/* AgentDiff dashboard: calm light theme (#22). Neutral surfaces; color carries meaning only
   (red critical/failed, orange high, amber medium, blue low, green completed/advice, violet unknown).
   One token set, a small spacing scale (4/8/12/16/24/32), sentence-case labels, 1px borders.
   Severity and status always pair color with text. No decorative motion: only the scanning
   spinner animates, and not under prefers-reduced-motion. Fonts are self-hosted (Geist, SIL OFL). */
@font-face { font-family: "Geist"; src: url("/static/fonts/geist-latin.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("/static/fonts/geist-mono-latin.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap; }

:root {
  color-scheme: light;
  --bg: #FAFAFA; --nav: #FFFFFF; --card: #FFFFFF; --card-2: #F4F4F5; --btn: #FFFFFF; --btn-hover: #F4F4F5;
  --line: #E7E7EA; --line-2: #F0F0F2; --line-strong: #D4D4D8;
  --head: #18181B; --fg: #27272A; --fg-2: #3F3F46; --muted: #52525B; --dim: #63636B;
  --link: #1D4ED8; --link-hover: #1E3A8A;
  --accent: #18181B; --accent-hover: #27272A; --accent-fg: #FFFFFF; --accent-text: #1D4ED8; --active: #F4F4F5; --focus: #2563EB;
  --crit: #D92D20; --crit-text: #B42318; --crit-bg: #FEF3F2;
  --high: #F97316; --high-text: #B93815; --high-bg: #FFF6ED;
  --med: #CA8A04; --med-text: #854D0E; --med-bg: #FEFCE8;
  --low: #6172F3; --low-text: #3538CD; --low-bg: #EEF4FF;
  --ok: #17B26A; --ok-text: #067647; --ok-bg: #ECFDF3; --ok-fg: #054F31; --ok-line: #D1FADF;
  --unk: #7A5AF8; --unk-text: #5925DC; --unk-bg: #F4F3FF; --unk-line: #D9D6FE;
  --warn: #FEF7C3; --warn-text: #93370D; --warn-bg: #FFFAEB; --warn-line: #FEDF89;
  --track: #EEEEF0; --viz-added: #71717A; --viz-removed: #D4D4D8;
  --env-text: #713F12; --failed-row: #FFFBFA; --advice-bg: #F6FEF9;
  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --r-lg: 12px; --r-md: 8px; --r-sm: 6px;
}
/* Dark appearance (A4.4): the same design and the same meanings on dark surfaces. Chosen by the user
   (static/theme.js sets data-theme="dark"); Light above stays the default. Only tokens change here. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0B0B0E; --nav: #111114; --card: #15151A; --card-2: #1E1E24; --btn: #1A1A20; --btn-hover: #24242B;
  --line: #2A2A31; --line-2: #222228; --line-strong: #3F3F48;
  --head: #FAFAFA; --fg: #E4E4E7; --fg-2: #D4D4D8; --muted: #A1A1AA; --dim: #9D9DA6;
  --link: #8AB4FF; --link-hover: #B4CFFF;
  --accent: #FAFAFA; --accent-hover: #E4E4E7; --accent-fg: #0B0B0E; --accent-text: #8AB4FF; --active: #24242B; --focus: #6EA8FE;
  --crit: #F04438; --crit-text: #FDA29B; --crit-bg: #3B1613;
  --high: #FB923C; --high-text: #FDBA74; --high-bg: #3A2212;
  --med: #EAB308; --med-text: #FDE047; --med-bg: #332B0B;
  --low: #8098F9; --low-text: #B2C4FD; --low-bg: #1E2445;
  --ok: #32D583; --ok-text: #75E0A7; --ok-bg: #0E2B1D; --ok-fg: #A6F4C5; --ok-line: #1D5138;
  --unk: #9B8AFB; --unk-text: #C3B9FE; --unk-bg: #261E4A; --unk-line: #463A80;
  --warn: #3D3412; --warn-text: #FEC84B; --warn-bg: #2A220A; --warn-line: #5E4B12;
  --track: #2A2A31; --viz-added: #A1A1AA; --viz-removed: #52525B;
  --env-text: #FDE68A; --failed-row: #1F1315; --advice-bg: #0E2219;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--link); text-decoration: none; text-underline-offset: 2px; }
a:hover { color: var(--link-hover); text-decoration: underline; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3, h4 { color: var(--head); margin: 0; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
h1 { font-size: 24px; letter-spacing: -0.01em; }
h2 { font-size: 17px; }
h3 { font-size: 18px; }
h4 { font-size: 15px; }
p { margin: 0 0 8px; }
code, .mono, .sha { font-family: var(--mono); font-size: 13px; }
.sha { color: var(--muted); }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.add { color: var(--fg); }
.del { color: var(--muted); }
.tag { display: inline-block; font-size: 12px; color: var(--muted); background: var(--card-2); border: 1px solid var(--line); border-radius: 999px; padding: 0 8px; line-height: 18px; }
.tag-new { color: var(--high-text); background: var(--high-bg); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -9999px; top: 8px; background: var(--card); color: var(--head); border: 1px solid var(--line-strong); border-radius: var(--r-sm); padding: 8px 12px; z-index: 10; }
.skip-link:focus { left: 8px; }
.icon { flex-shrink: 0; vertical-align: -3px; }
[hidden] { display: none !important; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--nav); border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 28px; padding: 22px 14px; position: sticky; top: 0; height: 100vh; }
.sidebar-head { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--head); font-weight: 700; font-size: 16px; }
.brand:hover { color: var(--head); text-decoration: none; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); display: grid; place-items: center; color: var(--accent-fg); flex-shrink: 0; }
.brand-mark svg { width: 16px; height: 16px; }
.env-badge { margin-left: auto; font-size: 11px; font-weight: 600; color: var(--env-text); background: var(--warn); padding: 1px 8px; border-radius: 999px; }
.bare-head .env-badge { margin-left: 0; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a, .nav-secondary { display: flex; align-items: center; gap: 12px; height: 38px; padding: 0 12px; border-radius: var(--r-md); color: var(--muted); font-weight: 500; }
.nav a:hover, .nav-secondary:hover { background: var(--card-2); color: var(--head); text-decoration: none; }
.nav a[aria-current="page"] { background: var(--active); color: var(--head); font-weight: 600; }
.nav a[aria-current="page"] .icon { color: var(--head); }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.nav-secondary { font-size: 14px; height: 38px; }
.account { display: flex; align-items: center; gap: 10px; padding: 8px 8px 0; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--card-2); border: 1px solid var(--line); display: grid; place-items: center; font-size: 13px; font-weight: 600; color: var(--fg); flex-shrink: 0; }
.account-name { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.account form { margin: 0; }
.theme-switch { display: inline-flex; align-self: flex-start; gap: 2px; padding: 3px; background: var(--card-2); border-radius: var(--r-md); }
.theme-switch button { height: 28px; padding: 0 12px; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--muted);
  font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; }
.theme-switch button:hover { color: var(--head); }
.theme-switch button[aria-pressed="true"] { background: var(--card); color: var(--head); box-shadow: inset 0 0 0 1px var(--line); }
.sidebar-foot .theme-switch { margin: 0 8px 4px; }
.bare-head .theme-switch { margin-left: auto; }
.link-button { background: none; border: 0; padding: 0; font: inherit; font-size: 13px; color: var(--link); cursor: pointer; }
.link-button:hover { text-decoration: underline; }
.content { min-width: 0; padding: 32px 40px 48px; }
.page { max-width: 1120px; margin: 0 auto; display: flex; flex-direction: column; gap: 28px; }

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-sub { margin: 4px 0 0; color: var(--muted); font-size: 14px; max-width: 760px; }
.back-link { font-size: 14px; color: var(--muted); }
.meta-line { margin: 4px 0 0; color: var(--muted); font-size: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.section { display: flex; flex-direction: column; gap: 12px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.section-head h2 { display: flex; align-items: center; gap: 8px; }
.count { font-size: 13px; font-weight: 500; color: var(--muted); background: var(--card-2); border-radius: 999px; padding: 0 9px; line-height: 22px; }
.section-sub { margin: -6px 0 0; color: var(--muted); font-size: 14px; }
.ov-controls { display: flex; justify-content: flex-end; gap: 16px; }
/* Disclosure heading: a chevron that turns when open, the heading beside it, and badges that wrap rather
   than squeeze the name. The state is still the native <details> one (keyboard and screen readers). */
.ov-summary { cursor: pointer; border-radius: var(--r-md); display: flex; align-items: center; gap: 10px; list-style: none; }
.ov-summary::-webkit-details-marker { display: none; }
.ov-summary::before { content: ""; flex-shrink: 0; width: 7px; height: 7px; margin: 0 2px 3px; border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted); transform: rotate(-45deg); }
details[open] > .ov-summary::before { margin-bottom: 4px; transform: rotate(45deg); }
.ov-summary h2 { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; min-width: 0; }
.ov-section > :not(summary) { margin-top: 12px; }
.scan-groups { display: flex; flex-direction: column; gap: 16px; }
.scan-group .ov-summary h2 { font-size: 15px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }

