/* Design tokens & components ported from the takevalue Onpage Audit mockup. */

:root {
  --bg: #F4F6F4;
  --surface: #FFFFFF;
  --surface-2: #FAFBFA;
  --ink: #0B1410;
  --ink-2: #1F2A24;
  --muted: #5B6B62;
  --muted-2: #8A968F;
  --line: #E4E8E5;
  --line-2: #EDF0EE;
  --primary: #02AE24;
  --primary-ink: #017218;
  --cyan: #10F0FC;
  --neon: #39FF14;
  --neon-ink: #0B7A0B;
  --grad: linear-gradient(180deg, #39FF14 0%, #10F0FC 100%);
  --grad-soft: linear-gradient(180deg, rgba(57,255,20,0.18) 0%, rgba(16,240,252,0.18) 100%);
  --grad-h: linear-gradient(90deg, #39FF14 0%, #10F0FC 100%);
  --warn: #F0A500;
  --warn-bg: #FFF6E2;
  --err: #D6483A;
  --err-bg: #FCE9E6;
  --info-bg: #E5FBFD;
  --good-bg: #E9FCE5;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;

  --shadow-1: 0 1px 0 rgba(11,20,16,0.04), 0 1px 2px rgba(11,20,16,0.04);
  --shadow-2: 0 8px 24px -12px rgba(11,20,16,0.18);

  /* The hero card is a "spotlight" tile and must stay dark in both
     themes — the radial neon glows and white type only read well on a
     dark background. */
  --hero-bg: #0B1410;
  --hero-fg: #FFFFFF;
  --hero-fg-muted: rgba(255, 255, 255, 0.7);
  --hero-fg-faint: rgba(255, 255, 255, 0.6);
  --hero-code-bg: rgba(255, 255, 255, 0.08);

  --sans: 'Source Sans 3', 'Source Sans Pro', system-ui, -apple-system, sans-serif;
  --display: 'Raleway', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}

[data-theme="dark"] {
  --bg: #0B1410;
  --surface: #121C17;
  --surface-2: #1A2620;
  --ink: #F2F6F3;
  --ink-2: #D6DED9;
  --muted: #9AA8A1;
  --muted-2: #6E7B74;
  --line: #1F2A24;
  --line-2: #182219;
  --primary: #39FF14;
  --primary-ink: #39FF14;
  --neon-ink: #6EE085;
  --warn-bg: #2A2113;
  --err-bg: #2A1815;
  --info-bg: #0F2A2C;
  --good-bg: #102516;
  --shadow-1: 0 1px 0 rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.4);
  --shadow-2: 0 8px 24px -12px rgba(0,0,0,0.6);
}

/* Dark-mode badge text overrides — the light-mode brand colors (dark
   green / dark brown / dark teal) lose all contrast on the matching
   dark-mode background tints. */
[data-theme="dark"] .badge.warn,
[data-theme="dark"] .badge.warning { color: #F5B65A; }
[data-theme="dark"] .badge.info,
[data-theme="dark"] .badge.notice  { color: #5BE0E8; }
[data-theme="dark"] .badge.err,
[data-theme="dark"] .badge.critical { color: #FF7E72; }
[data-theme="dark"] .flag.high     { color: #FF7E72; }
[data-theme="dark"] .flag.medium   { color: #F5B65A; }
[data-theme="dark"] .flag.low      { color: #5BE0E8; }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 {
  font-family: var(--display);
  margin: 0;
  letter-spacing: -0.01em;
  color: var(--ink);
}
button { font-family: inherit; }
a { color: var(--primary-ink); }
::selection { background: var(--neon); color: var(--ink); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted-2); }

/* App shell */
.app {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow-y: auto;
}
.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 14px;
  border-bottom: 1px solid var(--line-2);
  text-decoration: none;
  color: inherit;
}
.sidebar .brand .logo {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: var(--grad);
  display: grid; place-items: center;
  font-family: var(--display);
  font-weight: 800;
  color: #0B1410;
  font-size: 14px;
  letter-spacing: -0.04em;
}
.sidebar .brand .name { display: flex; flex-direction: column; line-height: 1.05; }
.sidebar .brand .name .b { font-family: var(--display); font-weight: 600; font-size: 14px; }
.sidebar .brand .name .b strong { font-weight: 800; }
.sidebar .brand .name .sub {
  font-size: 11px; color: var(--muted);
  letter-spacing: 0.04em; text-transform: uppercase;
}

.proj-switch-wrap { position: relative; }
.proj-switch {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  cursor: pointer;
  font: inherit;
  color: inherit;
  text-align: left;
}
.proj-switch:hover { border-color: var(--muted-2); }
.proj-switch .ps-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.proj-switch .ps-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--neon);
  box-shadow: 0 0 0 3px rgba(57,255,20,0.18);
  flex: none;
}
.proj-switch .ps-name {
  font-weight: 600; font-size: 13px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.proj-switch .ps-url { font-family: var(--mono); font-size: 11px; color: var(--muted); }

.proj-menu {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px);
  z-index: 50;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-2);
  padding: 6px;
  display: flex; flex-direction: column; gap: 4px;
}
.proj-menu[hidden] { display: none; }
.proj-menu-list {
  display: flex; flex-direction: column; gap: 2px;
  max-height: 240px; overflow-y: auto;
}
.proj-menu-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 8px; border-radius: 6px;
  text-decoration: none; color: var(--ink-2);
}
.proj-menu-item:hover { background: var(--surface-2); }
.proj-menu-item.active { background: var(--surface-2); }
.proj-menu-item .pmi-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--line); flex: none;
}
.proj-menu-item.active .pmi-dot {
  background: var(--neon);
  box-shadow: 0 0 0 3px rgba(57,255,20,0.18);
}
.proj-menu-item .pmi-text {
  display: flex; flex-direction: column; min-width: 0; line-height: 1.2;
}
.proj-menu-item .pmi-name {
  font-size: 13px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.proj-menu-item .pmi-dom {
  font-family: var(--mono); font-size: 10.5px; color: var(--muted);
}
.proj-menu-empty {
  padding: 10px 8px; font-size: 12.5px; color: var(--muted); text-align: center;
}
.proj-menu-add {
  display: flex; align-items: center; gap: 6px;
  width: 100%; padding: 7px 8px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 6px; cursor: pointer;
  font: inherit; font-size: 12.5px; font-weight: 600; color: var(--ink-2);
}
.proj-menu-add:hover { border-color: var(--muted-2); }
.proj-menu-create {
  display: flex; flex-direction: column; gap: 6px; padding: 4px 2px 2px;
}
.proj-menu-create[hidden] { display: none; }
.proj-menu-create input {
  padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--surface-2); color: var(--ink);
  font: inherit; font-size: 12.5px;
}
.proj-menu-create input:focus { outline: none; border-color: var(--primary); }
.proj-menu-create button {
  padding: 7px 10px; border: 0; border-radius: 6px;
  background: var(--grad); color: #0B1410;
  font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer;
}

