/* ─────────────────────────────────────────────────────────────────────────
   PathBench — Pathology Foundation Model Leaderboard — minimal scientific theme
   Model colours (shades of one hue per model category) come from the data; the UI
   itself is near-neutral so the figures carry the colour. One ink, one accent, lots of whitespace.
   ───────────────────────────────────────────────────────────────────────── */
:root {
  --ink:        #1a1d21;
  --ink-soft:   #545b64;
  --ink-faint:  #626a74;
  --line:       #e4e7eb;
  --line-soft:  #eef1f4;
  --bg:         #ffffff;
  --bg-soft:    #f7f8fa;
  --bg-sink:    #f0f2f5;
  --accent:     #0b6e99;       /* calm teal-blue, distinct from any model hue */
  --accent-bg:  #e6f1f6;
  --good:       #1b7837;
  --on-accent:  #ffffff;       /* text on an accent-filled surface */
  /* chart chrome; charts.js reads these at render time */
  --chart-grid:       #eef1f4;
  --chart-axis:       #c8cdd3;
  --chart-hover-line: #d4d8dd;
  --chart-whisker:    rgba(26,29,33,.45);
  /* status colours: public/private dataset tags, warning banner, load error */
  --pub-ink:  #1b7837; --pub-line:  #bfe3c8; --pub-bg:  #f0f8f2;
  --priv-ink: #9a6700; --priv-line: #f0dcab; --priv-bg: #fcf6e6;
  --warn-ink: #6b5a1e; --warn-line: #f0e0a8; --warn-bg: #fff8e1;
  --error:    #a3341f;
  --radius:     7px;
  --shadow:     0 1px 2px rgba(20,25,35,.05), 0 2px 8px rgba(20,25,35,.04);
  --font:       "Inter", "Helvetica Neue", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono:       "SFMono-Regular", "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --sidebar-w:  316px;
  color-scheme: light;
}

/* Dark mode. theme.js sets data-theme from the visitor's switch, or from the
   operating-system setting when the switch is on Auto. Only the tokens change;
   the model colours come from the data and read on both grounds. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --ink:        #e4e7eb;
  --ink-soft:   #aab1ba;
  --ink-faint:  #8f97a1;
  --line:       #2e333a;
  --line-soft:  #24282e;
  --bg:         #141619;
  --bg-soft:    #1a1d21;
  --bg-sink:    #22262b;
  --accent:     #4cb0db;       /* the teal, lifted to stay readable on dark */
  --accent-bg:  #10303e;
  --good:       #5cc27f;
  --on-accent:  #0b1a22;
  --shadow:     0 1px 2px rgba(0,0,0,.5), 0 2px 8px rgba(0,0,0,.35);
  --chart-grid:       #262a30;
  --chart-axis:       #474e57;
  --chart-hover-line: #3a4048;
  --chart-whisker:    rgba(228,231,235,.55);
  --pub-ink:  #6fcf8e; --pub-line:  #2c5a3b; --pub-bg:  #14261b;
  --priv-ink: #e3b35e; --priv-line: #5e4b22; --priv-bg: #2a2214;
  --warn-ink: #ead69c; --warn-line: #5e4f24; --warn-bg: #29230f;
  --error:    #f08a74;
}
/* the Stanford Medicine logo is Cardinal and grey artwork made for light grounds;
   it sits on a white plate instead of being recoloured */
