/* Elections Stats – Dark Mode (aktiv nur bei html[data-theme="dark"]) */
html[data-theme="dark"]{
  color-scheme: dark;
  --d-bg:#05080f; --ec-fade:5,8,15;
  --d-card-a:rgba(35,41,63,0.92); --d-card-b:rgba(27,32,51,0.90);
  --d-bar-a:rgba(46,53,80,0.92);  --d-bar-b:rgba(37,43,67,0.90);
  --d-text:#fff; --d-muted:#b8c0ee; --d-accent:#fff;
  --d-tint:rgba(255,255,255,0.09); --d-tint2:rgba(255,255,255,0.16);
  --d-line:rgba(255,255,255,0.15);
  --d-shadow:0 4px 16px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.10);
  --d-btn:linear-gradient(180deg,#3d36c4 0%,#5a52e0 100%);
}
html[data-theme="dark"] body{ background-color:var(--d-bg); color:var(--d-text); }

/* Glas-Karten */
html[data-theme="dark"] .header,
html[data-theme="dark"] .esas-title-bar::before,
html[data-theme="dark"] .esas-card::before,
html[data-theme="dark"] .esas-seats-col::before,
html[data-theme="dark"] .esas-home-live-btn::before,
html[data-theme="dark"] .ec-notice,
html[data-theme="dark"] .ec-table{ background:linear-gradient(180deg,var(--d-card-a) 0%,var(--d-card-b) 100%); }
html[data-theme="dark"] .nav,
html[data-theme="dark"] .footer,
html[data-theme="dark"] .esas-clear-btn,
html[data-theme="dark"] .esas-watch-placeholder{ background:linear-gradient(180deg,var(--d-bar-a) 0%,var(--d-bar-b) 100%); }
html[data-theme="dark"] .header,
html[data-theme="dark"] .nav,
html[data-theme="dark"] .footer,
html[data-theme="dark"] .esas-card,
html[data-theme="dark"] .esas-seats-col,
html[data-theme="dark"] .esas-home-live-btn,
html[data-theme="dark"] .ec-notice,
html[data-theme="dark"] .ec-table,
html[data-theme="dark"] .ec-preview-clip{ box-shadow:var(--d-shadow); border-color:var(--d-line); }

