/* CERT-C repair leaderboard UI v2 — zero-dependency static styles.
   No external fonts, no CDN. System font stack only. */

:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f0f2f8;
  --ink: #141a24;
  --ink-soft: #4a5567;
  --ink-faint: #8a94a6;
  --line: #e3e7ef;
  --line-strong: #cdd4e0;
  --accent: #1f6feb;
  --accent-ink: #0b4bbf;
  --accent-wash: #e9f1ff;
  --mode-off: #1f6feb;
  --mode-high: #d9770e;
  --mode-other: #64748b;
  --gold: #b8860b;
  --good: #128a5a;
  --good-wash: #e5f6ee;
  --watch: #b5541a;
  --watch-wash: #fdefe4;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(20, 26, 36, .05), 0 8px 24px rgba(20, 26, 36, .06);
  --shadow-sm: 0 1px 2px rgba(20, 26, 36, .06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", "Roboto Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117;
    --surface: #161b22;
    --surface-2: #1c232d;
    --ink: #e9edf3;
    --ink-soft: #adb7c4;
    --ink-faint: #7d8797;
    --line: #263040;
    --line-strong: #33405480;
    --accent: #4d8bff;
    --accent-ink: #8fb6ff;
    --accent-wash: #16233c;
    --mode-off: #4d8bff;
    --mode-high: #f0902f;
    --mode-other: #94a3b8;
    --gold: #e0b23c;
    --good: #3ac081;
    --good-wash: #123027;
    --watch: #e0894d;
    --watch-wash: #2e2114;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 28px rgba(0, 0, 0, .35);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

.shell {
  width: 100%;
  max-width: 1140px;
  margin-inline: auto;
  padding-inline: 24px;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 12px; top: -48px;
  background: var(--accent);
  color: #fff;
  padding: 8px 14px;
  border-radius: 8px;
  z-index: 50;
  transition: top .15s ease;
}
.skip-link:focus { top: 12px; }

a { color: var(--accent-ink); }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.eyebrow {
  margin: 0;
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--accent-ink);
}

/* ---- Header ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--line);
}
.nav-shell {
  display: flex;
  align-items: center;
  gap: 18px;
  height: 62px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 700;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), #6aa2ff);
  color: #fff;
  font-size: .82rem;
  letter-spacing: .02em;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-sub { font-size: .68rem; font-weight: 600; color: var(--ink-faint); letter-spacing: .12em; text-transform: uppercase; }
.nav-shell nav {
  display: flex;
  gap: 6px;
  margin-left: auto;
}
.nav-shell nav a {
  padding: 7px 12px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--ink-soft);
  font-size: .9rem;
  font-weight: 600;
}
.nav-shell nav a:hover { background: var(--surface-2); color: var(--ink); }
.edition-chip {
  padding: 6px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: .74rem;
  font-weight: 700;
  color: var(--ink-soft);
  white-space: nowrap;
}

/* ---- Hero ---- */
.hero {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: 32px;
  align-items: end;
  padding-top: 54px;
  padding-bottom: 30px;
}
.hero h1 {
  margin: 10px 0 14px;
  font-size: clamp(1.9rem, 4vw, 2.7rem);
  line-height: 1.1;
  letter-spacing: -.02em;
}
.hero h1 em { font-style: normal; color: var(--accent-ink); }
.lede { margin: 0; font-size: 1.06rem; color: var(--ink-soft); max-width: 46ch; }
.hero-note {
  background: var(--accent-wash);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.hero-note-label {
  margin: 0 0 6px;
  font-weight: 700;
  font-size: .82rem;
  color: var(--accent-ink);
}
.hero-note p { margin: 0; font-size: .93rem; color: var(--ink-soft); }
.hero-note strong { color: var(--ink); }

/* ---- Summary cards ---- */
.summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  padding-top: 8px;
  padding-bottom: 8px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}
.stat-label { margin: 0; font-size: .8rem; font-weight: 600; color: var(--ink-faint); }
.stat-value { display: block; font-size: 1.7rem; font-weight: 700; letter-spacing: -.02em; margin: 4px 0 2px; }
.stat-sub { font-size: .78rem; color: var(--ink-faint); }

/* ---- Section headings ---- */
.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.section-heading h2 {
  margin: 4px 0 0;
  font-size: 1.5rem;
  letter-spacing: -.01em;
}
.result-summary { margin: 0; color: var(--ink-faint); font-size: .9rem; font-weight: 600; }

.board { padding-top: 40px; }