[data-theme="dark"] .brand-logo { background: #fff; padding: 6px 9px; border-radius: 6px; margin-bottom: 10px; }
[data-theme="dark"] .brand-logo img { margin-bottom: 0; }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

/* ── top bar ── */
.topbar { border-bottom: 1px solid var(--line); background: var(--bg); }
.topbar-inner {
  max-width: 1500px; margin: 0 auto; padding: 18px 26px;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 24px;
}
.brand-logo { display: inline-block; line-height: 0; }
.brand-logo img { height: 34px; width: auto; display: block; margin-bottom: 10px; }
.brand h1 { font-size: 22.5px; font-weight: 650; letter-spacing: -.01em; margin: 0; }
.h1-sub { font-weight: 400; color: var(--ink-soft); }
.h1-sub::before { content: "· "; }
.subtitle { margin: 5px 0 0; color: var(--ink-soft); font-size: 14.5px; max-width: 106ch; }
.brand-side { display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
.topnav { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; white-space: nowrap; }
.topnav a, .topnav button {
  font-size: 13.5px; color: var(--ink-soft); text-decoration: none;
  background: none; border: none; padding: 0; cursor: pointer; font-family: inherit;
}
.topnav a:hover, .topnav button:hover { color: var(--accent); text-decoration: underline; }
/* Auto / Light / Dark switch at the end of the nav */
.theme-seg { display: inline-flex; gap: 2px; padding: 2px; background: var(--bg-sink); border-radius: 6px; }
.topnav .theme-seg button { padding: 2px 8px; border-radius: 4px; font-size: 12.5px; }
.topnav .theme-seg button:hover { color: var(--ink); text-decoration: none; }
.topnav .theme-seg button[aria-pressed="true"] { background: var(--bg); color: var(--ink); font-weight: 600; box-shadow: var(--shadow); }
.brand-meta { display: flex; gap: 20px; white-space: nowrap; }
.brand-meta .stat { text-align: right; }
.brand-meta .stat b { display: block; font-size: 21.5px; font-weight: 650; line-height: 1; }
.brand-meta .stat span { font-size: 12.5px; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .04em; }

/* ── layout ──
   The page's one scrollbar moves both columns. Each column is sticky, and app.js
   sets its `top` to min(0, window height - column height): a column that fits the
   window stays pinned at the top, and a taller one scrolls until its end is in
   view, then holds. The longer column sets the page length; the shorter one stays
   in the window instead of leaving blank space under it. */
.layout { display: flex; max-width: 1500px; margin: 0 auto; align-items: flex-start; position: relative; }
/* the column divider spans the layout, whichever column is longer */
.layout::before {
  content: ""; position: absolute; top: 0; bottom: 0;
  left: calc(var(--sidebar-w) - 1px); border-left: 1px solid var(--line);
}
.sidebar { width: var(--sidebar-w); flex: 0 0 var(--sidebar-w); position: sticky; top: 0; }
.sidebar-inner { padding: 18px 18px 40px; }
.main { flex: 1 1 auto; min-width: 0; padding: 18px 26px 60px; position: sticky; top: 0; }

/* ── controls ── */
.ctl { margin-bottom: 20px; }
.ctl-h { font-size: 12.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-soft); display: block; margin-bottom: 8px; }
.ctl-h-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.ctl-h-row .ctl-h { margin: 0; flex: 1; }
.info { display: inline-flex; width: 14px; height: 14px; border-radius: 50%; background: var(--bg-sink); color: var(--ink-faint); font-size: 10.5px; align-items: center; justify-content: center; cursor: help; font-weight: 700; vertical-align: middle; }
.mini { font-size: 12px; color: var(--accent); background: none; border: none; cursor: pointer; padding: 2px 3px; text-transform: lowercase; letter-spacing: .02em; }
.mini:hover { text-decoration: underline; }

/* segmented control */
.seg { display: flex; flex-wrap: wrap; gap: 4px; background: var(--bg-sink); padding: 3px; border-radius: var(--radius); }
.seg.seg-sm { font-size: 13.5px; }
.seg button {
  flex: 1 1 auto; border: none; background: transparent; cursor: pointer;
  padding: 6px 8px; border-radius: 5px; font-size: 13.5px; color: var(--ink-soft);
  font-family: inherit; white-space: nowrap; transition: background .12s, color .12s;
}
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--bg); color: var(--ink); font-weight: 600; box-shadow: var(--shadow); }
.metric-desc { font-size: 13px; color: var(--ink-faint); margin: 8px 2px 0; line-height: 1.4; }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chips-scroll { max-height: 196px; overflow-y: auto; padding: 2px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink-soft);
  border-radius: 20px; padding: 4px 10px 4px 9px; font-size: 13.5px; cursor: pointer;
  user-select: none; transition: background .12s, border-color .12s, color .12s;
  /* chips are buttons: reset the UA button look so they match the old spans */
  font-family: inherit; line-height: inherit; margin: 0;
}
.chip:focus-visible, .seg button:focus-visible, .tab:focus-visible, .th-sort:focus-visible,
.mini:focus-visible, .scope-btn:focus-visible, .reset:focus-visible, .tool:focus-visible,
.topnav button:focus-visible, .info:focus-visible, .about > summary:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.chip:hover { border-color: var(--ink-faint); }
.chip .dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.chip.on { background: var(--accent-bg); border-color: var(--accent); color: var(--ink); font-weight: 500; }
.chip.off { background: var(--bg-sink); border-style: dashed; color: var(--ink-soft); text-decoration: line-through; }
.chip.off .dot { background: var(--line) !important; }
.chip .tag { font-size: 10.5px; color: var(--ink-faint); border: 1px solid var(--line); border-radius: 3px; padding: 0 3px; text-transform: uppercase; }
.chip .tag.pub { color: var(--pub-ink); border-color: var(--pub-line); background: var(--pub-bg); }
.chip .tag.priv { color: var(--priv-ink); border-color: var(--priv-line); background: var(--priv-bg); }

