/* Who Gets Cited? — newspaper-style theme.
   Chart palettes validated with the dataviz validator (light on #fbf9f4, dark on #1b1a18). */
:root {
  color-scheme: light;
  --page: #f6f3ec;
  --surface-1: #fbf9f4;
  --surface-2: #efebe1;
  --text-primary: #161513;
  --text-secondary: #4a4740;
  --text-muted: #857f73;
  --rule: #161513;
  --grid: #e3ded2;
  --axis: #c4bdac;
  --border: rgba(22, 21, 19, 0.14);
  --engine: #2f6aa3;
  --ai: #cf5530;
  --dom: #2a8a63;
  --latam: #c99712;
  --outside: #6f5fc4;
  --on-dom: #ffffff;
  --on-latam: #161513;
  --on-outside: #ffffff;
  --accent: #a3241b;
  --link: #8a1f17;
  --down: #a3241b;
  --up: #1d6b47;
  --highlight: rgba(163, 36, 27, 0.07);
  /* NYT-style roles: display = nameplate, headlines and big numbers (Newsreader, kept);
     serif = body text, like NYT Imperial, which falls back to Georgia (Gelasio matches Georgia's metrics);
     sans = labels, controls and charts, like NYT Franklin (Libre Franklin). */
  --display: "Newsreader", Georgia, "Times New Roman", serif;
  --serif: Georgia, "Gelasio", "Times New Roman", Times, serif;
  --sans: "Libre Franklin", "Franklin Gothic Medium", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
  --m-claude: #d97757;
  --m-gpt: #10a37f;
  --m-grok: #1560bd;
  --m-pplx: #114f56;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #121110;
    --surface-1: #1b1a18;
    --surface-2: #252421;
    --text-primary: #eeeae0;
    --text-secondary: #c2bdb0;
    --text-muted: #8f897c;
    --rule: #eeeae0;
    --grid: #2d2b28;
    --axis: #45423d;
    --border: rgba(238, 234, 224, 0.14);
    --engine: #5a8fcc;
    --ai: #e0683f;
    --dom: #3fa679;
    --latam: #b8891a;
    --outside: #9386e0;
    --on-latam: #121110;
    --accent: #e0665a;
    --link: #f08a7e;
    --down: #ef7d70;
    --up: #4fbf87;
    --highlight: rgba(224, 102, 90, 0.10);
  --m-claude: #e08a6c;
  --m-gpt: #2cc39a;
  --m-grok: #5b9be6;
  --m-pplx: #9ccfd4;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #121110;
  --surface-1: #1b1a18;
  --surface-2: #252421;
  --text-primary: #eeeae0;
  --text-secondary: #c2bdb0;
  --text-muted: #8f897c;
  --rule: #eeeae0;
  --grid: #2d2b28;
  --axis: #45423d;
  --border: rgba(238, 234, 224, 0.14);
  --engine: #5a8fcc;
  --ai: #e0683f;
  --dom: #3fa679;
  --latam: #b8891a;
  --outside: #9386e0;
  --on-latam: #121110;
  --accent: #e0665a;
  --link: #f08a7e;
  --down: #ef7d70;
  --up: #4fbf87;
  --highlight: rgba(224, 102, 90, 0.10);
  --m-claude: #e08a6c;
  --m-gpt: #2cc39a;
  --m-grok: #5b9be6;
  --m-pplx: #9ccfd4;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--page);
  color: var(--text-primary);
  font: 18px/1.55 var(--serif);
}
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
h1, h2, h3 { font-family: var(--display); line-height: 1.15; margin: 0; font-weight: 700; }
h2 { font-size: 26px; letter-spacing: -0.01em; }
h3 { font-size: 19px; }
a { color: var(--link); text-underline-offset: 2px; }