/* ---------- Overview: one answer first, then what needs attention, then totals ---------- */
.posture { display: flex; flex-direction: column; gap: 20px; }
.hero { display: flex; align-items: center; gap: 20px; }
.hero-text { flex: 1; min-width: 0; }
.hero h1 { font-size: 26px; letter-spacing: -0.02em; }
.hero-sub { margin: 6px 0 0; color: var(--fg-2); max-width: 760px; }
.attention-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.card-label { padding: 12px 20px; font-size: 13px; font-weight: 500; color: var(--muted); border-bottom: 1px solid var(--line-2); }
.attention-list { list-style: none; margin: 0; padding: 0; }
.attn-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 14px 20px; }
.attn-row + .attn-row { border-top: 1px solid var(--line-2); }
.attn-text { flex: 1 1 260px; min-width: 0; }
.attn-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.stats-tiles .stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px 20px; flex-direction: column; }
.stats-tiles .stat dt { font-size: 13px; }
.stats-tiles .stat dd { font-size: 22px; font-weight: 600; color: var(--head); }
.stat dd.t-crit { color: var(--crit-text); }
.stat dd.t-high { color: var(--high-text); }
.stat dd.t-warn { color: var(--unk-text); }
.view-switch { display: inline-flex; gap: 2px; padding: 3px; background: var(--card-2); border-radius: var(--r-md); align-self: flex-start; }
.view-switch a { padding: 5px 14px; border-radius: var(--r-sm); color: var(--muted); font-weight: 500; font-size: 14px; }
.view-switch a:hover { color: var(--head); text-decoration: none; }
.view-switch a[aria-current="page"] { background: var(--card); color: var(--head); box-shadow: inset 0 0 0 1px var(--line); text-decoration: none; }
.scan-row.has-action { display: flex; align-items: center; gap: 8px; }
.scan-row.has-action > .row-link { flex: 1; min-width: 0; }
.row-action { flex: 0 0 132px; display: flex; justify-content: flex-end; padding-right: 8px; }
/* Archived view (#42): archived pull requests, then archived scans grouped by repository and pull request. */
.list-title { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.archived-scan-group { display: flex; flex-direction: column; gap: 8px; }
/* Active Scans: one block per pull request; Archive PR sits in its header, wrapping below on narrow screens. */
.pr-group { padding-left: 16px; }  /* nested under its repository section */
.pr-group + .pr-group { margin-top: 12px; }
.pr-summary { flex-wrap: wrap; gap: 8px 12px; min-width: 0; }
.pr-summary .group-title { min-width: 0; overflow-wrap: anywhere; }
.pr-group > .pr-body { margin-top: 8px; display: flex; flex-direction: column; gap: 8px; }
.pr-actions { display: flex; justify-content: flex-end; }
.current-label { font-size: 13px; color: var(--muted); padding-right: 8px; }
/* Scan page: archive actions grouped by scope (this scan / the pull request), wrapping on narrow screens. */
.archive-groups { display: flex; flex-wrap: wrap; gap: 8px 32px; padding-top: 14px; border-top: 1px solid var(--line-2); }
.archive-group { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; min-width: 0; }
.archive-group-label { font-size: 13px; font-weight: 500; color: var(--head); }
.archive-group-note { flex-basis: 100%; font-size: 13px; color: var(--muted); }
.archive-group .current-label { padding-right: 0; }
.group-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; }
.archive-form { margin: 0; }
.archive-bar { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.button-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.footnote { margin: 0; color: var(--dim); font-size: 13px; }

/* ---------- Buttons ---------- */
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 14px;
  border-radius: var(--r-md); border: 1px solid var(--line-strong); background: var(--btn); color: var(--head); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap; }