/* quick-toggles: cohort scope (all public / all private) and model category */
.scope-toggles { display: flex; gap: 6px; margin-bottom: 9px; }
.scope-btn, .type-btn {
  flex: 1; font-size: 13px; font-family: inherit; cursor: pointer;
  padding: 5px 8px; border: 1px solid var(--line); border-radius: 5px;
  background: var(--bg); color: var(--ink-soft); transition: background .12s, border-color .12s, color .12s;
}
.scope-btn:hover, .type-btn:hover { border-color: var(--ink-faint); color: var(--ink); }
.type-btn { padding: 5px 4px; white-space: nowrap; }
.scope-btn.on, .type-btn.on { background: var(--accent-bg); border-color: var(--accent); color: var(--ink); font-weight: 600; }

.search {
  width: 100%; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 6px 9px; font-size: 13.5px; font-family: inherit; margin-bottom: 8px; color: var(--ink); background: var(--bg);
}
.search:focus { border-color: var(--accent); }
.search:focus:not(:focus-visible) { outline: none; }
.search:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.reset {
  width: 100%; margin-top: 6px; padding: 9px; border: 1px solid var(--line);
  background: var(--bg); border-radius: var(--radius); cursor: pointer;
  font-size: 13.5px; color: var(--ink-soft); font-family: inherit;
}
.reset:hover { background: var(--bg-soft); color: var(--ink); }

/* ── tabs ── */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  border: none; background: none; cursor: pointer; font-family: inherit;
  padding: 9px 15px; font-size: 15.5px; color: var(--ink-soft);
  border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color .12s; flex: 0 0 auto; white-space: nowrap;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); font-weight: 600; border-bottom-color: var(--accent); }

.viewcap { font-size: 13.5px; color: var(--ink-faint); margin: 0 0 14px; }
.viewcap b { color: var(--ink-soft); font-weight: 600; }

.panel { animation: fade .2s ease; }
.panel.hidden { display: none; }
@keyframes fade { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
.panel-tools { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; flex-wrap: wrap; }
.inline { font-size: 13.5px; color: var(--ink-soft); display: inline-flex; align-items: center; gap: 6px; }
.inline select { font-family: inherit; font-size: 13.5px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 5px; background: var(--bg); color: var(--ink); }
.hint { font-size: 13px; color: var(--ink-faint); }
.tool { font-size: 13.5px; padding: 5px 11px; border: 1px solid var(--line); background: var(--bg); border-radius: 5px; cursor: pointer; color: var(--ink-soft); font-family: inherit; }
.tool:hover { background: var(--bg-soft); color: var(--ink); }

/* ── leaderboard table ── */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14.5px; }
thead th {
  text-align: left; font-weight: 600; color: var(--ink-soft); font-size: 12.5px;
  text-transform: uppercase; letter-spacing: .03em; padding: 8px 12px;
  border-bottom: 2px solid var(--line); white-space: nowrap; cursor: pointer; user-select: none;
}
thead th.num { text-align: right; }
.th-sort { font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; background: none; border: none; padding: 0; margin: 0; cursor: pointer; text-align: inherit; }
thead th .arr { color: var(--accent); font-size: 10.5px; margin-left: 3px; }
tbody td { padding: 9px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
tbody tr:hover { background: var(--bg-soft); }
td.num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: 13.5px; }
td.rank { color: var(--ink-faint); font-variant-numeric: tabular-nums; width: 30px; }
.model-cell { display: flex; align-items: center; gap: 9px; }
.model-cell .dot { width: 11px; height: 11px; border-radius: 50%; flex: 0 0 auto; }
.model-cell .nm { font-weight: 600; }
.model-cell .ty { font-size: 10.5px; color: var(--ink-faint); border: 1px solid var(--line); border-radius: 3px; padding: 0 4px; text-transform: uppercase; letter-spacing: .03em; }
.ci { color: var(--ink-faint); font-size: 12.5px; }
.bar-cell { width: 150px; }
.bar-track { background: var(--bg-sink); border-radius: 3px; height: 7px; position: relative; overflow: hidden; }
.bar-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; }
.binary-note { color: var(--ink-faint); font-style: italic; font-size: 12.5px; }

.chart { width: 100%; min-height: 460px; }
.footnote { font-size: 12.5px; color: var(--ink-faint); margin-top: 20px; line-height: 1.5; border-top: 1px solid var(--line-soft); padding-top: 12px; }

.empty { padding: 60px 20px; text-align: center; color: var(--ink-faint); font-size: 16px; }

