/**
 * WaterBalanceTool (WBT) — Minimalist Dark
 * ---------------------------------------------------------------------------
 * Layered slate + warm amber accent, ambient glow, glass cards.
 * All tokens live in :root — retheming means replacing this block only.
 */

/* ═══ Tokens ═══════════════════════════════════════════════════════════════ */
:root {
  /* Layered darkness — at least three distinct tones, per the design system */
  --bg:            #0A0A0F;
  --bg-alt:        #12121A;
  --muted:         #1A1A24;
  --card:          rgba(26, 26, 36, 0.6);
  --card-solid:    #1A1A24;

  --fg:            #FAFAFA;
  --fg-secondary:  #c3c2b7;
  --fg-muted:      #71717A;

  --accent:        #F59E0B;
  --accent-fg:     #0A0A0F;
  --accent-muted:  rgba(245, 158, 11, 0.15);

  --border:        rgba(255, 255, 255, 0.08);
  --border-hover:  rgba(255, 255, 255, 0.15);

  /* Data-viz roles — validated against the #12121A chart surface.
     Do not hand-edit; see env.js VIZ and re-run the palette validator. */
  --viz-home:      #2a78d6;
  --viz-away:      #e34948;
  --viz-neutral:   #383835;
  --viz-grid:      #2c2c2a;
  --viz-good:      #0ca30c;
  --viz-warning:   #fab219;
  --viz-critical:  #d03b3b;

  --radius-sm:  0.375rem;
  --radius-md:  0.5rem;
  --radius-lg:  0.75rem;
  --radius-xl:  1rem;

  --shadow-md:  0 4px 6px rgba(0, 0, 0, 0.3);
  --shadow-lg:  0 10px 15px rgba(0, 0, 0, 0.3);
  --glow-sm:    0 0 20px rgba(245, 158, 11, 0.15);
  --glow-md:    0 0 40px rgba(245, 158, 11, 0.2);

  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body:    "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono:    "JetBrains Mono", ui-monospace, monospace;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ═══ Reset ════════════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3, h4 { font-family: var(--font-display); letter-spacing: -0.025em; margin: 0; }
p { margin: 0; }
button { font: inherit; color: inherit; }

:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--accent), 0 0 0 4px var(--bg);
  border-radius: var(--radius-sm);
}

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

/* ═══ Ambient background ═══════════════════════════════════════════════════ */
.ambient { position: fixed; inset: 0; pointer-events: none; z-index: 0; }

.ambient__orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.05;
}
.ambient__orb--1 {
  top: -180px; left: 50%; transform: translateX(-50%);
  width: 620px; height: 420px; background: var(--accent);
}
.ambient__orb--2 {
  bottom: -220px; right: -120px;
  width: 520px; height: 420px; background: var(--viz-home);
}
.ambient__noise {
  position: absolute; inset: 0; opacity: 0.015;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E");
}

@media (max-width: 720px) {
  .ambient__orb--1 { width: 400px; height: 300px; }
  .ambient__orb--2 { width: 340px; height: 280px; }
}

/* ═══ Top bar ══════════════════════════════════════════════════════════════ */
.topbar {
  position: relative; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  max-width: 78rem; margin: 0 auto;
  padding: 20px 24px;
}

.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.brand__mark {
  display: grid; place-items: center;
  width: 38px; height: 38px;
  background: var(--accent-muted);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--radius-md);
  font-size: 19px;
  box-shadow: var(--glow-sm);
}
.brand__text { display: flex; flex-direction: column; line-height: 1.2; }
.brand__text strong { font-family: var(--font-display); font-size: 16px; font-weight: 600; }
.brand__text em {
  font-style: normal; font-family: var(--font-mono);
  font-size: 11px; color: var(--fg-muted); letter-spacing: 0.03em;
}

.topbar__nav { display: none; gap: 24px; }
@media (min-width: 768px) { .topbar__nav { display: flex; } }
.topbar__link {
  color: var(--fg-muted); text-decoration: none; font-size: 14px;
  transition: color 200ms var(--ease);
}
.topbar__link:hover, .topbar__link:focus-visible { color: var(--accent); }

