/* CounselMatch — demo styles.
   Tokens follow the shared spec; the accent is violet. Chart colours are
   separate tokens from the UI accent so each is validated against the
   surface it actually renders on. */

:root {
  color-scheme: light;

  --bg: #fafafa;
  --surface: #ffffff;
  --surface-2: #f4f4f6;
  --text: #1a1a2e;
  --muted: #6b7280;
  --border: #e5e7eb;

  --accent: #7c3aed;
  --accent-ink: #ffffff;
  --accent-soft: rgba(124, 58, 237, 0.10);
  --accent-line: rgba(124, 58, 237, 0.30);

  /* chart tokens */
  --series-1: #7c3aed;          /* validated: L .49, contrast 5.6:1 on #ffffff */
  --grid: #ebebef;
  --axis: #c9ccd3;
  --ink-axis: #6b7280;
  --quadrant: rgba(124, 58, 237, 0.07);

  /* Ordinal ramp for the pipeline stage bar: one hue, light -> dark as the
     stage advances. Validated as an ordinal ramp against #ffffff. */
  --ord-1: #a78bfa;
  --ord-2: #8b5cf6;
  --ord-3: #7333d8;
  --ord-4: #5b21b6;
  --ord-5: #3f1580;

  /* status */
  --good: #0f7a1f;
  --good-bg: rgba(15, 122, 31, 0.12);
  --warn: #8a5a00;
  --warn-bg: rgba(250, 178, 25, 0.20);
  --serious: #9a4a20;
  --serious-bg: rgba(236, 131, 90, 0.20);
  --crit: #b32b2b;
  --crit-bg: rgba(208, 59, 59, 0.14);

  --shadow: 0 6px 24px rgba(16, 18, 27, 0.10);
  --radius-card: 8px;
  --radius-ctl: 6px;
}

[data-theme="dark"] {
  color-scheme: dark;

  --bg: #111318;
  --surface: #1b1e26;
  --surface-2: #232733;
  --text: #e8eaf0;
  --muted: #9aa1ad;
  --border: #2a2f3a;

  --accent: #a78bfa;
  --accent-ink: #16181f;
  --accent-soft: rgba(167, 139, 250, 0.14);
  --accent-line: rgba(167, 139, 250, 0.38);

  --series-1: #9b7bf0;          /* validated in the dark band on #1b1e26 */
  --grid: #262b36;
  --axis: #3a4150;
  --ink-axis: #9aa1ad;
  --quadrant: rgba(155, 123, 240, 0.12);

  /* Dark steps of the same hue, re-stepped for the dark surface: the later
     stage stays the higher-contrast end. Validated against #1b1e26. */
  --ord-1: #6d28d9;
  --ord-2: #8348e8;
  --ord-3: #9a6cf2;
  --ord-4: #b28ffa;
  --ord-5: #cbb3fd;

  --good: #4ade80;
  --good-bg: rgba(12, 163, 12, 0.18);
  --warn: #fab219;
  --warn-bg: rgba(250, 178, 25, 0.16);
  --serious: #ec835a;
  --serious-bg: rgba(236, 131, 90, 0.16);
  --crit: #f08a8a;
  --crit-bg: rgba(208, 59, 59, 0.20);

  --shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
}

/* Same dark values under the OS preference, so a dark-mode visitor never sees
   a light flash in the moment before app.js stamps data-theme. The explicit
   [data-theme] stamps still decide once the toggle has been used. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #111318;
    --surface: #1b1e26;
    --surface-2: #232733;
    --text: #e8eaf0;
    --muted: #9aa1ad;
    --border: #2a2f3a;
    --accent: #a78bfa;
    --accent-ink: #16181f;
    --accent-soft: rgba(167, 139, 250, 0.14);
    --accent-line: rgba(167, 139, 250, 0.38);
    --series-1: #9b7bf0;
    --grid: #262b36;
    --axis: #3a4150;
    --ink-axis: #9aa1ad;
    --quadrant: rgba(155, 123, 240, 0.12);
    --ord-1: #6d28d9;
    --ord-2: #8348e8;
    --ord-3: #9a6cf2;
    --ord-4: #b28ffa;
    --ord-5: #cbb3fd;
    --good: #4ade80;
    --good-bg: rgba(12, 163, 12, 0.18);
    --warn: #fab219;
    --warn-bg: rgba(250, 178, 25, 0.16);
    --serious: #ec835a;
    --serious-bg: rgba(236, 131, 90, 0.16);
    --crit: #f08a8a;
    --crit-bg: rgba(208, 59, 59, 0.20);
    --shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
  }
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

.wrap { max-width: 1200px; margin: 0 auto; width: 100%; padding: 0 16px; }

a { color: var(--accent); }
a:focus-visible,
button:focus-visible,
select:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 60;
  background: var(--surface); color: var(--text);
  padding: 12px 16px; border: 1px solid var(--border); border-radius: 0 0 var(--radius-ctl) 0;
}
.skip-link:focus { left: 0; }

/* ------------------------------- header -------------------------------- */

