/* ─────────────────────────────────────────────────────────
   247 — Emergency Management System
   Font: Inter | Supabase dark palette
   ───────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #1c1c1c;
  --surface:     #1c1c1c;
  --surface-2:   #242424;
  --surface-3:   #2a2a2a;
  --border:      #333333;
  --border-2:    #3c3c3c;
  --brand:       #3ecf8e;
  --brand-dim:   rgba(62,207,142,0.12);
  --brand-ring:  rgba(62,207,142,0.3);
  --fg:          #ededed;
  --fg2:         #9b9b9b;
  --fg3:         #666666;
  --red:         #cc3939;
  --red-dim:     rgba(204,57,57,0.1);
  --school:      #f59e0b;
  --hospital:    #ef4444;
  --fire:        #f97316;
  --police:      #3b82f6;
  --r:           6px;
  --r2:          8px;
  --topbar-h:    50px;
  --sidebar-w:   248px;
  --rp-w:        290px;
  --sb-h:        27px;
  --shadow:      0 4px 20px rgba(0,0,0,0.65);
  --shadow-s:    0 2px 8px rgba(0,0,0,0.5);
}

html, body {
  height: 100%; width: 100%; overflow: hidden;
  font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
  font-size: 13px; background: var(--bg); color: var(--fg);
  -webkit-font-smoothing: antialiased;
}

/* ── SHELL ──────────────────────────────────────────────── */
.app-shell { display: flex; flex-direction: column; height: 100vh; width: 100vw; overflow: hidden; }

/* ── TOP BAR ────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h); flex-shrink: 0;
  background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 14px; gap: 0; z-index: 200;
}

.topbar-brand {
  display: flex; align-items: center;
  padding-right: 16px; border-right: 1px solid var(--border);
  min-width: 68px;
}
.brand-name {
  font-size: 18px; font-weight: 800; letter-spacing: -1px;
  color: var(--brand); font-variant-numeric: tabular-nums;
}

/* Nav tabs */
.topbar-nav { display: flex; align-items: center; gap: 1px; padding: 0 10px; height: 100%; }
.nav-tab {
  display: flex; align-items: center; gap: 6px;
  height: 100%; padding: 0 12px;
  border: none; background: none;
  color: var(--fg2); font-family: inherit; font-size: 12.5px; font-weight: 500;
  cursor: pointer; border-bottom: 2px solid transparent;
  transition: color .14s, border-color .14s; white-space: nowrap;
}
.nav-tab:hover { color: var(--fg); }
.nav-tab.active { color: var(--fg); border-bottom-color: var(--brand); }
.nav-tab svg { opacity: 0.65; flex-shrink: 0; }
.nav-tab.active svg { opacity: 1; }

.topbar-end { display: flex; align-items: center; gap: 10px; margin-left: auto; }

/* Search */
.search-wrap { position: relative; display: flex; align-items: center; }
.search-ico { position: absolute; left: 9px; color: var(--fg3); pointer-events: none; }
.search-wrap input {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r); color: var(--fg); font-family: inherit; font-size: 12.5px;
  padding: 6px 10px 6px 28px; width: 190px; outline: none;
  transition: border-color .14s, box-shadow .14s;
}
.search-wrap input::placeholder { color: var(--fg3); }
.search-wrap input:focus { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(62,207,142,0.14); }

.search-results {
  position: absolute; top: calc(100% + 5px); left: 0; right: 0; min-width: 240px;
  background: var(--surface-2); border: 1px solid var(--border-2);
  border-radius: var(--r2); box-shadow: var(--shadow); z-index: 500;
  display: none; overflow: hidden;
}
.sr-item {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 12px; cursor: pointer;
  border-bottom: 1px solid var(--border); transition: background .1s;
}
.sr-item:last-child { border-bottom: none; }
.sr-item:hover { background: var(--surface-3); }
.sr-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.sr-name { font-size: 12.5px; color: var(--fg); }
.sr-type { font-size: 11px; color: var(--fg3); }

.live-pill {
  display: flex; align-items: center; gap: 5px;
  background: rgba(62,207,142,0.08); border: 1px solid rgba(62,207,142,0.22);
  border-radius: 20px; padding: 4px 10px;
  font-size: 11.5px; font-weight: 600; color: var(--brand);
}
.live-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--brand);
  position: relative; flex-shrink: 0;
}
.live-dot::after {
  content: ''; position: absolute; inset: -3px; border-radius: 50%;
  border: 1.5px solid var(--brand); animation: livepulse 2s ease infinite;
}
@keyframes livepulse { 0% { opacity: .7; transform: scale(1); } 100% { opacity: 0; transform: scale(2.6); } }

/* ── BODY ───────────────────────────────────────────────── */
.body-wrap { flex: 1; display: flex; overflow: hidden; }

/* ── SIDEBAR ────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--surface); border-right: 1px solid var(--border);
  overflow-y: auto; overflow-x: hidden;
  scrollbar-width: thin; scrollbar-color: var(--border-2) transparent;
}
.sidebar::-webkit-scrollbar { width: 3px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 3px; }

.sb-panel { display: none; }
.sb-panel.active { display: block; }

.sb-group { padding: 13px 11px; border-bottom: 1px solid var(--border); transition: background .15s; }
.sb-group:last-child { border-bottom: none; }
.sb-group.panel-flash { background: rgba(62,207,142,.07); }
.sb-group-label {
  font-size: 10.5px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.9px; color: var(--fg3); margin-bottom: 9px;
}

/* Layer items */
.layer-item {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 8px; border-radius: var(--r); margin-bottom: 3px;
  border: 1px solid transparent; cursor: default;
  transition: background .12s;
}
.layer-item:hover { background: var(--surface-3); border-color: var(--border); }
.layer-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.layer-text { flex: 1; display: flex; flex-direction: column; gap: 1px; }
.layer-name { font-size: 12.5px; font-weight: 500; color: var(--fg); }
.layer-count { font-size: 11px; color: var(--fg3); }

/* Toggle */
.sb-toggle {
  width: 30px; height: 16px; border-radius: 20px;
  background: var(--border-2); border: 1px solid var(--border-2);
  position: relative; cursor: pointer; flex-shrink: 0;
  transition: background .2s, border-color .2s;
}
.sb-toggle::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--fg3); transition: transform .2s, background .2s;
}
.sb-toggle.on { background: rgba(62,207,142,0.18); border-color: var(--brand-ring); }
.sb-toggle.on::after { transform: translateX(14px); background: var(--brand); }

/* Tool buttons */
.sb-tool {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 8px 9px; border-radius: var(--r);
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--fg2); font-family: inherit; font-size: 12.5px; font-weight: 500;
  cursor: pointer; margin-bottom: 5px;
  transition: all .14s; text-align: left;
}
.sb-tool:hover, .sb-tool.active { border-color: var(--brand-ring); color: var(--brand); background: var(--brand-dim); }
.sb-tool svg { flex-shrink: 0; }

/* Style pills */


/* View row */
.view-row { display: flex; gap: 4px; }
.view-btn {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 5px;
  padding: 7px 4px; border-radius: var(--r);
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--fg2); font-family: inherit; font-size: 11.5px; font-weight: 500; cursor: pointer;
  transition: all .14s;
}
.view-btn:hover { border-color: var(--border-2); color: var(--fg); }
.view-btn.active { border-color: var(--brand); color: var(--brand); background: var(--brand-dim); }
.view-btn svg { flex-shrink: 0; }

/* Facility list (Schools / Medical panels) */
.facility-list { display: flex; flex-direction: column; gap: 3px; }
.facility-row {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 9px; border-radius: var(--r);
  border: 1px solid var(--border); background: var(--surface-2);
  cursor: pointer; transition: all .14s;
}
.facility-row:hover { border-color: var(--brand-ring); background: var(--brand-dim); }
.facility-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.facility-name { font-size: 12px; font-weight: 500; color: var(--fg); flex: 1; line-height: 1.3; }
.facility-fly {
  width: 22px; height: 22px; flex-shrink: 0;
  border-radius: 4px; border: 1px solid var(--border);
  background: var(--surface-3); color: var(--fg3);
  display: flex; align-items: center; justify-content: center;
  transition: all .12s;
}
.facility-row:hover .facility-fly { border-color: var(--brand-ring); color: var(--brand); }
.facility-fly svg { width: 10px; height: 10px; }

/* Empty state */
.empty-state {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  padding: 30px 16px; text-align: center;
}
.empty-state svg { opacity: 0.4; }
.empty-state span { font-size: 12.5px; font-weight: 500; color: var(--fg2); }
.empty-state p { font-size: 11px; color: var(--fg3); }

/* ── MAP ────────────────────────────────────────────────── */
.map-wrap { flex: 1; position: relative; overflow: hidden; }
#map { position: absolute; inset: 0; }

.maplibregl-ctrl-group,
.maplibregl-ctrl-attrib,
.maplibregl-ctrl-logo { display: none !important; }

.map-controls {
  position: absolute; bottom: 16px; right: 14px;
  display: flex; flex-direction: column; gap: 4px; z-index: 10;
}
.mc-btn {
  width: 30px; height: 30px;
  background: var(--surface); border: 1px solid var(--border-2);
  border-radius: var(--r); color: var(--fg2); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .14s; box-shadow: var(--shadow-s);
}
.mc-btn:hover { border-color: var(--brand); color: var(--brand); }
.mc-sep { height: 1px; background: var(--border); margin: 2px 3px; }

/* ── RIGHT PANEL ────────────────────────────────────────── */
.right-panel {
  width: var(--rp-w); flex-shrink: 0;
  background: var(--surface); border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow-y: auto; overflow-x: hidden;
  scrollbar-width: thin; scrollbar-color: var(--border-2) transparent;
  transition: width .24s cubic-bezier(.4,0,.2,1), opacity .24s;
}
.right-panel.hidden-rp { width: 0; opacity: 0; pointer-events: none; overflow: hidden; }
.right-panel::-webkit-scrollbar { width: 3px; }
.right-panel::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 3px; }

.rp-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 13px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.rp-title { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--fg); }
.rp-x {
  width: 24px; height: 24px; border-radius: var(--r);
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--fg3); cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all .13s;
}
.rp-x:hover { color: var(--fg); border-color: var(--border-2); }

.rp-body { padding: 12px 13px; border-bottom: 1px solid var(--border); }

/* Route input boxes */
.rpt-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r2);
  padding: 8px 9px; transition: border-color .14s;
}
.rpt-box:focus-within { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(62,207,142,0.12); }
.rpt-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.rpt-dot.origin { background: var(--brand); box-shadow: 0 0 0 2px rgba(62,207,142,0.22); }
.rpt-dot.dest   { background: var(--hospital); box-shadow: 0 0 0 2px rgba(239,68,68,0.22); }
.rpt-fields { flex: 1; display: flex; flex-direction: column; gap: 1px; }
.rpt-fields label { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--fg3); }
.rpt-fields input {
  background: none; border: none; outline: none;
  color: var(--fg); font-family: inherit; font-size: 12.5px; font-weight: 500; padding: 0;
}
.rpt-fields input::placeholder { color: var(--fg3); font-weight: 400; }
.rpt-clr {
  background: none; border: none; cursor: pointer; color: var(--fg3); flex-shrink: 0; padding: 2px;
  transition: color .13s;
}
.rpt-clr:hover { color: var(--red); }

