/* Tenura — visual design layer.
 *
 * Loaded after styles.css and deliberately overrides it: same class names, new
 * look. The language is a calm, light dashboard — soft neutral page, white
 * cards with hairline borders, one dark primary action, and colour reserved for
 * meaning (risk severity, status). It keeps the old stylesheet underneath so
 * every JS-generated class still has a home if one is missed here.
 */

:root {
  /* One brand colour. Deep teal-navy, used for actions, links and active
   * states; colour is otherwise reserved for meaning (risk severity, status). */
  --brand: #0f4c6b;
  --brand-dark: #0b3c5d;
  --brand-soft: #e8f1f5;
  --brand-ring: rgba(15, 76, 107, 0.18);
  --brand-2: #0f4c6b;

  --bg: #f5f7f8;
  --surface: #ffffff;
  --surface-2: #f8fafb;
  --ink: #12222b;
  --ink-soft: #3d4d55;
  --muted: #68777f;
  --line: #e7ecee;
  --line-strong: #dbe3e6;

  --high: #c0392b;
  --high-soft: #fdeceb;
  --medium: #a86a08;
  --medium-soft: #fdf4e6;
  --low: #1f8a5b;
  --low-soft: #e7f6ee;

  --primary: #0f4c6b;
  --primary-hover: #0b3c5d;

  --radius: 14px;
  --radius-sm: 10px;
  --radius-xs: 8px;
  --radius-lg: 18px;

  --shadow-xs: 0 1px 2px rgba(17, 24, 39, 0.05);
  --shadow-sm: 0 1px 3px rgba(17, 24, 39, 0.06);
  --shadow: 0 10px 30px rgba(17, 24, 39, 0.07);
  --shadow-lg: 0 24px 60px rgba(17, 24, 39, 0.14);

  --sidebar-w: 244px;
  --topbar-h: 68px;

  --c-low: #bfe3d3;
  --c-moderate: #f3ddb8;
  --c-high: #f4c7c2;
  --c-unknown: #d7dde0;
}

/* ---------------------------------------------------------------- base ---- */

body {
  background: var(--bg);
  background-image: none;
  color: var(--ink);
}

h1, h2, h3 { letter-spacing: -0.02em; color: var(--ink); }

a { color: var(--brand-dark); }

/* ---------------------------------------------------------- app shell ----- */

.app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  flex: none;
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}

.side-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  text-decoration: none;
}
.side-brand img { height: 28px; width: auto; display: block; }

.side-label {
  margin: 6px 8px -6px;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #9aa1ad;
}

.side-nav { display: flex; flex-direction: column; gap: 2px; }

.side-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  border-radius: 9px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.14s ease, color 0.14s ease;
}
.side-item svg { width: 18px; height: 18px; flex: none; stroke-width: 1.9; }
.side-item:hover { background: var(--surface-2); color: var(--ink); }
.side-item.is-active { background: var(--brand-soft); color: var(--brand-dark); }
.side-item.is-active svg { color: var(--brand-dark); }

.side-card {
  margin-top: auto;
  padding: 15px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.side-card strong { display: block; font-size: 0.9rem; color: var(--ink); margin-bottom: 4px; }
.side-card p { margin: 0; font-size: 0.78rem; color: var(--muted); line-height: 1.5; }

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ------------------------------------------------------------- topbar ----- */

.topbar {
  height: var(--topbar-h);
  flex: none;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 26px;
  background: rgba(243, 244, 246, 0.82);
  backdrop-filter: saturate(1.3) blur(10px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 30;
}

.top-search {
  position: relative;
  flex: 0 1 360px;
  display: flex;
  align-items: center;
}
.top-search svg {
  position: absolute;
  left: 13px;
  width: 16px;
  height: 16px;
  color: var(--muted);
  pointer-events: none;
}
.top-search input {
  width: 100%;
  padding: 10px 52px 10px 38px;
  font: inherit;
  font-size: 0.9rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
}
.top-search input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-ring); }
.top-search .key {
  position: absolute;
  right: 8px;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 3px 7px;
}

.topbar .nav-spacer { flex: 1; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  color: var(--muted);
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.14s, color 0.14s, background 0.14s;
}
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn:hover { border-color: var(--brand); color: var(--brand-dark); background: var(--brand-soft); }

/* --------------------------------------------------------------- page ----- */

.page { padding: 26px 26px 56px; width: 100%; max-width: 1360px; }

.page-head {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}
.page-head h1 { margin: 0; font-size: clamp(1.4rem, 2.6vw, 1.7rem); font-weight: 750; }
.page-head .page-sub { margin: 5px 0 0; color: var(--muted); font-size: 0.9rem; }

/* -------------------------------------------------------------- buttons --- */

.btn {
  border-radius: var(--radius-sm);
  font-weight: 650;
  padding: 11px 18px;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 1px 2px rgba(17, 24, 39, 0.18);
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:active { transform: translateY(1px); }
.btn-ghost, .btn-google {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  color: var(--ink);
}
.btn-ghost:hover, .btn-google:hover { background: var(--surface-2); border-color: var(--muted); color: var(--ink); }
.btn-new {
  background: var(--primary);
  color: #fff;
  border-radius: 9px;
  padding: 9px 15px;
  font-size: 0.88rem;
  font-weight: 650;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}
.btn-new:hover { background: var(--primary-hover); }
.btn-new svg { width: 15px; height: 15px; }

.ghost-btn { border-radius: 9px; }

/* --------------------------------------------------------------- panels --- */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
}