.site-header {
  position: sticky; top: 0; z-index: 30;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.header-top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; padding-top: 12px; padding-bottom: 12px;
}

.brand { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; min-width: 0; }
.brand-mark { color: var(--accent); font-size: 1.1rem; line-height: 1; }
.brand-name { font-size: 1.15rem; font-weight: 650; letter-spacing: -0.015em; color: var(--accent); }
.brand-tag { font-size: 0.85rem; color: var(--muted); }

.header-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.segmented {
  display: inline-flex; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius-ctl); padding: 2px;
}
.seg-btn {
  font: inherit; font-size: 0.85rem; font-weight: 550;
  border: 0; background: transparent; color: var(--muted);
  padding: 8px 14px; min-height: 40px; border-radius: 4px; cursor: pointer;
  transition: background 150ms ease, color 150ms ease;
}
.seg-btn[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.seg-btn:hover:not([aria-pressed="true"]) { color: var(--text); }

.btn {
  font: inherit; font-size: 0.875rem; font-weight: 550;
  border-radius: var(--radius-ctl); padding: 9px 14px; min-height: 40px;
  cursor: pointer; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
}
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn-ghost { background: transparent; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-sm { font-size: 0.8rem; padding: 6px 10px; min-height: 40px; }

.theme-glyph { font-size: 0.95rem; }

.header-bottom { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: thin; }
.tab {
  font: inherit; font-size: 0.9rem; font-weight: 550; white-space: nowrap;
  background: transparent; border: 0; border-bottom: 2px solid transparent;
  color: var(--muted); padding: 10px 12px; min-height: 44px; cursor: pointer;
  transition: color 150ms ease, border-color 150ms ease;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.tab .tab-badge {
  display: inline-block; margin-left: 6px; font-size: 0.72rem; font-weight: 650;
  background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 1px 7px;
  font-variant-numeric: tabular-nums;
}

.whoami { font-size: 0.8rem; color: var(--muted); padding-bottom: 8px; }
.whoami strong { color: var(--text); font-weight: 600; }

/* -------------------------------- main --------------------------------- */

main { flex: 1 0 auto; padding-top: 24px; padding-bottom: 48px; }

.panel[hidden] { display: none; }
.panel { display: flex; flex-direction: column; gap: 24px; }
.panel:focus { outline: none; }

.panel-head h1 { font-size: 1.5rem; letter-spacing: -0.02em; font-weight: 650; }
.lede { color: var(--muted); max-width: 76ch; margin-top: 8px; font-size: 0.95rem; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-card); padding: 24px;
}
.table-card { padding: 0; overflow: hidden; }
.card-title { font-size: 1.05rem; font-weight: 620; }
.card-sub { color: var(--muted); font-size: 0.875rem; margin-top: 4px; max-width: 72ch; }

/* ------------------------------- stat row ------------------------------- */

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-card); padding: 16px;
}
.stat-label { font-size: 0.8rem; color: var(--muted); }
.stat-value { font-size: 1.6rem; font-weight: 650; letter-spacing: -0.02em; margin-top: 4px; }
.stat-hero .stat-value { font-size: 2.25rem; }
.stat-note { font-size: 0.78rem; color: var(--muted); margin-top: 4px; }
.stat-accent { border-top: 3px solid var(--accent); }

/* ------------------------------- filters -------------------------------- */

.filter-bar {
  display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-card); padding: 16px;
}

.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field-label { font-size: 0.78rem; color: var(--muted); font-weight: 550; }
.field-hint { font-size: 0.78rem; color: var(--muted); }
.field-error { font-size: 0.8rem; color: var(--crit); font-weight: 550; }
.field-wide { flex: 1 1 100%; }
.field-search { flex: 1 1 220px; }