/* ---------- Site header (nameplate) ---------- */
.site-header { background: var(--page); }
.dateline {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  font: 600 11px/1 var(--sans); letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-secondary);
  padding: 12px 0 10px; border-bottom: 1px solid var(--border);
}
.dateline .dl-mid { flex: 1; text-align: center; }
.theme-toggle {
  width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--border); background: transparent;
  color: var(--text-primary); font-size: 15px; cursor: pointer; flex: none;
}
.nameplate {
  display: block; text-align: center; text-decoration: none; color: var(--text-primary);
  font: 800 clamp(34px, 5.5vw, 54px)/1 var(--display); letter-spacing: -0.025em; padding: 14px 0 4px;
}
.tagline {
  text-align: center; margin: 0 auto; max-width: 52ch; color: var(--text-secondary);
  font: italic 400 16px/1.4 var(--serif); padding-bottom: 10px;
}
.tabs {
  display: flex; justify-content: center; flex-wrap: wrap; gap: 4px 28px;
  border-top: 3px double var(--rule); border-bottom: 1px solid var(--rule); padding: 7px 0;
}
.tabs a {
  font: 700 12px/1.6 var(--sans); letter-spacing: 0.12em; text-transform: uppercase; text-decoration: none;
  color: var(--text-secondary); padding: 2px 0; border-bottom: 2px solid transparent;
}
.tabs a:hover { color: var(--text-primary); }
.tabs a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }
.tabs a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---------- Page lead ---------- */
.lead { padding: 36px 0 8px; display: grid; gap: 14px; max-width: 820px; }
.kicker { font: 700 12px/1 var(--sans); letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); margin: 0; }
.lead h1 { font-size: clamp(32px, 5.2vw, 52px); letter-spacing: -0.02em; font-weight: 700; }
.standfirst { font: 400 20px/1.5 var(--serif); color: var(--text-secondary); margin: 0; }
.byline { font: 500 14px/1.5 var(--sans); color: var(--text-secondary); margin: 2px 0 0; }
.byline strong { color: var(--text-primary); font-weight: 700; }
.lead-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }

/* ---------- Sections ---------- */
.step, .block { border-top: 2px solid var(--rule); padding: 14px 0 8px; margin: 36px 0 0; }
.section-label {
  font: 700 12px/1 var(--sans); letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-secondary);
  margin: 0 0 10px;
}
.step h2 { margin-bottom: 16px; font-size: 24px; }
.num { display: none; }
.sub { color: var(--text-secondary); margin: 8px 0 16px; max-width: 68ch; }
.hint { font: 400 13px/1.5 var(--sans); color: var(--text-muted); margin: 6px 0 0; }
label, legend, select, input, button, .legend, .chip, table, .tooltip, .seg { font-family: var(--sans); }

/* Country picker */
.country-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0; border-left: 1px solid var(--border); border-top: 1px solid var(--border); }
.country {
  text-align: left; padding: 12px 14px; border: 0; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
  background: transparent; color: var(--text-primary); cursor: pointer;
}
.country:hover { background: var(--surface-2); }
.country[aria-checked="true"] { background: var(--text-primary); color: var(--page); }
.country[aria-checked="true"] .cstat { color: var(--page); opacity: 0.75; }
.country .cname { font: 700 18px/1.2 var(--display); display: block; }
.country .cstat { font: 400 12px/1.4 var(--sans); color: var(--text-secondary); display: block; margin-top: 3px; font-variant-numeric: tabular-nums; }

