/* =====================================================
   FREEMAN ELECTION TERMINAL — BLOOMBERG DARK THEME
   Stock market terminal aesthetic
   ===================================================== */

@import url('https://api.fontshare.com/v2/css?f[]=general-sans@400,500,600,700&f[]=satoshi@400,500,700&display=swap');

/* ─── CSS VARIABLES ─── */
:root {
  --bg-base: #0a0e17;
  --bg-surface: #111827;
  --bg-card: #111827;
  --bg-card-hover: #161e2e;
  --bg-elevated: #1a2235;
  --border: #1e293b;
  --border-bright: #2d3f5c;
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-faint: #334155;
  --green: #22c55e;
  --green-dim: #16a34a;
  --green-glow: rgba(34, 197, 94, 0.15);
  --red: #ef4444;
  --red-dim: #dc2626;
  --red-glow: rgba(239, 68, 68, 0.15);
  --amber: #f59e0b;
  --amber-dim: #d97706;
  --amber-glow: rgba(245, 158, 11, 0.15);
  --blue: #3b82f6;
  --blue-dim: #2563eb;
  --blue-glow: rgba(59, 130, 246, 0.15);
  --purple: #8b5cf6;
  --teal: #14b8a6;
  --radius: 6px;
  --radius-lg: 10px;
  --font-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace;
}

/* ─── RESET & BASE ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 14px;
  scroll-behavior: smooth;
}

body {
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: 'General Sans', 'Satoshi', system-ui, sans-serif;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Monospace numbers */
.mono, .num, .price, .seats-num, .change-num, td.num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* ─── SCROLLBAR ─── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: 3px; }

/* ─── TOP HEADER BAR ─── */
.header-bar {
  background: #070b12;
  border-bottom: 1px solid var(--border);
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-top {
  display: flex;
  align-items: center;
  padding: 8px 16px;
  gap: 16px;
  border-bottom: 1px solid var(--border);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.logo-svg {
  width: 32px;
  height: 32px;
}

.logo-text {
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.2;
}

.logo-text .brand { color: var(--text-primary); font-weight: 700; letter-spacing: 2px; font-size: 13px; }
.logo-text .tagline { color: var(--text-muted); font-size: 9px; letter-spacing: 1px; }

.header-status {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-grow: 1;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
}

.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  animation: pulse-dot 2s infinite;
  flex-shrink: 0;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.status-text { color: var(--green); font-weight: 600; }
.status-sep { color: var(--text-faint); }

.timer-display {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  padding: 4px 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--amber);
  flex-shrink: 0;
}

.timer-icon { color: var(--amber); }
#countdown { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 38px; }

/* ─── STOCK TICKER BAR ─── */
.ticker-wrap {
  overflow: hidden;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 6px 0;
  position: relative;
}

.ticker-wrap::before,
.ticker-wrap::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  width: 40px;
  z-index: 2;
  pointer-events: none;
}
.ticker-wrap::before { left: 0; background: linear-gradient(to right, var(--bg-surface), transparent); }
.ticker-wrap::after { right: 0; background: linear-gradient(to left, var(--bg-surface), transparent); }

.ticker-track {
  display: flex;
  gap: 0;
  animation: ticker-scroll 60s linear infinite;
  white-space: nowrap;
  width: max-content;
}

.ticker-track:hover { animation-play-state: paused; }

@keyframes ticker-scroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 20px;
  font-family: var(--font-mono);
  font-size: 12px;
  border-right: 1px solid var(--border);
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.2s;
}

.ticker-item:hover { background: var(--bg-elevated); }
.ticker-item .t-name { color: var(--text-secondary); font-weight: 600; font-size: 11px; }
.ticker-item .t-seats { color: var(--text-primary); font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums; }
.ticker-item .t-change { font-size: 11px; font-variant-numeric: tabular-nums; }
.ticker-item .t-change.up { color: var(--green); }
.ticker-item .t-change.down { color: var(--red); }
.ticker-item .t-change.flat { color: var(--text-muted); }
.ticker-item .t-change.neutral { color: var(--text-muted); }