/* --------------------------------------------------------- stat cards ----- */

.stat-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}
.stat-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
}
.stat-card .sc-ico {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink-soft);
}
.stat-card .sc-ico svg { width: 19px; height: 19px; }
.stat-card .sc-label { font-size: 0.78rem; color: var(--muted); font-weight: 600; }
.stat-card .sc-value { font-size: 1.5rem; font-weight: 780; line-height: 1.1; letter-spacing: -0.02em; }
.stat-card.is-danger .sc-ico { background: var(--high-soft); border-color: #f6d3d3; color: var(--high); }
.stat-card.is-warn .sc-ico { background: var(--medium-soft); border-color: #f2e0c1; color: var(--medium); }
.stat-card.is-brand .sc-ico { background: var(--brand-soft); border-color: #cfe0e7; color: var(--brand-dark); }

/* ----------------------------------------------------------- chart grid --- */

.chart-grid {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 16px;
  margin-bottom: 18px;
}
.chart-card { padding: 18px 18px 14px; }
.chart-head { display: flex; align-items: center; gap: 9px; margin-bottom: 6px; }
.chart-head .ch-ico { width: 17px; height: 17px; color: var(--muted); }
.chart-head h2 { margin: 0; font-size: 1rem; font-weight: 700; }
.chart-body { position: relative; }
.chart-body svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-empty { padding: 40px 10px; text-align: center; color: var(--muted); font-size: 0.9rem; }

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-top: 10px;
  font-size: 0.72rem;
  color: var(--muted);
}
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 9px; height: 9px; border-radius: 50%; flex: none; }

.axis-label { fill: #9aa1ad; font-size: 9px; font-weight: 600; }
.grid-line { stroke: #eef0f4; stroke-width: 1; }

.chart-tip {
  position: absolute;
  pointer-events: none;
  transform: translate(-50%, -110%);
  background: var(--ink);
  color: #fff;
  border-radius: 9px;
  padding: 7px 10px;
  font-size: 0.72rem;
  line-height: 1.35;
  white-space: nowrap;
  box-shadow: var(--shadow);
  opacity: 0;
  transition: opacity 0.12s;
}
.chart-tip.show { opacity: 1; }
.chart-tip b { display: block; font-size: 0.76rem; }

/* -------------------------------------------------------------- table ----- */

.table-card { overflow: hidden; }
.table-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.table-toolbar .tt-title {
  font-size: 0.95rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.table-toolbar .tt-title svg { width: 16px; height: 16px; color: var(--muted); }
.table-toolbar .tt-spacer { flex: 1; }
.tt-search { position: relative; display: flex; align-items: center; }
.tt-search svg { position: absolute; left: 11px; width: 15px; height: 15px; color: var(--muted); }
.tt-search input {
  font: inherit;
  font-size: 0.85rem;
  padding: 8px 12px 8px 32px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--ink);
  width: 190px;
}
.tt-search input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-ring); }
.tt-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-soft);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  padding: 8px 13px;
  cursor: pointer;
}
.tt-btn svg { width: 15px; height: 15px; }
.tt-btn:hover { border-color: var(--muted); color: var(--ink); }
.tt-btn.is-active { border-color: var(--brand); color: var(--brand-dark); background: var(--brand-soft); }

.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.87rem; }
.data-table thead th {
  text-align: left;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #9aa1ad;
  padding: 12px 16px;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
.data-table tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
  vertical-align: middle;
  white-space: nowrap;
}
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr { transition: background 0.12s; }
.data-table tbody tr:hover { background: var(--surface-2); }
.data-table .cell-title {
  color: var(--ink);
  font-weight: 650;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}
.data-table .cell-title a { color: var(--ink); text-decoration: none; }
.data-table .cell-title a:hover { color: var(--brand-dark); text-decoration: underline; }
.data-table .col-check { width: 40px; }
.data-table input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--brand); }

.row-avatar {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}
.row-avatar .avatar { width: 28px; height: 28px; font-size: 0.72rem; }

