/* ==========================================================================
   POLITISO DESIGN SYSTEM & GLOBAL THEME ARCHITECTURE
   Premium, modern, data-driven political intelligence & election analytics
   Colors strictly adhere to POLITISO brand palette:
   - Deep Midnight Navy: #101828
   - Ink Black: #0B0D12
   - Graphite: #1C2430
   - Slate: #344054
   - Off-White: #F8FAFC
   - Pure White: #FFFFFF
   - Muted Gray: #98A2B3
   - POLITISO Signature Orange: #F26B38
   - Election Green: #23966A
   - Political Blue: #4267D5
   - Alert Red: #D94A4A
   - Gold: #D6A84B
   ========================================================================== */

:root,
html[data-theme="light"] {
  color-scheme: light;

  /* Primary Light Theme Surfaces */
  --bg-page: #F8FAFC;
  --bg-page-subtle: #F1F5F9;
  --bg-surface: #FFFFFF;
  --bg-surface-elevated: #FFFFFF;
  --bg-control: #F1F5F9;
  --bg-control-hover: #E2E8F0;
  --bg-control-active: rgba(242, 107, 56, 0.1);
  --bg-tertiary: #F1F5F9;
  --bg-hover: #F1F5F9;

  /* Borders & Dividers */
  --border-subtle: #F1F5F9;
  --border-default: #E2E8F0;
  --border-control: #CBD5E1;
  --border-control-hover: #94A3B8;
  --border-control-active: #F26B38;

  /* Text & Labels */
  --text-primary: #0B0D12;
  --text-normal: #0B0D12;
  --text-default: #0B0D12;
  --text-main: #0B0D12;
  --text-secondary: #344054;
  --text-muted: #64748B;
  --text-dim: #98A2B3;
  --text-on-accent: #FFFFFF;
  --text-active-control: #F26B38;

  /* Brand Accents */
  --accent-primary: #F26B38;
  --accent-hover: #DC5A28;
  --accent-active: #C84E20;
  --accent-subtle: rgba(242, 107, 56, 0.08);
  --accent-glow: rgba(242, 107, 56, 0.22);

  /* Semantic Colors */
  --status-success: #23966A;
  --status-success-bg: rgba(35, 150, 106, 0.1);
  --status-warning: #D6A84B;
  --status-warning-bg: rgba(214, 168, 75, 0.12);
  --status-error: #D94A4A;
  --status-error-bg: rgba(217, 74, 74, 0.1);
  --political-blue: #4267D5;
  --political-blue-bg: rgba(66, 103, 213, 0.1);

  /* Focus & Elevation */
  --focus-ring: 0 0 0 2px rgba(242, 107, 56, 0.35);
  --shadow-xs: 0 1px 2px 0 rgba(16, 24, 40, 0.05);
  --shadow-sm: 0 1px 3px 0 rgba(16, 24, 40, 0.08), 0 1px 2px -1px rgba(16, 24, 40, 0.04);
  --shadow-md: 0 4px 12px -2px rgba(16, 24, 40, 0.08), 0 2px 4px -2px rgba(16, 24, 40, 0.04);
  --shadow-lg: 0 12px 24px -4px rgba(16, 24, 40, 0.1), 0 4px 8px -2px rgba(16, 24, 40, 0.04);

  /* Clean Surfaces */
  --glass-surface: #FFFFFF;
  --glass-surface-elevated: #FFFFFF;
  --glass-surface-nav: rgba(255, 255, 255, 0.94);
  --glass-surface-control: #F1F5F9;
  --glass-surface-hover: #E2E8F0;
  --glass-border: #E2E8F0;
  --glass-border-subtle: #F1F5F9;
  --glass-border-highlight: #CBD5E1;
  --glass-active-pill: #FFFFFF;
  --glass-nav-bg: rgba(255, 255, 255, 0.94);
  --glass-blur: blur(8px);
  --glass-blur-nav: blur(8px);
  --glass-shadow-sm: var(--shadow-xs);
  --glass-shadow-md: var(--shadow-sm);
  --glass-shadow-lg: var(--shadow-md);

  /* Typography Stack */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-text: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Manrope', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Radii */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 14px;
  --radius-2xl: 16px;
  --radius-pill: 9999px;
  --radius: 8px;

  /* Transitions */
  --ease-apple: cubic-bezier(0.16, 1, 0.3, 1);
  --transition-fast: 140ms var(--ease-apple);
  --transition-smooth: 220ms var(--ease-apple);

  /* Legacy mappings */
  --ink: var(--text-primary);
  --muted: var(--text-muted);
  --line: var(--border-default);
  --paper: var(--bg-page-subtle);
  --white: var(--bg-surface);
  --navy: #101828;
  --navy2: #1C2430;
  --blue: #4267D5;
  --gold: #D6A84B;
  --green: #23966A;
  --orange: #F26B38;
}

html[data-theme="dark"] {
  color-scheme: dark;

  /* Primary Dark Theme Surfaces */
  --bg-page: #0B0D12;
  --bg-page-subtle: #101828;
  --bg-surface: #101828;
  --bg-surface-elevated: #1C2430;
  --bg-control: #1C2430;
  --bg-control-hover: #263242;
  --bg-control-active: rgba(242, 107, 56, 0.18);
  --bg-tertiary: #1C2430;
  --bg-hover: #1C2430;

  /* Borders & Dividers */
  --border-subtle: #1C2430;
  --border-default: #243042;
  --border-control: #344054;
  --border-control-hover: #475467;
  --border-control-active: #F26B38;

  /* Text & Labels */
  --text-primary: #F8FAFC;
  --text-normal: #F8FAFC;
  --text-default: #F8FAFC;
  --text-main: #F8FAFC;
  --text-secondary: #D0D5DD;
  --text-muted: #98A2B3;
  --text-dim: #64748B;
  --text-on-accent: #FFFFFF;
  --text-active-control: #F26B38;

  /* Brand Accents */
  --accent-primary: #F26B38;
  --accent-hover: #FF7D4D;
  --accent-active: #F26B38;
  --accent-subtle: rgba(242, 107, 56, 0.15);
  --accent-glow: rgba(242, 107, 56, 0.32);

  /* Semantic Colors */
  --status-success: #23966A;
  --status-success-bg: rgba(35, 150, 106, 0.18);
  --status-warning: #D6A84B;
  --status-warning-bg: rgba(214, 168, 75, 0.18);
  --status-error: #D94A4A;
  --status-error-bg: rgba(217, 74, 74, 0.18);
  --political-blue: #4267D5;
  --political-blue-bg: rgba(66, 103, 213, 0.18);

  /* Focus & Elevation */
  --focus-ring: 0 0 0 2px rgba(242, 107, 56, 0.45);
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.45), 0 1px 2px -1px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 14px -2px rgba(0, 0, 0, 0.55), 0 2px 4px -2px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 36px -6px rgba(0, 0, 0, 0.7);

  /* Clean Surfaces */
  --glass-surface: #101828;
  --glass-surface-elevated: #1C2430;
  --glass-surface-nav: rgba(11, 13, 18, 0.94);
  --glass-surface-control: #1C2430;
  --glass-surface-hover: #263242;
  --glass-border: #243042;
  --glass-border-subtle: #1C2430;
  --glass-border-highlight: #344054;
  --glass-active-pill: #1C2430;
  --glass-nav-bg: rgba(11, 13, 18, 0.94);
  --glass-blur: blur(8px);
  --glass-blur-nav: blur(8px);
  --glass-shadow-sm: var(--shadow-xs);
  --glass-shadow-md: var(--shadow-sm);
  --glass-shadow-lg: var(--shadow-md);

  /* Legacy mappings */
  --ink: var(--text-primary);
  --muted: var(--text-muted);
  --line: var(--border-default);
  --paper: var(--bg-page-subtle);
  --white: var(--bg-surface);
  --navy: #101828;
  --navy2: #1C2430;
  --blue: #4267D5;
  --gold: #D6A84B;
  --green: #23966A;
  --orange: #F26B38;
}

/* ==========================================================================
   GLOBAL THEME TOGGLE BUTTON
   ========================================================================== */

.theme-toggle {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border-control);
  border-radius: 999px;
  background: var(--bg-control);
  color: var(--text-primary);
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.18s ease;
  user-select: none;
}

.theme-toggle:hover {
  background: var(--bg-control-hover);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  transform: translateY(-1px);
}

.theme-toggle:active {
  transform: translateY(0) scale(0.98);
}

.theme-toggle:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.theme-toggle-icon {
  font-size: 15px;
  line-height: 1;
}

.theme-toggle-overlay {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 1000000;
  margin: 0;
}

@media (max-width: 1050px) {
  .theme-toggle {
    padding: 0 10px;
  }
}

@media (max-width: 820px) {
  .theme-toggle {
    min-height: 36px;
    width: 36px;
    min-width: 36px;
    padding: 0;
    border-radius: 9px;
    justify-content: center;
  }
  .theme-toggle .theme-toggle-label {
    display: none;
  }
  .theme-toggle-icon {
    font-size: 17px;
    margin: 0;
  }
}

@media (max-width: 360px) {
  .theme-toggle {
    min-height: 34px;
    width: 34px;
    min-width: 34px;
  }
}

/* ==========================================================================
   GLOBAL HEADER, BRANDING & NAVIGATION
   ========================================================================== */

.site-header {
  border-bottom: 1px solid var(--glass-border) !important;
  backdrop-filter: var(--glass-blur) !important;
  -webkit-backdrop-filter: var(--glass-blur) !important;
}

html[data-theme="light"] .site-header {
  background: var(--glass-surface-nav) !important;
}

html[data-theme="dark"] .site-header {
  background: var(--glass-surface-nav) !important;
}

.brand-copy strong {
  color: var(--text-primary);
}

.brand-copy small {
  color: var(--text-muted);
}

.main-nav a {
  color: var(--text-secondary) !important;
  transition: color 0.18s ease;
}

.main-nav a:hover {
  color: var(--text-primary) !important;
}

.main-nav a.active {
  color: var(--accent-primary) !important;
  font-weight: 800;
}

.main-nav a.active:after {
  background: var(--accent-primary) !important;
}

html[data-theme="dark"] .main-nav a.active:after {
  box-shadow: 0 0 8px var(--accent-primary);
}

@media (max-width: 820px) {
  .main-nav {
    background: var(--bg-surface) !important;
    border-color: var(--border-default) !important;
    box-shadow: var(--shadow-lg) !important;
  }
  .main-nav a {
    border-bottom: 1px solid var(--border-subtle) !important;
    padding: 0 12px;
  }
  .main-nav a.active {
    background: var(--bg-control-active) !important;
    color: var(--text-active-control) !important;
    border-radius: 8px;
  }
}

.auth-open-button {
  background: var(--accent-primary) !important;
  color: var(--text-on-accent) !important;
  border: 1px solid var(--accent-primary) !important;
  font-weight: 800 !important;
  box-shadow: var(--shadow-sm);
  transition: all 0.18s ease;
}