/* ─── NAV TABS ─── */
.nav-tabs {
  display: flex;
  background: var(--bg-base);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-tabs::-webkit-scrollbar { display: none; }

.tab-btn {
  padding: 12px 20px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-family: 'General Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.3px;
}

.tab-btn:hover {
  color: var(--text-primary);
  background: var(--bg-surface);
}

.tab-btn.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
  background: var(--bg-surface);
}

.tab-btn .tab-icon { font-size: 14px; }

/* ─── MAIN CONTENT ─── */
.main-content {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0;
}

.tab-panel {
  display: none;
  padding: 16px;
}
.tab-panel.active { display: block; }

/* ─── SECTION HEADERS ─── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.section-title {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.section-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 3px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

/* ─── GRID SYSTEMS ─── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.grid-5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }

/* ─── CARDS ─── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
  transition: border-color 0.2s, background 0.2s;
}

.card:hover {
  border-color: var(--border-bright);
  background: var(--bg-card-hover);
}

.card-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 4px;
}

/* ─── STOCK CARDS (Election State Cards) ─── */
.election-tracker-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}

.election-tracker-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--card-accent, var(--blue));
}

.election-tracker-card:hover {
  border-color: var(--border-bright);
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.election-tracker-card.pro-govt { --card-accent: var(--green); }
.election-tracker-card.anti-govt { --card-accent: var(--red); }
.election-tracker-card.mixed { --card-accent: var(--amber); }

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.card-ticker {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
}

.card-state-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 2px;
}

.sentiment-badge {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 3px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.sentiment-badge.pro-govt { background: var(--green-glow); color: var(--green); border: 1px solid rgba(34,197,94,0.3); }
.sentiment-badge.anti-govt { background: var(--red-glow); color: var(--red); border: 1px solid rgba(239,68,68,0.3); }
.sentiment-badge.mixed { background: var(--amber-glow); color: var(--amber); border: 1px solid rgba(245,158,11,0.3); }
.sentiment-badge.neutral { background: var(--bg-elevated); color: var(--text-muted); border: 1px solid var(--border); }

/* ─── PRICE DISPLAY ─── */
.price-block {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.price-main {
  font-family: var(--font-mono);
  font-size: 32px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.price-main.up { color: var(--green); }
.price-main.down { color: var(--red); }
.price-main.neutral { color: var(--text-primary); }

.price-change {
  font-family: var(--font-mono);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: center;
  gap: 3px;
}

.price-change.up { color: var(--green); }
.price-change.down { color: var(--red); }

.price-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: auto;
}

/* ─── PROGRESS BARS ─── */
.progress-wrap {
  margin: 8px 0;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.progress-bar {
  height: 4px;
  background: var(--bg-elevated);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.6s ease;
}

.progress-fill.green { background: var(--green); }
.progress-fill.red { background: var(--red); }
.progress-fill.blue { background: var(--blue); }
.progress-fill.amber { background: var(--amber); }

/* ─── META ROWS ─── */
.meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
  font-size: 12px;
  border-bottom: 1px solid var(--border);
}
.meta-row:last-child { border-bottom: none; }
.meta-row .meta-label { color: var(--text-muted); }
.meta-row .meta-value { color: var(--text-primary); font-weight: 500; }

/* ─── CONFIDENCE BADGE ─── */
.confidence-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 3px;
}

.confidence-badge.high { background: var(--green-glow); color: var(--green); }
.confidence-badge.moderate { background: var(--amber-glow); color: var(--amber); }
.confidence-badge.low { background: var(--red-glow); color: var(--red); }

/* ─── OPPONENT ROW ─── */
.opponent-row {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
}

.opponent-row .opp-party {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 3px;
  font-family: var(--font-mono);
}

.opp-party .opp-seats { color: var(--text-primary); font-weight: 600; }
.opp-party .opp-change.up { color: var(--green); }
.opp-party .opp-change.down { color: var(--red); }

/* ─── FLASH ANIMATIONS ─── */
@keyframes flash-green {
  0% { background: var(--green-glow); }
  100% { background: transparent; }
}

@keyframes flash-red {
  0% { background: var(--red-glow); }
  100% { background: transparent; }
}

.flash-green { animation: flash-green 1s ease-out; }
.flash-red { animation: flash-red 1s ease-out; }

/* ─── NUMBER FLASH ─── */
.num-flash-green { color: var(--green) !important; transition: color 0.3s; }
.num-flash-red { color: var(--red) !important; transition: color 0.3s; }

/* ─── MARKET MOOD GAUGE ─── */
.mood-gauge-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 12px;
}

