:root {
  --dash-bg: #0b1220;
  --dash-surface: #121c2e;
  --dash-surface-2: #1a2740;
  --dash-border: rgba(148, 163, 184, 0.18);
  --dash-text: #e8edf5;
  --dash-muted: #94a3b8;
  --dash-accent: #3b82f6;
  --dash-accent-2: #22d3ee;
  --dash-rep: #ef4444;
  --dash-dem: #3b82f6;
  --dash-battle: #f59e0b;
  --dash-ok: #22c55e;
  --radius: 14px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

body.dashboard-page {
  background: radial-gradient(1200px 600px at 10% -10%, rgba(59, 130, 246, 0.18), transparent 60%),
    radial-gradient(900px 500px at 90% 0%, rgba(34, 211, 238, 0.12), transparent 55%),
    var(--dash-bg);
  color: var(--dash-text);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}

body.dashboard-page .site-header {
  background: rgba(11, 18, 32, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--dash-border);
}

body.dashboard-page .site-footer {
  background: transparent;
  border-top: 1px solid var(--dash-border);
  color: var(--dash-muted);
  font-size: 0.9rem;
}

body.dashboard-page .site-footer .wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
}

body.dashboard-page .footer-banner-link:hover {
  opacity: 1;
}

body.dashboard-page a { color: var(--dash-accent-2); }

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

.dashboard-hero {
  padding: 36px 0 20px;
}

.dashboard-hero .wrap {
  width: min(1280px, calc(100% - 32px));
}

.hero-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
}

.hero-top h1 {
  margin: 0 0 8px;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.hero-top .lead {
  margin: 0;
  max-width: 62ch;
  color: var(--dash-muted);
  font-size: 1.05rem;
}

.election-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.35);
  color: #bfdbfe;
  font-size: 0.92rem;
  font-weight: 600;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.stat-card {
  background: linear-gradient(180deg, var(--dash-surface-2), var(--dash-surface));
  border: 1px solid var(--dash-border);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  box-shadow: var(--shadow);
}

.stat-card .label {
  color: var(--dash-muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.stat-card .value {
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1.1;
}

.stat-card .sub {
  margin-top: 6px;
  color: var(--dash-muted);
  font-size: 0.88rem;
}

.map-panel-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 18px;
  align-items: stretch;
}

@media (max-width: 960px) {
  .map-panel-grid { grid-template-columns: 1fr; }
}

.map-card,
.detail-card {
  background: linear-gradient(180deg, rgba(26, 39, 64, 0.95), rgba(18, 28, 46, 0.98));
  border: 1px solid var(--dash-border);
  border-radius: calc(var(--radius) + 2px);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.map-card-header,
.detail-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--dash-border);
}

.map-card-header h2,
.detail-card-header h2 {
  margin: 0;
  font-size: 1.05rem;
}

.state-select-wrap {
  flex-shrink: 0;
}

.state-select {
  appearance: none;
  background: rgba(15, 23, 42, 0.85) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2394a3b8' d='M1 1l5 5 5-5'/%3E%3C/svg%3E") no-repeat right 12px center;
  border: 1px solid var(--dash-border);
  border-radius: 8px;
  color: var(--dash-text);
  cursor: pointer;
  font: inherit;
  font-size: 0.9rem;
  max-width: min(220px, 42vw);
  padding: 8px 36px 8px 12px;
}

.state-select:hover,
.state-select:focus {
  border-color: var(--dash-accent-2);
  outline: none;
}

.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  font-size: 0.78rem;
  color: var(--dash-muted);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  border: 1px solid rgba(255,255,255,0.15);
}

.map-hover-label {
  min-height: 2rem;
  padding: 4px 18px 10px;
  text-align: center;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--dash-text);
  letter-spacing: 0.02em;
}

#us-map {
  width: 100%;
  min-height: 420px;
  display: block;
}

#us-map path.state {
  stroke: rgba(15, 23, 42, 0.9);
  stroke-width: 0.6;
  cursor: pointer;
  transition: filter 0.15s ease, opacity 0.15s ease;
}

#us-map path.state:hover,
#us-map path.state.active {
  filter: brightness(1.25);
  stroke: #fff;
  stroke-width: 1.2;
}

.detail-card-body {
  padding: 18px;
  min-height: 420px;
}

.state-placeholder {
  color: var(--dash-muted);
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 360px;
  text-align: center;
  gap: 8px;
}

.state-placeholder strong {
  color: var(--dash-text);
  font-size: 1.1rem;
}

.state-title {
  margin: 0 0 6px;
  font-size: 1.6rem;
}

.state-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 18px;
}

.tag {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--dash-border);
  background: rgba(255,255,255,0.04);
}

.tag.battleground { color: #fde68a; border-color: rgba(245, 158, 11, 0.45); }
.tag.senate { color: #bfdbfe; border-color: rgba(59, 130, 246, 0.45); }
.tag.governor { color: #a7f3d0; border-color: rgba(34, 197, 94, 0.45); }
.tag.vacant_house { color: #fecaca; border-color: rgba(239, 68, 68, 0.45); }

.detail-section {
  margin-bottom: 18px;
}

.detail-section h3 {
  margin: 0 0 10px;
  font-size: 0.95rem;
  color: #cbd5e1;
}

.detail-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.detail-list li {
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--dash-border);
  font-size: 0.92rem;
}

.party-pill {
  display: inline-block;
  min-width: 1.4rem;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 6px;
  margin-left: 6px;
  vertical-align: middle;
}

.party-pill.R { background: rgba(239, 68, 68, 0.2); color: #fecaca; }
.party-pill.D { background: rgba(59, 130, 246, 0.2); color: #bfdbfe; }
.party-pill.I { background: rgba(148, 163, 184, 0.2); color: #e2e8f0; }

.district-scroll {
  max-height: 180px;
  overflow: auto;
  padding-right: 4px;
}

.info-section {
  padding: 44px 0;
}

.info-section .wrap {
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
}

.info-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 18px;
}

@media (max-width: 900px) {
  .info-grid { grid-template-columns: 1fr; }
}

.info-card {
  background: var(--dash-surface);
  border: 1px solid var(--dash-border);
  border-radius: var(--radius);
  padding: 22px;
}

.info-card h2 {
  margin: 0 0 14px;
  font-size: 1.2rem;
}

.info-card p,
.info-card li {
  color: #cbd5e1;
  line-height: 1.6;
}

.def-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 12px;
}

.def-list strong {
  display: block;
  color: var(--dash-text);
  margin-bottom: 4px;
}

.source-list {
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.source-list a {
  color: var(--dash-accent-2);
  text-decoration: none;
}

.source-list a:hover { text-decoration: underline; }

.battleground-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.battle-card {
  padding: 14px;
  border-radius: 12px;
  border: 1px solid rgba(245, 158, 11, 0.25);
  background: rgba(245, 158, 11, 0.08);
}

.battle-card h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.battle-card p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--dash-muted);
}
