/* Dark theme. Light is the default; html[data-theme=dark] is set by the toggle in the header and remembered in localStorage. */
html{color-scheme:light}
html[data-theme=dark]{
  color-scheme:dark;
  --ink:#E6ECF5;--muted:#A3B0C7;--line:#2A3550;--bg:#0A0F1C;--surface:#111a2e;--surface-2:#16203A;
  --accent:#60A5FA;--accent-strong:#93C5FD;--accent-soft:#1B2F5E;--accent-tint:#131F3C;
  --ok-soft:#10301E;--warn-soft:#38270A;--bad-soft:#3B1416;--ok:#4ADE80;--warn:#FBBF24;--bad:#F87171;
  --card-shadow:0 10px 30px rgba(0,0,0,.45);--card-shadow-hover:0 24px 50px rgba(0,0,0,.6);
  --sh-ink:#E6ECF5;--sh-blue:#8AB4FF;
}
html[data-theme=dark] body{background:var(--bg);color:var(--ink)}
html[data-theme=dark] :is(.area,.box,.contacts span,.box.brief,.btn-ghost,.calc,.assump input,.calc .out,.card,.case,.controls,.draft,.copyD,.float-chip,.float-stat,.flow,.node,.form-card,.hud-btn,.integrations,.kpi,.lead-card,.lead-mini,.map-hud,.map-legend,.mobile-menu,.mock-q,.mode,.modes,.num,.onboard,.opt-btn,.panel,.plan,.psych,.req,.result,.sel,.skel-card,.stat-band,.status,.suggest,.tab,.table-wrap,.toggle,.trust,.ver,.verdict,.reply,.vexplain,.stepper li,.log,.toolbar select.sel,input,select,textarea){background:var(--surface);color:var(--ink);border-color:var(--line)}
html[data-theme=dark] :is(.btn-primary){color:#fff}
html[data-theme=dark] :is(.chip,button.chip){background:var(--surface-2);color:var(--ink)}
html[data-theme=dark] :is(.chip.on,.tab.active,.stepper li.active){background:var(--accent-soft);border-color:var(--accent);color:var(--ink)}
html[data-theme=dark] ::placeholder{color:#7989A0}
html[data-theme=dark] hr,html[data-theme=dark] .sf-top,html[data-theme=dark] .sf-bottom{border-color:var(--line)}
html[data-theme=dark] h1,html[data-theme=dark] h2,html[data-theme=dark] h3,html[data-theme=dark] h4{color:var(--ink)}
html[data-theme=dark] a{color:inherit}
html[data-theme=dark] .fine,html[data-theme=dark] small{color:var(--muted)}
/* header */
html[data-theme=dark] .sh-header.scrolled{background:rgba(10,15,28,.88);box-shadow:0 6px 24px rgba(0,0,0,.5)}
html[data-theme=dark] :is(.sh-pill,.sh-theme,.sh-burger,.sh-dd ul){background:var(--surface);box-shadow:0 8px 40px rgba(0,0,0,.55)}
html[data-theme=dark] .sh-dd ul a:hover{background:var(--surface-2)}
html[data-theme=dark] .sh-burger span{background:var(--ink)}
html[data-theme=dark] .sh-mobile{background:var(--bg)}
html[data-theme=dark] .sh-phone .ic{background:var(--accent-soft);color:#93C5FD}
html[data-theme=dark] .sh-phone b{color:var(--ink)}
html[data-theme=dark] .sh-pill .sh-cta,html[data-theme=dark] .sh-mobile .sh-cta{color:#fff}
/* map: invert the OSM tiles only, markers and sweep keep their colours */
html[data-theme=dark] .mapbox{background:#14161d;border-color:var(--line)}
html[data-theme=dark] .leaflet-tile-pane{filter:invert(1) hue-rotate(180deg) brightness(.92) contrast(.9) saturate(.85)}
html[data-theme=dark] .leaflet-container{background:#14161d}
html[data-theme=dark] :is(.leaflet-popup-content-wrapper,.leaflet-popup-tip,.leaflet-bar a){background:var(--surface);color:var(--ink)}
html[data-theme=dark] .leaflet-control-attribution{background:rgba(10,15,28,.75)!important;color:var(--muted)}
html[data-theme=dark] .leaflet-control-attribution a{color:#93C5FD}
html[data-theme=dark] .map-hud,html[data-theme=dark] .map-legend{background:rgba(17,26,46,.92)}
/* assistant panel (styles injected by assistant.js) */
html[data-theme=dark] #aiPanel{background:var(--surface);border-color:var(--line)}
html[data-theme=dark] #aiPanel :is(header,footer,form){background:var(--surface);border-color:var(--line)}
html[data-theme=dark] #aiStatus{background:var(--accent-tint);color:var(--muted);border-color:var(--line)}
html[data-theme=dark] #aiClose{color:var(--muted)}
html[data-theme=dark] #aiPanel :is(input,textarea){background:var(--surface-2);color:var(--ink)}
html[data-theme=dark] #aiPanel .bot{background:var(--surface-2);color:var(--ink)}
@media (prefers-reduced-motion:reduce){.sh-theme{transition:none}}
html[data-theme=dark] .page-hero{background:linear-gradient(180deg,var(--accent-tint),var(--bg))}
html[data-theme=dark] .mode button.on{background:var(--accent);color:#0A1530}
html[data-theme=dark] .leaflet-tile-pane{filter:invert(1) hue-rotate(180deg) brightness(1.05) contrast(.95) saturate(.9)}
html[data-theme=dark] .mode a.btn[style*="background:var(--ink)"]{background:var(--accent)!important;color:#0A1530!important}
