/* Theme only: keep event artwork and exported sharing cards in their original colors. */
html[data-theme="dark"] {
  color-scheme: dark;
  --bg:#101815; --surface:#19241f; --ink:#edf4ef; --muted:#afc0b5;
  --line:#34483d; --line-strong:#597163; --green:#7ddbad;
  --blue:#9bbcff; --orange:#ffb17d; --red:#ff9393;
  --shadow:0 8px 28px #0004;
  background:var(--bg);
}
html[data-theme="dark"] body { background:var(--bg); color:var(--ink); }
html[data-theme="dark"] :is(button,input,select,textarea) { color:var(--ink); }
html[data-theme="dark"] :is(input:not([type="checkbox"]),select,textarea) { background:var(--surface)!important; border-color:var(--line)!important; }
html[data-theme="dark"] ::placeholder { color:#9eafa4; opacity:1; }
html[data-theme="dark"] :is(.app-header,.browse-switch,.selection-rail,.bottom-nav,.explore-card,.decision-card,.event-dialog,.filter-grid,.search-field,.map-browser,.map-search,.route-sheet,.case-choice,.case-actions,#routeCaseDetail,#recommendForm,.parking-panel,.dialog-insight,.plan-summary,.plan-controls,.route-option-stats,.route-option-note,.registration-panel,.recommend-location button,.shared-route-banner) {
  background:var(--surface)!important; color:var(--ink); border-color:var(--line)!important;
}
html[data-theme="dark"] :is(.language-switch,.browse-switch-tabs,.decision-card header span,.purpose-chip,.rail-remove,.timeline-time,.list-date,.preferences-heading #preferencesDismiss) { background:#24372c; color:var(--ink); border-color:var(--line); }
html[data-theme="dark"] :is(.language-switch button,.browse-switch-tabs button,.nav-item) { color:var(--muted); }
html[data-theme="dark"] :is(.language-switch button[aria-pressed="true"],.browse-switch-tabs button[aria-pressed="true"],.nav-item.active,.date-tab.active,.case-choice.active,.case-choice[aria-pressed="true"],.decision-card.selected) { background:#2b5140!important; color:#ebfff2!important; border-color:#6bbb91!important; }
html[data-theme="dark"] :is(.date-tab,.decision-add,.explore-actions button,.map-list-actions button,.parking-actions a,.parking-actions button,.parking-retry,.preferences-body button,#preferencesOpen,.route-option-actions button,.share-actions button,.shared-route-banner button) { background:var(--surface); color:var(--ink); border-color:var(--line-strong); }
html[data-theme="dark"] :is(.purpose-chip.active,.route-option-actions .primary,.explore-actions button:last-child,.map-list-actions button:last-child,.case-actions button,.visit-editor button,.venue-event-add.active,.venue-marker.selected,.route-option li i,.route-bar) { background:var(--accent)!important; color:#17271e!important; }
html[data-theme="dark"] :is(.decision-card.selected .decision-add,#preferencesClose,#applyFiltersBtn,.rail-open,.recommend-submit,.share-x,.route-identity,.route-option>header,.registration-panel>header) { background:#27563f!important; color:#f2fff6!important; }
html[data-theme="dark"] :is(.preferences-heading p,.preferences-section h3,.preferences-body .preference-row small,.preferences-body .preferences-note,#preferencesReset,.brand-credit,.case-stops small,.explore-toolbar p,.explore-card dt,.preview-description,.preview-terms,.preview-price,.map-list-count,.map-list-event small,.parking-note,.parking-panel>summary span,.venue-hover>strong,.venue-hover small,.search-status) { color:var(--muted)!important; }
html[data-theme="dark"] :is(.rail-empty button,.rail-empty>span,.rail-event time,.rail-event>span,.selection-rail header small,.selection-rail h2 span,.explore-host,.preview-host,.map-list-event time,.case-leg,.venue-hover-event span,.search-status button,#preferencesSaved) { color:var(--green)!important; }
html[data-theme="dark"] :is(.preferences-section .preference-row,.preferences-footer,.selection-rail header,.rail-event,.map-list-event,.case-stops li,.venue-hover-event) { border-color:var(--line); }
html[data-theme="dark"] .preferences-body .preference-row input { background:#43594b; border-color:#668775; }
html[data-theme="dark"] .preferences-body .preference-row input:checked { background:#238459; border-color:#76c89e; }
html[data-theme="dark"] :is(.case-notice,.conditional-banner,.data-health.warning) { background:#372d18; color:#f1d395; border-color:#6c5930; }
html[data-theme="dark"] :is(.case-reward,.dialog-insight,.registration-tags) { background:#243a2c!important; color:#d6f6e0; }
html[data-theme="dark"] .kbw-wordmark { filter:brightness(0) invert(1); }
html[data-theme="dark"] #preferencesDialog::backdrop { background:#0009; }
/* Only the basemap is toned down; pins, route lines and popup content stay untouched. */
html[data-theme="dark"] .leaflet-tile-pane { filter:invert(1) hue-rotate(180deg) brightness(1.3) contrast(.85) saturate(.55); }
html[data-theme="dark"] .leaflet-container { background:#19241f; }
html[data-theme="dark"] body.route-active #routeView :is(.section-header,.map-route-controls label,.map-route-summary,.map-route-summary>div,.map-legend) { background:var(--surface)!important; color:var(--ink); border-color:var(--line); }
html[data-theme="dark"] :is(.leaflet-control-zoom a,.leaflet-control-attribution,.leaflet-popup-content-wrapper,.leaflet-popup-tip,.venue-hover-tooltip) { background:var(--surface)!important; color:var(--ink)!important; border-color:var(--line); }
html[data-theme="dark"] .leaflet-control-attribution a { color:#a2c9ff; }
html[data-theme="dark"] .leaflet-popup-close-button { color:var(--muted)!important; }
html[data-theme="dark"] .leaflet-tooltip-left:before { border-left-color:var(--surface); }
html[data-theme="dark"] .leaflet-tooltip-right:before { border-right-color:var(--surface); }
html[data-theme="dark"] :is(.decision-summary,.map-legend b) {color:var(--muted)!important}
html[data-theme="dark"] body.route-active #routeView.active,
html[data-theme="dark"] body.route-active #routeView .map-route-controls {background:var(--surface)!important}
html[data-theme="dark"] body.route-active #routeView .section-header .text-button {background:#24372c;color:var(--ink)}
html[data-theme="dark"] :is(.route-sheet-toggle b,.filter-drawer summary span,.registration-state.open,.summary-stat) {color:#17271e}
html[data-theme="dark"] :is(.itinerary-card,.route-controls,.leg,.source-stamp,.filter-grid button,.dialog-actions a,.pill,.registration-extra span) {background:var(--surface);color:var(--ink)}
html[data-theme="dark"] .route-summary>p {background:#213c2e;color:var(--ink)}
html[data-theme="dark"] .map-list-actions [data-map-select] {color:#17271e!important}
html[data-theme="dark"] .map-list-actions button:last-child:not([data-map-select]) {background:var(--surface)!important;color:var(--ink)!important}
html[data-theme="dark"] .source-stamp {color:var(--muted)!important}
@media(min-width:1100px){html[data-theme="dark"] .bottom-nav{background:transparent!important}}