.rpt-divider { display: flex; align-items: center; gap: 5px; padding: 5px 1px; }
.rpt-line { flex: 1; height: 1px; background: var(--border); }
.swap-btn {
  width: 22px; height: 22px; border-radius: 50%;
  border: 1px solid var(--border-2); background: var(--surface-3);
  color: var(--fg3); cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: all .13s;
}
.swap-btn:hover { border-color: var(--brand); color: var(--brand); }

/* Travel modes */
.travel-modes { display: flex; gap: 5px; margin-top: 11px; }
.tmode {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 4px; border-radius: var(--r);
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--fg2); font-family: inherit; font-size: 10.5px; font-weight: 500;
  cursor: pointer; transition: all .14s;
}
.tmode:hover { border-color: var(--border-2); color: var(--fg); }
.tmode.active { border-color: var(--brand); color: var(--brand); background: var(--brand-dim); }
.tmode svg { flex-shrink: 0; }

/* ── BUTTONS ─────────────────────────────────────────────── */
.btn-primary {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 14px; border-radius: var(--r); border: none;
  background: var(--brand); color: #fff;
  font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background .14s;
}
.btn-primary:hover:not(:disabled) { background: #2ea672; }
.btn-primary:disabled { opacity: 0.38; cursor: not-allowed; background: var(--surface-3); color: var(--fg3); }
.btn-primary svg { flex-shrink: 0; }
.btn-primary.danger { background: var(--red); }
.btn-primary.danger:hover:not(:disabled) { background: #b02020; }
.w100 { width: 100%; margin-top: 11px; }

.btn-ghost {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: var(--r);
  border: 1px solid var(--border); background: transparent;
  color: var(--fg2); font-family: inherit; font-size: 12.5px; font-weight: 500; cursor: pointer;
  transition: all .14s;
}
.btn-ghost:hover { border-color: var(--border-2); color: var(--fg); }
.btn-ghost.danger { border-color: rgba(204,57,57,0.3); color: var(--red); }
.btn-ghost.danger:hover { border-color: var(--red); background: var(--red-dim); }
.btn-ghost svg { flex-shrink: 0; }

/* ── ROUTE TABS ──────────────────────────────────────────── */
.route-tabs { display: flex; border-bottom: 1px solid var(--border); padding: 0 13px; flex-shrink: 0; flex-wrap: wrap; }
.rt-tab {
  padding: 8px 12px; border: none; background: none;
  font-family: inherit; font-size: 11.5px; font-weight: 500;
  color: var(--fg3); cursor: pointer;
  border-bottom: 2px solid transparent; transition: color .14s, border-color .14s;
}
.rt-tab:hover { color: var(--fg2); }
.rt-tab.active { color: var(--brand); border-bottom-color: var(--brand); }

/* ── ROUTE RESULTS ───────────────────────────────────────── */
.route-results { padding: 13px; }

.route-summary {
  display: flex; align-items: center;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r2); padding: 14px; margin-bottom: 11px;
}
.rs-block { flex: 1; display: flex; align-items: baseline; justify-content: center; gap: 4px; }
.rs-val { font-size: 26px; font-weight: 800; color: var(--brand); line-height: 1; }
.rs-unit { font-size: 11px; color: var(--fg3); font-weight: 500; }
.rs-sep { width: 1px; height: 30px; background: var(--border); }

/* Shortcuts */
.shortcuts-wrap { display: flex; flex-direction: column; gap: 5px; margin-bottom: 11px; }
.shortcut-card {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 10px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r2); cursor: pointer; transition: all .14s;
}
.shortcut-card:hover { border-color: var(--brand-ring); background: var(--brand-dim); }
.shortcut-info { flex: 1; display: flex; flex-direction: column; gap: 1px; }
.shortcut-name { font-size: 12px; font-weight: 600; color: var(--fg); }
.shortcut-meta { font-size: 11px; color: var(--fg3); }
.sc-badge {
  font-size: 10px; font-weight: 700; padding: 2px 7px;
  border-radius: 20px; background: var(--brand-dim); border: 1px solid var(--brand-ring);
  color: var(--brand); white-space: nowrap;
}
.sc-badge.alt { background: rgba(73,115,201,0.1); border-color: rgba(73,115,201,0.3); color: var(--police); }

/* Steps */
.steps-list {
  display: flex; flex-direction: column; gap: 3px;
  max-height: 190px; overflow-y: auto; margin-bottom: 11px;
  scrollbar-width: thin; scrollbar-color: var(--border-2) transparent;
}
.step-row {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 7px 8px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--r);
}
.step-n {
  width: 17px; height: 17px; border-radius: 4px; flex-shrink: 0;
  background: var(--brand-dim); border: 1px solid var(--brand-ring);
  color: var(--brand); font-size: 9px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.step-t { font-size: 11.5px; color: var(--fg2); line-height: 1.45; }

/* Hint */
.rp-hint {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 24px 18px; text-align: center;
}
.rp-hint p { font-size: 12px; color: var(--fg3); line-height: 1.65; }
.rp-hint strong { color: var(--fg); }

/* ── STATUS BAR ──────────────────────────────────────────── */
.statusbar {
  height: var(--sb-h); flex-shrink: 0;
  background: var(--surface); border-top: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 12px; gap: 0;
}
.sb-item {
  display: flex; align-items: center; gap: 5px;
  padding: 0 10px; border-right: 1px solid var(--border);
  font-size: 11px; color: var(--fg3); white-space: nowrap;
}
.sb-item svg { width: 10px; height: 10px; flex-shrink: 0; }
.sb-center {
  flex: 1; text-align: center; font-size: 11px; color: var(--fg3);
  border-right: 1px solid var(--border); padding: 0 10px;
}

/* ── POPUPS ──────────────────────────────────────────────── */
.maplibregl-popup-content {
  background: var(--surface-2) !important;
  border: 1px solid var(--border-2) !important;
  border-radius: var(--r2) !important; padding: 0 !important;
  box-shadow: var(--shadow) !important; min-width: 210px; overflow: hidden;
}
.maplibregl-popup-tip { border-top-color: var(--border-2) !important; }
.maplibregl-popup-close-button {
  color: var(--fg3) !important; font-size: 15px !important;
  right: 7px !important; top: 7px !important;
  width: 20px !important; height: 20px !important; border-radius: 3px !important;
}
.maplibregl-popup-close-button:hover { color: var(--fg) !important; background: var(--surface-3) !important; }

.pop-head {
  display: flex; align-items: center; gap: 7px;
  padding: 10px 13px; border-bottom: 1px solid var(--border);
}
.pop-badge {
  font-size: 9px; font-weight: 700; letter-spacing: 0.5px;
  padding: 2px 5px; border-radius: 4px; border: 1px solid; flex-shrink: 0;
}
.pop-name { font-size: 13px; font-weight: 600; color: var(--fg); line-height: 1.3; }
.pop-body { padding: 8px 13px; }
.pop-row { display: flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--fg3); padding: 2px 0; }
.pop-actions { display: flex; gap: 5px; padding: 9px 13px; border-top: 1px solid var(--border); }
.pop-btn {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 5px;
  padding: 7px; border-radius: var(--r);
  border: 1px solid var(--border); background: var(--surface-3);
  color: var(--fg2); font-family: inherit; font-size: 11px; font-weight: 500;
  cursor: pointer; transition: all .12s;
}
.pop-btn:hover { border-color: var(--border-2); color: var(--fg); }
.pop-btn.primary { background: var(--brand-dim); border-color: var(--brand-ring); color: var(--brand); }
.pop-btn.primary:hover { background: rgba(62,207,142,0.18); }

/* ── ROUTE MARKERS (DOM, for drag) ──────────────────────── */
.rte-marker {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2.5px solid #fff; cursor: grab;
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
  transition: transform .14s;
}
.rte-marker:hover { transform: scale(1.25); }
.rte-marker.origin { background: var(--brand); box-shadow: 0 0 0 3px rgba(62,207,142,0.25), 0 2px 8px rgba(0,0,0,0.5); }
.rte-marker.dest   { background: var(--hospital); box-shadow: 0 0 0 3px rgba(239,68,68,0.25), 0 2px 8px rgba(0,0,0,0.5); }

/* ── LOADING ─────────────────────────────────────────────── */
.loading-screen {
  position: fixed; inset: 0; background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999; transition: opacity .5s, visibility .5s;
}
.loading-screen.done { opacity: 0; visibility: hidden; pointer-events: none; }

.ls-card {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r2); padding: 32px 38px; min-width: 260px;
}
.ls-spinner { width: 44px; height: 44px; position: relative; }
.ls-a1, .ls-a2 {
  position: absolute; inset: 0; border-radius: 50%;
  border: 2.5px solid transparent; animation: spin 1.2s linear infinite;
}
.ls-a1 { border-top-color: var(--brand); }
.ls-a2 { border-top-color: var(--police); animation-delay: -.4s; inset: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }
.ls-row { display: flex; align-items: center; justify-content: center; gap: 10px; }
.ls-title { font-size: 32px; font-weight: 800; letter-spacing: -2px; color: var(--brand); }
.ls-sub { font-size: 12px; color: var(--fg3); text-align: center; }
.ls-track { width: 100%; height: 2px; background: var(--border); border-radius: 20px; overflow: hidden; }
.ls-fill { height: 100%; background: var(--brand); width: 0%; transition: width .4s ease; }

/* ── VOICE NAVIGATION BANNER ─────────────────────────────── */
#nav-banner {
  position: absolute;
  top: 14px; left: 50%; transform: translateX(-50%);
  z-index: 200;
  background: rgba(8, 18, 30, 0.93);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(62,207,142,0.35);
  border-radius: 14px;
  padding: 12px 16px 12px 18px;
  display: flex; align-items: center; gap: 12px;
  min-width: 280px; max-width: 480px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.5), 0 0 0 1px rgba(62,207,142,0.1);
  pointer-events: auto;
  animation: bannerIn .25s ease;
}
@keyframes bannerIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-8px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
#nav-banner.hidden { display: none !important; }
.nav-left { flex: 1; min-width: 0; }
.nav-instruction {
  font-size: 14px; font-weight: 600; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nav-dist-wrap { margin-top: 3px; }
.nav-dist {
  font-size: 12px; font-weight: 500; color: var(--brand);
  background: rgba(62,207,142,0.12); padding: 1px 8px; border-radius: 20px;
}
.nav-actions { display: flex; gap: 6px; flex-shrink: 0; }
.nav-mute-btn {
  background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px; color: var(--fg2); cursor: pointer;
  padding: 6px 8px; display: flex; align-items: center; transition: background .15s;
}
.nav-mute-btn:hover { background: rgba(255,255,255,0.13); }
.nav-mute-btn.muted { color: var(--hospital); }

/* ── START NAV BUTTON ROW ────────────────────────────────── */
.nav-btn-row {
  display: flex; gap: 8px; align-items: stretch; margin-bottom: 8px;
}
.nav-btn-row .flex-1 { flex: 1; }
.btn-icon {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--r1); color: var(--fg2); cursor: pointer;
  padding: 0 12px; display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s;
}
.btn-icon:hover { background: var(--border); color: var(--fg); }
.btn-icon.muted { color: var(--hospital); border-color: var(--hospital); }