/* ── boot / failure states ── */
.hidden { display: none !important; }
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--accent); color: var(--on-accent); padding: 9px 14px; border-radius: 0 0 var(--radius) 0; font-size: 14.5px;
}
.skip-link:focus { left: 0; }
.banner {
  max-width: 1500px; margin: 14px auto; padding: 12px 16px;
  background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: var(--radius);
  font-size: 14.5px; color: var(--warn-ink);
}
.banner code { font-family: var(--mono); font-size: 13.5px; }
.boot { padding: 90px 26px; text-align: center; color: var(--ink-faint); }
.boot-spin {
  width: 22px; height: 22px; margin: 0 auto 14px;
  border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.boot.failed .boot-spin { display: none; }
.boot-msg { font-size: 14.5px; margin: 0; }
.boot.failed .boot-msg { color: var(--error); max-width: 62ch; margin: 0 auto; line-height: 1.6; }
@media (prefers-reduced-motion: reduce) {
  .boot-spin, .panel { animation: none; }
  .seg button, .chip { transition: none; }
}

/* ── about & methods ── */
.about { margin-top: 34px; border-top: 1px solid var(--line); padding-top: 6px; }
.about > summary {
  cursor: pointer; padding: 12px 0; font-size: 14.5px; font-weight: 600; color: var(--accent);
  list-style: none;
}
.about > summary::-webkit-details-marker { display: none; }
.about > summary::before { content: "▸ "; display: inline-block; width: 1em; }
.about[open] > summary::before { content: "▾ "; }
.about-body { max-width: 82ch; padding-bottom: 18px; font-size: 14.5px; color: var(--ink-soft); }
.about-body h3 { font-size: 13.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink); margin: 24px 0 8px; }
.about-body h3:first-child { margin-top: 8px; }
.about-body p { margin: 0 0 10px; line-height: 1.6; }
.about-body ul { margin: 0 0 10px; padding-left: 18px; line-height: 1.6; }
.about-body li { margin-bottom: 6px; }
.about-body b { color: var(--ink); font-weight: 600; }
.tiny { font-size: 12.5px; color: var(--ink-faint); line-height: 1.55; }
.about-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 6px 18px; margin-bottom: 10px; }
.about-item { display: flex; align-items: baseline; gap: 7px; font-size: 13.5px; padding: 3px 0; border-bottom: 1px solid var(--line-soft); }
.about-item .dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; align-self: center; }
.about-item .nm { font-weight: 600; color: var(--ink); }
.about-item .sub { color: var(--ink-faint); font-size: 12.5px; margin-left: auto; text-align: right; white-space: nowrap; }
/* models carry a long citation, so give it its own line rather than let the
   name break mid-word to make room */
.about-item.model { flex-wrap: wrap; align-items: center; }
.about-item.model .nm { white-space: nowrap; }
.about-item .ty { font-size: 10.5px; color: var(--ink-faint); border: 1px solid var(--line); border-radius: 3px; padding: 0 4px; text-transform: uppercase; letter-spacing: .03em; }
.about-item .cit { flex-basis: 100%; color: var(--ink-faint); font-size: 12.5px; padding-left: 15px; }
.about-dl { margin: 0 0 10px; display: grid; grid-template-columns: max-content 1fr; gap: 5px 14px; font-size: 13.5px; }
.about-dl dt { font-weight: 600; color: var(--ink); }
.about-dl dd { margin: 0; }
.prov { font-family: var(--mono); font-size: 12.5px; list-style: none; padding-left: 0 !important; }
.prov li { display: flex; gap: 10px; border-bottom: 1px solid var(--line-soft); padding: 3px 0; }
.prov span { color: var(--ink-faint); min-width: 110px; }
.prov code { word-break: break-all; }
.cite-box { position: relative; }
.cite-box pre {
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 13px 15px; font-family: var(--mono); font-size: 13px; line-height: 1.55;
  overflow-x: auto; margin: 0 0 8px; color: var(--ink);
}

/* ── site footer ── */
.sitefoot { border-top: 1px solid var(--line); background: var(--bg-soft); margin-top: 10px; }
.sitefoot-inner {
  max-width: 1500px; margin: 0 auto; padding: 26px 26px 34px;
  display: grid; grid-template-columns: 2.2fr 1fr 1fr 1.6fr; gap: 28px;
}
.foot-col > b { font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink); display: block; margin-bottom: 8px; }
.foot-col p { margin: 0; }
.foot-links { list-style: none; margin: 0; padding: 0; font-size: 13.5px; }
.foot-links li { margin-bottom: 5px; }
.sitefoot a { color: var(--accent); text-decoration: none; }
.sitefoot a:hover { text-decoration: underline; }
#foot-version { font-family: var(--mono); font-size: 12px; word-break: break-all; }