/* Tags (project / status chips in the table) */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 4px 11px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  white-space: nowrap;
}
.tag .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.tag.t-low { color: #1f6ad6; background: #eaf1fe; border-color: #d3e2fd; }
.tag.t-moderate { color: #b5730a; background: #fdf3e3; border-color: #f2e0c1; }
.tag.t-high { color: #c02a2a; background: #fdecec; border-color: #f6d3d3; }
.tag.t-unknown { color: #6b7280; background: #f1f2f5; border-color: #e6e8ed; }
.tag.t-plain { color: var(--ink-soft); background: var(--surface-2); border-color: var(--line-strong); }
.tag.t-inline { color: #1f6ad6; background: #eaf1fe; border-color: #d3e2fd; }
.tag.t-build { color: #1f8a5b; background: #e7f6ee; border-color: var(--ok-line, #bfe6d1); }

.value-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.value-chip svg { width: 13px; height: 13px; color: var(--muted); }

/* Pagination */
.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  padding: 13px 16px;
  border-top: 1px solid var(--line);
  font-size: 0.83rem;
  color: var(--muted);
}
.pager .pager-spacer { flex: 1; }
.pager select {
  font: inherit;
  font-size: 0.83rem;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
}
.pager-pages { display: flex; align-items: center; gap: 4px; }
.pager-pages button {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
}
.pager-pages button:hover { background: var(--surface-2); }
.pager-pages button.is-active { background: var(--ink); color: #fff; }
.pager-pages button:disabled { opacity: 0.4; cursor: default; }
.pager-pages .ellipsis { color: var(--muted); padding: 0 2px; }

/* --------------------------------------------------------- empty states -- */

.empty-block {
  padding: 44px 24px;
  text-align: center;
}
.empty-block .empty-icon { margin: 0 auto 14px; }
.empty-block h2 { margin: 0 0 6px; font-size: 1.15rem; }
.empty-block p { margin: 0 auto 18px; color: var(--muted); max-width: 46ch; font-size: 0.92rem; }

/* ------------------------------------------------------------- history ---- */

.history-list { display: grid; gap: 12px; }

/* --------------------------------------------------------------- auth ----- */

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
}
.auth-pane {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 48px 32px;
}
.auth-pane .auth-inner { width: min(420px, 100%); margin: 0 auto; }
.auth-brand { display: inline-flex; margin-bottom: 26px; }
.auth-brand img { height: 30px; }

.auth-aside {
  position: relative;
  overflow: hidden;
  background: #0b3c5d;
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 56px 54px;
}
.auth-aside .aa-eyebrow {
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #a9d4de;
  margin-bottom: 14px;
}
.auth-aside h2 { color: #fff; font-size: clamp(1.5rem, 3vw, 2.1rem); line-height: 1.15; margin: 0 0 14px; max-width: 16ch; }
.auth-aside p { color: rgba(255, 255, 255, 0.78); font-size: 0.98rem; max-width: 40ch; margin: 0; }
.auth-aside .aa-points { list-style: none; margin: 26px 0 0; padding: 0; display: grid; gap: 13px; }
.auth-aside .aa-points li { display: flex; gap: 11px; align-items: flex-start; font-size: 0.92rem; color: rgba(255, 255, 255, 0.9); }
.auth-aside .aa-points svg { width: 18px; height: 18px; flex: none; color: #8fe3b6; margin-top: 2px; }
.auth-aside .aa-glow {
  position: absolute;
  width: 420px; height: 420px;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.5;
  pointer-events: none;
}
.auth-aside .aa-glow.g1 { background: #17627f; top: -120px; right: -100px; }
.auth-aside .aa-glow.g2 { background: #0f4c6b; bottom: -140px; left: -80px; }

.auth { padding: 0; }
.auth-card {
  width: 100%;
  border: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
}
.auth-card h1 { font-size: clamp(1.5rem, 3vw, 1.85rem); margin: 0 0 6px; }
.auth-card .auth-sub { margin: 0 0 22px; color: var(--muted); font-size: 0.95rem; }
.field input { background: var(--surface); border-color: var(--line-strong); border-radius: var(--radius-sm); }
.field input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-ring); }

.auth-footnote {
  margin: 30px 0 0;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.6;
}
.auth-footnote strong { color: var(--ink-soft); }
.auth-footnote a { color: var(--brand-dark); font-weight: 600; text-decoration: none; }
.auth-footnote a:hover { text-decoration: underline; }

@media (max-width: 900px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .auth-pane { padding: 36px 20px; }
}

/* ------------------------------------------------------------- landing ---- */

.m-nav {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(243, 244, 246, 0.85);
  backdrop-filter: saturate(1.3) blur(10px);
  border-bottom: 1px solid var(--line);
}
.m-nav .m-nav-inner {
  width: min(1180px, 100% - 44px);
  margin-inline: auto;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 13px 0;
}
.m-nav .brand img { height: 28px; }
.m-nav .m-links { display: flex; gap: 22px; margin-left: 14px; }
.m-nav .m-links a { color: var(--muted); font-size: 0.9rem; font-weight: 600; text-decoration: none; }
.m-nav .m-links a:hover { color: var(--ink); }
@media (max-width: 760px) { .m-nav .m-links { display: none; } }

.m-wrap { width: min(1180px, 100% - 44px); margin-inline: auto; }

.m-hero { padding: 54px 0 8px; }
.m-hero .m-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brand-dark);
  background: var(--brand-soft);
  border: 1px solid #cfe0e7;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
}
.m-hero .m-eyebrow .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); }
.m-hero h1 { font-size: clamp(2rem, 4.6vw, 3.1rem); line-height: 1.04; margin: 18px 0 0; max-width: 18ch; letter-spacing: -0.035em; }
.m-hero .lede { margin: 16px 0 0; max-width: 60ch; font-size: 1.06rem; color: var(--ink-soft); }
.hero-points li { color: var(--ink-soft); }
.hero-points svg { color: var(--brand); }

/* ------------------------------------------------------- severity/finding - */

.finding { border-radius: 12px; }
.stat { border-radius: 11px; }
.risk-low .risk-dot { background: var(--brand); }

/* ------------------------------------------------------------- filter ----- */

.filter-wrap { position: relative; }
.filter-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 40;
  min-width: 196px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.filter-opt {
  display: block;
  width: 100%;
  text-align: left;
  appearance: none;
  border: 0;
  background: none;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink-soft);
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
}
.filter-opt:hover { background: var(--surface-2); }
.filter-opt.is-active { background: var(--brand-soft); color: var(--brand-dark); }

/* Stroke weight for injected outline icons (CSS beats the attribute-less svg). */
.side-item svg { stroke-width: 1.9; }
.icon-btn svg,
.top-search svg,
.tt-search svg,
.stat-card .sc-ico svg,
.chart-head .ch-ico { stroke-width: 2; }

/* --------------------------------------------------------------- misc ----- */

.tenura-status { border-radius: 12px; }

/* App pages own their width now that they live inside the shell. */
.history, .profile { max-width: 100%; padding: 0; }

.app-foot {
  margin-top: 44px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.84rem;
}
.app-foot p { margin: 0 0 8px; max-width: 82ch; }
.app-foot p:last-child { margin-bottom: 0; }
.app-foot strong { color: var(--ink-soft); }
.app-foot a { color: var(--brand-dark); font-weight: 600; text-decoration: none; }
.app-foot a:hover { text-decoration: underline; }

/* Compact screens: the drawer and content rules live in the responsive
 * section at the end of this file. */

/* ======================================================================
 * Brand, focus and shared primitives
 * ==================================================================== */

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* One visible focus treatment for every interactive element. */
:where(a, button, input, textarea, select, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
  border-radius: 6px;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 100;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--brand-dark);
  font-weight: 650;
  text-decoration: none;
  transition: top 0.15s ease;
}
.skip-link:focus { top: 12px; }

/* Wordmark: a small teal document mark plus the name. Replaces the old
 * blue-to-violet PNG so the logo follows the same token as everything else. */
.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--brand);
  text-decoration: none;
  flex: none;
}
.brand-mark { width: 30px; height: 30px; display: block; flex: none; }
.brand-word {
  color: var(--ink);
  font-size: 1.16rem;
  font-weight: 780;
  letter-spacing: -0.03em;
  line-height: 1;
}
.brand-lockup:hover .brand-word { color: var(--brand-dark); }