/* ---- Toolbar ---- */
.toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.search-field { flex: 1 1 320px; }
.search-field input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font-size: .95rem;
  font-family: inherit;
}
.search-field input::placeholder { color: var(--ink-faint); }
.mode-filter {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.mode-chip {
  padding: 7px 14px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  font-size: .84rem;
  font-weight: 700;
  letter-spacing: .02em;
  cursor: pointer;
}
.mode-chip:hover { color: var(--ink); }
.mode-chip.active {
  background: var(--surface);
  color: var(--accent-ink);
  box-shadow: var(--shadow-sm);
}
.toolbar-note { margin: 0; font-size: .82rem; color: var(--ink-faint); font-weight: 600; }

/* ---- Table ---- */
.table-wrap {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 880px;
}
thead th {
  position: sticky;
  top: 0;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line-strong);
  text-align: left;
  font-size: .76rem;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding: 0;
  z-index: 1;
}
.col-metric, .col-cost { text-align: right; }
.col-rank { width: 74px; }
.col-action { width: 96px; }
.sort-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: 0;
  font: inherit;
  font-size: .76rem;
  letter-spacing: .03em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--ink-faint);
  cursor: pointer;
  padding: 13px 16px;
}
.col-metric .sort-btn, .col-cost .sort-btn { justify-content: flex-end; }
.sort-btn:hover { color: var(--ink); }
.sort-btn.active { color: var(--accent-ink); }
.sort-ind { font-size: .62rem; }

tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: color-mix(in srgb, var(--accent-wash) 45%, transparent); }
.col-metric, td.col-metric { text-align: right; }

/* rank cell */
.rank-cell { }
.rank-badge {
  display: inline-grid;
  place-items: center;
  min-width: 30px; height: 30px;
  padding: 0 8px;
  border-radius: 8px;
  font-weight: 700;
  font-size: .95rem;
  background: var(--surface-2);
  color: var(--ink-soft);
  border: 1px solid var(--line);
}
.rank-badge.medal-1 { background: #fff6da; color: #8a6a00; border-color: #f0d97a; }
.rank-badge.medal-2 { background: #f2f4f8; color: #566073; border-color: #d3dae6; }
.rank-badge.medal-3 { background: #fbeede; color: #935b21; border-color: #eecfa6; }
@media (prefers-color-scheme: dark) {
  .rank-badge.medal-1 { background: #3a3212; color: #e9c860; border-color: #5c4e1e; }
  .rank-badge.medal-2 { background: #2a303a; color: #c4ccd8; border-color: #3c4656; }
  .rank-badge.medal-3 { background: #3a2b18; color: #e0a869; border-color: #5b421f; }
}

/* system cell */
.system-cell { min-width: 220px; }
.system-name {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  font-size: .98rem;
}
a.system-name:hover { color: var(--accent-ink); text-decoration: underline; }
.ext-mark { font-size: .72rem; color: var(--ink-faint); }
.mode-tag {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: .66rem;
  font-weight: 700;
  letter-spacing: .05em;
  vertical-align: middle;
}
.mode-tag.mode-high { background: color-mix(in srgb, var(--mode-high) 14%, transparent); color: var(--mode-high); border: 1px solid color-mix(in srgb, var(--mode-high) 35%, transparent); }
.mode-tag.mode-off { background: color-mix(in srgb, var(--mode-off) 12%, transparent); color: var(--mode-off); border: 1px solid color-mix(in srgb, var(--mode-off) 32%, transparent); }
.mode-tag.mode-other { background: color-mix(in srgb, var(--mode-other) 14%, transparent); color: var(--mode-other); border: 1px solid color-mix(in srgb, var(--mode-other) 35%, transparent); }
.system-meta {
  display: block;
  margin-top: 3px;
  font-size: .78rem;
  color: var(--ink-faint);
}

/* metric cell */
.metric-main { font-weight: 700; font-size: .96rem; }
.metric-sub { display: block; font-size: .76rem; color: var(--ink-faint); }
.metric-ci { display: block; font-size: .69rem; color: var(--ink-faint); white-space: nowrap; }
.rate-bar {
  margin-top: 5px;
  margin-left: auto;
  width: 84px; height: 5px;
  border-radius: 3px;
  background: var(--surface-2);
  overflow: hidden;
}
.rate-bar > i {
  display: block; height: 100%;
  background: var(--accent);
  border-radius: 3px;
}
.money { font-weight: 700; font-size: .94rem; }
.muted-sub {
  display: block;
  max-width: 9rem;
  font-size: .74rem;
  line-height: 1.25;
  color: var(--ink-faint);
  font-weight: 500;
  overflow-wrap: anywhere;
  white-space: normal;
}

/* reasoning badge */
.reason-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: .74rem;
  font-weight: 700;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink-soft);
}
.reason-badge::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--ink-faint);
}

.details-btn {
  padding: 7px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: .84rem;
  font-weight: 600;
  cursor: pointer;
}
.details-btn:hover { background: var(--accent-wash); border-color: var(--accent); color: var(--accent-ink); }

/* state panel (loading / empty / error) */
.state-panel {
  padding: 44px 24px;
  text-align: center;
  color: var(--ink-soft);
}
.state-panel .state-title { font-weight: 700; color: var(--ink); margin-bottom: 6px; }
.state-panel.error .state-title { color: var(--watch); }
.state-panel code { font-family: var(--mono); font-size: .85em; background: var(--surface-2); padding: 2px 6px; border-radius: 5px; }

.metric-notes {
  margin-top: 16px;
  display: grid;
  gap: 4px;
}
.metric-notes p { margin: 0; font-size: .84rem; color: var(--ink-faint); }
.metric-notes strong { color: var(--ink-soft); }

/* ---- Cost section ---- */
.cost-section { padding-top: 48px; }
.cost-panel { min-width: 0; }
.cost-panel-heading {
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.cost-panel-heading h3 {
  margin: 0;
  font-size: 1.05rem;
}
.chart-legend {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}
.ci-toggle {
  padding: 5px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-soft);
  font: inherit;
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.ci-toggle:hover { color: var(--ink); border-color: var(--accent); }
.ci-toggle[aria-pressed="true"] {
  background: color-mix(in srgb, var(--accent-wash) 60%, transparent);
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
  color: var(--accent-ink);
}
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: .85rem;
  color: var(--ink-soft);
  font-weight: 600;
}
.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--line-strong);
}
.legend-dot.legend-off { background: var(--mode-off); }
.legend-dot.legend-high { background: var(--mode-high); }
.legend-dot.legend-other { background: var(--mode-other); }