.auth-open-button:hover {
  background: var(--accent-hover) !important;
  border-color: var(--accent-hover) !important;
  transform: translateY(-1px);
}

.auth-open-button:active {
  transform: translateY(0) scale(0.98);
}

.menu-toggle {
  background: var(--bg-control) !important;
  border: 1px solid var(--border-control) !important;
  color: var(--text-primary) !important;
}

.menu-toggle:hover {
  background: var(--bg-control-hover) !important;
  border-color: var(--accent-primary) !important;
}

/* ==========================================================================
   SELECTED & UNSELECTED CONTROLS — HIGHEST PRIORITY
   Crystal clear distinction between Inactive, Hover, Active, Focus, Disabled
   ========================================================================== */

/* 1. Election Year Selectors (2022 / 2017 / 2024 / 2019) */
.e22-year-switch,
.e19-year-switch,
.e19s-year-switch,
.e24-year-switch {
  display: flex;
  gap: 8px;
  margin: 0 0 18px;
}

.e22-year-switch button,
.e19-year-switch button,
.e19s-year-switch button,
.e24-year-switch button {
  background: var(--bg-control) !important;
  border: 1px solid var(--border-control) !important;
  color: var(--text-secondary) !important;
  border-radius: 9px;
  padding: 9px 18px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s ease;
  user-select: none;
}

.e22-year-switch button:hover,
.e19-year-switch button:hover,
.e19s-year-switch button:hover,
.e24-year-switch button:hover {
  background: var(--bg-control-hover) !important;
  border-color: var(--border-control-hover) !important;
  color: var(--text-primary) !important;
  transform: translateY(-1px);
}

.e22-year-switch button:focus-visible,
.e19-year-switch button:focus-visible,
.e19s-year-switch button:focus-visible,
.e24-year-switch button:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring) !important;
}

/* Active / Selected year buttons: prominently styled with high-contrast accent in both themes */
.e22-year-switch button[aria-pressed="true"],
.e19-year-switch button[aria-pressed="true"],
.e19s-year-switch button[aria-pressed="true"],
.e24-year-switch button[aria-pressed="true"] {
  background: var(--bg-control-active) !important;
  border: 1.5px solid var(--border-control-active) !important;
  color: var(--text-active-control) !important;
  font-weight: 800 !important;
  box-shadow: 0 0 0 1px var(--border-control-active), var(--shadow-sm) !important;
}

html[data-theme="dark"] .e22-year-switch button[aria-pressed="true"],
html[data-theme="dark"] .e19-year-switch button[aria-pressed="true"],
html[data-theme="dark"] .e19s-year-switch button[aria-pressed="true"],
html[data-theme="dark"] .e24-year-switch button[aria-pressed="true"] {
  background: rgba(242, 107, 56, 0.22) !important;
  border-color: #F26B38 !important;
  color: #f8fafc !important;
  box-shadow: 0 0 0 1px #F26B38, 0 2px 10px rgba(7, 89, 133, 0.5) !important;
}

html[data-theme="light"] .e22-year-switch button[aria-pressed="true"],
html[data-theme="light"] .e19-year-switch button[aria-pressed="true"],
html[data-theme="light"] .e19s-year-switch button[aria-pressed="true"],
html[data-theme="light"] .e24-year-switch button[aria-pressed="true"] {
  background: rgba(242, 107, 56, 0.1) !important;
  border-color: #F26B38 !important;
  color: #F26B38 !important;
  box-shadow: 0 0 0 1px #F26B38, 0 2px 6px rgba(242, 107, 56, ) !important;
}

/* 2. Navigation Tabs (Local Results, Forecast Desk, Auth Dialog, District Dashboard) */
.local-results-tabs,
.forecast-sub-tabs,
.auth-tabs {
  background: var(--bg-control);
  border: 1px solid var(--border-default);
  border-radius: 14px;
  padding: 5px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.local-results-tabs button,
.f-tab-btn,
.auth-tabs button,
.dd-tab-btn {
  background: transparent !important;
  border: 1px solid transparent !important;
  color: var(--text-secondary) !important;
  border-radius: 10px;
  padding: 9px 16px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s ease;
  user-select: none;
}

.local-results-tabs button:hover,
.f-tab-btn:hover,
.auth-tabs button:hover,
.dd-tab-btn:hover {
  background: var(--bg-control-hover) !important;
  color: var(--text-primary) !important;
}

.local-results-tabs button:focus-visible,
.f-tab-btn:focus-visible,
.auth-tabs button:focus-visible,
.dd-tab-btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring) !important;
}

/* Active tab state */
.local-results-tabs button[aria-pressed="true"],
.f-tab-btn.active,
.auth-tabs button.is-active,
.dd-tab-btn.active,
#districtDashboard .dd-tab-btn.active {
  background: var(--bg-control-active) !important;
  border: 1.5px solid var(--border-control-active) !important;
  color: var(--text-active-control) !important;
  font-weight: 800 !important;
  box-shadow: 0 0 0 1px var(--border-control-active), var(--shadow-sm) !important;
}

html[data-theme="dark"] .local-results-tabs button[aria-pressed="true"],
html[data-theme="dark"] .f-tab-btn.active,
html[data-theme="dark"] .auth-tabs button.is-active {
  background: rgba(242, 107, 56, 0.22) !important;
  border-color: #F26B38 !important;
  color: #f8fafc !important;
  box-shadow: 0 0 0 1px #F26B38, 0 2px 10px rgba(242, 107, 56, 0.4) !important;
}

html[data-theme="dark"] .dd-tab-btn.active,
html[data-theme="dark"] #districtDashboard .dd-tab-btn.active {
  background: #1C2430 !important;
  border-color: #F26B38 !important;
  color: #f8fafc !important;
  box-shadow: 0 0 0 1px #F26B38, 0 2px 10px rgba(242, 107, 56, 0.4) !important;
}

html[data-theme="light"] .local-results-tabs button[aria-pressed="true"],
html[data-theme="light"] .f-tab-btn.active,
html[data-theme="light"] .auth-tabs button.is-active,
html[data-theme="light"] .dd-tab-btn.active,
html[data-theme="light"] #districtDashboard .dd-tab-btn.active {
  background: rgba(242, 107, 56, 0.1) !important;
  border-color: #F26B38 !important;
  color: #F26B38 !important;
  box-shadow: 0 0 0 1px #F26B38, 0 2px 6px rgba(242, 107, 56, ) !important;
}

/* 3. Filters and Segmented Controls (Gram Panchayat Results, Chips, Categories) */
.gp-result-filters {
  background: var(--bg-page-subtle);
  border: 1px solid var(--border-default);
  border-radius: 12px;
}

.gp-result-filter-label {
  color: var(--text-muted);
}

.gp-result-filter-options button {
  background: var(--bg-surface) !important;
  border: 1px solid var(--border-control) !important;
  color: var(--text-secondary) !important;
  border-radius: 999px;
  padding: 6px 14px;
  font: inherit;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s ease;
}

.gp-result-filter-options button:hover {
  background: var(--bg-control-hover) !important;
  border-color: var(--border-control-hover) !important;
  color: var(--text-primary) !important;
}

.gp-result-filter-options button[aria-pressed="true"] {
  background: var(--bg-control-active) !important;
  border: 1.5px solid var(--border-control-active) !important;
  color: var(--text-active-control) !important;
  font-weight: 800 !important;
}

html[data-theme="dark"] .gp-result-filter-options button[aria-pressed="true"] {
  background: rgba(242, 107, 56, 0.22) !important;
  border-color: #F26B38 !important;
  color: #f8fafc !important;
  box-shadow: 0 0 0 1px #F26B38 !important;
}

html[data-theme="light"] .gp-result-filter-options button[aria-pressed="true"] {
  background: rgba(242, 107, 56, 0.1) !important;
  border-color: #F26B38 !important;
  color: #F26B38 !important;
  box-shadow: 0 0 0 1px #F26B38 !important;
}

/* Specific Winner / Runner-up tag highlights */
html[data-theme="dark"] .gp-result-filter-options button[data-result-filter="winner"][aria-pressed="true"] {
  background: #064e3b !important;
  border-color: #22c55e !important;
  color: #f8fafc !important;
  box-shadow: 0 0 0 1px #22c55e !important;
}

html[data-theme="light"] .gp-result-filter-options button[data-result-filter="winner"][aria-pressed="true"] {
  background: #dcfce7 !important;
  border-color: #16a34a !important;
  color: #166534 !important;
  box-shadow: 0 0 0 1px #16a34a !important;
}

html[data-theme="dark"] .gp-result-filter-options button[data-result-filter="runner-up"][aria-pressed="true"] {
  background: #78350f !important;
  border-color: #f59e0b !important;
  color: #f8fafc !important;
  box-shadow: 0 0 0 1px #f59e0b !important;
}

html[data-theme="light"] .gp-result-filter-options button[data-result-filter="runner-up"][aria-pressed="true"] {
  background: #fef3c7 !important;
  border-color: #d97706 !important;
  color: #92400e !important;
  box-shadow: 0 0 0 1px #d97706 !important;
}

/* Popular searches chips */
.popular-searches > span {
  color: var(--text-muted);
}

.popular-searches button {
  background: var(--bg-surface) !important;
  border: 1px solid var(--border-control) !important;
  color: var(--text-secondary) !important;
  transition: all 0.15s ease;
}

.popular-searches button:hover {
  background: var(--bg-control-active) !important;
  border-color: var(--border-control-active) !important;
  color: var(--text-active-control) !important;
  transform: translateY(-1px);
}

/* 4. Dropdowns and Select Menus */
.urban-results-controls select,
.urban-results-controls input,
.f-select,
.f-comment-input {
  background-color: var(--bg-surface) !important;
  border: 1px solid var(--border-control) !important;
  color: var(--text-primary) !important;
  border-radius: 12px;
  padding: 11px 14px;
  font: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}

html[data-theme="dark"] .urban-results-controls select,
html[data-theme="dark"] .urban-results-controls input,
html[data-theme="dark"] .f-select,
html[data-theme="dark"] .f-comment-input {
  background-color: #1e293b !important;
  border-color: #344157 !important;
  color: #f8fafc !important;
}

.urban-results-controls select:focus,
.urban-results-controls input:focus,
.f-select:focus,
.f-comment-input:focus {
  border-color: var(--accent-primary) !important;
  box-shadow: var(--focus-ring) !important;
}

/* 5. Pagination and Retry Buttons */
.urban-results-pagination button,
.urban-results-retry,
.dd-step-btn {
  background: var(--bg-control) !important;
  border: 1px solid var(--border-control) !important;
  color: var(--text-primary) !important;
  border-radius: 999px;
  padding: 8px 16px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s ease;
}

.urban-results-pagination button:hover,
.urban-results-retry:hover,
.dd-step-btn:hover {
  background: var(--bg-control-hover) !important;
  border-color: var(--accent-primary) !important;
  color: var(--accent-primary) !important;
  transform: translateY(-1px);
}