.button:hover { background: var(--btn-hover); color: var(--head); text-decoration: none; }
.button-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.button-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-fg); }
.button-block { width: 100%; height: 44px; }
.button[disabled] { opacity: .45; cursor: default; }
.icon-button { width: 32px; height: 32px; display: inline-grid; place-items: center; border-radius: var(--r-sm); border: 1px solid var(--line);
  background: var(--btn); color: var(--fg-2); cursor: pointer; flex-shrink: 0; }
.icon-button:hover { color: var(--head); }
.icon-button.copied { color: var(--ok-text); }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs button { height: 32px; padding: 0 12px; border-radius: var(--r-md); border: 1px solid transparent; background: transparent; color: var(--muted);
  font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; }
.tabs button:hover { color: var(--head); background: var(--card-2); }
.tabs button[aria-pressed="true"] { background: var(--card); border-color: var(--line-strong); color: var(--head); }

/* ---------- Cards and lists ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px 24px; }
.row-list { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); display: flex; flex-direction: column; overflow: hidden; }
.row-list > li { border-radius: 0; }
.row-list > li + li { border-top: 1px solid var(--line-2); }
.row-link, .row-cols { display: grid; grid-template-columns: minmax(0, 1.5fr) 150px minmax(0, 1.2fr) 110px 150px; gap: 16px; align-items: center;
  padding: 12px 16px; color: inherit; }
/* Column labels above a row list (#22 table look); visual only, hidden where the cells stack. */
.row-head { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: var(--muted); }
.row-head .row-cols { flex: 1; min-width: 0; padding-top: 9px; padding-bottom: 9px; }
.row-head .row-time { color: var(--muted); }
.row-link:hover { background: var(--bg); text-decoration: none; color: inherit; }
.row-title { display: block; font-weight: 500; color: var(--head); overflow-wrap: anywhere; }
.row-sub { display: block; font-size: 13px; color: var(--dim); }
.row-time { font-size: 13px; color: var(--dim); text-align: right; }
.row-perms { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.scan-row-failed { background: var(--failed-row); }
.list-empty { padding: 16px; color: var(--muted); font-size: 14px; }
.repo-name { overflow-wrap: anywhere; }
.repo-owner { color: var(--dim); font-weight: 400; }

.repo-row, .repo-head { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.4fr) minmax(0, 1fr) 150px; gap: 16px; align-items: start; padding: 16px 20px; }
.repo-head { padding-top: 9px; padding-bottom: 9px; }
.repo-cell { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; font-size: 14px; }
.repo-main { flex-direction: column; align-items: flex-start; gap: 2px; }
/* The column headers label the cells on wide screens; each cell keeps its own label for screen readers,
   shown again on narrow screens where the columns stack. */