/* Controls */
.controls { display: flex; flex-wrap: wrap; gap: 24px 36px; align-items: flex-start; }
.field { border: 0; padding: 0; margin: 0; min-width: 0; }
.field.grow { flex: 1 1 340px; }
.field > label, .field > legend, .ctl-label {
  display: block; font: 700 11px/1.4 var(--sans); letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-secondary); margin-bottom: 8px; padding: 0;
}
.combo { position: relative; display: flex; gap: 8px; }
.combo input {
  flex: 1; min-width: 0; font-size: 15px; padding: 9px 12px; border-radius: 2px;
  border: 1px solid var(--axis); background: var(--surface-1); color: var(--text-primary);
}
.combo input:focus, .btn:focus-visible, select:focus-visible, .country:focus-visible, .seg button:focus-visible, .sys-toggle:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.btn {
  display: inline-block; text-decoration: none; font: 700 13px/1.2 var(--sans); letter-spacing: 0.04em;
  padding: 10px 16px; border-radius: 2px; border: 1px solid var(--text-primary);
  background: var(--text-primary); color: var(--page); cursor: pointer;
}
.btn.ghost { background: transparent; color: var(--text-primary); }
.btn.small { font-size: 12px; padding: 6px 10px; }
.suggestions {
  position: absolute; z-index: 20; top: 44px; left: 0; right: 0; margin: 0; padding: 4px; list-style: none;
  background: var(--surface-1); border: 1px solid var(--rule); border-radius: 2px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12); max-height: 280px; overflow: auto; font-size: 14px;
}
.suggestions li { padding: 8px 10px; cursor: pointer; display: flex; justify-content: space-between; gap: 12px; }
.suggestions li[aria-selected="true"], .suggestions li:hover { background: var(--surface-2); }
.suggestions .meta { color: var(--text-muted); font-size: 12px; white-space: nowrap; }
.chips-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 10px; border-radius: 2px;
  background: var(--surface-1); border: 1px solid var(--axis); font-size: 13px;
}
.chip .chip-name { border: 0; background: none; font: inherit; color: var(--text-primary); cursor: pointer; padding: 0; }
.chip.focus { border-color: var(--text-primary); box-shadow: inset 0 0 0 1px var(--text-primary); }
.chip .chip-x { border: 0; background: none; color: var(--text-muted); cursor: pointer; font-size: 16px; line-height: 1; padding: 2px 4px; }
.chip .dotkey { width: 8px; height: 8px; }
.quick { border: 0; background: none; color: var(--link); cursor: pointer; font: inherit; padding: 0; text-decoration: underline; text-underline-offset: 2px; }

.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--text-primary); border-radius: 2px; overflow: hidden; }
.seg button {
  font-size: 14px; padding: 8px 12px; border: 0; background: transparent;
  color: var(--text-secondary); cursor: pointer; border-right: 1px solid var(--axis);
}
.seg button:last-child { border-right: 0; }
.seg button[aria-checked="true"] { background: var(--text-primary); color: var(--page); font-weight: 700; }
.seg .user-btn { display: inline-flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 14px; min-width: 86px; }
.uicons { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); }
.seg button[aria-checked="true"] .uicons { color: var(--page); }
.uicon { display: inline-flex; }
.ulang {
  display: inline-block; font: 700 10px/1 var(--sans); letter-spacing: 0.04em;
  padding: 2px 4px; border-radius: 2px; border: 1px solid currentColor;
}
.ulang.en { border-style: dashed; }
.user-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font: 400 12px/1.5 var(--sans); color: var(--text-muted); margin: 8px 0 0; }
.user-legend > span { display: inline-flex; align-items: center; gap: 5px; }

/* System filter */
.sys-filter { display: grid; gap: 8px; }
.sys-group { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.sys-group .sys-kind { font: 600 12px/1 var(--sans); color: var(--text-secondary); min-width: 108px; display: inline-flex; align-items: center; gap: 6px; }
.sys-toggle {
  font: 500 13px/1 var(--sans); padding: 7px 10px; border-radius: 2px; cursor: pointer;
  border: 1px solid var(--axis); background: transparent; color: var(--text-muted); text-decoration: line-through;
}
.sys-toggle[aria-pressed="true"] { background: var(--surface-1); color: var(--text-primary); border-color: var(--text-primary); text-decoration: none; }
.sys-toggle .tick-mark { display: inline-block; width: 12px; }

/* ---------- Results ---------- */
.block-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; align-items: flex-end; }
.mini-controls { display: flex; gap: 12px; flex-wrap: wrap; font: 600 12px/1.4 var(--sans); color: var(--text-secondary); }
.mini-controls select {
  display: block; margin-top: 4px; font-size: 14px; padding: 6px 8px; border-radius: 2px;
  border: 1px solid var(--axis); background: var(--surface-1); color: var(--text-primary);
}
.scatter-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
@media (min-width: 960px) { .scatter-layout { grid-template-columns: minmax(0, 1fr) 320px; } }
.detail { border-left: 1px solid var(--border); padding-left: 20px; }
@media (max-width: 959px) { .detail { border-left: 0; border-top: 1px solid var(--border); padding: 16px 0 0; } }
.detail .d-empty { font: italic 400 16px/1.5 var(--serif); color: var(--text-secondary); }
.detail h3 { font-size: 22px; display: flex; align-items: center; gap: 8px; word-break: break-all; }
.detail .d-origin { font: 400 13px/1.4 var(--sans); color: var(--text-muted); margin: 4px 0 10px; }
.figs { display: flex; gap: 18px; flex-wrap: wrap; margin: 10px 0 8px; }
.fig .label { font: 600 12px/1.3 var(--sans); color: var(--text-secondary); display: flex; align-items: center; gap: 6px; }
.fig .value { font: 700 30px/1.1 var(--display); font-variant-numeric: tabular-nums; }
.fig .rank { font: 400 12px/1.4 var(--sans); color: var(--text-muted); }
.fig .value.down { color: var(--down); }
.fig .value.up { color: var(--up); }
.fig .value.flat { color: var(--text-secondary); }
.detail .figs { gap: 14px 18px; }
.detail .fig .value { font-size: 26px; }
.swatch { width: 10px; height: 10px; border-radius: 1px; display: inline-block; flex: none; }
.empty-note { color: var(--text-secondary); font-size: 15px; }