/* Topbar crawl switcher — pick which stored crawl is shown across all views. */
.crawl-switch-wrap { position: relative; }
.crawl-switch-wrap .cs-label { font-size: 12.5px; }
.crawl-menu {
  position: absolute; right: 0; top: calc(100% + 6px);
  z-index: 50; min-width: 260px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-2);
  padding: 6px;
  display: flex; flex-direction: column; gap: 2px;
  max-height: 320px; overflow-y: auto;
}
.crawl-menu[hidden] { display: none; }
.crawl-menu-head {
  font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted); padding: 4px 8px 6px;
}
.crawl-menu-item {
  display: flex; flex-direction: column; gap: 1px; line-height: 1.25;
  padding: 7px 8px; border-radius: 6px;
  text-decoration: none; color: var(--ink-2);
}
.crawl-menu-item:hover { background: var(--surface-2); }
.crawl-menu-item.active { background: var(--surface-2); }
.crawl-menu-item .cmi-date { font-size: 13px; font-weight: 600; }
.crawl-menu-item.active .cmi-date { color: var(--ink); }
.crawl-menu-item .cmi-file {
  font-family: var(--mono); font-size: 10.5px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.nav-section { display: flex; flex-direction: column; gap: 2px; }
.nav-label {
  font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted-2);
  padding: 8px 10px 4px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 500;
  border: 1px solid transparent;
  position: relative;
  text-decoration: none;
}
.nav-item:hover { background: var(--surface-2); }
.nav-item.active {
  background: var(--surface-2);
  color: var(--ink);
  border-color: var(--line);
}
.nav-item.active::before {
  content: '';
  position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px;
  background: var(--grad);
  border-radius: 0 3px 3px 0;
}
.nav-item .nv-ico { width: 16px; height: 16px; flex: none; color: var(--muted); }
.nav-item.active .nv-ico { color: var(--primary); }
.nav-item .nv-count {
  margin-left: auto; font-size: 11px;
  color: var(--muted); font-variant-numeric: tabular-nums;
}
.nav-item .nv-soon {
  margin-left: auto;
  font-size: 10px; padding: 1px 6px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--muted);
}