@media (max-width: 920px) {
  .layout { flex-direction: column; }
  .layout::before { display: none; }
  .sidebar { width: 100%; flex-basis: auto; position: static; border-bottom: 1px solid var(--line); }
  .main { position: static; }
  .topbar-inner { flex-direction: column; align-items: flex-start; }
  .brand-side { align-items: flex-start; width: 100%; }
  .brand-meta { gap: 24px; }
  .brand-meta .stat { text-align: left; }
  .sitefoot-inner { grid-template-columns: 1fr 1fr; gap: 22px; }
}
@media (max-width: 560px) {
  .topbar-inner, .main, .sitefoot-inner { padding-left: 16px; padding-right: 16px; }
  .sitefoot-inner { grid-template-columns: 1fr; }
  .brand h1 { font-size: 19px; }
  .h1-sub { display: block; font-size: 14.5px; margin-top: 2px; }
  .h1-sub::before { content: ""; }
  .chart { min-height: 380px; }
}

/* ── print: just the table and footnote ── */
@media print {
  .sidebar, .topnav, .tabs, .tool, .skip-link { display: none !important; }
  .layout { display: block; max-width: none; }
  .layout::before { display: none; }
  .main { padding: 0; position: static; }
  .panel { animation: none; }
}

/* ── PathBench additions ── */
/* model metadata columns in the leaderboard table */
td.sub-cell { color: var(--ink-soft); font-size: 13.5px; white-space: nowrap; }
/* task list in About: name and context on one line, class description below */
.about-grid-wide { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.about-grid-wide .about-item { flex-wrap: wrap; }
.about-grid-wide .about-item .sub { white-space: normal; }
.about-grid-wide .about-item .cit { padding-left: 0; }

/* answer bar: the common questions as one row of selects above the tabs */
.quickbar {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px;
  padding: 12px 14px; margin-bottom: 10px;
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius);
}
.qb-lead { font-size: 14.5px; font-weight: 650; color: var(--ink); align-self: center; margin-right: 2px; }
.qb-field { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--ink-faint);
  text-transform: uppercase; letter-spacing: .04em; }
.qb-field select {
  font-family: inherit; font-size: 14.5px; text-transform: none; letter-spacing: 0;
  padding: 5px 8px; min-width: 150px; max-width: 210px; border: 1px solid var(--line); border-radius: 5px;
  background: var(--bg); color: var(--ink); cursor: pointer;
}
.qb-field select.set { border-color: var(--accent); background: var(--accent-bg); font-weight: 600; }
.qb-field select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.qb-clear { align-self: flex-end; }

/* headline: the top model for the current selection, in one sentence */
.headline { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px;
  padding: 4px 2px 12px; font-size: 14.5px; color: var(--ink-soft); }
.headline .hl-scope { flex-basis: 100%; font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-faint); }
.headline .hl-main { font-size: 19px; color: var(--ink); display: inline-flex; align-items: baseline; gap: 7px; }
.headline .hl-main .dot { width: 11px; height: 11px; border-radius: 50%; align-self: center; }
.headline .hl-ty { font-size: 10.5px; color: var(--ink-faint); border: 1px solid var(--line); border-radius: 3px; padding: 0 4px; text-transform: uppercase; }
.headline .hl-ci { font-size: 14px; color: var(--ink-soft); }
.headline .hl-close { font-size: 14px; }
.linkish { background: none; border: none; padding: 0; color: var(--accent); cursor: pointer; font: inherit; text-decoration: underline; }

/* chip "only" control and unavailable chips */
.chip { position: relative; }
/* "only" floats on the chip's corner so showing it never changes the chip's size;
   a width change made chips near a row's end wrap away from the pointer */
.chip .only {
  position: absolute; top: -8px; right: -4px; z-index: 2;
  font-size: 10.5px; font-weight: 700; line-height: 1; letter-spacing: .03em; text-transform: uppercase;
  padding: 3px 5px; border-radius: 8px; background: var(--accent); color: var(--on-accent);
  box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity .1s;
}
.chip:hover .only, .chip:focus-visible .only { opacity: 1; pointer-events: auto; }
.chip .only:hover { filter: brightness(1.12); }
.chip.na { opacity: .42; }
.chip.na.on { border-style: dotted; }
.chip .cnt { font-size: 11.5px; color: var(--ink-faint); }
.side-tip { margin: 2px 0 8px; color: var(--ink-faint); }

