:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f5f5f4;
  --surface-3: #e9e9e7;
  --border: #e4e4e1;
  --ink: #111111;
  --ink-2: #5c5c59;
  --ink-3: #8c8c88;
  --grid: #ececea;
  --accent: #2a78d6;
  --baseline: #9a9a96;
  --live: #d9463f;
  --pass: #1baf7a;
  --fail: #e34948;
  --timeout: #eda100;
  --frontier: #ea580c;
  --infra: #8c6bd6;
  --running: #2a78d6;
  --radius: 6px;
  --font: "Inter", -apple-system, "Segoe UI", system-ui, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", "DejaVu Sans Mono", monospace;
  --nav-h: 48px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #111111;
  --surface: #161616;
  --surface-2: #1e1e1e;
  --surface-3: #2a2a2a;
  --border: #2a2a29;
  --ink: #ececea;
  --ink-2: #a3a3a0;
  --ink-3: #6f6f6c;
  --grid: #242423;
  --accent: #3987e5;
  --baseline: #6e6e6b;
  --pass: #199e70;
  --fail: #e66767;
  --timeout: #c98500;
  --frontier: #fb923c;
  --infra: #9085e9;
  --running: #3987e5;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 13.5px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, select { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
.hidden { display: none !important; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
.dim { color: var(--ink-2); }
.wrap { max-width: 1440px; margin: 0 auto; padding: 0 20px; }
.link { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--ink-3); }
.link:hover { text-decoration-color: var(--ink); }

/* -------------------------------------------------------------- announce */
.announce { background: color-mix(in srgb, var(--pass) 14%, var(--bg)); color: var(--ink); border-bottom: 1px solid color-mix(in srgb, var(--pass) 32%, var(--bg)); font-size: 12.5px; }
.announce-inner { height: 34px; display: flex; align-items: center; justify-content: center; gap: 8px; position: relative; }
.announce-link { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; overflow: hidden; padding: 7px; margin: -7px; }
.announce-link strong { font-weight: 600; }
.announce-sub { opacity: 0.7; }
.announce-sub:hover { opacity: 1; }
.announce-sub:hover span:first-child { text-decoration: underline; text-underline-offset: 3px; }
.announce-close { position: absolute; right: 14px; width: 24px; height: 24px; border-radius: 4px; display: inline-flex; align-items: center; justify-content: center; opacity: 0.7; }
.announce-close:hover { opacity: 1; background: rgba(127, 127, 127, 0.25); }
@media (max-width: 720px) { .announce-sub { display: none; } }

/* ------------------------------------------------------------------- nav */
.nav { position: sticky; top: 0; z-index: 20; height: var(--nav-h); background: var(--bg); border-bottom: 1px solid var(--border); }
.nav-inner { height: 100%; display: flex; align-items: center; gap: 22px; }
.brand { font-weight: 600; white-space: nowrap; display: inline-flex; align-items: center; }
.brand-logo { width: 26px; height: 26px; border-radius: 6px; margin-right: 8px; background: #fff; box-shadow: 0 0 0 1px var(--border); flex: none; }
.sample-badge { margin-left: 8px; padding: 1px 7px; border-radius: 10px; background: var(--timeout); color: #fff; font-size: 11px; font-weight: 600; font-family: var(--mono); vertical-align: 2px; }
.tabs { display: flex; gap: 2px; height: 100%; position: relative; }
.tabs a { display: flex; align-items: center; padding: 0 9px; color: var(--ink-2); position: relative; white-space: nowrap; cursor: pointer; }
.tabs a:hover, .tabs a.active { color: var(--ink); }
.tabs a[hidden] { display: none; }
.tab-ink { position: absolute; left: 0; bottom: -1px; height: 2px; background: var(--ink); pointer-events: none; transition: transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1), width 0.45s cubic-bezier(0.2, 0.8, 0.2, 1); }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.nav-status { display: flex; align-items: center; gap: 18px; white-space: nowrap; }
.nav-cell { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; }
.nav-cell .k { font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.nav-cell .v { font-family: var(--mono); font-size: 13.5px; font-variant-numeric: tabular-nums; }
.icon-btn { width: 28px; height: 28px; border-radius: 4px; display: inline-flex; align-items: center; justify-content: center; color: var(--ink-2); }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); flex: none; }
.dot.live { background: var(--pass); position: relative; }
.dot.live::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--pass); animation: ping 1.6s cubic-bezier(0, 0, 0.2, 1) infinite; }
.dot.stale { background: var(--timeout); }
.dot.done { background: var(--pass); }
@keyframes ping { 70%, 100% { transform: scale(2.8); opacity: 0; } }