.urban-results-pagination button:disabled,
.dd-step-btn:disabled {
  opacity: 0.4 !important;
  cursor: not-allowed !important;
  transform: none !important;
}

.urban-results-retry {
  background: var(--status-error-bg) !important;
  color: var(--status-error) !important;
  border-color: var(--status-error) !important;
}

/* 6. Universal "Back to..." Pill Toggles */
html[data-theme="dark"] .back-toggle-btn,
html[data-theme="dark"] .pc-back,
html[data-theme="dark"] .e22-back,
html[data-theme="dark"] #e19Back,
html[data-theme="dark"] .e19s-back,
html[data-theme="dark"] .e24-back,
html[data-theme="dark"] .local-results-back,
html[data-theme="dark"] .pp-back,
html[data-theme="dark"] #prBack {
  background: rgba(255, 255, 255, 0.08) !important;
  border-color: rgba(255, 255, 255, 0.22) !important;
  color: #f8fafc !important;
}

html[data-theme="dark"] .back-toggle-btn:hover,
html[data-theme="dark"] .pc-back:hover,
html[data-theme="dark"] .e22-back:hover,
html[data-theme="dark"] #e19Back:hover,
html[data-theme="dark"] .e19s-back:hover,
html[data-theme="dark"] .e24-back:hover,
html[data-theme="dark"] .local-results-back:hover,
html[data-theme="dark"] .pp-back:hover,
html[data-theme="dark"] #prBack:hover {
  background: rgba(255, 255, 255, 0.16) !important;
  border-color: #F26B38 !important;
  color: #F26B38 !important;
}

html[data-theme="light"] .back-toggle-btn,
html[data-theme="light"] .pc-back,
html[data-theme="light"] .e22-back,
html[data-theme="light"] #e19Back,
html[data-theme="light"] .e19s-back,
html[data-theme="light"] .e24-back,
html[data-theme="light"] .local-results-back,
html[data-theme="light"] .pp-back,
html[data-theme="light"] #prBack {
  background: #eef2f7 !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}

html[data-theme="light"] .back-toggle-btn:hover,
html[data-theme="light"] .pc-back:hover,
html[data-theme="light"] .e22-back:hover,
html[data-theme="light"] #e19Back:hover,
html[data-theme="light"] .e19s-back:hover,
html[data-theme="light"] .e24-back:hover,
html[data-theme="light"] .local-results-back:hover,
html[data-theme="light"] .pp-back:hover,
html[data-theme="light"] #prBack:hover {
  background: rgba(242, 107, 56, 0.1) !important;
  border-color: #F26B38 !important;
  color: #F26B38 !important;
}

html[data-theme="light"] .back-arrow {
  background: rgba(15, 23, 42, 0.08);
  color: #0f172a;
}

html[data-theme="light"] .back-toggle-btn:hover .back-arrow {
  background: #F26B38;
  color: #ffffff;
}

/* ==========================================================================
   CARDS, PANELS, SURFACES & ELEVATED OVERLAYS
   ========================================================================== */

/* Universal Cards & Containers */
.overview-stat,
.overview-path,
.election-card,
.insight-card,
.feature-card,
.e22-card,
.e22-panel,
.e19-card,
.e19-panel,
.e19s-card,
.e19s-panel,
.e24-card,
.e24-panel,
.urban-results-panel,
.urban-results-stat,
.pc-metric,
.pc-profile-section,
.pr-card,
.pr-section,
.pp-card,
.pp-panel,
.party-rating-card,
.community-stats-box,
.auth-dialog,
.info-dialog {
  background: var(--bg-surface) !important;
  border: 1px solid var(--border-default) !important;
  color: var(--text-primary) !important;
  box-shadow: var(--shadow-sm);
}

html[data-theme="dark"] .overview-stat,
html[data-theme="dark"] .overview-path,
html[data-theme="dark"] .election-card,
html[data-theme="dark"] .insight-card,
html[data-theme="dark"] .feature-card,
html[data-theme="dark"] .e22-card,
html[data-theme="dark"] .e22-panel,
html[data-theme="dark"] .e19-card,
html[data-theme="dark"] .e19-panel,
html[data-theme="dark"] .e19s-card,
html[data-theme="dark"] .e19s-panel,
html[data-theme="dark"] .e24-card,
html[data-theme="dark"] .e24-panel,
html[data-theme="dark"] .urban-results-panel,
html[data-theme="dark"] .urban-results-stat,
html[data-theme="dark"] .pc-metric,
html[data-theme="dark"] .pc-profile-section,
html[data-theme="dark"] .pr-card,
html[data-theme="dark"] .pr-section,
html[data-theme="dark"] .pp-card,
html[data-theme="dark"] .pp-panel,
html[data-theme="dark"] .party-rating-card,
html[data-theme="dark"] .community-stats-box,
html[data-theme="dark"] .auth-dialog,
html[data-theme="dark"] .info-dialog {
  background: #151F32 !important;
  border-color: #344157 !important;
  color: #F8FAFC !important;
}

html[data-theme="light"] .overview-stat,
html[data-theme="light"] .overview-path,
html[data-theme="light"] .election-card,
html[data-theme="light"] .insight-card,
html[data-theme="light"] .feature-card,
html[data-theme="light"] .e22-card,
html[data-theme="light"] .e22-panel,
html[data-theme="light"] .e19-card,
html[data-theme="light"] .e19-panel,
html[data-theme="light"] .e19s-card,
html[data-theme="light"] .e19s-panel,
html[data-theme="light"] .e24-card,
html[data-theme="light"] .e24-panel,
html[data-theme="light"] .urban-results-panel,
html[data-theme="light"] .urban-results-stat,
html[data-theme="light"] .pc-metric,
html[data-theme="light"] .pc-profile-section,
html[data-theme="light"] .pr-card,
html[data-theme="light"] .pr-section,
html[data-theme="light"] .pp-card,
html[data-theme="light"] .pp-panel,
html[data-theme="light"] .party-rating-card,
html[data-theme="light"] .community-stats-box,
html[data-theme="light"] .auth-dialog,
html[data-theme="light"] .info-dialog {
  background: #FFFFFF !important;
  border-color: #D7DFEA !important;
  color: #0F172A !important;
}

.overview-path:hover,
.election-card:hover,
.feature-card:hover {
  border-color: var(--accent-primary) !important;
  transform: translateY(-3px);
  box-shadow: var(--shadow-md) !important;
}

.arrow-btn {
  background: var(--bg-control) !important;
  border: 1px solid var(--border-control) !important;
  color: var(--text-primary) !important;
  cursor: pointer;
  transition: all 0.18s ease;
}

.arrow-btn:hover {
  background: var(--accent-primary) !important;
  border-color: var(--accent-primary) !important;
  color: var(--text-on-accent) !important;
  transform: translateY(-1px);
}

/* ==========================================================================
   LANDING PAGE SECTIONS
   ========================================================================== */

.overview-context,
.search-band,
.page-intro {
  background: var(--bg-page-subtle) !important;
  border-color: var(--border-default) !important;
}

.insights-section,
.lower-grid-section {
  background: var(--bg-page) !important;
}

.newsletter {
  background: var(--bg-surface) !important;
  border: 1px solid var(--border-default) !important;
  color: var(--text-primary) !important;
}

.newsletter .btn-dark {
  background: var(--accent-primary) !important;
  color: var(--text-on-accent) !important;
  border: 1px solid var(--accent-primary) !important;
  font-weight: 800;
}

.newsletter .btn-dark:hover {
  background: var(--accent-hover) !important;
}

.site-footer {
  background: var(--bg-page) !important;
  border-top: 1px solid var(--border-default) !important;
  color: var(--text-muted) !important;
}

.footer-instagram,
.footer-twitter {
  color: var(--text-muted) !important;
}

.footer-instagram:hover {
  color: #E1306C !important;
  background: rgba(225, 48, 108, 0.08) !important;
  border-color: rgba(225, 48, 108, 0.25) !important;
}

.footer-twitter:hover {
  color: #0F1419 !important;
  background: rgba(15, 20, 25, 0.08) !important;
  border-color: rgba(15, 20, 25, 0.25) !important;
}

html[data-theme="dark"] .footer-instagram,
html[data-theme="dark"] .footer-twitter {
  color: #94A3B8 !important;
}

html[data-theme="dark"] .footer-instagram:hover {
  color: #FB7185 !important;
  background: rgba(251, 113, 133, 0.12) !important;
  border-color: rgba(251, 113, 133, 0.3) !important;
}

html[data-theme="dark"] .footer-twitter:hover {
  color: #F8FAFC !important;
  background: rgba(255, 255, 255, 0.12) !important;
  border-color: rgba(255, 255, 255, 0.3) !important;
}

.context-stamp {
  background: var(--bg-surface) !important;
  border: 1px solid var(--border-default) !important;
  color: var(--text-secondary) !important;
}

/* Search Box & Autocomplete Results */
.search-box {
  background: var(--bg-surface) !important;
  border: 1px solid var(--border-default) !important;
  color: var(--text-primary) !important;
}

.search-box:focus-within {
  border-color: var(--accent-primary) !important;
  box-shadow: var(--focus-ring) !important;
}

.search-box input {
  color: var(--text-primary) !important;
}

.search-box input::placeholder {
  color: var(--text-muted) !important;
}

.search-results {
  background: var(--bg-surface-elevated) !important;
  border: 1px solid var(--border-default) !important;
  box-shadow: var(--shadow-lg) !important;
}

.search-results-header {
  background: var(--bg-control) !important;
  border-bottom: 1px solid var(--border-subtle) !important;
  color: var(--text-muted) !important;
}

.search-result-item {
  background: var(--bg-surface-elevated) !important;
  border-bottom: 1px solid var(--border-subtle) !important;
  color: var(--text-primary) !important;
}

.search-result-item:hover,
.search-result-item:focus {
  background: var(--bg-control-hover) !important;
}

.item-name {
  color: var(--text-primary) !important;
}

.item-meta {
  color: var(--text-secondary) !important;
}

.item-submeta {
  color: var(--text-muted) !important;
}

/* Search inputs in overlays */
.e22-search,
.e19-search,
.e24-search {
  background: var(--bg-surface) !important;
  border: 1px solid var(--border-control) !important;
  color: var(--text-primary) !important;
  border-radius: 9px;
  padding: 10px 14px;
}

html[data-theme="dark"] .e22-search,
html[data-theme="dark"] .e19-search,
html[data-theme="dark"] .e24-search {
  background: #1e293b !important;
  border-color: #344157 !important;
  color: #f8fafc !important;
}

.e22-search:focus,
.e19-search:focus,
.e24-search:focus {
  border-color: var(--accent-primary) !important;
  box-shadow: var(--focus-ring) !important;
}

/* ==========================================================================
   FULL-PAGE OVERLAYS & MODAL PAGES
   ========================================================================== */

#election2022FullPage,
#electionParliamentFullPage,
#electionParliamentSegmentResultsPage,
#election2024FullPage,
#localElectionResultsPage,
#politisoFullResults,
.politiso-pc-profile,
#politisoSeatFullPage,
#politisoParliamentFullPage {
  background: var(--bg-page) !important;
  color: var(--text-primary) !important;
}

