:root,
[data-theme="light"] {
  --bg-dark: #f1f5f9;
  --bg-nav: #ffffff;
  --bg-ribbon: #f8fafc;
  --bg-panel: #f1f5f9;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --bg-subcard: #f8fafc;
  --bg-subcard-hover: #eef2f6;
  --bg-input: #ffffff;
  --bg-overlay: rgba(255, 255, 255, 0.95);
  --bg-map-stage: #e2e8f0;
  --bg-header-banner: linear-gradient(135deg, #eff6ff 0%, #f8fafc 100%);
  --border-subtle: #dbe2ea;
  --border-bright: #cbd5e1;
  --text-main: #0f172a;
  --text-secondary: #334155;
  --text-muted: #475569;
  --text-dim: #64748b;
  --dem-blue: #2563eb;
  --gop-red: #dc2626;
  --pos-green: #059669;
  --neg-rose: #e11d48;
  --warn-amber: #d97706;
  --alert-red: #dc2626;
  --cyan-dc: #0284c7;
  --accent-blue: #0284c7;
  --bop-track: #cbd5e1;
  --bop-midline: #0f172a;
  --toggle-track: #cbd5e1;
  --toggle-knob: #ffffff;
  --card-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  --overlay-shadow: 0 8px 24px rgba(15, 23, 42, 0.14);
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

[data-theme="dark"] {
  --bg-dark: #060a12;
  --bg-nav: #080d18;
  --bg-ribbon: #0c1323;
  --bg-panel: #0c1220;
  --bg-card: #121b2e;
  --bg-card-hover: #18243d;
  --bg-subcard: #09101d;
  --bg-subcard-hover: #142038;
  --bg-input: #111a2e;
  --bg-overlay: rgba(11, 17, 30, 0.95);
  --bg-map-stage: #050811;
  --bg-header-banner: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  --border-subtle: #1e2d4a;
  --border-bright: #314a76;
  --text-main: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --dem-blue: #3b82f6;
  --gop-red: #ef4444;
  --pos-green: #34d399;
  --neg-rose: #fb7185;
  --warn-amber: #fbbf24;
  --alert-red: #f87171;
  --cyan-dc: #22d3ee;
  --accent-blue: #38bdf8;
  --bop-track: #1e293b;
  --bop-midline: #ffffff;
  --toggle-track: #1e293b;
  --toggle-knob: #94a3b8;
  --card-shadow: none;
  --overlay-shadow: 0 8px 24px rgba(0, 0, 0, 0.65);
}

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

body {
  background: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-sans);
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: background 0.18s ease, color 0.18s ease;
}

body.sources-page-body {
  height: auto;
  min-height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
}

/* TIER 1: TOP NAVIGATION BAR */
.top-nav {
  height: 52px;
  background: var(--bg-nav);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  gap: 14px;
  flex-shrink: 0;
  z-index: 25;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-badge {
  background: linear-gradient(135deg, #2563eb, #06b6d4);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 5px;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.brand-title {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
  white-space: nowrap;
}

.hidden {
  display: none !important;
}

/* INSTANT SEARCH BAR IN TOP NAV */
.nav-search-wrap {
  position: relative;
  width: 300px;
  flex-shrink: 1;
}

.geo-search-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-bright);
  border-radius: 7px;
  padding: 6px 11px;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 11.5px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.geo-search-input::placeholder {
  color: var(--text-dim);
}

.geo-search-input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.22);
}

.geo-search-results {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--accent-blue);
  border-radius: 8px;
  box-shadow: var(--overlay-shadow);
  max-height: 290px;
  overflow-y: auto;
  z-index: 60;
}

.search-item {
  padding: 8px 11px;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  transition: background 0.12s ease;
}

.search-item:last-child {
  border-bottom: none;
}

.search-item:hover {
  background: var(--bg-subcard-hover);
}

.si-main {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
}

.si-sub {
  font-size: 10.5px;
  color: var(--text-muted);
}

.si-badge {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(2, 132, 199, 0.14);
  color: var(--accent-blue);
  white-space: nowrap;
}

.layer-count-badge {
  background: rgba(2, 132, 199, 0.16);
  color: var(--accent-blue);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 99px;
}

.status-pill-off {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  background: rgba(148, 163, 184, 0.18);
  color: var(--text-muted);
  padding: 2px 7px;
  border-radius: 4px;
}