.gauge-title {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.gauge-bar-wrap {
  position: relative;
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(to right, #ef4444, #f59e0b, #22c55e);
  margin-bottom: 8px;
  overflow: visible;
}

.gauge-needle {
  position: absolute;
  top: -4px;
  width: 4px;
  height: 20px;
  background: white;
  border-radius: 2px;
  box-shadow: 0 0 8px rgba(255,255,255,0.6);
  transform: translateX(-50%);
  transition: left 1s ease;
}

.gauge-labels {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 10px;
  margin-top: 6px;
}

.gauge-labels .bear { color: var(--red); }
.gauge-labels .mid { color: var(--amber); }
.gauge-labels .bull { color: var(--green); }

.mood-value {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
  margin-top: 8px;
}

/* ─── NEWS TICKER ─── */
.news-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.news-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.2s;
}

.news-item:hover { background: var(--bg-elevated); padding-left: 8px; border-radius: var(--radius); }

.news-sentiment-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}
.news-sentiment-dot.positive { background: var(--green); }
.news-sentiment-dot.negative { background: var(--red); }
.news-sentiment-dot.neutral { background: var(--amber); }

.news-text { font-size: 12px; color: var(--text-primary); line-height: 1.4; flex-grow: 1; }
.news-meta { font-family: var(--font-mono); font-size: 10px; color: var(--text-muted); flex-shrink: 0; }
.news-state-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  margin-right: 6px;
}

/* ─── NATIONAL INDEX CARDS ─── */
.index-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.index-name {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.index-seats {
  font-family: var(--font-mono);
  font-size: 40px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  margin-bottom: 6px;
}

.index-range {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.majority-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--amber);
  margin-top: 8px;
}

/* ─── ALLIANCE TABLE ─── */
.alliance-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.alliance-table th {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-align: left;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.alliance-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}

.alliance-table tr:last-child td { border-bottom: none; }

.alliance-table tr:hover td { background: var(--bg-elevated); }

.party-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  flex-shrink: 0;
}

.party-weight {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

/* ─── LEADER CARDS ─── */
.leader-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all 0.2s;
}

.leader-card:hover { border-color: var(--border-bright); background: var(--bg-card-hover); }

.leader-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--blue);
  flex-shrink: 0;
}

.leader-info { flex-grow: 1; min-width: 0; }
.leader-name { font-size: 12px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.leader-role { font-size: 11px; color: var(--text-muted); }
.leader-party { font-family: var(--font-mono); font-size: 10px; color: var(--blue); }

.approval-bar {
  width: 60px;
  flex-shrink: 0;
}

.approval-track {
  height: 3px;
  background: var(--bg-elevated);
  border-radius: 2px;
  margin-top: 4px;
}

.approval-fill {
  height: 3px;
  border-radius: 2px;
  background: var(--green);
}

.approval-pct {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--green);
  text-align: right;
}

/* ─── STATE SCREENER TABLE ─── */
.screener-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.screener-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  white-space: nowrap;
}

.screener-table th {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-align: left;
  padding: 10px 14px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  letter-spacing: 0.5px;
  cursor: pointer;
  user-select: none;
  text-transform: uppercase;
}

.screener-table th:hover { color: var(--text-primary); }

.screener-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}

.screener-table tbody tr:hover td {
  background: var(--bg-elevated);
  cursor: pointer;
}

.screener-table tr:last-child td { border-bottom: none; }

.state-code {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--blue);
  font-size: 11px;
}

.election-badge-live {
  font-family: var(--font-mono);
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 3px;
  background: rgba(239,68,68,0.2);
  color: var(--red);
  border: 1px solid rgba(239,68,68,0.4);
  letter-spacing: 0.5px;
}