/* Compact key below the scatter: color dot + short model name + rate chips, rank order */
.point-group { transition: opacity .12s ease; }
.point-group circle { transition: r .1s ease, stroke-width .1s ease; }
.cost-list {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
}
.cost-list-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  cursor: default;
  transition: background .12s ease, border-color .12s ease;
}
.cost-list-item:hover,
.cost-list-item.focused {
  background: color-mix(in srgb, var(--accent-wash) 60%, transparent);
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
}
.cost-list-dot {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  box-shadow: 0 0 0 1px var(--line-strong);
}
.cost-list-dot.mode-off { background: var(--mode-off); }
.cost-list-dot.mode-high { background: var(--mode-high); }
.cost-list-dot.mode-other { background: var(--mode-other); }
.cost-list-item.no-cost .cost-list-dot { box-shadow: 0 0 0 1px var(--line-strong); opacity: .55; }
.cost-list-name {
  font-size: .82rem;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}
.cost-list-mode {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--ink-faint);
  white-space: nowrap;
}
.cost-list-rate {
  font-size: .8rem;
  font-weight: 700;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.cost-list-na {
  font-size: .66rem;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--ink-faint);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 0 6px;
  white-space: nowrap;
}
.chart-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.chart-card[hidden] { display: none; }
.chart-tabs {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.chart-tab {
  padding: 7px 14px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  font-size: .84rem;
  font-weight: 700;
  letter-spacing: .02em;
  cursor: pointer;
}
.chart-tab:hover { color: var(--ink); }
.chart-tab.active {
  background: var(--surface);
  color: var(--accent-ink);
  box-shadow: var(--shadow-sm);
}
.chart { width: 100%; position: relative; }
.chart svg { width: 100%; height: auto; display: block; }
.chart-tip {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  max-width: 240px;
  padding: 9px 11px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  box-shadow: var(--shadow);
  font-size: .82rem;
  line-height: 1.42;
  color: var(--ink-soft);
}
.chart-tip[hidden] { display: none; }
.chart-tip-name { display: block; margin-bottom: 3px; font-size: .86rem; font-weight: 700; color: var(--ink); }
.chart-tip-row { display: block; font-variant-numeric: tabular-nums; }
.chart-hint { margin: 10px 2px 0; font-size: .82rem; color: var(--ink-faint); }
.chart-note { margin: 6px 2px 0; font-size: .76rem; color: var(--ink-faint); opacity: .85; }

/* ---- Methodology ---- */
.methodology { padding-top: 48px; padding-bottom: 20px; }
.section-heading.compact { margin-bottom: 14px; }
.method-subhead { margin: 30px 0 14px; font-size: 1.15rem; letter-spacing: -.01em; }
.method-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  align-items: start;
  gap: 14px;
}
/* FAQ answers are long-form: one readable column instead of a card mosaic. */
.faq-grid { grid-template-columns: 1fr; gap: 10px; }
/* Chart legend + CI toggle grouped on the right of a section heading. */
.chart-controls { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.bar-group { transition: opacity .12s ease; }
.method-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.method-card summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  padding: 18px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  list-style: none;
}
.method-card summary::-webkit-details-marker { display: none; }
.method-card summary::after { content: "＋"; flex: 0 0 auto; color: var(--ink-faint); font-weight: 400; }
.method-card[open] summary::after { content: "－"; }
.method-card p { margin: 0; padding: 0 18px 18px; font-size: .88rem; color: var(--ink-soft); }
.method-card strong { color: var(--ink); }
.changelog-list { margin: 0; padding: 0 18px 18px; list-style: none; }
.changelog-list > li { font-size: .88rem; color: var(--ink-soft); line-height: 1.5; }
.changelog-list > li + li { margin-top: 14px; }
.changelog-date { margin-left: 4px; font-size: .82rem; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.changelog-detail { margin: 6px 0 0; padding-left: 20px; list-style: disc; }
.changelog-detail li { font-size: .88rem; color: var(--ink-soft); line-height: 1.5; }
.changelog-detail li + li { margin-top: 4px; }
.changelog-detail li::marker { color: var(--ink-faint); }

.caveat-panel {
  margin-top: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.caveat-panel summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  cursor: pointer;
  padding: 16px 20px;
  font-weight: 700;
  color: var(--ink);
  list-style: none;
}
.caveat-panel summary::-webkit-details-marker { display: none; }
.caveat-panel summary::after { content: "＋"; flex: 0 0 auto; color: var(--ink-faint); font-weight: 400; }
.caveat-panel[open] summary::after { content: "－"; }
.caveat-body { padding: 0 20px 18px; }
.caveat-body p { margin: 0 0 12px; font-size: .9rem; color: var(--ink-soft); }
.caveat-body p:last-child { margin-bottom: 0; }
.caveat-body strong { color: var(--ink); }

.data-footnote {
  margin-top: 22px;
  font-size: .8rem;
  color: var(--ink-faint);
  font-family: var(--mono);
}

/* ---- Footer ---- */
.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 30px;
  padding: 24px 0;
  background: var(--surface);
}
.footer-inner { display: flex; flex-direction: column; gap: 4px; }
.footer-inner p { margin: 0; font-size: .82rem; color: var(--ink-faint); }