.status-pill-on {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  background: rgba(16, 185, 129, 0.18);
  color: var(--pos-green);
  padding: 2px 7px;
  border-radius: 4px;
}

.tele-clickable {
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.15s ease, background 0.15s ease;
}

.tele-clickable:hover {
  border-color: var(--accent-blue);
  background: var(--bg-card-hover);
  transform: translateY(-1px);
}

.click-hint-pill {
  font-family: var(--font-mono);
  font-size: 8.5px;
  color: var(--text-muted);
  background: rgba(148, 163, 184, 0.16);
  padding: 1px 5px;
  border-radius: 4px;
}

.legend-empty-hint {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
}

.nav-center-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-subcard);
  padding: 4px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
}

.nav-tab-link {
  text-decoration: none;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 13px;
  border-radius: 6px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.nav-tab-link:hover {
  color: var(--text-main);
  background: rgba(148, 163, 184, 0.12);
}

.nav-tab-link.active {
  background: #2563eb;
  color: #fff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.28);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.theme-toggle-btn {
  font-weight: 700;
}

/* TIER 2: TELEMETRY RIBBON */
.telemetry-ribbon {
  background: var(--bg-ribbon);
  border-bottom: 1px solid var(--border-subtle);
  display: grid;
  grid-template-columns: 1.3fr 0.95fr 1.15fr 1fr 0.95fr 0.9fr;
  gap: 8px;
  padding: 8px 14px;
  flex-shrink: 0;
  z-index: 20;
}

.tele-item {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 7px;
  padding: 6px 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-shadow: var(--card-shadow);
}

.tele-highlight {
  border-color: rgba(16, 185, 129, 0.45);
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.08), rgba(244, 63, 94, 0.08));
}

.tele-label {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 3px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.win-call-badge {
  background: rgba(37, 99, 235, 0.14);
  border: 1px solid rgba(37, 99, 235, 0.45);
  color: var(--dem-blue);
  font-family: var(--font-mono);
  font-size: 8.5px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 4px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

[data-theme="dark"] .win-call-badge {
  background: rgba(59, 130, 246, 0.25);
  border-color: rgba(96, 165, 250, 0.5);
  color: #93c5fd;
}

.tele-main {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-main);
}

.tele-sub {
  font-size: 10.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.kpi-bop {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dem-pill {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--dem-blue);
  white-space: nowrap;
}

.gop-pill {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--gop-red);
  white-space: nowrap;
}

.bop-bar-wrap {
  flex: 1;
  height: 8px;
  background: var(--bop-track);
  border-radius: 4px;
  display: flex;
  overflow: hidden;
  position: relative;
}

.bop-bar-dem {
  background: #2563eb;
  height: 100%;
  transition: width 0.4s ease;
}

.bop-bar-dem-lead {
  background: #93c5fd;
  height: 100%;
  transition: width 0.4s ease;
}

.bop-bar-gop-lead {
  background: #fca5a5;
  height: 100%;
  transition: width 0.4s ease;
}

.bop-bar-gop {
  background: #dc2626;
  height: 100%;
  transition: width 0.4s ease;
}

.bop-midline {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--bop-midline);
  z-index: 2;
}

.mono-val { font-family: var(--font-mono); }
.pos-text { color: var(--pos-green); }
.neg-text { color: var(--neg-rose); }
.warn-text { color: var(--warn-amber); }
.alert-text { color: var(--alert-red); }
.cyan-text { color: var(--cyan-dc); }
.sep { color: var(--text-dim); }

.btn-primary, .btn-secondary {
  border: none;
  border-radius: 6px;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  padding: 7px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-bright);
}

.btn-secondary:hover {
  background: var(--bg-subcard-hover);
}

.pulse-dot {
  width: 7px;
  height: 7px;
  background: #34d399;
  border-radius: 50%;
  box-shadow: 0 0 6px #34d399;
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(1.25); }
}

/* MAIN WORKSPACE GRID */
.workspace-grid {
  flex: 1;
  display: grid;
  grid-template-columns: 365px 1fr 400px;
  height: calc(100vh - 116px);
  overflow: hidden;
}

.panel {
  background: var(--bg-panel);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.left-panel {
  border-right: 1px solid var(--border-subtle);
  padding: 12px;
  gap: 12px;
}

.right-panel {
  border-left: 1px solid var(--border-subtle);
}

/* CONTROL SECTIONS */
.control-section {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 9px;
  padding: 12px;
  box-shadow: var(--card-shadow);
}

.highlight-section {
  border-color: rgba(245, 158, 11, 0.45);
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.06) 0%, var(--bg-card) 100%);
}