.side-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line-2); }
.side-foot .score-card {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex; flex-direction: column; gap: 6px;
}
.side-foot .score-card .sc-head {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--display); font-weight: 700; font-size: 13px;
}
.side-foot .score-card .sc-bar {
  height: 4px; background: var(--line-2); border-radius: 999px;
}
.side-foot .score-card .sc-bar > i {
  display: block; height: 100%; background: var(--grad-h); border-radius: 999px;
}
.side-credits { font-size: 11px; color: var(--muted-2); padding: 6px 10px; }

/* Top bar */
.topbar {
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 0 24px;
  display: flex; align-items: center; gap: 16px;
  position: sticky; top: 0; z-index: 20;
}
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.crumbs .c-here { color: var(--ink); font-weight: 600; }
.crumbs .sep { color: var(--muted-2); }
.topbar .spacer { flex: 1; }
.top-search {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 999px;
  padding: 6px 12px;
  width: 280px;
  color: var(--muted);
  font-size: 13px;
}
.top-search input {
  background: transparent; border: 0; outline: 0;
  font-family: inherit; font-size: 13px;
  color: var(--ink); width: 100%;
}
.top-search kbd {
  border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px;
  font-family: var(--mono); font-size: 10px; color: var(--muted);
  background: var(--surface);
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  line-height: 1.2;
  transition: transform .08s ease, background .12s ease;
  text-decoration: none;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--ink); background: var(--surface-2); }
.btn.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.primary:hover { background: #000; }
.btn.cta {
  background: var(--grad);
  color: #0B1410;
  border-color: transparent;
  font-weight: 700;
  box-shadow: 0 6px 18px -10px rgba(57,255,20,0.6);
}
.btn.cta:hover { filter: brightness(1.03); }
.btn.sm { padding: 5px 10px; font-size: 12px; }

/* Avatar */
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--grad);
  display: grid; place-items: center;
  font-family: var(--display); font-weight: 700; font-size: 12px;
  color: #0B1410;
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--line);
}
.topbar-user {
  font-family: var(--display); font-weight: 600; font-size: 13px;
  color: var(--ink);
  max-width: 200px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Page */
.page {
  padding: 24px;
  display: flex; flex-direction: column;
  gap: 20px;
  max-width: 1480px;
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
}
.card .card-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-2);
  display: flex; align-items: center; gap: 10px;
}
.card .card-head h3 {
  font-size: 14px; font-weight: 600;
  font-family: var(--display);
}
.card .card-head .ch-sub { font-size: 12px; color: var(--muted); }
.card .card-body { padding: 18px; }