/* ─── FILTER BAR ─── */
.filter-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 5px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 12px;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: all 0.2s;
}

.filter-btn:hover {
  border-color: var(--border-bright);
  color: var(--text-primary);
}

.filter-btn.active {
  background: var(--blue-glow);
  border-color: var(--blue);
  color: var(--blue);
}

/* ─── IPO CARDS ─── */
.election-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: all 0.2s;
}

.election-card::before {
  content: '2026';
  position: absolute;
  top: 12px; right: 12px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--blue-glow);
  color: var(--blue);
  border: 1px solid rgba(59,130,246,0.3);
  letter-spacing: 1px;
}

.election-card:hover { border-color: var(--border-bright); box-shadow: 0 4px 20px rgba(0,0,0,0.4); }

.election-state-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
  padding-right: 60px;
}

.election-type {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 1px;
  margin-bottom: 16px;
}

.countdown-display {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 16px;
  text-align: center;
}

.countdown-big {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--amber);
  font-variant-numeric: tabular-nums;
  letter-spacing: 1px;
}

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

.election-date {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--blue);
  font-weight: 600;
  margin-bottom: 12px;
}

/* ─── RISK INDICATORS ─── */
.risk-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}

.risk-row:last-child { border-bottom: none; }
.risk-label { color: var(--text-secondary); }
.risk-badge { font-family: var(--font-mono); font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 3px; }
.risk-badge.high { background: var(--red-glow); color: var(--red); }
.risk-badge.medium { background: var(--amber-glow); color: var(--amber); }
.risk-badge.low { background: var(--green-glow); color: var(--green); }

/* ─── ECONOMIC INDICATORS ─── */
.econ-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}

.econ-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
}

.econ-value {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  margin-bottom: 4px;
}

.econ-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.econ-note {
  font-size: 10px;
  color: var(--text-faint);
}

/* ─── PREDICTION WEIGHTS ─── */
.weight-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.weight-icon { font-size: 20px; flex-shrink: 0; }
.weight-info { flex-grow: 1; }
.weight-title { font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 2px; }
.weight-desc { font-size: 12px; color: var(--text-muted); }
.weight-bar-wrap { width: 120px; flex-shrink: 0; }
.weight-pct { font-family: var(--font-mono); font-size: 13px; font-weight: 700; color: var(--blue); text-align: right; margin-bottom: 4px; }
.weight-bar { height: 4px; background: var(--bg-elevated); border-radius: 2px; overflow: hidden; }
.weight-fill { height: 100%; background: var(--blue); border-radius: 2px; }

/* ─── DETAIL MODAL ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}

.modal-overlay.open { display: flex; }

.modal-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  background: var(--bg-elevated);
  position: sticky;
  top: 0;
  z-index: 10;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 20px;
  padding: 4px;
  line-height: 1;
  transition: color 0.2s;
}

.modal-close:hover { color: var(--text-primary); }

.modal-body {
  padding: 20px 24px;
}

.modal-section {
  margin-bottom: 24px;
}

.modal-section-title {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

/* ─── CHART CONTAINERS ─── */
.chart-container {
  position: relative;
  width: 100%;
  border-radius: var(--radius);
  overflow: hidden;
}

.chart-sm { height: 120px; }
.chart-md { height: 200px; }
.chart-lg { height: 300px; }

/* ─── EXPANDABLE SECTIONS ─── */
.expandable {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 8px;
}

.expandable-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  cursor: pointer;
  background: var(--bg-elevated);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  transition: background 0.2s;
}

.expandable-header:hover { background: var(--border); }

.expand-icon {
  font-size: 16px;
  color: var(--text-muted);
  transition: transform 0.2s;
}

.expandable.open .expand-icon { transform: rotate(180deg); }

.expandable-body {
  display: none;
  padding: 12px 14px;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-card);
  line-height: 1.6;
}

.expandable.open .expandable-body { display: block; }

/* ─── TOOLTIP STYLE ─── */
.has-tooltip {
  position: relative;
  cursor: help;
  text-decoration: underline dotted var(--text-faint);
  text-underline-offset: 3px;
}

