/* Vantage evaluation dashboard. Visual language: Vantage Data House Design System
 * (org default design system; see .agents/skills/vantage-dashboard-design/SKILL.md).
 * Light tokens are VDS values. VDS defines no dark mode, focus ring, warning colour
 * or breakpoints; the dark theme, focus ring and responsive rules below are local
 * extensions, derived from the VDS white-alpha / on-dark ramps. */

@font-face { font-family: "Inter"; font-weight: 400; font-style: normal; font-display: swap; src: url("fonts/Inter-Regular.ttf") format("truetype"); }
@font-face { font-family: "Inter"; font-weight: 500; font-style: normal; font-display: swap; src: url("fonts/Inter-Medium.ttf") format("truetype"); }
@font-face { font-family: "Inter"; font-weight: 600; font-style: normal; font-display: swap; src: url("fonts/Inter-SemiBold.ttf") format("truetype"); }

/* ---------- Tokens (light = VDS) ---------- */
:root {
  color-scheme: light;
  --page: #f7f9fb;                 /* surface-sunken (dove-10) */
  --surface: #ffffff;              /* surface-base */
  --surface-2: #fafafa;            /* surface-subtle (black-a-02) as an opaque value for sticky cells */
  --surface-hover: #f5f5f5;        /* control hover, opaque */
  --glass: rgba(255, 255, 255, 0.8);   /* surface-glass-strong */
  --ink: rgba(0, 0, 0, 0.8);       /* text-primary  12.6:1 */
  --ink-2: rgba(0, 0, 0, 0.6);     /* text-secondary 5.7:1: minimum for informative text */
  --muted: rgba(0, 0, 0, 0.6);
  --faint: rgba(0, 0, 0, 0.4);     /* text-tertiary: decoration only (fails AA as text) */
  --ink-solid: #333333;            /* grey-80, for accent-color on native checkboxes */
  --on-inverse: #ffffff;
  --grid: rgba(0, 0, 0, 0.05);     /* stroke-faint: row rules */
  --axis: rgba(0, 0, 0, 0.2);
  --border: rgba(0, 0, 0, 0.05);   /* stroke-faint: card hairline */
  --border-strong: rgba(0, 0, 0, 0.1);  /* stroke-subtle */
  --control-border: rgba(0, 0, 0, 0.2);
  --control-subtle: rgba(0, 0, 0, 0.05);
  --control-subtle-hover: rgba(0, 0, 0, 0.1);
  --control-inverse: rgba(0, 0, 0, 0.8);
  --accent: #d3f431;               /* accent-80: never as text on light surfaces */
  --accent-fill: #f1ffad;          /* accent-50: control-accent, emphasis fill */
  --accent-wash: #f8ffd6;          /* accent-10 */
  --accent-ink: rgba(0, 0, 0, 0.8);
  --focus: rgba(0, 0, 0, 0.8);
  /* Vote-share ramps (VDS data tokens), rgb triplets for alpha shading of race errors. */
  --div-pos: 13, 94, 234;          /* blue-60: Democrats under-predicted */
  --div-neg: 247, 75, 1;           /* red-60: Republicans under-predicted */
  --warn-bg: #f8ffd6;              /* accent-10: VDS defines no warning colour */
  --warn-border: rgba(160, 190, 0, 0.45);
  --info-bg: #ffffff;
  --info-border: rgba(0, 0, 0, 0.1);
  --shadow: 2px 2px 15px -5px rgba(0, 0, 0, 0.1);           /* shadow-drop-shadow */
  --shadow-pop: 0 29px 43.9px rgba(0, 0, 0, 0.25);          /* shadow-new-drop */
  --shadow-bar: 1px 2px 4px rgba(0, 0, 0, 0.15);            /* shadow-glass-bar */
  --edge-shadow: rgba(0, 0, 0, 0.12);
  --radius-card: 20px;   /* radius-lg */
  --radius-md: 12px;
  --radius-sm: 8px;
  --radius-full: 9999px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --rank-w: 56px;
  --model-w: clamp(170px, 17.5vw, 290px);
  --header-h: 56px;
}

/* Dark: local extension (VDS has no dark mode). Text/borders use the VDS white-alpha
 * ramp; surfaces are cool near-blacks; party/data hues keep their VDS values. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0f1012; --surface: #191a1d; --surface-2: #1e1f22; --surface-hover: #232428;
    --glass: rgba(25, 26, 29, 0.82);
    --ink: rgba(255, 255, 255, 0.9); --ink-2: rgba(255, 255, 255, 0.66); --muted: rgba(255, 255, 255, 0.66);
    --faint: rgba(255, 255, 255, 0.4); --ink-solid: #e5e5e5; --on-inverse: #111214;
    --grid: rgba(255, 255, 255, 0.06); --axis: rgba(255, 255, 255, 0.24);
    --border: rgba(255, 255, 255, 0.08); --border-strong: rgba(255, 255, 255, 0.12);
    --control-border: rgba(255, 255, 255, 0.2); --control-subtle: rgba(255, 255, 255, 0.06);
    --control-subtle-hover: rgba(255, 255, 255, 0.12); --control-inverse: rgba(255, 255, 255, 0.9);
    --accent-fill: rgba(211, 244, 49, 0.2); --accent-wash: rgba(211, 244, 49, 0.07); --accent-ink: #e9fb8f;
    --focus: rgba(255, 255, 255, 0.9);
    --div-pos: 59, 131, 255; --div-neg: 255, 121, 64;   /* blue-40, red-40 */
    --warn-bg: rgba(211, 244, 49, 0.08); --warn-border: rgba(211, 244, 49, 0.32);
    --info-bg: #191a1d; --info-border: rgba(255, 255, 255, 0.12);
    --shadow: 2px 2px 15px -5px rgba(0, 0, 0, 0.6); --shadow-pop: 0 29px 43.9px rgba(0, 0, 0, 0.55);
    --shadow-bar: 1px 2px 4px rgba(0, 0, 0, 0.5); --edge-shadow: rgba(0, 0, 0, 0.55);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0f1012; --surface: #191a1d; --surface-2: #1e1f22; --surface-hover: #232428;
  --glass: rgba(25, 26, 29, 0.82);
  --ink: rgba(255, 255, 255, 0.9); --ink-2: rgba(255, 255, 255, 0.66); --muted: rgba(255, 255, 255, 0.66);
  --faint: rgba(255, 255, 255, 0.4); --ink-solid: #e5e5e5; --on-inverse: #111214;
  --grid: rgba(255, 255, 255, 0.06); --axis: rgba(255, 255, 255, 0.24);
  --border: rgba(255, 255, 255, 0.08); --border-strong: rgba(255, 255, 255, 0.12);
  --control-border: rgba(255, 255, 255, 0.2); --control-subtle: rgba(255, 255, 255, 0.06);
  --control-subtle-hover: rgba(255, 255, 255, 0.12); --control-inverse: rgba(255, 255, 255, 0.9);
  --accent-fill: rgba(211, 244, 49, 0.2); --accent-wash: rgba(211, 244, 49, 0.07); --accent-ink: #e9fb8f;
  --focus: rgba(255, 255, 255, 0.9);
  --div-pos: 59, 131, 255; --div-neg: 255, 121, 64;
  --warn-bg: rgba(211, 244, 49, 0.08); --warn-border: rgba(211, 244, 49, 0.32);
  --info-bg: #191a1d; --info-border: rgba(255, 255, 255, 0.12);
  --shadow: 2px 2px 15px -5px rgba(0, 0, 0, 0.6); --shadow-pop: 0 29px 43.9px rgba(0, 0, 0, 0.55);
  --shadow-bar: 1px 2px 4px rgba(0, 0, 0, 0.5); --edge-shadow: rgba(0, 0, 0, 0.55);
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--page); color: var(--ink); font: 400 14px/1.45 var(--font); letter-spacing: 0.005em;
  -webkit-font-smoothing: antialiased; font-feature-settings: "cv11", "ss01"; }