.repo-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.repo-note { width: 100%; font-size: 13px; color: var(--muted); }
.repo-time { justify-content: flex-end; font-size: 13px; color: var(--dim); }
.repo-head .repo-time { text-align: right; color: var(--muted); }

/* ---------- Badges, status, labels ---------- */
.sev { display: inline-block; font-size: 12px; font-weight: 600; line-height: 20px; padding: 0 9px; border-radius: 999px; white-space: nowrap; }
.sev-critical { background: var(--crit-bg); color: var(--crit-text); }
.sev-high { background: var(--high-bg); color: var(--high-text); }
.sev-medium { background: var(--med-bg); color: var(--med-text); }
.sev-low { background: var(--low-bg); color: var(--low-text); }
.counts { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--fg-2); white-space: nowrap; }
.status .icon { width: 15px; height: 15px; }
.status-completed .icon { color: var(--ok); }
.status-failed { color: var(--crit-text); }
.status-queued, .status-running { color: var(--low-text); }
.state { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--line-strong); }
.state-on::before { background: var(--ok); }
/* Unknown / Incomplete / Archived risk: a violet label shaped like the severity badges, always with text. */
.unknown-label { display: inline-block; font-size: 12px; font-weight: 600; line-height: 20px; padding: 0 9px; border-radius: 999px;
  background: var(--unk-bg); color: var(--unk-text); white-space: nowrap; }