.tooltip-text {
  visibility: hidden;
  opacity: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border-bright);
  color: var(--text-primary);
  font-size: 11px;
  padding: 8px 12px;
  border-radius: var(--radius);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 6px;
  white-space: nowrap;
  z-index: 50;
  pointer-events: none;
  transition: opacity 0.2s;
  max-width: 250px;
  white-space: normal;
  text-align: left;
}

.has-tooltip:hover .tooltip-text {
  visibility: visible;
  opacity: 1;
}

/* ─── MANIFESTO COMPARE TABLE ─── */
.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.compare-table th {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-primary);
  padding: 10px;
  text-align: left;
  border-bottom: 2px solid var(--border-bright);
  background: var(--bg-elevated);
}

.compare-table td {
  padding: 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  line-height: 1.5;
  color: var(--text-secondary);
}

.compare-table tr:hover td { background: var(--bg-elevated); }

.category-pill {
  display: inline-flex;
  font-family: var(--font-mono);
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 3px;
  margin-bottom: 4px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.cat-welfare { background: rgba(139,92,246,0.2); color: var(--purple); }
.cat-economy { background: var(--green-glow); color: var(--green); }
.cat-infrastructure { background: var(--blue-glow); color: var(--blue); }
.cat-education { background: var(--amber-glow); color: var(--amber); }
.cat-social { background: rgba(20,184,166,0.2); color: var(--teal); }

/* ─── SCROLLABLE PANELS ─── */
.scroll-x { overflow-x: auto; }
.scroll-y { overflow-y: auto; max-height: 400px; }

/* ─── DIVIDERS ─── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

/* ─── HELPER CLASSES ─── */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-amber { color: var(--amber); }
.text-blue { color: var(--blue); }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--text-primary); }
.font-mono { font-family: var(--font-mono); }
.text-xs { font-size: 11px; }
.text-sm { font-size: 12px; }
.text-base { font-size: 13px; }
.font-bold { font-weight: 700; }
.font-600 { font-weight: 600; }

/* ─── PARTY COLOR DOTS ─── */
.party-swatch {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
}

/* ─── SPARKLINE MINI ─── */
.sparkline-wrap {
  height: 40px;
  width: 80px;
  flex-shrink: 0;
}

/* ─── BOTTOM FOOTER ─── */
.terminal-footer {
  text-align: center;
  padding: 12px;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 10px;
  border-top: 1px solid var(--border);
  margin-top: 24px;
}

/* ─── RESPONSIVE ─── */
@media (max-width: 900px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-5 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .tab-panel { padding: 10px; }
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: 1fr; }
  .header-status { display: none; }
  .price-main { font-size: 24px; }
  .index-seats { font-size: 28px; }
  .modal-box { max-height: 95vh; }
  .modal-body { padding: 14px; }
  .timer-display { display: none; }
}

@media (max-width: 480px) {
  .grid-5 { grid-template-columns: 1fr; }
  .grid-auto { grid-template-columns: 1fr; }
  .header-top { gap: 8px; padding: 8px 10px; }
}

/* ─── POLL RESULTS ─── */
.poll-bar-wrap {
  margin-top: 10px;
}

.poll-candidate {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 12px;
}

.poll-name { color: var(--text-secondary); min-width: 80px; }
.poll-track { flex: 1; height: 8px; background: var(--bg-elevated); border-radius: 4px; overflow: hidden; }
.poll-fill { height: 100%; border-radius: 4px; transition: width 0.6s ease; }
.poll-pct { font-family: var(--font-mono); font-size: 11px; font-variant-numeric: tabular-nums; min-width: 45px; text-align: right; }

/* ─── STATE DETAIL LAYOUT ─── */
.state-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 600px) {
  .state-detail-grid { grid-template-columns: 1fr; }
}

/* ─── HIGHLIGHT ROW ─── */
.row-highlight {
  background: rgba(59,130,246,0.05);
  border-left: 2px solid var(--blue);
}