.section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.section-num {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  color: var(--accent-blue);
  background: rgba(2, 132, 199, 0.14);
  padding: 2px 6px;
  border-radius: 4px;
}

.section-header h2 {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  flex: 1;
}

.cherry-badge {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  background: rgba(245, 158, 11, 0.18);
  color: var(--warn-amber);
  padding: 2px 6px;
  border-radius: 4px;
}

.section-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 10px;
  line-height: 1.4;
}

/* STEP 1: COMPACT 2-COLUMN MODE BUTTON GRID */
.mode-group-label {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.full-span {
  grid-column: 1 / -1;
}

.mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.mode-btn {
  background: var(--bg-subcard);
  border: 1px solid var(--border-subtle);
  border-radius: 7px;
  padding: 8px 10px;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: all 0.15s ease;
  font-family: var(--font-sans);
}

.mode-btn:hover {
  background: var(--bg-subcard-hover);
  border-color: var(--border-bright);
}

.mode-btn.active {
  background: rgba(37, 99, 235, 0.14);
  border-color: #2563eb;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.35);
}

[data-theme="dark"] .mode-btn.active {
  background: rgba(37, 99, 235, 0.24);
  border-color: #3b82f6;
}

.mode-btn-obbba.active {
  background: rgba(16, 185, 129, 0.14);
  border-color: #059669;
  box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.35);
}

[data-theme="dark"] .mode-btn-obbba.active {
  background: rgba(16, 185, 129, 0.2);
  border-color: #10b981;
}

.mode-btn-fuel.active {
  background: rgba(245, 158, 11, 0.15);
  border-color: #d97706;
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.35);
}

[data-theme="dark"] .mode-btn-fuel.active {
  background: rgba(245, 158, 11, 0.22);
  border-color: #f59e0b;
}

.mode-btn-fuel.active .mode-status-badge {
  display: inline-block;
  background: rgba(245, 158, 11, 0.18);
  border: 1px solid rgba(217, 119, 6, 0.55);
  color: var(--warn-amber);
}

[data-theme="dark"] .mode-btn-fuel.active .mode-status-badge {
  background: rgba(245, 158, 11, 0.28);
  border-color: rgba(251, 191, 36, 0.65);
  color: #fde68a;
}

.mode-btn-blend {
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.10), rgba(16, 185, 129, 0.10));
  border-color: rgba(139, 92, 246, 0.45);
}

.mode-btn-blend.active {
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.22), rgba(16, 185, 129, 0.22));
  border-color: #9333ea;
  box-shadow: 0 0 0 1px rgba(147, 51, 234, 0.45);
}

.mode-btn-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  width: 100%;
}

.mode-status-badge {
  display: none;
  font-family: var(--font-mono);
  font-size: 8.5px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 4px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.mode-btn.active .mode-status-badge {
  display: inline-block;
  background: rgba(37, 99, 235, 0.18);
  border: 1px solid rgba(37, 99, 235, 0.5);
  color: var(--dem-blue);
}

[data-theme="dark"] .mode-btn.active .mode-status-badge {
  background: rgba(59, 130, 246, 0.28);
  border-color: rgba(96, 165, 250, 0.65);
  color: #93c5fd;
}

.mode-btn-obbba.active .mode-status-badge {
  display: inline-block;
  background: rgba(16, 185, 129, 0.18);
  border: 1px solid rgba(5, 150, 105, 0.5);
  color: var(--pos-green);
}

[data-theme="dark"] .mode-btn-obbba.active .mode-status-badge {
  background: rgba(16, 185, 129, 0.25);
  border-color: rgba(52, 211, 153, 0.65);
  color: #6ee7b7;
}

.mode-btn-blend.active .mode-status-badge {
  display: inline-block;
  background: rgba(147, 51, 234, 0.18);
  border: 1px solid rgba(147, 51, 234, 0.55);
  color: #7e22ce;
}

[data-theme="dark"] .mode-btn-blend.active .mode-status-badge {
  background: rgba(168, 85, 247, 0.28);
  border-color: rgba(192, 132, 252, 0.7);
  color: #e9d5ff;
}

.dual-blend-panel {
  margin-top: 10px;
  background: var(--bg-subcard);
  border: 1px solid rgba(139, 92, 246, 0.45);
  border-radius: 8px;
  padding: 9px;
}

.blend-mix-box {
  background: var(--bg-card);
  border: 1px solid rgba(139, 92, 246, 0.35);
  border-radius: 7px;
  padding: 8px;
  margin-bottom: 8px;
}

.blend-mix-header {
  font-size: 10.5px;
  font-weight: 700;
  color: #7e22ce;
  margin-bottom: 6px;
}

[data-theme="dark"] .blend-mix-header {
  color: #e9d5ff;
}

.blend-mix-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 7px;
}