/* Texte */
html[data-theme="dark"] .nav-link-inner,
html[data-theme="dark"] .nav-toggle-label,
html[data-theme="dark"] .ec-title,
html[data-theme="dark"] .ec-notice-text,
html[data-theme="dark"] .ec-table tr.month-row td,
html[data-theme="dark"] .ec-search-toggle-mobile,
html[data-theme="dark"] .esas-strength-party-select,
html[data-theme="dark"] .esas-strength-extreme-btn,
html[data-theme="dark"] .esas-vote-info,
html[data-theme="dark"] .esas-clear-btn{ color:var(--d-accent); }
html[data-theme="dark"] .esas-home-live-title,
html[data-theme="dark"] .esas-home-live-subtitle,
html[data-theme="dark"] .ec-table tbody tr.data-row td,
html[data-theme="dark"] .esas-country-name,
html[data-theme="dark"] .esas-election-title,
html[data-theme="dark"] .esas-status-field.is-counting,
html[data-theme="dark"] .esas-status-field.is-preliminary,
html[data-theme="dark"] .esas-pf-position,
html[data-theme="dark"] .esas-pf-value-num,
html[data-theme="dark"] .esas-pf-value-prev,
html[data-theme="dark"] .esas-vote-btn,
html[data-theme="dark"] .esas-lead-explain-close,
html[data-theme="dark"] .esas-diagram-title,
html[data-theme="dark"] .esas-dr-label,
html[data-theme="dark"] .esas-dr-subhead,
html[data-theme="dark"] #esasDetailedResultsParties th,
html[data-theme="dark"] .esas-exitpoll-subtitle,
html[data-theme="dark"] .esas-exitpoll-gauge-title,
html[data-theme="dark"] .esas-wk-placeholder,
html[data-theme="dark"] .esas-wk-result-header,
html[data-theme="dark"] .esas-wk-result-close,
html[data-theme="dark"] .esas-wk-result-title,
html[data-theme="dark"] .esas-wk-result-source,
html[data-theme="dark"] .esas-polls-source,
html[data-theme="dark"] .esas-seats-source,
html[data-theme="dark"] .esas-polls-hint,
html[data-theme="dark"] .esas-polls-info-date,
html[data-theme="dark"] .esas-lead-source,
html[data-theme="dark"] .esas-watch-placeholder,
html[data-theme="dark"] .esas-section-intro,
html[data-theme="dark"] .esas-detailed-results td,
html[data-theme="dark"] .esas-detailed-results th{ color:var(--d-text); }
html[data-theme="dark"] .esas-strength-legend-labels,
html[data-theme="dark"] .esas-vote-explain,
html[data-theme="dark"] .esas-polls-info-source,
html[data-theme="dark"] .esas-party-chip,
html[data-theme="dark"] .esas-watch-text{ color:var(--d-muted); }
html[data-theme="dark"] .esas-party-chip.is-active,
html[data-theme="dark"] .esas-vote-btn.is-active,
html[data-theme="dark"] .esas-orientation-btn.is-active{ color:#fff; }

/* Tönungen / Flächen / Linien */
html[data-theme="dark"] .social-link:hover{ background:var(--d-tint); }
html[data-theme="dark"] .esas-vote-btn,
html[data-theme="dark"] .esas-strength-party-select,
html[data-theme="dark"] .esas-strength-extreme-btn,
html[data-theme="dark"] .esas-dr-label{ background:var(--d-tint); }
html[data-theme="dark"] .esas-vote-btn:hover,
html[data-theme="dark"] .esas-strength-extreme-btn:hover{ background:var(--d-tint2); }
html[data-theme="dark"] .esas-vote-info,
html[data-theme="dark"] .esas-orientation-btn{ background:var(--d-tint2); }
html[data-theme="dark"] .esas-orientation-btn{ color:var(--d-muted); }
html[data-theme="dark"] .esas-vote-explain,
html[data-theme="dark"] .esas-dr-subhead{ background:var(--d-tint); }
html[data-theme="dark"] .esas-vote-btn.is-active,
html[data-theme="dark"] .esas-orientation-btn.is-active,
html[data-theme="dark"] .ec-notice-cta,
html[data-theme="dark"] .ec-preview-cta,
html[data-theme="dark"] .nav-link:hover .nav-link-inner,
html[data-theme="dark"] .nav-link.active .nav-link-inner{ background:var(--d-btn); }
html[data-theme="dark"] .esas-detailed-results th,
html[data-theme="dark"] .esas-detailed-results td{ border-color:var(--d-line); }
html[data-theme="dark"] .esas-exitpoll-col + .esas-exitpoll-col,
html[data-theme="dark"] .esas-wk-results{ border-color:var(--d-line); }
html[data-theme="dark"] .ec-table tbody tr.data-row{ border-bottom-color:var(--d-line); }
html[data-theme="dark"] .ec-table tbody tr.data-row:hover{ background-color:var(--d-tint); }
html[data-theme="dark"] .esas-wk-search-panel{ background:#1a2454; }
html[data-theme="dark"] .esas-wk-search-input{ background:#121a44; color:var(--d-text); border-color:var(--d-line); }
html[data-theme="dark"] .esas-wk-search-result{ color:var(--d-text); }
html[data-theme="dark"] .esas-wk-search-result-sub,
html[data-theme="dark"] .esas-wk-search-empty{ color:var(--d-muted); }
html[data-theme="dark"] .nav-toggle-icon span{ background:var(--d-accent); }

/* Symbole & Logo: blaue PNGs -> hell */
html[data-theme="dark"] .social-link img,
html[data-theme="dark"] .header-left img.logo{ filter:invert(1) hue-rotate(180deg) brightness(1.15); }

html[data-theme="dark"] .ec-table tr.month-row td{ background:linear-gradient(180deg,var(--d-bar-a) 0%,var(--d-bar-b) 100%); color:var(--d-accent); }


/* Trennstrich + Umschalter (Sonne/Mond) */
.es-theme-sep{ width:1px; height:26px; background:rgba(6,0,112,0.3); margin:0 6px; flex:none; }
html[data-theme="dark"] .es-theme-sep{ background:rgba(255,255,255,0.4); }
.es-theme-switch{ position:relative; flex:none; width:62px; height:32px; border-radius:16px; padding:0; cursor:pointer;
  border:1px solid rgba(6,0,112,0.3); background:rgba(6,0,112,0.08); transition:background .2s, border-color .2s; }
.es-theme-switch .es-knob{ position:absolute; top:3px; left:3px; width:24px; height:24px; border-radius:50%;
  background:#060070; transition:transform .22s ease, background .2s; }
.es-theme-switch svg{ position:absolute; top:7px; width:16px; height:16px; z-index:1; }
.es-theme-switch .es-ico-sun{ left:7px; color:#fff; }
.es-theme-switch .es-ico-moon{ right:7px; color:#060070; }
html[data-theme="dark"] .es-theme-switch{ border-color:rgba(255,255,255,0.35); background:rgba(255,255,255,0.10); }
html[data-theme="dark"] .es-theme-switch .es-knob{ transform:translateX(30px); background:#5a52e0; }
html[data-theme="dark"] .es-theme-switch .es-ico-sun{ color:#fff; }
html[data-theme="dark"] .es-theme-switch .es-ico-moon{ color:#fff; }
@media (max-width:650px){ .es-theme-sep{ margin:0 3px; } }

/* Weiß statt Blau-Grau */
html[data-theme="dark"] .esas-status-field.is-counting,
html[data-theme="dark"] .esas-strength-legend-labels,
html[data-theme="dark"] .esas-vote-explain,
html[data-theme="dark"] .esas-polls-info-source,
html[data-theme="dark"] .esas-party-chip,
html[data-theme="dark"] .esas-watch-text,
html[data-theme="dark"] .esas-section-intro,
html[data-theme="dark"] .esas-wk-result-source,
html[data-theme="dark"] .esas-wk-result-title,
html[data-theme="dark"] .esas-wk-result-header,
html[data-theme="dark"] .esas-wk-result-bars,
html[data-theme="dark"] .esas-wk-results{ color:#fff; }

/* Weiß: Logo-Schrift, Footer, Last updated, Hinweise */
html[data-theme="dark"] .header-left h1,
html[data-theme="dark"] .footer,
html[data-theme="dark"] .footer-links a,
html[data-theme="dark"] .footer-links span,
html[data-theme="dark"] .esas-last-updated,
html[data-theme="dark"] .esas-seats-bloc-hint,
html[data-theme="dark"] .esas-wk-attribution{ color:#fff; }
html[data-theme="dark"] .header-left img.logo{ filter:brightness(0) invert(1); }

/* Wahlkreis-Ergebnisse: Werte rechts neben den Balken weiß (inline-Farbe überschreiben) */
html[data-theme="dark"] .esas-wk-results .esas-bv-new,
html[data-theme="dark"] .esas-wk-results .esas-bv-old{ color:#fff !important; }

/* Preliminary-Feld: Text schwarz */
html[data-theme="dark"] .esas-status-field.is-preliminary{ color:#000; }

/* Vergleichswerte (Vorwahl) an den Balken weiß */
html[data-theme="dark"] .esas-bv-old{ color:#fff !important; }

/* Mobil: Umschalter neben "Elections Stats" statt in der (einklappenden) Icon-Zeile */
@media (max-width:650px){
  .header-left .es-theme-sep{ margin:0 5px; height:24px; }
  .header-left .es-theme-switch{ margin-left:0; }
}
@media (max-width:650px){
  html[data-theme] .header-left{ gap:8px; }
  html[data-theme] .header-left a{ gap:8px !important; }
  html[data-theme] .header{ padding-left:10px; padding-right:10px; }
  html[data-theme] .header-left h1{ white-space:nowrap; }
  html[data-theme] .header-left .es-theme-switch{ margin-left:0; width:56px; height:30px; }
  html[data-theme] .header-left .es-theme-switch .es-knob{ width:22px; height:22px; }
  html[data-theme="dark"] .header-left .es-theme-switch .es-knob{ transform:translateX(26px); }
  html[data-theme] .header-left .es-theme-switch svg{ top:6px; width:15px; height:15px; }
  html[data-theme] .header-left .es-theme-switch .es-ico-sun{ left:6px; }
  html[data-theme] .header-left .es-theme-switch .es-ico-moon{ right:6px; }
}

/* Politische Position bei den waagrechten Balken + Detailtabelle */
html[data-theme="dark"] .esas-mobile-pos,
html[data-theme="dark"] .esas-dr-party-position,
html[data-theme="dark"] .esas-dr-party-position-inner{ color:#fff !important; }

/* Navigation: Schrift weiß */
html[data-theme="dark"] .nav-link-inner,
html[data-theme="dark"] .nav-toggle-label{ color:#fff; }
html[data-theme="dark"] .nav-toggle-icon span{ background:#fff; }

/* Umschalter Darkmode: weißer Kreis hinter dem aktiven Modus, Striche voll weiß bzw. dunkel auf Weiß */
html[data-theme="dark"] .es-theme-switch .es-knob{ background:#fff; }
html[data-theme="dark"] .es-theme-switch .es-ico-moon{ color:#060070; }
html[data-theme="dark"] .es-theme-switch .es-ico-sun{ color:#fff; }

/* Umfragen: Info-Box beim Anklicken */
html[data-theme="dark"] .esas-polls-info-box{ background:#2b3050; border-color:rgba(255,255,255,0.28) !important; box-shadow:0 10px 34px rgba(0,0,0,0.55), 0 2px 12px rgba(0,0,0,0.3); }
html[data-theme="dark"] .esas-polls-info-date,
html[data-theme="dark"] .esas-polls-info-source{ color:#fff !important; }

html[data-theme="dark"] .esas-polls-info-box{ background:#2b3050; }
html[data-theme="dark"] .esas-wk-search-panel{ background:#212639; }
html[data-theme="dark"] .esas-wk-search-input{ background:#141826; }

/* Detailergebnisse: volle Parteinamen */
html[data-theme="dark"] .esas-dr-party-fullname{ color:#fff !important; }

/* Überschriften und Titel immer weiß */
html[data-theme="dark"] h1,html[data-theme="dark"] h2,html[data-theme="dark"] h3,
html[data-theme="dark"] h4,html[data-theme="dark"] h5,html[data-theme="dark"] h6,
html[data-theme="dark"] .ec-title,
html[data-theme="dark"] .ec-table tr.month-row td,
html[data-theme="dark"] .ec-notice-text,
html[data-theme="dark"] .esas-diagram-title,
html[data-theme="dark"] .esas-section-title,
html[data-theme="dark"] .esas-strength-party-select,
html[data-theme="dark"] .esas-strength-extreme-btn,
html[data-theme="dark"] .esas-vote-info,
html[data-theme="dark"] .esas-clear-btn{ color:#fff !important; }

/* ── Textseiten: Impressum, Datenschutz, Kontakt ── */
html[data-theme="dark"] .imprint-box,
html[data-theme="dark"] .privacy-box,
html[data-theme="dark"] .contact-box{ background:linear-gradient(180deg,var(--d-card-a) 0%,var(--d-card-b) 100%); box-shadow:var(--d-shadow); border:1px solid var(--d-line); }
html[data-theme="dark"] .imprint-title,
html[data-theme="dark"] .privacy-title,
html[data-theme="dark"] .contact-title,
html[data-theme="dark"] .imprint-section h2,
html[data-theme="dark"] .privacy-section h2,
html[data-theme="dark"] .form-group label,
html[data-theme="dark"] .imprint-section p,
html[data-theme="dark"] .privacy-section p,
html[data-theme="dark"] .imprint-section li,
html[data-theme="dark"] .privacy-section li,
html[data-theme="dark"] .imprint-section strong,
html[data-theme="dark"] .privacy-section strong{ color:#fff; }
html[data-theme="dark"] .imprint-section h2,
html[data-theme="dark"] .privacy-section h2{ border-bottom-color:var(--d-line); }
html[data-theme="dark"] .imprint-section a,
html[data-theme="dark"] .privacy-section a{ color:#fff; text-decoration:underline; }
html[data-theme="dark"] .form-group input,
html[data-theme="dark"] .form-group textarea{ background:rgba(255,255,255,0.08); color:#fff; border-color:var(--d-line); }
html[data-theme="dark"] .form-group input::placeholder,
html[data-theme="dark"] .form-group textarea::placeholder{ color:rgba(255,255,255,0.55); }
html[data-theme="dark"] .form-group input:focus,
html[data-theme="dark"] .form-group textarea:focus{ background:rgba(255,255,255,0.12); border-color:#fff; }
html[data-theme="dark"] .form-message.success{ background:rgba(46,125,50,0.25); color:#b9f6ca; border-color:rgba(165,214,167,0.5); }
html[data-theme="dark"] .form-message.error{ background:rgba(192,57,43,0.25); color:#ffb4ab; border-color:rgba(245,198,203,0.5); }
html[data-theme="dark"] .ec-notice-wrap td,
html[data-theme="dark"] .ec-wrapper td,
html[data-theme="dark"] .ec-note-row td{ color:#fff !important; }

/* ── Ältere Seiten (ets-…) und Länderübersicht ── */
html[data-theme="dark"] .ctry-card,
html[data-theme="dark"] .ets-header-bar,
html[data-theme="dark"] .ets-status-card,
html[data-theme="dark"] .ets-canvas-card,
html[data-theme="dark"] .ets-seats-card,
html[data-theme="dark"] .ets-results-card{ background:linear-gradient(180deg,var(--d-card-a) 0%,var(--d-card-b) 100%); box-shadow:var(--d-shadow); border-color:var(--d-line); }
html[data-theme="dark"] .ctry-card,
html[data-theme="dark"] .ctry-card *,
html[data-theme="dark"] .ets-election-title,
html[data-theme="dark"] .ets-country-name,
html[data-theme="dark"] .ets-refresh-meta,
html[data-theme="dark"] .ets-results-card td,
html[data-theme="dark"] .ets-results-card th{ color:#fff; }
html[data-theme="dark"] .ets-results-card td,
html[data-theme="dark"] .ets-results-card th,
html[data-theme="dark"] .ets-results-party-cell{ background:transparent; border-color:var(--d-line); }
html[data-theme="dark"] .ets-header-bar a,
html[data-theme="dark"] .ets-election-nav a{ color:#fff; }
html[data-theme="dark"] .ets-diagram-title,
html[data-theme="dark"] .ets-chip-name,
html[data-theme="dark"] .ets-chip-seats{ color:#fff; }

/* Header-Symbole und Menü: voll weiß */
html[data-theme="dark"] .social-link img{ filter:grayscale(1) invert(1) brightness(6); }
html[data-theme="dark"] .header-left h1,
html[data-theme="dark"] .nav a,
html[data-theme="dark"] .nav-link-inner,
html[data-theme="dark"] .nav-toggle-label,
html[data-theme="dark"] .nav-toggle{ color:#fff !important; }
html[data-theme="dark"] .nav-toggle-icon span{ background:#fff !important; }
html[data-theme="dark"] .nav img,
html[data-theme="dark"] .nav svg{ filter:brightness(0) invert(1); }

/* Logo und Titel im Header: sicher weiß */
html[data-theme="dark"] .header-left h1,
html[data-theme="dark"] .header-left a{ color:#fff !important; -webkit-text-fill-color:#fff; }
html[data-theme="dark"] .header-left img.logo{ filter:brightness(0) invert(1) !important; opacity:1 !important; }

/* Election Calendar: Monatszeilen heller, Hinweiszeile dunkler, Vorschau-Verlauf zur Seitenfarbe */
html[data-theme="dark"] .ec-table tr.month-row td{ background:linear-gradient(180deg,rgba(88,97,142,0.98) 0%,rgba(74,82,125,0.98) 100%); }
html[data-theme="dark"] .ec-table tr.ec-note-row td{ background:linear-gradient(180deg,rgba(18,22,38,0.98) 0%,rgba(12,15,28,0.98) 100%); }