.e22-top,
.e19-top,
.e19s-top,
.e24-top,
.local-results-top,
.pp-top,
.pr-top,
.pc-profile-top {
  border-bottom: 1px solid var(--border-default) !important;
  color: var(--text-primary) !important;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

html[data-theme="dark"] .e22-top,
html[data-theme="dark"] .e19-top,
html[data-theme="dark"] .e19s-top,
html[data-theme="dark"] .e24-top,
html[data-theme="dark"] .local-results-top,
html[data-theme="dark"] .pp-top,
html[data-theme="dark"] .pr-top,
html[data-theme="dark"] .pc-profile-top,
html[data-theme="dark"] .constituencies-page-top {
  background: #101827 !important;
  border-bottom-color: #344157 !important;
  color: #f8fafc !important;
}

html[data-theme="light"] .e22-top,
html[data-theme="light"] .e19-top,
html[data-theme="light"] .e19s-top,
html[data-theme="light"] .e24-top,
html[data-theme="light"] .local-results-top,
html[data-theme="light"] .pp-top,
html[data-theme="light"] .pr-top,
html[data-theme="light"] .pc-profile-top,
html[data-theme="light"] .constituencies-page-top {
  background: rgba(255, 255, 255, 0.94) !important;
  border-bottom-color: #d7dfea !important;
  color: #0f172a !important;
}

/* Constituencies Full Page Header Text in Light & Dark Mode */
html[data-theme="light"] .constituencies-page-top b {
  color: #0f172a !important;
}
html[data-theme="light"] .constituencies-top-sub {
  color: #64748b !important;
}
html[data-theme="dark"] .constituencies-page-top b {
  color: #f8fafc !important;
}
html[data-theme="dark"] .constituencies-top-sub {
  color: #94a3b8 !important;
}

/* ==========================================================================
   CONSTITUENCY PROFILE (.pc-) THEME RULES
   ========================================================================== */

/* Dark mode */
html[data-theme="dark"] .pc-profile-top h1,
html[data-theme="dark"] .pc-metric strong,
html[data-theme="dark"] .pc-section-head h2,
html[data-theme="dark"] .pc-vote-bar-label b,
html[data-theme="dark"] .pc-vote-bar-row > strong {
  color: #F8FAFC !important;
}

html[data-theme="dark"] .pc-profile-top p,
html[data-theme="dark"] .pc-metric span,
html[data-theme="dark"] .pc-vote-bar-label small,
html[data-theme="dark"] .pc-desc {
  color: #CBD5E1 !important;
}

html[data-theme="dark"] .pc-metric small {
  color: #F26B38 !important;
}

html[data-theme="dark"] .pc-subheading,
html[data-theme="dark"] .pc-data-note,
html[data-theme="dark"] .pc-empty,
html[data-theme="dark"] .pc-muted {
  color: #94A3B8 !important;
}

html[data-theme="dark"] .pc-kicker {
  color: #60A5FA !important;
}

html[data-theme="dark"] .pc-highlight {
  color: #93C5FD !important;
}

/* Light mode */
html[data-theme="light"] .pc-profile-top h1,
html[data-theme="light"] .pc-metric strong,
html[data-theme="light"] .pc-section-head h2,
html[data-theme="light"] .pc-vote-bar-label b,
html[data-theme="light"] .pc-vote-bar-row > strong {
  color: #0F172A !important;
}

html[data-theme="light"] .pc-profile-top p,
html[data-theme="light"] .pc-metric span,
html[data-theme="light"] .pc-vote-bar-label small,
html[data-theme="light"] .pc-desc {
  color: #475569 !important;
}

html[data-theme="light"] .pc-results-table td {
  color: #1E293B !important;
}

html[data-theme="light"] .pc-metric small {
  color: #F26B38 !important;
}

html[data-theme="light"] .pc-subheading {
  color: #334155 !important;
}

html[data-theme="light"] .pc-data-note,
html[data-theme="light"] .pc-empty,
html[data-theme="light"] .pc-muted {
  color: #64748B !important;
}

html[data-theme="light"] .pc-kicker {
  color: #2563EB !important;
}

html[data-theme="light"] .pc-highlight {
  color: #1D4ED8 !important;
}

.e22-kicker,
.e19-kicker,
.e19s-kicker,
.e24-kicker,
.local-results-kicker,
.pp-kicker {
  color: var(--accent-primary) !important;
  font-weight: 800;
}

.e22-sub,
.e19-sub,
.e24-sub,
.local-results-sub,
.pp-muted,
.pc-muted {
  color: var(--text-secondary) !important;
}

.e22-label,
.e19-label,
.e19s-label,
.e24-label,
.pp-label,
.stat-label,
.urban-results-stat-label {
  color: var(--text-muted) !important;
  font-weight: 800;
}

.e22-pill,
.e19-pill,
.e19s-pill,
.e24-pill,
.pc-pill {
  background: var(--bg-control) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-control) !important;
}

/* Secondary CTA buttons (e.g. View Assembly segment results) */
.e19-segments {
  background: var(--bg-control) !important;
  border: 1px solid var(--border-control) !important;
  color: var(--text-primary) !important;
  border-radius: 9px;
  padding: 10px 16px;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  transition: all 0.18s ease;
}

.e19-segments:hover {
  background: var(--bg-control-hover) !important;
  border-color: var(--accent-primary) !important;
  color: var(--accent-primary) !important;
  transform: translateY(-1px);
}

/* ==========================================================================
   DATA TABLES & ROWS
   ========================================================================== */

.e22-table th,
.e19-table th,
.e19s-table th,
.e24-table th,
.pc-results-table th,
.pr-table th,
.urban-results-table th,
.pp-table th {
  background: var(--bg-control) !important;
  color: var(--text-secondary) !important;
  border-bottom: 1px solid var(--border-default) !important;
}

html[data-theme="dark"] .e22-table th,
html[data-theme="dark"] .e19-table th,
html[data-theme="dark"] .e19s-table th,
html[data-theme="dark"] .e24-table th,
html[data-theme="dark"] .pc-results-table th,
html[data-theme="dark"] .pr-table th,
html[data-theme="dark"] .urban-results-table th,
html[data-theme="dark"] .pp-table th {
  background: #1B2940 !important;
  color: #CBD5E1 !important;
  border-bottom-color: #344157 !important;
}

html[data-theme="light"] .e22-table th,
html[data-theme="light"] .e19-table th,
html[data-theme="light"] .e19s-table th,
html[data-theme="light"] .e24-table th,
html[data-theme="light"] .pc-results-table th,
html[data-theme="light"] .pr-table th,
html[data-theme="light"] .urban-results-table th,
html[data-theme="light"] .pp-table th {
  background: #EEF2F7 !important;
  color: #475569 !important;
  border-bottom-color: #D7DFEA !important;
}

.e22-table td,
.e19-table td,
.e19s-table td,
.e24-table td,
.pc-results-table td,
.pr-table td,
.urban-results-table td,
.pp-table td {
  border-bottom: 1px solid var(--border-subtle) !important;
  color: var(--text-primary) !important;
}

html[data-theme="dark"] .e22-table td,
html[data-theme="dark"] .e19-table td,
html[data-theme="dark"] .e19s-table td,
html[data-theme="dark"] .e24-table td,
html[data-theme="dark"] .pc-results-table td,
html[data-theme="dark"] .pr-table td,
html[data-theme="dark"] .urban-results-table td,
html[data-theme="dark"] .pp-table td {
  border-bottom-color: #24334A !important;
  color: #CBD5E1 !important;
}

html[data-theme="light"] .e22-table td,
html[data-theme="light"] .e19-table td,
html[data-theme="light"] .e19s-table td,
html[data-theme="light"] .e24-table td,
html[data-theme="light"] .pc-results-table td,
html[data-theme="light"] .pr-table td,
html[data-theme="light"] .urban-results-table td,
html[data-theme="light"] .pp-table td {
  border-bottom-color: #EEF2F7 !important;
  color: #334155 !important;
}

.e22-table tbody tr:hover,
.e19-table tbody tr:hover,
.e19s-table tbody tr:hover,
.e24-table tbody tr:hover,
.pc-results-table tbody tr:hover,
.pr-table tbody tr:hover,
.urban-results-table tbody tr:hover,
.pp-table tbody tr:hover {
  background: var(--bg-control-hover) !important;
}

.e22-table td:first-child,
.e19-table td:first-child,
.e19s-table td:first-child,
.e24-table td:first-child,
.pc-results-table td:nth-child(2),
.urban-results-table td:first-child {
  font-weight: 700;
  color: var(--text-primary) !important;
}

/* Winner rows */
.pc-results-table tr.pc-winner,
.pr-table tr:first-child {
  background: var(--status-success-bg) !important;
}

/* ==========================================================================
   CHARTS, TRACKS & VISUALIZATIONS
   ========================================================================== */

.e22-track,
.e19-track,
.e19s-track,
.e24-track,
.pc-vote-bar-track,
.pr-bar,
.pp-track,
.c-bar-track,
.bar-track {
  background: var(--bg-control) !important;
  border-radius: 999px;
  overflow: hidden;
}

html[data-theme="dark"] .e22-track,
html[data-theme="dark"] .e19-track,
html[data-theme="dark"] .e19s-track,
html[data-theme="dark"] .e24-track,
html[data-theme="dark"] .pc-vote-bar-track,
html[data-theme="dark"] .pr-bar,
html[data-theme="dark"] .pp-track,
html[data-theme="dark"] .c-bar-track,
html[data-theme="dark"] .bar-track {
  background: #1E293B !important;
}

html[data-theme="light"] .e22-track,
html[data-theme="light"] .e19-track,
html[data-theme="light"] .e19s-track,
html[data-theme="light"] .e24-track,
html[data-theme="light"] .pc-vote-bar-track,
html[data-theme="light"] .pr-bar,
html[data-theme="light"] .pp-track,
html[data-theme="light"] .c-bar-track,
html[data-theme="light"] .bar-track {
  background: #EEF2F7 !important;
}

.donut-hole {
  background: var(--bg-surface) !important;
  color: var(--text-primary) !important;
}

.donut-hole strong {
  color: var(--text-primary) !important;
}

.donut-hole small {
  color: var(--text-muted) !important;
}

.legend > div {
  color: var(--text-secondary) !important;
}

.legend small {
  color: var(--text-muted) !important;
}

.chart-footnote,
.data-note {
  color: var(--text-muted) !important;
}

/* Insight and Callout Boxes */
.e22-insight,
.e19-insight,
.e19s-insight,
.e24-insight,
.local-results-notice {
  border-radius: 14px;
}

html[data-theme="dark"] .e22-insight,
html[data-theme="dark"] .e19-insight,
html[data-theme="dark"] .e19s-insight,
html[data-theme="dark"] .e24-insight,
html[data-theme="dark"] .local-results-notice {
  background: rgba(7, 89, 133, 0.22) !important;
  border: 1px solid rgba(242, 107, 56, 0.22) !important;
  color: #CBD5E1 !important;
}