.blend-mix-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
}

.blend-pill-group {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px;
}

.blend-pill {
  background: var(--bg-subcard);
  border: 1px solid var(--border-subtle);
  border-radius: 5px;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 10.5px;
  font-weight: 600;
  padding: 5px 7px;
  cursor: pointer;
  transition: all 0.14s ease;
  text-align: center;
}

.blend-pill:hover {
  border-color: var(--dem-blue);
  color: var(--text-main);
}

.blend-pill.active {
  background: rgba(37, 99, 235, 0.16);
  border-color: #2563eb;
  color: var(--dem-blue);
  font-weight: 700;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.3);
}

[data-theme="dark"] .blend-pill.active {
  background: rgba(37, 99, 235, 0.28);
  border-color: #3b82f6;
  color: #93c5fd;
}

.blend-pill.obbba-pill.active {
  background: rgba(16, 185, 129, 0.16);
  border-color: #059669;
  color: var(--pos-green);
  font-weight: 700;
  box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.3);
}

[data-theme="dark"] .blend-pill.obbba-pill.active {
  background: rgba(16, 185, 129, 0.24);
  border-color: #10b981;
  color: #6ee7b7;
}

.blend-pill.fuel-pill.active {
  background: rgba(245, 158, 11, 0.16);
  border-color: #d97706;
  color: var(--warn-amber);
  font-weight: 700;
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.32);
}

[data-theme="dark"] .blend-pill.fuel-pill.active {
  background: rgba(245, 158, 11, 0.26);
  border-color: #f59e0b;
  color: #fde68a;
}

.fuel-lens-panel {
  border-color: rgba(245, 158, 11, 0.5);
}

.fuel-lens-panel .lens-header {
  color: var(--warn-amber);
}

.fuel-tag {
  background: rgba(245, 158, 11, 0.16);
  color: var(--warn-amber);
}

.fuel-preset-btn.active {
  background: rgba(245, 158, 11, 0.15);
  border-color: var(--warn-amber);
}

.fuel-explainer-box {
  border-left-color: #f59e0b;
}

.blend-active-filter-bar {
  background: rgba(16, 185, 129, 0.08);
  border: 1px dashed rgba(16, 185, 129, 0.45);
  border-radius: 5px;
  padding: 5px 7px;
  font-size: 10px;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.blend-filter-hint {
  font-size: 9.5px;
  color: var(--pos-green);
  font-weight: 600;
}

.blend-sliders-wrap {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border-subtle);
}

.slider-row {
  margin-bottom: 7px;
}

.slider-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10.5px;
  color: var(--text-secondary);
  margin-bottom: 3px;
}

.slider-row input[type="range"] {
  width: 100%;
  height: 5px;
  accent-color: #9333ea;
  cursor: pointer;
}

.mode-btn-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
}

.mode-btn-sub {
  font-size: 10px;
  color: var(--text-muted);
}

/* OBBBA POLICY LENS PANEL */
.obbba-lens-panel {
  margin-top: 12px;
  background: var(--bg-subcard);
  border: 1px solid rgba(16, 185, 129, 0.45);
  border-radius: 8px;
  padding: 10px;
}

.lens-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--pos-green);
  margin-bottom: 4px;
}

.lens-tag {
  font-family: var(--font-mono);
  font-size: 9.5px;
  background: rgba(16, 185, 129, 0.16);
  color: var(--pos-green);
  padding: 2px 6px;
  border-radius: 4px;
}

.lens-hint {
  font-size: 10.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
  line-height: 1.35;
}

.preset-grid {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.preset-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 7px 9px;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-family: var(--font-sans);
  transition: all 0.15s ease;
}

.preset-btn:hover {
  background: var(--bg-subcard-hover);
  border-color: var(--border-bright);
}

.preset-btn.active {
  background: rgba(16, 185, 129, 0.14);
  border-color: var(--pos-green);
}