.hero { display: flex; gap: 40px; flex-wrap: wrap; margin-bottom: 12px; }
.hero .value { font: 700 54px/1 var(--display); }
.hero .label { font: 400 14px/1.4 var(--sans); color: var(--text-secondary); margin-top: 6px; max-width: 30ch; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--text-secondary); margin: 4px 0 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .dotkey, .dotkey { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.lkey { display: inline-flex; align-items: center; }

.chart { width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
svg text { font-family: var(--sans); fill: var(--text-secondary); font-size: 12px; }
svg .tick { fill: var(--text-muted); font-variant-numeric: tabular-nums; font-size: 11px; }
svg .rowlabel { fill: var(--text-primary); font-size: 13px; }
svg .rowlabel.sel { font-weight: 700; }
svg .grouplabel { fill: var(--text-muted); font-size: 10.5px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
svg .val { fill: var(--text-secondary); font-variant-numeric: tabular-nums; }
svg .val.down { fill: var(--down); font-weight: 700; }
svg .val.up { fill: var(--up); font-weight: 700; }
svg .val.flat { fill: var(--text-secondary); }
svg .na { fill: var(--text-muted); font-style: italic; }
svg .grid { stroke: var(--grid); stroke-width: 1; }
svg .baseline { stroke: var(--axis); stroke-width: 1; }
svg .zero { stroke: var(--text-secondary); stroke-width: 1.2; }
svg .hit { fill: transparent; cursor: default; }
svg .hit:hover, svg .hit:focus { fill: var(--highlight); outline: none; }
svg .hit.clickable { cursor: pointer; }
svg .selband { fill: var(--highlight); }
svg .connector { stroke: var(--axis); stroke-width: 2; }
svg .dot { stroke: var(--surface-1); stroke-width: 2; }
svg .inlabel { font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; pointer-events: none; }
svg .pt { fill-opacity: 0.75; stroke: var(--page); stroke-width: 0.6; }
svg .pt.faded { fill-opacity: 0.12; stroke: none; }
svg .pt.sel { fill-opacity: 1; stroke: var(--text-primary); stroke-width: 1.6; }
svg .pt.focus { stroke-width: 2.6; }
svg .plabel {
  fill: var(--text-primary); font-size: 12px; font-weight: 600; pointer-events: none;
  paint-order: stroke; stroke: var(--page); stroke-width: 3px; stroke-linejoin: round;
}
svg .plabel.sel { font-size: 13px; font-weight: 700; }
svg .plabel.faded { opacity: 0.35; }
svg .diag { stroke: var(--text-muted); stroke-width: 1.2; stroke-dasharray: 5 4; }
svg .region { fill: var(--text-muted); font: italic 13px var(--serif); }
svg .axis-title { fill: var(--text-secondary); font-size: 12px; font-weight: 600; }
svg .hover-ring { fill: none; stroke: var(--text-primary); stroke-width: 1.5; pointer-events: none; }
svg .scatter-hit { fill: transparent; }
svg .engine-ref { stroke: var(--text-muted); stroke-width: 1.8; fill: none; }

.table-view { margin-top: 12px; font: 400 14px/1.4 var(--sans); }
.table-view summary { cursor: pointer; color: var(--text-secondary); font-weight: 600; }
.scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; margin-top: 8px; font-variant-numeric: tabular-nums; font-size: 14px; }
th, td { text-align: right; padding: 7px 8px; border-bottom: 1px solid var(--grid); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th { color: var(--text-secondary); font-weight: 700; font-size: 12px; letter-spacing: 0.04em; border-bottom: 1px solid var(--rule); }
td.down { color: var(--down); font-weight: 700; }
td.up { color: var(--up); font-weight: 700; }
td.na { color: var(--text-muted); }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--highlight); }
tr.focus td { background: var(--highlight); font-weight: 700; }
.compare-table td:first-child { display: flex; align-items: center; gap: 6px; }
.compare-table th.group { text-align: center; border-bottom: 1px solid var(--axis); font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; }

.share { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.methods ul, .facts { padding-left: 18px; color: var(--text-secondary); max-width: 74ch; }
.methods li, .facts li { margin: 8px 0; }
.methods strong, .facts strong { color: var(--text-primary); }
.cite { font: 400 14px/1.5 var(--sans); color: var(--text-muted); }

/* ---------- Findings page ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); margin: 28px 0 0; border-top: 2px solid var(--rule); border-bottom: 1px solid var(--rule); }
.stats > div { padding: 16px 18px 14px; border-right: 1px solid var(--border); }
.stats > div:last-child { border-right: 0; }
.stats .value { display: block; font: 700 38px/1.05 var(--display); font-variant-numeric: tabular-nums; }
.stats .label { display: block; font: 400 13px/1.4 var(--sans); color: var(--text-secondary); margin-top: 4px; }
.fnum { font: 700 12px/1 var(--sans); letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); margin: 0 0 8px; }
.finding h2 { font-size: 30px; max-width: 30ch; }
.finding .sub { margin-top: 12px; font-size: 19px; }
.finding .seg { margin-top: 4px; }
.authors { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 0; margin: 12px 0 8px; border-top: 1px solid var(--border); }
.author { padding: 14px 16px 14px 0; border-bottom: 1px solid var(--border); }
.author .a-name { font: 700 19px/1.25 var(--display); }
.author .a-role { font: 400 13px/1.45 var(--sans); color: var(--text-secondary); margin-top: 3px; }
.author a { font: 500 12px/1.4 var(--sans); }
.cite-box {
  display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap;
  background: var(--surface-1); border: 1px solid var(--border); border-left: 3px solid var(--accent); padding: 14px 16px; margin: 10px 0;
}
.cite-box p { margin: 0; flex: 1 1 320px; font-size: 17px; }
.cite-box pre { margin: 0; flex: 1 1 320px; overflow-x: auto; font: 13px/1.5 var(--mono); color: var(--text-primary); white-space: pre; }

.site-footer { border-top: 3px double var(--rule); margin-top: 48px; padding: 18px 0 40px; font: 400 13px/1.6 var(--sans); color: var(--text-muted); }
.site-footer p { margin: 4px 0; max-width: 80ch; }

/* Tooltip */
.tooltip {
  position: fixed; z-index: 50; pointer-events: none; min-width: 170px; max-width: 300px;
  background: var(--surface-1); border: 1px solid var(--rule); border-radius: 2px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16); padding: 8px 10px; font-size: 13px;
}
.tooltip .tt-title { color: var(--text-primary); font-weight: 700; margin-bottom: 4px; }
.tooltip .tt-row { display: flex; align-items: center; gap: 8px; }
.tooltip .tt-key { width: 12px; height: 3px; border-radius: 1px; flex: none; }
.tooltip .tt-val { font-weight: 700; color: var(--text-primary); font-variant-numeric: tabular-nums; min-width: 42px; }
.tooltip .tt-name { color: var(--text-secondary); }
.tooltip .tt-sep { border-top: 1px solid var(--grid); margin: 5px 0; }
.tooltip .tt-note { color: var(--text-muted); margin-top: 4px; }

@media (max-width: 600px) {
  body { font-size: 17px; }
  .dateline .dl-side { display: none; }
  .dateline .dl-mid { text-align: left; }
  .tabs { justify-content: flex-start; gap: 4px 18px; }
  .seg .user-btn { min-width: 0; flex: 1 1 40%; }
  .seg { display: flex; }
  .hero .value { font-size: 44px; }
  .stats > div { border-right: 0; border-bottom: 1px solid var(--border); }
  .sys-group .sys-kind { min-width: 100%; }
}

/* ---------- Compact lead + chart toolbar (outlet lookup) ---------- */
.lead.lead-compact { padding: 22px 0 4px; gap: 8px; max-width: none; }
.lead.lead-compact h1 { font-size: clamp(26px, 3.6vw, 36px); }
.lead.lead-compact .standfirst { font-size: 18px; }
.viz { margin-top: 14px; }
.toolbar {
  display: grid; gap: 10px; padding: 12px 14px; margin-bottom: 14px;
  background: var(--surface-1); border-top: 2px solid var(--rule); border-bottom: 1px solid var(--border);
}
.tb-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; }
.tb-item { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.tb-item.grow { flex: 1 1 320px; }
.tb-item.grow .combo { flex: 1; }
.tb-label { font: 700 11px/1 var(--sans); letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-secondary); white-space: nowrap; }
.toolbar select {
  font-size: 13px; padding: 6px 8px; border-radius: 2px; border: 1px solid var(--axis);
  background: var(--page); color: var(--text-primary);
}
.toolbar .combo input { padding: 7px 10px; font-size: 14px; background: var(--page); }
.toolbar .combo .btn { padding: 7px 12px; }
.toolbar .suggestions { top: 38px; }
.toolbar .chips-row { margin-top: 0; }
.toolbar .user-legend { margin: 0; }
.pills { display: flex; flex-wrap: wrap; gap: 4px; }
.pill {
  font: 600 13px/1 var(--sans); padding: 7px 10px; border-radius: 2px; cursor: pointer;
  border: 1px solid var(--axis); background: var(--page); color: var(--text-primary);
}
.pill:hover { border-color: var(--text-primary); }
.pill[aria-checked="true"] { background: var(--text-primary); color: var(--page); border-color: var(--text-primary); }
.pill:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.seg.seg-compact .user-btn { flex-direction: row; gap: 6px; padding: 6px 10px; min-width: 0; font-size: 13px; }
.toolbar .sys-filter { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.toolbar .sys-group { gap: 4px; }
.toolbar .sys-group .sys-kind { min-width: 0; margin-right: 2px; font-size: 12px; }
.toolbar .sys-toggle { padding: 6px 8px; font-size: 12px; }
@media (max-width: 600px) {
  .toolbar { padding: 10px; }
  .tb-row { gap: 8px 14px; }
  .seg.seg-compact { display: flex; }
  .seg.seg-compact .user-btn { flex: 1 1 45%; justify-content: center; }
  .toolbar .sys-group .sys-kind { min-width: 100%; }
}
@media (max-width: 600px) {
  .tagline { display: none; }
  .nameplate { padding-bottom: 10px; }
  .lead.lead-compact { padding-top: 14px; }
  .lead.lead-compact .standfirst { font-size: 16px; }
  .toolbar { gap: 8px; }
  .toolbar .tb-row { flex-direction: column; align-items: stretch; flex-wrap: nowrap; gap: 8px; }
  .toolbar .tb-row:first-child { flex-direction: row; align-items: center; flex-wrap: nowrap; }
  .toolbar .tb-item { flex-wrap: nowrap; min-width: 0; }
  .toolbar .tb-item.grow { flex: none; }
  .toolbar .tb-label { flex: none; width: 98px; }
  .toolbar .pills, .toolbar .sys-filter, .seg.seg-compact {
    flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; min-width: 0;
  }
  .toolbar .pills::-webkit-scrollbar, .toolbar .sys-filter::-webkit-scrollbar, .seg.seg-compact::-webkit-scrollbar { display: none; }
  .toolbar .sys-group { flex-wrap: nowrap; flex: none; }
  .toolbar .pill, .toolbar .sys-toggle { white-space: nowrap; flex: none; }
  .toolbar .sys-group .sys-kind { min-width: 0; white-space: nowrap; }
  .seg.seg-compact .user-btn { flex: none; }
  .toolbar .user-legend { display: none; }
}

.toolbar { grid-template-columns: minmax(0, 1fr); }
.toolbar > * { min-width: 0; }
.toolbar .combo { min-width: 0; }
.toolbar .combo input { width: 100%; }
@media (max-width: 600px) { .toolbar .tb-item.grow { width: 100%; } .toolbar .tb-item.grow .combo { flex: 1 1 0; } }

/* ---------- Domestic page: chart + side panel ---------- */
.split { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; }
@media (min-width: 960px) { .split { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); } }
.split-side { border-left: 1px solid var(--border); padding-left: 24px; }
@media (max-width: 959px) { .split-side { border-left: 0; border-top: 2px solid var(--rule); padding: 14px 0 0; } }
.side-title { font-size: 28px; margin: 2px 0 6px; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 8px 20px; flex-wrap: wrap; margin-bottom: 4px; }
.panel-title { font-size: 22px; }
.block .panel-title { margin-bottom: 4px; }
.hero.hero-compact { gap: 22px; margin: 0 0 6px; }
.hero.hero-compact .value { font-size: 30px; }
.hero.hero-compact .label { font-size: 12px; margin-top: 2px; }
svg .dval { fill: var(--text-secondary); font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; pointer-events: none; }
svg .selbar { fill: var(--accent); }