.none-label { font-size: 13px; color: var(--muted); }
.change { display: inline-block; font-size: 13px; color: var(--fg-2); }
.change-del { color: var(--med-text); font-weight: 500; }
.t-crit { color: var(--crit-text); }
.t-high { color: var(--high-text); }
.t-warn { color: var(--unk-text); }
.t-ok { color: var(--ok-text); }

/* ---------- Summary card (overview posture and scan verdict) ---------- */
.summary { display: flex; flex-direction: column; gap: 18px; }
.summary-top { display: flex; gap: 18px; align-items: center; }
.summary-text { flex: 1; min-width: 0; }
.summary-text h2 { font-size: 18px; }
.summary-text p { margin: 4px 0 0; color: var(--fg-2); max-width: 760px; }
.summary-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.stats { display: flex; gap: 12px; flex-wrap: wrap; margin: 0; }
.stat { flex: 1 1 180px; background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--r-md); padding: 14px 18px; display: flex; flex-direction: column-reverse; justify-content: flex-end; }
.stat dt { font-size: 14px; color: var(--muted); }
.stat dd { margin: 0; font-size: 19px; font-weight: 500; color: var(--fg); font-variant-numeric: tabular-nums; }
.stat-of { font-size: 14px; color: var(--muted); }
.stat-meters { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.meter-row { display: grid; grid-template-columns: 64px 28px minmax(0, 1fr); gap: 8px; align-items: center; font-size: 13px; color: var(--muted); }
.error-text { font-family: var(--mono); font-size: 13px; color: var(--crit-text); white-space: pre-wrap; overflow-wrap: anywhere; margin: 6px 0 !important; }
.affected { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.affected li { display: inline-flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font-size: 14px; overflow-wrap: anywhere; }
.affected-count { font-variant-numeric: tabular-nums; color: var(--fg-2); }
.notice { display: flex; gap: 10px; align-items: flex-start; background: var(--card-2); color: var(--fg-2); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 16px; margin: 0; }
.notice a { color: inherit; text-decoration: underline; }
.notice-warn { background: var(--warn-bg); color: var(--warn-text); border-color: var(--warn-line); }
.notice-warn a { color: inherit; }
.remediation { display: flex; flex-direction: column; gap: 12px; }
.remediation h2 { display: flex; align-items: center; gap: 8px; margin: 0; }
.resolved-list { margin: 8px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }

/* ---------- Charts (server-rendered SVG; geometry in attributes, color here) ---------- */
.ring { position: relative; flex-shrink: 0; }
.ring-lg { width: 120px; height: 120px; }
.ring-sm { width: 76px; height: 76px; }
.ring-svg { width: 100%; height: 100%; overflow: visible; }
.ring-track { stroke: var(--track); }
.ring-seg.seg-critical { stroke: var(--crit); }
.ring-seg.seg-high { stroke: var(--high); }
.ring-seg.seg-medium, .ring-seg.seg-lower { stroke: var(--med); }
.ring-seg.seg-low { stroke: var(--low); }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.ring-value { font-size: 22px; font-weight: 600; line-height: 1; color: var(--head); font-variant-numeric: tabular-nums; }
.ring-lg .ring-value { font-size: 30px; }
.ring-label { max-width: 62%; margin-top: 3px; font-size: 9.5px; line-height: 1.2; color: var(--muted); }
.ring-sm .ring-label { display: none; }
.ring-ok .ring-track { stroke: var(--ok-line); }
.ring-ok .ring-value { color: var(--ok-text); }
.ring-unknown .ring-track { stroke: var(--unk-line); stroke-dasharray: 2.2 1.6; }
.ring-unknown .ring-value { color: var(--unk-text); }
.ring-outer-unknown { stroke: var(--unk); stroke-dasharray: 1.6 1.4; opacity: .8; }
.ring-spinner { stroke: var(--low); stroke-linecap: round; transform-origin: 21px 21px; animation: spin 1.15s linear infinite; }
.ring-pending .ring-value { color: var(--low-text); }
.meter { display: block; width: 100%; height: 6px; }
.meter-track { fill: var(--track); }
rect.seg-critical, rect.seg-risk { fill: var(--crit); }
rect.seg-high { fill: var(--high); }
rect.seg-medium, rect.seg-lower { fill: var(--med); }
rect.seg-low { fill: var(--low); }
rect.seg-added { fill: var(--viz-added); }
rect.seg-removed { fill: var(--viz-removed); }
rect.seg-clean { fill: var(--ok); }
rect.seg-failed { fill: var(--unk); }
rect.seg-pending { fill: var(--low); }
.stacked { display: block; width: 100%; height: 6px; border-radius: 3px; overflow: hidden; }
.mix { display: flex; flex-direction: column; gap: 8px; }
.mix-legend { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 0; font-size: 13px; color: var(--muted); }
.mix-legend strong { color: var(--fg); font-weight: 500; margin-right: 4px; }
.key { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; vertical-align: 1px; }
.key-risk { background: var(--crit); }
.key-clean { background: var(--ok); }
.key-failed { background: var(--unk); }
.key-pending { background: var(--low); }

/* ---------- Finding review ---------- */
.review { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 20px; align-items: start; }
.finding-groups { display: flex; flex-direction: column; gap: 8px; position: sticky; top: 24px; }
.finding-group { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 4px 8px; }
.finding-group > summary { display: flex; align-items: center; gap: 8px; padding: 10px 6px; cursor: pointer; font-size: 14px; color: var(--fg-2); border-radius: var(--r-md); }
.group-count, .group-shown { color: var(--muted); }
.group-controls { display: flex; justify-content: flex-end; gap: 16px; margin: 0 0 8px; }
.finding-list { list-style: none; margin: 0; padding: 0 0 8px; display: flex; flex-direction: column; gap: 2px; }
.finding-link { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-md); color: inherit; }
.finding-link:hover { background: var(--card-2); text-decoration: none; color: inherit; }
.finding-link[aria-current="true"] { background: var(--active); }
.finding-num { flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%; background: var(--card-2); color: var(--fg-2); display: grid; place-items: center; font-size: 13px; font-weight: 600; }
.finding-link[aria-current="true"] .finding-num { background: var(--accent); color: var(--accent-fg); }
.finding-link-text { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.finding-link-title { font-weight: 500; color: var(--head); overflow-wrap: anywhere; }
.finding-link-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 13px; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.dot-critical { background: var(--crit); } .dot-high { background: var(--high); }
.dot-medium { background: var(--med); } .dot-low { background: var(--low); }
.dot-unknown { background: var(--unk); }
.finding-cards { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.finding-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 24px 28px; display: flex; flex-direction: column; gap: 20px; min-width: 0; scroll-margin-top: 24px; }
.is-stepper .finding-card { display: none; }
.is-stepper .finding-card.is-current { display: flex; }
.finding-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; font-size: 14px; color: var(--muted); }
.finding-pos { margin-left: auto; font-size: 13px; }
.eyebrow { font-size: 13px; color: var(--muted); margin: 0 0 4px; }
.finding-card h3 { font-size: 19px; line-height: 1.4; }
.finding-subject { margin: 8px 0 0; color: var(--fg-2); overflow-wrap: anywhere; }
.finding-subject code { color: var(--fg); }
.todo { background: var(--advice-bg); border: 1px solid var(--ok-line); border-radius: var(--r-md); padding: 16px 20px; }
.todo h4 { display: flex; align-items: center; gap: 8px; color: var(--ok-fg); margin-bottom: 4px; }
.todo p { margin: 0; color: var(--head); }
/* What changed: Before and After side by side (#22), stacked on narrow screens. */
.changed { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; font-size: 14px; margin: 8px 0 0; }
.changed > div { border: 1px solid var(--line-2); border-radius: var(--r-md); padding: 12px 16px; min-width: 0; }
.changed dt { font-size: 13px; color: var(--muted); }
.changed dd { margin: 2px 0 0; font-family: var(--mono); font-size: 13px; color: var(--fg); overflow-wrap: anywhere; }
.details { background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--r-md); padding: 12px 16px; }
.details summary { cursor: pointer; font-size: 14px; font-weight: 500; color: var(--fg-2); }
.details dl { display: grid; grid-template-columns: 80px minmax(0, 1fr) auto; gap: 8px 12px; align-items: center; margin: 12px 0 0; font-size: 14px; }
.details dt { color: var(--muted); }
.details dd { margin: 0; font-family: var(--mono); font-size: 13px; overflow-wrap: anywhere; }
.review-nav { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 4px; }
.review-pos { font-size: 14px; color: var(--muted); }
.file-errors { margin: 0; padding: 14px 18px 14px 34px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md); color: var(--crit-text); }
.file-errors li + li { margin-top: 4px; }
.file-errors code { overflow-wrap: anywhere; color: inherit; }
.help p { margin: 8px 0 0; color: var(--muted); font-size: 14px; }
.help strong { font-weight: 600; }