.preset-btn strong {
  font-size: 11.5px;
  color: var(--text-main);
}

.preset-btn span {
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.3;
}

.obbba-explainer-box {
  margin-top: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--accent-blue);
  border-radius: 5px;
  padding: 8px 9px;
  font-size: 10.5px;
  color: var(--text-secondary);
  line-height: 1.45;
}

.custom-obbba-details {
  margin-top: 8px;
  border-top: 1px solid var(--border-subtle);
  padding-top: 7px;
}

.custom-obbba-details summary {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-blue);
  cursor: pointer;
  user-select: none;
}

.details-body {
  margin-top: 8px;
}

/* SUB CONTROL BOX */
.sub-control-box {
  margin-top: 8px;
  padding: 8px 10px;
  background: var(--bg-subcard);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 7px;
}

.form-row:last-child { margin-bottom: 0; }

.form-row label {
  font-size: 10.5px;
  color: var(--text-muted);
  font-weight: 500;
}

.form-row select {
  background: var(--bg-input);
  color: var(--text-main);
  border: 1px solid var(--border-bright);
  border-radius: 5px;
  padding: 6px 8px;
  font-size: 11.5px;
  font-family: var(--font-sans);
  outline: none;
}

/* TOGGLE ROWS */
.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 4px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-subtle);
}

.toggle-row:last-of-type { border-bottom: none; }
.toggle-row input[type="checkbox"] { display: none; }

.toggle-switch {
  width: 32px;
  height: 18px;
  background: var(--toggle-track);
  border-radius: 99px;
  position: relative;
  transition: background 0.2s ease;
  flex-shrink: 0;
  border: 1px solid var(--border-bright);
}

.toggle-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  background: var(--toggle-knob);
  border-radius: 50%;
  transition: transform 0.2s ease, background 0.2s ease;
}

.toggle-row input:checked + .toggle-switch::after {
  transform: translateX(14px);
  background: #fff;
}