.noscript-note {
  max-width: 640px;
  margin: 40px auto;
  padding: 0 24px;
  color: var(--ink-soft);
}

/* ---- Dialog ---- */
dialog {
  width: min(760px, 94vw);
  max-height: 88vh;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 24px 64px rgba(20, 26, 36, .3);
  overflow: hidden;
}
dialog::backdrop { background: rgba(15, 20, 30, .5); backdrop-filter: blur(2px); }
.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0;
  background: var(--surface);
}
.dialog-head h2 { margin: 3px 0 0; font-size: 1.3rem; }
.dialog-close {
  width: 34px; height: 34px;
  border-radius: 9px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}
.dialog-close:hover { background: var(--surface-2); color: var(--ink); }
.dialog-content {
  padding: 20px 22px 24px;
  overflow-y: auto;
  max-height: calc(88vh - 74px);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px 20px;
  margin-bottom: 22px;
}
.detail-item { display: flex; flex-direction: column; gap: 2px; }
.detail-item span { font-size: .74rem; color: var(--ink-faint); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.detail-item strong { font-size: .95rem; font-weight: 600; }
.detail-item code { font-family: var(--mono); font-size: .84rem; word-break: break-all; }

.detail-section { margin-bottom: 22px; }
.detail-section h3 { margin: 0 0 10px; font-size: 1rem; }
.detail-table { width: 100%; min-width: 0; border-collapse: collapse; }
.detail-table th, .detail-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  font-size: .86rem;
  font-variant-numeric: tabular-nums;
}
.detail-table th { font-size: .74rem; text-transform: uppercase; letter-spacing: .03em; color: var(--ink-faint); }
.detail-table td:not(:first-child), .detail-table th:not(:first-child) { text-align: right; }
.detail-table tr:last-child td { border-bottom: 0; }

