/* Shared appearance controls. Maps and original evidence keep their own colours. */
:root { color-scheme: light; }
.header-controls { display:flex; align-items:center; gap:12px; flex-shrink:0; }
.theme-toggle {
 display:inline-flex; align-items:center; justify-content:center; gap:8px;
 min-height:46px; padding:10px 12px; border:1px solid #a9b9ae; border-radius:7px;
 background:#fff; color:#123f3b; font-size:14px; line-height:1.3; white-space:nowrap;
}
.theme-toggle svg { width:20px; height:20px; flex-shrink:0; fill:none; stroke:currentColor; stroke-width:1.7; stroke-linejoin:round; }
.theme-toggle:hover { background:#e8eee5; color:#123f3b; }
.theme-toggle[aria-pressed=true] { border-color:#9ecdbb; background:#2b493d; color:#e5f4e8; }
.theme-toggle:focus-visible { outline:3px solid #667c2d; outline-offset:3px; }
body > header { flex-wrap:wrap; }
header.portal-header { flex-wrap:wrap; }
.auth-body header { max-width:720px; }
.auth-body .header-controls { margin-left:auto; }

@media (max-width:640px) {
 body > header, header.portal-header { display:flex; align-items:center; gap:14px; }
 body > header .brand { margin-bottom:0; }
 .header-controls { margin-left:auto; gap:8px; }
 .theme-toggle { min-width:46px; padding:10px; }
 .theme-toggle span { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; }
}

@media screen {
 :root[data-theme=dark] {
  color-scheme:dark;
  --ink:#e5eee8; --green:#a4d1be; --lime:#d9ed9f; --muted:#acbeb4;
  --line:#3b5047; --paper:#101b18; --white:#1b2a24; --red:#ffaaa0;
 }
 [data-theme=dark] body { background:var(--paper); color:var(--ink); }
 [data-theme=dark] .brand-mark { background:#214c3f; color:#d9ed9f; }
 [data-theme=dark] .hero-card { background:#214c3f; color:#f2f7ee; }
 [data-theme=dark] .pill { color:#183c30; }
 [data-theme=dark] .emergency { background:#302b1e; border-color:#5a5135; color:#f1e5c3; }
 [data-theme=dark] .notice, [data-theme=dark] .demo-notice { background:#332e1e; border-color:#b5984e; color:#f4e7bd; }
 [data-theme=dark] input, [data-theme=dark] select, [data-theme=dark] textarea {
  background-color:#15221d; color:var(--ink); border-color:#6c8275;
  accent-color:#a4d1be;
 }
 [data-theme=dark] input::placeholder, [data-theme=dark] textarea::placeholder { color:#a5b5ab; opacity:1; }
 [data-theme=dark] select {
  background-image:linear-gradient(45deg,transparent 50%,#e5eee8 50%),linear-gradient(135deg,#e5eee8 50%,transparent 50%);
 }
 [data-theme=dark] input[type=file]::file-selector-button { background:#2b4035; color:#e5eee8; border:1px solid #6c8275; border-radius:4px; padding:8px 12px; }
 [data-theme=dark] button, [data-theme=dark] .button { background:#a4d1be; color:#102c22; border-color:#a4d1be; }
 [data-theme=dark] button:hover, [data-theme=dark] .button:hover { background:#c4e6d5; color:#102c22; }
 [data-theme=dark] button.secondary, [data-theme=dark] .button.secondary { background:transparent; color:var(--green); border-color:#7e9f8d; }
 [data-theme=dark] button.secondary:hover, [data-theme=dark] .button.secondary:hover { background:#2b4035; color:var(--ink); }
 [data-theme=dark] .theme-toggle, [data-theme=dark] .portal-menu>summary, [data-theme=dark] .portal-menu>.portal-menu-toggle {
  background:#1b2a24; border-color:#6c8275; color:var(--ink);
 }
 [data-theme=dark] .theme-toggle[aria-pressed=true] { background:#2b493d; border-color:#9ecdbb; color:#e5f4e8; }
 [data-theme=dark] .theme-toggle:hover, [data-theme=dark] .portal-menu>summary:hover,
 [data-theme=dark] .portal-menu>.portal-menu-toggle:hover { background:#304a3d; color:var(--ink); }
 [data-theme=dark] .portal-menu .portal-nav { background:#1b2a24; box-shadow:0 12px 30px #0006; }
 [data-theme=dark] .portal-nav a:hover { background:#2b4035; }
 [data-theme=dark] .portal-nav a[aria-current] { background:#304a3d; border-color:#7e9f8d; color:#d9ed9f; }
 [data-theme=dark] .nav-icon { color:#b4d3bb; }
 [data-theme=dark] .skip { background:#1b2a24; color:var(--ink); }
 [data-theme=dark] :focus-visible, [data-theme=dark] .portal-nav a:focus-visible,
 [data-theme=dark] .portal-menu>.portal-menu-toggle:focus-visible,
 [data-theme=dark] .theme-toggle:focus-visible { outline-color:#e2ed9a; }
 [data-theme=dark] .status { background:#304a3d; color:#dfedce; }
 [data-theme=dark] .chart-panel, [data-theme=dark] .access-count { background:var(--white); border-color:var(--line); }
 [data-theme=dark] .filter-bar, [data-theme=dark] .methodology,
 [data-theme=dark] .heatmap-controls, [data-theme=dark] .map-controls,
 [data-theme=dark] .map-credit, [data-theme=dark] .map-detail-status,
 [data-theme=dark] .search-excerpt, [data-theme=dark] .own-summary div,
 [data-theme=dark] .bulk-table th, [data-theme=dark] .setup-progress li,
 [data-theme=dark] .lifecycle-message:not(:empty) { background:#24372d; color:var(--ink); }
 [data-theme=dark] .map-area-detail, [data-theme=dark] .reporter-card,
 [data-theme=dark] .report-type-option, [data-theme=dark] #community-setup .setup-consent { background:#192820; }
 [data-theme=dark] .report-type-option:has(input:checked) { background:#304a3d; border-color:#a4d1be; }
 [data-theme=dark] .information-privacy { background:#1c2e39; border-color:#668a9f; }
 [data-theme=dark] .information-privacy .small { color:#bad4e2; }
 [data-theme=dark] .hotspot-button { background:#463126; color:#f0cfb6; border-color:#9a7252; }
 [data-theme=dark] .filter-chip { background:#d9ed9f; color:#183c30; }
 [data-theme=dark] .category-bar, [data-theme=dark] .event-button { background:transparent; color:var(--ink); border-color:var(--line); }
 [data-theme=dark] .category-bar:hover, [data-theme=dark] .event-button:hover { background:#2b4035; color:var(--ink); }
 [data-theme=dark] .event-button[aria-current=step] { background:#304a3d; color:var(--ink); }
 [data-theme=dark] .time-label, [data-theme=dark] .patrol-panel td::before { color:var(--muted); }
 [data-theme=dark] .time-cell { background:#24372d; color:#e5eee8; }
 [data-theme=dark] .time-cell[data-level="1"] { background:#345340; color:#f0f6ed; }
 [data-theme=dark] .time-cell[data-level="2"] { background:#537958; color:#fff; }
 [data-theme=dark] .time-cell[data-level="3"] { background:#8bb68a; color:#10261a; }
 [data-theme=dark] .time-cell[data-level="4"] { background:#d9ed9f; color:#162c1c; }
 [data-theme=dark] .time-cell:hover { background:#c4e6d5; color:#102c22; outline-color:#e2ed9a; }
 [data-theme=dark] #timeline-chart svg text { fill:#acbeb4; }
 [data-theme=dark] #timeline-chart svg line { stroke:#3b5047; }
 [data-theme=dark] .heatmap-controls input[type=range] { accent-color:#a4d1be; background:transparent; }
 [data-theme=dark] .map-dialog { background:#15221d; border-color:#6c8275; color:var(--ink); }
 [data-theme=dark] .map-dialog::backdrop { background:#050c09d9; }
 [data-theme=dark] .evidence-preview img, [data-theme=dark] .evidence-preview video { background:#15221d; }
 [data-theme=dark] .setup-progress [aria-current=step] { background:#a4d1be; color:#102c22; }
 [data-theme=dark] .setup-progress li::before { border-color:#7e9f8d; }
 [data-theme=dark] .setup-progress [aria-current=step]::before { border-color:#315845; }
 [data-theme=dark] .bulk-table th, [data-theme=dark] .bulk-table td,
 [data-theme=dark] .directory-card, [data-theme=dark] .patrol-panel tbody tr,
 [data-theme=dark] .bulk-invitations .bulk-table tr { border-color:var(--line); }
}

@media print { .header-controls { display:none!important; } }

@media screen {
 [data-theme=dark] .resident-tabs a:hover { background:#24372d; }
 [data-theme=dark] .resident-workspace .own-summary div,
 [data-theme=dark] .insights-body .metric,
 [data-theme=dark] .insights-body .officer-briefing { background:transparent; }
 [data-theme=dark] .insights-body #filters { background:var(--white); }
}
@media screen {
 [data-theme=dark] .resident-tabs{background:#17261f;border-color:#526b5d}
 [data-theme=dark] .resident-tabs a{color:#acbeb4}
 [data-theme=dark] .resident-tabs a:hover{background:#24372d;color:#e5eee8}
 [data-theme=dark] .resident-tabs a[aria-current]{background:#304a3d;border-color:#8ab09c;color:#e5f1df;box-shadow:0 1px 3px #0004}
}