select, input[type="text"], input[type="search"], input[type="number"], textarea {
  font: inherit; font-size: 0.875rem;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-ctl);
  padding: 9px 10px; min-height: 40px; width: 100%;
}
select { min-width: 165px; cursor: pointer; }
textarea { min-height: 72px; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--muted); }

input[type="range"] { width: 100%; accent-color: var(--accent); min-height: 40px; }
.fee-out { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--accent); }

.reset-link {
  font: inherit; font-size: 0.85rem; font-weight: 550;
  background: none; border: 0; color: var(--accent); cursor: pointer;
  text-decoration: underline; padding: 10px 4px; min-height: 40px;
}
.result-count { font-size: 0.8rem; color: var(--muted); margin-left: auto; padding-bottom: 10px; }

/* -------------------------------- tables -------------------------------- */

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table { border-collapse: collapse; width: 100%; font-size: 0.875rem; }
caption { text-align: left; padding: 16px 16px 0; color: var(--muted); font-size: 0.8rem; }
thead th {
  text-align: left; font-weight: 600; font-size: 0.78rem; color: var(--muted);
  border-bottom: 1px solid var(--border); background: var(--surface);
  white-space: nowrap; padding: 0;
}
thead th.num, td.num { text-align: right; }
.sort-btn {
  font: inherit; font-size: 0.78rem; font-weight: 600; color: inherit;
  background: none; border: 0; cursor: pointer; width: 100%;
  padding: 12px 12px; min-height: 44px; text-align: inherit;
  display: flex; align-items: center; gap: 4px;
}
th.num .sort-btn { justify-content: flex-end; }
.sort-btn:hover { color: var(--text); }
th[aria-sort] .sort-btn { color: var(--accent); }
.sort-caret { font-size: 0.7rem; }
th.plain { padding: 12px; }

tbody tr { border-bottom: 1px solid var(--border); }
tbody tr:last-child { border-bottom: 0; }
tfoot tr { border-top: 1px solid var(--border); background: var(--surface-2); }
tfoot td { padding: 12px; }
tbody tr.clickable { cursor: pointer; transition: background 150ms ease; }
tbody tr.clickable:hover, tbody tr.clickable:focus-visible { background: var(--accent-soft); }
tbody td { padding: 12px; vertical-align: top; }
td.num, .tnum { font-variant-numeric: tabular-nums; }
.cell-strong { font-weight: 600; }
.cell-sub { color: var(--muted); font-size: 0.8rem; display: block; margin-top: 2px; }
.nowrap { white-space: nowrap; }

.empty-state { padding: 48px 24px; text-align: center; color: var(--muted); }
.empty-state p { margin-bottom: 12px; }

/* -------------------------------- badges -------------------------------- */

.badge {
  display: inline-block; font-size: 0.75rem; font-weight: 600; white-space: nowrap;
  border-radius: 999px; padding: 3px 9px; border: 1px solid transparent;
}
.badge-neutral { background: var(--surface-2); color: var(--muted); border-color: var(--border); }
.badge-accent { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-line); }
.badge-good { background: var(--good-bg); color: var(--good); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-serious { background: var(--serious-bg); color: var(--serious); }
.badge-crit { background: var(--crit-bg); color: var(--crit); }

.niche-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip {
  font-size: 0.72rem; border: 1px solid var(--border); border-radius: 999px;
  padding: 2px 8px; color: var(--muted); white-space: nowrap;
}

/* -------------------------------- charts -------------------------------- */

.chart-card { display: flex; flex-direction: column; gap: 16px; }
.chart-head h2 { font-size: 1.05rem; font-weight: 620; }
.chart-sub { color: var(--muted); font-size: 0.85rem; margin-top: 4px; max-width: 72ch; }
/* Charts are drawn at the holder's measured pixel width, so SVG text keeps
   its intended size at every breakpoint. max-width is the safety net. */
.chart-holder { width: 100%; }
.chart-holder svg { display: block; max-width: 100%; }
.chart-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.chart-note { font-size: 0.78rem; color: var(--muted); }
.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }

.size-legend { display: flex; align-items: center; gap: 12px; font-size: 0.78rem; color: var(--muted); }
.size-legend svg { width: auto; }

.chart-tip {
  position: fixed; z-index: 50; pointer-events: none;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-ctl);
  box-shadow: var(--shadow); padding: 8px 10px; max-width: 260px;
  font-size: 0.8rem; line-height: 1.4;
}
.chart-tip[hidden] { display: none; }
.tip-value { font-weight: 650; font-size: 0.95rem; }
.tip-label { color: var(--muted); }
.tip-row { display: flex; align-items: baseline; gap: 6px; }
.tip-key { display: inline-block; width: 14px; height: 2px; border-radius: 1px; background: var(--series-1); flex: none; }
.tip-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; flex: none; }

