:root {
  --bg: #ffffff; --fg: #1f2328; --muted: #57606a; --line: #d0d7de; --panel: #f6f8fa;
  --accent: #0969da; --good: #116329; --bad: #a40e26; --warn-bg: #fff8c5; --warn-fg: #4d2d00;
  --err-bg: #ffebe9; --err-fg: #82071e; --info-bg: #ddf4ff; --info-fg: #0a3069;
  --v-upstream-standard: #8a6d00; --v-upstream-minimal: #b5651d; --v-hardened-full: #1f6fb2; --v-hardened-micro: #2a8a4a;
  --s-critical: #7f1d1d; --s-high: #c2410c; --s-medium: #d97706; --s-low: #2563eb; --s-negligible: #64748b; --s-unknown: #a3a3a3;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1117; --fg: #e6edf3; --muted: #9da7b3; --line: #30363d; --panel: #161b22;
    --accent: #4493f8; --good: #3fb950; --bad: #ff7b72; --warn-bg: #3b2e00; --warn-fg: #f2cc60;
    --err-bg: #3d0d12; --err-fg: #ffa198; --info-bg: #0c2d4a; --info-fg: #a5d6ff;
    --v-upstream-standard: #d4b106; --v-upstream-minimal: #e3a35f; --v-hardened-full: #58a6ff; --v-hardened-micro: #56d364;
    --s-critical: #f87171; --s-high: #fb923c; --s-medium: #fbbf24; --s-low: #60a5fa; --s-negligible: #94a3b8; --s-unknown: #d4d4d4;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1117; --fg: #e6edf3; --muted: #9da7b3; --line: #30363d; --panel: #161b22;
  --accent: #4493f8; --good: #3fb950; --bad: #ff7b72; --warn-bg: #3b2e00; --warn-fg: #f2cc60;
  --err-bg: #3d0d12; --err-fg: #ffa198; --info-bg: #0c2d4a; --info-fg: #a5d6ff;
  --v-upstream-standard: #d4b106; --v-upstream-minimal: #e3a35f; --v-hardened-full: #58a6ff; --v-hardened-micro: #56d364;
  --s-critical: #f87171; --s-high: #fb923c; --s-medium: #fbbf24; --s-low: #60a5fa; --s-negligible: #94a3b8; --s-unknown: #d4d4d4;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
a { color: var(--accent); }
a:focus-visible, button:focus-visible, select:focus-visible, input:focus-visible, summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 8px; background: var(--bg); padding: 4px 8px; z-index: 10; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.top { border-bottom: 1px solid var(--line); background: var(--panel); }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; }
h1 { font-size: 1.25rem; margin: 0; }
h2 { font-size: 1.15rem; margin: 2rem 0 .5rem; }
h3 { font-size: 1rem; margin: 1.25rem 0 .5rem; }
.note { color: var(--muted); margin: 0 0 .75rem; max-width: 80ch; }
button.ghost { background: none; color: var(--fg); border: 1px solid var(--line); border-radius: 6px; padding: 4px 10px; font: inherit; cursor: pointer; }

.banner { border-radius: 6px; padding: 10px 14px; margin: 12px 0; }
.banner strong { display: block; }
.banner.info { background: var(--info-bg); color: var(--info-fg); }
.banner.warn { background: var(--warn-bg); color: var(--warn-fg); }
.banner.error { background: var(--err-bg); color: var(--err-fg); }
.banner ul { margin: 6px 0 0; padding-left: 20px; }

.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px 20px; margin: 16px 0; }
.facts div { min-width: 0; }
.facts dt { color: var(--muted); font-size: .85rem; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.badge { display: inline-block; border-radius: 999px; padding: 0 8px; font-size: .8rem; font-weight: 600; border: 1px solid currentColor; }
.badge.fresh { color: var(--good); }
.badge.stale { color: var(--warn-fg); background: var(--warn-bg); }
.badge.old, .badge.bad { color: var(--err-fg); background: var(--err-bg); }

.filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px 16px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; margin: 0; padding: 0; border: 0; }
.field label, .field legend { font-size: .85rem; color: var(--muted); padding: 0; }
.filters fieldset { grid-column: span 2; }
select { font: inherit; padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--fg); min-height: 32px; max-width: 100%; }
.checks { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.checks label { display: inline-flex; align-items: center; gap: 6px; color: var(--fg); font-size: .9rem; min-height: 28px; }

.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; margin: 4px 0 12px; font-size: .9rem; }
caption { text-align: left; font-weight: 600; padding: 4px 0; }
th, td { border-bottom: 1px solid var(--line); padding: 5px 8px; text-align: left; vertical-align: top; }
th { color: var(--muted); font-weight: 600; white-space: nowrap; }
td.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nm { color: var(--err-fg); font-style: italic; }
.better { color: var(--good); font-weight: 600; }
.worse { color: var(--bad); font-weight: 600; }
.same { color: var(--muted); }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85em; overflow-wrap: anywhere; }

.chart { margin: 8px 0 4px; }
.chart svg { display: block; width: 100%; height: auto; max-width: 900px; }
.chart text { fill: var(--fg); font-size: 12px; }
.chart .muted { fill: var(--muted); }
.chart .nm-t { fill: var(--err-fg); font-style: italic; }
.chart .grid { stroke: var(--line); }
.chart .axis { stroke: var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .85rem; margin: 4px 0; padding: 0; list-style: none; }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 12px; height: 12px; display: inline-block; border-radius: 2px; }
details { margin: 4px 0 16px; }
summary { cursor: pointer; color: var(--accent); }
.links { padding-left: 20px; }
.links li { margin: 4px 0; }
.foot { color: var(--muted); font-size: .85rem; border-top: 1px solid var(--line); margin-top: 32px; padding-top: 8px; padding-bottom: 24px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 330px), 1fr)); gap: 16px; }
.card { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; min-width: 0; }
.card h3 { margin-top: .25rem; }
.cards.wide { grid-template-columns: repeat(auto-fit, minmax(min(100%, 520px), 1fr)); }

@media (max-width: 560px) {
  .filters fieldset { grid-column: auto; }
  .cards { grid-template-columns: 1fr; }
  h2 { margin-top: 1.5rem; }
}

/* chart series colours follow the theme tokens */
.v-upstream-standard { fill: var(--v-upstream-standard); background: var(--v-upstream-standard); stroke: var(--v-upstream-standard); }
.v-upstream-minimal { fill: var(--v-upstream-minimal); background: var(--v-upstream-minimal); stroke: var(--v-upstream-minimal); }
.v-hardened-full { fill: var(--v-hardened-full); background: var(--v-hardened-full); stroke: var(--v-hardened-full); }
.v-hardened-micro { fill: var(--v-hardened-micro); background: var(--v-hardened-micro); stroke: var(--v-hardened-micro); }
.chart rect[class^="v-"], .chart circle, .chart path { stroke: none; }
.chart polyline.ln { fill: none; }
.sev-critical { fill: var(--s-critical); background: var(--s-critical); }
.sev-high { fill: var(--s-high); background: var(--s-high); }
.sev-medium { fill: var(--s-medium); background: var(--s-medium); }
.sev-low { fill: var(--s-low); background: var(--s-low); }
.sev-negligible { fill: var(--s-negligible); background: var(--s-negligible); }
.sev-unknown { fill: var(--s-unknown); background: var(--s-unknown); }