.toggle-row input:checked + .toggle-switch.amber { background: #d97706; border-color: #f59e0b; }
.toggle-row input:checked + .toggle-switch.gold { background: #ca8a04; border-color: #eab308; }
.toggle-row input:checked + .toggle-switch.neon { background: #0284c7; border-color: #38bdf8; }
.toggle-row input:checked + .toggle-switch.red { background: #dc2626; border-color: #ef4444; }
.toggle-row input:checked + .toggle-switch.orange { background: #ea580c; border-color: #f97316; }
.toggle-row input:checked + .toggle-switch.purple { background: #9333ea; border-color: #a855f7; }
.toggle-row input:checked + .toggle-switch.cyan { background: #0891b2; border-color: #06b6d4; }
.toggle-row input:checked + .toggle-switch.slate { background: #475569; border-color: #64748b; }

.toggle-text { display: flex; flex-direction: column; }
.toggle-text strong { font-size: 11.5px; color: var(--text-main); }
.toggle-text span { font-size: 10px; color: var(--text-muted); }

/* REDISTRICTING JUMP PILLS */
.redist-jump-bar {
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px dashed rgba(245, 158, 11, 0.45);
}

.jump-label {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--warn-amber);
  margin-bottom: 6px;
}

.jump-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.pill-btn {
  background: rgba(245, 158, 11, 0.14);
  border: 1px solid rgba(245, 158, 11, 0.45);
  color: var(--warn-amber);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.15s ease;
}

[data-theme="dark"] .pill-btn {
  color: #fde68a;
}

.pill-btn:hover, .pill-btn.active {
  background: #f59e0b;
  color: #000;
}

.redist-note {
  margin-top: 7px;
  font-size: 10.5px;
  color: var(--text-secondary);
  background: var(--bg-subcard);
  padding: 6px 8px;
  border-radius: 5px;
  border-left: 3px solid #f59e0b;
  line-height: 1.35;
}

/* MAP STAGE */
.map-stage {
  position: relative;
  width: 100%;
  height: 100%;
  background: var(--bg-map-stage);
}

#map {
  width: 100%;
  height: 100%;
}

/* FLOATING LEGEND */
.map-legend-overlay {
  position: absolute;
  bottom: 16px;
  left: 16px;
  right: 16px;
  background: var(--bg-overlay);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-bright);
  border-radius: 9px;
  padding: 10px 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  z-index: 10;
  box-shadow: var(--overlay-shadow);
}

.legend-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.legend-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-main);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.legend-scale {
  display: flex;
  align-items: center;
  gap: 8px;
}

.scale-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}

.legend-caption {
  font-size: 10px;
  color: var(--text-muted);
}

.gradient-bar {
  width: 210px;
  height: 11px;
  border-radius: 4px;
  border: 1px solid var(--border-bright);
}

.election-grad {
  background: linear-gradient(90deg, #1d4ed8 0%, #3b82f6 25%, #e2e8f0 50%, #ef4444 75%, #b91c1c 100%);
}

.obbba-diverging-grad {
  background: linear-gradient(90deg, #be123c 0%, #fb7185 28%, #f8fafc 50%, #34d399 74%, #047857 100%);
}

.obbba-loss-grad {
  background: linear-gradient(90deg, #881337 0%, #e11d48 35%, #fb7185 70%, #fde68a 100%);
}

.obbba-quantile-grad {
  background: linear-gradient(90deg, #e11d48 0%, #fb923c 25%, #fde047 50%, #34d399 75%, #059669 100%);
}

.fuel-grad {
  background: linear-gradient(90deg, #059669 0%, #34d399 24%, #fde047 50%, #fb923c 76%, #b91c1c 100%);
}

.fuel-diverging-grad {
  background: linear-gradient(90deg, #047857 0%, #34d399 26%, #f8fafc 50%, #fb7185 74%, #9f1239 100%);
}

.legend-divider {
  width: 1px;
  height: 38px;
  background: var(--border-subtle);
}

.marker-items {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.marker-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-secondary);
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
}

.dot-raid { background: #ef4444; box-shadow: 0 0 6px #ef4444; border: 1.5px solid #fff; }
.dot-aor { background: rgba(249, 115, 22, 0.35); border: 2px solid #f97316; width: 11px; height: 11px; }
.dot-dc-op { background: #06b6d4; border: 1px solid #0891b2; }
.dot-dc-prop { background: #eab308; border: 1px solid #ca8a04; }
.line-dash-amber {
  width: 16px;
  height: 0;
  border-top: 2.5px dashed #f59e0b;
  display: inline-block;
}

/* HOVER TOOLTIP */
.map-tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--bg-overlay);
  border: 1px solid var(--border-bright);
  border-radius: 7px;
  padding: 9px 11px;
  color: var(--text-main);
  font-size: 11.5px;
  max-width: 300px;
  box-shadow: var(--overlay-shadow);
  z-index: 30;
}

.map-tooltip.hidden { display: none; }

.tt-title {
  font-weight: 700;
  font-size: 12.5px;
  margin-bottom: 4px;
  color: var(--text-main);
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 3px;
}

.tt-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 3px;
  font-size: 11px;
}

.tt-label { color: var(--text-muted); }
.tt-val { font-family: var(--font-mono); font-weight: 600; color: var(--text-main); }

/* RIGHT PANEL: DOSSIER & TABS */
.dossier-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-nav);
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 700;
  padding: 12px 10px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s ease;
}

.tab-btn.active {
  color: var(--accent-blue);
  border-bottom-color: var(--accent-blue);
  background: rgba(2, 132, 199, 0.06);
}

.tab-pane {
  display: none;
  padding: 14px;
  flex: 1;
  overflow-y: auto;
}

.tab-pane.active { display: block; }

.dossier-placeholder {
  padding: 6px 2px;
  color: var(--text-muted);
}

.launchpad-header {
  text-align: center;
  margin-bottom: 12px;
}

.placeholder-icon { font-size: 28px; margin-bottom: 4px; }
.dossier-placeholder h3 { font-size: 14.5px; color: var(--text-main); margin-bottom: 5px; }
.dossier-placeholder p { font-size: 11.5px; line-height: 1.45; margin-bottom: 10px; }

.scenario-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.scenario-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 3px;
  box-shadow: var(--card-shadow);
}

.scenario-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-blue);
  transform: translateX(2px);
}

.sc-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
}

.sc-desc {
  font-size: 10.5px;
  color: var(--text-muted);
  line-height: 1.38;
}

.click-prompt-box {
  background: rgba(2, 132, 199, 0.08);
  border: 1px dashed rgba(2, 132, 199, 0.45);
  border-radius: 7px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.click-prompt-box strong {
  color: var(--accent-blue);
  font-size: 11.5px;
}

.btn-back-scenarios {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-bright);
  color: var(--accent-blue);
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 600;
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
  margin-bottom: 10px;
  transition: background 0.15s ease;
}

.btn-back-scenarios:hover {
  background: var(--bg-subcard-hover);
  color: var(--text-main);
}
.dossier-content.hidden { display: none; }

/* DOSSIER CARDS */
.dossier-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
  box-shadow: var(--card-shadow);
}

.dossier-header-banner {
  background: var(--bg-header-banner);
  border: 1px solid var(--border-bright);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
}

.dh-eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--accent-blue);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.dh-title { font-size: 16px; font-weight: 800; color: var(--text-main); margin-top: 2px; }
.dh-sub { font-size: 11.5px; color: var(--text-muted); margin-top: 3px; }

.card-tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.tag {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 4px;
}

.tag-dem { background: rgba(37, 99, 235, 0.15); color: var(--dem-blue); border: 1px solid rgba(37, 99, 235, 0.35); }
.tag-gop { background: rgba(220, 38, 38, 0.15); color: var(--gop-red); border: 1px solid rgba(220, 38, 38, 0.35); }
.tag-amber { background: rgba(217, 119, 6, 0.15); color: var(--warn-amber); border: 1px solid rgba(217, 119, 6, 0.35); }
.tag-cyan { background: rgba(2, 132, 199, 0.15); color: var(--cyan-dc); border: 1px solid rgba(2, 132, 199, 0.35); }

.dc-section-title {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* CANDIDATE TABLE */
.cand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 12px;
}

.cand-row:last-child { border-bottom: none; }

.cand-name {
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.party-dot { width: 8px; height: 8px; border-radius: 50%; }
.party-Dem { background: var(--dem-blue); }
.party-GOP { background: var(--gop-red); }
.party-Oth { background: #eab308; }
.cand-stats { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-secondary); }

/* METRIC GRID */
.metric-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 6px;
}

.metric-box {
  background: var(--bg-subcard);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 8px;
}

.m-label { font-size: 10px; color: var(--text-muted); }
.m-val { font-family: var(--font-mono); font-size: 13.5px; font-weight: 700; margin-top: 2px; color: var(--text-main); }

/* MINI LIST ITEMS */
.mini-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 210px;
  overflow-y: auto;
}