@media (max-width: 560px) {
  .quickbar { padding: 10px; }
  .qb-field { flex: 1 1 140px; }
  .qb-field select { min-width: 0; width: 100%; }
  .qb-lead { flex-basis: 100%; }
}
/* narrow screens: the answer bar and leaderboard come first, the full filter panel after */
@media (max-width: 920px) {
  /* the stacked layout keeps align-items: flex-start, so give main the full width
     explicitly; otherwise it grows to the table's width and the page scrolls sideways */
  .main { order: -1; width: 100%; padding: 16px 14px 48px; }
}

/* ══ v2.1 layout: cards, folded filters, cleaner table, tasks tab ══════════════ */
:root { --page: #f4f6f8; --card-radius: 12px; --card-shadow: 0 1px 2px rgba(20,25,35,.04), 0 4px 14px rgba(20,25,35,.05); }
:root[data-theme="dark"] { --page: #0f1113; --card-shadow: 0 1px 2px rgba(0,0,0,.5), 0 4px 14px rgba(0,0,0,.3); }
body { background: var(--page); }
.topbar { background: var(--bg); }
.sidebar { background: var(--bg); }
.layout::before { border-color: var(--line); }
.main { padding-top: 22px; }

/* summary cards */
.stat-cards { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.stat-card {
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--card-radius); box-shadow: var(--card-shadow);
  padding: 12px 14px; display: flex; flex-direction: column; gap: 1px;
}
.stat-card b { font-size: 26px; font-weight: 650; line-height: 1.1; color: var(--ink); }
.stat-card .lbl { font-size: 13.5px; font-weight: 600; color: var(--ink-soft); }
.stat-card .sub { font-size: 12.5px; color: var(--ink-faint); }

/* answer bar, headline and panels sit on cards */
.quickbar { background: var(--bg); border-radius: var(--card-radius); box-shadow: var(--card-shadow); padding: 14px 16px; }
.headline { padding: 6px 4px 14px; }
.tabs { margin-bottom: 12px; }
.panel {
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--card-radius); box-shadow: var(--card-shadow);
  padding: 14px 16px 16px;
}
.viewcap { margin: 0 4px 10px; }
.about { background: var(--bg); border: 1px solid var(--line); border-radius: var(--card-radius); padding: 6px 18px; margin-top: 22px; }
.footnote { padding: 0 4px; }
.search-inline { width: 230px; margin: 0; }
.push-right { margin-left: auto; }
.panel-note { margin: 0 0 12px; font-size: 14px; color: var(--ink-soft); }

/* folded filter sections */
.filters-h { display: flex; align-items: baseline; justify-content: space-between; margin: 6px 0 6px;
  padding-top: 14px; border-top: 1px solid var(--line); }
.filters-h span { font-size: 12.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--ink); }
.filters-h .linkish { font-size: 13px; }
.fold { margin-bottom: 4px; border-bottom: 1px solid var(--line-soft); }
.fold > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; padding: 9px 0;
}
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::before { content: "›"; font-size: 17px; line-height: 1; color: var(--ink-faint); width: 10px; transition: transform .15s; }
.fold[open] > summary::before { transform: rotate(90deg); }
.fold > summary .ctl-h { margin: 0; flex: 1; }
.fold > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.fold-count { font-size: 12.5px; color: var(--ink-faint); background: var(--bg-sink); padding: 1px 7px; border-radius: 10px; }
.fold.narrowed .fold-count { background: var(--accent-bg); color: var(--accent); font-weight: 600; }
.fold-body { padding: 2px 0 14px; }
.fold-tools { display: flex; gap: 10px; margin-bottom: 8px; }
.fold-tools .mini { padding: 0; }
.chip[hidden] { display: none; }

/* leaderboard table */
#lb-table thead th { padding-top: 6px; padding-bottom: 8px; }
#lb-table tr.th-group th { border-bottom: none; padding-bottom: 0; }
#lb-table th.th-span { text-align: center; font-size: 11.5px; color: var(--ink-faint); letter-spacing: .06em;
  border-bottom: 1px solid var(--line) !important; }