button, input, select { font: inherit; color: inherit; letter-spacing: inherit; }
a { color: inherit; }
code { font-size: 12px; }
b, strong { font-weight: 600; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.ink2 { color: var(--ink-2); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
/* Caption: the only uppercase style (VDS: 10px, 600, 12% tracking). */
.caption, .field > label, .field > .label, .tile-label, .ms-group > span, .grid tr.group .group-label,
.grid th.band, .notice-kicker, .rx th.rx-cat .band-toggle, .rx-sec-btn, .rx-facts dt, .rx-d-table tr.rx-d-group td { font-size: 10px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; }

/* ---------- Header (glass bar) ---------- */
.app-header { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 24px;
  min-height: var(--header-h); padding: 8px 24px; background: var(--glass); backdrop-filter: blur(40px) saturate(1.2);
  -webkit-backdrop-filter: blur(40px) saturate(1.2); border-bottom: 1px solid var(--border); box-shadow: var(--shadow-bar); }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand > div { min-width: 0; }
.brand-mark { width: 22px; height: 22px; border-radius: 7px; flex: none; background: var(--control-inverse);
  box-shadow: inset 0 0 0 5px var(--control-inverse), inset 0 0 0 11px var(--accent); }
.brand-title { font-size: 14px; font-weight: 600; letter-spacing: 0.01em; }
.brand-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-nav { display: flex; gap: 2px; padding: 2px; border-radius: var(--radius-full); background: var(--control-subtle); }
.app-nav a { padding: 5px 14px; border-radius: var(--radius-full); color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: 13px; }
.app-nav a[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.header-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.view { padding: 24px 24px 56px; max-width: 1920px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head > div:first-child { max-width: 880px; }
.page-head h1 { margin: 0; font-size: 24px; font-weight: 500; line-height: 1.3; letter-spacing: 0.01em; }
.page-head p { margin: 6px 0 0; color: var(--ink-2); }

/* ---------- Controls (VDS PillButton / MiscToggle) ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 14px;
  border: 1px solid var(--border-strong); background: var(--surface); border-radius: var(--radius-full); cursor: pointer;
  font-size: 13px; font-weight: 500; line-height: 1; white-space: nowrap; color: var(--ink);
  transition: background-color 120ms var(--ease), color 120ms var(--ease); }
.btn:hover { background: var(--surface-hover); }
.btn:active { transform: translateY(1px); }
.btn-ghost { border-color: transparent; background: var(--control-subtle); }
.btn-ghost:hover { background: var(--control-subtle-hover); }
.btn-small { height: 24px; padding: 0 10px; font-size: 12px; }
.select { height: 32px; border: 1px solid var(--control-border); background-color: var(--surface); border-radius: var(--radius-full);
  padding: 0 32px 0 14px; appearance: none; cursor: pointer; font-size: 13px;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%);
  background-position: calc(100% - 17px) 52%, calc(100% - 12px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
.select-compact { height: 28px; font-size: 12px; padding: 0 28px 0 12px; }

.filters { position: sticky; top: var(--header-h); z-index: 20; display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: flex-end;
  padding: 12px 24px 14px; margin: -24px -24px 20px; background: color-mix(in srgb, var(--page) 86%, transparent);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); border-bottom: 1px solid var(--border); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field > .label { color: var(--muted); }
.segmented { display: inline-flex; gap: 2px; padding: 2px; border-radius: var(--radius-full); background: var(--control-subtle); max-width: 100%; }
.segmented button { border: 0; background: transparent; height: 28px; padding: 0 12px; border-radius: var(--radius-full); cursor: pointer;
  color: var(--ink-2); font-size: 13px; font-weight: 500; white-space: nowrap; transition: background-color 120ms var(--ease), color 120ms var(--ease); }
.segmented button:hover { color: var(--ink); }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow), 0 0 0 1px var(--border); }
.checks { display: flex; gap: 6px 16px; min-height: 32px; align-items: center; flex-wrap: wrap; }
.check { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; color: var(--ink-2); white-space: nowrap; font-size: 13px; }
.check input { accent-color: var(--ink-solid); margin: 0; width: 15px; height: 15px; }

/* Multi-select */
.ms { position: relative; }
.ms-button { min-width: 200px; justify-content: space-between; border-color: var(--control-border); font-weight: 400; }
.ms-button::after { content: ""; width: 6px; height: 6px; border-right: 1.5px solid var(--ink-2); border-bottom: 1.5px solid var(--ink-2);
  transform: rotate(45deg) translateY(-2px); flex: none; }
.ms-panel { position: absolute; top: calc(100% + 8px); left: 0; z-index: 40; width: 380px; max-width: calc(100vw - 32px);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-md); box-shadow: var(--shadow-pop);
  display: flex; flex-direction: column; max-height: min(70vh, 620px); }
.ms-head { padding: 12px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.ms-search { width: 100%; height: 32px; border: 1px solid var(--control-border); border-radius: var(--radius-full); padding: 0 14px; background: var(--surface); }
.ms-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.ms-list { overflow: auto; padding: 4px 6px 10px; }
.ms-group { padding: 12px 8px 4px; display: flex; justify-content: space-between; align-items: center; color: var(--muted); }
.ms-group button { font-size: 12px; font-weight: 500; border: 0; background: none; color: var(--ink); text-decoration: underline;
  text-decoration-color: var(--faint); text-underline-offset: 3px; cursor: pointer; padding: 2px 4px; }
.ms-item { display: flex; gap: 10px; align-items: center; padding: 6px 8px; border-radius: var(--radius-sm); cursor: pointer; font-size: 13px; }
.ms-item:hover { background: var(--control-subtle); }
.ms-item input { accent-color: var(--ink-solid); margin: 0; flex: none; width: 15px; height: 15px; }
.ms-item .ms-name { flex: 1; min-width: 0; }
.ms-item .ms-hint { font-size: 11px; color: var(--muted); }

/* Forecast-type markers: shape-coded and party-neutral (VDS reserves blue/red/orange for
 * partisan data). Circle = Vantage issued, diamond = external, ring = retrospective. */
.mk { display: inline-block; width: 9px; height: 9px; flex: none; vertical-align: 0; }
.mk-vantage { border-radius: 50%; background: var(--ink); }
.mk-external { width: 8px; height: 8px; background: var(--ink); transform: rotate(45deg); border-radius: 1px; margin: 0 1px; }
.mk-retro { border-radius: 50%; border: 2px solid var(--ink-2); background: transparent; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); white-space: nowrap; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12px; color: var(--ink-2); padding-bottom: 4px; }

/* ---------- Notices ---------- */
.notices { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 10px 14px; border-radius: var(--radius-md); border: 1px solid var(--info-border);
  background: var(--info-bg); color: var(--ink); font-size: 13px; }
.notice.warn { background: var(--warn-bg); border-color: var(--warn-border); }
.notice > div { flex: 1; min-width: 0; padding-top: 1px; }
.notice .icon { flex: none; font-weight: 600; width: 18px; height: 18px; border-radius: 50%; display: inline-grid; place-items: center;
  font-size: 11px; color: var(--ink); background: var(--control-subtle); margin-top: 1px; }
.notice.warn .icon { background: var(--control-inverse); color: var(--on-inverse); }
.notice button { flex: none; }

/* ---------- KPI tiles (VDS card anatomy: eyebrow, value, detail) ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 20px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 16px; box-shadow: var(--shadow); }
.tile-label { color: var(--muted); }
.tile-value { font-size: 24px; font-weight: 500; line-height: 1.3; letter-spacing: 0.01em; margin-top: 6px; }
.tile-sub { font-size: 12px; color: var(--ink-2); margin-top: 4px; line-height: 1.5; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); margin-bottom: 20px;
  overflow: hidden; box-shadow: var(--shadow); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px 16px; flex-wrap: wrap; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-head h2 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: 0.01em; }
.card-head .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.card-tools { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; }
.card-tools .caption { color: var(--muted); }
.card-body { padding: 16px 20px; }
.foot { padding: 12px 20px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--border); line-height: 1.55; }

/* Horizontal scroll frame: edge fade on the right while more columns remain. */
.scroll-frame { position: relative; }
.scroll-frame::after { content: ""; position: absolute; top: 0; right: 0; bottom: 0; width: 32px; pointer-events: none; z-index: 6;
  background: linear-gradient(to left, var(--surface), transparent); opacity: 0; transition: opacity 200ms var(--ease); }
.scroll-frame.can-scroll-right::after { opacity: 1; }
.table-wrap, .races-wrap { overflow: auto; overscroll-behavior-x: contain; scrollbar-width: thin; scrollbar-color: var(--axis) transparent; }
.table-wrap:focus-visible, .races-wrap:focus-visible { outline-offset: -2px; }

/* ---------- Scorecard table ---------- */
.ranking-status { padding: 10px 20px; font-size: 12px; color: var(--ink-2); border-bottom: 1px solid var(--border); background: var(--surface-2); }
.ranking-status.different-pools { color: var(--ink); background: var(--warn-bg); }
table.grid { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; font-size: 13px; }
.grid th, .grid td { padding: 9px 10px; border-bottom: 1px solid var(--grid); text-align: right; white-space: nowrap; background: var(--surface); }
.grid thead th { font-weight: 500; color: var(--ink-2); font-size: 12px; vertical-align: bottom; border-bottom-color: var(--border-strong); }
.grid th.l, .grid td.l { text-align: left; }
.grid th.sep, .grid td.sep { border-left: 1px solid var(--border-strong); }
.grid td { font-variant-numeric: tabular-nums; }
.grid td.metric { min-width: 72px; }

/* Band row: collapsible column groups. */
.grid th.band { padding: 0; text-align: left; color: var(--muted); border-bottom: 1px solid var(--grid); }
.band-toggle { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: transparent; cursor: pointer;
  padding: 10px 10px; font: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit; text-align: left; white-space: nowrap;
  transition: background-color 120ms var(--ease), color 120ms var(--ease); }
.band-toggle:hover { color: var(--ink); background: var(--control-subtle); }
.band-toggle:focus-visible { outline-offset: -2px; }
.band-toggle .band-detail { text-transform: none; letter-spacing: 0.02em; font-weight: 400; color: var(--muted); }
.band-toggle .chev { margin-left: auto; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(-135deg) translate(-1px, -1px); flex: none; transition: transform 200ms var(--ease); }
.band-toggle[aria-expanded="false"] .chev { transform: rotate(-45deg); }
.band-hidden { text-transform: none; letter-spacing: 0.02em; font-weight: 500; color: var(--ink-2); background: var(--control-subtle);
  border-radius: var(--radius-full); padding: 1px 7px; }

/* Sticky identity columns: rank and model stay visible while scrolling horizontally. */
.grid .sticky-col { position: sticky; z-index: 3; }
.grid thead .sticky-col { z-index: 5; }
.grid .rank-col { left: 0; width: var(--rank-w); min-width: var(--rank-w); max-width: var(--rank-w); text-align: center; padding-left: 8px; padding-right: 8px; }
.grid .model-col { left: var(--rank-w); width: var(--model-w); min-width: var(--model-w); max-width: var(--model-w); white-space: normal; }
.grid .edge { border-right: 1px solid var(--border-strong); transition: box-shadow 200ms var(--ease); }
.can-scroll-left .grid .edge, .can-scroll-left .races .edge { box-shadow: 8px 0 10px -8px var(--edge-shadow); }
.grid .type-col { color: var(--ink-2); }

/* Rows */
.grid tbody tr[data-model]:hover td { background: var(--surface-hover); }
.grid tr.group td { background: var(--surface-2); padding: 14px 0 6px; border-bottom-color: var(--border-strong); text-align: left; }
.grid tbody tr.group:not(:first-child) td { border-top: 1px solid var(--border-strong); }
.grid tr.group .group-label { position: sticky; left: 0; display: inline-flex; align-items: baseline; gap: 10px; padding: 0 16px; color: var(--ink-2); }
.grid tr.group .group-count { font-size: 11px; font-weight: 400; letter-spacing: 0.02em; text-transform: none; color: var(--muted); }
.grid td.empty-row { text-align: left; color: var(--muted); font-size: 12px; padding: 10px 16px; }
.rank-pill { display: inline-grid; place-items: center; min-width: 28px; height: 22px; padding: 0 6px; border-radius: var(--radius-full);
  font-weight: 600; font-size: 12px; background: var(--control-subtle); color: var(--ink); }
.rank-pill.top { background: var(--accent-fill); color: var(--accent-ink); box-shadow: inset 0 0 0 1px var(--warn-border); }
.model-cell { display: flex; align-items: center; gap: 10px; }
.model-name { font-weight: 500; flex: 1; min-width: 0; }
.model-name.retro { font-weight: 400; color: var(--ink-2); }
.info-dot { color: var(--ink-2); cursor: help; font-size: 11px; font-weight: 600; border: 1px solid var(--control-border); border-radius: 50%;
  width: 18px; height: 18px; display: inline-grid; place-items: center; flex: none; font-style: normal; }
.info-dot:hover { color: var(--ink); background: var(--control-subtle); }
.na { color: var(--muted); }
.best { font-weight: 600; }
.best::before { content: "▲"; font-size: 8px; margin-right: 4px; vertical-align: 2px; color: var(--ink-2); }
.ncell { display: inline-flex; align-items: center; gap: 8px; justify-content: flex-end; }
.cov { width: 32px; height: 4px; border-radius: 2px; background: var(--control-subtle-hover); overflow: hidden; display: inline-block; }
.cov > i { display: block; height: 100%; background: var(--ink-2); border-radius: 2px; }
.cov.partial > i { background: var(--faint); }

/* Sortable metric headers and the active (ranked) column: the view's one accent emphasis. */
.grid .metric-sort { display: inline-flex; align-items: center; justify-content: flex-end; gap: 4px; border: 0; background: transparent;
  padding: 9px 10px; margin: -9px -10px; width: calc(100% + 20px); font: inherit; color: inherit; cursor: pointer; text-align: right;
  text-decoration: underline dotted var(--faint); text-underline-offset: 4px; transition: color 120ms var(--ease); }
.grid .metric-sort:hover { color: var(--ink); text-decoration-color: var(--ink-2); }
.grid .metric-sort:focus-visible { outline: 2px solid var(--focus); outline-offset: -3px; border-radius: 6px; }
.grid th .arrow { font-size: 9px; color: var(--ink); }
.grid th.active-metric { background: var(--accent-fill); color: var(--ink); font-weight: 600; box-shadow: inset 0 -2px var(--ink); }
.grid th.active-metric .metric-sort { text-decoration: none; }
.grid td.active-metric, .grid tbody tr[data-model]:hover td.active-metric { background: var(--accent-wash); font-weight: 500; }

/* ---------- Chart ---------- */
.chart-controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; max-width: 100%; }
svg.dots { display: block; width: 100%; height: auto; font-family: var(--font); }
svg.dots text { fill: var(--ink-2); font-size: 12px; }
svg.dots .tick text { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
svg.dots .gridline { stroke: var(--grid); stroke-width: 1; }
svg.dots .zero { stroke: var(--axis); stroke-width: 1.5; }
svg.dots .row:hover .hit, svg.dots .row:focus .hit { fill: var(--control-subtle); }
svg.dots .row:focus { outline: none; }
svg.dots .row:focus-visible .hit { stroke: var(--focus); stroke-width: 1.5; }
svg.dots .hit { fill: transparent; }
svg.dots .stem { stroke: var(--axis); stroke-width: 1; }
svg.dots .pt-fill { fill: var(--ink); stroke: var(--surface); stroke-width: 1.5; }
svg.dots .pt-ring { fill: var(--surface); stroke: var(--ink-2); stroke-width: 2; }

/* ---------- Race table base (used by the race explorer) ---------- */
.search { height: 32px; border: 1px solid var(--control-border); border-radius: var(--radius-full); padding: 0 14px; background: var(--surface); min-width: 260px; font-size: 13px; }
.races-wrap { max-height: min(72vh, 760px); }
table.races { border-collapse: separate; border-spacing: 0; font-size: 12px; width: max-content; min-width: 100%; }
.races th, .races td { padding: 6px 8px; border-bottom: 1px solid var(--grid); text-align: right; white-space: nowrap; background: var(--surface); }
.races thead th { position: sticky; top: 0; z-index: 3; vertical-align: bottom; font-weight: 500; color: var(--ink-2); cursor: pointer;
  border-bottom-color: var(--border-strong); }
.races thead th:hover { color: var(--ink); }
.races thead th.mcol { white-space: normal; width: 80px; min-width: 80px; max-width: 80px; padding: 6px 4px; font-size: 11px; line-height: 1.3; text-align: center; hyphens: auto; overflow-wrap: break-word; }
.races .sticky { position: sticky; left: 0; z-index: 2; text-align: left; }
.races thead .sticky { z-index: 4; }
.races .edge { border-right: 1px solid var(--border-strong); transition: box-shadow 200ms var(--ease); }
.races td.c { text-align: center; font-variant-numeric: tabular-nums; }
.races td.c.x { outline: 1.5px dashed var(--ink); outline-offset: -3px; }
.races td.c .na { font-size: 11px; }
.races tbody tr:hover td.sticky, .races tbody tr:hover td:not(.c) { background: var(--surface-hover); }

/* ---------- Race explorer ----------
 * Pinned race + result columns, two sticky header rows (model categories, models),
 * collapsible race-category tbodies and an inline detail row. Incorrect calls use the
 * dashed ink outline; the reference model column is the one accent emphasis. */
.rx-toolbar { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: flex-end; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.rx-toolbar .search { min-width: 220px; }
.rx-toolbar #rx-ref { max-width: 280px; }
.rx-inline { display: flex; gap: 6px; align-items: center; }
.rx-status { padding: 10px 20px; font-size: 12px; color: var(--ink-2); border-bottom: 1px solid var(--border); background: var(--surface-2); }
.rx-warn { color: var(--ink); background: var(--warn-bg); border-radius: 4px; padding: 0 4px; }
.rx-count { font-size: 11px; color: var(--muted); margin-left: 2px; font-variant-numeric: tabular-nums; }
.segmented button[aria-pressed="true"] .rx-count { color: var(--ink-2); }

.rx-wrap { --rx-band-h: 34px; --rx-race-w: 168px; --rx-res-w: 116px; --rx-col-w: 92px; max-height: min(78vh, 880px); }
.rx thead th { padding: 0; cursor: default; }
.rx thead tr.rx-band th { top: 0; height: var(--rx-band-h); }
.rx thead tr.rx-cols th { top: var(--rx-band-h); }
.rx .rx-race-col { position: sticky; left: 0; z-index: 2; text-align: left; width: var(--rx-race-w); min-width: var(--rx-race-w); max-width: var(--rx-race-w); }
.rx .rx-res-col { position: sticky; left: var(--rx-race-w); z-index: 2; text-align: left; width: var(--rx-res-w); min-width: var(--rx-res-w); max-width: var(--rx-res-w); }
.rx thead .rx-race-col, .rx thead .rx-res-col { z-index: 6; }
.rx-hbtn { display: flex; align-items: flex-end; gap: 4px; width: 100%; min-height: 100%; border: 0; background: transparent; padding: 8px;
  font: inherit; color: inherit; cursor: pointer; text-align: left; text-decoration: underline dotted var(--faint); text-underline-offset: 4px; }
.rx-hbtn:hover { color: var(--ink); text-decoration-color: var(--ink-2); }
.rx-hbtn:focus-visible { outline-offset: -3px; border-radius: 6px; }
.rx-hbtn[aria-pressed="true"] { color: var(--ink); font-weight: 600; text-decoration: none; }
.rx-hbtn .arrow { font-size: 9px; }
.rx .rx-sum { min-width: 70px; text-align: right; }
.rx thead .rx-sum .rx-hbtn { justify-content: flex-end; text-align: right; }
.rx thead th.mcol { width: var(--rx-col-w); min-width: var(--rx-col-w); max-width: var(--rx-col-w); padding: 0; }
.rx-mbtn { flex-direction: column; align-items: center; justify-content: flex-end; text-align: center; gap: 4px; padding: 6px 4px;
  font-size: 11px; line-height: 1.25; white-space: normal; overflow-wrap: anywhere; text-decoration: none; }
.rx-mbtn > span:not(.mk) { text-decoration: underline dotted var(--faint); text-underline-offset: 3px; }
.rx th.rx-cat { color: var(--muted); }
.rx th.rx-cat .band-toggle { padding: 8px 10px; height: var(--rx-band-h); }
.rx th.rx-cat .band-toggle[aria-expanded="false"] { white-space: normal; line-height: 1.2; }
.rx thead th.rx-catcol { font-size: 11px; padding: 6px 4px; text-align: center; color: var(--ink-2); vertical-align: bottom; }
.rx th.sep, .rx td.sep { border-left: 1px solid var(--border-strong); }

.rx td { padding: 5px 8px; vertical-align: middle; }
.rx td.c { width: var(--rx-col-w); min-width: var(--rx-col-w); max-width: var(--rx-col-w); padding: 4px 6px; }
.rx .rx-l1 { font-weight: 500; line-height: 1.3; }
.rx .rx-line2 { display: flex; justify-content: space-between; gap: 4px; font-size: 11px; color: var(--ink-2); line-height: 1.3; min-height: 14px; }
.rx td.rx-sum .rx-line2 { justify-content: flex-end; }
.rx-call { font-weight: 600; color: var(--ink); white-space: nowrap; }
.rx th.rx-ref { background: var(--accent-fill); box-shadow: inset 0 -2px var(--ink); }
.rx th.rx-ref .rx-mbtn { color: var(--ink); font-weight: 600; }
.rx td.rx-ref { background-color: var(--accent-wash); box-shadow: inset 1px 0 var(--warn-border), inset -1px 0 var(--warn-border); }

/* Race category sections */
.rx tr.rx-sec td { padding: 0; background: var(--surface-2); border-top: 1px solid var(--border-strong); border-bottom-color: var(--border-strong); text-align: left; }
.rx-sec-inner { position: sticky; left: 0; width: var(--rx-vw, 100%); display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px;
  padding: 10px 16px; text-align: left; white-space: normal; }
.rx-sec-btn { display: inline-flex; align-items: center; gap: 8px; border: 0; background: transparent; cursor: pointer; padding: 3px 6px; margin-left: -6px;
  border-radius: 6px; color: var(--ink); }
.rx-sec-btn:hover { background: var(--control-subtle); }
.rx-sec-btn .chev { width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg) translate(-1px, -1px);
  transition: transform 200ms var(--ease); flex: none; }
.rx-sec-btn[aria-expanded="false"] .chev { transform: rotate(-45deg); }
.rx-sec-counts { font-size: 12px; color: var(--ink-2); }
.rx tr.rx-more td, .rx tr.rx-empty td { padding: 0; text-align: left; }
.rx tr.rx-more .rx-sec-inner, .rx tr.rx-empty .rx-sec-inner { padding: 8px 16px; font-size: 12px; color: var(--ink-2); gap: 8px; }

/* Race rows */
.rx tr.rx-row { cursor: pointer; }
.rx tbody tr.rx-sec:hover > td, .rx tbody tr.rx-detail:hover > td { background: var(--surface-2); }
.rx tbody tr.rx-more:hover > td, .rx tbody tr.rx-empty:hover > td { background: var(--surface); }
.rx tr.rx-row.open > td.sticky, .rx tr.rx-row.open > td.rx-sum { background: var(--surface-hover); }
.rx-open { display: flex; align-items: center; gap: 6px; max-width: 100%; border: 0; background: transparent; padding: 0; font: inherit; font-weight: 600;
  color: var(--ink); cursor: pointer; text-align: left; }
.rx-open::before { content: ""; width: 5px; height: 5px; flex: none; border-right: 1.5px solid var(--ink-2); border-bottom: 1.5px solid var(--ink-2);
  transform: rotate(-45deg); transition: transform 200ms var(--ease); }
.rx-open[aria-expanded="true"]::before { transform: rotate(45deg); }
.rx-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rx-subline { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); white-space: nowrap; padding-left: 11px; min-height: 17px; }
.rx-subline > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; margin-right: auto; }
.flag { display: inline-flex; align-items: center; height: 16px; padding: 0 5px; border-radius: var(--radius-full); background: var(--control-subtle-hover);
  color: var(--ink); font-size: 10px; font-weight: 600; flex: none; font-variant-numeric: tabular-nums; }
.flag-x { background: transparent; outline: 1.2px dashed var(--ink); outline-offset: -1.2px; }
.rx-x-demo { display: inline-block; padding: 0 4px; outline: 1.5px dashed var(--ink); outline-offset: -1px; font-weight: 600; color: var(--ink); }
.rx-win { display: inline-grid; place-items: center; min-width: 18px; height: 18px; margin-right: 4px; border-radius: 4px;
  background: var(--control-inverse); color: var(--on-inverse); font-size: 11px; font-weight: 600; }
.rx-uncalled { font-style: italic; color: var(--ink-2); font-weight: 400; }
.rx-strong { font-weight: 600; }

/* Detail row: pinned to the visible width of the scroll area. */
.rx tr.rx-detail > td { padding: 0; background: var(--surface-2); text-align: left; white-space: normal; border-bottom: 1px solid var(--border-strong); }
.rx-detail-inner { position: sticky; left: 0; width: var(--rx-vw, 100%); padding: 16px 20px 18px; display: flex; flex-direction: column; gap: 14px; cursor: default; }
.rx-d-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.rx-d-head > div { min-width: 0; }
.rx-d-title { font-size: 14px; font-weight: 600; }
.rx-d-id { font-size: 11px; color: var(--muted); overflow-wrap: anywhere; }
.rx-d-id code { font-size: 11px; }
.rx-facts { display: flex; flex-wrap: wrap; gap: 8px 28px; margin: 0; }
.rx-facts dt { color: var(--muted); }
.rx-facts dd { margin: 2px 0 0; font-size: 13px; font-variant-numeric: tabular-nums; }
.rx-notes { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--ink-2); }
.rx-strip { position: relative; margin: 20px 12px 18px; border-top: 1px solid var(--axis); }
.rx-mark { position: absolute; top: -4px; bottom: 0; width: 0; border-left: 1px dashed var(--axis); }
.rx-mark.actual { border-left: 2px solid var(--ink); margin-left: -1px; }
.rx-mark i { position: absolute; top: -18px; left: 0; transform: translateX(-50%); font-style: normal; font-size: 11px; white-space: nowrap; color: var(--ink-2); }
.rx-mark.actual i { top: auto; bottom: -17px; color: var(--ink); font-weight: 600; }
.rx-dot { position: absolute; width: 12px; height: 12px; margin-left: -6px; display: grid; place-items: center; cursor: help; }
.rx-dot.ref { border-radius: 50%; background: var(--accent-fill); box-shadow: 0 0 0 1px var(--warn-border); }
.rx-axis { position: absolute; top: -18px; font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; }
.rx-axis.lo { left: 0; } .rx-axis.hi { right: 0; }
.rx-d-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); scrollbar-width: thin; }
.rx-d-table { border-collapse: collapse; width: 100%; font-size: 12px; }
.races .rx-d-table th, .races .rx-d-table td { position: static; padding: 6px 10px; border-bottom: 1px solid var(--grid); white-space: nowrap; text-align: right;
  background: transparent; vertical-align: middle; }