/* ---------- Findings: sticky user bar, chart heads, heat table ---------- */
.findings-bar {
  position: sticky; top: 0; z-index: 15; display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap;
  margin: 28px 0 0; padding: 10px 0; background: var(--page);
  border-bottom: 1px solid var(--border);
}
.findings-bar .hint { margin: 0; }
.chart-head { display: flex; justify-content: space-between; align-items: center; gap: 10px 20px; flex-wrap: wrap; margin: 4px 0 8px; }
.chart-head .legend { margin: 0; }
.seg.seg-compact > button:not(.user-btn) { padding: 6px 10px; font-size: 13px; }
table.heat { font-size: 13px; }
table.heat th { white-space: nowrap; }
table.heat th.group { text-align: center; border-bottom: 1px solid var(--axis); font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; }
table.heat td { padding: 9px 8px; }
table.heat td.heat-cell { text-align: center; font-weight: 600; color: var(--text-primary); border: 2px solid var(--page); cursor: default; }
table.heat td.heat-cell.avg { outline: 1px solid var(--engine); outline-offset: -3px; }
table.heat td.heat-cell:focus { outline: 2px solid var(--accent); outline-offset: -2px; }
table.heat .muted { color: var(--text-muted); font-size: 12px; font-weight: 400; }
@media (max-width: 600px) { .findings-bar .hint { display: none; } }