#lb-table td { padding-top: 9px; padding-bottom: 9px; vertical-align: middle; }
#lb-table tbody tr:hover { background: var(--bg-soft); }
#lb-table tr.top { background: color-mix(in srgb, var(--accent-bg) 55%, transparent); }
#lb-table tr.top:hover { background: var(--accent-bg); }
.c-rank { width: 44px; }
.rank-badge {
  display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 24px; padding: 0 5px;
  border-radius: 12px; font-size: 13.5px; font-weight: 650; font-variant-numeric: tabular-nums; color: var(--ink-faint);
}
.rank-badge.r1 { background: var(--accent); color: var(--on-accent); }
.rank-badge.r2, .rank-badge.r3 { border: 1.5px solid var(--accent); color: var(--accent); }
.model-cell .sub { font-size: 12.5px; color: var(--ink-faint); margin-top: 1px; }
td.c-score { white-space: nowrap; }
td.c-score .score {
  display: inline-block; font-size: 16px; font-weight: 700; color: var(--ink);
  background: var(--bg-sink); border-radius: 6px; padding: 2px 8px;
}
td.c-score .ci { display: block; font-size: 12px; color: var(--ink-faint); margin-top: 2px; }
td.c-bar { width: 130px; }
td.c-cat { color: var(--ink-soft); width: 82px; }
td.c-cat.best { color: var(--accent); font-weight: 700; }
th.c-cat { width: 82px; }
td.c-n { color: var(--ink-faint); width: 56px; }

/* tasks tab */
.task-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.tcard { border: 1px solid var(--line); border-radius: 10px; background: var(--bg); overflow: hidden; }
.tcard header { display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  padding: 10px 14px; background: var(--bg-soft); border-bottom: 1px solid var(--line); }
.tcard h4 { margin: 0; font-size: 16px; }
.tcard-n { font-size: 12.5px; color: var(--ink-faint); }
.tcard ul { list-style: none; margin: 0; padding: 4px 0; }
.task-row {
  width: 100%; text-align: left; background: none; border: none; cursor: pointer; font-family: inherit; color: var(--ink);
  display: flex; flex-direction: column; gap: 4px; padding: 8px 14px; border-radius: 0;
}
.task-row:hover { background: var(--bg-soft); }
.task-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.task-row.na { opacity: .45; }
.tr-name { font-size: 14.5px; font-weight: 600; }
.tr-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tr-tags .tag { font-size: 11.5px; color: var(--ink-soft); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; }
.tr-best { font-size: 12.5px; color: var(--ink-faint); display: inline-flex; align-items: center; gap: 4px; }
.tr-best .dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }

@media (max-width: 1100px) { .stat-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 920px) { .sidebar { background: var(--bg); } }
@media (max-width: 560px) {
  .stat-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .stat-card { padding: 8px 10px; }
  .stat-card b { font-size: 20px; }
  .stat-card .sub { display: none; }
  td.c-bar, th.c-bar { display: none; }
  .search-inline { width: 100%; }
  .push-right { margin-left: 0; }
  .panel { padding: 10px; }
}

/* ══ v2.2: calmer top of page, models / generalization / scaling tabs ═══════════ */
/* logos side by side; both sit on a white plate in dark mode */
.brand-logos { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 10px; }
.brand-logos .brand-logo img { margin-bottom: 0; }
.brand-logo-2 img { height: 60px; }
.brand-logos .brand-logo-2 { padding-left: 14px; border-left: 1px solid var(--line); }
[data-theme="dark"] .brand-logos .brand-logo-2 { border-left: none; padding-left: 9px; }
.brand-logo[hidden] { display: none; }
[data-theme="dark"] .brand-logos .brand-logo { margin-bottom: 0; }

/* header counts: one quiet row */
.brand-meta { gap: 22px; }
.brand-meta .stat b { font-size: 20px; }
.brand-meta .stat span { font-size: 12px; }

/* answer card: the selects, then one line with the result */
.quickbar { margin-bottom: 14px; }
.quickbar .headline {
  flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px;
  margin-top: 4px; padding: 12px 0 0; border-top: 1px solid var(--line-soft);
}
.headline .hl-lead { font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-faint); font-weight: 600; }
.headline .hl-main { font-size: 17px; gap: 8px; align-items: center; }
.headline .hl-val { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }
.headline .hl-ci { font-size: 13.5px; color: var(--ink-faint); cursor: help; }
.headline .hl-scope { flex-basis: auto; margin-left: auto; font-size: 13px; text-transform: none; letter-spacing: 0; color: var(--ink-faint); }

/* key findings: one collapsed line */
.findings {
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--card-radius);
  padding: 0 16px; margin-bottom: 14px;
}
.findings > summary { list-style: none; cursor: pointer; padding: 11px 0; font-size: 14.5px; display: flex; gap: 8px; align-items: baseline; }
.findings > summary::-webkit-details-marker { display: none; }
.findings > summary::before { content: "›"; color: var(--ink-faint); transition: transform .15s; display: inline-block; width: 10px; }
.findings[open] > summary::before { transform: rotate(90deg); }
.findings > summary span { color: var(--ink-faint); font-size: 13.5px; }
.findings ol { margin: 0 0 12px; padding-left: 22px; }
.findings li { margin: 2px 0; }
.finding { background: none; border: none; padding: 4px 0; text-align: left; font: inherit; font-size: 14.5px; color: var(--ink); cursor: pointer; }
.finding:hover { color: var(--accent); }
.finding .go { margin-left: 8px; font-size: 13px; color: var(--accent); white-space: nowrap; }