html[data-theme="dark"] .e22-insight strong,
html[data-theme="dark"] .e19-insight strong,
html[data-theme="dark"] .e19s-insight strong,
html[data-theme="dark"] .e24-insight strong {
  color: #F26B38 !important;
}

html[data-theme="light"] .e22-insight,
html[data-theme="light"] .e19-insight,
html[data-theme="light"] .e19s-insight,
html[data-theme="light"] .e24-insight,
html[data-theme="light"] .local-results-notice {
  background: #E0F2FE !important;
  border: 1px solid #BAE6FD !important;
  color: #F26B38 !important;
}

html[data-theme="light"] .e22-insight strong,
html[data-theme="light"] .e19-insight strong,
html[data-theme="light"] .e19s-insight strong,
html[data-theme="light"] .e24-insight strong {
  color: #F26B38 !important;
}

/* ==========================================================================
   INTERACTIVE LEAFLET MAPS
   ========================================================================== */

.up-assembly-map,
.map-panel {
  background: var(--bg-page-subtle) !important;
}

.up-assembly-map .leaflet-container {
  background: var(--bg-page-subtle) !important;
  outline: none;
}

.leaflet-bar a {
  background: var(--bg-surface) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-control) !important;
}

.leaflet-bar a:hover {
  background: var(--bg-control-hover) !important;
  color: var(--accent-primary) !important;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: var(--bg-surface-elevated) !important;
  color: var(--text-primary) !important;
  box-shadow: var(--shadow-lg) !important;
}

.map-popup strong {
  color: var(--text-primary) !important;
}

.map-popup span {
  color: var(--text-muted) !important;
}

.map-popup button {
  background: var(--accent-primary) !important;
  color: var(--text-on-accent) !important;
  border-radius: 6px;
  font-weight: 800;
  cursor: pointer;
}

#mapSeatSearch {
  background: var(--bg-surface) !important;
  border: 1px solid var(--border-control) !important;
  color: var(--text-primary) !important;
}

#mapReset {
  background: var(--bg-control) !important;
  border: 1px solid var(--border-control) !important;
  color: var(--text-primary) !important;
}

#mapReset:hover {
  background: var(--bg-control-hover) !important;
  border-color: var(--accent-primary) !important;
}

.map-status {
  background: var(--bg-surface-elevated) !important;
  border: 1px solid var(--border-default) !important;
  color: var(--text-secondary) !important;
}

/* ==========================================================================
   DISTRICT DASHBOARD
   ========================================================================== */

#districtDashboard {
  background: var(--bg-surface) !important;
  border-color: var(--border-default) !important;
  color: var(--text-primary) !important;
}

html[data-theme="dark"] #districtDashboard {
  background: #151F32 !important;
  border-color: #344157 !important;
  color: #F8FAFC !important;
}

html[data-theme="light"] #districtDashboard {
  background: #FFFFFF !important;
  border-color: #D7DFEA !important;
  color: #0F172A !important;
}

#districtDashboard .dd-tab-btn.active {
  background: var(--bg-control-active) !important;
  border: 1.5px solid var(--border-control-active) !important;
  color: var(--text-active-control) !important;
}

html[data-theme="light"] #districtDashboard .dd-tab-btn.active {
  background: rgba(242, 107, 56, 0.1) !important;
  border-color: #F26B38 !important;
  color: #F26B38 !important;
}

html[data-theme="dark"] #districtDashboard .dd-tab-btn.active {
  background: #1C2430 !important;
  border-color: #F26B38 !important;
  color: #f8fafc !important;
}

#districtDashboard .dd-party-box {
  background: var(--bg-control) !important;
  border-color: var(--border-control) !important;
}

#districtDashboard .dd-seat-row {
  border-bottom-color: var(--border-subtle) !important;
}

#districtDashboard .dd-badge {
  background: var(--bg-control-active) !important;
  border-color: var(--border-control-active) !important;
  color: var(--text-active-control) !important;
}

#districtDashboard .dd-close-btn {
  background: var(--bg-control) !important;
  border: 1px solid var(--border-control) !important;
  color: var(--text-primary) !important;
}

#districtDashboard .dd-close-btn:hover {
  background: var(--bg-control-hover) !important;
  border-color: var(--border-control-hover) !important;
  color: var(--text-primary) !important;
}

html[data-theme="dark"] #districtDashboard .dd-close-btn {
  background: #1E2D48 !important;
  border: 1px solid #475569 !important;
  color: #F8FAFC !important;
}

html[data-theme="dark"] #districtDashboard .dd-close-btn:hover {
  background: #2B3F63 !important;
  border-color: #64748B !important;
  color: #FFFFFF !important;
}

/* Compact header theme toggle on small screens */
@media (max-width: 540px) {
  .theme-toggle-header {
    min-height: 34px;
    padding: 0 9px;
    margin-right: 6px;
    font-size: 11px;
  }
  .theme-toggle-header .theme-toggle-label {
    display: none;
  }
}

/* ==========================================================================
   COMPREHENSIVE DARK MODE TEXT CONTRAST & ACCESSIBILITY ENHANCEMENTS
   Guarantees high visibility across all sections, headings, cards and tables
   ========================================================================== */

/* 1. Explore & Hero Section */
html[data-theme="dark"] .eyebrow,
html[data-theme="dark"] .section-kicker,
html[data-theme="dark"] .light-kicker {
  color: #94A3B8 !important;
}

html[data-theme="dark"] .eyebrow-line {
  background: #F26B38 !important;
}

html[data-theme="dark"] .hero h1,
html[data-theme="dark"] .hero-content h1 {
  color: #FFFFFF !important;
}

html[data-theme="dark"] .hero h1 em {
  color: #FBBF24 !important;
}

html[data-theme="dark"] .hero-content > p {
  color: #CBD5E1 !important;
}

html[data-theme="dark"] .hero-footnote {
  color: #CBD5E1 !important;
}

html[data-theme="dark"] .foot-sep {
  color: #64748B !important;
}

html[data-theme="dark"] .visual-top {
  color: #CBD5E1 !important;
}

html[data-theme="dark"] .visual-bottom strong {
  color: #FFFFFF !important;
}

html[data-theme="dark"] .visual-bottom strong small {
  color: #94A3B8 !important;
}

/* 2. Overview Context / Uttar Pradesh at a Glance */
html[data-theme="dark"] .overview-context {
  background: #101827 !important;
  border-bottom-color: #344157 !important;
}

html[data-theme="dark"] .overview-context-head h2 {
  color: #F8FAFC !important;
}

html[data-theme="dark"] .overview-context-head p {
  color: #CBD5E1 !important;
}

html[data-theme="dark"] .context-stamp {
  background: #1E293B !important;
  border-color: #344157 !important;
  color: #94A3B8 !important;
}

html[data-theme="dark"] .context-stamp b {
  color: #F8FAFC !important;
}

/* Overview Stat Cards (403, 80, 2027) */
html[data-theme="dark"] .overview-stat {
  background: #151F32 !important;
  border-color: #344157 !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45) !important;
}

html[data-theme="dark"] .overview-stat strong {
  color: #FFFFFF !important;
}

html[data-theme="dark"] .overview-stat b {
  color: #F1F5F9 !important;
  font-weight: 700 !important;
}

html[data-theme="dark"] .overview-stat small {
  color: #94A3B8 !important;
}

html[data-theme="dark"] .overview-stat-icon {
  background: rgba(242, 107, 56, ) !important;
  color: #F26B38 !important;
}

html[data-theme="dark"] .overview-stat-icon.gold {
  background: rgba(245, 158, 11, 0.15) !important;
  color: #FBBF24 !important;
}

html[data-theme="dark"] .overview-stat-icon.green {
  background: rgba(34, 197, 94, 0.15) !important;
  color: #4ADE80 !important;
}

/* Overview Paths (Where would you like to begin?) */
html[data-theme="dark"] .overview-paths-head h3 {
  color: #F8FAFC !important;
}

html[data-theme="dark"] .overview-paths-sub {
  color: #94A3B8 !important;
}

html[data-theme="dark"] .overview-paths-head > span,
html[data-theme="dark"] .overview-paths-meta > span {
  color: #94A3B8 !important;
}

html[data-theme="dark"] .stack-counter-pill {
  background: rgba(242, 107, 56, ) !important;
  border-color: rgba(242, 107, 56, ) !important;
  color: #F26B38 !important;
}