/* Hero */
.hero {
  background: var(--hero-bg);
  color: var(--hero-fg);
  border-radius: var(--radius-lg);
  padding: 28px;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(800px 300px at 100% -10%, rgba(16,240,252,0.2), transparent 60%),
    radial-gradient(600px 240px at 0% 110%, rgba(57,255,20,0.18), transparent 60%);
  pointer-events: none;
}
.hero h2 { color: var(--hero-fg); font-size: 22px; font-weight: 700; }
.hero .h-sub { color: var(--hero-fg-muted); font-size: 13px; margin-top: 4px; }
.hero code { background: var(--hero-code-bg); color: var(--hero-fg); }
.hero .hero-meta { color: var(--hero-fg-faint); }
.hero .hero-row {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 24px; position: relative; z-index: 1;
}

/* Pills */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); border-radius: 999px;
  padding: 4px 10px; font-size: 12px; color: var(--muted);
  background: var(--surface-2);
}
.pill.on-dark {
  background: rgba(57,255,20,0.12);
  border-color: rgba(57,255,20,0.3);
  color: #39FF14;
}

/* KPI */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex; flex-direction: column; gap: 6px;
  position: relative; overflow: hidden;
}
.kpi .k-lbl {
  font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--muted); font-weight: 600;
}
.kpi .k-val {
  font-family: var(--display);
  font-size: 32px; font-weight: 700; letter-spacing: -0.02em;
}
.kpi .k-foot {
  font-size: 12px; color: var(--muted);
  display: flex; align-items: center; gap: 6px;
}
.kpi.err .k-val { color: var(--err); }
.kpi.warn .k-val { color: #8A6300; }
.kpi.ok .k-val { color: var(--primary-ink); }

/* Severity pip */
.sev { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.sev.err, .sev.critical { background: var(--err); }
.sev.warn, .sev.warning { background: var(--warn); }
.sev.info, .sev.notice { background: var(--cyan); }
.sev.ok { background: var(--neon); }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11.5px; font-weight: 600;
  line-height: 1.4;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.err, .badge.critical { color: var(--err); background: var(--err-bg); }
.badge.warn, .badge.warning { color: #8A6300; background: var(--warn-bg); }
.badge.ok { color: var(--neon-ink); background: var(--good-bg); }
.badge.info, .badge.notice { color: #066D74; background: var(--info-bg); }
.badge.neutral { color: var(--muted); background: var(--surface-2); border-color: var(--line); }

/* Filter chips */
.filter-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 12.5px; font-weight: 500;
  cursor: pointer;
}
.chip:hover { border-color: var(--muted-2); }
.chip.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip .c-count {
  color: var(--muted); font-variant-numeric: tabular-nums;
}
.chip.active .c-count { color: var(--bg); opacity: 0.7; }

/* Status code colors */
.status-code { font-family: var(--mono); font-weight: 600; font-size: 12.5px; }
.status-code.s2 { color: var(--primary-ink); }
.status-code.s3 { color: #8A6300; }
.status-code.s4 { color: var(--err); }
.status-code.s5 { color: var(--err); }

/* Donut */
.donut-wrap {
  position: relative; display: grid; place-items: center;
  width: 160px; height: 160px;
}
.donut-wrap .center {
  position: absolute; inset: 0;
  display: grid; place-items: center; text-align: center;
}
.donut-wrap .center .v {
  font-family: var(--display);
  font-size: 28px; font-weight: 700;
}
.donut-wrap .center .l {
  font-size: 11px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.08em;
}

/* Legend row */
.legend-row {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12.5px;
}
.legend-row .lr-left { display: flex; align-items: center; gap: 8px; }
.legend-row .lr-color { width: 10px; height: 10px; border-radius: 2px; }
.legend-row .lr-val { font-family: var(--mono); color: var(--muted); }

/* Findings list */
.finding-list { list-style: none; padding: 0; margin: 0; }
.finding {
  background: var(--surface);
  border-top: 1px solid var(--line-2);
}
.finding:first-child { border-top: 0; }
.finding > details > summary {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  cursor: pointer;
  list-style: none;
}
.finding > details > summary::-webkit-details-marker { display: none; }
.finding .f-title { flex: 1; font-weight: 600; font-size: 13.5px; color: var(--ink); }
.finding .f-count { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.finding .f-body { padding: 0 18px 16px 60px; color: var(--muted); }
.finding .f-body .f-desc { margin: 0 0 10px; font-size: 12.5px; }
.finding .f-body ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 3px; }
.finding .f-body ul li {
  font-family: var(--mono); font-size: 12.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.finding .f-body ul li a { color: var(--ink-2); text-decoration: none; }
.finding .f-body ul li a:hover { color: var(--primary-ink); text-decoration: underline; }
.finding .f-body .more { color: var(--muted-2); font-style: italic; }
.finding .c-ico {
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; flex: none;
  background: var(--good-bg); color: var(--neon-ink);
}
.finding.warning .c-ico, .finding.warn .c-ico { background: var(--warn-bg); color: #8A6300; }
.finding.critical .c-ico, .finding.err .c-ico { background: var(--err-bg); color: var(--err); }
.finding.notice .c-ico, .finding.info .c-ico { background: var(--info-bg); color: #066D74; }

/* Upload card */
.upload-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  padding: 24px;
}
.file-drop {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 40px;
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color .15s, background .15s;
  text-align: center;
  gap: 8px;
}
.file-drop:hover { border-color: var(--primary); background: var(--good-bg); }
.file-drop input[type=file] { display: none; }
.file-drop-headline { font-family: var(--display); font-size: 15px; font-weight: 700; }
.file-drop-sub { color: var(--muted); font-size: 13px; }
.file-drop .drop-ico {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--grad); color: #0B1410;
  display: grid; place-items: center; margin-bottom: 6px;
}

.thresholds {
  margin-top: 16px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
}
.thresholds summary {
  cursor: pointer; color: var(--muted); font-weight: 600; font-size: 13px;
}
.thresholds[open] summary { color: var(--ink); margin-bottom: 14px; }
.threshold-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}
.threshold-grid label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 11.5px; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--muted); font-weight: 600;
}
.threshold-grid input {
  background: var(--surface); border: 1px solid var(--line);
  color: var(--ink); padding: 8px 10px; border-radius: 6px;
  font-family: var(--mono); font-size: 13px;
}
.threshold-grid input:focus { outline: 2px solid var(--neon); outline-offset: -1px; border-color: transparent; }

/* Checks overview tile */
.check-tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 4px;
}
.check-tile strong { font-family: var(--display); font-weight: 700; font-size: 13.5px; }
.check-tile span { color: var(--muted); font-size: 12.5px; }
.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

/* Flash messages */
.flash { list-style: none; padding: 0; margin: 0 0 16px; display: flex; flex-direction: column; gap: 6px; }
.flash li {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--primary);
  font-size: 13px;
}
.flash li.flash-error { border-left-color: var(--err); }