/* ═══ Shell ════════════════════════════════════════════════════════════════ */
.shell {
  position: relative; z-index: 1;
  max-width: 78rem; margin: 0 auto;
  padding: 24px 24px 80px;
}

/* ═══ Buttons ══════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 22px;
  background: var(--accent); color: var(--accent-fg);
  border: none; border-radius: var(--radius-lg);
  font-weight: 500; cursor: pointer;
  transition: all 200ms ease-out;
}
.btn:hover { filter: brightness(1.1); box-shadow: 0 0 20px rgba(245, 158, 11, 0.4); }
.btn:active { transform: scale(0.98); }

.btn--ghost {
  background: transparent; color: var(--fg);
  border: 1px solid var(--border-hover);
}
.btn--ghost:hover { background: rgba(255, 255, 255, 0.05); border-color: rgba(255,255,255,0.25); box-shadow: none; }

.btn--sm { height: 34px; padding: 0 14px; font-size: 13px; border-radius: var(--radius-md); }

/* ═══ Valve ════════════════════════════════════════════════════════════════ */
.valve__head { text-align: center; padding: 48px 0 40px; }

.badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px; margin-bottom: 28px;
  background: var(--accent-muted);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: 9999px;
  font-family: var(--font-mono); font-size: 12px;
  color: var(--accent);
  box-shadow: var(--glow-sm);
}
.badge__dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.valve__title {
  font-size: clamp(2.2rem, 6vw, 3.6rem);
  font-weight: 700; line-height: 1.12; margin-bottom: 20px;
}
.valve__title .accent { color: var(--accent); }

.valve__sub {
  max-width: 42rem; margin: 0 auto;
  color: var(--fg-muted); font-size: 15px; line-height: 1.75;
}

.valve__controls {
  display: flex; flex-wrap: wrap; align-items: flex-end;
  justify-content: space-between; gap: 16px;
  margin-bottom: 24px;
}

.field { display: flex; flex-direction: column; gap: 7px; flex: 1; min-width: 260px; }
.field__label { font-size: 12px; color: var(--fg-muted); font-family: var(--font-mono); letter-spacing: 0.03em; }

.select {
  height: 44px; padding: 0 14px;
  background: var(--card); color: var(--fg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(8px);
  transition: all 200ms;
}
.select:focus {
  border-color: rgba(245, 158, 11, 0.5); outline: none;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2), 0 0 20px rgba(245, 158, 11, 0.1);
}