/* Transparent hit targets sit above the marks; `all` guarantees they are
   hit-tested regardless of how the fill is painted. */
.chart-hit { cursor: pointer; pointer-events: all; }
.chart-hit:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* stage bar */
.stagebar { display: flex; flex-direction: column; gap: 12px; }
.stage-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.stage-key { display: flex; align-items: center; gap: 6px; font-size: 0.8rem; }
.stage-key .sw { width: 12px; height: 12px; border-radius: 2px; flex: none; }
.stage-key .n { font-variant-numeric: tabular-nums; font-weight: 620; }
.stage-key .l { color: var(--muted); }

/* rank badges */
.rank-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; margin-top: 16px; }
.rank-card { border: 1px solid var(--border); border-radius: var(--radius-card); padding: 16px; background: var(--surface-2); }
.rank-niche { font-size: 0.85rem; font-weight: 600; }
.rank-pct { font-size: 1.4rem; font-weight: 650; margin-top: 4px; letter-spacing: -0.02em; }
.rank-meta { font-size: 0.8rem; color: var(--muted); margin-top: 4px; }

/* -------------------------------- forms --------------------------------- */

.post-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.form-row > .field { flex: 1 1 200px; }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.switch-row { display: flex; flex-direction: column; gap: 4px; flex: 1 1 100%; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; min-height: 40px; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track {
  width: 40px; height: 22px; border-radius: 999px; background: var(--surface-2);
  border: 1px solid var(--border); position: relative; flex: none;
  transition: background 150ms ease, border-color 150ms ease;
}
.switch-thumb {
  position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--muted); transition: transform 150ms ease, background 150ms ease;
}
.switch input:checked + .switch-track { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(18px); background: var(--accent-ink); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch-text { font-size: 0.875rem; }

.match-list { list-style: none; display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.match-item {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  border: 1px solid var(--border); border-radius: var(--radius-card); padding: 12px;
}
.match-rank {
  width: 28px; height: 28px; border-radius: 50%; flex: none;
  background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 650; font-variant-numeric: tabular-nums;
}
.match-body { flex: 1 1 200px; min-width: 0; }
.match-name { font-weight: 600; font-size: 0.9rem; }
.match-why { font-size: 0.8rem; color: var(--muted); margin-top: 2px; }
.match-foot { margin-top: 16px; font-size: 0.85rem; color: var(--muted); }

/* ------------------------------ my briefs ------------------------------- */

.claim-meter {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  border: 1px solid var(--border); border-radius: var(--radius-card);
  background: var(--surface); padding: 12px 16px; font-size: 0.875rem;
}
.claim-pips { display: flex; gap: 4px; }
.claim-pip { width: 26px; height: 8px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--border); }
.claim-pip.on { background: var(--accent); border-color: var(--accent); }
.claim-text { color: var(--muted); }

.brief-cards { display: flex; flex-direction: column; gap: 16px; }
.brief-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 24px; }
.brief-card-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: flex-start; }
.brief-card-head h2 { font-size: 1.05rem; font-weight: 620; }
.brief-meta { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 8px; font-size: 0.85rem; color: var(--muted); }
.brief-meta b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.brief-body { margin-top: 12px; font-size: 0.9rem; color: var(--muted); max-width: 76ch; }

.submit-form { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 16px; }
.submit-form h3 { font-size: 0.9rem; font-weight: 620; margin-bottom: 12px; }
.cand-list { list-style: none; display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.cand-item {
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-ctl); padding: 8px 12px; font-size: 0.85rem;
}
.cand-item .cand-name { font-weight: 600; }
.cand-item .cand-meta { color: var(--muted); font-size: 0.8rem; }

/* ------------------------------- prose ---------------------------------- */

.prose { max-width: 82ch; }
.prose h2 { font-size: 1.05rem; font-weight: 620; margin-top: 24px; color: var(--accent); }
.prose h2:first-child { margin-top: 0; }
.prose p { margin-top: 8px; color: var(--text); font-size: 0.95rem; }
.callout {
  margin-top: 24px; border-left: 3px solid var(--accent);
  background: var(--accent-soft); border-radius: 0 var(--radius-ctl) var(--radius-ctl) 0;
  padding: 16px;
}
.callout h3 { font-size: 0.9rem; font-weight: 620; }
.callout p { margin-top: 4px; font-size: 0.9rem; }