/* Empty state */
.empty-state {
  background: var(--surface);
  border: 1px dashed var(--line);
  padding: 36px;
  text-align: center;
  border-radius: var(--radius);
  color: var(--muted);
}

/* Raw JSON */
.raw-pre {
  background: #0B1410;
  color: #D6DED9;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
  overflow-x: auto;
  max-height: 520px;
}

.spacer { flex: 1; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }
.row { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1; }

/* Loading overlay — full-screen while uploads/analysis are running.
   The slash glides horizontally across a sweep area. As it travels
   left → right it WIPES the caption away (clip-path inset from the left);
   when it returns right → left a new caption is REVEALED behind it
   (clip-path inset from the right). */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11, 20, 16, 0.94);
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 36px;
  z-index: 200;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.loading-overlay.active { display: flex; }
.loading-overlay::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(800px 320px at 100% -10%, rgba(16,240,252,0.20), transparent 60%),
    radial-gradient(620px 260px at 0% 110%, rgba(57,255,20,0.18), transparent 60%);
  pointer-events: none;
}
.loading-message {
  color: #fff;
  font-family: var(--display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  position: relative;
  z-index: 1;
}
.loader-sweep {
  position: relative;
  width: min(620px, 86vw);
  height: 180px;
  margin: 12px 0;
  z-index: 1;
}
.loader-sub {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 14px;
  color: rgba(255, 255, 255, 0.78);
  letter-spacing: 0.04em;
  text-align: center;
  padding: 0 8px;
  clip-path: inset(0 0 0 0);
  white-space: nowrap;
  overflow: hidden;
}
.loader-sub.hiding {
  animation: loader-hide 1.3s cubic-bezier(0.45, 0, 0.55, 1) forwards;
}
.loader-sub.revealing {
  animation: loader-reveal 1.3s cubic-bezier(0.45, 0, 0.55, 1) forwards;
}
.loading-slash {
  position: absolute;
  top: 50%;
  font-family: var(--mono);
  font-size: 104px;
  font-weight: 800;
  color: var(--neon);
  text-shadow: 0 0 32px rgba(57, 255, 20, 0.65),
               0 0 64px rgba(57, 255, 20, 0.35);
  line-height: 1;
  user-select: none;
  z-index: 2;
  transform: translate(-50%, -50%);
  left: 0%;
}
.loading-slash.forward {
  animation: loader-slash-forward 1.3s cubic-bezier(0.45, 0, 0.55, 1) forwards;
}
.loading-slash.backward {
  animation: loader-slash-backward 1.3s cubic-bezier(0.45, 0, 0.55, 1) forwards;
}
@keyframes loader-slash-forward {
  0%   { left: 0%; }
  100% { left: 100%; }
}
@keyframes loader-slash-backward {
  0%   { left: 100%; }
  100% { left: 0%; }
}
/* Hiding: clip from the left as the slash sweeps right. */
@keyframes loader-hide {
  0%   { clip-path: inset(0 0 0 0%); }
  100% { clip-path: inset(0 0 0 100%); }
}
/* Revealing: start fully clipped from the right and uncover as the
   slash sweeps back left. */
@keyframes loader-reveal {
  0%   { clip-path: inset(0 100% 0 0); }
  100% { clip-path: inset(0 0 0 0); }
}

/* Fun-Fact panel — sits below the sweep animation and cross-fades
   between SEO trivia. */
.loader-fact {
  position: relative;
  z-index: 1;
  width: min(640px, 88vw);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: var(--radius);
  padding: 16px 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 380ms ease, transform 380ms ease;
}
.loader-fact.in  { opacity: 1; transform: translateY(0); }
.loader-fact.out { opacity: 0; transform: translateY(-6px); }
.loader-fact-label {
  font-family: var(--mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--neon);
  align-self: flex-start;
}
.loader-fact-body { display: flex; flex-direction: column; gap: 4px; }
.loader-fact-title {
  font-family: var(--display);
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.01em;
  line-height: 1.3;
}
.loader-fact-text {
  font-size: 13px;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.78);
}

