/* Global surfaces share one theme; map markers and branded actions retain their identity. */
:root[data-theme=dark],:root[data-theme=dark] body.night-reading{
  --cream:#0d1e27;--paper:#142b36;--ink:#edf4f7;--muted:#acc1cd;--line:#344d5b;
  --orange:#ff8766;--orange-soft:#3b2b27;--green:#7adbc1;--green-soft:#173d37;--gold-soft:#3b3422;--danger:#ff9b89;
  --admin-bg:#0d1e27;--shadow:0 20px 60px #0004;
  --travel-paper:#142b36;--travel-soft:#203c49;--travel-ink:#edf4f7;--travel-muted:#acc1cd;--travel-line:#344d5b;
  --night-raised:#1c3643;--night-input:#102631;--night-link:#95c3ff;--night-selected:#203f59;
  color-scheme:dark;
}
:root[data-theme=dark] body{background:var(--cream);color:var(--ink)}
:root[data-theme=dark] .ambient{opacity:.15}
:root[data-theme=dark] :is(.control-panel,.arrival-drawer,.arrival-drawer .drawer-head,.drawer-actions,.journey-guide,.map-overlay,.map-legend,.map-status,.maplibregl-popup-content,.desktop-nav,.account-button,.live-pill,.mobile-nav,.product-dialog,.place-dialog,.direction-dialog,.reading-dialog,.reading-dialog-header,.reading-dialog-footer,.install-app-dialog,.profile-header,.profile-panel,.profile-nav,.profile-stats article,.conversation-hub,.community-feed,.community-sidebar article,.community-start,.private-invites-panel,.admin-metrics article,.admin-overview-grid>article,.admin-table-card,.content-editor-grid>article,.audit-timeline,.club-dashboard,.club-sidebar article,.rewards-hero,.game-hub){
  background:var(--paper);color:var(--ink);border-color:var(--line);
}
:root[data-theme=dark] #location-confirm-dialog{background:var(--paper);color:var(--ink);border-color:var(--line)}
:root[data-theme=dark] :is(.map-panel,.chat-messages){background:var(--cream)}
:root[data-theme=dark] .map-panel:after{box-shadow:inset 0 0 0 1px var(--line)}
:root[data-theme=dark] .map-panel canvas{filter:invert(.9) hue-rotate(180deg) brightness(.9) saturate(.8)}
:root[data-theme=dark] :is(.maplibregl-ctrl-group,.maplibregl-ctrl-attrib){background:var(--paper)!important;color:var(--ink)}
:root[data-theme=dark] .maplibregl-ctrl-attrib a{color:var(--muted)}
:root[data-theme=dark] :is(.maplibregl-ctrl-icon,.maplibregl-ctrl-attrib-button){filter:invert(1)}
:root[data-theme=dark] .maplibregl-popup-tip{border-top-color:var(--paper);border-bottom-color:var(--paper)}
:root[data-theme=dark] :is(.workspace-tabs,.auth-tabs,.feed-scope-switch,.route-options,.community-step,.community-step.ready,.chat-card-status,.preference-list>label,.privacy-actions>div,.saved-place-grid>div){background:var(--night-input);border-color:var(--line);color:var(--muted)}
:root[data-theme=dark] :is(.workspace-tab.active,.auth-tabs button.active,.feed-scope-switch button.active){background:var(--night-selected);color:var(--night-link)}
:root[data-theme=dark] :is(.place-card,.commute-empty,.journey-card,.line-card,.stop-card,.nearby-stop-choice,.stop-line-option,.itinerary-stop,.itinerary-favorite,.favorite-stops-panel,.favorite-stop-row,.favorite-stops-panel[open]>summary,.direction-choice,.location-confirm-card,.origin-correction,.origin-results>button,.place-result,.destination-result,.reading-theme-card>span,.chat-mode-card,.private-invite-row,.chat-message,.chat-message.private-message,.community-poll,.community-poll button,.community-empty,.chat-lobby,.how-card,.campaign-card,.prize-card,.campaign-admin-card,.mission-card,.mission-card.done,.rules-dialog-grid article,.detail-list span,.photo-upload,.poll-toggle,.post-poll-fields){background:var(--night-raised);color:var(--ink);border-color:var(--line)}
:root[data-theme=dark] .arrival-card:not(.next){background:var(--night-raised);color:var(--ink);border-color:var(--line)}
:root[data-theme=dark] :is(.boarding-direction,.selection-summary,.destination-summary){background:linear-gradient(125deg,var(--night-selected),var(--paper));color:var(--ink);border-color:var(--line)}
:root[data-theme=dark] :is(.nearby-stop-choice.active,.nearby-stop-choice:hover,.stop-card.active,.stop-line-option.active,.stop-line-option:hover,.direction-choice.current,.direction-choice:hover,.reading-theme-card input:checked+span,.route-preference button.active){background:var(--night-selected);border-color:#6d9ecb;color:var(--ink)}
:root[data-theme=dark] :is(.itinerary-destination,.itinerary-stop.current,.guide-step.active){background:var(--orange-soft);border-color:#6f493b;color:var(--ink)}
:root[data-theme=dark] :is(.location-accuracy,.location-accuracy.good,.journey-boarding,.alight-recommendation,.journey-live.ready,.guide-live.ready,.chat-message.own,.chat-message.private-message.own,.launch-notice){background:var(--green-soft);color:#9be7d0;border-color:#315e50}
:root[data-theme=dark] :is(.location-accuracy.fair,.itinerary-note,.route-data-note,.chat-safety-note,.community-guidelines,.journey-live.scheduled){background:var(--gold-soft);color:#f1d891;border-color:#655a32}
:root[data-theme=dark] :is(.location-accuracy.low,.journey-boarding.warning){background:var(--orange-soft);color:#ffc0a7}
:root[data-theme=dark] :is(.itinerary-note b,.itinerary-note strong,.journey-boarding.warning b){color:inherit}
:root[data-theme=dark] :is(.search-control,.destination-search-control,.place-search-control){background:var(--night-input);border-color:var(--line)}
:root[data-theme=dark] :is(input,select,textarea):not([type=checkbox]):not([type=radio]){background-color:var(--night-input);color:var(--ink);border-color:var(--line);caret-color:var(--ink)}
:root[data-theme=dark] :is(input,textarea)::placeholder{color:#92aab8}
:root[data-theme=dark] :is(.profile-form,.auth-form,.admin-form-dialog,.content-editor-grid,.post-form-grid,.post-poll-fields) :is(input,select,textarea){background:var(--night-input);color:var(--ink);border-color:var(--line)}
:root[data-theme=dark] #origin-search-form input{background:var(--night-input);color:var(--ink);border-color:var(--line)}
:root[data-theme=dark] :is(.secondary-action,.filter-button,.selection-summary button,.destination-summary button,.drawer-head button,.direction-close,.direction-back,.boarding-direction button,.route-preference button,.journey-actions a.secondary,.dialog-close,.dialog-head button,.guide-head>button,.guide-step,.guide-actions button,.google-button,.demo-access,.input-password button,.private-invite-actions button,.quick-messages,.quick-messages button,.chat-form,.chat-room-switch,.community-post-actions button,.privacy-actions button,.community-step>button,.install-app-actions button,.form-footer button,.rules-summary button,.faq-list button,.campaign-admin-card footer button){background:var(--night-raised);color:var(--night-link);border-color:var(--line)}
:root[data-theme=dark] #location-confirm-dialog>.dialog-close{background:var(--night-raised);color:var(--ink);border-color:var(--line)}
:root[data-theme=dark] #location-confirm-dialog .location-confirm-actions{background:var(--paper)}
:root[data-theme=dark] #location-confirm-dialog .location-confirm-actions button{background:var(--night-raised);color:var(--night-link);border-color:var(--line)}
:root[data-theme=dark] :is(.direction-picker button,.workspace-tab,.line-search-panel>summary b,.boarding-steps button[aria-current=step],.boarding-direction strong,.direction-choice>b,.direction-choice small,.commute-result-toolbar button,.journey-refresh,.line-copy strong,.place-card strong,.itinerary-stop strong,.itinerary-stop>b,.travel-stop.upcoming strong,.origin-recents>header button,.reading-options>button,.use-location-place,.journey-total>strong,.journey-steps summary,.chat-room-switch button.active,.chat-message-actions .private-chat-action,.auth-reset,.form-message){color:var(--night-link)}
:root[data-theme=dark] .hero-copy h1 em{color:var(--night-link)}
:root[data-theme=dark] :is(.stop-card-icon,.nearby-stop-choice .nearby-stop-icon,.legend-stop){background:var(--orange-soft);color:#ffa98d}
:root[data-theme=dark] :is(.legend-bus,.arrival-bus-icon,.place-icon.work,.location-confirm-card>b){background:var(--green-soft);color:#97e5cf}
:root[data-theme=dark] :is(.distance-chip,.place-icon.home,.direction-symbol,.use-location-icon,.origin-recent-icon,.nearby-stop-heading>b,.nearby-start>span,.stop-line-option.all,.arrival-section-head b,.mode-badge,.mode-badge.subway,.mode-badge.rail,.mode-badge.suburban,.mode-badge.walk,.chat-mode-icon,.community-empty>span,.social-post>span.community-post-avatar,.post-tags span,.community-step-number){background:var(--night-selected);color:var(--night-link)}
:root[data-theme=dark] :is(.mode-badge.bus,.journey-live){background:var(--orange-soft);color:#ffc0a7}
:root[data-theme=dark] :is(.nearby-start,.key-test-button,.key-test-results,.chat-room-switch button.active,.origin-recent-item:hover){background:var(--night-raised);border-color:var(--line);color:var(--ink)}
:root[data-theme=dark] .location-confirmed #location-button{background:var(--night-raised);color:var(--ink);border-color:var(--line)}
:root[data-theme=dark] .location-confirmed #location-button :is(small,.button-arrow){color:var(--night-link)}
:root[data-theme=dark] .location-confirmed #location-button .location-icon{background:var(--night-selected);color:var(--night-link)}
:root[data-theme=dark] :is(.location-accuracy>div strong,.location-accuracy>p){color:inherit}
:root[data-theme=dark] #location-confirm-dialog .origin-correction summary{color:var(--night-link)}
:root[data-theme=dark] .boarding-steps .complete i{background:var(--green-soft);color:#97e5cf;border-color:#315e50}
:root[data-theme=dark] :is(.boarding-steps button[aria-current=step] i,.location-confirm-actions button.primary,#location-confirm-dialog .location-confirm-actions button.primary,.selection-actions #open-selected-line-chat,.guide-actions button.primary,.form-footer button:last-child,.install-app-actions .primary-action,.private-invite-actions button:first-child,.community-step.ready>button,.journey-actions .journey-start-button){background:#1658b5;color:#fff;border-color:#548acc}
:root[data-theme=dark] .journey-actions button:not(.journey-live-button):not(.journey-start-button){background:var(--night-selected);color:var(--night-link)}
:root[data-theme=dark] .journey-arrival{background:var(--green-soft);color:#99e8cd}
:root[data-theme=dark] .journey-arrival :is(strong,span,small){color:inherit}
:root[data-theme=dark] .journey-arrival:is(.neutral,.loading){background:var(--night-raised);color:var(--muted)}
:root[data-theme=dark] .journey-arrival.scheduled{background:var(--gold-soft);color:#f1d891}
:root[data-theme=dark] .journey-arrival.tracking{background:var(--night-selected);color:var(--night-link)}
:root[data-theme=dark] .reading-dialog{--reading-ink:var(--ink);--reading-muted:var(--muted);--reading-line:var(--line)}
:root[data-theme=dark] .reading-theme-card input:checked+span{border-color:var(--night-link);color:var(--night-link);box-shadow:inset 0 0 0 .5px var(--night-link)}
:root[data-theme=dark] .reading-theme-card input:checked+span:after{background:var(--night-link);border-color:var(--paper);box-shadow:0 0 0 1px var(--night-link)}
:root[data-theme=dark] .reading-toggle>i{background:#48616e}
:root[data-theme=dark] .reading-toggle input:checked+i{background:#3579d5}
:root[data-theme=dark] .reading-eyebrow{color:#97e5cf}
:root[data-theme=dark] #close-reading-options:hover{background:var(--night-raised)}
:root[data-theme=dark] .reading-dialog-footer p{color:var(--muted)}
:root[data-theme=dark] .install-app-copy .install-app-help{background:var(--night-input);color:var(--muted)}
:root[data-theme=dark] .skeleton{background:linear-gradient(90deg,#193440 25%,#274552 50%,#193440 75%);background-size:200% 100%}
:root[data-theme=dark] .guide-actions{background:var(--paper)}
:root[data-theme=dark] .toast{background:#dceef7;color:#102d3f}
:root[data-theme=dark] :is(.install-app-copy h2,.community-poll button.selected,.post-poll-fields legend){color:var(--night-link)}
:root[data-theme=dark] :is(.chat-card-status.ready,.install-benefits .ui-icon){color:#99e8cd}
:root[data-theme=dark] .chat-mode-card.direct .primary-action{background:#116b60;color:#fff}
:root[data-theme=dark] .auth-input-shell>svg{stroke:var(--night-link)}
:root[data-theme=dark] .safe-chat-pill{color:#99e8cd}
:root[data-theme=dark] .place-card>b{color:var(--night-link)}
:root[data-theme=dark] :is(.launch-notice span,.destination-search-control button,.search-control button,.place-search-control button,.arrival-line-badge,.arrival-card.next .arrival-track-button,.arrival-card.next .arrival-card-actions .arrival-map-button,.itinerary-destination>summary i,.itinerary-stop.current i,.guide-step.active>span:first-child){color:#142630}