/* ------------------------------------------------------------------ page */
#main { padding-top: 22px; padding-bottom: 40px; min-height: calc(100vh - var(--nav-h) - 60px); }
.page-head { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; margin-bottom: 14px; flex-wrap: wrap; }
/* the overview head's right side: the evaluate button, then the sponsor badge; they wrap onto two rows on a phone */
.head-right { display: flex; align-items: stretch; gap: 8px; flex-wrap: wrap; }
.eval-cta { display: inline-flex; align-items: center; gap: 7px; min-height: 30px; padding: 3px 12px 3px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--ink); font-size: 13px; font-weight: 600; white-space: nowrap; transition: background 0.2s, border-color 0.2s; }
.eval-cta:hover, .eval-cta:focus-visible { background: var(--surface-2); color: var(--ink); border-color: var(--ink-3); }
.eval-cta svg { flex: none; color: var(--ink-2); }
.page-title { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.page-title .muted { font-weight: 400; margin-left: 8px; }
.page-title::first-letter, .card-title::first-letter, .modal-title::first-letter { text-transform: uppercase; }
.page-sub { color: var(--ink-2); max-width: 820px; margin-top: 2px; }
.section { margin-top: 26px; }
/* the first section sits closer under the page head than sections sit to each other: the head's own margin is the gap */
.page-head + .section { margin-top: 0; }
.section-title { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); font-weight: 600; margin-bottom: 8px; display: flex; gap: 10px; align-items: baseline; }
.section-title .muted { text-transform: none; letter-spacing: 0; font-weight: 400; }
.crumbs { color: var(--ink-3); font-size: 12px; margin-bottom: 4px; }
.crumbs a:hover { color: var(--ink); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; min-width: 0; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.card-title { font-weight: 600; font-size: 13px; }
.card-note { color: var(--ink-3); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card.clickable { cursor: zoom-in; transition: border-color 0.2s, box-shadow 0.3s, transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1); }
.card.clickable:hover { border-color: var(--ink-3); transform: translateY(-2px); box-shadow: 0 10px 28px rgba(0, 0, 0, 0.08); }
:root[data-theme="dark"] .card.clickable:hover { box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45); }
.grid { display: grid; gap: 12px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-feed { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); }
@media (max-width: 1100px) { .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-feed, .race-grid { grid-template-columns: 1fr; } }
@media (max-width: 720px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------ status line */
.status { border-top: 1px solid var(--border); padding: 12px 0 10px; }
.status:first-child { border-top: 0; padding-top: 0; }
.status-line, .status .kv { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px 18px; }
.status-line { align-items: center; }
.status-name, .status-line .progress, .status .kv > :first-child { grid-column: span 2; }
.status-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.name-col { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.name-col b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.name-col .sub { color: var(--ink-3); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-name .state { font-size: 12px; }
.big { font-family: var(--mono); font-size: 26px; font-weight: 500; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.big .u { font-size: 13px; color: var(--ink-3); margin-left: 4px; letter-spacing: 0; }
.clock-col { display: flex; flex-direction: column; line-height: 1.2; }
.clock-col .started { color: var(--ink-3); font-size: 12px; }
.progress { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.pbar { height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; display: flex; }
.pbar > i { display: block; height: 100%; }
.pbar-text { color: var(--ink-3); font-size: 12px; display: flex; gap: 10px; white-space: nowrap; overflow: hidden; }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px 18px; margin-top: 10px; }
.kv .k { font-size: 11px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kv .v { font-family: var(--mono); font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kv .v .u, .u { color: var(--ink-3); font-size: 0.85em; margin-left: 3px; }
.kv .v small { color: var(--ink-3); font-size: 11px; margin-left: 4px; }

/* -------------------------------------------------------------------- KPI */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
/* One row of --kpi-n cells when they fit, else rows of --kpi-mid, so no row is left part-filled. */
.kpis-fit { grid-template-columns: repeat(var(--kpi-n, 8), minmax(0, 1fr)); }
@media (max-width: 1360px) { .kpis-fit { grid-template-columns: repeat(var(--kpi-mid, 4), minmax(0, 1fr)); } }
.kpi { padding: 12px 14px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); margin: 0 -1px -1px 0; min-width: 0; }
.kpi .k { font-size: 11px; color: var(--ink-3); white-space: nowrap; }
.kpi .v { font-family: var(--mono); font-size: 20px; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kpi .s { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* A metrics card without a sub-line keeps its height when it sits alone on a row. */
#metrics .kpi:not(:has(> .s))::after { content: "\00a0"; display: block; font-size: 11.5px; }

/* ----------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tbl th { text-align: left; font-weight: 500; color: var(--ink-3); font-size: 11.5px; padding: 6px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; position: sticky; top: 0; background: var(--surface); }
.tbl th.num, .tbl td.num { text-align: right; }
.tbl thead th { cursor: pointer; user-select: none; transition: color 0.15s; }
.tbl thead th:hover, .tbl th.sorted { color: var(--ink); }
.tbl th[data-dir]::after { content: "↓"; margin-left: 3px; font-size: 10px; }
.tbl th[data-dir="asc"]::after { content: "↑"; }
.tbl td { padding: 5px 8px; border-bottom: 1px solid var(--grid); white-space: nowrap; }
.tbl td.mono, .tbl .mono { font-size: 12.5px; }
.tbl td.wrap { white-space: normal; }
.ver-grid { align-items: stretch; }
.ver-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.ver-col > .ver-fill { flex: 1; }
.ver-tbl.ver-kv td:first-child { color: var(--ink-3); width: 1%; white-space: nowrap; padding-right: 16px; }
.ver-kv td.ver-id { white-space: normal; }
.ver-tbl.ver-kv tr.ver-sub td { color: var(--ink); font-weight: 600; font-size: 13px; padding-top: 16px; background: none; }
.ver-sub td::first-letter { text-transform: uppercase; }
@media (max-width: 720px) { .ver-tbl.ver-kv td:first-child { white-space: normal; width: 32%; padding-right: 8px; } }
.ver-tbl td { white-space: normal; }
.ver-tbl td.mono { white-space: nowrap; }
.ver-tbl td.ver-id { white-space: normal; }
.ver-id span { white-space: nowrap; }
.tbl tbody tr:hover td { background: var(--surface-2); }
.tbl tr.row-link { cursor: pointer; }
.tbl tr.baseline td { color: var(--ink-2); }
.tbl tr.total td { font-weight: 600; border-top: 1px solid var(--border); }
.tbl tr.group td { background: var(--surface-2); color: var(--ink-2); font-size: 11.5px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.tbl .ci { color: var(--ink-3); font-size: 11px; margin-left: 4px; }
.tbl-scroll { max-height: 640px; overflow: auto; }

.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; padding: 1px 7px; border-radius: 10px; border: 1px solid var(--border); color: var(--ink-2); white-space: nowrap; }
.badge i { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.o-pass { color: var(--pass); } .o-fail { color: var(--fail); } .o-timeout { color: var(--timeout); } .o-infra { color: var(--infra); } .o-running { color: var(--running); } .o-incomplete { color: var(--ink-3); }
.bg-pass { background: var(--pass); } .bg-fail { background: var(--fail); } .bg-timeout { background: var(--timeout); } .bg-infra { background: var(--infra); } .bg-running { background: var(--running); } .bg-incomplete { background: var(--ink-3); }
.swatch { display: inline-block; width: 9px; height: 9px; border-radius: 2px; flex: none; vertical-align: middle; margin-right: 6px; }
.swatch.m-only { display: none; }
.hlogo { display: inline-block; width: 15px; height: 15px; border-radius: 4px; flex: none; vertical-align: -3px; margin: 0 7px 0 1px; background: #fff; object-fit: contain; box-shadow: 0 0 0 1.5px var(--hc); }
.mlogo { display: inline-block; width: 15px; height: 15px; border-radius: 50%; flex: none; vertical-align: -3px; margin: 0 6px 0 1px; background: #fff; object-fit: contain; box-shadow: 0 0 0 1px var(--border); }
.mlogo.mystery { overflow: hidden; background: var(--surface-3); color: var(--ink-2); }
.mlogo.mystery svg { display: block; width: 100%; height: 100%; }
.page-title .hlogo, .page-title .mlogo { width: 18px; height: 18px; vertical-align: -3px; }
.muted-x { color: var(--ink-3); font-weight: 400; }
.hmono { background: var(--hc); color: #fff; font: 600 8px/15px var(--mono, ui-monospace, monospace); font-style: normal; text-align: center; letter-spacing: -0.02em; }
.flag { font-size: 10.5px; padding: 0 6px; border-radius: 3px; background: var(--surface-3); color: var(--ink-2); margin-right: 4px; white-space: nowrap; }
.flag.bad { background: color-mix(in srgb, var(--fail) 22%, transparent); color: var(--ink); }

.row-bar { height: 6px; background: var(--surface-3); border-radius: 3px; overflow: hidden; min-width: 60px; }
.row-bar-fill { height: 100%; background: var(--accent); }

/* ---------------------------------------------------------------- heatmap */
.heat td.hc { text-align: center; font-family: var(--mono); font-size: 12px; border: 2px solid var(--surface); padding: 6px 6px; min-width: 64px; }
.heat td.hc { transition: transform 0.18s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.18s; }
.heat td.hc[data-href] { cursor: pointer; }
.heat td.hc[data-href]:hover { outline: 1px solid var(--ink); transform: scale(1.07); position: relative; z-index: 3; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2); }
.heat td.hc .sub { display: block; font-size: 10.5px; opacity: 0.75; }
.heat td.hc.empty { color: var(--ink-3); background: var(--surface-2); cursor: default; }
.heat th.col { text-align: center; }
.heat tr > :first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); }
.heat thead tr > :first-child { z-index: 2; }

/* ----------------------------------------------------------------- charts */
.chart-body { height: 200px; position: relative; }
.chart-body.tall { height: 280px; }
.chart-body canvas, .modal-chart canvas { display: block; width: 100%; height: 100%; }
.chart-body canvas { touch-action: pan-y; }
.modal-chart canvas { touch-action: none; }
.chart-tip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--border); border-radius: 4px; padding: 5px 8px; font-size: 11.5px; font-family: var(--mono); white-space: nowrap; z-index: 5; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08); }
.chart-tip .t { color: var(--ink-3); margin-bottom: 2px; }
.chart-tip { line-height: 1.4; max-width: 100%; box-sizing: border-box; }
.chart-tip .tr { display: flex; align-items: center; min-width: 0; }
.chart-tip .tn { overflow: hidden; text-overflow: ellipsis; min-width: 0; margin-right: 6px; }
.chart-tip .tr b { flex: none; margin-left: auto; }
.chart-tip .tr.on { color: var(--ink); font-weight: 600; }
.chart-tip .more { color: var(--ink-3); }
.marker { display: inline-block; vertical-align: middle; margin-right: 2px; }
.phase-strip { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.phase { display: flex; flex-direction: column; gap: 5px; text-align: left; padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--ink); min-width: 0; }
.phase { transition: border-color 0.2s, transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.25s; }
@media (hover: hover) { .phase:hover { border-color: var(--ink-3); transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.07); } }
.phase.on, .phase.on:hover { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent); }
.phase b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.phase-top { align-items: center; }
.phase-top b { min-width: 0; font-family: var(--font); font-size: 13.5px; color: var(--ink); }
.phase-top > span { flex: none; white-space: nowrap; }
.phase .row-bar { display: block; min-width: 0; }
.phase .row-bar-fill { display: block; }
.phase-top, .phase-sub { display: flex; justify-content: space-between; gap: 6px; font-size: 11.5px; color: var(--ink-3); font-family: var(--mono); }
.phase-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.ph-running { color: var(--pass); }
.ph-done { color: var(--pass); }
.ph-partial { color: var(--timeout); }
.race-grid { grid-template-columns: minmax(0, 1.85fr) minmax(0, 1fr); }
.ph-pending { color: var(--ink-3); }
.chart-body.race-body { height: auto; min-height: 440px; flex: 1; }
.race-grid > .card:first-child { display: flex; flex-direction: column; }
.race-table td.race-name { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.race-table th, .race-table td { padding-left: 6px; padding-right: 6px; }
.race-row { cursor: pointer; }
/* the two cost headers wrap, and names shorten where the card is narrow, so every ranking column stays in view */
.race-table th.race-cost { white-space: normal; width: 64px; line-height: 1.25; }
@media (min-width: 1101px) and (max-width: 1360px), (max-width: 720px) { .race-table td.race-name { max-width: 104px; } }
.race-row td { color: var(--ink-3); }
.race-row.hl td { color: var(--ink); }
.race-row.hl .race-name { font-weight: 600; }
.race-row.pinned td:first-child { box-shadow: inset 3px 0 0 var(--ink-2); }
.race-row:hover td { background: var(--surface-2); }
.race-name a { color: inherit; text-decoration: none; }
.race-name a:hover { text-decoration: underline; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--ink-2); margin-top: 6px; }
.chart-empty { display: flex; align-items: center; justify-content: center; height: 100%; color: var(--ink-3); font-size: 12px; }
.hbars { display: flex; flex-direction: column; gap: 5px; }
.hbar { display: grid; grid-template-columns: minmax(90px, 160px) 1fr 92px; gap: 10px; align-items: center; font-size: 12px; }
.hbar .name { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .track { display: block; height: 10px; background: var(--surface-3); border-radius: 2px; overflow: hidden; position: relative; }
.hbar .fill { display: block; height: 100%; background: var(--accent); }
.hbar .val { font-family: var(--mono); text-align: right; white-space: nowrap; }
.hbar .val .muted { font-size: 11px; }

/* ------------------------------------------------------------------ feed */
.feed-list { max-height: 420px; overflow-y: auto; }
.jobs-scroll { max-height: 440px; overflow-y: auto; overscroll-behavior: contain; }
.lb-scroll { max-height: 520px; overflow-y: auto; overscroll-behavior: contain; }
.lb-scroll .tbl th { z-index: 2; }
.errors-scroll, .exc-scroll { max-height: 420px; overflow-y: auto; overscroll-behavior: contain; }
.errors-scroll .tbl th, .exc-scroll .tbl th { z-index: 2; }
.grp-scroll { max-height: 560px; overflow-y: auto; overscroll-behavior: contain; }
.grp-scroll .tbl th { z-index: 3; }
.grp-scroll .tbl tr.group td { position: sticky; top: var(--th-h, 29px); z-index: 2; box-shadow: inset 0 -1px 0 var(--border); }
.tl-item { display: grid; grid-template-columns: 64px 150px minmax(0, 1fr) 132px; gap: 10px; padding: 4px 0; border-bottom: 1px solid var(--grid); align-items: baseline; font-size: 12.5px; }
.tl-item:last-child { border-bottom: 0; }
.tl-time { color: var(--ink-3); font-family: var(--mono); font-size: 11.5px; white-space: nowrap; }
.tl-task, .tl-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-task a:hover, .tl-text a:hover { text-decoration: underline; }
.tl-meta { color: var(--ink-3); font-family: var(--mono); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: right; }

/* -------------------------------------------------------------- controls */
.controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.controls label { color: var(--ink-3); font-size: 12px; display: flex; gap: 6px; align-items: center; }
.controls select, .controls input[type="search"], .controls input[type="text"] { background: var(--surface); border: 1px solid var(--border); border-radius: 4px; padding: 4px 8px; font-size: 12.5px; color: var(--ink); }
.controls input[type="search"] { min-width: 220px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 4px; overflow: hidden; }
.seg button { padding: 3px 10px; font-size: 12px; color: var(--ink-2); border-right: 1px solid var(--border); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--surface-3); color: var(--ink); }
/* segmented controls side by side in a card head (the race's cost / speed and top N / all) */
.seg-group { display: inline-flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.ver-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
/* the head's names, one a line and taking no height: every such heading is as wide as the widest of them, so the
   switch never moves */
.ver-head .page-title::after { content: attr(data-widest); display: block; height: 0; overflow: hidden; visibility: hidden; white-space: pre; }
.ver-switch { display: inline-flex; border: 1px solid var(--border); border-radius: 4px; overflow: hidden; font-size: 12px; -webkit-user-select: none; user-select: none; }
.ver-switch a { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; color: var(--ink-2); text-decoration: none; border-right: 1px solid var(--border); transition: background 0.2s, color 0.2s; }
.ver-switch a:last-child { border-right: 0; }
.ver-switch a[href]:hover { background: var(--surface-2); color: var(--ink); }
.ver-switch a.on { background: var(--surface-3); color: var(--ink); }
.ver-switch .dot { width: 6px; height: 6px; }
.btn { border: 1px solid var(--border); border-radius: 4px; padding: 4px 12px; font-size: 12.5px; color: var(--ink-2); }
.btn:hover { color: var(--ink); border-color: var(--ink-3); }

/* ----------------------------------------------------------- task chips */
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { font-family: var(--mono); font-size: 11px; padding: 3px 6px; border-radius: 3px; cursor: pointer; white-space: nowrap; }
.chip:hover { outline: 1px solid var(--ink); }
span.chip { cursor: default; }
span.chip:hover { outline: none; transform: none; }

/* ---------------------------------------------------------- trial detail */
.timeline { display: flex; height: 22px; border-radius: 4px; overflow: hidden; background: var(--surface-3); }
.timeline > div { height: 100%; display: flex; align-items: center; justify-content: center; font-size: 11px; color: #fff; white-space: nowrap; overflow: hidden; min-width: 2px; }
.steps { display: flex; flex-direction: column; gap: 8px; }
.step { border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 12px; }
.step-head { display: flex; gap: 10px; align-items: baseline; font-size: 12px; color: var(--ink-3); margin-bottom: 4px; }
.step-head b { color: var(--ink); font-weight: 600; }
.step.user { background: var(--surface-2); }
pre, .pre { font-family: var(--mono); font-size: 12px; white-space: pre-wrap; word-break: break-word; margin: 4px 0 0; }
pre.box { background: var(--surface-2); border-radius: 4px; padding: 8px 10px; max-height: 360px; overflow: auto; }
pre.err { border-left: 3px solid var(--fail); }
.tool-call { font-family: var(--mono); font-size: 12px; margin-top: 4px; }
.tool-call b { color: var(--accent); font-weight: 600; }
details summary { cursor: pointer; color: var(--ink-2); font-size: 12px; }
.prose p { max-width: 860px; margin-bottom: 12px; color: var(--ink-2); }
.prose h3 { font-size: 13px; margin: 18px 0 6px; }
.prose dl { display: grid; grid-template-columns: 220px 1fr; gap: 6px 16px; max-width: 1000px; align-items: baseline; }
.about-tbl { width: auto; min-width: 560px; }
.about-tbl td:first-child, .about-tbl th:first-child { width: 220px; padding-left: 0; }
.about-tbl td.num, .about-tbl th.num { width: 120px; }
.prose dt { font-family: var(--mono); font-size: 12.5px; }
.prose dd { margin: 0; color: var(--ink-2); }

/* ------------------------------------------------------------------ modal */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.35); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.modal-card { transform-origin: 0 0; position: relative; width: min(1100px, 94vw); max-height: 92vh; overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 16px 18px; }
.modal-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.modal-title { font-weight: 600; font-size: 15px; }
.modal-desc { color: var(--ink-2); font-size: 12.5px; }
.chart-legend [data-lk] { cursor: pointer; user-select: none; border-radius: 4px; transition: opacity 0.2s, background-color 0.15s; }
.chart-legend [data-lk]:hover { background: var(--surface-2); }
.chart-legend [data-lk].off { opacity: 0.35; text-decoration: line-through; }
.modal-stats { margin-top: 12px; font-size: 12.5px; }
.modal-stats > .chart-legend { margin-bottom: 10px; }
.modal-stats:empty { display: none; }
.modal-table { max-height: 300px; border-top: 1px solid var(--border); }
.modal-note { font-size: 12px; margin-top: 6px; }
.modal-chart { height: 440px; position: relative; }
.status-pill { position: fixed; bottom: 16px; right: 16px; background: var(--live); color: #fff; padding: 4px 12px; border-radius: 12px; font-size: 12px; z-index: 60; }
.empty-state { padding: 30px; text-align: center; color: var(--ink-3); border: 1px dashed var(--border); border-radius: var(--radius); }

/* ---------------------------------------------------------------- sponsor */
/* brand tints, darker on the light theme so they read on white */
:root { --sp-runta: #d9701c; --sp-baseten: #12a05c; --sp-zai: #3f3f46; }
:root[data-theme="dark"] { --sp-runta: #f6964a; --sp-baseten: #4be08f; --sp-zai: #e4e4e7; }
/* the banner: a dot grid fading down from the top, two drifting brand glows, the headline and the three marks */
.sp-top { position: relative; overflow: hidden; isolation: isolate; display: flex; align-items: center; justify-content: space-between; gap: 40px; padding: 54px 44px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.sp-top::before { content: ""; position: absolute; inset: 0; z-index: -1; background-image: radial-gradient(var(--surface-3) 1px, transparent 1px); background-size: 22px 22px; -webkit-mask-image: radial-gradient(ellipse 90% 100% at 50% 0%, #000 25%, transparent 78%); mask-image: radial-gradient(ellipse 90% 100% at 50% 0%, #000 25%, transparent 78%); }
.sp-orb { position: absolute; z-index: -1; width: 440px; height: 440px; border-radius: 50%; filter: blur(80px); opacity: 0.2; animation: sp-drift 18s ease-in-out infinite alternate; }
.sp-orb-a { background: var(--sp-runta); left: -140px; top: -240px; }
.sp-orb-b { background: var(--sp-baseten); right: -120px; bottom: -280px; animation-delay: -9s; }
@keyframes sp-drift { from { transform: translate3d(0, 0, 0) scale(1); } to { transform: translate3d(60px, 40px, 0) scale(1.15); } }
.sp-top-text { min-width: 0; max-width: 720px; }
.sp-top .sp-kicker { display: inline-flex; align-items: center; gap: 7px; padding: 3px 10px; font-size: 12px; border: 1px solid var(--border); border-radius: 999px; background: color-mix(in srgb, var(--surface) 70%, transparent); color: var(--ink-2); }
.sp-top .sp-kicker::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: linear-gradient(135deg, var(--sp-runta), var(--sp-baseten)); }
.sp-title { margin-top: 16px; font-size: clamp(28px, 4.1vw, 44px); line-height: 1.08; font-weight: 600; letter-spacing: -0.03em; text-wrap: balance; }
.sp-grad { background: linear-gradient(90deg, var(--sp-runta), var(--sp-baseten)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sp-lede { margin-top: 16px; font-size: 18px; line-height: 1.5; color: var(--ink-2); max-width: 52ch; }
.sp-trio { flex: none; display: flex; align-items: center; padding-right: 12px; }
.sp-trio .sp-mark { animation: sp-float 7s ease-in-out infinite; }
.sp-trio .sp-mark:nth-child(1) { transform: rotate(-7deg); z-index: 1; }
.sp-trio .sp-mark:nth-child(2) { margin: -46px -14px 0; z-index: 2; animation-delay: -2.3s; }
.sp-trio .sp-mark:nth-child(3) { transform: rotate(7deg); z-index: 1; animation-delay: -4.6s; }
@keyframes sp-float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -9px; } }
/* a sponsor's mark: its logo on a tile tinted and lit in its colour. The banner, cards and tiles take the live
   page's card radius, and the buttons keep .btn's */
.sp-mark { flex: none; display: grid; place-items: center; width: 76px; height: 76px; border-radius: var(--radius); background: color-mix(in srgb, var(--sp) 9%, var(--surface-2)); border: 1px solid color-mix(in srgb, var(--sp) 30%, var(--border)); box-shadow: 0 16px 36px -18px color-mix(in srgb, var(--sp) 85%, transparent); }
.sp-mark img { width: 44px; height: 44px; object-fit: contain; border-radius: 4px; }
/* a sponsor card: a glow that follows the pointer (--mx, --my, set by app.js) and a top line that spreads on hover */
.sp-card { --mx: 12%; --my: 0%; position: relative; overflow: hidden; isolation: isolate; display: flex; align-items: flex-start; gap: 22px; height: 100%; padding: 26px 28px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1), border-color 0.25s, box-shadow 0.35s; }
.sp-card::before { content: ""; position: absolute; inset: 0; z-index: -1; background: radial-gradient(520px circle at var(--mx) var(--my), color-mix(in srgb, var(--sp) 15%, transparent), transparent 62%); opacity: 0.55; transition: opacity 0.3s; }
.sp-card::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: linear-gradient(90deg, transparent, var(--sp), transparent); opacity: 0.75; transform: scaleX(0.4); transform-origin: 18% 50%; transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.3s; }
@media (hover: hover) {
  .sp-card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--sp) 45%, var(--border)); box-shadow: 0 24px 50px -30px color-mix(in srgb, var(--sp) 75%, transparent); }
  .sp-card:hover::before { opacity: 1; }
  .sp-card:hover::after { transform: scaleX(1); opacity: 1; }
  .sp-card:hover .sp-mark { transform: scale(1.06) rotate(-3deg); }
}
.sp-card .sp-mark { transition: transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1); }
.sp-body { flex: 1; min-width: 0; }
.sp-role { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 600; color: color-mix(in srgb, var(--sp) 70%, var(--ink)); }
.sp-role::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--sp); box-shadow: 0 0 0 3px color-mix(in srgb, var(--sp) 22%, transparent); }
.sp-card h2 { margin-top: 6px; font-size: 22px; font-weight: 650; letter-spacing: -0.02em; }
.sp-card p { margin-top: 6px; font-size: 14px; color: var(--ink-2); max-width: 62ch; }
.sp-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 0; padding: 0; list-style: none; }
.sp-chips li { padding: 3px 9px; border: 1px solid var(--border); border-radius: 999px; background: color-mix(in srgb, var(--surface-2) 75%, transparent); color: var(--ink-2); font-family: var(--mono); font-size: 12px; white-space: nowrap; }
.sp-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.sp-actions .btn { padding: 6px 14px; font-size: 14px; background: color-mix(in srgb, var(--surface) 60%, transparent); transition: color 0.2s, border-color 0.2s, background 0.2s, transform 0.2s; }
.sp-actions .btn:hover { transform: translateY(-1px); }
.sp-actions .sp-primary { background: var(--ink); font-weight: 550; }
.sp-feature { padding: 34px 36px; gap: 28px; }
.sp-feature .sp-mark { width: 96px; height: 96px; }
.sp-feature .sp-mark img { width: 58px; height: 58px; }
.sp-feature h2 { font-size: 26px; }
.sp-feature p { font-size: 16px; }
@media (max-width: 900px) { .sp-top { flex-direction: column; align-items: flex-start; gap: 34px; padding: 40px 28px; } .sp-trio { padding: 24px 0 0 4px; } }
@media (max-width: 720px) {
  .sp-top { padding: 30px 20px; }
  .sp-trio .sp-mark, .sp-card .sp-mark, .sp-feature .sp-mark { width: 60px; height: 60px; }
  .sp-trio .sp-mark img, .sp-card .sp-mark img, .sp-feature .sp-mark img { width: 36px; height: 36px; }
  .sp-trio .sp-mark:nth-child(2) { margin-top: -34px; }
  .sp-card, .sp-feature { flex-direction: column; gap: 16px; padding: 22px 20px; }
  .sp-feature h2 { font-size: 24px; }
  .sp-lede { font-size: 16px; }
  .sp-chips li { white-space: normal; }
}
@media (prefers-reduced-motion: reduce) { .sp-orb, .sp-trio .sp-mark { animation: none; } .sp-card, .sp-card .sp-mark, .sp-card::after, .sp-actions .btn { transition: none; } }
.sp-kicker { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.sp-primary { background: var(--ink); color: var(--bg); border-color: var(--ink); font-weight: 600; }
.sp-primary:hover { color: var(--bg); border-color: var(--ink); opacity: 0.85; }
.sp-primary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sp-badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); }
.sp-badge a { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px 2px 4px; border-radius: 999px; color: var(--ink); text-decoration: none; transition: background 0.2s; }
.sp-badge a:hover { background: var(--surface-2); color: var(--ink); }
.sp-badge img { width: 18px; height: 18px; object-fit: contain; }
.sp-badge .sp-kicker { font-size: 10px; margin-right: 2px; }
.sp-badge .sp-name { font-weight: 600; font-size: 13px; }
@media (max-width: 720px) { .sp-badge .sp-name { display: none; } .sp-badge a { padding: 2px 3px; } }