/* Findings table — per-finding sortable / filterable view.
   The wrap sits inside .f-body (which already provides the indent
   under the severity-coloured icon column) so it must not re-introduce
   that padding itself. */
.finding-table-wrap {
  padding: 0;
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}
.finding-filter {
  width: 100%;
  max-width: 320px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 6px;
  font-size: 13px;
  font-family: var(--sans);
}
.finding-filter:focus {
  outline: 2px solid var(--neon);
  outline-offset: -1px;
  border-color: transparent;
}
.finding-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  font-size: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
/* Column widths: URL grows to fill, the rest stay compact. */
.finding-table col.col-url       { width: auto; }
.finding-table col.col-status    { width: 96px; }
.finding-table col.col-indexable { width: 110px; }
.finding-table col.col-depth     { width: 80px; }
.finding-table col.col-words     { width: 110px; }

.finding-table thead th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
  padding: 10px 12px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  user-select: none;
  white-space: nowrap;
}
.finding-table thead th.num { text-align: right; }
.finding-table thead th.sortable { cursor: pointer; }
.finding-table thead th.sortable:hover { color: var(--ink); }
.finding-table thead th .sort-ind {
  display: inline-block;
  margin-left: 6px;
  opacity: 0.45;
  font-family: var(--mono);
}
.finding-table thead th.asc .sort-ind,
.finding-table thead th.desc .sort-ind {
  opacity: 1;
  color: var(--primary);
}
.finding-table tbody td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line-2);
  vertical-align: middle;
  font-size: 12.5px;
  color: var(--ink-2);
}
.finding-table tbody tr:last-child td { border-bottom: 0; }
.finding-table tbody td.num {
  text-align: right;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}