.mini-item {
  background: var(--bg-subcard);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 7px 9px;
  font-size: 11px;
}

.mini-item-head {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 2px;
}

.mini-item-sub {
  color: var(--text-muted);
  font-size: 10.5px;
  line-height: 1.35;
}

/* SOURCES PAGE STYLING (/sources.html) */
.sources-container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

.sources-hero {
  background: var(--bg-header-banner);
  border: 1px solid var(--border-bright);
  border-radius: 12px;
  padding: 24px 28px;
  margin-bottom: 24px;
}

.sources-hero h2 {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-main);
  margin: 6px 0 10px;
}

.sources-hero p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.sources-hero code {
  font-family: var(--font-mono);
  background: rgba(2, 132, 199, 0.14);
  color: var(--accent-blue);
  padding: 2px 6px;
  border-radius: 4px;
}

.sources-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.source-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--card-shadow);
}

.source-card-header h3 {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-main);
  margin-top: 6px;
}

.source-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  display: inline-block;
}

.badge-election { background: rgba(37, 99, 235, 0.15); color: var(--dem-blue); }
.badge-obbba { background: rgba(16, 185, 129, 0.15); color: var(--pos-green); }
.badge-redist { background: rgba(217, 119, 6, 0.15); color: var(--warn-amber); }
.badge-ice { background: rgba(220, 38, 38, 0.15); color: var(--gop-red); }
.badge-dc { background: rgba(2, 132, 199, 0.15); color: var(--cyan-dc); }
.badge-pres { background: rgba(147, 51, 234, 0.15); color: #9333ea; }

.source-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.55;
}

.source-note-box {
  background: var(--bg-subcard);
  border-left: 3px solid #10b981;
  border-radius: 6px;
  padding: 12px 14px;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.source-meta-table {
  margin-top: auto;
  background: var(--bg-subcard);
  border: 1px solid var(--border-subtle);
  border-radius: 7px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sm-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: 11.5px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 5px;
}

.sm-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.sm-row span {
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
}

.sm-row a {
  color: var(--accent-blue);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sm-row a:hover {
  text-decoration: underline;
}

.sm-row code {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--warn-amber);
}