.races .rx-d-table thead th { font-weight: 500; color: var(--ink-2); border-bottom-color: var(--border-strong); cursor: default; vertical-align: bottom; }
.races .rx-d-table .l { text-align: left; }
.races .rx-d-table tr.rx-d-group td { background: var(--surface-2); color: var(--muted); text-align: left; padding-top: 10px; }
.races .rx-d-table tr.rx-ref td { background: var(--accent-wash); }
.rx-d-table .rx-call.wrong { outline: 1.5px dashed var(--ink); outline-offset: 1px; padding: 0 3px; border-radius: 2px; }
.races .rx-d-table td.rx-status-cell, .races .rx-d-table td.rx-prov { white-space: normal; min-width: 170px; color: var(--ink-2); }
.races .rx-d-table td.rx-prov { font-size: 11px; max-width: 340px; overflow-wrap: anywhere; }
.rx-d-table .model-cell { gap: 8px; }

/* ---------- Definitions ---------- */
.defs { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 8px 32px; font-size: 13px; color: var(--ink-2); margin: 0; }
.defs dt { font-weight: 600; color: var(--ink); margin-top: 12px; }
.defs div > dt:first-child { margin-top: 0; }
.defs dd { margin: 4px 0 0; overflow-wrap: anywhere; line-height: 1.55; }