.side-brand.brand-lockup { padding: 6px 8px; }
.side-brand .brand-mark { width: 27px; height: 27px; }
.side-brand .brand-word { font-size: 1.08rem; }
.auth-brand.brand-lockup { margin-bottom: 26px; }
.auth-brand .brand-mark { width: 32px; height: 32px; }
.auth-brand .brand-word { font-size: 1.24rem; }

/* ======================================================================
 * Landing page
 * ==================================================================== */

.lp-body { background: var(--bg); }

.lp-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(245, 247, 248, 0.9);
  backdrop-filter: saturate(1.25) blur(10px);
  border-bottom: 1px solid var(--line);
}
.lp-header-inner {
  width: min(1180px, 100% - 40px);
  margin-inline: auto;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 13px 0;
}
.lp-nav { display: flex; align-items: center; gap: 4px; margin-left: 12px; }
.lp-nav a {
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  padding: 8px 11px;
  border-radius: 8px;
  transition: background 0.14s ease, color 0.14s ease;
}
.lp-nav a:hover { background: var(--surface); color: var(--brand-dark); }

.lp-hero { padding: 68px 0 52px; }
.lp-hero-inner {
  width: min(1180px, 100% - 40px);
  margin-inline: auto;
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 0.98fr);
  gap: 54px;
  align-items: center;
}

.lp-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brand-dark);
  background: var(--brand-soft);
  border: 1px solid #cfe0e7;
  padding: 6px 11px;
  border-radius: 999px;
}
.lp-eyebrow .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); }

.lp-hero h1 {
  font-size: clamp(2.1rem, 4.8vw, 3.4rem);
  line-height: 1.04;
  letter-spacing: -0.04em;
  font-weight: 760;
  margin: 20px 0 0;
  max-width: 17ch;
}
.lp-lede {
  margin: 18px 0 0;
  max-width: 52ch;
  font-size: 1.06rem;
  line-height: 1.65;
  color: var(--ink-soft);
}
.lp-cta-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.lp-micro { margin: 14px 0 0; font-size: 0.82rem; color: var(--muted); }

/* Product preview ---------------------------------------------------- */