html[data-theme="dark"] .overview-path,
html[data-theme="dark"] .stack-card,
html[data-theme="dark"] .overview-path.stack-card,
html[data-theme="dark"] .election-card.stack-card {
  background: linear-gradient(155deg, #162238 0%, #10192B 100%) !important;
  border-color: #344157 !important;
  box-shadow: 0 22px 48px -18px rgba(0, 0, 0, 0.72), inset 0 1px 0 rgba(255, 255, 255, 0.06) !important;
}

html[data-theme="dark"] .stack-card[data-stack-pos="1"],
html[data-theme="dark"] .overview-path.stack-card[data-stack-pos="1"],
html[data-theme="dark"] .election-card.stack-card[data-stack-pos="1"] {
  background: linear-gradient(155deg, #17243B 0%, #101A2C 100%) !important;
  border-color: #3E4F69 !important;
}

html[data-theme="dark"] .stack-card[data-stack-pos="2"],
html[data-theme="dark"] .overview-path.stack-card[data-stack-pos="2"],
html[data-theme="dark"] .election-card.stack-card[data-stack-pos="2"] {
  background: linear-gradient(155deg, #131E32 0%, #0D1524 100%) !important;
  border-color: #324158 !important;
}

html[data-theme="dark"] .stack-card[data-stack-pos="3"],
html[data-theme="dark"] .overview-path.stack-card[data-stack-pos="3"],
html[data-theme="dark"] .election-card.stack-card[data-stack-pos="3"] {
  background: linear-gradient(155deg, #0F182A 0%, #0A111D 100%) !important;
  border-color: #29364C !important;
}

html[data-theme="dark"] .stack-card[data-stack-pos="0"]:hover,
html[data-theme="dark"] .overview-path.stack-card[data-stack-pos="0"]:hover,
html[data-theme="dark"] .election-card.stack-card[data-stack-pos="0"]:hover {
  background: linear-gradient(155deg, #1A2842 0%, #121D32 100%) !important;
  border-color: #F26B38 !important;
}

html[data-theme="dark"] .stack-card[data-stack-pos="0"][data-accent="gold"]:hover,
html[data-theme="dark"] .overview-path.stack-card[data-stack-pos="0"][data-accent="gold"]:hover,
html[data-theme="dark"] .election-card.stack-card[data-stack-pos="0"][data-accent="gold"]:hover {
  border-color: #FBBF24 !important;
}

html[data-theme="dark"] .stack-card[data-stack-pos="0"][data-accent="orange"]:hover,
html[data-theme="dark"] .overview-path.stack-card[data-stack-pos="0"][data-accent="orange"]:hover,
html[data-theme="dark"] .election-card.stack-card[data-stack-pos="0"][data-accent="orange"]:hover {
  border-color: #FB923C !important;
}

html[data-theme="dark"] .stack-card[data-stack-pos="0"][data-accent="green"]:hover,
html[data-theme="dark"] .overview-path.stack-card[data-stack-pos="0"][data-accent="green"]:hover,
html[data-theme="dark"] .election-card.stack-card[data-stack-pos="0"][data-accent="green"]:hover {
  border-color: #34D399 !important;
}

html[data-theme="dark"] .stack-card[data-stack-pos="0"][data-accent="purple"]:hover,
html[data-theme="dark"] .overview-path.stack-card[data-stack-pos="0"][data-accent="purple"]:hover,
html[data-theme="dark"] .election-card.stack-card[data-stack-pos="0"][data-accent="purple"]:hover {
  border-color: #A78BFA !important;
}

html[data-theme="dark"] .overview-path b,
html[data-theme="dark"] .stack-card b,
html[data-theme="dark"] .overview-path.stack-card b {
  color: #F8FAFC !important;
  font-weight: 700 !important;
}

html[data-theme="dark"] .overview-path small,
html[data-theme="dark"] .stack-card small,
html[data-theme="dark"] .overview-path.stack-card small {
  color: #CBD5E1 !important;
}

html[data-theme="dark"] .stack-card-kicker,
html[data-theme="dark"] .stack-card-hint,
html[data-theme="dark"] .stack-kbd-hint {
  color: #94A3B8 !important;
}

html[data-theme="dark"] .stack-card-pill.blue {
  background: rgba(242, 107, 56, ) !important;
  color: #F26B38 !important;
  border-color: rgba(242, 107, 56, ) !important;
}

html[data-theme="dark"] .stack-card-pill.gold {
  background: rgba(251, 191, 36, 0.14) !important;
  color: #FBBF24 !important;
  border-color: rgba(251, 191, 36, 0.28) !important;
}

html[data-theme="dark"] .stack-card-pill.orange {
  background: rgba(251, 146, 60, 0.14) !important;
  color: #FB923C !important;
  border-color: rgba(251, 146, 60, 0.28) !important;
}

html[data-theme="dark"] .stack-card-pill.green {
  background: rgba(52, 211, 153, 0.14) !important;
  color: #34D399 !important;
  border-color: rgba(52, 211, 153, 0.28) !important;
}

html[data-theme="dark"] .stack-card-pill.purple {
  background: rgba(167, 139, 250, 0.14) !important;
  color: #C4B5FD !important;
  border-color: rgba(167, 139, 250, 0.28) !important;
}

html[data-theme="dark"] .stack-metric {
  background: rgba(15, 23, 42, 0.55) !important;
  border-color: #2A384F !important;
}

html[data-theme="dark"] .stack-metric strong {
  color: #F8FAFC !important;
}

html[data-theme="dark"] .stack-metric span {
  color: #94A3B8 !important;
}

html[data-theme="dark"] .stack-nav-btn {
  background: #151F32 !important;
  border-color: #344157 !important;
  color: #E2E8F0 !important;
}

html[data-theme="dark"] .stack-nav-btn:hover {
  border-color: #F26B38 !important;
  color: #F26B38 !important;
}

html[data-theme="dark"] .stack-rail-item,
html[data-theme="dark"] .rp-tab-btn.stack-rail-item {
  background: #131C2E !important;
  border-color: #2B3950 !important;
  color: #F8FAFC !important;
}

html[data-theme="dark"] .stack-rail-item:hover,
html[data-theme="dark"] .rp-tab-btn.stack-rail-item:hover {
  background: #18243A !important;
  border-color: #F26B38 !important;
}

html[data-theme="dark"] .stack-rail-item.is-active,
html[data-theme="dark"] .rp-tab-btn.stack-rail-item.is-active {
  background: linear-gradient(135deg, #19263E 0%, #141F33 100%) !important;
  border-color: #F26B38 !important;
  color: #F8FAFC !important;
}

html[data-theme="dark"] .stack-rail-item.is-active[data-accent="gold"],
html[data-theme="dark"] .rp-tab-btn.stack-rail-item.is-active[data-accent="gold"] {
  border-color: #FBBF24 !important;
}

html[data-theme="dark"] .stack-rail-item.is-active[data-accent="orange"],
html[data-theme="dark"] .rp-tab-btn.stack-rail-item.is-active[data-accent="orange"] {
  border-color: #FB923C !important;
}

html[data-theme="dark"] .stack-rail-item.is-active[data-accent="green"] {
  border-color: #34D399 !important;
}

html[data-theme="dark"] .stack-rail-item.is-active[data-accent="purple"] {
  border-color: #A78BFA !important;
}

html[data-theme="dark"] .stack-rail-step {
  background: #1E293B !important;
  color: #94A3B8 !important;
}

html[data-theme="dark"] .stack-rail-item.is-active .stack-rail-step {
  background: rgba(242, 107, 56, ) !important;
  color: #F26B38 !important;
}

html[data-theme="dark"] .stack-rail-item.is-active[data-accent="gold"] .stack-rail-step {
  background: rgba(251, 191, 36, 0.18) !important;
  color: #FBBF24 !important;
}

html[data-theme="dark"] .stack-rail-item.is-active[data-accent="orange"] .stack-rail-step {
  background: rgba(251, 146, 60, 0.18) !important;
  color: #FB923C !important;
}

html[data-theme="dark"] .stack-rail-item.is-active[data-accent="green"] .stack-rail-step {
  background: rgba(52, 211, 153, 0.18) !important;
  color: #34D399 !important;
}

html[data-theme="dark"] .stack-rail-item.is-active[data-accent="purple"] .stack-rail-step {
  background: rgba(167, 139, 250, 0.18) !important;
  color: #C4B5FD !important;
}

html[data-theme="dark"] .stack-rail-copy strong {
  color: #F8FAFC !important;
}

html[data-theme="dark"] .stack-rail-copy span {
  color: #94A3B8 !important;
}

html[data-theme="dark"] .stack-rail-launch {
  background: #1E293B !important;
  border-color: #344157 !important;
  color: #94A3B8 !important;
}

html[data-theme="dark"] .stack-rail-item.is-active .stack-rail-launch,
html[data-theme="dark"] .stack-rail-launch:hover {
  color: #0F172A !important;
  background: #F26B38 !important;
}

html[data-theme="dark"] .stack-rail-item.is-active[data-accent="gold"] .stack-rail-launch {
  background: #FBBF24 !important;
}

html[data-theme="dark"] .stack-rail-item.is-active[data-accent="orange"] .stack-rail-launch {
  background: #FB923C !important;
}

html[data-theme="dark"] .stack-rail-item.is-active[data-accent="green"] .stack-rail-launch {
  background: #34D399 !important;
}

html[data-theme="dark"] .stack-rail-item.is-active[data-accent="purple"] .stack-rail-launch {
  background: #A78BFA !important;
}

html[data-theme="dark"] .path-arrow {
  color: inherit !important;
}

html[data-theme="dark"] .path-icon.blue {
  background: rgba(242, 107, 56, ) !important;
  color: #F26B38 !important;
}

html[data-theme="dark"] .path-icon.purple {
  background: rgba(168, 85, 247, 0.15) !important;
  color: #C084FC !important;
}

html[data-theme="dark"] .path-icon.green {
  background: rgba(52, 211, 153, 0.15) !important;
  color: #34D399 !important;
}

html[data-theme="dark"] .path-icon.orange,
html[data-theme="dark"] .path-icon.gold {
  background: rgba(245, 158, 11, 0.15) !important;
  color: #FBBF24 !important;
}

/* Overview Integrity Notice */
html[data-theme="dark"] .overview-integrity {
  background: #151F32 !important;
  border-color: #344157 !important;
}

html[data-theme="dark"] .overview-integrity b {
  color: #F8FAFC !important;
}

html[data-theme="dark"] .overview-integrity p {
  color: #CBD5E1 !important;
}

html[data-theme="dark"] .overview-integrity > span {
  background: rgba(34, 197, 94, 0.18) !important;
  color: #4ADE80 !important;
}

/* 3. Search Band & Popular Searches */
html[data-theme="dark"] .search-band {
  background: #101827 !important;
  border-bottom-color: #344157 !important;
}

html[data-theme="dark"] .search-copy h2 {
  color: #F8FAFC !important;
}

html[data-theme="dark"] .search-copy p {
  color: #CBD5E1 !important;
}

html[data-theme="dark"] .search-box {
  background: #151F32 !important;
  border-color: #344157 !important;
}

html[data-theme="dark"] .search-box input {
  color: #F8FAFC !important;
}

html[data-theme="dark"] .search-box input::placeholder {
  color: #94A3B8 !important;
}

html[data-theme="dark"] .search-box kbd {
  background: #1E293B !important;
  color: #CBD5E1 !important;
  border-color: #344157 !important;
}

html[data-theme="dark"] .popular-searches > span {
  color: #94A3B8 !important;
}

html[data-theme="dark"] .popular-searches button {
  background: #1E293B !important;
  border-color: #344157 !important;
  color: #CBD5E1 !important;
}

html[data-theme="dark"] .popular-searches button:hover {
  background: #263750 !important;
  border-color: #F26B38 !important;
  color: #F8FAFC !important;
}

/* 4. Elections Section & Cards */
html[data-theme="dark"] .section-block {
  background: #0B1220 !important;
}

html[data-theme="dark"] .section-heading h2 {
  color: #F8FAFC !important;
}

html[data-theme="dark"] .section-heading p {
  color: #CBD5E1 !important;
}

html[data-theme="dark"] .text-link {
  color: #F26B38 !important;
}

html[data-theme="dark"] .election-card {
  background: #151F32 !important;
  border-color: #344157 !important;
}

html[data-theme="dark"] .election-card.featured {
  background: #18243A !important;
  border-color: #3A4B64 !important;
}

html[data-theme="dark"] .card-year {
  color: #F8FAFC !important;
}

html[data-theme="dark"] .election-card h3 {
  color: #F8FAFC !important;
}

html[data-theme="dark"] .election-card p {
  color: #CBD5E1 !important;
}

html[data-theme="dark"] .card-footer {
  color: #94A3B8 !important;
  border-top-color: #344157 !important;
}

html[data-theme="dark"] .card-metric strong {
  color: #FBBF24 !important;
}

html[data-theme="dark"] .card-metric span {
  color: #CBD5E1 !important;
}

html[data-theme="dark"] .local-chips span {
  background: #1E293B !important;
  border-color: #344157 !important;
  color: #CBD5E1 !important;
}

html[data-theme="dark"] .local-chips button {
  background: #1E293B !important;
  border-color: #344157 !important;
  color: #F8FAFC !important;
}

html[data-theme="dark"] .local-chips button:hover {
  background: #263750 !important;
  border-color: #F26B38 !important;
  color: #F26B38 !important;
}

html[data-theme="dark"] .arrow-btn {
  background: #1E293B !important;
  border-color: #344157 !important;
  color: #CBD5E1 !important;
}

html[data-theme="dark"] .arrow-btn:hover {
  background: #F26B38 !important;
  border-color: #F26B38 !important;
  color: #0B1220 !important;
}

/* 5. Data Center, Insights & Feature Grids */
html[data-theme="dark"] .page-intro {
  background: #101827 !important;
  border-bottom-color: #344157 !important;
}

html[data-theme="dark"] .page-intro h1 {
  color: #F8FAFC !important;
}

html[data-theme="dark"] .page-intro p {
  color: #CBD5E1 !important;
}

html[data-theme="dark"] .insights-section {
  background: #0B1220 !important;
}

html[data-theme="dark"] .insight-card {
  background: #151F32 !important;
  border-color: #344157 !important;
}

html[data-theme="dark"] .insight-head h3 {
  color: #F8FAFC !important;
}

html[data-theme="dark"] .donut-hole {
  background: #151F32 !important;
}

html[data-theme="dark"] .donut-hole strong {
  color: #F8FAFC !important;
}

html[data-theme="dark"] .donut-hole small {
  color: #94A3B8 !important;
}

html[data-theme="dark"] .legend > div {
  color: #CBD5E1 !important;
}

html[data-theme="dark"] .legend small {
  color: #94A3B8 !important;
}

html[data-theme="dark"] .bar-row {
  color: #CBD5E1 !important;
}

html[data-theme="dark"] .bar-row b {
  color: #94A3B8 !important;
}

html[data-theme="dark"] .axis-labels {
  color: #94A3B8 !important;
  border-bottom-color: #344157 !important;
}

html[data-theme="dark"] .chart-footnote,
html[data-theme="dark"] .data-note {
  color: #94A3B8 !important;
  border-top-color: #344157 !important;
}

html[data-theme="dark"] .feature-card h3 {
  color: #F8FAFC !important;
}

html[data-theme="dark"] .feature-card p {
  color: #CBD5E1 !important;
}

html[data-theme="dark"] .newsletter {
  background: #151F32 !important;
  border-color: #344157 !important;
}

html[data-theme="dark"] .newsletter h2 {
  color: #F8FAFC !important;
}

html[data-theme="dark"] .newsletter p {
  color: #CBD5E1 !important;
}

html[data-theme="dark"] .newsletter-mark {
  background: #1E293B !important;
  border: 1px solid #344157 !important;
}

/* 6. Ratings & Prediction Dark Mode Polish */
html[data-theme="dark"] .rp-tally-majority-pill {
  background: rgba(245, 158, 11, 0.18) !important;
  color: #FBBF24 !important;
  border-color: rgba(245, 158, 11, 0.35) !important;
}

html[data-theme="dark"] .rp-majority-marker {
  background: #F26B38 !important;
  box-shadow: 0 0 10px rgba(242, 107, 56, ) !important;
}

html[data-theme="dark"] .rp-majority-marker::after {
  background: #0B1220 !important;
  color: #F26B38 !important;
  border: 1px solid #F26B38 !important;
}

html[data-theme="dark"] .rp-subnav-bar {
  background: #151F32 !important;
  border-color: #344157 !important;
}

html[data-theme="dark"] .rp-subnav-btn {
  color: #CBD5E1 !important;
}

html[data-theme="dark"] .rp-subnav-btn.active {
  background: rgba(242, 107, 56, 0.22) !important;
  color: #F0F9FF !important;
  border-color: #F26B38 !important;
}

html[data-theme="dark"] .rp-card-stat-pill {
  background: #1E293B !important;
  border-color: #344157 !important;
  color: #F8FAFC !important;
}

html[data-theme="dark"] .rp-top-column {
  background: #151F32 !important;
  border-color: #344157 !important;
}

html[data-theme="dark"] .rp-top-header {
  border-bottom-color: #344157 !important;
}

html[data-theme="dark"] .rp-ranking-card {
  background: #1B2940 !important;
  border-color: #344157 !important;
}

html[data-theme="dark"] .rp-ranking-score-pill {
  color: #F8FAFC !important;
}

html[data-theme="dark"] .rp-ranking-count-note {
  color: #94A3B8 !important;
}

html[data-theme="dark"] .rp-count-badge {
  background: #1E293B !important;
  border-color: #344157 !important;
  color: #F26B38 !important;
}

html[data-theme="dark"] .rp-period-banner {
  background: #151F32 !important;
  border-color: #344157 !important;
  color: #F8FAFC !important;
}

html[data-theme="dark"] .rp-match-hero {
  background: #151F32 !important;
  border-color: #344157 !important;
}

html[data-theme="dark"] .rp-match-circle-card {
  background: #1B2940 !important;
}

html[data-theme="dark"] .rp-match-label {
  color: #CBD5E1 !important;
}

html[data-theme="dark"] .rp-match-metric-box {
  background: #1B2940 !important;
  border: 1px solid #344157 !important;
}

html[data-theme="dark"] .rp-match-metric-box strong {
  color: #F8FAFC !important;
}

html[data-theme="dark"] .rp-match-metric-box span {
  color: #94A3B8 !important;
}

html[data-theme="dark"] .rp-matching-card {
  background: #151F32 !important;
  border-color: #344157 !important;
}

html[data-theme="dark"] .rp-matching-card-title {
  color: #F8FAFC !important;
}

html[data-theme="dark"] .rp-matching-card-meta {
  color: #94A3B8 !important;
}

html[data-theme="dark"] .rp-my-rating-card {
  background: #1B2940 !important;
  border-color: #344157 !important;
}

html[data-theme="dark"] .rp-my-card-name {
  color: #F8FAFC !important;
}

html[data-theme="dark"] .rp-my-card-sub {
  color: #94A3B8 !important;
}

html[data-theme="dark"] .rp-my-card-score {
  color: #F8FAFC !important;
}

html[data-theme="dark"] .rp-my-card-notes {
  color: #CBD5E1 !important;
}

html[data-theme="dark"] .rp-my-card-footer {
  color: #94A3B8 !important;
  border-top-color: #344157 !important;
}

html[data-theme="dark"] .rp-archive-card {
  background: #151F32 !important;
  border-color: #344157 !important;
}

html[data-theme="dark"] .rp-archive-card-title {
  color: #F8FAFC !important;
}

html[data-theme="dark"] .rp-archive-card-dates {
  color: #94A3B8 !important;
}

html[data-theme="dark"] .rp-archive-card-stats {
  color: #CBD5E1 !important;
  border-top-color: #344157 !important;
}

html[data-theme="dark"] .rp-archive-card-action {
  color: #F26B38 !important;
}

html[data-theme="dark"] .rp-back-btn {
  background: #1E293B !important;
  border-color: #344157 !important;
  color: #F8FAFC !important;
}

html[data-theme="dark"] .rp-back-btn:hover {
  background: #263750 !important;
  border-color: #F26B38 !important;
}

html[data-theme="dark"] .rp-disclaimer-banner {
  background: rgba(242, 107, 56, ) !important;
  border-color: rgba(242, 107, 56, ) !important;
  color: #F8FAFC !important;
}

html[data-theme="dark"] .rp-ranking-table {
  background: #151F32 !important;
}

html[data-theme="dark"] .rp-ranking-table th {
  background: #1B2940 !important;
  color: #94A3B8 !important;
  border-bottom-color: #344157 !important;
}

html[data-theme="dark"] .rp-ranking-table td {
  border-bottom-color: #24334A !important;
  color: #F8FAFC !important;
}

html[data-theme="dark"] .rp-ranking-table tr:hover td {
  background: #1E293B !important;
}

html[data-theme="dark"] .rp-seat-card {
  background: #151F32 !important;
  border-color: #344157 !important;
}

html[data-theme="dark"] .rp-seat-name {
  color: #F8FAFC !important;
}

html[data-theme="dark"] .rp-seat-num {
  color: #94A3B8 !important;
}

html[data-theme="dark"] .rp-party-chip {
  background: #1E293B !important;
  border-color: #344157 !important;
  color: #CBD5E1 !important;
}

html[data-theme="dark"] .rp-seat-consensus-box {
  background: #1B2940 !important;
  border-color: #344157 !important;
  color: #CBD5E1 !important;
}

html[data-theme="dark"] .rp-consensus-lead {
  color: #F8FAFC !important;
}

html[data-theme="dark"] .rp-meta-pill {
  background: #1E293B !important;
  border-color: #344157 !important;
  color: #CBD5E1 !important;
}

html[data-theme="dark"] .rp-meta-pill.highlight {
  background: rgba(245, 158, 11, 0.18) !important;
  color: #FBBF24 !important;
  border-color: rgba(245, 158, 11, 0.35) !important;
}

html[data-theme="dark"] .rp-meta-pill.success {
  background: rgba(34, 197, 94, 0.18) !important;
  color: #4ADE80 !important;
  border-color: rgba(34, 197, 94, 0.35) !important;
}

html[data-theme="dark"] .rp-status-badge.winner {
  background: rgba(34, 197, 94, 0.18) !important;
  color: #4ADE80 !important;
  border-color: rgba(34, 197, 94, 0.35) !important;
}

html[data-theme="dark"] .rp-status-badge.runner {
  background: rgba(245, 158, 11, 0.18) !important;
  color: #FBBF24 !important;
  border-color: rgba(245, 158, 11, 0.35) !important;
}

html[data-theme="dark"] .rp-status-badge.independent {
  background: #1E293B !important;
  color: #CBD5E1 !important;
  border-color: #344157 !important;
}

html[data-theme="dark"] .rp-historical-notice {
  background: #1E293B !important;
  color: #94A3B8 !important;
}

/* 7. Dialogs & Modals */
html[data-theme="dark"] .info-dialog {
  background: #151F32 !important;
  border-color: #344157 !important;
  color: #F8FAFC !important;
}

html[data-theme="dark"] .info-dialog h2 {
  color: #F8FAFC !important;
}

html[data-theme="dark"] .info-dialog p {
  color: #CBD5E1 !important;
}

html[data-theme="dark"] .dialog-close {
  background: #1E293B !important;
  color: #CBD5E1 !important;
}

html[data-theme="dark"] .dialog-icon {
  background: rgba(242, 107, 56, ) !important;
  color: #F26B38 !important;
}

/* 8. Full-page Election Overlays */
html[data-theme="dark"] .election2022-full-page,
html[data-theme="dark"] #election2022FullPage,
html[data-theme="dark"] #electionParliamentFullPage,
html[data-theme="dark"] #electionParliamentSegmentResultsPage,
html[data-theme="dark"] #election2024FullPage,
html[data-theme="dark"] #localElectionResultsPage,
html[data-theme="dark"] .politiso-pc-profile {
  background: #0B1220 !important;
  color: #F8FAFC !important;
}

html[data-theme="dark"] .e22-title,
html[data-theme="dark"] .e19-title,
html[data-theme="dark"] .e19s-title,
html[data-theme="dark"] .e24-title,
html[data-theme="dark"] .local-results-title,
html[data-theme="dark"] .pp-title,
html[data-theme="dark"] .pr-title {
  color: #F8FAFC !important;
}

html[data-theme="dark"] .e22-sub,
html[data-theme="dark"] .e19-sub,
html[data-theme="dark"] .e19s-sub,
html[data-theme="dark"] .e24-sub,
html[data-theme="dark"] .local-results-sub,
html[data-theme="dark"] .pp-muted,
html[data-theme="dark"] .pc-muted {
  color: #CBD5E1 !important;
}

html[data-theme="dark"] .e22-number,
html[data-theme="dark"] .e19-number,
html[data-theme="dark"] .e19s-number,
html[data-theme="dark"] .e24-number,
html[data-theme="dark"] .urban-results-stat-num,
html[data-theme="dark"] .pp-big,
html[data-theme="dark"] .pr-big {
  color: #F8FAFC !important;
}

html[data-theme="dark"] .e22-label,
html[data-theme="dark"] .e19-label,
html[data-theme="dark"] .e19s-label,
html[data-theme="dark"] .e24-label,
html[data-theme="dark"] .urban-results-stat-label,
html[data-theme="dark"] .pp-label {
  color: #94A3B8 !important;
}

html[data-theme="dark"] .e22-note,
html[data-theme="dark"] .e19-note,
html[data-theme="dark"] .e19s-note,
html[data-theme="dark"] .e24-note,
html[data-theme="dark"] .urban-results-stat-note {
  color: #94A3B8 !important;
}

html[data-theme="dark"] .e22-panel h2,
html[data-theme="dark"] .e19-panel h2,
html[data-theme="dark"] .e24-panel h2,
html[data-theme="dark"] .urban-results-panel h2,
html[data-theme="dark"] .pp-section h2 {
  color: #F8FAFC !important;
}

html[data-theme="dark"] .e22-panel > p,
html[data-theme="dark"] .e19-panel > p,
html[data-theme="dark"] .e24-panel > p,
html[data-theme="dark"] .urban-results-panel > p {
  color: #CBD5E1 !important;
}

html[data-theme="dark"] .e22-source,
html[data-theme="dark"] .e19-source,
html[data-theme="dark"] .e24-source,
html[data-theme="dark"] .local-results-source {
  color: #94A3B8 !important;
}

html[data-theme="dark"] .e22-row,
html[data-theme="dark"] .e19-row,
html[data-theme="dark"] .e24-row,
html[data-theme="dark"] .pp-bar-row {
  color: #F8FAFC !important;
}

html[data-theme="dark"] .e22-row b,
html[data-theme="dark"] .e19-row b,
html[data-theme="dark"] .e24-row b {
  color: #F8FAFC !important;
}

html[data-theme="dark"] .pp-bar-row small {
  color: #94A3B8 !important;
}

html[data-theme="dark"] .e22-pill,
html[data-theme="dark"] .e19-pill,
html[data-theme="dark"] .e24-pill {
  background: #1E293B !important;
  color: #CBD5E1 !important;
  border: 1px solid #344157 !important;
}

/* Local Election Results Overlays */
html[data-theme="dark"] .urban-results-heading {
  color: #F8FAFC !important;
}

html[data-theme="dark"] .urban-results-caption {
  color: #CBD5E1 !important;
}

html[data-theme="dark"] .urban-results-stat-value {
  color: #F8FAFC !important;
}

html[data-theme="dark"] .urban-results-toolbar {
  background: #1B2940 !important;
  border-bottom-color: #344157 !important;
}

html[data-theme="dark"] .urban-results-summary {
  background: #151F32 !important;
  border-bottom-color: #344157 !important;
}

html[data-theme="dark"] .urban-results-table th {
  background: #1B2940 !important;
  color: #94A3B8 !important;
  border-bottom-color: #344157 !important;
}

html[data-theme="dark"] .urban-results-table td {
  border-bottom-color: #24334A !important;
  color: #CBD5E1 !important;
}

html[data-theme="dark"] .urban-results-table td:first-child {
  color: #F8FAFC !important;
}

html[data-theme="dark"] .urban-results-table tbody tr:hover {
  background: #1E293B !important;
}

html[data-theme="dark"] .urban-results-footer {
  background: #151F32 !important;
  color: #94A3B8 !important;
  border-top-color: #344157 !important;
}

html[data-theme="dark"] .urban-results-pagination button,
html[data-theme="dark"] .urban-results-retry {
  background: #1E293B !important;
  border-color: #344157 !important;
  color: #F8FAFC !important;
}

html[data-theme="dark"] .urban-results-pagination button:hover,
html[data-theme="dark"] .urban-results-retry:hover {
  background: #263750 !important;
  border-color: #F26B38 !important;
}

html[data-theme="dark"] .local-results-tabs {
  background: #151F32 !important;
  border-color: #344157 !important;
}

html[data-theme="dark"] .local-results-tabs button {
  color: #CBD5E1 !important;
}

html[data-theme="dark"] .local-results-tabs button[aria-pressed="true"] {
  background: rgba(242, 107, 56, 0.22) !important;
  color: #F0F9FF !important;
  border-color: #F26B38 !important;
}

html[data-theme="dark"] .gp-result-filters {
  background: #151F32 !important;
  border-color: #344157 !important;
}

html[data-theme="dark"] .gp-result-filter-label {
  color: #94A3B8 !important;
}

html[data-theme="dark"] .gp-result-filter-options button {
  background: #1E293B !important;
  border-color: #344157 !important;
  color: #CBD5E1 !important;
}

html[data-theme="dark"] .gp-result-filter-options button:hover {
  background: #263750 !important;
  border-color: #F26B38 !important;
  color: #F8FAFC !important;
}

/* Dark Mode: Constituencies Explorer & Search */
html[data-theme="dark"] .constituencies-full-page {
  background: #0b1220 !important;
  color: #f8fafc !important;
}

html[data-theme="dark"] .card-icon.purple {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.22), rgba(147, 51, 234, 0.35)) !important;
  color: #c084fc !important;
  box-shadow: 0 2px 8px rgba(147, 51, 234, 0.25) !important;
}

html[data-theme="dark"] .tag-purple {
  background: rgba(168, 85, 247, 0.18) !important;
  color: #d8b4fe !important;
  border-color: rgba(168, 85, 247, 0.32) !important;
}

html[data-theme="dark"] .search-results-header {
  background: rgba(15, 23, 42, 0.85) !important;
  border-bottom-color: rgba(255, 255, 255, 0.08) !important;
  color: #94a3b8 !important;
}

html[data-theme="dark"] .search-result-item {
  border-bottom-color: rgba(255, 255, 255, 0.07) !important;
}

html[data-theme="dark"] .search-result-item:hover,
html[data-theme="dark"] .search-result-item:focus-visible {
  background: rgba(255, 255, 255, 0.06) !important;
}

html[data-theme="dark"] .search-result-item .item-name {
  color: #f8fafc !important;
}

html[data-theme="dark"] .search-result-item .item-meta {
  color: #cbd5e1 !important;
}

html[data-theme="dark"] .search-result-item .item-submeta {
  color: #94a3b8 !important;
}

html[data-theme="dark"] .search-cat-pill {
  background: #1e293b !important;
  border-color: #344157 !important;
  color: #cbd5e1 !important;
}

html[data-theme="dark"] .search-cat-pill:hover {
  background: #263750 !important;
  border-color: #F26B38 !important;
  color: #f8fafc !important;
}

html[data-theme="dark"] .search-cat-pill.active {
  background: #F26B38 !important;
  border-color: #F26B38 !important;
  color: #fff !important;
}

html[data-theme="dark"] .item-map-btn {
  background: rgba(242, 107, 56, ) !important;
  border-color: rgba(242, 107, 56, ) !important;
  color: #F26B38 !important;
}

html[data-theme="dark"] .item-map-btn:hover {
  background: #F26B38 !important;
  color: #fff !important;
}

/* Dark mode: Victory margin filters & graphics */
html[data-theme="dark"] .e22-filter-bar,
html[data-theme="dark"] .e19-filter-bar {
  background: #142237 !important;
  border-color: #273b5a !important;
}

html[data-theme="dark"] .e22-filter-tag,
html[data-theme="dark"] .e19-filter-tag {
  color: #94a3b8 !important;
}

html[data-theme="dark"] .e22-margin-btn,
html[data-theme="dark"] .e19-margin-btn {
  background: #1e293b !important;
  border-color: #344157 !important;
  color: #f8fafc !important;
}

html[data-theme="dark"] .e22-margin-btn:hover,
html[data-theme="dark"] .e19-margin-btn:hover {
  background: #263750 !important;
  border-color: #F26B38 !important;
  color: #f8fafc !important;
}

html[data-theme="dark"] .e22-margin-btn.active,
html[data-theme="dark"] .e19-margin-btn.active {
  background: #F26B38 !important;
  border-color: #F26B38 !important;
  color: #ffffff !important;
}

html[data-theme="dark"] .e22-margin-btn .pill-count,
html[data-theme="dark"] .e19-margin-btn .pill-count {
  background: rgba(255, 255, 255, 0.18) !important;
  color: #ffffff !important;
}

html[data-theme="dark"] .e22-mstat-card,
html[data-theme="dark"] .e19-mstat-card {
  background: #142237 !important;
  border-color: #273b5a !important;
}

html[data-theme="dark"] .e22-mstat-label,
html[data-theme="dark"] .e19-mstat-label {
  color: #94a3b8 !important;
}

html[data-theme="dark"] .e22-mstat-val,
html[data-theme="dark"] .e19-mstat-val {
  color: #f8fafc !important;
}

html[data-theme="dark"] .e22-mstat-note,
html[data-theme="dark"] .e19-mstat-note {
  color: #cbd5e1 !important;
}

html[data-theme="dark"] .margin-badge-high {
  background: #064e3b !important;
  color: #6ee7b7 !important;
  border-color: #047857 !important;
}

html[data-theme="dark"] .margin-badge-mid {
  background: #0c4a6e !important;
  color: #FF7D4D !important;
  border-color: #F26B38 !important;
}

html[data-theme="dark"] .margin-badge-narrow {
  background: #4c0519 !important;
  color: #fda4af !important;
  border-color: #9f1239 !important;
}

html[data-theme="dark"] .e22-margin-track,
html[data-theme="dark"] .e19-margin-track {
  background: #1e2e48 !important;
}

html[data-theme="dark"] .e22-action-btn,
html[data-theme="dark"] .e19-action-btn {
  background: #1e293b !important;
  border-color: #344157 !important;
  color: #f8fafc !important;
}

html[data-theme="dark"] .e22-action-btn:hover,
html[data-theme="dark"] .e19-action-btn:hover {
  background: #263750 !important;
  border-color: #F26B38 !important;
  color: #F26B38 !important;
}

html[data-theme="dark"] .e22-page-btn,
html[data-theme="dark"] .e19-page-btn {
  background: #1e293b !important;
  border-color: #344157 !important;
  color: #f8fafc !important;
}