/* ----------------------------------------------------------------- motion */
.kpi { transition: background 0.2s; }
.kpi:hover { background: var(--surface-2); }
.tbl td { transition: background 0.15s; }
.seg button, .btn, .icon-btn { transition: background 0.2s, color 0.2s, border-color 0.2s; }
.chip { transition: transform 0.15s cubic-bezier(0.2, 0.8, 0.2, 1); }
.chip:hover { transform: translateY(-1px); }
.icon-btn:active, .btn:active, .seg button:active { transform: scale(0.94); }

/* blocks rise in when first scrolled into view; rows, cells and bars follow */
.rv { opacity: 0; transform: translateY(16px); }
.rv.in { opacity: 1; transform: none; transition: opacity 0.55s ease var(--d, 0ms), transform 0.75s cubic-bezier(0.2, 0.8, 0.2, 1) var(--d, 0ms); }
.rv .rrow, .rv .rcell { opacity: 0; }
.rv.in .rrow { animation: row-in 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) calc(var(--d, 0ms) + var(--r, 0ms)) both; }
.rv.in .rcell { animation: cell-in 0.55s cubic-bezier(0.2, 0.8, 0.2, 1) calc(var(--d, 0ms) + var(--r, 0ms)) both; }
@keyframes row-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes cell-in { from { opacity: 0; transform: scale(0.6); } to { opacity: 1; transform: none; } }
.rv .row-bar-fill, .rv .hbar .fill { transform: scaleX(0); transform-origin: left; }
.rv.in .row-bar-fill, .rv.in .hbar .fill { transform: none; transition: transform 1.1s cubic-bezier(0.2, 0.8, 0.2, 1) calc(var(--d, 0ms) + 200ms); }
.rv .pbar { clip-path: inset(0 100% 0 0); }
.rv.in .pbar { clip-path: inset(0); transition: clip-path 1.2s cubic-bezier(0.2, 0.8, 0.2, 1) calc(var(--d, 0ms) + 150ms); }