/* ------------------------------ slide-over ------------------------------ */

.overlay {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(12, 14, 20, 0.45);
  display: flex; justify-content: flex-end;
}
.overlay[hidden] { display: none; }

.slideover {
  background: var(--surface); width: min(560px, 100%); height: 100%;
  border-left: 1px solid var(--border); box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  animation: slide-in 180ms ease;
}
@keyframes slide-in { from { transform: translateX(24px); opacity: 0.4; } to { transform: none; opacity: 1; } }

.slideover-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 24px; border-bottom: 1px solid var(--border);
}
.slideover-head h2 { font-size: 1.15rem; font-weight: 650; letter-spacing: -0.015em; }
.slideover-kicker { font-size: 0.78rem; color: var(--accent); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.slideover-body { padding: 24px; overflow-y: auto; display: flex; flex-direction: column; gap: 24px; }
.close-btn { flex: none; }

.meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.meta-item { border: 1px solid var(--border); border-radius: var(--radius-ctl); padding: 12px; }
.meta-label { font-size: 0.75rem; color: var(--muted); }
.meta-value { font-size: 0.95rem; font-weight: 600; margin-top: 2px; font-variant-numeric: tabular-nums; }

.section-title { display: flex; align-items: center; gap: 6px; font-size: 0.95rem; font-weight: 620; }
.info-btn {
  font: inherit; font-size: 0.7rem; font-weight: 700; line-height: 1;
  width: 18px; height: 18px; border-radius: 50%; flex: none;
  border: 1px solid var(--accent-line); background: var(--accent-soft); color: var(--accent);
  cursor: help; display: inline-flex; align-items: center; justify-content: center;
}
.section-note { font-size: 0.82rem; color: var(--muted); margin-top: 4px; }
.detail-block { display: flex; flex-direction: column; gap: 12px; }

.rank-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.rank-row {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--border); border-radius: var(--radius-ctl); padding: 12px;
}
.rank-row .match-rank { background: var(--surface-2); color: var(--text); }
.rank-row .match-rank.top { background: var(--accent); color: var(--accent-ink); }
.rank-main { flex: 1 1 auto; min-width: 0; }
.rank-figs { text-align: right; font-variant-numeric: tabular-nums; flex: none; }
.rank-figs .big { font-weight: 650; }
.rank-figs .small { font-size: 0.78rem; color: var(--muted); }

/* -------------------------------- toasts -------------------------------- */

.toast-wrap {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 24px;
  z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none; width: min(420px, calc(100% - 32px));
}
.toast {
  background: var(--text); color: var(--bg);
  border-radius: var(--radius-ctl); padding: 12px 16px; font-size: 0.875rem;
  box-shadow: var(--shadow); animation: toast-in 180ms ease; width: 100%;
}
.toast.warn { background: var(--surface); color: var(--text); border: 1px solid var(--accent-line); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* -------------------------------- footer -------------------------------- */

.site-footer { border-top: 1px solid var(--border); background: var(--surface); flex: none; }
.footer-inner {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  flex-wrap: wrap; padding-top: 24px; padding-bottom: 24px;
  font-size: 0.85rem; color: var(--muted);
}

/* ------------------------------ responsive ------------------------------ */

@media (max-width: 900px) {
  .post-grid { grid-template-columns: minmax(0, 1fr); }
  .slideover { width: 100%; }
}

@media (max-width: 640px) {
  .brand-tag { display: none; }
  .header-top { padding-top: 8px; padding-bottom: 8px; }
  .header-tools { width: 100%; justify-content: space-between; }
  .whoami { width: 100%; }
  .panel-head h1 { font-size: 1.3rem; }
  .card, .brief-card { padding: 16px; }
  .filter-bar { padding: 12px; }
  .field, .field-search { flex: 1 1 100%; }
  select { min-width: 0; }
  .result-count { margin-left: 0; width: 100%; padding-bottom: 0; }
  .stat-hero .stat-value { font-size: 1.9rem; }
  .chart-grid { grid-template-columns: minmax(0, 1fr); }
  .toast-wrap { bottom: 12px; }
  .slideover-head, .slideover-body { padding: 16px; }
}

/* ---------------------------- reduced motion ---------------------------- */

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

@media print {
  .site-header, .toast-wrap, .overlay { display: none !important; }
}