/* ---------- Scan review page: the verdict is the page's answer (#22) ---------- */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 13px; color: var(--muted); }
.crumbs a { color: var(--muted); }
.crumbs span { overflow-wrap: anywhere; }
.verdict { display: flex; flex-direction: column; gap: 18px; }
.verdict-top { display: flex; align-items: flex-start; gap: 20px; }
.verdict-text { flex: 1; min-width: 0; }
.verdict-text .meta-line { margin: 0 0 8px; font-size: 13px; }
.verdict h1 { font-size: 26px; letter-spacing: -0.02em; }
.verdict-text > p:not(.meta-line) { margin: 8px 0 0; color: var(--fg-2); max-width: 760px; }
.summary-actions { align-items: center; }
.summary-actions .button-sm { height: 36px; padding: 0 14px; font-size: 14px; }
.details .scan-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 20px; margin: 12px 0 0; }
.details .scan-facts > div { min-width: 0; }
.details .scan-facts dt { font-size: 13px; }
.details .scan-facts dd { margin: 2px 0 0; font-family: var(--sans); font-size: 14px; color: var(--fg); }

/* ---------- Empty states ---------- */
.empty-state { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 32px 24px; text-align: center; }
.empty-state h2 { margin: 12px 0 6px; }
.empty-state p { color: var(--fg-2); max-width: 560px; margin: 0 auto 8px; }
.empty-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 16px !important; }
.empty-icon { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--card-2); color: var(--fg-2); }
.empty-inline { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 16px; color: var(--muted); }