.mode-toggle {
  display: inline-flex; padding: 4px; gap: 4px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.mode-toggle__btn {
  padding: 8px 18px; background: transparent; border: none;
  border-radius: var(--radius-md); color: var(--fg-muted);
  font-size: 14px; cursor: pointer; transition: all 200ms;
}
.mode-toggle__btn.is-active { background: var(--accent); color: var(--accent-fg); font-weight: 500; }
.mode-toggle__btn:not(.is-active):hover { color: var(--fg); background: rgba(255,255,255,0.05); }

/* ═══ Data source bar (一键获取真实赛事) ══════════════════════════════════ */
.datasource-bar {
  display: inline-flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-left: 12px;
}
.ds-btn {
  padding: 8px 18px; border-radius: var(--radius-md);
  background: var(--accent); color: var(--accent-fg); border: 1px solid transparent;
  font-size: 14px; font-weight: 500; cursor: pointer; transition: all 200ms;
  white-space: nowrap;
}
.ds-btn:hover:not(:disabled) { filter: brightness(1.08); transform: translateY(-1px); }
.ds-btn:disabled { opacity: 0.6; cursor: progress; }
.ds-btn--ghost {
  background: transparent; color: var(--fg-muted); border-color: var(--border);
}
.ds-btn--ghost:hover:not(:disabled) { color: var(--fg); background: rgba(255,255,255,0.05); }
.ds-status {
  font-size: 13px; color: var(--fg-muted); line-height: 1.4;
}
.ds-status.is-real { color: var(--accent); }
.ds-status.is-error { color: #ef4444; }

/* ═══ Expert panel ═════════════════════════════════════════════════════════ */
.expert-panel {
  display: grid; gap: 24px;
  padding: 22px; margin-bottom: 28px;
  background: var(--card); backdrop-filter: blur(8px);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
}
.expert-panel__title { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.expert-panel__hint { font-size: 12.5px; color: var(--fg-muted); margin-bottom: 12px; }

.expert-panel__group { min-width: 0; }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
/* The a~m picker holds 13 chips — tighten so it stays one visual block. */
.chip-row--dense { gap: 5px; }

.chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  background: transparent; color: var(--fg-secondary);
  border: 1px solid var(--border); border-radius: var(--radius-md);
  font-size: 13px; cursor: pointer; transition: all 200ms;
}
.chip:hover { border-color: var(--border-hover); background: rgba(255,255,255,0.04); }
.chip.is-on {
  border-color: rgba(245, 158, 11, 0.35);
  background: var(--accent-muted);
  color: var(--fg);
}
.chip__dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.chip__meta { font-size: 11px; color: var(--fg-muted); font-family: var(--font-mono); }
.chip__key {
  display: grid; place-items: center;
  width: 17px; height: 17px; border-radius: 4px;
  background: rgba(255,255,255,0.08);
  font-family: var(--font-mono); font-size: 10px;
}
.chip--sm { padding: 6px 10px; font-size: 12px; }

/* ═══ Match grid ═══════════════════════════════════════════════════════════ */
.match-grid {
  display: grid; gap: 20px;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}

/* ═══ Empty state (默认空框占位) ══════════════════════════════════════════ */
.match-empty { grid-column: 1 / -1; }
.match-empty__frame {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; text-align: center;
  min-height: 260px; padding: 48px 24px;
  background: var(--card); backdrop-filter: blur(8px);
  border: 1px dashed var(--border); border-radius: var(--radius-lg);
}
.match-empty__icon { color: var(--fg-muted); opacity: 0.55; }
.match-empty__title { font-size: 17px; font-weight: 600; color: var(--fg); margin: 0; }
.match-empty__hint { font-size: 13.5px; line-height: 1.6; color: var(--fg-muted); margin: 0; }

.match-card {
  display: flex; flex-direction: column; gap: 14px;
  padding: 20px;
  background: var(--card); backdrop-filter: blur(8px);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 300ms ease-out;
}
.match-card:hover, .match-card:focus-visible {
  border-color: var(--border-hover);
  background: rgba(26, 26, 36, 0.8);
  transform: scale(1.02);
  box-shadow: var(--shadow-lg);
}
.match-card:hover .match-card__cta { color: var(--accent); }

.match-card__top {
  display: flex; justify-content: space-between; gap: 10px;
  font-size: 12px; color: var(--fg-muted); font-family: var(--font-mono);
}
.match-card__top .league {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.match-card__top .kickoff { flex-shrink: 0; color: var(--fg-secondary); }

.match-card__teams { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; }
.team { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.team--home { align-items: flex-start; }
.team--away { align-items: flex-end; }
.team--away .team__form { flex-direction: row-reverse; }
.team__name {
  font-family: var(--font-display); font-size: 15px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%;
}
.team__rank { font-size: 11px; color: var(--fg-muted); font-family: var(--font-mono); }
.team__form { display: flex; gap: 3px; }

.form-pill {
  display: grid; place-items: center;
  width: 16px; height: 16px; border-radius: 3px;
  font-size: 9px; font-weight: 600; font-family: var(--font-mono);
}
.form-pill--w { background: rgba(12, 163, 12, 0.22); color: #4ade80; }
.form-pill--d { background: rgba(255, 255, 255, 0.08); color: var(--fg-muted); }
.form-pill--l { background: rgba(208, 59, 59, 0.22); color: #f87171; }

.match-card__vs { display: flex; flex-direction: column; align-items: center; gap: 7px; }
.vs { font-family: var(--font-mono); font-size: 11px; color: var(--fg-muted); }
.tilt-bar { position: relative; width: 54px; height: 3px; background: var(--viz-neutral); border-radius: 2px; }
.tilt-bar__fill { position: absolute; top: 0; height: 100%; border-radius: 2px; transition: width 400ms var(--ease); }

.match-card__odds {
  display: flex; gap: 12px; flex-wrap: wrap;
  padding-top: 12px; border-top: 1px solid var(--border);
  font-family: var(--font-mono); font-size: 12px;
}
.match-card__odds em { font-style: normal; color: var(--fg-muted); margin-right: 4px; }
.match-card__odds .handicap { margin-left: auto; color: var(--accent); }

.match-card__tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag {
  padding: 3px 9px; border-radius: 9999px;
  background: rgba(255,255,255,0.05); border: 1px solid var(--border);
  font-size: 11px; color: var(--fg-muted);
}

.match-card__cta {
  font-size: 13px; color: var(--fg-muted);
  transition: color 200ms;
}

/* ═══ Analyzing ════════════════════════════════════════════════════════════ */
.analyzing {
  max-width: 46rem; margin: 0 auto;
  padding: 64px 0; text-align: center;
}
.analyzing__match {
  display: flex; align-items: center; justify-content: center; gap: 16px;
  margin-bottom: 40px;
  font-family: var(--font-display); font-size: 22px; font-weight: 600;
}
.analyzing__team { color: var(--fg); }
.analyzing__vs { color: var(--fg-muted); font-size: 13px; font-family: var(--font-mono); }

.progress { margin-bottom: 34px; }
.progress__track {
  height: 4px; border-radius: 2px; overflow: hidden;
  background: rgba(255,255,255,0.06);
}
.progress__fill {
  height: 100%; width: 0;
  background: linear-gradient(90deg, var(--accent), #fbbf24);
  border-radius: 2px;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.5);
  transition: width 500ms var(--ease);
}
.progress__row {
  display: flex; justify-content: space-between;
  margin-top: 11px; font-size: 13px;
}
.progress__label { color: var(--fg-secondary); }
.progress__pct { font-family: var(--font-mono); color: var(--accent); }
.progress__detail { margin-top: 4px; font-size: 12px; color: var(--fg-muted); min-height: 18px; }

.stage-list {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 22px;
  list-style: none; padding: 0; margin: 0 0 30px;
}
.stage { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--fg-muted); }
.stage__dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--viz-neutral); transition: all 300ms;
}
.stage__name { white-space: nowrap; }
.stage.is-active { color: var(--fg); }
.stage.is-active .stage__dot {
  background: var(--accent); box-shadow: 0 0 10px var(--accent);
  animation: pulse 1.4s ease-in-out infinite;
}
.stage.is-done { color: var(--fg-secondary); }
.stage.is-done .stage__dot { background: var(--viz-good); }

.lane-status { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin-bottom: 30px; }
.lane-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 14px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 9999px; font-size: 12.5px;
}
.lane-chip__dot { width: 8px; height: 8px; border-radius: 50%; }
.lane-chip__name { color: var(--fg-secondary); }
.lane-chip__state { color: var(--fg-muted); font-family: var(--font-mono); font-size: 11px; }

.analyzing__tip {
  max-width: 34rem; margin: 0 auto 26px;
  color: var(--fg-muted); font-size: 13.5px; line-height: 1.7;
  transition: opacity 260ms;
}

/* ═══ Balance workspace ════════════════════════════════════════════════════ */
.balance { display: flex; flex-direction: column; gap: 22px; }

.balance__head {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding-bottom: 18px; border-bottom: 1px solid var(--border);
}
.balance__title { flex: 1; min-width: 220px; }
.balance__title h2 { font-size: 22px; font-weight: 600; }
.vs-sm { color: var(--fg-muted); font-size: 14px; font-weight: 400; }
.balance__meta { font-size: 12px; color: var(--fg-muted); font-family: var(--font-mono); }
.balance__actions { display: flex; gap: 8px; }

.origin-badge {
  padding: 2px 7px; border-radius: 4px;
  background: var(--accent-muted); color: var(--accent);
  font-size: 11px;
}

.warn-banner, .error-banner {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 16px; border-radius: var(--radius-md);
  font-size: 13px;
}
.warn-banner { background: rgba(250, 178, 25, 0.1); border: 1px solid rgba(250, 178, 25, 0.25); color: #fcd34d; }
.error-banner { background: rgba(208, 59, 59, 0.12); border: 1px solid rgba(208, 59, 59, 0.3); color: #fca5a5; margin-bottom: 20px; }
.error-banner button { margin-left: auto; }

/* ── Stat tiles ── */
.verdict-row {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.stat {
  display: flex; flex-direction: column; gap: 5px;
  padding: 16px 18px;
  background: var(--card); backdrop-filter: blur(8px);
  border: 1px solid var(--border); border-left: 3px solid var(--stat-accent, var(--viz-neutral));
  border-radius: var(--radius-lg);
}
.stat__label { font-size: 11.5px; color: var(--fg-muted); font-family: var(--font-mono); letter-spacing: 0.02em; }
.stat__value {
  font-family: var(--font-display); font-size: 30px; font-weight: 600;
  line-height: 1.1; color: var(--fg);
}
.stat__value em { font-style: normal; font-size: 15px; color: var(--fg-muted); }
.stat__sub { font-size: 12px; color: var(--fg-secondary); }

.stat--hero { border-left-width: 3px; box-shadow: 0 0 30px rgba(245, 158, 11, 0.06); }
.stat--hero .stat__value { font-size: 40px; color: var(--stat-accent); }

/* Status tile (e.g. 舆论过热) — the accent is a reserved status color, and it
   always ships with the ⚠ icon + label in the markup, never color alone. */
.stat--status { background: rgba(250, 178, 25, 0.06); }
.stat--status .stat__value { color: var(--stat-accent); }
.stat--delta.is-flipped { border-left-color: var(--accent); box-shadow: var(--glow-sm); }

/* ── Panels ── */
.panel {
  padding: 20px;
  background: var(--card); backdrop-filter: blur(8px);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
}
/* The curve panel is the visual anchor of the workspace — give it more room
   and a faint amber lift so it reads as primary among the panels. */
.panel--chart {
  padding: 22px 22px 18px;
  box-shadow: 0 0 40px rgba(245, 158, 11, 0.04);
}
/* The triage list is long; let it breathe and cap runaway height on desktop. */
.panel--factors { padding-bottom: 12px; }

.panel__head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; margin-bottom: 16px;
}
.panel__head h3 { font-size: 15px; font-weight: 600; }
.panel__hint { font-size: 12.5px; color: var(--fg-muted); margin-bottom: 16px; line-height: 1.7; }
.panel__tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.panel__legend { display: flex; gap: 14px; flex-wrap: wrap; }

.legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--fg-secondary); }
.legend-item i { width: 10px; height: 3px; border-radius: 2px; display: inline-block; }
.legend-dash {
  background: repeating-linear-gradient(90deg, var(--fg-muted) 0 3px, transparent 3px 6px) !important;
}

.grid-2 { display: grid; gap: 22px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

.chart-host { position: relative; width: 100%; min-height: 180px; }
.wbt-chart { display: block; width: 100%; overflow: visible; }
.wbt-chart:focus-visible { box-shadow: 0 0 0 2px var(--accent); border-radius: var(--radius-md); }

.wbt-pulse { animation: chartPulse 2.2s ease-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes chartPulse {
  0%   { r: 5;  opacity: 0.9; }
  100% { r: 16; opacity: 0; }
}

.wbt-tooltip {
  position: absolute; z-index: 20; pointer-events: none;
  padding: 8px 11px;
  background: rgba(10, 10, 15, 0.95); backdrop-filter: blur(8px);
  border: 1px solid var(--border-hover); border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 12px; white-space: nowrap;
}
.wbt-tooltip__time { color: var(--fg-muted); font-family: var(--font-mono); font-size: 10.5px; }
.wbt-tooltip__value { font-family: var(--font-display); font-size: 17px; font-weight: 600; }
.wbt-tooltip__meta { color: var(--fg-secondary); font-size: 11px; }

/* ── Table view (the non-visual equivalent) ── */
.table-view { margin-top: 14px; }
.table-view summary {
  cursor: pointer; font-size: 12.5px; color: var(--fg-muted);
  padding: 6px 0; user-select: none;
}
.table-view summary:hover { color: var(--accent); }
.table-scroll { overflow-x: auto; margin-top: 10px; }

.dtable { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.dtable th, .dtable td {
  padding: 7px 12px; text-align: left;
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
.dtable th { color: var(--fg-muted); font-weight: 500; font-family: var(--font-mono); font-size: 11px; }
.dtable td { color: var(--fg-secondary); }

/* ── Report ── */
.report p { margin-bottom: 12px; font-size: 14px; line-height: 1.8; color: var(--fg-secondary); }
.report p:last-child { margin-bottom: 0; }
.report strong { color: var(--fg); font-weight: 600; }

/* ── Synthesis ── */
.synthesis { display: flex; flex-direction: column; gap: 20px; }
.synthesis__summary {
  padding: 14px 16px;
  background: rgba(245, 158, 11, 0.06);
  border-left: 2px solid var(--accent);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-size: 13.5px; line-height: 1.8; color: var(--fg-secondary);
}
.synthesis__group h4 { font-size: 13px; margin-bottom: 10px; color: var(--fg-secondary); }

.synth-card {
  padding: 13px 15px; margin-bottom: 9px;
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--border); border-radius: var(--radius-md);
}
.synth-card--warn { border-color: rgba(250, 178, 25, 0.25); background: rgba(250, 178, 25, 0.05); }
.synth-card__topic { font-size: 13.5px; font-weight: 500; margin-bottom: 6px; }
.synth-card__positions { margin: 0 0 8px; padding-left: 18px; font-size: 12.5px; color: var(--fg-secondary); }
.synth-card__positions li { margin-bottom: 3px; }
.synth-card__adj { font-size: 12px; color: var(--fg-muted); line-height: 1.7; }

/* ── Triage suggestions ── */
.suggest {
  padding: 15px 17px; margin-bottom: 20px;
  background: rgba(245, 158, 11, 0.05);
  border: 1px solid rgba(245, 158, 11, 0.18);
  border-radius: var(--radius-md);
}
.suggest__head { font-size: 12px; color: var(--accent); font-family: var(--font-mono); margin-bottom: 11px; }
.suggest__list { display: flex; flex-direction: column; gap: 7px; }

.suggest__item {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 14px;
  padding: 9px 12px; text-align: left;
  background: transparent; border: 1px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer;
  transition: all 200ms;
}
.suggest__item:hover { border-color: var(--border-hover); background: rgba(255,255,255,0.04); }
.suggest__item.is-pivot { border-color: rgba(245, 158, 11, 0.35); }
.suggest__claim { font-size: 13px; }
.suggest__reasons { grid-column: 1; font-size: 11px; color: var(--fg-muted); }
.suggest__delta {
  grid-row: 1 / 3; align-self: center;
  font-family: var(--font-mono); font-size: 14px; color: var(--accent);
  font-variant-numeric: tabular-nums;
}

/* ── Segmented control ── */
.seg { display: inline-flex; padding: 3px; gap: 3px; background: rgba(255,255,255,0.04); border-radius: var(--radius-md); }
.seg__btn {
  padding: 5px 12px; background: transparent; border: none;
  border-radius: var(--radius-sm); color: var(--fg-muted);
  font-size: 12.5px; cursor: pointer; transition: all 200ms;
}
.seg__btn.is-active { background: rgba(255,255,255,0.1); color: var(--fg); }

/* ── Factor list ── */
.fgroup { margin-bottom: 22px; }
.fgroup__head {
  display: flex; justify-content: space-between; align-items: baseline;
  padding-bottom: 8px; margin-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.fgroup__title { font-size: 13px; font-weight: 500; color: var(--fg-secondary); }
.fgroup__count { font-size: 11px; color: var(--fg-muted); font-family: var(--font-mono); }
.fgroup__items { display: flex; flex-direction: column; gap: 7px; }

.factor {
  display: grid; grid-template-columns: auto auto 1fr auto; gap: 12px;
  align-items: start;
  padding: 12px 14px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border); border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 240ms var(--ease);
}
.factor:hover { border-color: var(--border-hover); background: rgba(255,255,255,0.045); }

.factor.is-excluded { opacity: 0.42; background: transparent; }
.factor.is-excluded .factor__claim { text-decoration: line-through; text-decoration-color: var(--fg-muted); }
.factor.is-lowconf:not(.is-excluded) { border-left: 2px solid rgba(250, 178, 25, 0.45); }

.factor__check {
  width: 17px; height: 17px; margin-top: 2px;
  border: 1.5px solid var(--border-hover); border-radius: 4px;
  position: relative; flex-shrink: 0;
  transition: all 200ms;
}
.factor:not(.is-excluded) .factor__check {
  background: var(--accent); border-color: var(--accent);
}
.factor:not(.is-excluded) .factor__check::after {
  content: ''; position: absolute;
  left: 5px; top: 1.5px; width: 4px; height: 9px;
  border: solid var(--accent-fg); border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.factor__side { width: 3px; border-radius: 2px; align-self: stretch; flex-shrink: 0; }

.factor__body { min-width: 0; }
.factor__claim { font-size: 13.5px; line-height: 1.6; margin-bottom: 6px; }
.factor__tags { display: flex; flex-wrap: wrap; gap: 6px; }

.ftag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 7px; border-radius: 4px;
  background: rgba(255,255,255,0.05);
  font-size: 10.5px; color: var(--fg-muted);
  font-family: var(--font-mono);
}
.ftag i { width: 6px; height: 6px; border-radius: 50%; }
/* Lane provenance tag — the dot carries the lane's categorical color, but the
   lane NAME is always beside it, since the lane trio sits in the CVD warn band. */
.ftag--lane { background: rgba(255,255,255,0.04); }
.ftag--warn { background: rgba(250, 178, 25, 0.13); color: #fcd34d; }
.ftag--pivot { background: var(--accent-muted); color: var(--accent); }
.ftag--flip { background: rgba(42, 120, 214, 0.16); color: #93c5fd; }

.factor__note-toggle {
  margin-top: 7px; padding: 0;
  background: none; border: none;
  color: var(--fg-muted); font-size: 11.5px; cursor: pointer;
}
.factor__note-toggle:hover { color: var(--accent); }

.factor__note {
  display: none; margin-top: 7px; padding: 9px 11px;
  background: rgba(0,0,0,0.25); border-radius: var(--radius-sm);
  font-size: 12px; color: var(--fg-muted); line-height: 1.7;
}
.factor.is-open .factor__note { display: block; }
.factor__sources { margin-top: 6px; display: flex; flex-direction: column; gap: 3px; }
.factor__sources a { color: var(--viz-home); font-size: 11px; text-decoration: none; }
.factor__sources a:hover { text-decoration: underline; }

.factor__metrics { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.factor__weight {
  font-family: var(--font-mono); font-size: 14px; color: var(--fg);
  font-variant-numeric: tabular-nums;
}
.factor__delta {
  font-family: var(--font-mono); font-size: 11px; color: var(--fg-muted);
  font-variant-numeric: tabular-nums;
}

/* ═══ Method ═══════════════════════════════════════════════════════════════ */
.method { position: relative; z-index: 1; padding: 80px 24px; border-top: 1px solid var(--border); }
.method__inner { max-width: 78rem; margin: 0 auto; }
.method__title { font-size: 26px; margin-bottom: 40px; text-align: center; }

.method__steps {
  display: grid; gap: 26px; list-style: none; padding: 0; margin: 0;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.method__steps li { display: flex; flex-direction: column; gap: 8px; }
.method__num {
  font-family: var(--font-mono); font-size: 12px; color: var(--accent);
  letter-spacing: 0.08em;
}
.method__steps h3 { font-size: 15px; font-weight: 600; }
.method__steps p { font-size: 13px; color: var(--fg-muted); line-height: 1.75; }

/* ═══ Footer ═══════════════════════════════════════════════════════════════ */
.footer {
  position: relative; z-index: 1;
  padding: 40px 24px 56px; text-align: center;
  border-top: 1px solid var(--border);
}
.footer p { font-size: 13px; color: var(--fg-muted); }
.footer__disclaimer { margin-top: 8px; font-size: 11.5px; opacity: 0.7; }

/* ═══ Reduced motion ═══════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .match-card:hover { transform: none; }
}

/* ═══ Responsive ═══════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  .shell { padding: 16px 16px 60px; }
  .valve__head { padding: 32px 0 28px; }
  .match-grid { grid-template-columns: 1fr; }
  .balance__actions { width: 100%; }
  .factor { grid-template-columns: auto auto 1fr; }
  .factor__metrics { grid-column: 3; flex-direction: row; gap: 10px; }
  .stat__value { font-size: 26px; }
  .stat--hero .stat__value { font-size: 32px; }
}