/* ── NAV USER POSITION DOT ───────────────────────────────── */
.nav-user-dot {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--brand);
  border: 3px solid #fff;
  box-shadow: 0 0 0 4px rgba(62,207,142,0.3), 0 2px 10px rgba(0,0,0,0.5);
  cursor: default;
}

/* ── STEP ROWS (updated with icons) ─────────────────────── */
.step-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 7px 0; border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.step-row:last-child { border-bottom: none; }
.step-icon { font-size: 14px; flex-shrink: 0; width: 18px; text-align: center; margin-top: 1px; }
.step-body { flex: 1; min-width: 0; }
.step-t { color: var(--fg); line-height: 1.4; }
.step-dist { display: inline-block; margin-top: 3px; font-size: 11px; color: var(--fg3); }
.step-n { display: none; }

/* ── DRIVER LINK BUTTONS ────────────────────────────────── */
a.driver-link {
  display: flex; align-items: center; gap: 8px;
  text-decoration: none; color: inherit;
  background: rgba(62,207,142,0.06);
  border: 1px solid rgba(62,207,142,0.2);
}
a.driver-link:hover { background: rgba(62,207,142,0.12); color: var(--brand); }

/* ── DRIVER UNIT LIST (status panel) ────────────────────────── */
.dul-row {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 9px; border-radius: 7px; margin-bottom: 3px;
  color: var(--fg1);
  border: 1px solid var(--border);
  background: rgba(255,255,255,.03);
  transition: background .15s, border-color .15s;
  cursor: pointer; user-select: none;
}
.dul-row:hover { background: rgba(62,207,142,.08); border-color: rgba(62,207,142,.3); }
.dul-row.busy  { border-color: rgba(245,158,11,.25); background: rgba(245,158,11,.04); }
.dul-icon   { color: var(--fg3); flex-shrink: 0; }
.dul-name   { font-size: 12px; font-weight: 700; flex: 1; letter-spacing: .03em; }
.dul-status { font-size: 10px; color: var(--fg3); }
.dul-conn {
  width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
  background: var(--border); border: 1px solid rgba(255,255,255,.1);
}
.dul-conn.connected { background: #3ecf8e; box-shadow: 0 0 5px rgba(62,207,142,.6); }
/* ── UNIT DETAIL CARD ───────────────────────────────────────── */
.udc {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 9px; padding: 12px; margin: 4px 0 6px;
  animation: fadeSlideDown .15s ease;
}
@keyframes fadeSlideDown { from{opacity:0;transform:translateY(-6px)} to{opacity:1;transform:translateY(0)} }
.udc-header {
  display: flex; align-items: center; gap: 7px; margin-bottom: 10px;
}
.udc-id     { font-size: 13px; font-weight: 800; color: var(--fg1); flex: 1; }
.udc-status { font-size: 10px; color: var(--fg3); }
.udc-close  { background: none; border: none; color: var(--fg3); font-size: 14px; cursor: pointer; padding: 0 2px; margin-left: auto; }
.udc-close:hover { color: var(--fg1); }
.udc-rows   { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.udc-row    { display: flex; justify-content: space-between; font-size: 11px; }
.udc-lbl    { color: var(--fg3); }
.udc-val    { color: var(--fg1); font-weight: 500; text-align: right; max-width: 60%; }
.udc-val.dim { color: var(--fg3); }
.udc-inc    { color: #f59e0b; }
.udc-actions { display: flex; gap: 5px; flex-wrap: wrap; }
.udc-btn {
  flex: 1; padding: 6px 8px; border-radius: 6px; font-size: 11px; font-weight: 600;
  border: 1px solid var(--border); background: rgba(255,255,255,.04);
  color: var(--fg2); cursor: pointer; transition: all .15s; white-space: nowrap;
}
.udc-btn:hover    { background: rgba(255,255,255,.09); color: var(--fg1); }
.udc-btn.primary  { background: rgba(62,207,142,.12); border-color: rgba(62,207,142,.35); color: #3ecf8e; }
.udc-btn.primary:hover { background: rgba(62,207,142,.22); }

/* ── TOAST ───────────────────────────────────────────────── */
.ems-toast {
  position: fixed; bottom: 40px; left: 50%; transform: translateX(-50%) translateY(12px);
  background: rgba(20,30,45,0.96); color: var(--fg); font-size: 13px;
  padding: 10px 18px; border-radius: 20px; border: 1px solid var(--border);
  box-shadow: 0 4px 20px rgba(0,0,0,0.5); z-index: 9000;
  opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
  white-space: nowrap;
}
.ems-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── MISC ────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ══════════════════════════════════════════════════════════
   DISPATCH CONSOLE — index.html panels
   ══════════════════════════════════════════════════════════ */

/* ── PTT TOPBAR BUTTON ──────────────────────────────────── */
.ptt-topbar {
  display: flex; align-items: center; gap: 6px;
  padding: 0 12px; height: 32px; border-radius: var(--r);
  background: var(--surface-3); border: 1px solid var(--border-2);
  color: var(--fg2); font-size: 11px; font-weight: 600; letter-spacing: .08em;
  cursor: pointer; transition: background .15s, color .15s, border-color .15s;
  touch-action: none; user-select: none; -webkit-user-select: none;
}
.ptt-topbar svg { flex-shrink: 0; }
.ptt-topbar:hover { background: var(--surface-2); color: var(--fg); }
.ptt-topbar.tx-active {
  background: rgba(239,68,68,.15); border-color: #ef4444;
  color: #ef4444; animation: pttTopPulse 0.8s infinite;
}
@keyframes pttTopPulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(239,68,68,.4); }
  50%      { box-shadow: 0 0 0 6px rgba(239,68,68,0); }
}

/* ── PTT RADIO WRAP + CHANNEL SELECTOR ─────────────────── */
.ptt-radio-wrap {
  display: flex; align-items: center; gap: 0;
}
.ptt-ch-wrap {
  position: relative;
}
.ptt-ch-btn {
  display: flex; align-items: center; gap: 4px;
  padding: 0 8px; height: 32px; border-radius: 0 var(--r) var(--r) 0;
  background: var(--surface-2); border: 1px solid var(--border-2); border-left: none;
  color: var(--fg2); font-size: 10px; font-weight: 600; letter-spacing: .06em;
  cursor: pointer; transition: background .15s, color .15s;
  white-space: nowrap; max-width: 110px;
}
.ptt-ch-btn:hover { background: var(--surface-3); color: var(--fg); }
.ptt-ch-btn span  { overflow: hidden; text-overflow: ellipsis; max-width: 80px; }
.ptt-ch-menu {
  position: absolute; top: calc(100% + 4px); right: 0;
  min-width: 170px; background: var(--surface-1);
  border: 1px solid var(--border-2); border-radius: var(--r);
  box-shadow: 0 8px 24px rgba(0,0,0,.5);
  z-index: 9999; overflow: hidden;
}
.ptt-ch-menu.hidden { display: none; }
.ptt-ch-item {
  display: flex; align-items: center; gap: 7px;
  padding: 8px 12px; font-size: 12px; color: var(--fg2);
  cursor: pointer; transition: background .12s;
}
.ptt-ch-item:hover { background: var(--surface-2); color: var(--fg); }
.ptt-ch-item.active { color: var(--accent); background: rgba(62,207,142,.07); }
.ptt-radio-wrap .ptt-topbar { border-radius: var(--r) 0 0 var(--r); border-right: none; }

/* ── DISPATCH PANEL LAYOUT ──────────────────────────────── */
.dc-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto 1fr;
  gap: 14px;
  padding: 14px;
  height: calc(100vh - var(--topbar-h));
  overflow: hidden;
}
.dc-col-left  { display: flex; flex-direction: column; gap: 14px; overflow: hidden; }
.dc-col-right { display: flex; flex-direction: column; gap: 14px; overflow: hidden; }

/* ── SHARED CARD ────────────────────────────────────────── */
.dc-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r2);
  display: flex; flex-direction: column;
  overflow: hidden;
  min-height: 0;
}
.dc-card-hdr {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 11px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--fg2);
  flex-shrink: 0;
}
.dc-card-hdr-title { display: flex; align-items: center; gap: 6px; }
.dc-card-hdr-title svg { opacity: .7; }
.dc-card-body {
  flex: 1; overflow-y: auto; padding: 10px 14px;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.dc-card-body::-webkit-scrollbar { width: 5px; }
.dc-card-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

/* ── ACTIVE INCIDENTS BOARD ─────────────────────────────── */
.inc-card {
  background: var(--surface-3);
  border: 1px solid var(--border-2);
  border-left: 4px solid var(--border-2);
  border-radius: var(--r);
  padding: 10px 12px;
  margin-bottom: 8px;
  display: flex; align-items: flex-start; gap: 10px;
  transition: border-color .15s;
}
.inc-card:last-child { margin-bottom: 0; }
.inc-card.p1 { border-left-color: #ef4444; }
.inc-card.p2 { border-left-color: #f97316; }
.inc-card.p3 { border-left-color: #6b7280; }

.inc-card-badge {
  font-size: 10px; font-weight: 800; letter-spacing: .06em;
  padding: 3px 7px; border-radius: 4px;
  background: rgba(239,68,68,.12); color: #ef4444;
  white-space: nowrap; flex-shrink: 0; margin-top: 1px;
}
.inc-card-info { flex: 1; min-width: 0; }
.inc-card-code { font-size: 11px; font-weight: 700; color: var(--fg); margin-bottom: 2px; }
.inc-card-addr { font-size: 11px; color: var(--fg2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inc-card-meta { font-size: 10px; color: var(--fg3); margin-top: 3px; }
.inc-card-unit {
  font-size: 10px; font-weight: 700; color: var(--brand);
  background: var(--brand-dim); border: 1px solid var(--brand-ring);
  padding: 2px 6px; border-radius: 4px; white-space: nowrap;
}
.dc-empty {
  padding: 24px 0; text-align: center;
  color: var(--fg3); font-size: 12px;
}
.dc-active-count {
  font-size: 10px; font-weight: 700;
  background: var(--brand-dim); color: var(--brand);
  border: 1px solid var(--brand-ring);
  padding: 2px 7px; border-radius: 99px;
}

/* ── UNIT ROSTER ────────────────────────────────────────── */
.roster-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.roster-row:last-child { border-bottom: none; }

.roster-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 800; letter-spacing: .04em;
  flex-shrink: 0; border: 2px solid transparent;
}
.roster-avatar.amb { background: rgba(239,68,68,.15); color: #ef4444; border-color: rgba(239,68,68,.3); }
.roster-avatar.pol { background: rgba(59,130,246,.15); color: #3b82f6; border-color: rgba(59,130,246,.3); }

.roster-info { flex: 1; min-width: 0; }
.roster-name { font-size: 12px; font-weight: 700; color: var(--fg); }
.roster-detail { font-size: 10px; color: var(--fg3); margin-top: 1px; }

.roster-status {
  font-size: 10px; font-weight: 700; padding: 3px 8px;
  border-radius: 99px; white-space: nowrap;
}
.roster-status.standby  { background: rgba(107,114,128,.12); color: #9b9b9b; }
.roster-status.enroute  { background: rgba(245,158,11,.12);  color: #f59e0b; }
.roster-status.onscene  { background: rgba(239,68,68,.12);   color: #ef4444; }
.roster-status.transport{ background: rgba(59,130,246,.12);  color: #3b82f6; }
.roster-status.available{ background: rgba(62,207,142,.12);  color: var(--brand); }

.roster-loc { font-size: 10px; color: var(--fg3); text-align: right; max-width: 90px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── NEW INCIDENT FORM ───────────────────────────────────── */
.dc-form { display: flex; flex-direction: column; gap: 10px; padding: 14px; }

.dc-form label {
  font-size: 10px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--fg2); display: block;
  margin-bottom: 4px;
}
.dc-form input,
.dc-form select,
.dc-form textarea {
  width: 100%; background: var(--surface-3);
  border: 1px solid var(--border-2); border-radius: var(--r);
  color: var(--fg); font-size: 12px; padding: 8px 10px;
  outline: none; transition: border-color .15s;
}
.dc-form input:focus,
.dc-form select:focus,
.dc-form textarea:focus { border-color: var(--brand); }
.dc-form select option { background: var(--surface-3); }
.dc-form textarea { resize: vertical; min-height: 50px; max-height: 90px; }

/* Code preview pill shown below the select */
.code-preview {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border-radius: var(--r);
  background: var(--surface-3); border: 1px solid var(--border-2);
  margin-top: 4px; font-size: 11px;
  transition: background .2s;
}
.code-preview-badge {
  font-size: 10px; font-weight: 800; padding: 2px 7px;
  border-radius: 4px; white-space: nowrap;
}
.code-preview-label { color: var(--fg2); flex: 1; }
.code-preview-priority { font-size: 10px; font-weight: 700; color: var(--fg3); }

/* ── UNIT GRID ───────────────────────────────────────────── */
.dc-unit-grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 6px; margin-top: 4px;
}
.dc-unit-card {
  background: var(--surface-3);
  border: 1px solid var(--border-2);
  border-radius: var(--r); padding: 8px 10px;
  cursor: pointer; transition: border-color .15s, background .15s;
  display: flex; align-items: center; gap: 8px;
}
.dc-unit-card:hover { background: var(--surface-2); }
.dc-unit-card.selected {
  border-color: var(--brand);
  background: var(--brand-dim);
}
.dc-unit-card.unavailable { opacity: .45; pointer-events: none; }
.dc-unit-card-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.dc-unit-card-dot.standby   { background: #6b7280; }
.dc-unit-card-dot.available { background: var(--brand); }
.dc-unit-card-dot.busy      { background: #ef4444; }
.dc-unit-card-label { font-size: 11px; font-weight: 700; color: var(--fg); }
.dc-unit-card-status { font-size: 10px; color: var(--fg3); }

/* ── DISPATCH BUTTON ─────────────────────────────────────── */
.dc-dispatch-btn {
  width: 100%; padding: 11px; border-radius: var(--r);
  background: var(--brand); color: #0a0a0a;
  font-size: 13px; font-weight: 800; letter-spacing: .06em;
  text-transform: uppercase; border: none; cursor: pointer;
  transition: opacity .15s, transform .1s;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.dc-dispatch-btn:hover  { opacity: .88; }
.dc-dispatch-btn:active { transform: scale(.98); }
.dc-dispatch-btn:disabled { opacity: .35; pointer-events: none; }
.dc-dispatch-btn.dispatching {
  background: #f97316; animation: dispatchPulse .5s 3;
}
@keyframes dispatchPulse {
  0%,100% { opacity: 1; }
  50%      { opacity: .6; }
}

/* Pick-location row */
.dc-pick-row {
  display: flex; align-items: center; gap: 8px;
}
.dc-pick-row input { flex: 1; }
.dc-pick-btn {
  padding: 8px 10px; border-radius: var(--r);
  background: var(--surface-3); border: 1px solid var(--border-2);
  color: var(--fg2); font-size: 11px; font-weight: 600;
  cursor: pointer; white-space: nowrap; transition: border-color .15s, color .15s;
  display: flex; align-items: center; gap: 5px;
}
.dc-pick-btn:hover { border-color: var(--brand); color: var(--brand); }
.dc-pick-btn.picking { border-color: #f59e0b; color: #f59e0b; }

/* ── RADIO SCRIPTS PANEL ─────────────────────────────────── */
.script-list { display: flex; flex-direction: column; gap: 6px; }
.script-item {
  background: var(--surface-3); border: 1px solid var(--border-2);
  border-radius: var(--r); padding: 10px 12px;
  cursor: pointer; transition: border-color .15s, background .15s;
}
.script-item:hover { border-color: var(--brand); background: var(--brand-dim); }
.script-item-label {
  font-size: 10px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--brand); margin-bottom: 4px;
}
.script-item-text { font-size: 11px; color: var(--fg2); line-height: 1.5; }

/* 10-code quick ref */
.tencode-grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 4px;
}
.tencode-row {
  display: flex; align-items: baseline; gap: 6px;
  padding: 5px 8px; background: var(--surface-3);
  border: 1px solid var(--border); border-radius: 4px;
  font-size: 10px;
}
.tencode-code { font-weight: 800; color: var(--brand); white-space: nowrap; }
.tencode-label { color: var(--fg3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── PHONE CONNECT PANEL ─────────────────────────────────── */
.phone-info-panel {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r2); overflow: hidden;
}
.phone-info-toggle {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; cursor: pointer;
  font-size: 11px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--fg2);
  background: var(--surface-3); border: none; width: 100%;
  transition: color .15s;
}
.phone-info-toggle:hover { color: var(--fg); }
.phone-info-toggle .toggle-arrow { transition: transform .2s; }
.phone-info-toggle.open .toggle-arrow { transform: rotate(180deg); }
.phone-info-body {
  display: none; padding: 12px 14px;
  border-top: 1px solid var(--border);
}
.phone-info-body.open { display: block; }
.phone-step {
  display: flex; gap: 10px; margin-bottom: 10px;
  font-size: 11px; line-height: 1.5;
}
.phone-step:last-child { margin-bottom: 0; }
.phone-step-num {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--brand-dim); border: 1px solid var(--brand-ring);
  color: var(--brand); font-size: 10px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.phone-step-text { color: var(--fg2); }
.phone-step-text code {
  background: var(--surface-3); border: 1px solid var(--border-2);
  border-radius: 3px; padding: 0 4px;
  font-family: monospace; font-size: 10px; color: var(--fg);
}
.phone-url-display {
  margin-top: 8px; padding: 8px 10px;
  background: var(--surface-3); border: 1px solid var(--border-2);
  border-radius: var(--r); font-family: monospace; font-size: 10px;
  color: var(--brand); word-break: break-all; line-height: 1.6;
}
.phone-url-display.waiting { color: var(--fg3); font-style: italic; }

/* WS status indicator in topbar area */
.ws-status-dot {
  width: 7px; height: 7px; border-radius: 50%;
  display: inline-block; margin-right: 5px;
  background: var(--fg3); transition: background .3s;
}
.ws-status-dot.connected  { background: var(--brand); }
.ws-status-dot.connecting { background: #f59e0b; animation: wsBlink .8s infinite; }
@keyframes wsBlink { 0%,100%{opacity:1} 50%{opacity:.3} }

/* ── VEHICLE MARKERS (dispatch map) ─────────────────────── */
.vehicle-wrap {
  width: 36px; height: 36px; cursor: pointer; position: relative;
  display: flex; flex-direction: column; align-items: center;
  user-select: none;
}
.vehicle-car {
  transform-origin: center center;
  transition: transform 0.55s cubic-bezier(0.25,0.46,0.45,0.94);
}
.vehicle-label {
  margin-top: 3px; font-size: 9px; font-weight: 700; letter-spacing: .6px;
  color: rgba(255,255,255,0.92);
  background: rgba(10,14,26,0.72);
  border: 1px solid rgba(255,255,255,0.1);
  padding: 2px 7px; border-radius: 6px;
  backdrop-filter: blur(8px) saturate(1.4);
  white-space: nowrap;
  font-family: ui-monospace, monospace;
}
.vehicle-wrap.fading { opacity: 0; transform: scale(0.7); transition: opacity 1.2s ease, transform 1.2s ease; }
/* Default: lights off */
.siren-red  { opacity: 0.18; }
.siren-blue { opacity: 0.18; }
/* Crisp alternating flash — steps(1) = instant switch, realistic siren rhythm */
.siren-active .siren-red  { animation: sirenRedD  0.52s steps(1) infinite; }
.siren-active .siren-blue { animation: sirenBlueD 0.52s steps(1) infinite; }
@keyframes sirenRedD  {
  0%,49%  { opacity:1; filter:drop-shadow(0 0 6px #ef4444) drop-shadow(0 0 12px rgba(239,68,68,0.5)); }
  50%,100%{ opacity:.12; filter:none; }
}
@keyframes sirenBlueD {
  0%,49%  { opacity:.12; filter:none; }
  50%,100%{ opacity:1; filter:drop-shadow(0 0 6px #3b82f6) drop-shadow(0 0 12px rgba(59,130,246,0.5)); }
}
.vehicle-wrap[data-status="onscene"] .vehicle-car {
  animation: onSceneGlowD 1.4s ease-in-out infinite;
}
@keyframes onSceneGlowD {
  0%,100%{ filter:drop-shadow(0 0 8px rgba(245,158,11,0.45)) drop-shadow(0 4px 14px rgba(0,0,0,0.4)); }
  50%    { filter:drop-shadow(0 0 20px rgba(245,158,11,0.9)) drop-shadow(0 4px 14px rgba(0,0,0,0.4)); }
}

/* ── CONNECTED PHONES PILL ───────────────────────────────── */
.dc-phones-pill {
  display: flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 99px;
  background: var(--surface-3); border: 1px solid var(--border-2);
  font-size: 11px; font-weight: 700; color: var(--fg2);
  transition: border-color .2s, color .2s;
}
.dc-phones-pill.has-phones {
  border-color: var(--brand); color: var(--brand);
  background: var(--brand-dim);
}
.dc-phones-label { font-weight: 400; color: var(--fg3); }

/* ── CANCEL INCIDENT BUTTON ──────────────────────────────── */
.dc-cancel-btn {
  margin-left: auto; padding: 2px 7px; border-radius: 4px;
  background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3);
  color: #ef4444; font-size: 10px; cursor: pointer;
  transition: background .15s;
}
.dc-cancel-btn:hover { background: rgba(239,68,68,0.25); }
.dc-hosp-btn {
  height: 22px; padding: 0 8px; border-radius: 4px; font-size: 9px; font-weight: 700;
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.25);
  color: #f87171; cursor: pointer; transition: background .15s;
}
.dc-hosp-btn:hover { background: rgba(239,68,68,0.25); }
/* unit checkmark badge */
.unit-chk { font-size: 10px; color: var(--brand); font-weight: 800; margin-left: auto; }

/* ── UNIT ROSTER (dispatch sidebar) ─────────────────────── */
.dc-roster-row {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border-radius: 6px;
  border: 1px solid var(--border-1);
  background: var(--surface-2);
  margin-bottom: 4px;
  font-size: 12px;
}
.dc-roster-row:last-child { margin-bottom: 0; }
.unit-status-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.unit-status-dot.available  { background: #3ecf8e; box-shadow: 0 0 6px rgba(62,207,142,0.6); }
.unit-status-dot.enroute    { background: #f59e0b; box-shadow: 0 0 6px rgba(245,158,11,0.6); animation: dotPulse .8s ease-in-out infinite; }
.unit-status-dot.onscene    { background: #ef4444; box-shadow: 0 0 6px rgba(239,68,68,0.6); }
.unit-status-dot.transport  { background: #8b5cf6; box-shadow: 0 0 6px rgba(139,92,246,0.6); animation: dotPulse .8s ease-in-out infinite; }
.unit-status-dot.standby    { background: #64748b; }
.unit-status-dot.offline    { background: #334155; }
@keyframes dotPulse { 0%,100%{opacity:1} 50%{opacity:.4} }
.unit-name { font-weight: 700; color: var(--fg1); font-family: ui-monospace, monospace; font-size: 11px; letter-spacing: .4px; }
.unit-type-badge {
  font-size: 9px; font-weight: 800; letter-spacing: .8px;
  padding: 2px 5px; border-radius: 4px; text-transform: uppercase;
}
.unit-type-badge.ambulance { background: rgba(239,68,68,0.12); color: #f87171; border: 1px solid rgba(239,68,68,0.2); }
.unit-type-badge.police    { background: rgba(59,130,246,0.12); color: #60a5fa; border: 1px solid rgba(59,130,246,0.2); }
.unit-status-lbl { font-size: 10px; color: var(--fg3); margin-left: auto; }
.unit-status-lbl.enroute   { color: #f59e0b; }
.unit-status-lbl.onscene   { color: #ef4444; }
.unit-status-lbl.transport { color: #8b5cf6; }
.unit-status-lbl.available { color: #3ecf8e; }

/* ── ACTIVE INCIDENTS BOARD ──────────────────────────────── */
.dc-inc-card {
  border-radius: 7px; border: 1px solid var(--border-1);
  border-left: 3px solid #ef4444;
  background: var(--surface-2);
  padding: 8px 10px; margin-bottom: 6px;
  transition: border-color .2s;
}
.dc-inc-card:last-child { margin-bottom: 0; }
.dc-ic-top {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 4px;
}
.dc-ic-code {
  font-size: 9px; font-weight: 800; letter-spacing: .6px;
  padding: 2px 6px; border-radius: 4px;
  font-family: ui-monospace, monospace;
}
.dc-ic-unit {
  font-size: 10px; font-weight: 700; color: var(--fg2);
  font-family: ui-monospace, monospace; letter-spacing: .4px;
}
.dc-ic-status {
  font-size: 9px; color: var(--fg3);
  padding: 1px 5px; border-radius: 3px;
  background: var(--surface-3);
}
.dc-ic-age {
  font-size: 9px; color: var(--fg3);
  margin-left: auto; font-variant-numeric: tabular-nums;
}
.dc-ic-addr {
  font-size: 11px; color: var(--fg2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ── INCIDENT MAP PIN PULSE ──────────────────────────────── */
@keyframes incPulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.5), 0 2px 8px rgba(0,0,0,0.4); }
  50%     { box-shadow: 0 0 0 8px rgba(239,68,68,0), 0 2px 8px rgba(0,0,0,0.4); }
}

/* ── DC SCRIPT BUTTONS ───────────────────────────────────── */
.dc-script-btn {
  width: 100%; text-align: left; padding: 8px 10px; border-radius: 6px;
  background: var(--surface-2); border: 1px solid var(--border-1);
  color: var(--fg2); font-size: 11px; cursor: pointer;
  transition: background .15s, border-color .15s;
  margin-bottom: 4px;
}
.dc-script-btn:hover { background: var(--surface-3); border-color: var(--border-2); color: var(--fg1); }
.dc-script-btn:last-child { margin-bottom: 0; }

/* ── UNIT CARD CALL BUTTON ───────────────────────────────────── */
.unit-call-btn {
  margin-left: auto; width: 22px; height: 22px; border-radius: 5px;
  background: rgba(59,130,246,0.1); border: 1px solid rgba(59,130,246,0.25);
  color: #60a5fa; cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background .15s, border-color .15s, transform .1s;
  flex-shrink: 0;
}
.unit-call-btn:hover { background: rgba(59,130,246,0.25); border-color: #3b82f6; transform: scale(1.1); }
.dc-unit-card.calling .unit-call-btn {
  background: rgba(59,130,246,0.35); border-color: #3b82f6;
  animation: callBtnPulse .6s steps(1) infinite;
}
@keyframes callBtnPulse {
  0%,49% { background: rgba(59,130,246,0.5); }
  50%,100%{ background: rgba(59,130,246,0.1); }
}

/* ── HOSPITAL CAPACITY BOARD ─────────────────────────────── */
.hosp-cap-row {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 0; border-bottom: 1px solid var(--border);
  font-size: 10px;
}
.hosp-cap-row:last-child { border-bottom: none; }
.hosp-cap-name { width: 80px; flex-shrink: 0; color: var(--fg2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hosp-cap-bar { flex: 1; height: 4px; background: var(--surface-3); border-radius: 2px; overflow: hidden; }
.hosp-cap-fill { height: 100%; border-radius: 2px; background: #3ecf8e; transition: width .4s; }
.cap-busy .hosp-cap-fill { background: #f59e0b; }
.cap-full .hosp-cap-fill { background: #ef4444; }
.hosp-cap-pct { width: 32px; text-align: right; flex-shrink: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.cap-ok   .hosp-cap-pct { color: #3ecf8e; }
.cap-busy .hosp-cap-pct { color: #f59e0b; }
.cap-full .hosp-cap-pct { color: #ef4444; animation: capBlink .8s steps(1) infinite; }
@keyframes capBlink { 0%,49%{opacity:1} 50%,100%{opacity:.3} }

/* ── AUTO-REROUTE ALERT ───────────────────────────────────── */
.reroute-alert {
  position: fixed; bottom: 80px; right: 16px; z-index: 1000;
  width: 280px; animation: raSlideIn .3s ease;
}
@keyframes raSlideIn { from { opacity:0; transform: translateX(20px); } to { opacity:1; transform: translateX(0); } }
.reroute-alert-body {
  background: rgba(15,18,26,0.95); border: 1.5px solid #f59e0b;
  border-radius: 10px; padding: 14px 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
  backdrop-filter: blur(16px);
}
.reroute-alert-title {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700; color: #f59e0b; margin-bottom: 5px;
}
.reroute-alert-sub { font-size: 11px; color: var(--fg2); margin-bottom: 8px; line-height: 1.4; }
.reroute-alert-countdown { font-size: 10px; color: var(--fg3); margin-bottom: 10px; font-variant-numeric: tabular-nums; }
.reroute-cancel-btn {
  width: 100%; padding: 7px; border-radius: 6px;
  background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3);
  color: #ef4444; font-size: 11px; font-weight: 600; cursor: pointer;
  transition: background .15s;
}
.reroute-cancel-btn:hover { background: rgba(239,68,68,0.25); }
.dc-script-btn:last-child { margin-bottom: 0; }

/* ── ON-SCENE HOSPITAL / POLICE PICKER ───────────────────────── */
.on-scene-picker {
  margin-top: 10px; padding: 10px; border-radius: 8px;
  background: rgba(15,23,42,0.95); border: 1px solid rgba(248,113,113,0.3);
  position: relative;
}
.osp-title { font-size: 10px; font-weight: 700; color: #f87171; margin-bottom: 8px; text-transform: uppercase; letter-spacing: .05em; }
.osp-list { display: flex; flex-direction: column; gap: 4px; }
.osp-item {
  width: 100%; text-align: left; padding: 7px 10px; border-radius: 6px;
  background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08);
  color: var(--fg1); cursor: pointer; display: flex; align-items: center; justify-content: space-between;
  gap: 8px; transition: background .15s;
}
.osp-item:hover { background: rgba(255,255,255,0.1); }
.osp-item.osp-full { opacity: .5; pointer-events: none; }
.osp-name { font-size: 11px; font-weight: 600; }
.osp-meta { font-size: 10px; color: var(--fg3); }
.osp-close {
  position: absolute; top: 6px; right: 6px; width: 18px; height: 18px;
  background: transparent; border: none; color: var(--fg3); cursor: pointer; font-size: 12px;
}

/* ── MAYDAY ALERT (dispatch) ────────────────────────────────── */
.mayday-alert {
  position: fixed; top: 80px; left: 50%; transform: translateX(-50%);
  z-index: 9999; min-width: 280px;
  background: rgba(15,4,4,.97); border: 2px solid #ef4444;
  border-radius: 16px; padding: 18px 20px;
  backdrop-filter: blur(18px);
  box-shadow: 0 0 40px rgba(239,68,68,.4);
  animation: maydayPop .3s ease;
}
@keyframes maydayPop { from{opacity:0;transform:translateX(-50%) scale(.9)} to{opacity:1;transform:translateX(-50%) scale(1)} }
.mayday-header { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 900; color: #ef4444; margin-bottom: 6px; letter-spacing: .04em; }
.mayday-body { font-size: 13px; color: #fca5a5; margin-bottom: 14px; }
.mayday-ack { width: 100%; padding: 10px; border-radius: 10px; background: rgba(239,68,68,.2); border: 1.5px solid rgba(239,68,68,.5); color: #ef4444; font-size: 13px; font-weight: 700; cursor: pointer; }
.mayday-ack:hover { background: rgba(239,68,68,.35); }

/* ── HAZARD DOT (dispatch + monitor map) ────────────────────── */
.dispatch-hazard-dot {
  position: relative;
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(245,158,11,.15); border: 2px solid #f59e0b;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; cursor: default;
  box-shadow: 0 0 14px rgba(245,158,11,.3);
  animation: hazardPulse 2s ease infinite;
}
.dispatch-hazard-dot.sev-major {
  border-color: #f97316; background: rgba(249,115,22,.15);
  box-shadow: 0 0 16px rgba(249,115,22,.4);
}
.dispatch-hazard-dot.sev-critical {
  border-color: #ef4444; background: rgba(239,68,68,.18);
  box-shadow: 0 0 20px rgba(239,68,68,.5);
  animation: critHazardDisp .7s steps(1) infinite;
}
@keyframes hazardPulse    { 0%,100%{box-shadow:0 0 14px rgba(245,158,11,.3)} 50%{box-shadow:0 0 22px rgba(245,158,11,.6)} }
@keyframes critHazardDisp { 0%,100%{opacity:1;box-shadow:0 0 20px rgba(239,68,68,.5)} 50%{opacity:.6;box-shadow:0 0 8px rgba(239,68,68,.2)} }

/* dismiss × button on hazard dot */
.dhd-emoji   { pointer-events: none; }
.dhd-dismiss {
  display: none; position: absolute; top: -6px; right: -6px;
  width: 16px; height: 16px; border-radius: 50%;
  background: #ef4444; border: 1.5px solid #fff;
  color: #fff; font-size: 10px; font-weight: 900; line-height: 1;
  cursor: pointer; align-items: center; justify-content: center; padding: 0;
}
.dispatch-hazard-dot:hover .dhd-dismiss { display: flex; }

/* ── ADMITTED BADGE ─────────────────────────────────────────── */
.dc-admitted-badge {
  display: block; margin-top: 4px;
  color: #3ecf8e; font-size: 10px; font-weight: 700; letter-spacing: .06em;
}
.dc-ic-vitals {
  font-size: 10px; color: var(--fg3); margin-top: 3px; font-family: monospace;
}

/* ── SELF-INIT BADGE ────────────────────────────────────────── */
.dc-selfinit-badge {
  display: inline-block; background: rgba(251,146,60,.15); color: #fb923c;
  border: 1px solid rgba(251,146,60,.4); border-radius: 4px;
  font-size: 9px; font-weight: 800; padding: 1px 5px; letter-spacing: .08em;
  margin-right: 4px;
}

/* ── MCI BADGE ──────────────────────────────────────────────── */
.dc-mci-badge {
  display: inline-block; background: rgba(239,68,68,.18); color: #ef4444;
  border: 1px solid rgba(239,68,68,.4); border-radius: 4px;
  font-size: 9px; font-weight: 800; padding: 1px 5px; letter-spacing: .1em;
  margin-right: 4px;
}

/* ── MCI CHECKBOX ROW ───────────────────────────────────────── */
.dc-mci-row {
  display: flex; align-items: center; gap: 8px;
  margin: 8px 0 4px; cursor: pointer; user-select: none;
}
.dc-mci-row input[type="checkbox"] { accent-color: #ef4444; width: 14px; height: 14px; cursor: pointer; }
.dc-mci-label { font-size: 11px; color: #ef4444; font-weight: 600; letter-spacing: .04em; }

/* ── INCIDENT LOG DRAWER ────────────────────────────────────── */
#inc-log-drawer {
  position: fixed; right: -380px; top: 0; bottom: 0; width: 360px;
  background: var(--surface); border-left: 1px solid var(--border);
  z-index: 800; display: flex; flex-direction: column;
  transition: right .3s cubic-bezier(.4,0,.2,1);
  box-shadow: -4px 0 24px rgba(0,0,0,.4);
}
#inc-log-drawer.open { right: 0; }
.ild-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border-bottom: 1px solid var(--border);
  background: var(--surface2); gap: 8px;
}
.ild-tabs { display: flex; gap: 4px; flex: 1; }
.ild-tab {
  flex: 1; padding: 6px 0; border-radius: 6px; font-size: 11px; font-weight: 700;
  border: 1.5px solid transparent; background: transparent; color: var(--fg3);
  cursor: pointer; transition: all .15s; letter-spacing: .04em;
}
.ild-tab.active { border-color: var(--brand); color: var(--brand); background: rgba(62,207,142,.08); }
.ild-tab:hover:not(.active) { color: var(--fg1); background: rgba(255,255,255,.05); }
.ild-close { background: none; border: none; color: var(--fg3); font-size: 18px; cursor: pointer; padding: 0 4px; }
.ild-close:hover { color: var(--fg1); }
.ild-body { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.ild-empty { color: var(--fg3); font-size: 13px; text-align: center; padding: 32px 0; }
.ild-row {
  background: var(--surface2); border-radius: 8px; padding: 10px 12px;
  border-left: 3px solid var(--border);
}
.ild-row.cleared  { border-left-color: #3ecf8e; }
.ild-row.admitted { border-left-color: #3ecf8e; }
.ild-row.cancelled { border-left-color: #64748b; }
.ild-row-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }
.ild-badge { border-radius: 4px; font-size: 9px; font-weight: 800; padding: 2px 5px; letter-spacing: .07em; }
.ild-badge.p1 { background: rgba(239,68,68,.18); color: #ef4444; }
.ild-badge.p2 { background: rgba(245,158,11,.18); color: #f59e0b; }
.ild-badge.p3 { background: rgba(62,207,142,.18); color: #3ecf8e; }
.ild-mci { font-size: 9px; font-weight: 800; color: #ef4444; background: rgba(239,68,68,.12); border-radius: 3px; padding: 1px 4px; }
.ild-unit { font-size: 11px; font-weight: 700; color: var(--fg1); }
.ild-time { font-size: 10px; color: var(--fg3); margin-left: auto; }
.ild-dur  { font-size: 10px; color: var(--fg3); }
.ild-reason { font-size: 9px; font-weight: 700; padding: 2px 5px; border-radius: 3px; text-transform: uppercase; letter-spacing: .06em; }
.ild-reason.cleared  { background: rgba(62,207,142,.15); color: #3ecf8e; }
.ild-reason.admitted { background: rgba(62,207,142,.15); color: #3ecf8e; }
.ild-reason.cancelled { background: rgba(100,116,139,.2); color: #94a3b8; }
.ild-type { font-size: 12px; font-weight: 600; color: var(--fg1); }
.ild-addr { font-size: 11px; color: var(--fg3); }
.ild-hosp { font-size: 11px; color: #3ecf8e; margin-top: 2px; }
.ild-sev-badge {
  font-size: 9px; font-weight: 800; padding: 1px 5px; border-radius: 3px;
  border: 1px solid; letter-spacing: .07em;
}
.hazard-row { cursor: default; }
.ild-title { font-weight: 700; font-size: 14px; color: var(--fg1); }

/* ════════════════════════════════════════════════════════════
   CAD FULL-SCREEN DISPATCH MODE
   ════════════════════════════════════════════════════════════ */

/* Expand sidebar to full width when dispatch tab is active */
.app-shell.dispatch-active .sidebar {
  width: 100%; flex-shrink: 0;
}
.app-shell.dispatch-active .map-wrap { display: none; }

/* Panel fills remaining height */
.app-shell.dispatch-active #panel-incidents.active {
  display: flex; flex-direction: column; height: calc(100vh - var(--topbar-h)); overflow: hidden;
}

/* ── 3-COLUMN CAD GRID ─────────────────────────────────────── */
.cad-layout {
  display: grid;
  grid-template-columns: 320px 1fr 280px;
  height: 100%;
  overflow: hidden;
}

.cad-col {
  display: flex; flex-direction: column; overflow: hidden;
  border-right: 1px solid var(--border);
}
.cad-col:last-child { border-right: none; }

.cad-col-hdr {
  flex-shrink: 0;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--fg2);
  display: flex; align-items: center; justify-content: space-between;
}
.cad-col-hdr svg { opacity: .6; }

.cad-col-body {
  flex: 1; overflow-y: auto; padding: 12px 13px;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.cad-col-body::-webkit-scrollbar { width: 4px; }
.cad-col-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

/* ── SHARED CAD UTILITIES ──────────────────────────────────── */
.cad-badge {
  font-size: 10px; font-weight: 700;
  background: var(--brand-dim); color: var(--brand);
  border: 1px solid var(--brand-ring);
  padding: 1px 7px; border-radius: 99px;
}
.cad-empty {
  text-align: center; padding: 36px 14px;
  color: var(--fg3); font-size: 12px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.cad-sub-hdr {
  font-size: 9.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--fg3); padding: 10px 0 5px;
  border-top: 1px solid var(--border);
  margin-top: 10px;
  display: flex; align-items: center; justify-content: space-between;
}
.cad-sub-hdr:first-child { border-top: none; margin-top: 0; padding-top: 0; }
.cad-toggle {
  background: none; border: none; color: var(--fg3); cursor: pointer; font-size: 12px; padding: 0 2px;
}
.cad-toggle:hover { color: var(--fg1); }
.cad-hint { font-weight: 400; font-size: 9px; color: var(--fg3); text-transform: none; letter-spacing: 0; }

/* ── CAD FORM FIELDS ───────────────────────────────────────── */
.cad-field { margin-bottom: 10px; }
.cad-field:last-child { margin-bottom: 0; }
.cad-field > label {
  display: block; font-size: 9.5px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--fg2); margin-bottom: 4px;
}
.cad-field input, .cad-field select, .cad-field textarea {
  width: 100%; background: var(--surface-3);
  border: 1px solid var(--border-2); border-radius: 6px;
  color: var(--fg); font-size: 12px; padding: 8px 10px;
  outline: none; transition: border-color .15s; font-family: inherit;
  box-sizing: border-box;
}
.cad-field input:focus, .cad-field select:focus, .cad-field textarea:focus {
  border-color: var(--brand);
}
.cad-field select option { background: var(--surface-3); }
.cad-field textarea { resize: none; min-height: 52px; }
.cad-field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.cad-field-pair .cad-field { margin-bottom: 0; }

.cad-loc-row { display: flex; gap: 6px; }
.cad-loc-row input { flex: 1; }

/* ── CALLER LOCATION PIN ─────────────────────────────────── */
.caller-pin { position: relative; width: 36px; height: 36px; cursor: pointer; }
.caller-pulse {
  position: absolute; inset: 0; border-radius: 50%;
  background: rgba(239,68,68,.35);
  animation: caller-pulse 1.2s ease-out infinite;
}
.caller-dot {
  position: absolute; inset: 8px; border-radius: 50%;
  background: #ef4444; border: 2.5px solid #fff;
  box-shadow: 0 0 10px rgba(239,68,68,.7);
}
@keyframes caller-pulse {
  0%   { transform: scale(.8); opacity: .9; }
  70%  { transform: scale(2.2); opacity: 0; }
  100% { transform: scale(.8); opacity: 0; }
}
.caller-popup .maplibregl-popup-content {
  background: #111827; border: 1px solid #1e293b;
  border-radius: 10px; padding: 10px 12px; min-width: 200px;
  box-shadow: 0 8px 24px rgba(0,0,0,.5);
}
.cp-header { font-size: 12px; color: #94a3b8; margin-bottom: 4px; }
.cp-acc    { font-size: 11px; color: #3ecf8e; margin-bottom: 8px; }
.cp-btn {
  width: 100%; padding: 8px; border-radius: 7px; border: none; cursor: pointer;
  background: #3ecf8e; color: #051c10; font-size: 12px; font-weight: 700;
}

/* ── WHISPER TRANSCRIPTION ──────────────────────────────── */
.transcribe-status {
  margin-top: 5px; padding: 6px 10px; border-radius: 6px;
  font-size: 11px; font-weight: 600; letter-spacing: .02em;
  border: 1px solid var(--border);
}
.transcribe-status.recording { background: rgba(239,68,68,.1); color: #ef4444; border-color: rgba(239,68,68,.3); }
.transcribe-status.processing { background: rgba(245,158,11,.1); color: #f59e0b; border-color: rgba(245,158,11,.3); }
.transcribe-status.done { background: rgba(62,207,142,.1); color: var(--accent); border-color: rgba(62,207,142,.3); }
.transcribe-status.error { background: rgba(239,68,68,.08); color: #ef4444; border-color: rgba(239,68,68,.2); }

/* ── COMPOUND QUICK-SELECT ──────────────────────────────── */
.cad-label-btn {
  float: right; margin-left: 8px;
  font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 4px;
  border: 1px solid var(--border-2); background: var(--surface-2);
  color: var(--accent); cursor: pointer; letter-spacing: .03em;
}
.cad-label-btn:hover { background: rgba(62,207,142,.1); }
.compound-grid {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 200;
  background: var(--surface); border: 1px solid var(--border-2);
  border-radius: var(--r); box-shadow: 0 8px 24px rgba(0,0,0,.5);
  overflow: hidden;
}
.compound-grid.hidden { display: none; }
.cg-search {
  width: 100%; padding: 9px 12px; border: none; border-bottom: 1px solid var(--border);
  background: var(--surface-2); color: var(--fg); font-size: 12px; outline: none;
}
.cg-list { max-height: 220px; overflow-y: auto; }
.cg-item {
  padding: 9px 14px; font-size: 12px; color: var(--fg2); cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.cg-item:hover { background: var(--surface-2); color: var(--accent); }
.cg-item:last-child { border-bottom: none; }

/* ── ADDRESS VALIDATION BADGE ───────────────────────────── */
.dc-addr-badge {
  display: inline-block; font-size: 10px; font-weight: 600;
  padding: 2px 7px; border-radius: 3px; margin-top: 3px;
  letter-spacing: .04em;
}
.dc-addr-badge.checking   { background: rgba(100,116,139,.15); color: var(--fg3); }
.dc-addr-badge.valid      { background: rgba(62,207,142,.15);  color: #3ecf8e; }
.dc-addr-badge.unconfirmed{ background: rgba(245,158,11,.15);  color: #f59e0b; }

/* ── LOCATION INTELLIGENCE PANEL ───────────────────────── */
.dc-location-intel {
  margin: 6px 0 10px; border-radius: var(--r);
  overflow: hidden; border: 1px solid var(--border-2);
  background: var(--surface-2);
}
.dc-location-intel.hidden { display: none; }
.dcli-loading { padding: 8px 12px; font-size: 11px; color: var(--fg3); font-style: italic; }
.dcli-sv { position: relative; line-height: 0; }
.dcli-sv-img { width: 100%; height: 160px; object-fit: cover; display: block; }
.dcli-sv-badge {
  position: absolute; bottom: 6px; left: 8px;
  background: rgba(0,0,0,.65); color: #fff; font-size: 9px; font-weight: 700;
  padding: 2px 6px; border-radius: 3px; letter-spacing: .06em; text-transform: uppercase;
}
.dcli-units { padding: 8px 10px; border-top: 1px solid var(--border); }
.dcli-section-label { font-size: 9px; font-weight: 700; color: var(--fg3);
                      letter-spacing: .1em; text-transform: uppercase; margin-bottom: 5px; }
.dcli-unit-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11px; color: var(--fg2); padding: 3px 0;
}
.dcli-unit-row.best { color: var(--accent); font-weight: 600; }
.dcli-unit-eta { font-size: 10px; color: var(--fg3); }
.dcli-unit-row.best .dcli-unit-eta { color: var(--accent); opacity: .8; }
.dcli-weather {
  display: flex; align-items: center; gap: 7px;
  padding: 6px 10px; border-top: 1px solid var(--border);
  font-size: 11px; color: var(--fg2);
}
.dcli-w-icon { font-size: 14px; }

/* ── UNIFIED LOCATION SUGGEST DROPDOWN ──────────────────── */
.road-suggest {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 600;
  background: var(--surface-1); border: 1px solid var(--border-2); border-top: none;
  border-radius: 0 0 var(--r) var(--r); max-height: 260px; overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0,0,0,.5);
}
.road-suggest.hidden { display: none; }
.road-suggest-item {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 12px; cursor: pointer; transition: background .1s;
}
.road-suggest-item:hover { background: var(--surface-2); }
.rsi-icon { flex-shrink: 0; color: var(--fg3); margin-top: 1px; }
.rsi-body { display: flex; flex-direction: column; min-width: 0; }
.rsi-label { font-size: 12px; font-weight: 600; color: var(--fg);
             white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rsi-sub   { font-size: 10px; color: var(--fg3); margin-top: 1px; }
.rsi-searching { padding: 6px 12px; font-size: 10px; color: var(--fg3); font-style: italic; }
.cad-pin-btn {
  flex-shrink: 0;
  display: flex; align-items: center; gap: 4px;
  padding: 0 10px; border-radius: 6px; font-size: 11px; font-weight: 600;
  background: var(--surface-3); border: 1px solid var(--border-2);
  color: var(--fg2); cursor: pointer; transition: all .15s; white-space: nowrap;
}
.cad-pin-btn:hover { border-color: var(--brand); color: var(--brand); }
.cad-pin-btn.picking { border-color: #f59e0b; color: #f59e0b; background: rgba(245,158,11,.08); }

/* ── CAD INCIDENT CARDS ────────────────────────────────────── */
.cic {
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-left: 4px solid #6b7280;
  border-radius: 8px;
  margin-bottom: 10px;
  overflow: hidden;
  animation: cicIn .15s ease;
}
@keyframes cicIn { from{opacity:0;transform:translateY(-4px)} to{opacity:1;transform:translateY(0)} }
.cic.p1 { border-left-color: #ef4444; }
.cic.p2 { border-left-color: #f97316; }
.cic.p3 { border-left-color: #6b7280; }

.cic-top {
  display: flex; align-items: center; gap: 7px;
  padding: 9px 11px 5px;
}
.cic-priority {
  font-size: 9px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  padding: 2px 6px; border-radius: 4px; flex-shrink: 0;
}
.cic-priority.echo, .cic-priority.delta { background: rgba(239,68,68,.15); color: #ef4444; }
.cic-priority.charlie, .cic-priority.bravo { background: rgba(249,115,22,.15); color: #f97316; }
.cic-priority.alpha { background: rgba(107,114,128,.12); color: #9b9b9b; }

.cic-code { font-size: 12px; font-weight: 700; color: var(--fg); flex: 1; }
.cic-timer {
  font-size: 11px; font-weight: 700; color: var(--brand);
  font-variant-numeric: tabular-nums; flex-shrink: 0;
}
.cic-timer.warn { color: #f59e0b; }
.cic-timer.crit { color: #ef4444; animation: timerBlink .9s steps(1) infinite; }
@keyframes timerBlink { 0%,49%{opacity:1} 50%,100%{opacity:.4} }
.cic-cancel {
  background: none; border: none; color: var(--fg3);
  font-size: 13px; cursor: pointer; padding: 0 2px; line-height: 1;
}
.cic-cancel:hover { color: #ef4444; }

.cic-addr {
  padding: 0 11px 5px;
  font-size: 12px; font-weight: 600; color: var(--fg);
}
.cic-patient {
  display: flex; align-items: center; gap: 8px;
  padding: 3px 11px 4px;
}
.cic-patient-name {
  font-size: 11px; font-weight: 700; color: #e2e8f0;
}
.cic-nhima {
  font-size: 10px; color: #3ecf8e; font-family: monospace;
  background: rgba(62,207,142,.1); padding: 1px 6px;
  border-radius: 4px; border: 1px solid rgba(62,207,142,.2);
}
.cic-complaint {
  padding: 0 11px 4px;
  font-size: 11px; color: var(--fg3); font-style: italic;
}
.cic-caller {
  padding: 0 11px 4px;
  font-size: 10px; color: var(--fg3);
}
.cic-dispatch-note {
  padding: 0 11px 4px;
  font-size: 10px; color: #f59e0b;
}

.cic-unit-row {
  display: flex; align-items: center; gap: 7px;
  padding: 6px 11px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.cic-unit {
  font-size: 10px; font-weight: 700; color: var(--brand);
  background: var(--brand-dim); border: 1px solid var(--brand-ring);
  padding: 2px 6px; border-radius: 4px;
}
.cic-status-chip {
  font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 99px; white-space: nowrap;
}
.cic-status-chip.enroute   { background: rgba(245,158,11,.12); color: #f59e0b; }
.cic-status-chip.onscene   { background: rgba(239,68,68,.12);  color: #ef4444; }
.cic-status-chip.transport { background: rgba(139,92,246,.12); color: #a78bfa; }
.cic-status-chip.available, .cic-status-chip.clear { background: rgba(62,207,142,.1); color: var(--brand); }
.cic-status-chip.standby   { background: rgba(107,114,128,.1); color: #9b9b9b; }
.cic-hosp { font-size: 10px; color: var(--fg3); margin-left: auto; white-space: nowrap; }

.cic-vitals { padding: 5px 11px; font-size: 10px; color: #f59e0b; font-family: ui-monospace, monospace; }
.cic-badges { display: flex; gap: 5px; padding: 5px 11px 0; flex-wrap: wrap; }

.cic-footer {
  display: flex; align-items: center; gap: 5px;
  padding: 7px 10px; flex-wrap: wrap;
}
.cic-act {
  padding: 4px 9px; border-radius: 5px; font-size: 10px; font-weight: 600;
  border: 1px solid var(--border-2); background: rgba(255,255,255,.04);
  color: var(--fg2); cursor: pointer; transition: all .15s; white-space: nowrap;
}
.cic-act:hover { background: rgba(255,255,255,.09); color: var(--fg); }
.cic-act.primary { background: rgba(62,207,142,.1); border-color: rgba(62,207,142,.3); color: var(--brand); }
.cic-act.primary:hover { background: rgba(62,207,142,.18); }
.cic-act.danger { color: #ef4444; border-color: rgba(239,68,68,.2); }
.cic-act.danger:hover { background: rgba(239,68,68,.08); }

.cic-note-form {
  display: none; padding: 6px 10px 8px;
  border-top: 1px solid var(--border);
}
.cic-note-form.open { display: block; }
.cic-note-ta {
  width: 100%; background: var(--surface-3);
  border: 1px solid var(--border-2); border-radius: 5px;
  color: var(--fg); font-size: 11px; padding: 6px 8px;
  resize: none; outline: none; margin-bottom: 5px;
  font-family: inherit; box-sizing: border-box;
}
.cic-note-ta:focus { border-color: var(--brand); }
.cic-log-note {
  padding: 4px 11px 4px;
  font-size: 10px; color: #a78bfa; border-top: 1px solid var(--border);
}

/* ── CAD UNIT ROSTER (right column) ───────────────────────── */
.cad-roster-row {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 6px; border-radius: 6px;
  cursor: pointer; transition: background .12s;
  margin-bottom: 2px;
}
.cad-roster-row:hover { background: rgba(255,255,255,.04); }
.crr-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 800; flex-shrink: 0;
}
.crr-avatar.amb { background: rgba(239,68,68,.12); color: #f87171; border: 1.5px solid rgba(239,68,68,.22); }
.crr-avatar.pol { background: rgba(59,130,246,.12); color: #60a5fa; border: 1.5px solid rgba(59,130,246,.22); }
.crr-info   { flex: 1; min-width: 0; }
.crr-id     { display: block; font-size: 12px; font-weight: 700; color: var(--fg); }
.crr-detail { display: block; font-size: 10px; color: var(--fg3); margin-top: 1px; }
.crr-road   { display: block; font-size: 10px; color: var(--accent); margin-top: 2px;
              white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crr-conn {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--border); flex-shrink: 0;
  transition: background .3s;
}
.crr-conn.online { background: var(--brand); box-shadow: 0 0 5px rgba(62,207,142,.45); }

/* ── PARAMEDIC DATA ON INCIDENT CARD ────────────────────────── */
.cic-procs { font-size: 10px; color: #a5b4fc; margin-top: 2px; }
.cic-vitals.pm { border-left: 2px solid rgba(139,92,246,.45); padding-left: 5px; border-radius: 0 3px 3px 0; background: rgba(139,92,246,.06); }
.cic-act.warn { background: rgba(245,158,11,.15); color: #f59e0b; border-color: rgba(245,158,11,.35); }
.cic-act.warn:hover { background: rgba(245,158,11,.25); }

/* ── ARCHIVE MODAL ──────────────────────────────────────────── */
#archive-modal { position: fixed; inset: 0; z-index: 9990; }
#arc-overlay { position: absolute; inset: 0; background: rgba(0,0,0,.55); }
#arc-drawer {
  position: absolute; top: 60px; right: 0; bottom: 0; width: min(680px, 100vw);
  background: #060f1c; border-left: 1px solid rgba(255,255,255,.1);
  display: flex; flex-direction: column;
}
.arc-hdr {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid rgba(255,255,255,.08);
  font-size: 13px; font-weight: 700; color: #e2e8f0; flex-shrink: 0;
}
.arc-hdr button { background: rgba(255,255,255,.08); border: none; color: #e2e8f0; border-radius: 6px; padding: 4px 10px; cursor: pointer; font-size: 14px; }
#arc-list { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 5px; }
.arc-row {
  display: grid; grid-template-columns: 36px 60px 100px 1fr auto 60px;
  gap: 8px; align-items: center;
  background: rgba(255,255,255,.03); border-radius: 7px; padding: 7px 10px;
  font-size: 11px; border: 1px solid rgba(255,255,255,.06);
}
.arc-pri { font-size: 10px; font-weight: 800; text-align: center; padding: 2px 5px; border-radius: 4px; }
.arc-pri.p1 { background: rgba(239,68,68,.2); color: #f87171; }
.arc-pri.p2 { background: rgba(245,158,11,.2); color: #fbbf24; }
.arc-pri.p3 { background: rgba(62,207,142,.15); color: #3ecf8e; }
.arc-unit { font-weight: 700; color: #e2e8f0; }
.arc-type { color: #94a3b8; }
.arc-addr { color: #cbd5e1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arc-time { color: #64748b; white-space: nowrap; font-size: 10px; }
.arc-reason { font-size: 9px; text-transform: uppercase; letter-spacing: .5px; font-weight: 700; text-align: right; }
.arc-reason.cleared   { color: #3ecf8e; }
.arc-reason.cancelled { color: #f59e0b; }

/* ── MAJOR INCIDENT TRIGGER BUTTON ──────────────────────── */
.mci-trigger-btn {
  display: flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 6px;
  background: rgba(239,68,68,.12); border: 1px solid rgba(239,68,68,.35);
  color: #ef4444; font-size: 10px; font-weight: 800; letter-spacing: .08em;
  cursor: pointer; transition: background .12s; white-space: nowrap; flex-shrink: 0;
}
.mci-trigger-btn:hover { background: rgba(239,68,68,.22); }

/* ── MCI OVERLAY ─────────────────────────────────────────── */
.mci-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.65);
  z-index: 1100; backdrop-filter: blur(3px);
}
.mci-overlay.hidden, .mci-modal.hidden { display: none; }

/* ── MCI MODAL ───────────────────────────────────────────── */
.mci-modal {
  position: fixed; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: min(900px, 96vw); max-height: 86vh;
  background: #060f1a;
  border: 1.5px solid rgba(239,68,68,.35); border-radius: 16px;
  z-index: 1101; display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 24px 80px rgba(0,0,0,.7);
}
.mci-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid rgba(255,255,255,.07);
  background: rgba(239,68,68,.07); flex-shrink: 0;
}
.mci-header-left { display: flex; align-items: center; gap: 10px; }
.mci-title { font-size: 15px; font-weight: 800; color: #fff; }
.mci-sub   { font-size: 11px; color: #8da3bc; }
.mci-close {
  background: none; border: none; color: #8da3bc;
  font-size: 18px; cursor: pointer; padding: 4px 8px; border-radius: 6px;
}
.mci-close:hover { background: rgba(255,255,255,.08); }

.mci-body {
  display: grid; grid-template-columns: 1fr 1fr;
  flex: 1; overflow: hidden;
}
.mci-col { padding: 18px 20px; overflow-y: auto; }
.mci-col-units { border-left: 1px solid rgba(255,255,255,.07); }

.mci-section-label {
  font-size: 9px; font-weight: 800; letter-spacing: .1em;
  text-transform: uppercase; color: #6b7280; margin-bottom: 8px;
}
.mci-type-grid {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px;
}
.mci-type-btn {
  padding: 9px 6px; border-radius: 8px;
  border: 1.5px solid rgba(255,255,255,.1);
  background: rgba(255,255,255,.04);
  color: #cbd5e1; font-size: 12px; font-weight: 600;
  cursor: pointer; transition: background .12s, border-color .12s, color .12s;
  text-align: center;
}
.mci-type-btn:hover  { background: rgba(239,68,68,.1); border-color: rgba(239,68,68,.3); color: #fff; }
.mci-type-btn.active { background: rgba(239,68,68,.18); border-color: #ef4444; color: #fff; }

.mci-pri-row { display: flex; gap: 8px; }
.mci-pri {
  flex: 1; padding: 8px; border-radius: 8px;
  border: 1.5px solid rgba(255,255,255,.1);
  background: rgba(255,255,255,.04);
  color: #8da3bc; font-size: 12px; font-weight: 700;
  cursor: pointer; transition: background .12s, border-color .12s, color .12s;
}
.mci-pri.active[data-pri="P1"] { background: rgba(239,68,68,.2); border-color: #ef4444; color: #ef4444; }
.mci-pri.active[data-pri="P2"] { background: rgba(245,158,11,.18); border-color: #f59e0b; color: #f59e0b; }

.mci-loc-row { display: flex; gap: 6px; align-items: center; }
.mci-input {
  flex: 1; width: 100%;
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.12);
  border-radius: 8px; color: #e8edf5; font-size: 13px; padding: 9px 12px;
  font-family: inherit; box-sizing: border-box;
}
.mci-input::placeholder { color: rgba(255,255,255,.2); }
.mci-textarea { width: 100%; resize: none; display: block; }

.mci-pin-btn {
  flex-shrink: 0; width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(62,207,142,.1); border: 1px solid rgba(62,207,142,.3);
  border-radius: 8px; color: #3ecf8e; cursor: pointer; transition: background .12s;
}
.mci-pin-btn.active { background: rgba(62,207,142,.25); border-color: #3ecf8e; }
.mci-pin-note { font-size: 11px; color: #3ecf8e; margin-top: 5px; }

.mci-quick-btns { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 10px; }
.mci-quick {
  padding: 5px 10px; border-radius: 6px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.05);
  color: #8da3bc; font-size: 11px; font-weight: 600; cursor: pointer;
}
.mci-quick:hover { background: rgba(255,255,255,.1); color: #fff; }
.mci-quick-clear { color: #ef4444; border-color: rgba(239,68,68,.25); }

.mci-unit-grid { display: flex; flex-direction: column; gap: 5px; }
.mci-unit-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px;
  border: 1.5px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.03);
  cursor: pointer; transition: background .12s, border-color .12s; user-select: none;
}
.mci-unit-row:hover   { background: rgba(255,255,255,.06); }
.mci-unit-row.checked { background: rgba(62,207,142,.08); border-color: rgba(62,207,142,.3); }
.mci-unit-row.unavail { opacity: .4; cursor: not-allowed; }
.mci-unit-chk {
  width: 16px; height: 16px; border-radius: 4px; flex-shrink: 0;
  border: 2px solid rgba(255,255,255,.25);
  display: flex; align-items: center; justify-content: center;
  transition: background .1s, border-color .1s;
}
.mci-unit-row.checked .mci-unit-chk { background: #3ecf8e; border-color: #3ecf8e; }
.mci-unit-chk-ico { font-size: 11px; line-height: 1; color: #050e18; font-weight: 900; }
.mci-unit-id     { font-size: 12px; font-weight: 800; color: #e8edf5; flex: 1; }
.mci-unit-type   { font-size: 10px; color: #8da3bc; }
.mci-unit-status {
  font-size: 9px; font-weight: 700; padding: 2px 7px;
  border-radius: 4px; letter-spacing: .05em; text-transform: uppercase;
}
.mci-unit-status.available { background: rgba(62,207,142,.15); color: #3ecf8e; }
.mci-unit-status.busy      { background: rgba(239,68,68,.12); color: #ef4444; }

.mci-sel-count { font-size: 11px; color: #6b7280; margin-top: 10px; text-align: right; }

.mci-footer {
  padding: 14px 20px; border-top: 1px solid rgba(255,255,255,.07);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0; background: rgba(0,0,0,.2);
}
.mci-footer-info { font-size: 11px; color: #6b7280; }
.mci-dispatch-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 11px 24px; border-radius: 8px;
  background: #ef4444; border: none; color: #fff;
  font-size: 13px; font-weight: 800; letter-spacing: .06em;
  cursor: pointer; transition: background .12s;
}
.mci-dispatch-btn:hover:not(:disabled) { background: #dc2626; }
.mci-dispatch-btn:disabled { background: rgba(239,68,68,.25); color: rgba(255,255,255,.4); cursor: not-allowed; }