/* ---------- Signed-out pages ---------- */
.bare { min-height: 100vh; display: flex; flex-direction: column; }
.bare-head { display: flex; align-items: center; gap: 12px; padding: 22px 32px; }
.bare-main { flex-grow: 1; display: grid; place-items: center; padding: 24px 24px 64px; }
.signin, .message-panel { width: 100%; max-width: 460px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 32px; display: flex; flex-direction: column; gap: 18px; }
.signin h1, .message-panel h1 { font-size: 22px; }
.signin-lead { margin: 6px 0 0; color: var(--fg-2); }
.value-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; color: var(--fg-2); font-size: 14px; }
.value-list li { display: flex; gap: 8px; align-items: flex-start; }
.value-list .icon { color: var(--ok); margin-top: 3px; }
.steps-card { background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--r-md); padding: 14px 16px; font-size: 14px; }
.steps-card h2 { font-size: 14px; margin-bottom: 6px; color: var(--fg); }
.steps-card ol { margin: 0; padding-left: 20px; color: var(--fg-2); display: flex; flex-direction: column; gap: 4px; }
.scope { font-size: 14px; }
.scope summary { cursor: pointer; color: var(--fg-2); }
.scope ul { margin: 10px 0 0; padding-left: 20px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.fine-print { margin: 0; font-size: 12.5px; color: var(--dim); }
.message-panel { text-align: center; align-items: center; }

/* ---------- Motion: only the scanning spinner moves (it shows an active state). ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Narrow screens ---------- */
@media (max-width: 980px) {
  .review { grid-template-columns: minmax(0, 1fr); }
  .finding-list { position: static; }
  .row-link { grid-template-columns: minmax(0, 1fr) auto; }
  .row-findings, .row-perms { grid-column: 1 / -1; }
  .row-time { text-align: left; }
  .row-head { display: none; }
  .repo-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .repo-main { grid-column: 1 / -1; }
  .repo-label { position: static; width: 100%; height: auto; overflow: visible; clip: auto; white-space: normal; font-size: 13px; color: var(--dim); }
  .repo-time { justify-content: flex-start; }
  .details .scan-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 12px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar-head { padding: 0; }
  .nav { flex-direction: row; order: 3; width: 100%; overflow-x: auto; }
  .nav a { white-space: nowrap; height: 38px; }
  .sidebar-foot { margin: 0 0 0 auto; flex-direction: row; align-items: center; }
  .nav-secondary, .avatar { display: none; }
  .account { padding: 0; }
  .content { padding: 20px 16px 40px; }
  .summary-top, .hero { align-items: flex-start; }
  .hero h1 { font-size: 22px; }
  .attn-row { padding: 14px 16px; }
  .repo-row { grid-template-columns: minmax(0, 1fr); padding: 14px 16px; }
  .pr-group { padding-left: 8px; }
  .scan-row.has-action { flex-wrap: wrap; gap: 0; }
  .scan-row.has-action > .row-link { flex-basis: 100%; }
  .scan-row.has-action > .row-action { flex: 1 0 100%; justify-content: flex-start; padding: 0 16px 12px; }
  .finding-card { padding: 20px; }
  .signin, .message-panel { padding: 24px; }
  .details dl { grid-template-columns: 70px minmax(0, 1fr) auto; }
  .details .scan-facts, .changed { grid-template-columns: minmax(0, 1fr); }
  .verdict h1 { font-size: 22px; }
}