/* leaderboard additions */
.mtag { margin-left: 7px; font-size: 10.5px; font-weight: 600; color: var(--priv-ink); background: var(--priv-bg);
  border: 1px solid var(--priv-line); border-radius: 4px; padding: 0 5px; vertical-align: 1px; }
.rank-badge.ref { font-size: 11.5px; border: 1px dashed var(--ink-faint); color: var(--ink-faint); }
#lb-table tr.ref-row td { background: var(--bg-soft); }
#lb-table tr.ref-row .nm { font-style: italic; }
td.c-sig { font-size: 13px; white-space: nowrap; color: var(--ink-faint); }
td.c-sig.best { color: var(--accent); font-weight: 700; }
td.c-sig.ns { color: var(--ink-soft); }
td.c-sig.sig { color: var(--error); }

/* models tab */
.model-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.mcard { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: var(--bg); display: flex; flex-direction: column; gap: 7px; }
.mcard.ref { background: var(--bg-soft); border-style: dashed; }
.mcard header { display: flex; align-items: center; gap: 9px; }
.mcard header .dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.mc-title { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.mc-title b { font-size: 16px; }
.mc-title span { font-size: 12.5px; color: var(--ink-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mc-score { text-align: right; display: flex; flex-direction: column; }
.mc-score b { font-size: 20px; font-variant-numeric: tabular-nums; }
.mc-score span { font-size: 11.5px; color: var(--ink-faint); text-transform: uppercase; }
.mc-meta { margin: 0; font-size: 13px; color: var(--ink-soft); }
.mc-line { margin: 0; font-size: 13.5px; color: var(--ink-soft); display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: baseline; }
.mc-line .lbl { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-faint); min-width: 112px; }
.mc-chip { font-size: 12.5px; background: var(--bg-sink); border-radius: 4px; padding: 1px 6px; white-space: nowrap; }
.mc-chip i { font-style: normal; color: var(--ink-faint); }
.mc-cmp { align-self: flex-start; margin-top: 2px; }

/* generalization tab */
.general-side { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; margin-top: 12px; }
.note-box { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; font-size: 14px; color: var(--ink-soft); background: var(--bg-soft); }
.note-box:empty { display: none; }
.note-box h4 { margin: 0 0 6px; font-size: 13.5px; color: var(--ink); text-transform: uppercase; letter-spacing: .04em; }
.note-box p { margin: 0 0 6px; }
.note-box ul { margin: 0 0 6px; padding-left: 18px; }

@media (max-width: 920px) {
  .quickbar .headline .hl-scope { margin-left: 0; flex-basis: 100%; }
}
@media (max-width: 560px) {
  .brand-meta { gap: 14px; }
  .mc-line .lbl { min-width: 0; flex-basis: 100%; }
}

/* key findings now sit at the foot of the page, above About & methods */
#findings { margin: 22px 0 0; }
#findings + .about { margin-top: 12px; }

/* model cards: chips and names are links into the leaderboard */
button.mc-chip { border: 1px solid transparent; font-family: inherit; color: var(--ink-soft); cursor: pointer; }
button.mc-chip:hover { border-color: var(--accent); color: var(--ink); background: var(--accent-bg); }
button.mc-chip:focus-visible, .mc-name:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.mc-name { background: none; border: none; padding: 0; font: inherit; font-size: 16px; font-weight: 700; color: var(--ink);
  cursor: pointer; text-align: left; }
.mc-name:hover { color: var(--accent); text-decoration: underline; }
@keyframes rowflash { 0%, 50% { background: var(--accent-bg); } 100% { background: transparent; } }
@keyframes rowflash-edge { 0%, 50% { background: var(--accent-bg); box-shadow: inset 3px 0 0 var(--accent); } 100% { background: transparent; box-shadow: none; } }
#lb-table tr.flash td { animation: rowflash 2.6s ease-out; }
#lb-table tr.flash td:first-child { animation-name: rowflash-edge; }

.chips-scroll { padding-top: 8px; }
.chips { padding-top: 4px; }

/* reset controls: always present, greyed out when nothing is filtered */
.qb-clear:disabled, .linkish:disabled { opacity: .45; cursor: default; }
.qb-clear:not(:disabled) { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.qb-clear:not(:disabled):hover { background: var(--accent-bg); }
.filters-links { display: inline-flex; gap: 12px; }
.linkish:disabled { text-decoration: none; }