.detail-caveat {
  margin: 0;
  padding: 14px 16px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  font-size: .86rem;
  color: var(--ink-soft);
}
.detail-caveat strong { color: var(--ink); }
.completeness-flag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: .68rem;
  font-weight: 700;
  background: var(--watch-wash);
  color: var(--watch);
}

/* ---- Responsive ---- */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; align-items: start; gap: 22px; }
  .summary { grid-template-columns: repeat(2, 1fr); }
  .nav-shell nav { display: none; }
}
@media (max-width: 680px) {
  #board-table {
    min-width: 0;
    table-layout: fixed;
  }
  #board-table .optional-compile,
  #board-table .optional-logic,
  #board-table .optional-cost-pass,
  #board-table .optional-reason,
  #board-table .col-action {
    display: none;
  }
  #board-table .col-rank { width: 42px; }
  #board-table .priority-validation { width: 100px; }
  #board-table .priority-cost { width: 82px; }
  #board-table .sort-btn { padding: 10px 6px; font-size: .64rem; line-height: 1.2; }
  #board-table tbody td { padding: 10px 6px; }
  #board-table .system-cell { min-width: 0; }
  #board-table .system-name { display: block; font-size: .82rem; line-height: 1.2; overflow-wrap: anywhere; }
  #board-table .system-meta { display: none; }
  #board-table .metric-main, #board-table .money { font-size: .82rem; }
  #board-table .metric-sub { font-size: .68rem; }
  #board-table .metric-ci { font-size: .59rem; letter-spacing: -.015em; white-space: normal; }
  #board-table .rate-bar { width: 66px; }
  #board-table .muted-sub { font-size: .61rem; }
}
@media (max-width: 560px) {
  .shell { padding-inline: 16px; }
  .run-date-chip { display: none; }
  .brand-mark { display: none; }
  .brand-text { font-size: .8rem; }
  .brand-sub { font-size: .6rem; }
  .edition-chip { padding-inline: 8px; font-size: .66rem; }
  .summary { grid-template-columns: 1fr 1fr; }
  .method-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .hero { padding-top: 34px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

/* ---- v0.4.2 presentation refresh: extension CTA, hero actions/stats, table + chart tweaks ---- */
/* Header CTA + version chip as link */
.cta-nav {
  padding: 7px 13px; border-radius: 999px; text-decoration: none; white-space: nowrap;
  font-size: .82rem; font-weight: 700; color: #fff;
  background: var(--accent); border: 1px solid var(--accent);
}
.cta-nav:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.edition-link { text-decoration: none; }
.edition-link:hover { color: var(--accent-ink); border-color: var(--accent); }

/* Hero actions + stats */
.hero { align-items: center; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 22px 0 0; }
.btn {
  display: inline-flex; flex-direction: column; align-items: flex-start; justify-content: center;
  padding: 10px 18px; border-radius: 11px; text-decoration: none; font-weight: 700; font-size: .95rem; line-height: 1.2;
  border: 1px solid transparent;
}
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 28%, transparent); }
.btn-primary:hover { background: var(--accent-ink); }
.btn-sub { font-size: .7rem; font-weight: 600; opacity: .85; margin-top: 2px; }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent-ink); }
.hero-stats { margin: 16px 0 0; font-size: .86rem; color: var(--ink-faint); }
.hero-stats strong { color: var(--ink); font-variant-numeric: tabular-nums; }

/* Table tweaks: no wrapping counts, cost asterisk, header note */
.metric-main, .money { white-space: nowrap; }
.money-mark { font-size: .7em; color: var(--ink-faint); margin-left: 1px; }
.th-note { display: block; font-size: .62rem; letter-spacing: 0; text-transform: none; color: var(--ink-faint); padding: 0 12px 8px; text-align: right; }

/* Key chips: slightly tighter (scatter focus labels are drawn in app.js) */
.cost-list { gap: 5px 6px; }
.cost-list-item { padding: 3px 9px 3px 7px; }

/* Footer */
.footer-links a { font-weight: 600; }

@media (max-width: 900px) {
  .cta-nav { margin-left: auto; }
}
@media (max-width: 560px) {
  .cta-nav { font-size: .72rem; padding: 6px 10px; }
  .btn { width: 100%; align-items: center; }
  .btn-ghost { align-items: center; }
}
