:root {
  color-scheme: light;
  --surface-0: #f6f5f1;
  --surface-1: #fcfcfb;
  --surface-2: #efeeea;
  --border: #dad9d3;
  --grid: #e6e5df;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #85837d;
  --accent: #2a78d6;
  --series-aihc-native: #2a78d6;
  --series-aihc-llvm: #eb6834;
  --series-aihc-wasm: #1baf7a;
  --series-ghc-native: #eda100;
  --series-ghc-llvm: #e87ba4;
  --status-good: #0ca30c;
  --status-warning: #fab219;
  --status-critical: #d03b3b;
  --cover-measured: #2a78d6;
  --cover-inherited: #9ec5f4;
  --cover-unavailable: #b8b7b1;
  --cover-pending: #efeeea;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --surface-0: #111110;
    --surface-1: #1a1a19;
    --surface-2: #242422;
    --border: #35342f;
    --grid: #2b2b28;
    --text-primary: #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted: #8f8e86;
    --accent: #3987e5;
    --series-aihc-native: #3987e5;
    --series-aihc-llvm: #d95926;
    --series-aihc-wasm: #199e70;
    --series-ghc-native: #c98500;
    --series-ghc-llvm: #d55181;
    --cover-measured: #3987e5;
    --cover-inherited: #1c5cab;
    --cover-unavailable: #4a4945;
    --cover-pending: #242422;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --surface-0: #111110;
  --surface-1: #1a1a19;
  --surface-2: #242422;
  --border: #35342f;
  --grid: #2b2b28;
  --text-primary: #ffffff;
  --text-secondary: #c3c2b7;
  --text-muted: #8f8e86;
  --accent: #3987e5;
  --series-aihc-native: #3987e5;
  --series-aihc-llvm: #d95926;
  --series-aihc-wasm: #199e70;
  --series-ghc-native: #c98500;
  --series-ghc-llvm: #d55181;
  --cover-measured: #3987e5;
  --cover-inherited: #1c5cab;
  --cover-unavailable: #4a4945;
  --cover-pending: #242422;
}

* { box-sizing: border-box; }
html { background: var(--surface-0); }
body {
  margin: 0;
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--text-primary);
  background: var(--surface-0);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--mono); font-size: 0.92em; }

.site-header {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.5rem 1.5rem;
  padding: 0.9rem 1.5rem; border-bottom: 1px solid var(--border); background: var(--surface-1);
}
.site-header .brand { font-weight: 650; font-size: 1.05rem; color: var(--text-primary); }
.site-header nav { display: flex; gap: 1rem; flex-wrap: wrap; }
.site-header nav a { color: var(--text-secondary); }
.site-header nav a[aria-current="page"] { color: var(--text-primary); font-weight: 600; }
.site-header .spacer { flex: 1; }
.site-header .external { color: var(--text-muted); font-size: 0.9rem; }

main { max-width: 1240px; margin: 0 auto; padding: 1.25rem 1.5rem 3rem; }
h1 { font-size: 1.45rem; margin: 0.4rem 0 0.2rem; }
h2 { font-size: 1.1rem; margin: 1.6rem 0 0.6rem; }
h3 { font-size: 0.95rem; margin: 1rem 0 0.4rem; color: var(--text-secondary); font-weight: 600; }
.lede { color: var(--text-secondary); margin: 0 0 1rem; }
.status-line { color: var(--text-muted); font-size: 0.9rem; min-height: 1.4em; }

.filters {
  display: flex; flex-wrap: wrap; gap: 0.6rem 1rem; align-items: end;
  padding: 0.8rem 1rem; margin: 0.8rem 0 1rem; background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px;
}
.filters label { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.8rem; color: var(--text-secondary); }
.filters select, .filters input {
  font: inherit; font-size: 0.92rem; padding: 0.3rem 0.5rem; min-width: 9rem;
  color: var(--text-primary); background: var(--surface-1); border: 1px solid var(--border); border-radius: 6px;
}
.filters .checks { flex-direction: row; align-items: center; gap: 0.4rem; padding-bottom: 0.35rem; font-size: 0.9rem; color: var(--text-primary); }
.filters button, .button {
  font: inherit; font-size: 0.9rem; padding: 0.35rem 0.8rem; border-radius: 6px; cursor: pointer;
  color: var(--text-primary); background: var(--surface-2); border: 1px solid var(--border);
}