/* ---------- Tooltip (VDS TooltipBox: frosted, 12px radius) ---------- */
.tooltip { position: fixed; z-index: 100; pointer-events: none; max-width: 360px; background: var(--glass); color: var(--ink);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border: 1px solid var(--border-strong); border-radius: var(--radius-md);
  box-shadow: var(--shadow-pop); padding: 10px 12px; font-size: 12px; line-height: 1.5; }
.tooltip .tt-title { font-weight: 600; margin-bottom: 6px; }
.tooltip .tt-row { display: flex; justify-content: space-between; gap: 16px; color: var(--ink-2); }
.tooltip .tt-row b { font-variant-numeric: tabular-nums; font-weight: 500; color: var(--ink); text-align: right; }
.tooltip .tt-note { color: var(--ink-2); margin-top: 6px; }

.empty { padding: 32px 16px; text-align: center; color: var(--muted); }
.error { padding: 24px; border: 1px solid var(--warn-border); background: var(--warn-bg); border-radius: var(--radius-card); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}

/* ---------- Turnout scorecard ---------- */
.tv-head { align-items: baseline; gap: 8px 16px; }
.tv-status { font-size: 12px; color: var(--ink-2); padding: 2px 10px; border-radius: var(--radius-full); background: var(--control-subtle); cursor: help; }
.tv-i { display: inline-grid; place-items: center; width: 14px; height: 14px; margin-left: 4px; border-radius: 50%; border: 1px solid var(--control-border);
  font: 600 9px/1 var(--font); letter-spacing: 0; text-transform: none; color: var(--ink-2); cursor: help; vertical-align: 1px; }