/* live work shimmers */
.bg-running, .row-bar-fill.live { background-image: linear-gradient(100deg, transparent 25%, rgba(255, 255, 255, 0.5) 50%, transparent 75%); background-size: 220% 100%; animation: shimmer 1.8s linear infinite; }
@keyframes shimmer { from { background-position: 160% 0; } to { background-position: -60% 0; } }
.chart-pulse { position: absolute; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; background: var(--c); pointer-events: none; }
.chart-pulse::after { content: ""; position: absolute; inset: -1px; border-radius: 50%; border: 1.5px solid var(--c); animation: ping 1.8s cubic-bezier(0, 0, 0.2, 1) var(--pd, 0s) infinite; }

/* live changes */
.bump { animation: bump 1s ease-out; }
@keyframes bump { 0% { color: var(--accent); } 100% { color: inherit; } }
.tl-item.fresh { animation: fresh-in 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both, fresh-glow 2.8s ease-out; }
@keyframes fresh-in { from { opacity: 0; transform: translateY(-10px); } }
@keyframes fresh-glow { from { background: color-mix(in srgb, var(--accent) 18%, transparent); } to { background: transparent; } }
.rank-up td:first-child::after, .rank-down td:first-child::after { font-size: 9px; margin-left: 3px; animation: rank-fade 1.8s ease-in forwards; }
.rank-up td:first-child::after { content: "▲"; color: var(--pass); }
.rank-down td:first-child::after { content: "▼"; color: var(--fail); }
.rank-up td { animation: rank-glow 1.4s ease-out; }
@keyframes rank-fade { 0%, 60% { opacity: 1; } 100% { opacity: 0; } }
@keyframes rank-glow { from { background: color-mix(in srgb, var(--pass) 9%, transparent); } }