.card {
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px; padding: 1rem 1.1rem; margin-bottom: 1rem;
}
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 1rem; }
.card h2 { margin: 0 0 0.2rem; font-size: 1.05rem; }
.card .meta { color: var(--text-muted); font-size: 0.85rem; }
.stat-row { display: flex; gap: 1.5rem; flex-wrap: wrap; margin: 0.7rem 0; }
.stat { display: flex; flex-direction: column; }
.stat .value { font-size: 1.35rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.stat .label { font-size: 0.78rem; color: var(--text-secondary); }

.cover-bar { display: flex; height: 10px; border-radius: 4px; overflow: hidden; background: var(--cover-pending); border: 1px solid var(--border); }
.cover-bar span { display: block; height: 100%; }
.cover-bar .measured { background: var(--cover-measured); }
.cover-bar .inherited { background: var(--cover-inherited); }
.cover-bar .unavailable { background: var(--cover-unavailable); }

table.data { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
table.data th, table.data td { padding: 0.35rem 0.6rem; border-bottom: 1px solid var(--grid); text-align: left; vertical-align: top; }
table.data th { color: var(--text-secondary); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.02em; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data tr:hover td { background: var(--surface-2); }
.table-wrap { overflow-x: auto; }
.better { color: var(--status-good); }
.worse { color: var(--status-critical); }
.muted { color: var(--text-muted); }
.swatch { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 0.4rem; }
.swatch.dashed { background: repeating-linear-gradient(90deg, currentColor 0 3px, transparent 3px 5px); }

.chart-wrap { position: relative; background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px; padding: 0.75rem 0.5rem 0.25rem; }
.chart-wrap .empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--text-muted); }
.chart-wrap .empty[hidden], .tooltip[hidden] { display: none; }
.legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; margin: 0.6rem 0.5rem 0.2rem; font-size: 0.85rem; color: var(--text-secondary); }
.legend button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; display: inline-flex; align-items: center; }
.legend button.off { opacity: 0.4; text-decoration: line-through; }
.tooltip {
  position: absolute; pointer-events: none; z-index: 5; min-width: 200px; max-width: 320px;
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 6px; box-shadow: 0 4px 14px rgba(0,0,0,0.12);
  padding: 0.5rem 0.65rem; font-size: 0.82rem; color: var(--text-secondary);
}
.tooltip strong { color: var(--text-primary); font-variant-numeric: tabular-nums; }
.tooltip .row { display: flex; justify-content: space-between; gap: 1rem; }
.tooltip .row span:first-child { display: inline-flex; align-items: center; }
.tooltip[hidden] { display: none; }

.coverage-strip { width: 100%; height: 36px; display: block; border: 1px solid var(--border); border-radius: 4px; background: var(--cover-pending); }
.coverage-legend { display: flex; gap: 1.2rem; font-size: 0.82rem; color: var(--text-secondary); margin: 0.4rem 0 0; }
.coverage-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 2px; vertical-align: -1px; margin-right: 0.35rem; border: 1px solid var(--border); }

.uplot, .uplot *, .uplot *::before, .uplot *::after { box-sizing: border-box; }
.uplot { font-family: inherit; line-height: 1.5; width: min-content; }
.u-title { text-align: center; font-size: 18px; font-weight: bold; }
.u-wrap { position: relative; user-select: none; }
.u-over, .u-under { position: absolute; }
.u-under { overflow: hidden; }
.uplot canvas { display: block; position: relative; width: 100%; height: 100%; }
.u-axis { position: absolute; }
.u-legend { font-size: 14px; margin: auto; text-align: center; }
.u-inline { display: block; }
.u-inline * { display: inline-block; }
.u-inline tr { margin-right: 16px; }
.u-legend th { font-weight: 600; }
.u-legend .u-marker { width: 1em; height: 1em; margin-right: 4px; background-clip: padding-box !important; }
.u-inline.u-live th::after { content: ":"; vertical-align: top; }
.u-inline:not(.u-live) .u-value { display: none; }
.u-series > * { padding: 4px; }
.u-series th { cursor: pointer; }
.u-legend .u-off > * { opacity: 0.3; }
.u-select { background: rgba(0,0,0,0.07); position: absolute; pointer-events: none; }
.u-cursor-x, .u-cursor-y { position: absolute; left: 0; top: 0; pointer-events: none; will-change: transform; z-index: 100; }
.u-hz .u-cursor-x, .u-vt .u-cursor-y { height: 100%; border-right: 1px dashed var(--text-muted); }
.u-hz .u-cursor-y, .u-vt .u-cursor-x { width: 100%; border-bottom: 1px dashed var(--text-muted); }
.u-cursor-pt { position: absolute; top: 0; left: 0; border-radius: 50%; border: 0 solid; pointer-events: none; will-change: transform; z-index: 100; background-clip: padding-box !important; }
.u-axis.u-off, .u-select.u-off, .u-cursor-x.u-off, .u-cursor-y.u-off, .u-cursor-pt.u-off { display: none; }

@media (max-width: 640px) {
  main { padding: 1rem; }
  .filters select, .filters input { min-width: 7rem; }
}