/* ─── LOADING STATE ─── */
.loading-bar {
  height: 2px;
  background: var(--bg-elevated);
  overflow: hidden;
  margin-bottom: 8px;
}

.loading-fill {
  height: 100%;
  width: 30%;
  background: var(--blue);
  animation: loading-slide 1.5s ease-in-out infinite;
}

@keyframes loading-slide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(400%); }
}

/* ─── SEARCH BAR ─── */
.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
}

.search-bar input {
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  flex: 1;
}

.search-bar input::placeholder { color: var(--text-muted); }

.search-icon { color: var(--text-muted); font-size: 14px; }

/* ─── KPI BAR ─── */
.kpi-bar {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 14px;
  scrollbar-width: none;
}
.kpi-bar::-webkit-scrollbar { display: none; }

.kpi-pill {
  flex-shrink: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.kpi-pill-val {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.kpi-pill-label {
  font-size: 10px;
  color: var(--text-muted);
}

/* ─── PARTY BREAKDOWN IN ELECTION CARDS ─── */
.leading-block {
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 10px;
}
.leading-label {
  font-size: 9px;
  font-family: var(--font-mono);
  color: var(--blue);
  letter-spacing: 0.1em;
  margin-bottom: 4px;
}
.leading-party {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.leading-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
}
.leading-seats {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
}
.leading-change {
  font-family: var(--font-mono);
  font-size: 12px;
}
.leading-predicted {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
}
.leading-predicted strong {
  color: var(--green);
}

.all-parties-section {
  margin-bottom: 10px;
}
.parties-header {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  font-family: var(--font-mono);
  color: var(--text-faint);
  letter-spacing: 0.08em;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.party-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  font-size: 12px;
}
.party-row.leading {
  background: rgba(34, 197, 94, 0.06);
  margin: 0 -8px;
  padding: 5px 8px;
  border-radius: 4px;
}
.party-row-left {
  display: flex;
  align-items: center;
  gap: 6px;
}
.party-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.party-name {
  color: var(--text-main);
  font-weight: 500;
}
.party-row-right {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
}
.party-seats {
  font-weight: 700;
  min-width: 30px;
  text-align: right;
}
.party-change {
  font-size: 10px;
  min-width: 50px;
  text-align: right;
}
.party-share {
  font-size: 10px;
  color: var(--text-muted);
  min-width: 35px;
  text-align: right;
}
.party-range {
  font-size: 9px;
  color: var(--text-faint);
  min-width: 45px;
  text-align: right;
}

.seat-bar-mini {
  display: flex;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 10px;
  gap: 1px;
}
.seat-seg {
  border-radius: 2px;
  min-width: 2px;
  transition: width 0.5s ease;
}

.card-stats-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.stat-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 100px;
}
.stat-label {
  font-size: 9px;
  font-family: var(--font-mono);
  color: var(--text-faint);
  letter-spacing: 0.05em;
}
.stat-value {
  font-size: 11px;
  color: var(--text-muted);
}

/* ─── FREEMAN ANALYTICS TAB ─── */
.analytics-state-block {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}
.analytics-state-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 8px;
}
.analytics-state-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
}
.analytics-state-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  font-family: var(--font-mono);
}
.analytics-leader {
  display: flex;
  align-items: center;
  gap: 6px;
}
.analytics-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 16px;
}
@media (max-width: 768px) {
  .analytics-grid { grid-template-columns: 1fr; }
}
.analytics-chart-wrap {
  background: rgba(0,0,0,0.2);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 6px;
  padding: 12px;
}
.analytics-parties {
  padding: 4px 0;
}
.analytics-party-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 6px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  border-radius: 4px;
}
.analytics-party-row.leading {
  background: rgba(34, 197, 94, 0.08);
}

/* Activity Log */
.analytics-log {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  max-height: 300px;
  overflow-y: auto;
}
.log-entry {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 11px;
  line-height: 1.5;
}
.log-entry:last-child { border-bottom: none; }
.log-time {
  font-family: var(--font-mono);
  color: var(--text-faint);
  white-space: nowrap;
  min-width: 80px;
}
.log-msg {
  color: var(--text-muted);
  word-break: break-word;
}
