/* Shared dashboard surfaces. Map geometry, visibility and layer colours stay native. */
:root[data-dashboard-theme] {
  color-scheme: light;
  --ui-paper: #f7f5ef;
  --ui-surface: #fffdf8;
  --ui-text: #292b28;
  --ui-muted: #62645e;
  --ui-line: #d2d0c7;
  --ui-accent: #486653;
  --ui-button-text: #fffdf8;
  --ui-shadow: 0 8px 28px #25282018;
  --bg: var(--ui-paper);
  --panel: var(--ui-surface);
  --panel2: var(--ui-paper);
  --card: var(--ui-surface);
  --text: var(--ui-text);
  --ink: var(--ui-text);
  --muted: var(--ui-muted);
  --line: var(--ui-line);
  --panel-border: var(--ui-line);
  --input: var(--ui-surface);
  --input-text: var(--ui-text);
  --input-border: var(--ui-line);
  --popup: var(--ui-surface);
  --popup-text: var(--ui-text);
  --brand: var(--ui-accent);
  --btn: var(--ui-accent);
  --btn-secondary: var(--ui-accent);
}
:root[data-dashboard-theme="dark"] {
  color-scheme: dark;
  --ui-paper: #20221f;
  --ui-surface: #292c26;
  --ui-text: #e7e5dc;
  --ui-muted: #b5b6ad;
  --ui-line: #494c43;
  --ui-accent: #adc5aa;
  --ui-button-text: #20221f;
  --ui-shadow: 0 8px 28px #0003;
}
html[data-dashboard-theme] body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ui-text);
  background: var(--ui-paper);
}
html[data-dashboard-theme] .global-nav {
  background: var(--ui-paper);
  border-bottom-color: var(--ui-line);
  gap: 12px;
}
html[data-dashboard-theme] .global-nav .brand {
  color: var(--ui-text);
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
  letter-spacing: -.04em;
  text-transform: none;
}
html[data-dashboard-theme] .global-nav-links a {
  color: var(--ui-muted);
  font-size: 14px;
  font-weight: 500;
}
html[data-dashboard-theme] .global-nav-links a.active {
  color: var(--ui-accent);
  text-decoration: underline;
  text-underline-offset: 5px;
}
html[data-dashboard-theme] .global-nav-links a:hover { color: var(--ui-text); }
html[data-dashboard-theme] .global-nav .source-pill {
  color: var(--ui-muted);
  background: var(--ui-surface);
  border-color: var(--ui-line);
  font-weight: 500;
}
html[data-dashboard-theme] .global-nav :is(.theme-toggle, .toggle, .filter-toggle, .optemera-newsletter-button, .newsletter-nav-button) {
  flex: 0 0 auto;
  width: auto;
  min-width: 0;
  margin: 0;
  border: 1px solid var(--ui-line);
  background: var(--ui-surface);
  color: var(--ui-accent);
  border-radius: 12px;
  font-weight: 600;
  font-size: 13px;
  box-shadow: none;
  cursor: pointer;
  white-space: nowrap;
}
html[data-dashboard-theme] .global-nav .theme-toggle { width: 36px; min-width: 36px; }
html[data-dashboard-theme] .global-nav #panelToggle {
  background: var(--ui-surface) !important;
  color: var(--ui-accent) !important;
  border-color: var(--ui-line) !important;
}
html[data-dashboard-theme] :is(.filters, .top-panel, .sidebar, .sidebar-top, .card, .stat, .sim-box, .sim-result, .legend, .topbar, .newsletter-modal, .optemera-newsletter-dialog, .fuel-calc-modal) {
  background: var(--ui-surface);
  color: var(--ui-text);
  border-color: var(--ui-line);
}
html[data-dashboard-theme] :is(.filters, .top-panel, .sim-box, .newsletter-modal, .optemera-newsletter-dialog, .fuel-calc-modal) {
  border-radius: 18px;
  box-shadow: var(--ui-shadow);
}
html[data-dashboard-theme] :is(.card, .stat, .sim-result, .legend) { border-radius: 14px; }
html[data-dashboard-theme] :is(.filters, .top-panel, .sidebar, .sim-box, .newsletter-modal, .optemera-newsletter-dialog, .fuel-calc-modal) :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="hidden"]), select) {
  background: var(--ui-surface);
  color: var(--ui-text);
  border-color: var(--ui-line);
  border-radius: 11px;
  min-height: 42px;
  font-family: inherit;
}
html[data-dashboard-theme] :is(.filters, .top-panel, .sidebar, .sim-box, .newsletter-modal, .optemera-newsletter-dialog) :is(label, .check, .layer-note, .sim-note, .sim-breakdown, .newsletter-modal-copy, .optemera-newsletter-copy) {
  color: var(--ui-muted);
}
html[data-dashboard-theme] :is(.filters, .top-panel, .sidebar, .sim-box) :is(h1, h2, h3, .title) { font-weight: 600; letter-spacing: -.025em; }
html[data-dashboard-theme] :is(.btn, .btn-primary, .optemera-newsletter-submit) {
  background: var(--ui-accent);
  color: var(--ui-button-text);
  border-color: var(--ui-accent);
  border-radius: 11px;
  font-weight: 600;
}
html[data-dashboard-theme] :is(.btn.secondary, .btn-soft, .icon-btn, .close, .optemera-newsletter-close, .newsletter-modal-close) {
  background: var(--ui-paper);
  color: var(--ui-text);
  border-color: var(--ui-line);
}
html[data-dashboard-theme] :is(.leaflet-popup-content-wrapper, .leaflet-popup-tip) { background: var(--ui-surface); color: var(--ui-text); }
html[data-dashboard-theme] .leaflet-popup-content-wrapper { border-radius: 18px; }
html[data-dashboard-theme] .leaflet-popup-content :is(h2, .popup-title, .popup-meta, .popup-addr, .popup-small, .popup-fuel, .price, .conn) { color: var(--ui-text); }
html[data-dashboard-theme] .leaflet-popup-content .popup-card p { color: var(--ui-muted); }
html[data-dashboard-theme] .newsletter-modal-head h2 { color: var(--ui-text); }
html[data-dashboard-theme] .newsletter-modal .newsletter-field > span { color: var(--ui-muted) !important; }
html[data-dashboard-theme] .newsletter-modal a { color: var(--ui-accent); }
html[data-dashboard-theme] :is(.optemera-newsletter-consent input[type="checkbox"], .newsletter-modal .newsletter-field > span > input[type="checkbox"]) {
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  min-height: 16px;
  margin: 2px 0 0;
  padding: 0;
  accent-color: var(--ui-accent);
}
html[data-dashboard-theme] .newsletter-form-actions button:not(#btnNewsletterSubmit) { background: var(--ui-paper); color: var(--ui-text); border-color: var(--ui-line); }
html[data-dashboard-theme] :is(.cookie-banner, #cookieBanner) {
  background: var(--ui-surface);
  color: var(--ui-text);
  border: 1px solid var(--ui-line);
  border-radius: 18px;
  box-shadow: var(--ui-shadow);
}
html[data-dashboard-theme] :is(.cookie-banner, #cookieBanner) p { color: var(--ui-muted); }
html[data-dashboard-theme] .cookie-actions button,
html[data-dashboard-theme] .optemera-newsletter-actions button:not(.optemera-newsletter-submit) {
  background: var(--ui-paper);
  color: var(--ui-text);
  border: 1px solid var(--ui-line);
  border-radius: 11px;
  font-weight: 600;
}
html[data-dashboard-theme] .cookie-actions :is(.primary, .cookie-accept, #cookieAccept, #cookieAcceptBtn) {
  background: var(--ui-accent);
  color: var(--ui-button-text);
}
html[data-dashboard-theme] :is(input, select, button, a):focus-visible { outline: 2px solid var(--ui-accent); outline-offset: 3px; }
@media (max-width: 760px) {
  html[data-dashboard-theme] .global-nav { gap: 8px; }
  html[data-dashboard-theme] .global-nav-links { gap: 18px; }
  html[data-dashboard-theme] .global-nav .source-pill { display: none; }
  html[data-dashboard-theme] .global-nav-actions { gap: 6px; }
  html[data-dashboard-theme] .global-nav :is(.optemera-newsletter-button, .newsletter-nav-button) { padding: 0 9px; min-height: 36px; }
}