.lp-preview-wrap { position: relative; }
.lp-preview {
  position: relative;
  z-index: 1;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(18, 34, 43, 0.12);
  overflow: hidden;
}
.lp-preview-glow {
  position: absolute;
  inset: 14% 6% -8% 6%;
  background: radial-gradient(closest-side, rgba(15, 76, 107, 0.14), transparent 72%);
  filter: blur(18px);
  z-index: 0;
  pointer-events: none;
}
.lp-preview-top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.lp-dots { display: inline-flex; gap: 5px; }
.lp-dots i { width: 7px; height: 7px; border-radius: 50%; background: #d5dde0; display: block; }
.lp-preview-title { font-size: 0.78rem; font-weight: 700; color: var(--muted); }
.lp-preview-top .pill { margin-left: auto; }

.lp-preview-body { padding: 16px; display: grid; gap: 12px; }

.lp-mini-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.lp-mini-stat {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  min-width: 0;
}
.lp-mini-ico {
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink-soft);
}
.lp-mini-ico svg { width: 15px; height: 15px; }
.lp-mini-ico.is-danger { background: var(--high-soft); border-color: #f2cfcb; color: var(--high); }
.lp-mini-ico.is-warn { background: var(--medium-soft); border-color: #efdfc6; color: var(--medium); }
.lp-mini-ico.is-ok { background: var(--low-soft); border-color: #cbe7da; color: var(--low); }
.lp-mini-stat span { display: block; font-size: 0.66rem; font-weight: 650; color: var(--muted); line-height: 1.2; }
.lp-mini-stat b { display: block; font-size: 1.18rem; font-weight: 780; line-height: 1.15; letter-spacing: -0.02em; }

.lp-flag {
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 11px 12px;
  background: var(--surface);
}
.lp-flag-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 5px;
}
.lp-flag-head > span:first-child { font-size: 0.82rem; font-weight: 700; color: var(--ink); }
.lp-flag p { margin: 0; font-size: 0.78rem; line-height: 1.5; color: var(--muted); }

.lp-missing { border-top: 1px dashed var(--line-strong); padding-top: 11px; }
.lp-missing h3 { margin: 0 0 7px; font-size: 0.78rem; font-weight: 700; color: var(--ink); }
.lp-missing ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.lp-missing li {
  position: relative;
  padding-left: 20px;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.45;
}
.lp-missing li::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 5px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 2px solid var(--medium);
}

/* Pills --------------------------------------------------------------- */

.pill {
  display: inline-flex;
  align-items: center;
  flex: none;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
  white-space: nowrap;
}
.pill-high { background: var(--high-soft); color: var(--high); border-color: #f2cfcb; }
.pill-warn { background: var(--medium-soft); color: var(--medium); border-color: #efdfc6; }
.pill-ok { background: var(--low-soft); color: var(--low); border-color: #cbe7da; }

/* Trust strip --------------------------------------------------------- */

.lp-trust { border-block: 1px solid var(--line); background: var(--surface); }
.lp-trust-inner {
  width: min(1180px, 100% - 40px);
  margin-inline: auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  padding: 22px 0;
}
.lp-trust-item { display: flex; align-items: flex-start; gap: 11px; }
.lp-trust-ico {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--brand-soft);
  color: var(--brand-dark);
  border: 1px solid #cfe0e7;
}
.lp-trust-ico svg { width: 17px; height: 17px; }
.lp-trust-item span:last-child { font-size: 0.82rem; color: var(--muted); line-height: 1.5; }
.lp-trust-item strong { display: block; color: var(--ink); font-size: 0.86rem; margin-bottom: 1px; }

/* Section rhythm ------------------------------------------------------ */

.lp-section { padding: 76px 0; }
.lp-section-head { width: min(720px, 100% - 40px); margin: 0 auto 38px; text-align: center; }
.lp-kicker {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brand-dark);
  margin-bottom: 10px;
}
.lp-section-head h2, .lp-sample h2, .lp-why h2, .lp-final h2 {
  margin: 0;
  font-size: clamp(1.55rem, 3vw, 2.15rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
  font-weight: 740;
}
.lp-section-head p {
  margin: 12px auto 0;
  max-width: 60ch;
  color: var(--muted);
  font-size: 0.98rem;
}

/* Steps --------------------------------------------------------------- */

.lp-steps {
  width: min(1180px, 100% - 40px);
  margin-inline: auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.lp-step {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  padding: 24px 22px;
}
.lp-step-ico {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--brand-soft);
  color: var(--brand-dark);
  border: 1px solid #cfe0e7;
  margin-bottom: 18px;
}
.lp-step-ico svg { width: 20px; height: 20px; }
.lp-step-num {
  position: absolute;
  top: 22px;
  right: 22px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: #b7c3c8;
}
.lp-step h3 { margin: 0 0 7px; font-size: 1.02rem; font-weight: 700; }
.lp-step p { margin: 0; color: var(--muted); font-size: 0.88rem; line-height: 1.6; }

/* What we check ------------------------------------------------------- */

.lp-checks { background: var(--surface); border-block: 1px solid var(--line); }
.lp-feature-grid {
  width: min(980px, 100% - 40px);
  margin-inline: auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.lp-feature {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  padding: 24px 22px;
}
.lp-feature-ico {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  margin-bottom: 16px;
}
.lp-feature-ico svg { width: 20px; height: 20px; }
.lp-feature-ico.is-danger { background: var(--high-soft); color: var(--high); border: 1px solid #f2cfcb; }
.lp-feature-ico.is-warn { background: var(--medium-soft); color: var(--medium); border: 1px solid #efdfc6; }
.lp-feature h3 { margin: 0 0 7px; font-size: 1.08rem; font-weight: 720; }
.lp-feature > p { margin: 0; color: var(--muted); font-size: 0.9rem; line-height: 1.6; }
.lp-example {
  margin-top: 16px;
  padding: 13px 14px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.lp-example p { margin: 8px 0 0; font-size: 0.84rem; line-height: 1.55; color: var(--ink-soft); }

/* Sample -------------------------------------------------------------- */

.lp-sample { padding: 10px 0 76px; }
.lp-sample-inner {
  width: min(1180px, 100% - 40px);
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 30px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
}
.lp-sample p { margin: 8px 0 0; color: var(--muted); font-size: 0.9rem; max-width: 56ch; }

/* Why an account ------------------------------------------------------ */

.lp-why-inner {
  width: min(1180px, 100% - 40px);
  margin-inline: auto;
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: 48px;
  align-items: center;
}
.lp-why-copy > p { margin: 12px 0 0; color: var(--muted); font-size: 0.95rem; }
.lp-why-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.lp-why-list li {
  display: flex;
  gap: 13px;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  padding: 16px 18px;
}
.lp-why-ico {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--brand-soft);
  color: var(--brand-dark);
  border: 1px solid #cfe0e7;
}
.lp-why-ico svg { width: 18px; height: 18px; }
.lp-why-list strong { display: block; font-size: 0.92rem; color: var(--ink); margin-bottom: 2px; }
.lp-why-list span span, .lp-why-list li div span { font-size: 0.84rem; color: var(--muted); line-height: 1.5; }

/* FAQ ----------------------------------------------------------------- */

.lp-faq { padding-top: 0; }
.lp-faq-list { width: min(820px, 100% - 40px); margin-inline: auto; display: grid; gap: 10px; }
.lp-faq-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}
.lp-faq-item summary {
  list-style: none;
  cursor: pointer;
  padding: 16px 18px;
  font-size: 0.94rem;
  font-weight: 660;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.lp-faq-item summary::-webkit-details-marker { display: none; }
.lp-faq-item summary::after {
  content: "+";
  flex: none;
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--muted);
  line-height: 1;
  transition: transform 0.18s ease;
}
.lp-faq-item[open] summary::after { content: "\2212"; }
.lp-faq-item[open] summary { color: var(--brand-dark); }
.lp-faq-item p {
  margin: 0;
  padding: 0 18px 17px;
  color: var(--muted);
  font-size: 0.89rem;
  line-height: 1.65;
  max-width: 72ch;
}

/* Final band ---------------------------------------------------------- */

.lp-final { padding: 0 0 76px; }
.lp-final-inner {
  width: min(1180px, 100% - 40px);
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 34px 36px;
  border-radius: var(--radius);
  background: var(--brand-dark);
  color: #fff;
}
.lp-final h2 { color: #fff; font-size: clamp(1.35rem, 2.6vw, 1.8rem); }
.lp-final p { margin: 7px 0 0; color: rgba(255, 255, 255, 0.78); font-size: 0.92rem; }
.lp-final-btn {
  flex: none;
  background: #fff;
  color: var(--brand-dark) !important;
  border: 1px solid #fff;
}
.lp-final-btn:hover { background: var(--brand-soft); border-color: var(--brand-soft); }

/* Footer -------------------------------------------------------------- */

.lp-footer { background: var(--surface); border-top: 1px solid var(--line); }
.lp-footer-inner {
  width: min(1180px, 100% - 40px);
  margin-inline: auto;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: 40px;
  padding: 40px 0 30px;
}
.lp-footer-brand p { margin: 14px 0 0; max-width: 54ch; font-size: 0.8rem; color: var(--muted); line-height: 1.6; }
.lp-footer-links { display: flex; flex-wrap: wrap; gap: 8px 18px; align-content: start; justify-content: flex-end; }
.lp-footer-links a { color: var(--muted); font-size: 0.84rem; font-weight: 600; text-decoration: none; }
.lp-footer-links a:hover { color: var(--brand-dark); }
.lp-footer-base {
  width: min(1180px, 100% - 40px);
  margin-inline: auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 18px;
  padding: 16px 0 26px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.78rem;
}

/* Analyser page ------------------------------------------------------- */

.an-hero { padding-top: 46px; }
.an-hero h1 { max-width: 22ch; }

.result-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}
.result-stats .stat-card { padding: 12px 13px; gap: 10px; box-shadow: none; }
.result-stats .sc-ico { width: 34px; height: 34px; border-radius: 9px; }
.result-stats .sc-label { font-size: 0.72rem; }
.result-stats .sc-value { font-size: 1.22rem; }

.detail-score .stat-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.detail-score .stat-card { padding: 12px 13px; gap: 10px; box-shadow: none; }
.detail-score .sc-ico { width: 34px; height: 34px; border-radius: 9px; }
.detail-score .sc-label { font-size: 0.72rem; }
.detail-score .sc-value { font-size: 1.22rem; }

/* Auth pages pick up the new brand; keep the pane generous on mobile. */
.auth-aside .aa-glow { opacity: 0.35; }
.auth-aside h2 { color: #fff; }

/* ======================================================================
 * Landing / analyser responsive
 * ==================================================================== */

@media (max-width: 1020px) {
  .lp-hero-inner { grid-template-columns: 1fr; gap: 40px; }
  .lp-hero h1 { max-width: 18ch; }
  .lp-preview-wrap { max-width: 560px; }
  .lp-why-inner { grid-template-columns: 1fr; gap: 30px; }
}

@media (max-width: 860px) {
  .lp-nav { display: none; }
  .lp-header-inner { gap: 10px; }
  .lp-trust-inner { grid-template-columns: 1fr; gap: 16px; }
  .lp-steps { grid-template-columns: 1fr; }
  .lp-feature-grid { grid-template-columns: 1fr; }
  .lp-footer-inner { grid-template-columns: 1fr; gap: 24px; }
  .lp-footer-links { justify-content: flex-start; }
  .lp-sample-inner, .lp-final-inner { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 620px) {
  .lp-hero { padding: 40px 0 36px; }
  .lp-section { padding: 52px 0; }
  .lp-header-inner, .lp-hero-inner, .lp-trust-inner, .lp-steps,
  .lp-feature-grid, .lp-sample-inner, .lp-why-inner, .lp-faq-list,
  .lp-final-inner, .lp-footer-inner, .lp-footer-base,
  .lp-section-head { width: min(100% - 32px, 1180px); }
  .lp-mini-stats { grid-template-columns: 1fr; }
  .lp-cta-row .btn { flex: 1 1 auto; justify-content: center; }
  .lp-final-inner { padding: 26px 22px; }
  .lp-sample-inner { padding: 22px; }
  .result-stats { grid-template-columns: 1fr; }
  .m-nav .m-links { display: none; }
}

/* ======================================================================
 * App shell: sidebar account block, mobile drawer and top bar
 * ==================================================================== */

.side-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.drawer-close {
  display: none;
  width: 40px;
  height: 40px;
  flex: none;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}
.drawer-close:hover { background: var(--surface-2); color: var(--ink); }
.drawer-close:focus { outline: 2px solid var(--brand-dark); outline-offset: 2px; }
.drawer-close svg { width: 18px; height: 18px; }

.side-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding-right: 2px;
}
.side-scroll .side-card { margin-top: auto; }

.side-user {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.side-user-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 5px 7px;
  border-radius: 10px;
  color: inherit;
  text-decoration: none;
}
.side-user-link:hover { background: var(--surface-2); }
.avatar-sm { width: 36px; height: 36px; font-size: 0.82rem; }
.side-user-id { min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.side-user-id strong {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.86rem;
  color: var(--ink);
}
.side-user-id > span {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.74rem;
  color: var(--muted);
}
.side-logout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  min-height: 38px;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 650;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}
.side-logout svg { width: 16px; height: 16px; flex: none; }
.side-logout:hover {
  background: var(--high-soft);
  border-color: #f2cfcb;
  color: var(--high);
}

/* Top bar: search on the left on desktop; hamburger and wordmark on mobile. */
.nav-toggle,
.topbar-brand,
.top-search-toggle { display: none; }

.nav-toggle {
  width: 44px;
  height: 44px;
  flex: none;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}
.nav-toggle svg { width: 20px; height: 20px; }
.nav-toggle:hover { border-color: var(--brand); color: var(--brand-dark); background: var(--brand-soft); }

.topbar-brand {
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: var(--brand);
  text-decoration: none;
}
.topbar-brand .brand-mark { width: 26px; height: 26px; }
.topbar-brand .brand-word { font-size: 1.04rem; }

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(18, 34, 43, 0.44);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}
body.drawer-open .drawer-backdrop {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
body.drawer-open { overflow: hidden; }

/* Guest/member copy reserves its line while auth resolves. */
.lp-cta-row { min-height: 44px; }
.lp-micro { min-height: 1.25em; }

@media (max-width: 1023px) {
  .app { display: block; }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 70;
    width: min(320px, 86vw);
    height: 100dvh;
    padding: 16px;
    overflow: hidden;
    overscroll-behavior: contain;
    border-right: 1px solid var(--line);
    background: var(--surface);
    box-shadow: 0 24px 60px rgba(18, 34, 43, 0.22);
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }
  .sidebar.is-open { transform: translateX(0); }
  .drawer-close { display: grid; }

  .main-col { width: 100%; min-width: 0; }
  .topbar { height: 60px; padding: 0 12px; gap: 8px; }
  .nav-toggle { display: grid; }
  .topbar-brand { display: inline-flex; }
  .topbar .nav-spacer { flex: 1; }
  .page { padding: 20px 16px 48px; }

  .stat-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .chart-grid { grid-template-columns: 1fr; }
  .table-scroll { max-width: 100%; -webkit-overflow-scrolling: touch; }

  .btn,
  .btn-new,
  .tt-btn,
  .ghost-btn,
  .icon-btn,
  .nav-toggle,
  .acct-btn { min-height: 44px; }
  .icon-btn { width: 44px; height: 44px; }
  .side-item { min-height: 44px; padding: 11px 12px; }
  .side-logout { min-height: 44px; }
  .drawer-close { min-width: 44px; min-height: 44px; }
}

@media (max-width: 640px) {
  .top-search { display: none; }
  .topbar.has-search .top-search-toggle { display: grid; }
  .topbar.search-open .top-search {
    display: flex;
    position: absolute;
    top: calc(100% + 6px);
    left: 12px;
    right: 12px;
    flex: none;
    padding: 8px;
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    box-shadow: var(--shadow);
    z-index: 5;
  }
  .topbar.search-open .top-search .key { display: none; }
  .topbar.search-open .top-search input { padding-right: 14px; }

  .stat-card { padding: 12px; gap: 10px; }
  .stat-card .sc-ico { width: 34px; height: 34px; border-radius: 9px; }
  .stat-card .sc-ico svg { width: 17px; height: 17px; }
  .stat-card .sc-label { font-size: 0.72rem; line-height: 1.25; }
  .stat-card .sc-value { font-size: 1.28rem; }

  .table-toolbar { padding: 12px; gap: 8px; position: relative; }
  .tt-search { flex: 1 1 130px; }
  .tt-search input { width: 100%; min-height: 44px; }
  /* Anchor the menu to the toolbar, not the narrow filter button. Otherwise
   * the menu's right edge follows a button on the left of a wrapped row and
   * most of it opens off-screen. */
  .filter-wrap { position: static; }
  .filter-menu { top: calc(100% - 1px); right: 12px; }

  .page-head .btn-new { flex: 1 1 auto; justify-content: center; }
}

.analyse-account-link { flex: none; }

/* A top bar with no search has nothing to show on desktop; the mobile one
 * still carries the hamburger and wordmark. */
@media (min-width: 1024px) {
  .topbar:not([data-shell-search]) { display: none; }
}
@media (max-width: 640px) {
  .topbar.search-open .top-search input { min-height: 44px; }
}

/* The analyser uses the same component inside the app shell; only the page
 * header above it is different. */
.app-analyser .input-panel { margin-top: 0; }
.app-analyser .eyebrow { margin-bottom: 8px; }

/* ---------------------------------------------------------- admin page ---- */

.admin-page-head { align-items: flex-start; }
.admin-refresh { flex: none; }
.admin-refresh.is-spinning svg { animation: admin-spin 0.85s linear infinite; }

.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 18px;
  margin-bottom: 12px;
}
.admin-range { margin: 0; }
.admin-updated {
  color: var(--muted);
  font-size: 0.79rem;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.admin-note {
  margin: 0 0 16px;
  padding: 11px 13px;
  border: 1px solid #d7e5ea;
  border-radius: 10px;
  background: var(--brand-soft);
  color: var(--ink-soft);
  font-size: 0.79rem;
  line-height: 1.5;
}
.admin-note code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.73rem;
  color: var(--brand-dark);
}

.admin-error {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding: 11px 13px;
  border: 1px solid #f0cdcd;
  border-radius: 10px;
  background: #fdf2f2;
  color: #9f2d2d;
  font-size: 0.84rem;
}
.admin-error[hidden] { display: none; }
.admin-retry {
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  color: #8a2323;
  background: #fff;
  border: 1px solid #efc4c4;
  border-radius: 7px;
  padding: 5px 9px;
  cursor: pointer;
}

.admin-stat-cards .sc-sub {
  margin-top: 3px;
  min-height: 1em;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.25;
  font-weight: 500;
}
.admin-chart-grid { align-items: stretch; }
.admin-legend { margin-top: 12px; }
.admin-donut-body,
.admin-source-body {
  min-height: 232px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.admin-donut-wrap {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 18px 28px;
}
.admin-donut-wrap svg { width: 180px; height: 180px; flex: none; }
.admin-donut-value { fill: var(--ink); font-size: 29px; font-weight: 750; }
.admin-donut-label { fill: var(--muted); font-size: 10px; font-weight: 600; }
.admin-donut-legend {
  display: flex;
  flex-direction: column;
  gap: 9px;
  color: var(--ink-soft);
  font-size: 0.82rem;
}
.admin-donut-legend span { display: inline-flex; align-items: center; gap: 8px; }
.admin-donut-legend i { width: 10px; height: 10px; border-radius: 3px; }
.admin-donut-legend b { color: var(--ink); }

.admin-source-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 8px 2px;
}
.admin-source-row { width: 100%; }
.admin-source-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 600;
}
.admin-source-head b { color: var(--ink); font-variant-numeric: tabular-nums; }
.admin-source-track {
  height: 9px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  overflow: hidden;
}
.admin-source-track span { display: block; height: 100%; border-radius: inherit; }

.admin-users-card { margin-bottom: 0; }
.admin-users-table { min-width: 760px; }
.admin-table-scroll { max-width: 100%; -webkit-overflow-scrolling: touch; }
.admin-user-cell {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
}
.admin-user-cell strong { font-weight: 650; }
.admin-email { color: var(--ink-soft); }
.admin-empty-row { padding: 26px 8px; text-align: center; color: var(--muted); font-size: 0.88rem; }
.admin-sort { display: flex; align-items: center; }
.admin-select {
  font: inherit;
  font-size: 0.82rem;
  color: var(--ink-soft);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  padding: 8px 10px;
  cursor: pointer;
}
.admin-select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-ring); }

.skeleton {
  display: block;
  border-radius: 6px;
  background: linear-gradient(90deg, #edf1f3 25%, #f7f9fa 37%, #edf1f3 63%);
  background-size: 400% 100%;
  animation: admin-shimmer 1.4s ease infinite;
}
.skeleton-value { width: 78px; height: 25px; margin: 1px 0 5px; }
.skeleton-line { width: 100%; height: 12px; }
.skeleton-line.sm { width: 70%; height: 10px; }
.skeleton-chart { width: 100%; height: 218px; }

@keyframes admin-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: 0 0; }
}
@keyframes admin-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 640px) {
  .admin-page-head { margin-bottom: 16px; }
  .admin-refresh { width: 100%; justify-content: center; }
  .admin-toolbar { align-items: flex-start; }
  .admin-updated { width: 100%; }
  .admin-note { font-size: 0.75rem; }
  .admin-donut-wrap { gap: 10px 18px; }
  .admin-donut-wrap svg { width: 154px; height: 154px; }
  .admin-donut-value { font-size: 25px; }
  .admin-sort { flex: 1 1 100%; }
  .admin-select { width: 100%; min-height: 44px; }
}