td .cnt { color: var(--text-muted); font-size: 11px; font-weight: 400; }

/* ---------- Lookup toolbar as dropdowns ---------- */
.toolbar.toolbar-dd { gap: 8px; padding: 10px 14px; }
.toolbar-dd .tb-row { gap: 10px 18px; align-items: flex-end; }
.toolbar-dd .tb-item { flex-direction: column; align-items: flex-start; gap: 5px; }
.toolbar-dd select, .dropdown > summary {
  font: 500 14px/1.2 var(--sans); padding: 7px 30px 7px 10px; border-radius: 2px; border: 1px solid var(--axis);
  background: var(--page); color: var(--text-primary); cursor: pointer; min-height: 34px;
}
.toolbar-dd select:hover, .dropdown > summary:hover { border-color: var(--text-primary); }
.dropdown { position: relative; }
.dropdown > summary { list-style: none; position: relative; display: inline-flex; align-items: center; white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.dropdown > summary::-webkit-details-marker { display: none; }
.dropdown > summary::after { content: "▾"; position: absolute; right: 10px; color: var(--text-secondary); font-size: 12px; }
.dropdown[open] > summary { border-color: var(--text-primary); }
.dropdown-panel {
  position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; min-width: 300px; padding: 12px;
  background: var(--surface-1); border: 1px solid var(--rule); border-radius: 2px; box-shadow: 0 10px 28px rgba(0, 0, 0, 0.16);
}
.dropdown-panel.sys-filter { display: grid; gap: 10px; }
.dropdown-panel .sys-group { flex-wrap: wrap; gap: 6px; }
.dropdown-panel .sys-group .sys-kind { min-width: 100%; margin-bottom: 2px; }
.toolbar-dd .combo input { min-height: 34px; }
.toolbar-dd .chips-row { margin: 0; }
@media (max-width: 600px) {
  .toolbar.toolbar-dd .tb-row { flex-direction: row; flex-wrap: wrap; align-items: flex-end; }
  .toolbar-dd .tb-item { flex: 1 1 45%; min-width: 0; }
  .toolbar-dd .tb-item select, .toolbar-dd .dropdown, .toolbar-dd .dropdown > summary { width: 100%; max-width: none; }
  .toolbar-dd .tb-item.grow { flex: 1 1 100%; }
  .toolbar-dd .tb-label { width: auto; }
  .dropdown-panel { min-width: 0; width: min(330px, 86vw); }
}
.toolbar-dd .tb-item.grow { flex: 1 1 240px; align-items: stretch; }
.find-row { display: flex; gap: 6px; align-items: stretch; }
.find-row .combo { flex: 1; min-width: 0; }
.find-row .btn { white-space: nowrap; }

/* ---------- Outlet lookup: visible system toggles, find box in the panel, method boxes ---------- */
.toolbar-dd .tb-item.tb-sys { flex: 1 1 100%; align-items: stretch; }
.toolbar .tb-sys .sys-filter { display: flex; flex-wrap: wrap; gap: 6px 20px; overflow: visible; }
.toolbar .tb-sys .sys-group { flex-wrap: wrap; gap: 4px; }
@media (max-width: 600px) {
  .toolbar .tb-sys .sys-filter { flex-wrap: wrap; overflow: visible; }
  .toolbar .tb-sys .sys-group { flex-wrap: wrap; flex: 1 1 100%; }
}
.d-find { margin-bottom: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.d-find .tb-label { display: block; margin-bottom: 6px; }
.d-find .combo input { padding: 8px 10px; font-size: 14px; background: var(--page); min-height: 36px; }
.d-find .suggestions { top: 40px; }
.d-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.d-head .quick { font-size: 13px; }
.fig .value .of { font-size: 0.55em; font-weight: 600; color: var(--text-muted); }
.method-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin-top: 12px; }
.method-card { background: var(--surface-1); border: 1px solid var(--border); border-top: 2px solid var(--rule); padding: 12px 14px; }
.method-card h3 { font: 700 11px/1.3 var(--sans); letter-spacing: 0.12em; text-transform: uppercase; margin: 0 0 6px; }
.method-card p { font: 400 14px/1.45 var(--sans); color: var(--text-secondary); margin: 0; }

/* ---------- Findings: paper-style small multiples, glance cards, paper links ---------- */
svg .paneltitle { fill: var(--text-primary); font: 600 13px var(--sans); }
svg .ref-line { stroke: var(--text-secondary); stroke-width: 2; fill: none; }
svg .ref-band { fill: var(--text-secondary); opacity: 0.12; }
svg .zero-faint { stroke: var(--axis); stroke-width: 1; }
.lkey .ref-line { stroke: var(--text-secondary); stroke-width: 2; }
.tabs a.tab-ext { color: var(--link); }
.glance { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 12px; margin: 26px 0 0; }
.glance-card {
  display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; text-decoration: none; color: inherit;
  background: var(--surface-1); border: 1px solid var(--border); border-top: 3px solid var(--accent);
}
a.glance-card:hover { border-color: var(--text-primary); border-top-color: var(--accent); }
.glance-card .fnum { margin: 0; }
.glance-card .g-title { font: 700 20px/1.2 var(--display); }
.glance-card .g-text { font: 400 14px/1.45 var(--sans); color: var(--text-secondary); }
.glance-card.explore { border-top-color: var(--rule); }
.glance-card.explore a { font: 600 14px/1.4 var(--sans); color: var(--link); text-decoration: none; }
.glance-card.explore a:hover { text-decoration: underline; }
.finding-sub { font-size: 22px; margin-top: 34px; }
.paper-ref { color: var(--link); font-weight: 600; white-space: nowrap; }
.cta-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.finding .method-grid { margin-top: 18px; }
.method-card.link-card { text-decoration: none; color: inherit; }
.method-card.link-card h3 { color: var(--link); }
.method-card.link-card:hover { border-color: var(--text-primary); }
.tb-item-inline { display: flex; align-items: center; gap: 8px; }
.tb-item-inline select {
  font: 500 14px/1.2 var(--sans); padding: 6px 8px; border-radius: 2px; border: 1px solid var(--axis);
  background: var(--page); color: var(--text-primary);
}
.methods .stats { margin: 14px 0 6px; }