/* loading skeletons: placeholders in the view's own containers; one sweep, fixed to the viewport, crosses them all */
:root { --sk: #ecece9; --sk-hi: rgba(255, 255, 255, 0.8); }
:root[data-theme="dark"] { --sk: #232322; --sk-hi: rgba(255, 255, 255, 0.06); }
.skel { pointer-events: none; user-select: none; }
.sk { display: inline-block; height: 0.72em; max-width: 100%; vertical-align: middle; border-radius: 3px; background: linear-gradient(100deg, transparent, var(--sk-hi), transparent) var(--sk) fixed no-repeat; background-size: 50vw 100%; animation: sk-sweep 1.6s ease-in-out infinite; }
@keyframes sk-sweep { from { background-position: -50vw 0; } to { background-position: 150vw 0; } }
.sk.sk-dot { width: 15px; height: 15px; box-shadow: none; }
.mlogo.sk-dot { border-radius: 50%; }
.skel .row-bar { display: block; }
.sk-chart { position: relative; }
.sk-chart::before { content: ""; position: absolute; inset: 8px 8px 24px 40px; border-left: 1px solid var(--border); border-bottom: 1px solid var(--border); background: repeating-linear-gradient(to top, transparent 0 calc(20% - 1px), var(--grid) calc(20% - 1px) 20%); }
.sk-chart .sk-y { position: absolute; left: 4px; top: 4px; bottom: 20px; display: flex; flex-direction: column; justify-content: space-between; }
.sk-chart .sk-x { position: absolute; left: 25px; right: -7px; bottom: 2px; display: flex; justify-content: space-between; }
.sk-chart .sk-y .sk, .sk-chart .sk-x .sk { height: 8px; }
/* the race placeholder sits on the real race plot's margins, so its frame hands over in place */
.sk-chart.race-body::before { inset: 22px 16px 34px 48px; }
.sk-chart.race-body .sk-y { top: 16px; bottom: 28px; left: 8px; }
.sk-chart.race-body .sk-x { left: 33px; right: 1px; bottom: 15px; }
/* the leaderboard's frame, as js/leaderboard.js DASH_CSS lays it out: the plot card (legend, toggle, scatter), three
   highlight cards, the two link pills */
.lb-skel { min-height: calc(100vh - var(--nav-h) - 120px); }
.lb-skel-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; min-height: 40px; padding-bottom: 8px; }
.lb-skel-legend { display: flex; flex-wrap: wrap; gap: 8px 12px; flex: 1 1 200px; }
.lb-skel .sk-box { height: 26px; border-radius: 4px; }
.lb-skel-plot { height: 300px; margin: 0 20px 18px 36px; }
.lb-skel-plot .sk-chart { height: 100%; }
.lb-skel-hl { display: grid; gap: 12px; margin-top: 12px; }
.lb-skel-hl > div { display: flex; flex-direction: column; gap: 9px; min-height: 104px; }
.lb-skel .sk-icon { height: 18px; border-radius: 4px; }
.lb-skel .sk-title { height: 14px; }
.lb-skel-cta { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 26px; }
.lb-skel .sk-btn { height: 30px; border-radius: 999px; }
@media (min-width: 1051px) {
  .lb-skel-legend { flex-wrap: nowrap; overflow: hidden; }
  .lb-skel-plot { height: 480px; margin: 0 8px 18px 42px; }
  .lb-skel-hl { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) { .sk { animation: none; background-image: none; } }

/* theme switch spreads from the toggle */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ----------------------------------------------------------------- mobile */
@media (max-width: 900px) {
  .nav-status { gap: 14px; }
  .tabs a { padding: 0 6px; }
}
@media (max-width: 720px) {
  .wrap { padding: 0 12px; }
  .nav { height: auto; }
  .nav-inner { flex-wrap: wrap; gap: 0 12px; padding-top: 8px; }
  .brand { order: 1; }
  /* Three rows: the brand with the theme toggle at its end, the run's figures in equal columns under the brand, then
     the tabs. .nav-right gives up its box so its two children can sit on different rows. */
  .nav-right { display: contents; }
  #theme-toggle { order: 2; margin-left: auto; }
  .nav-status { order: 3; width: 100%; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 0 10px; margin-top: 6px; }
  .nav-cell { align-items: flex-start; min-width: 0; }
  .nav-cell .v { font-size: 12.5px; }
  .tabs { order: 4; width: 100%; height: 38px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; margin: 0 -6px; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs a { padding: 0 10px; }
  .tab-ink { bottom: 0; }
  #main { padding-top: 14px; min-height: 60vh; }
  .page-head { gap: 10px; }
  .page-title .muted { display: block; margin-left: 0; font-size: 13px; }
  /* The overview head: the version switch at the row's end, then the evaluate button and the sponsor badge filling
     the row between them, or a full row each where they don't fit side by side. */
  .ver-head { width: 100%; justify-content: space-between; flex-wrap: nowrap; }
  .head-right { width: 100%; gap: 6px; }
  .head-right > * { flex: 1 1 auto; justify-content: center; }
  .eval-cta { min-height: 34px; gap: 6px; padding: 3px 7px; font-size: 12.5px; }
  .sp-badge { gap: 3px; padding-left: 8px; }
  .sp-badge .sp-kicker { letter-spacing: 0.05em; }
  .ver-switch a { padding: 4px 11px; }
  .section { margin-top: 20px; }
  .section-title { flex-wrap: wrap; gap: 2px 10px; }
  .card { padding: 10px 12px; }
  .card-note { white-space: normal; }
  .status-line, .status .kv { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; }
  /* The race card's head: where the title and both controls don't fit one row, the controls take the next row
     together, so the title never breaks into two lines beside a stacked pair. */
  .card-head:has(.seg-group) { flex-wrap: wrap; align-items: center; row-gap: 8px; }
  .card-head:has(.seg-group) .card-title { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .seg-group { flex-wrap: nowrap; }
  .big { font-size: 22px; }
  .kv { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis-fit > .kpi:last-child:nth-child(odd) { grid-column: span 2; }
  .kpi { padding: 10px 12px; }
  .kpi .v { font-size: 17px; }

  .table-wrap { -webkit-overflow-scrolling: touch; }
  .swatch.m-only { display: inline-block; }
  .tbl .m-hide { display: none; }
  .heat td.mono:first-child { max-width: 46vw; overflow: hidden; text-overflow: ellipsis; }
  .tbl .c-finished, .tbl .c-job, .tbl .c-env_setup, .tbl .c-verifier { display: none; }
  .tbl .c-task { position: sticky; left: 0; z-index: 1; background: var(--surface); max-width: 46vw; overflow: hidden; text-overflow: ellipsis; }
  .tbl th.c-task { z-index: 2; }
  .tbl-scroll { max-height: none; }
  .tbl td, .tbl th { padding: 5px 6px; }
  .heat td.hc { min-width: 52px; }

  .chart-body { height: 180px; }
  .chart-body.tall { height: 240px; }
  .hbar { grid-template-columns: minmax(64px, 34%) 1fr auto; gap: 8px; }
  .feed-list { max-height: 360px; }
  .jobs-scroll { max-height: 380px; }
  .lb-scroll { max-height: 440px; }
  .errors-scroll, .exc-scroll { max-height: 360px; }
  .grp-scroll { max-height: 440px; }
  .tl-item { grid-template-columns: 52px minmax(0, 1fr) auto; gap: 2px 8px; }
  .tl-task { grid-column: 2; grid-row: 1; }
  .tl-meta { grid-column: 3; grid-row: 1; }
  .tl-text { grid-column: 2 / -1; grid-row: 2; }

  .controls { gap: 8px; }
  .controls label { flex: 1 1 calc(50% - 8px); min-width: 0; }
  .controls label select, .controls label input { flex: 1; min-width: 0; }
  .controls input[type="search"] { min-width: 0; flex: 1 1 100%; }
  .controls label input[type="checkbox"] { flex: none; }
  .controls label:has(input[type="checkbox"]) { flex: 0 0 auto; }
  .controls select, .controls input[type="search"], .controls input[type="text"] { font-size: 16px; padding: 6px 8px; }
  .seg button { padding: 6px 12px; white-space: nowrap; flex: none; }
  .controls label:has(.seg) { flex: 0 1 auto; max-width: 100%; }
  /* The scroller clips overflow, so pad it to keep the selected card's 3px ring visible. */
  .phase-strip { display: flex; overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding: 4px; margin: -4px -4px 8px; scroll-padding-inline: 4px; }
  .phase-strip::-webkit-scrollbar { display: none; }
  /* The strip scrolls sideways only, so its cards fade in without the rise that would push them past its bottom edge. */
  .phase-strip > .rv { transform: none; }
  .phase { flex: 0 0 170px; }
  .race-grid { grid-template-columns: 1fr; }
  .chart-body.race-body { height: 340px; }
  .controls .seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .btn { padding: 6px 12px; }

  .prose dl { grid-template-columns: 1fr; gap: 2px; }
  .prose dd { margin-bottom: 8px; }
  .step { padding: 8px 10px; }
  pre.box { max-height: 280px; }

  .modal { align-items: stretch; }
  .modal-card { width: 100vw; max-height: none; height: 100dvh; border-radius: 0; border: 0; padding: 12px; padding-bottom: max(12px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; }
  .modal-chart { flex: 1; min-height: 260px; height: auto; }
  .modal-stats { font-size: 11.5px; }
  .modal-table { max-height: 34dvh; }
  .status-pill { bottom: max(12px, env(safe-area-inset-bottom)); right: 12px; }
}
@media (hover: none) {
  .tbl tbody tr:hover td { background: none; }
  .heat td.hc:hover, .chip:hover { outline: none; }
}