.tv-i:hover { color: var(--ink); border-color: var(--ink-2); }
.tv-assume-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tv-assume-row .select { min-width: 230px; }
.segmented button:disabled { opacity: 0.45; cursor: not-allowed; }
.tv-tiles { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.tv-tiles .tile-value { white-space: nowrap; }
.tv-up { color: var(--ink); font-weight: 600; }
.tv-down { color: var(--ink-2); }
.tv-split { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(260px, 1fr); gap: 16px 32px; align-items: start; }
.tv-chart { min-width: 0; }
/* Predicted turnout by assumption: one row per scenario, dot = predicted, rule = recorded. */
.tv-levels { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.tv-lv-head, .tv-lv { display: grid; grid-template-columns: minmax(150px, 240px) minmax(110px, 1fr) 205px; gap: 12px; align-items: center; }
.tv-lv-head { font-size: 11px; color: var(--muted); padding: 0 8px 6px; }
.tv-lv-head > span:last-child, .tv-lv-val { text-align: right; }
.tv-rec-key { display: inline-block; width: 2px; height: 10px; background: var(--ink); vertical-align: -1px; margin: 0 2px 0 6px; }
.tv-lv { padding: 5px 8px; border-radius: var(--radius-sm); cursor: pointer; }
.tv-lv:hover { background: var(--surface-hover); }
.tv-lv.on { background: var(--accent-wash); box-shadow: inset 0 0 0 1px var(--warn-border); }
.tv-lv-name { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tv-lv.on .tv-lv-name { color: var(--ink); font-weight: 500; }
.tv-badge { font-size: 10px; padding: 1px 6px; border-radius: var(--radius-full); background: var(--control-subtle); color: var(--ink-2); margin-left: 4px; font-weight: 500; }
.tv-badge.pub { background: var(--control-inverse); color: var(--on-inverse); }
.tv-lv-track { position: relative; height: 18px; }
.tv-lv-track::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 1px solid var(--grid); }
.tv-lv-rec { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--ink); border-radius: 1px; }
.tv-lv-bar { position: absolute; top: 50%; height: 2px; margin-top: -1px; background: var(--axis); }
.tv-lv-dot { position: absolute; top: 50%; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: var(--ink-2); box-shadow: 0 0 0 2px var(--surface); }
.tv-lv.on .tv-lv-dot { background: var(--ink); }
.tv-lv-foot { font-size: 11px; color: var(--muted); padding: 8px 8px 0; }
details.tv-more { border-top: 1px solid var(--border); }
details.tv-more > summary, details.tv-method > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; }
details.tv-more > summary { padding: 12px 20px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
details.tv-more > summary::before, details.tv-method > summary::before { content: ""; width: 6px; height: 6px; border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform 120ms var(--ease); }
details[open].tv-more > summary::before, details[open].tv-method > summary::before { transform: rotate(45deg); }
details.tv-more > summary::-webkit-details-marker, details.tv-method > summary::-webkit-details-marker { display: none; }
details.tv-method > summary { padding: 16px 20px; }
details.tv-method > summary h2 { margin: 0; font-size: 16px; font-weight: 600; }
details[open].tv-method > summary { border-bottom: 1px solid var(--border); }
.tv-scroll { max-height: 480px; }
.tv-scroll thead th { position: sticky; top: 0; z-index: 2; }
.tv-pad { padding: 12px 20px; }
.tv-flag { font-size: 11px; color: var(--ink-2); border: 1px solid var(--warn-border); background: var(--warn-bg); border-radius: var(--radius-full); padding: 0 6px; }
.grid tr.tv-dim td { color: var(--muted); }
.grid tr.tv-sel td { background: var(--accent-wash); }
.grid tr.tv-click { cursor: pointer; }
.grid tr.tv-click:hover td { background: var(--surface-hover); }
.grid td.tv-good { color: var(--ink); font-weight: 600; }
.grid td.tv-worse { color: var(--ink-2); }
.tv-ok { color: var(--ink-2); }
.tv-bad { color: var(--ink); font-weight: 600; }
.tv-search { width: 220px; }
.tv-pair { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 0 20px; align-items: start; }
.tv-resp td.l { white-space: normal; min-width: 130px; max-width: 220px; }
.tv-resp tr.group td { white-space: normal; }
.tv-resp tr.group .group-label { position: static; display: inline; padding: 0 6px 0 12px; }
.tv-resp tr.group .tv-base { display: inline-block; font-size: 12px; color: var(--muted); }
.tv-resp th, .tv-resp td { padding-left: 10px; padding-right: 10px; }
/* Diverging Δ RMSE bars: left of the centre line = better. Direction is encoded by position and sign. */
.tv-bars { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.tv-bar-row { display: grid; grid-template-columns: minmax(110px, 160px) minmax(100px, 1fr) 52px 58px; gap: 10px; align-items: center; padding: 3px 4px; border-radius: var(--radius-sm); }
.tv-bar-row:hover { background: var(--surface-hover); }
.tv-bar-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tv-bar-track { position: relative; height: 14px; }
.tv-bar-track::before { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; border-left: 1px solid var(--axis); }
.tv-bar { position: absolute; top: 2px; bottom: 2px; border-radius: 4px; }
.tv-bar.better { background: var(--ink); border-top-right-radius: 0; border-bottom-right-radius: 0; }
.tv-bar.worse { background: var(--axis); border-top-left-radius: 0; border-bottom-left-radius: 0; }
.tv-bar-val, .tv-bar-calls { text-align: right; font-size: 12px; }
.tv-bars-foot { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin: 8px 0 10px; padding: 0 62px 0 calc(min(160px, 30%) + 14px); }
.tv-defs ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; line-height: 1.55; color: var(--ink-2); max-width: 1100px; }
svg.tv-svg { display: block; max-width: 100%; height: auto; overflow: visible; }
svg.tv-svg .gridline { stroke: var(--grid); stroke-width: 1; }
svg.tv-svg .zero { stroke: var(--axis); stroke-width: 1.5; }
svg.tv-svg .tick-label, svg.tv-svg .pt-label { font-size: 11px; fill: var(--ink-2); font-variant-numeric: tabular-nums; }
svg.tv-svg .axis-label { font-size: 11px; fill: var(--muted); }
svg.tv-svg .tv-diag { stroke: var(--axis); stroke-width: 1.5; stroke-dasharray: 4 4; }
svg.tv-svg .tv-cursor { stroke: var(--accent); stroke-width: 6; opacity: 0.55; }
svg.tv-svg .hit { fill: transparent; }
svg.tv-svg g:hover .hit, svg.tv-svg g:focus .hit { fill: var(--control-subtle); }
svg.tv-svg g:focus-visible .hit { stroke: var(--focus); stroke-width: 1.5; }
svg.tv-svg g:focus { outline: none; }
svg.tv-svg .pt-fill { fill: var(--ink); stroke: var(--surface); stroke-width: 2; }
svg.tv-svg .pt-ring { fill: var(--surface); stroke: var(--ink-2); stroke-width: 2; }
svg.tv-svg .tv-line-on { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; }
svg.tv-svg .tv-line-off { fill: none; stroke: var(--axis); stroke-width: 1.5; stroke-linejoin: round; }
svg.tv-svg .tv-pt-off { fill: var(--axis); }
svg.tv-svg .tv-end-on { font-size: 12px; font-weight: 600; fill: var(--ink); }
svg.tv-svg .tv-end-off { font-size: 11px; fill: var(--muted); }
.tv-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--ink-2); margin-top: 8px; }
.tv-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.tv-key-line { width: 16px; height: 2px; background: var(--ink); border-radius: 1px; }
.tv-key-sq { width: 8px; height: 8px; background: var(--ink); border-radius: 1.5px; }
.tv-key-cur { width: 6px; height: 12px; background: var(--accent); opacity: 0.8; border-radius: 1px; }
@media (max-width: 1100px) { .tv-split { grid-template-columns: 1fr; } }
@media (max-width: 1280px) { .tv-pair { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .tv-search { width: 100%; } .tv-pad { padding: 12px 16px; }
  .tv-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .tv-tiles .tile { padding: 12px; }
  .tv-tiles .tile-value { font-size: 19px; }
  .tv-tiles .tile-sub { font-size: 11px; }
  .tv-assume-row .select { flex: 1 1 100%; min-width: 0; }
  .tv-lv-head, .tv-lv { grid-template-columns: minmax(0, 1fr) minmax(60px, 0.8fr) minmax(0, 1fr); gap: 8px; }
  .tv-lv-val { font-size: 11px; line-height: 1.3; }
  .tv-lv-name { white-space: normal; font-size: 12px; line-height: 1.3; }
  .tv-bar-row { grid-template-columns: minmax(84px, 1fr) minmax(70px, 1.2fr) 44px 50px; gap: 6px; }
  .tv-bars-foot { padding: 0 0 0 0; }
  .tv-resp td.l { min-width: 112px; max-width: 132px; font-size: 12px; }
  .tv-resp th, .tv-resp td { padding-left: 6px; padding-right: 6px; }
  details.tv-more > summary, details.tv-method > summary { padding-left: 16px; padding-right: 16px; }
}

/* ---------- Responsive (local extension; VDS is desktop-only) ---------- */
/* Keep the filter bar sticky only where it fits on one row. */
@media (max-width: 1400px) {
  .filters { position: static; }
}
@media (max-width: 1100px) {
  .view { padding: 20px 20px 48px; }
  .filters { margin: -20px -20px 20px; padding: 12px 20px 14px; }
  .app-header { padding: 8px 20px; }
}
@media (max-width: 760px) {
  :root { --rank-w: 48px; --model-w: clamp(150px, 42vw, 220px); }
  .app-header { position: static; padding: 10px 16px; gap: 10px 12px; flex-wrap: wrap; }
  .brand { flex: 1 1 100%; }
  .header-actions { margin-left: auto; max-width: 100%; min-width: 0; }
  .header-actions .select { min-width: 0; flex: 1; }
  .header-actions .btn { flex-shrink: 0; }
  .view { padding: 16px 16px 48px; }
  .page-head h1 { font-size: 20px; }
  .filters { position: static; margin: 0 0 16px; padding: 0 0 16px; background: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
  .filters .field { flex: 1 1 100%; }
  .ms-button, .filters .select { min-width: 0; width: 100%; }
  .segmented { overflow-x: auto; scrollbar-width: none; }
  .card-head { padding: 14px 16px; }
  .card-body { padding: 12px 16px; }
  .foot, .ranking-status { padding-left: 16px; padding-right: 16px; }
  .card-tools { width: 100%; }
  .rx-wrap { --rx-race-w: 112px; --rx-res-w: 94px; --rx-col-w: 86px; }
  .rx-toolbar { padding: 12px 16px; gap: 10px 12px; }
  .rx-toolbar .field { flex: 1 1 100%; }
  .rx-toolbar .search, .rx-toolbar .select, .rx-toolbar #rx-ref { width: 100%; min-width: 0; max-width: none; flex: none; }
  .rx-inline .select { flex: 1; }
  .rx-status { padding-left: 16px; padding-right: 16px; }
  .rx-detail-inner { padding: 12px; }
  .rx-sec-inner { padding: 10px 12px; }
  .search { flex: 1 1 100%; min-width: 0; }
  .defs { grid-template-columns: 1fr; }
  .notice { flex-wrap: wrap; }
  .notice > div { flex: 1 1 calc(100% - 30px); }
  .notice button { margin-left: 30px; }
  .grid th, .grid td { padding: 8px 10px; }
  .grid .type-col { white-space: normal; min-width: 104px; max-width: 120px; }
  .grid .type-col .badge { white-space: normal; }
}
