/* UI appearance only. No map tile, route, traffic, marker or swatch recolouring. */
:root{color-scheme:light}
.appearance-settings select{display:block;width:100%;margin-top:6px;min-height:44px}
html[data-theme=dark]{color-scheme:dark;--ui-bg:#191d21;--ui-surface:#22282e;--ui-raised:#2d353d;--ui-text:#edf1f4;--ui-muted:#bcc8d0;--ui-border:#697984;--ui-selected:#254c50;--ui-focus:#98e6e0;background:var(--ui-bg);color:var(--ui-text)}
html[data-theme=dark] body,html[data-theme=dark] #mapWorkspace,html[data-theme=dark] #map{background:var(--ui-bg)!important;color:var(--ui-text)}
html[data-theme=dark] :is(.choice-panel,.panel-heading,.choice-heading,.panel-content,.developer-tools-dialog,.developer-tools-heading,.developer-tools-body,.selection-sheet,.selection-sheet-heading,.selection-sheet-body,.ticket-popup,.leaflet-popup-content-wrapper,.leaflet-popup-tip,.leaflet-tooltip,.map-information,.map-mode-label,.map-readouts,.geo-prompt,.start-screen,.start-card,.quick-sources,.settings-grid,.notice,.beta-notice,.report-heading,.report-card,.report-location-summary,header,aside,dialog,#eventPicker,#reportPanel,#crosshairCoordinateBar,#selectionSheetGrip,#developerToolsOpen,#planningSettings,#elevationSettings){background:var(--ui-surface)!important;color:var(--ui-text)!important;border-color:var(--ui-border)!important;box-shadow:none}
html[data-theme=dark] :is(.choice-panel,dialog,.selection-sheet,#reportPanel,.map-information) :is(p,h2,h3,h4,label,legend,summary,small,th,td,dt,dd,pre,code,.small,.coordinate-row,.coordinate-hint,.source-note,.popup-coordinates,.popup-elevation){color:var(--ui-text)!important}
html[data-theme=dark] :is(.choice-panel,dialog,.selection-sheet,#reportPanel,.map-information) :is(fieldset,details,table,th,td,.item,.quick-source,.subrecord,.setting,.settings-card,.popup-section,.popup-facts,.planning-status,.planning-result,.report-location-summary){background:var(--ui-surface)!important;border-color:var(--ui-border)!important}
html[data-theme=dark] :is(button,select,textarea,input:not([type=radio]):not([type=checkbox]),.leaflet-bar a,.leaflet-control-attribution,.leaflet-control-scale-line){background:var(--ui-raised)!important;color:var(--ui-text)!important;border-color:var(--ui-border)!important;text-shadow:none}
html[data-theme=dark] :is(input,select,textarea){color-scheme:dark;accent-color:#98e6e0}
html[data-theme=dark] option{background:var(--ui-surface);color:var(--ui-text)}
html[data-theme=dark] :is(input,textarea)::placeholder{color:var(--ui-muted);opacity:1}
html[data-theme=dark] :is(button,.leaflet-bar a):hover{background:#3d4b56!important}
html[data-theme=dark] :is(button[aria-pressed=true],button[aria-expanded=true],label:has(>input:checked),.basemap-options label:has(input:checked),.source-subgroup label:has(input:checked)){background:var(--ui-selected)!important;color:var(--ui-text)!important;outline:1px solid #81b6bb;outline-offset:-1px}
html[data-theme=dark] :is(button,select,input,textarea,a,summary):focus-visible{outline:3px solid var(--ui-focus)!important;outline-offset:2px}
html[data-theme=dark] :is(button,input,select):disabled{background:#252b30!important;color:#a8b3bc!important;border-color:#53606b!important;opacity:1;cursor:not-allowed}
html[data-theme=dark] a{color:#9cdae9}
html[data-theme=dark] :is(.small,.coordinate-hint,#routeChoice,#baseChoice,#displayChoice){color:var(--ui-muted)}
html[data-theme=dark] :is(#quickLocationStatus,#userMapError,#reportDraftNotice,.error){background:#42351f!important;color:#ffe0a6!important;border-color:#b69458!important}
html[data-theme=dark] :is(.badge,.popup-badge,.position-badge){background:var(--ui-raised)!important;color:var(--ui-text)!important}
html[data-theme=dark] .panel-content{scrollbar-color:#a8bac5 #22282e}
html[data-theme=dark] .leaflet-tooltip:before{border-top-color:var(--ui-surface)}
/* The crosshair is an outline over every basemap, never a tile filter. */
html[data-theme=dark] button.map-crosshair{background:none!important;border:0!important;color:#edf1f4!important}
html[data-theme=dark] .map-crosshair>.ticket-icon{filter:drop-shadow(1px 0 #111) drop-shadow(-1px 0 #111)}
html[data-theme=dark] .map-crosshair span{background:var(--ui-surface);color:var(--ui-text);box-shadow:none}
html[data-theme=dark] :is(.basemap-options label,summary,.panel-chrome-heading,.popup-actions,.popup-detail,.popup-elevation,.popup-location,.selection-detail,.selection-scroll-hint,.ticket-popup-body,.report-heading){background:var(--ui-surface)!important;color:var(--ui-text)!important;border-color:var(--ui-border)!important}
html[data-theme=dark] .basemap-options label:has(input:checked){background:var(--ui-selected)!important}
html[data-theme=dark] button#sheetBackdrop,html[data-theme=dark] button#sheetBackdrop:hover{background:rgba(0,0,0,.45)!important;border:0!important}
html[data-theme=dark] :is(.ticket-action,.ticket-scroll-track,.ticket-popup-heading){background:var(--ui-raised)!important;color:var(--ui-text)!important;border-color:var(--ui-border)!important}
html[data-theme=dark] .ticket-scroll-thumb{background:#a8bac5}
html[data-theme=dark] .ticket-popup .popup-transport button.transport-icon-button{color:#a8b3bc!important}
html[data-theme=dark] :is(dialog,#reportPanel) :is(p,.stats,.version-badge,.mode-note,.report-warning){background:var(--ui-surface)!important;color:var(--ui-text)!important;border-color:var(--ui-border)!important}
html[data-theme=dark] dialog::backdrop{background:rgba(0,0,0,.55)}
html[data-theme=dark] :is(#elevationSettings,#planningSettings,.ticket-popup,.developer-tools-dialog,.choice-panel) :is(.setting-label,.toggle-label,.elevation-toggle-label,.elevation-label,.planning-note){color:var(--ui-text)!important}
html[data-theme=dark] #elevationSettings span,html[data-theme=dark] #planningSettings p{color:var(--ui-text)!important}

/* B048: keep crosshair geometry/colour/hit target; remove only opaque backing.
   ID specificity outranks the shared dark button rule (including hover/focus). */
#crosshairPosition.map-crosshair,
#crosshairPosition.map-crosshair:hover,
#crosshairPosition.map-crosshair:focus,
#crosshairPosition.map-crosshair:active{background:transparent!important}
#crosshairPosition.map-crosshair>span{background:transparent!important;box-shadow:none}
