:root {
  font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
  color: #1c2c29;
  background: #f5f5f1;
  font-synthesis: none;
  --cand-a: #c04338;
  --cand-a-soft: #f9ebe9;
  --cand-b: #2d7a5b;
  --cand-b-soft: #e7f3ed;
  --other: #5e7e8f;
  --bn: #c89d54;
  --abs: #8e9b95;
}

* { box-sizing: border-box; }
body { margin: 0; }
button, select, input { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
a { color: #245568; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid #d19047; outline-offset: 2px; }

.skip { position: absolute; left: -999px; top: 8px; background: #fff; padding: 10px; z-index: 30; }
.skip:focus { left: 8px; }
.wrap { width: min(1220px, calc(100% - 40px)); margin: auto; }

/* Header & Tabs */
.top {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(16px);
  background: #f5f5f1eb;
  border-bottom: 1px solid #dcded8;
  box-shadow: 0 3px 18px #18282208;
}
.top-inner {
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #1c2c29;
  font-family: Manrope, system-ui, sans-serif;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.05em;
}
.brand-mark { font-size: 20px; color: var(--cand-a); letter-spacing: -0.25em; padding-right: 8px; }
.brand-light { font-weight: 500; color: #546660; }
.header-actions { display: flex; align-items: center; gap: 14px; }
.top-tag, .eyebrow, .pill {
  font: 800 10px Manrope, system-ui, sans-serif;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.top-tag { color: #64706b; }
.eyebrow { color: #7b664b; margin: 0 0 6px; display: block; }
h1, h2, h3, h4, p { margin-top: 0; }
h1, h2, h3, h4 { font-family: Manrope, system-ui, sans-serif; }

.theme-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #cbd6cf;
  border-radius: 8px;
  background: #fff;
  color: #264a42;
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.theme-toggle:hover { background: #eaf2ed; }

.tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: thin;
  padding: 0 0 10px;
}
.tab {
  display: flex;
  align-items: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #5c6b65;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 700;
  padding: 9px 14px;
  transition: background 0.18s, color 0.18s;
}
.tab:hover { background: #e6ece8; color: #1c3d36; }
.tab.active { background: #1d3c36; color: #fff; box-shadow: 0 3px 10px #1d3c3626; }
.tab-panel { min-height: 60vh; padding-bottom: 30px; }

/* Banners & Dashboard Topbar */
.demo-banner {
  margin-top: 14px;
  padding: 12px 16px;
  background: #f5dea8;
  border: 1px solid #b88c3e;
  border-radius: 8px;
  font-size: 12px;
  letter-spacing: 0.08em;
  font-weight: 800;
  text-align: center;
  color: #4a3410;
}
.dash-topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 18px;
  padding: 24px 0 14px;
  flex-wrap: wrap;
}
.dash-topbar h1 {
  font-size: clamp(24px, 3vw, 34px);
  letter-spacing: -0.045em;
  line-height: 1.15;
  margin: 0;
  font-weight: 800;
}
.dash-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.filter {
  font-size: 12px;
  color: #55635d;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.filter select {
  background: #fff;
  border: 1px solid #cdd4ce;
  border-radius: 8px;
  color: #1e332f;
  padding: 8px 12px;
  font-weight: 700;
  font-size: 13px;
}
.dash-status-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1px solid #d5dcd6;
  border-radius: 10px;
  padding: 6px 12px;
}
.dash-status-pill strong { display: block; font-size: 12px; line-height: 1.2; }
.next-poll { display: block; font-size: 10px; color: #6c7a73; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: #c48a44; flex: none; }
.status-dot.ok { background: #2d8a61; }
.status-dot.alert { background: #c04338; }
.status-dot.demo { background: #b5843c; }
.icon-refresh {
  border: 1px solid #cbd7d0;
  background: #f2f6f3;
  color: #214a40;
  border-radius: 7px;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 700;
}
.icon-refresh:hover { background: #e3ede7; }
.icon-refresh:disabled { opacity: 0.5; }

.active-filter-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: #dcebe3;
  border: 1px solid #9ec2b0;
  border-radius: 8px;
  padding: 10px 16px;
  margin-bottom: 12px;
  font-size: 13px;
  color: #193d33;
}
.btn-sm { padding: 6px 12px !important; font-size: 12px !important; }

.dash-subbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 9px 14px;
  background: #e8eeea;
  border-left: 3px solid #2d7a5b;
  border-radius: 6px;
  margin-bottom: 16px;
  font-size: 12px;
  color: #2f4740;
}
.dash-timestamp { font-weight: 700; color: #495e56; }
.notice {
  padding: 12px 16px;
  margin-bottom: 18px;
  background: #e8eeea;
  border-left: 3px solid #2d7a5b;
  border-radius: 6px;
  color: #2f4740;
  font-size: 13px;
}

/* Sections & Headings */
.results, .progress-section, .uf-section, .methodology {
  padding: 20px 0 26px;
  border-top: 1px solid #d9ddd7;
}
.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 14px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
h2 { font-size: clamp(20px, 2.2vw, 25px); letter-spacing: -0.04em; margin: 0; }
.pill {
  border: 1px solid #c5d9d0;
  background: #e6f1ec;
  border-radius: 30px;
  color: #285e4b;
  padding: 6px 11px;
  white-space: nowrap;
}
.pill-outline { background: transparent; border-color: #d4cec2; color: #7e6b4b; }
.source-badge { font: 700 12px Manrope, system-ui, sans-serif; color: #566860; }

/* Color utilities (A = Lula = Red, B = Flávio = Green) */
.txt-a { color: var(--cand-a) !important; }
.txt-b { color: var(--cand-b) !important; }
.tug-dot.a, .dot-a, .dest-0, .pool-a, .rk-a, .gm-a, .band-a, .point-a { background: var(--cand-a); }
.tug-dot.b, .dot-b, .dest-1, .pool-b, .rk-b, .gm-b, .band-b, .point-b { background: var(--cand-b); }
.dot-other, .pool-other, .rk-other { background: var(--other); }
.dot-bn, .pool-bn, .dest-3, .gm-bn, .seg-blank { background: var(--bn); }
.dot-abs, .pool-abs, .dest-2, .gm-abs, .seg-abs { background: var(--abs); }

/* 01 / Cabo de Guerra & Candidate Cards */
.tug-card {
  background: #fff;
  border: 1px solid #dce1da;
  border-radius: 12px;
  padding: 18px 22px;
  margin-bottom: 16px;
  box-shadow: 0 3px 12px #1c2c2908;
}
.tug-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.tug-side {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: Manrope, system-ui, sans-serif;
}
.tug-side strong { font-size: 15px; letter-spacing: -0.02em; }
.tug-pct { font-size: 22px; font-weight: 800; letter-spacing: -0.04em; color: var(--cand-a); }
.tug-side-b .tug-pct { color: var(--cand-b); }
.tug-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.tug-center-tag {
  font: 800 10px Manrope, system-ui, sans-serif;
  letter-spacing: 0.1em;
  color: #5b6b63;
  background: #eef2ef;
  padding: 4px 10px;
  border-radius: 20px;
}
.tug-bar-outer {
  position: relative;
  height: 22px;
  border-radius: 11px;
  background: #e6ebe7;
  overflow: hidden;
  display: flex;
}
.tug-bar-fill-a { background: linear-gradient(90deg, #a63329, #d45246); height: 100%; transition: width 0.35s; }
.tug-bar-fill-other { background: var(--other); height: 100%; transition: width 0.35s; opacity: 0.72; }
.tug-bar-fill-b { background: linear-gradient(90deg, #3ca178, #24664b); height: 100%; transition: width 0.35s; }
.tug-midline {
  position: absolute;
  left: 50%;
  top: -2px;
  bottom: -2px;
  width: 3px;
  background: #182623;
  transform: translateX(-50%);
  z-index: 2;
  box-shadow: 0 0 0 2px #fff;
}
.tug-sub { text-align: center; font-size: 12px; color: #56665f; margin-top: 10px; line-height: 1.4; }

.candidate-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.candidate {
  background: #fff;
  border: 1px solid #dce1da;
  border-top: 4px solid var(--cand-a);
  border-radius: 12px;
  padding: 20px 22px;
  box-shadow: 0 3px 12px #1c2c2906;
}
.candidate-1 { border-top-color: var(--cand-b); }
.candidate-head {
  display: flex;
  align-items: center;
  gap: 14px;
}
.candidate-avatar, .group-avatar {
  display: grid;
  place-items: center;
  flex: none;
  overflow: hidden;
  border-radius: 50%;
  background: var(--cand-a-soft);
  color: var(--cand-a);
}
.candidate-1 .candidate-avatar {
  background: var(--cand-b-soft);
  color: var(--cand-b);
}
.candidate-avatar { width: 64px; height: 64px; }
.candidate-avatar img, .group-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-placeholder { font: 800 24px Manrope, system-ui, sans-serif; }
.cand-title-wrap { flex: 1; min-width: 0; }
.cand-title-wrap span {
  display: block;
  font: 700 10px Manrope, system-ui, sans-serif;
  letter-spacing: 0.08em;
  color: #67756e;
  text-transform: uppercase;
}
.candidate h3 {
  font-size: clamp(17px, 1.8vw, 21px);
  margin: 4px 0 0;
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
}
.cand-pct-block { text-align: right; flex: none; }
.cand-big-pct {
  display: block;
  font: 800 clamp(24px, 2.6vw, 32px)/1.05 Manrope, system-ui, sans-serif;
  letter-spacing: -0.05em;
  color: var(--cand-a);
}
.candidate-1 .cand-big-pct { color: var(--cand-b); }
.cand-pct-block small {
  display: block;
  font-size: 11px;
  color: #66756d;
  margin-top: 3px;
}
.cand-bars-compare { margin-top: 16px; display: grid; gap: 9px; }
.cand-bar-row {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: #5a6a62;
}
.cand-bar-row b {
  font: 700 12px Manrope, system-ui, sans-serif;
  color: #1f332f;
  white-space: nowrap;
}
.candidate-bar {
  height: 8px;
  background: #eaeee9;
  border-radius: 10px;
  overflow: hidden;
}
.candidate-bar span {
  display: block;
  height: 100%;
  background: var(--cand-a);
  border-radius: 10px;
}
.candidate-1 .candidate-bar span { background: var(--cand-b); }
.past-row { opacity: 0.82; }
.past-bar span { opacity: 0.55; }

/* 02 / KPI Urnas & Composição (Zero Overlaps) */
.kpi-visual-grid {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  gap: 16px;
}
.kpi-gauge-card, .kpi-composition-card {
  background: #fff;
  border: 1px solid #dce1da;
  border-radius: 12px;
  padding: 20px 22px;
  box-shadow: 0 3px 12px #1c2c2906;
}
.kpi-gauge-card {
  display: flex;
  align-items: center;
  gap: 20px;
}
.gauge-wrap {
  position: relative;
  width: 132px;
  height: 132px;
  flex: none;
}
.donut-svg { width: 100%; height: 100%; display: block; }
.donut-track { color: #e5ebe6; }
.gauge-center {
  position: absolute;
  inset: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
}
.gauge-center .progress-number {
  font: 800 22px/1.05 Manrope, system-ui, sans-serif;
  letter-spacing: -0.04em;
  color: #1c3530;
}
.gauge-center .progress-number span { font-size: 0.7em; color: #5f7a72; margin-left: 1px; }
.gauge-center small {
  font-size: 10px;
  color: #6b7a72;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 3px;
}
.gauge-info { flex: 1; min-width: 0; }
.progress-track {
  height: 10px;
  background: #e6ebe7;
  border-radius: 20px;
  overflow: hidden;
  margin: 0 0 10px;
}
.progress-track div {
  height: 100%;
  width: 0;
  background: #2d7a5b;
  border-radius: 20px;
  transition: width 0.4s;
}
.gauge-info p { font-size: 13px; color: #54645d; margin: 0 0 6px; line-height: 1.45; }
.source-line { font-size: 11px; color: #6c7a73; margin: 6px 0 0; }

.kpi-composition-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
}
.comp-bar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
  font-weight: 700;
  color: #2f4640;
  margin-bottom: 8px;
}
.comp-bar-header small { color: #66756e; font-weight: 600; }
.comp-stacked {
  height: 14px;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  background: #e6ebe7;
}
.comp-stacked.empty-stack span {
  background: repeating-linear-gradient(45deg, #e2e9e4, #e2e9e4 8px, #eef3ef 8px, #eef3ef 16px);
}
.seg-valid { background: #2c6c5b; }
.seg-null { background: #b5654d; }

.comp-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.comp-item {
  background: #f7f9f7;
  border: 1px solid #e1e7e2;
  border-radius: 9px;
  padding: 11px 12px;
  min-width: 0;
}
.comp-item span {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #5e6e66;
  margin-bottom: 6px;
  white-space: nowrap;
}
.comp-item i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.comp-valid i { background: #2c6c5b; }
.comp-blank i { background: var(--bn); }
.comp-null i { background: #b5654d; }
.comp-abs i { background: var(--abs); }
.comp-item strong {
  display: block;
  font: 800 clamp(14px, 1.5vw, 17px)/1.15 Manrope, system-ui, sans-serif;
  letter-spacing: -0.03em;
  color: #1c302c;
  overflow-wrap: anywhere;
}
.kpi-sub-1t {
  display: block;
  font: 600 10px 'DM Sans', system-ui, sans-serif;
  color: #6a7a72;
  margin-top: 3px;
}

/* Baseline 1º Turno + Ranking Completo + Termômetro de Virada */
.baseline-box {
  margin-top: 16px;
  background: #fff;
  border: 1px solid #d8e0d9;
  border-radius: 12px;
  padding: 20px 22px;
  box-shadow: 0 3px 12px #1c2c2906;
}
.baseline-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.baseline-header h3 { font-size: 18px; letter-spacing: -0.03em; margin: 0; }
.baseline-cta { display: flex; gap: 8px; flex-wrap: wrap; }
.pool-bar {
  height: 18px;
  border-radius: 9px;
  overflow: hidden;
  display: flex;
  background: #dfe5e0;
  margin-bottom: 10px;
}
.pool-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  font-size: 12px;
  color: #485b52;
  margin-bottom: 18px;
}
.pool-legend span { display: inline-flex; align-items: center; gap: 6px; }
.pool-legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; flex: none; }

.baseline-split-grid {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 16px;
  padding-top: 16px;
  border-top: 1px solid #e4eae5;
}
.rk-card, .breakeven-card {
  background: #f8faf8;
  border: 1px solid #e1e8e2;
  border-radius: 10px;
  padding: 15px 16px;
}
.rk-list { display: grid; gap: 9px; margin-top: 10px; }
.rk-row {
  display: grid;
  grid-template-columns: minmax(120px, 1.1fr) 1.4fr auto;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}
.rk-name { min-width: 0; }
.rk-name strong { display: block; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rk-name small { display: block; font-size: 10px; color: #6c7b73; }
.rk-track { height: 8px; background: #e4ebe6; border-radius: 8px; overflow: hidden; }
.rk-track span { display: block; height: 100%; border-radius: 8px; }
.rk-val { text-align: right; white-space: nowrap; }
.rk-val b { font: 800 12px Manrope, system-ui, sans-serif; color: #1e332f; }
.rk-val small { display: block; font-size: 10px; color: #6b7a72; }

.breakeven-card h4 { font-size: 15px; margin: 6px 0 12px; color: #1f3631; }
.be-metrics { display: grid; gap: 10px; }
.be-box {
  background: #fff;
  border: 1px solid #dfe6e0;
  border-radius: 8px;
  padding: 11px 13px;
}
.be-box span { display: block; font-size: 11px; color: #64746b; }
.be-box strong { display: block; font: 800 17px Manrope, system-ui, sans-serif; color: #1e3530; margin: 4px 0; }
.be-box small { display: block; font-size: 11px; line-height: 1.45; color: #53645b; }

/* 03 & 04 / Two Columns: Projection & Time Series */
.dash-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  align-items: stretch;
  padding: 20px 0;
  border-top: 1px solid #d9ddd7;
}
.projection, .chart-section {
  background: #fff;
  border: 1px solid #dce1da;
  border-radius: 12px;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
}
.outlook {
  background: #eef4f0;
  border: 1px solid #d2e0d7;
  border-radius: 9px;
  padding: 12px 15px;
  margin-bottom: 14px;
  color: #2c4a40;
}
.outlook > span {
  display: block;
  font: 800 10px Manrope, system-ui, sans-serif;
  letter-spacing: 0.12em;
  color: #567366;
  margin-bottom: 4px;
}
.outlook strong { font: 800 16px Manrope, system-ui, sans-serif; }
.projection-empty { flex: 1; }
.gate-grid { display: grid; gap: 11px; }
.gate-top { display: flex; justify-content: space-between; font-size: 12px; color: #4c6057; margin-bottom: 4px; }
.gate-track { height: 8px; background: #e5ebe7; border-radius: 10px; overflow: hidden; }
.gate-track span { display: block; height: 100%; background: #2d7a5b; border-radius: 10px; }
.model-note { font-size: 12px; color: #5b6b63; line-height: 1.5; margin: 12px 0 0; }

.prob-meter { margin-bottom: 16px; }
.prob-meter-labels { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 6px; font-weight: 700; }
.prob-meter-bar { height: 15px; border-radius: 10px; overflow: hidden; display: flex; background: #e4eae5; }
.prob-meter-bar span:first-child { background: var(--cand-a); }
.prob-meter-bar span:last-child { background: var(--cand-b); }
.range-plot { border-top: 1px solid #e2e8e3; padding-top: 12px; display: grid; gap: 11px; }
.range-title { display: flex; justify-content: space-between; font-size: 11px; color: #68776f; }
.range-row { display: grid; gap: 5px; }
.range-label { display: flex; justify-content: space-between; font-size: 12px; }
.range-track { position: relative; height: 12px; background: #eaf0ec; border-radius: 8px; }
.range-mid { position: absolute; left: 50%; top: -2px; bottom: -2px; border-left: 2px dashed #55685f; }
.range-band { position: absolute; top: 2px; bottom: 2px; border-radius: 6px; opacity: 0.45; }
.range-point { position: absolute; top: 0; width: 12px; height: 12px; border-radius: 50%; transform: translateX(-50%); border: 2px solid #fff; }
.method-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 10px; margin-top: 10px; border-top: 1px solid #e2e7e2; font-size: 12px; }
.method-row span { display: block; font-size: 11px; color: #6c7a72; }
.method-row p { margin: 0; font-weight: 700; }

.chart-card { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.chart-card svg { display: block; width: 100%; height: auto; }
.legend { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 8px; font-size: 12px; font-weight: 700; }
.key { display: inline-block; width: 18px; border-top: 3px solid; margin: 0 6px 3px 0; }
.key-a { border-color: var(--cand-a); }
.key-b { border-color: var(--cand-b); border-style: dashed; }
.chart-summary { font-size: 11px; color: #68766f; margin: 6px 0 0; }
.chart-placeholder { min-height: 190px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: #6b7a72; font-size: 12px; text-align: center; }
.placeholder-svg { width: 100%; max-width: 320px; height: auto; }

/* 05 / Geografia do Voto: Mapa Hex/Grid + Macrorregiões + Filtros + UFs */
.geo-overview-grid {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 16px;
  margin-bottom: 18px;
}
.geo-card {
  background: #fff;
  border: 1px solid #dce1da;
  border-radius: 12px;
  padding: 18px 20px;
  box-shadow: 0 3px 12px #1c2c2906;
}
.geo-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.geo-card-head strong { font-size: 15px; font-family: Manrope, system-ui, sans-serif; }
.geo-card-head small { font-size: 11px; color: #6b7972; }

.br-grid-map {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  grid-auto-rows: 42px;
  gap: 5px;
  max-width: 440px;
  margin: 0 auto;
}
.map-tile {
  border: 1px solid #00000018;
  border-radius: 7px;
  padding: 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #162421;
  transition: transform 0.15s, opacity 0.15s;
}
.map-tile:hover { transform: scale(1.07); z-index: 2; }
.map-tile strong { font: 800 11px/1 Manrope, system-ui, sans-serif; }
.map-tile small { font-size: 9px; line-height: 1; margin-top: 2px; font-weight: 700; }
.map-tile-selected { outline: 3px solid #162925; outline-offset: 1px; z-index: 3; }
.map-tile-dim { opacity: 0.28; }
.map-legend {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin-top: 12px;
  font-size: 11px;
  color: #55665e;
  font-weight: 700;
}
.map-legend span { display: inline-flex; align-items: center; gap: 6px; }
.map-legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }

.macro-list { display: grid; gap: 9px; }
.macro-row {
  width: 100%;
  text-align: left;
  background: #f8faf8;
  border: 1px solid #dfe6e0;
  border-radius: 9px;
  padding: 10px 13px;
  transition: border-color 0.15s, background 0.15s;
}
.macro-row:hover { border-color: #9ab5a8; background: #f1f6f3; }
.macro-row-active { border: 2px solid #1d3c36; background: #ebf3ee; }
.macro-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
  margin-bottom: 6px;
}
.macro-head small { color: #67766f; font-size: 11px; }
.macro-saldo { font: 800 11px Manrope, system-ui, sans-serif; padding: 2px 7px; border-radius: 12px; }
.saldo-a { background: var(--cand-a-soft); color: var(--cand-a); }
.saldo-b { background: var(--cand-b-soft); color: var(--cand-b); }
.macro-bar { height: 8px; border-radius: 6px; overflow: hidden; display: flex; background: #e3e9e4; margin-bottom: 5px; }
.macro-sub { display: flex; justify-content: space-between; font-size: 10px; color: #5d6d65; }

.uf-filter-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: #fff;
  border: 1px solid #dce1da;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
}
.region-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.region-pill {
  border: 1px solid #cdd6d0;
  background: #f6f8f6;
  color: #465951;
  border-radius: 20px;
  padding: 6px 11px;
  font-size: 11px;
  font-weight: 700;
}
.region-pill:hover { background: #e8f0ec; }
.region-pill.active { background: #1d3c36; border-color: #1d3c36; color: #fff; }
.uf-search-sort { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.uf-search-input {
  border: 1px solid #cdd4ce;
  border-radius: 8px;
  padding: 7px 11px;
  font-size: 12px;
  min-width: 210px;
  background: #fff;
  color: #1c2c29;
}
.uf-filter-count { font-size: 12px; color: #5b6b63; margin: 0 0 12px; }

.uf-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.uf-card {
  text-align: left;
  background: #fff;
  border: 1px solid #dce1da;
  border-radius: 10px;
  padding: 14px 16px;
  transition: border-color 0.15s, transform 0.15s;
}
.uf-card:hover { border-color: #89a89a; transform: translateY(-1px); }
.uf-card-active { border: 2px solid #1d3c36; background: #f2f7f4; }
.uf-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 9px;
}
.uf-card-top strong { display: block; font: 800 14px Manrope, system-ui, sans-serif; color: #1c302c; }
.uf-card-top small { display: block; font-size: 11px; color: #6b7a72; margin-top: 2px; }
.uf-badge {
  font: 700 10px Manrope, system-ui, sans-serif;
  background: #edf1ee;
  color: #4f635a;
  border-radius: 20px;
  padding: 4px 8px;
  white-space: nowrap;
}
.uf-badge-live { background: #d8ede2; color: #1d5948; }
.uf-bar {
  height: 7px;
  display: flex;
  border-radius: 8px;
  overflow: hidden;
  background: #e7ece8;
  margin-bottom: 8px;
}
.uf-bar span:first-child { background: var(--cand-a); }
.uf-bar span:last-child { background: var(--cand-b); }
.live-bar { margin-top: 6px; height: 5px; }
.uf-meta {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  font-size: 11px;
  color: #5b6b63;
  flex-wrap: wrap;
}
.uf-live {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px solid #ebefec;
  font-size: 11px;
  color: #2b4a41;
}
.uf-waiting { color: #718078; }

/* Buttons */
.secondary-button, .primary-button {
  border-radius: 8px;
  font-weight: 700;
  font-size: 12px;
  padding: 10px 14px;
}
.secondary-button { background: #fff; border: 1px solid #c5d2ca; color: #264d43; }
.secondary-button:hover { background: #e8f0ec; }
.primary-button { border: 1px solid #1d3c36; background: #1d3c36; color: #fff; }
.primary-button:hover { background: #142c27; }
.primary-button:disabled { opacity: 0.55; cursor: wait; }

/* Simulador de Fluxo */
.preset-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.preset-chip {
  border: 1px solid #c6d4cc;
  background: #fff;
  color: #23493f;
  border-radius: 20px;
  padding: 6px 11px;
  font-size: 11px;
  font-weight: 700;
}
.preset-chip:hover { background: #e6f0ea; }
.simulator-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(300px, 0.9fr);
  gap: 22px;
  align-items: start;
}
.group-list { display: grid; gap: 10px; }
.group-card {
  background: #fff;
  border: 1px solid #dce1da;
  border-radius: 10px;
}
.group-card summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
}
.group-card summary::-webkit-details-marker { display: none; }
.group-identity { display: flex; align-items: center; gap: 11px; min-width: 0; }
.group-identity strong { display: block; font: 700 14px Manrope, system-ui, sans-serif; }
.group-identity small { display: block; font-size: 11px; color: #6c7a72; margin-top: 2px; }
.group-avatar { width: 38px; height: 38px; background: #e5ece8; color: #36524a; }
.group-summary-right { display: flex; align-items: center; gap: 10px; flex: none; }
.group-mini-bar { width: 100px; height: 8px; border-radius: 6px; overflow: hidden; display: flex; background: #e6ebe7; }
.group-chip { font-size: 10px; color: #54695f; background: #ecf2ee; border-radius: 20px; padding: 5px 9px; white-space: nowrap; }
.allocation-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 18px;
  padding: 14px 16px;
  border-top: 1px solid #ebefec;
}
.allocation-label > span {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: #4f6158;
}
.dest-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 4px; }
.allocation-label input { display: block; width: 100%; margin: 8px 0 4px; accent-color: #1d3c36; }

.aside-sticky {
  position: sticky;
  top: 125px;
  background: #fff;
  border: 1px solid #dce1da;
  border-radius: 12px;
  padding: 20px;
}
.scenario-result { background: #f4f7f5; border-radius: 10px; overflow: hidden; border: 1px solid #e0e7e2; }
.scenario-leader { padding: 14px 16px; border-bottom: 1px solid #dce4de; }
.scenario-leader > span { display: block; font: 800 10px Manrope, system-ui, sans-serif; letter-spacing: 0.1em; color: #5c7066; }
.scenario-leader strong { display: block; font: 800 19px Manrope, system-ui, sans-serif; margin-top: 4px; }
.sim-tug { position: relative; height: 11px; border-radius: 8px; overflow: hidden; display: flex; background: #dfe5e0; margin-top: 9px; }
.sim-tug span:first-child { background: var(--cand-a); }
.sim-tug span:last-child { background: var(--cand-b); }
.sim-mid { position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; background: #fff; }
.scenario-totals { display: grid; grid-template-columns: 1fr 1fr; }
.scenario-totals > div { padding: 13px 15px; border-right: 1px solid #dce4de; }
.scenario-totals > div:last-child { border-right: 0; }
.scenario-totals span, .scenario-totals small { display: block; font-size: 11px; color: #64736b; }
.scenario-totals strong { display: block; font: 800 24px Manrope, system-ui, sans-serif; margin: 4px 0 2px; }
.sim-breakdown { padding: 12px 15px; border-top: 1px solid #dce4de; display: grid; gap: 8px; }
.sim-bd-row { display: grid; grid-template-columns: 80px 1fr auto; align-items: center; gap: 8px; font-size: 11px; }
.sim-bd-track { height: 8px; background: #e2e8e3; border-radius: 6px; overflow: hidden; display: flex; }
.bd-base-a { background: #9e2f25; }
.bd-trans-a { background: #e07b72; }
.bd-base-b { background: #1f5c43; }
.bd-trans-b { background: #6bc29f; }
.scenario-loss { border-top: 1px solid #dce4de; padding: 10px 15px; display: flex; justify-content: space-between; font-size: 11px; color: #64736b; }
.scenario-note { font-size: 11px; color: #6b7a72; margin: 12px 0 0; line-height: 1.45; }
.aside-actions { display: grid; gap: 8px; margin-top: 14px; }
.aside-actions button { width: 100%; }
.share-status { display: block; font-size: 11px; color: #245e49; min-height: 14px; }

/* 21,4M Cenários (Possibilidades) */
.possibility-layout {
  display: grid;
  grid-template-columns: minmax(270px, 0.8fr) minmax(0, 1.2fr);
  gap: 18px;
  margin-bottom: 18px;
}
.possibility-controls, .explorer-result, .live-cases, .exact-panel, .interpretation, .method-note {
  background: #fff;
  border: 1px solid #dce1da;
  border-radius: 12px;
  padding: 20px 22px;
}
.possibility-controls label { display: block; font-size: 13px; font-weight: 700; margin-top: 12px; }
.possibility-controls select {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid #c3d1c8;
  border-radius: 8px;
  background: #f8faf8;
  font-weight: 700;
}
.step-example { background: #f2f6f3; border-radius: 8px; padding: 11px 13px; margin: 14px 0; font-size: 12px; }
.step-example p { margin: 4px 0 0; color: #5b6b63; }
.fixed-summary { border-top: 1px solid #e2e8e3; border-bottom: 1px solid #e2e8e3; padding: 12px 0; font-size: 12px; }
.fixed-summary > span, .combination-count > span { display: block; font: 800 10px Manrope, system-ui, sans-serif; letter-spacing: 0.1em; color: #68776f; margin-bottom: 6px; }
.fixed-summary > div { display: flex; justify-content: space-between; padding: 3px 0; }
.fixed-summary p { font-size: 11px; color: #5c6c64; margin: 8px 0 0; line-height: 1.45; }
.combination-count { padding: 12px 0; }
.combination-count strong { display: block; font: 800 22px Manrope, system-ui, sans-serif; color: #1c3530; overflow-wrap: anywhere; }
.combination-count small { display: block; font-size: 11px; color: #6b7a72; margin-top: 3px; }
.possibility-controls .primary-button { width: 100%; }

.explorer-score, .live-case-scores, .exact-score {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 14px 0;
}
.score-card-0 { background: var(--cand-a-soft); border-radius: 9px; padding: 13px 15px; border: 1px solid #ebd0cd; }
.score-card-1 { background: var(--cand-b-soft); border-radius: 9px; padding: 13px 15px; border: 1px solid #c7e2d6; }
.explorer-score span, .explorer-score small, .live-case-scores span, .live-case-scores small, .exact-score span, .exact-score small { display: block; font-size: 11px; color: #55645d; }
.explorer-score strong, .live-case-scores b, .exact-score b { display: block; font: 800 28px Manrope, system-ui, sans-serif; letter-spacing: -0.05em; margin: 4px 0; }
.score-card-0 strong, .score-card-0 b { color: var(--cand-a); }
.score-card-1 strong, .score-card-1 b { color: var(--cand-b); }

.win-bar { height: 11px; display: flex; border-radius: 20px; overflow: hidden; background: #e5eae6; margin-bottom: 16px; }
.win-bar span:first-child { background: var(--cand-a); }
.win-bar span:last-child { background: var(--cand-b); }

.margin-chart { border-top: 1px solid #e2e8e3; padding-top: 14px; }
.margin-chart-title { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 12px; }
.histogram {
  height: 155px;
  display: flex;
  align-items: flex-end;
  gap: 3px;
  position: relative;
  border-bottom: 1px solid #a9b8af;
  padding-bottom: 1px;
  margin-top: 12px;
}
.histogram-bar { flex: 1; min-width: 2px; border-radius: 3px 3px 0 0; position: relative; z-index: 1; }
.histogram-bar.bar-a { background: var(--cand-a); }
.histogram-bar.bar-b { background: var(--cand-b); }
.zero-line { position: absolute; z-index: 2; top: 0; bottom: 0; border-left: 2px dashed #1c2c29; pointer-events: none; }
.center-line { position: absolute; z-index: 2; top: 0; bottom: 0; border-left: 2px solid #6b7a72; pointer-events: none; opacity: 0.5; }
.chart-axis-clean {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 11px;
  color: #5b6b63;
  margin-top: 8px;
}
.axis-mid-badge { background: #eef2ef; padding: 2px 8px; border-radius: 10px; font-weight: 700; font-size: 10px; }
.bound-box { border-top: 1px solid #e2e8e3; padding-top: 12px; margin-top: 12px; }
.bound-box span { display: block; font: 800 10px Manrope, system-ui, sans-serif; letter-spacing: 0.08em; color: #6b7a72; }
.bound-box strong { display: block; font: 800 16px Manrope, system-ui, sans-serif; margin-top: 4px; }

.live-cases, .exact-panel { display: flex; flex-direction: column; justify-content: space-between; gap: 14px; }
.live-cases p, .exact-panel p { font-size: 12px; color: #56665f; line-height: 1.55; margin: 6px 0 0; }
.live-cases-result, .exact-result { background: #f8faf8; border: 1px solid #e0e7e2; border-radius: 10px; padding: 16px; }
.live-cases-result > span { display: block; font: 800 10px Manrope, system-ui, sans-serif; letter-spacing: 0.1em; color: #5d6e65; }
.live-cases-result > strong { display: block; font: 800 24px Manrope, system-ui, sans-serif; margin: 5px 0 8px; }
.live-case-bar { height: 9px; background: #dfe6e1; border-radius: 20px; overflow: hidden; margin-bottom: 10px; }
.live-case-bar > span { display: block; height: 100%; background: #2d7a5b; }
.exact-visual-head { display: flex; align-items: center; gap: 14px; }
.exact-donut { width: 64px; height: 64px; flex: none; }
.exact-visual-head strong { display: block; font: 800 24px Manrope, system-ui, sans-serif; }
.exact-visual-head span { display: block; font: 800 10px Manrope, system-ui, sans-serif; letter-spacing: 0.1em; color: #5d6e65; }
.exact-visual-head small { font-size: 11px; color: #67766f; }
.interpretation { margin-top: 16px; background: #eef2ee; }
.interpretation h3, .method-note h3 { font-size: 15px; margin: 0 0 6px; }
.interpretation p, .method-note p { font-size: 12px; color: #56665f; margin: 0; line-height: 1.6; }

/* Metodologia & Footer & Legal */
.method-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 18px; }
.method-grid article { background: #fff; border: 1px solid #dce1da; border-top: 3px solid #2d7a5b; border-radius: 10px; padding: 16px; }
.method-grid article > span { font: 800 11px Manrope, system-ui, sans-serif; color: #7b664b; }
.method-grid h3 { font-size: 15px; margin: 8px 0; }
.method-grid p { font-size: 12px; color: #5a6a62; line-height: 1.55; margin: 0; }

footer {
  border-top: 1px solid #d8ddd7;
  padding: 26px 0 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
footer strong { font: 800 14px Manrope, system-ui, sans-serif; }
footer p { font-size: 12px; color: #6c7a72; margin: 4px 0 0; }
footer > div:last-child { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
footer button { border: 0; background: none; color: #245568; padding: 0; text-decoration: underline; font-size: 12px; font-weight: 700; }
footer a { font-size: 12px; }

.legal-page { width: min(790px, calc(100% - 40px)); padding: 40px 0 70px; }
.legal-back { display: inline-block; font-size: 13px; font-weight: 700; margin-bottom: 28px; }
.legal-page h1 { font-size: clamp(32px, 5vw, 48px); line-height: 1.1; letter-spacing: -0.04em; margin: 6px 0 10px; }
.legal-updated { color: #68776f; font-size: 12px; margin-bottom: 28px; }
.legal-page section { padding: 20px 0; border-top: 1px solid #dae0d9; }
.legal-page section h2 { font-size: 19px; margin: 0 0 8px; }
.legal-page section p { font-size: 14px; line-height: 1.7; color: #485b52; margin: 0 0 12px; }
.legal-page section p:last-child { margin-bottom: 0; }
.legal-page code { font-size: 0.9em; background: #e8efea; padding: 2px 5px; border-radius: 4px; }
.legal-footer { padding-top: 20px; border-top: 1px solid #dae0d9; font-size: 12px; }

/* Share Button, Pre-Opening Banner, Magic Target, Batch Feed & Geo Turn Switch */
.share-live-btn {
  border: 1px solid #2d7a5b;
  background: #eaf4ef;
  color: #19533b;
  font: 800 12px Manrope, system-ui, sans-serif;
  padding: 9px 14px;
  border-radius: 9px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, transform 0.1s;
}
.share-live-btn:hover { background: #d6ebe1; }

.pre-opening-banner {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  align-items: center;
  background: linear-gradient(135deg, #fffdf7 0%, #f4efe2 100%);
  border: 1px solid #d9c89e;
  border-left: 5px solid #b88428;
  border-radius: 12px;
  padding: 18px 22px;
  margin-bottom: 18px;
  box-shadow: 0 4px 14px #1c2c290c;
}
.pre-opening-badge {
  display: inline-block;
  font: 800 10px Manrope, system-ui, sans-serif;
  letter-spacing: 0.08em;
  color: #7c5310;
  background: #f5e6c4;
  padding: 4px 10px;
  border-radius: 99px;
  margin-bottom: 6px;
}
.pre-opening-main h3 {
  margin: 0 0 6px;
  font: 700 20px/1.2 "Instrument Serif", Georgia, serif;
  color: #231c10;
}
.pre-opening-main p {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.5;
  color: #4f4636;
}
.pre-opening-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.pre-opening-clock {
  background: #221d14;
  color: #f9f3e6;
  border-radius: 10px;
  padding: 14px 18px;
  text-align: center;
  min-width: 195px;
}
.pre-opening-clock span {
  display: block;
  font: 800 9px Manrope, system-ui, sans-serif;
  letter-spacing: 0.1em;
  color: #d6c39b;
  margin-bottom: 4px;
}
.pre-opening-clock strong {
  display: block;
  font: 800 28px/1.1 Manrope, monospace;
  letter-spacing: -0.03em;
  color: #ffd479;
}
.pre-opening-clock small {
  display: block;
  margin-top: 4px;
  font: 600 11px Manrope, system-ui, sans-serif;
  color: #bfb297;
}

.magic-target-card {
  margin-top: 16px;
  background: #fff;
  border: 1px solid #dce1da;
  border-radius: 12px;
  padding: 16px 20px;
  box-shadow: 0 2px 8px #1c2c2906;
}
.magic-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.magic-head strong {
  font: 800 13px Manrope, system-ui, sans-serif;
  color: #1f2e2b;
}
.magic-head span {
  font: 700 11px Manrope, system-ui, sans-serif;
  color: #54635c;
  background: #eef2ef;
  padding: 3px 9px;
  border-radius: 99px;
}
.magic-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 10px;
}
.magic-box {
  background: #f8faf8;
  border: 1px solid #e3e8e4;
  border-radius: 9px;
  padding: 11px 14px;
}
.magic-box-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
  font-family: Manrope, system-ui, sans-serif;
}
.magic-box-top span { font-size: 12px; font-weight: 700; }
.magic-box-top strong { font-size: 18px; font-weight: 800; letter-spacing: -0.03em; }
.magic-box small {
  display: block;
  font-size: 11.5px;
  color: #54635c;
  line-height: 1.4;
}

.batch-feed {
  margin-top: 14px;
  border-top: 1px solid #e3e8e4;
  padding-top: 12px;
}
.batch-feed-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font: 800 11px Manrope, system-ui, sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #54635c;
}
.batch-list {
  display: grid;
  gap: 6px;
  max-height: 190px;
  overflow-y: auto;
}
.batch-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 7px 10px;
  border-radius: 7px;
  background: #f8faf8;
  border: 1px solid #e5eae6;
  font: 600 11.5px Manrope, system-ui, sans-serif;
}
.batch-time { color: #54635c; font-weight: 700; }
.batch-delta {
  background: #e9efec;
  color: #213530;
  padding: 2px 7px;
  border-radius: 5px;
  font-weight: 700;
}

.geo-turn-switch {
  display: inline-flex;
  background: #e9eeeb;
  padding: 3px;
  border-radius: 9px;
  gap: 3px;
  flex-wrap: wrap;
}
.geo-turn-btn {
  border: 0;
  background: transparent;
  color: #465750;
  font: 800 11.5px Manrope, system-ui, sans-serif;
  padding: 6px 11px;
  border-radius: 7px;
  cursor: pointer;
}
.geo-turn-btn.active {
  background: #fff;
  color: #162420;
  box-shadow: 0 1px 4px #00000014;
}

/* Responsive Breakpoints */
@media (max-width: 1020px) {
  .kpi-visual-grid, .baseline-split-grid, .dash-two-col, .geo-overview-grid, .simulator-layout, .possibility-layout, .pre-opening-banner {
    grid-template-columns: 1fr;
  }
  .uf-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .method-grid { grid-template-columns: repeat(2, 1fr); }
  .aside-sticky { position: static; }
}
@media (max-width: 680px) {
  .wrap { width: calc(100% - 28px); }
  .top-tag, .brand-light { display: none; }
  .candidate-grid, .uf-grid, .method-grid, .allocation-grid, .explorer-score, .live-case-scores, .exact-score, .magic-grid {
    grid-template-columns: 1fr;
  }
  .comp-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-gauge-card { flex-direction: column; text-align: center; }
  .rk-row { grid-template-columns: 1fr auto; }
  .rk-track { grid-column: 1 / -1; order: 3; }
  .group-mini-bar { display: none; }
}

/* Dark Theme */
html[data-theme="dark"] {
  color-scheme: dark;
  background: #101917;
  color: #ebf2ed;
  --cand-a: #e05a4f;
  --cand-a-soft: #38201e;
  --cand-b: #45b085;
  --cand-b-soft: #1b362b;
}
html[data-theme="dark"] .top { background: #14201deb; border-color: #2c423b; }
html[data-theme="dark"] .brand { color: #ebf2ed; }
html[data-theme="dark"] .brand-light, html[data-theme="dark"] .top-tag, html[data-theme="dark"] .next-poll, html[data-theme="dark"] .source-line, html[data-theme="dark"] .uf-filter-count, html[data-theme="dark"] footer p, html[data-theme="dark"] .magic-box small, html[data-theme="dark"] .batch-time { color: #9eb3a8; }
html[data-theme="dark"] .theme-toggle, html[data-theme="dark"] .filter select, html[data-theme="dark"] .uf-search-input, html[data-theme="dark"] .possibility-controls select, html[data-theme="dark"] .secondary-button, html[data-theme="dark"] .preset-chip, html[data-theme="dark"] .region-pill, html[data-theme="dark"] .share-live-btn {
  background: #1d2e29;
  border-color: #385249;
  color: #deece4;
}
html[data-theme="dark"] .region-pill.active, html[data-theme="dark"] .tab.active, html[data-theme="dark"] .primary-button, html[data-theme="dark"] .geo-turn-btn.active {
  background: #45b085;
  border-color: #45b085;
  color: #0e1f18;
}
html[data-theme="dark"] .geo-turn-switch { background: #1c2c27; }
html[data-theme="dark"] .geo-turn-btn { color: #a7bdb2; }
html[data-theme="dark"] .pre-opening-banner {
  background: linear-gradient(135deg, #241f15 0%, #1c1811 100%);
  border-color: #594723;
  border-left-color: #d89b32;
}
html[data-theme="dark"] .pre-opening-main h3 { color: #f7eedc; }
html[data-theme="dark"] .pre-opening-main p { color: #d1c4ab; }
html[data-theme="dark"] .pre-opening-badge { background: #3d2e14; color: #f6c870; }
html[data-theme="dark"] .tug-card, html[data-theme="dark"] .candidate, html[data-theme="dark"] .kpi-gauge-card, html[data-theme="dark"] .kpi-composition-card, html[data-theme="dark"] .baseline-box, html[data-theme="dark"] .projection, html[data-theme="dark"] .chart-section, html[data-theme="dark"] .geo-card, html[data-theme="dark"] .uf-filter-toolbar, html[data-theme="dark"] .uf-card, html[data-theme="dark"] .group-card, html[data-theme="dark"] .aside-sticky, html[data-theme="dark"] .possibility-controls, html[data-theme="dark"] .explorer-result, html[data-theme="dark"] .live-cases, html[data-theme="dark"] .exact-panel, html[data-theme="dark"] .interpretation, html[data-theme="dark"] .method-grid article, html[data-theme="dark"] .method-note, html[data-theme="dark"] .dash-status-pill, html[data-theme="dark"] .magic-target-card {
  background: #182622;
  border-color: #2f463e;
}
html[data-theme="dark"] .rk-card, html[data-theme="dark"] .breakeven-card, html[data-theme="dark"] .be-box, html[data-theme="dark"] .comp-item, html[data-theme="dark"] .macro-row, html[data-theme="dark"] .scenario-result, html[data-theme="dark"] .live-cases-result, html[data-theme="dark"] .exact-result, html[data-theme="dark"] .step-example, html[data-theme="dark"] .magic-box, html[data-theme="dark"] .batch-row {
  background: #1f302b;
  border-color: #355046;
}
html[data-theme="dark"] .batch-delta, html[data-theme="dark"] .magic-head span {
  background: #283e37;
  color: #d6ede1;
}
html[data-theme="dark"] .gauge-center .progress-number, html[data-theme="dark"] .comp-item strong, html[data-theme="dark"] .rk-val b, html[data-theme="dark"] .breakeven-card h4, html[data-theme="dark"] .be-box strong, html[data-theme="dark"] .uf-card-top strong, html[data-theme="dark"] .cand-bar-row b, html[data-theme="dark"] .combination-count strong, html[data-theme="dark"] .map-tile, html[data-theme="dark"] .magic-head strong {
  color: #eff6f1;
}
html[data-theme="dark"] .donut-track { color: #2b3f38; }
html[data-theme="dark"] .tug-bar-outer, html[data-theme="dark"] .candidate-bar, html[data-theme="dark"] .progress-track, html[data-theme="dark"] .comp-stacked, html[data-theme="dark"] .pool-bar, html[data-theme="dark"] .rk-track, html[data-theme="dark"] .gate-track, html[data-theme="dark"] .range-track, html[data-theme="dark"] .macro-bar, html[data-theme="dark"] .uf-bar {
  background: #293d36;
}
html[data-theme="dark"] .results, html[data-theme="dark"] .progress-section, html[data-theme="dark"] .uf-section, html[data-theme="dark"] .dash-two-col, html[data-theme="dark"] .baseline-split-grid, html[data-theme="dark"] footer {
  border-color: #2b4039;
}
html[data-theme="dark"] .dash-subbar, html[data-theme="dark"] .outlook, html[data-theme="dark"] .active-filter-bar {
  background: #1d332b;
  border-color: #3f6b59;
  color: #d6ede1;
}
html[data-theme="dark"] a, html[data-theme="dark"] footer button { color: #7ed6b2; }