.finding-table tbody td.url {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
}
.finding-table tbody td.url a:not(.open-ext) {
  display: block;
  min-width: 0;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--ink-2);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.finding-table tbody td.url a:not(.open-ext):hover { color: var(--primary-ink); text-decoration: underline; }
.finding-table tbody tr:hover td { background: var(--surface-2); }
.finding-table .empty-row td {
  text-align: center;
  color: var(--muted);
  font-style: italic;
  padding: 12px;
}

/* Responsive */
@media (max-width: 1024px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .topbar { padding: 0 14px; }
  .top-search { display: none; }
}

/* Print / PDF — strip the app chrome so the report prints as a clean
   document via the browser's "Save as PDF". */
@media print {
  .sidebar,
  .topbar,
  #loader,
  .report-actions,
  .flash { display: none !important; }
  body, .app, main { display: block !important; background: #fff !important; color: #000 !important; }
  .page { padding: 0 !important; }
  .card, .kpi, .report-head { break-inside: avoid; box-shadow: none !important; border-color: #ddd !important; }
  a { color: inherit !important; text-decoration: none !important; }
  table { font-size: 11px; }
  .export-modal { display: none !important; }
}

/* Export selection modal — pick findings to export, one sheet each. */
dialog.export-modal {
  border: 0;
  border-radius: var(--radius);
  padding: 0;
  width: 92%;
  max-width: 560px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-2);
}
dialog.export-modal::backdrop { background: rgba(11, 20, 16, 0.55); backdrop-filter: blur(3px); }
.export-form { display: flex; flex-direction: column; max-height: 82vh; }
.export-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.export-head h3 { margin: 0; font-family: var(--display); font-size: 16px; }
.export-head .btn.ghost { margin-left: auto; padding: 4px 8px; }
.export-tools { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 18px; border-bottom: 1px solid var(--line-2); }
.export-body { overflow: auto; padding: 8px 18px; }
.export-group-label {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--muted); margin: 12px 0 4px;
}
.export-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; cursor: pointer; }
.export-row input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; accent-color: var(--primary); flex: none; }
.export-row .ex-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.export-row .ex-count { color: var(--muted-2); font-size: 12px; white-space: nowrap; }
.export-foot { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-top: 1px solid var(--line); }
.export-foot .ex-hint { font-size: 12px; flex: 1; }

/* "Open in new tab" icon shown next to a listed URL. */
.open-ext {
  flex: none;
  display: inline-flex;
  align-items: center;
  color: var(--muted-2);
  text-decoration: none;
  vertical-align: middle;
  opacity: .7;
  transition: color .15s ease, opacity .15s ease;
}
.open-ext:hover { color: var(--neon); opacity: 1; }
