*{margin:0;padding:0;box-sizing:border-box}
body{font-family:-apple-system,BlinkMacSystemFont,'SF Pro Text','Helvetica Neue',Arial,sans-serif;background:#0d1117;color:#e6edf3;height:100vh;display:flex;flex-direction:column;overflow:hidden}

/* Header */
.dsp-header{
  display:flex;align-items:center;justify-content:space-between;
  padding:10px 20px;background:#161b22;border-bottom:1px solid #30363d;
  flex-shrink:0;height:52px;
}
.dsp-logo{font-size:13px;font-weight:900;letter-spacing:1.5px;color:#e74c3c;text-transform:uppercase}
.dsp-logo{display:flex;align-items:center;gap:8px}
.dsp-logo img{width:28px;height:28px;border-radius:7px;object-fit:cover;box-shadow:0 4px 12px rgba(114,86,211,.2)}
.dsp-logo span{color:#fff;opacity:0.5;margin-left:6px;font-weight:400;font-size:11px;letter-spacing:0.5px}
.dsp-status{display:flex;align-items:center;gap:16px;font-size:11px;font-weight:700}
.status-dot{width:7px;height:7px;border-radius:50%;background:#2ecc71;display:inline-block;margin-right:5px;box-shadow:0 0 6px #2ecc71}
.status-dot.offline{background:#e74c3c;box-shadow:0 0 6px #e74c3c}
.dsp-time{color:#8b949e;font-weight:600;font-size:12px;font-variant-numeric:tabular-nums}

/* Layout */
.dsp-body{display:flex;flex:1;overflow:hidden}

/* Sidebar */
.dsp-sidebar{
  width:300px;flex-shrink:0;background:#161b22;border-right:1px solid #30363d;
  display:flex;flex-direction:column;overflow:hidden;
  min-width:240px;max-width:520px;
}
.sidebar-scroll-area{
  overflow-y:auto;min-height:60px;max-height:none;
  flex:0 0 auto; /* height controlled by JS resize */
}
.sidebar-resizer{
  height:5px;flex-shrink:0;cursor:ns-resize;
  background:transparent;position:relative;
  transition:background .15s;
}
.sidebar-resizer::after{
  content:'';position:absolute;left:50%;top:50%;
  transform:translate(-50%,-50%);
  width:36px;height:3px;border-radius:2px;
  background:#30363d;transition:background .15s;
}
.sidebar-resizer:hover::after,.sidebar-resizer.dragging::after{background:#58a6ff;}
.sidebar-scroll-area::-webkit-scrollbar{width:5px}
.sidebar-scroll-area::-webkit-scrollbar-track{background:transparent}
.sidebar-scroll-area::-webkit-scrollbar-thumb{background:#30363d;border-radius:4px}
.sidebar-scroll-area::-webkit-scrollbar-thumb:hover{background:#484f58}
.sidebar-section{padding:12px 16px 8px;border-bottom:1px solid #21262d;flex-shrink:0}
.sidebar-section-label{
  font-size:9px;font-weight:800;color:#484f58;text-transform:uppercase;letter-spacing:0.8px;margin-bottom:8px;
  cursor:pointer;user-select:none;display:flex;align-items:center;justify-content:space-between;
}
.sidebar-section-label::after{content:'▾';font-size:10px;color:#484f58;transition:transform .2s}
.sidebar-section.collapsed .sidebar-section-label::after{transform:rotate(-90deg)}
.sidebar-section-body{overflow:hidden;transition:max-height .25s ease,opacity .2s;max-height:600px;opacity:1}
.sidebar-section.collapsed .sidebar-section-body{max-height:0!important;opacity:0}

.unit-count-row{display:flex;gap:10px;margin-bottom:4px}
.uc-badge{
  flex:1;background:#21262d;border-radius:8px;padding:6px 10px;text-align:center;
  border:1px solid #30363d;
}
.uc-num{font-size:22px;font-weight:900;line-height:1}
.uc-label{font-size:9px;color:#8b949e;font-weight:600;margin-top:2px;text-transform:uppercase}

/* Unit list */
.unit-list{flex:1;overflow-y:auto;padding:8px}
.unit-list::-webkit-scrollbar{width:4px}
.unit-list::-webkit-scrollbar-track{background:transparent}
.unit-list::-webkit-scrollbar-thumb{background:#30363d;border-radius:2px}

.unit-card{
  background:#21262d;border:1px solid #30363d;border-radius:10px;
  padding:10px 12px;margin-bottom:6px;cursor:pointer;transition:border-color 0.15s;
}
.unit-card:hover{border-color:#484f58}
.unit-card.enroute{border-left:3px solid #e74c3c}
.unit-card.onscene{border-left:3px solid #f39c12}
.unit-card.available{border-left:3px solid #2ecc71}

.uc-top{display:flex;align-items:center;gap:8px;margin-bottom:6px}
.uc-emoji{font-size:20px;line-height:1}
.uc-name{font-size:12px;font-weight:800;flex:1}
.uc-badge-status{
  font-size:8px;font-weight:900;text-transform:uppercase;letter-spacing:0.4px;
  padding:2px 7px;border-radius:10px;
}
.uc-badge-status.enroute{background:rgba(231,76,60,0.15);color:#e74c3c}
.uc-badge-status.onscene{background:rgba(243,156,18,0.15);color:#f39c12}
.uc-badge-status.available{background:rgba(46,204,113,0.15);color:#2ecc71}

.uc-meta{display:flex;gap:10px;font-size:10px;color:#8b949e;font-weight:600}
.uc-eta{color:#58a6ff;font-weight:700}
.uc-assign{
  margin-top:7px;width:100%;padding:5px;border-radius:6px;border:1px solid #30363d;
  background:rgba(255,255,255,0.04);color:#8b949e;font-size:10px;font-weight:700;
  cursor:pointer;transition:0.15s;font-family:-apple-system,BlinkMacSystemFont,'SF Pro Text','Helvetica Neue',Arial,sans-serif;text-transform:uppercase;
  letter-spacing:0.3px;
}
.uc-assign:hover{background:rgba(88,166,255,0.1);border-color:#58a6ff;color:#58a6ff}
.uc-assign.assigned{background:rgba(46,204,113,0.1);border-color:#2ecc71;color:#2ecc71}

/* Unit card quick-action row */
.uc-actions{display:flex;gap:4px;margin-top:6px;}
.uca-btn{
  flex:1;padding:4px 2px;border-radius:6px;border:1px solid #30363d;
  background:rgba(255,255,255,0.03);color:#8b949e;font-size:10px;font-weight:700;
  cursor:pointer;transition:.15s;font-family:-apple-system,BlinkMacSystemFont,'SF Pro Text','Helvetica Neue',Arial,sans-serif;text-align:center;
}
.uca-btn:hover{background:rgba(88,166,255,0.1);border-color:#58a6ff;color:#58a6ff;}
.uca-btn.uca-assigned{background:rgba(46,204,113,0.1);border-color:#2ecc71;color:#2ecc71;}

/* Scene Status Board */
.sboard-grid{display:grid;grid-template-columns:1fr 1fr;gap:6px;}
.sboard-label{font-size:9px;font-weight:800;text-transform:uppercase;letter-spacing:.5px;margin-bottom:4px;}
.sboard-col{min-height:32px;background:#21262d;border-radius:8px;padding:4px;border:1px dashed #30363d;}
.sboard-chip{
  display:flex;align-items:center;gap:4px;padding:3px 6px;border-radius:6px;
  background:#161b22;border:1px solid #30363d;margin-bottom:3px;font-size:10px;
  font-weight:700;cursor:pointer;font-family:-apple-system,BlinkMacSystemFont,'SF Pro Text','Helvetica Neue',Arial,sans-serif;
  justify-content:space-between;
}
.sboard-chip:hover{border-color:#58a6ff;}
.sboard-chip-role{font-size:8px;padding:1px 4px;border-radius:3px;background:#30363d;color:#8b949e;cursor:pointer;}

/* Incident board */
.incident-board{padding:10px 16px}
.inc-input-row{display:flex;gap:6px;margin-bottom:8px}
.inc-input{
  flex:1;background:#21262d;border:1px solid #30363d;border-radius:8px;
  padding:7px 10px;font-size:11px;color:#e6edf3;font-family:-apple-system,BlinkMacSystemFont,'SF Pro Text','Helvetica Neue',Arial,sans-serif;outline:none;
}
.inc-input:focus{border-color:#58a6ff}
.inc-btn{
  background:#e74c3c;border:none;border-radius:8px;padding:7px 12px;
  color:#fff;font-size:11px;font-weight:800;cursor:pointer;font-family:-apple-system,BlinkMacSystemFont,'SF Pro Text','Helvetica Neue',Arial,sans-serif;
}
.active-inc{
  background:#21262d;border:1px solid #e74c3c44;border-radius:10px;
  padding:10px 12px;font-size:11px;display:none;
}
.active-inc-title{font-weight:900;color:#e74c3c;font-size:13px}
.active-inc-addr{color:#8b949e;margin-top:3px;font-size:10px}
.active-inc-timer{font-size:11px;color:#f39c12;font-weight:700;margin-top:5px}

/* Autocomplete dropdown */
.inc-suggestions{
  position:absolute;top:100%;left:0;right:0;background:#21262d;border:1px solid #30363d;
  border-radius:8px;z-index:999;max-height:160px;overflow-y:auto;display:none;
}
.inc-sugg-item{
  padding:7px 10px;font-size:11px;cursor:pointer;color:#e6edf3;border-bottom:1px solid #21262d;
}
.inc-sugg-item:last-child{border:none}
.inc-sugg-item:hover{background:#30363d}
.inc-input-wrap{position:relative;flex:1}

/* Hospital strip */
.hosp-row{display:flex;align-items:center;justify-content:space-between;
  padding:5px 0;border-bottom:1px solid #21262d;font-size:10px}
.hosp-row:last-child{border:none}
.hosp-name{font-weight:700;color:#8b949e}
.hosp-btn{
  font-size:9px;font-weight:900;padding:2px 8px;border-radius:6px;border:none;
  cursor:pointer;text-transform:uppercase;letter-spacing:0.3px;
  background:rgba(46,204,113,0.12);color:#2ecc71;
}
.hosp-btn.diverted{background:rgba(231,76,60,0.15);color:#e74c3c}

/* Map */
#dsp-map{flex:1;position:relative}

/* Resize handle */
.dsp-resize-handle{
  width:5px;background:transparent;cursor:col-resize;flex-shrink:0;
  transition:background .15s;position:relative;
}
.dsp-resize-handle::after{
  content:'';position:absolute;top:50%;left:50%;
  transform:translate(-50%,-50%);
  width:3px;height:40px;border-radius:2px;
  background:#30363d;transition:background .15s,height .15s;
}
.dsp-resize-handle:hover::after,.dsp-resize-handle.dragging::after{
  background:#58a6ff;height:60px;
}

/* Annotation toolbar */
.ann-btn{background:rgba(16,20,28,.88);border:1px solid #30363d44;color:#e6edf3;border-radius:8px;
  padding:5px 9px;font-size:11px;cursor:pointer;font-weight:700;transition:.15s}
.ann-btn.active{background:#4a90d9;border-color:#4a90d9;color:#fff}

/* Incident tabs (multi-incident) */
#inc-tabs{display:flex;gap:4px;padding:8px 16px 0;flex-shrink:0;background:#161b22;border-bottom:1px solid #21262d;overflow-x:auto}
.inc-tab{padding:5px 12px;border-radius:8px 8px 0 0;font-size:10px;font-weight:800;cursor:pointer;
  border:1px solid #30363d;border-bottom:none;background:#21262d;color:#8b949e;white-space:nowrap}
.inc-tab.active{background:#1c2333;color:#e74c3c;border-color:#e74c3c44}
.inc-tab-add{padding:4px 10px;border-radius:8px 8px 0 0;font-size:12px;cursor:pointer;
  background:none;border:1px dashed #30363d;color:#484f58;border-bottom:none}

/* Notification bell */
#notif-bell{position:relative;cursor:pointer;font-size:18px}
#notif-count{position:absolute;top:-4px;right:-6px;background:#e74c3c;color:#fff;
  font-size:8px;font-weight:900;border-radius:50%;width:14px;height:14px;
  line-height:14px;text-align:center;display:none}
#notif-drawer{display:none;position:absolute;top:52px;right:12px;width:320px;max-height:420px;
  overflow-y:auto;background:#161b22;border:1px solid #30363d;border-radius:12px;
  box-shadow:0 8px 32px rgba(0,0,0,.7);z-index:9999;font-size:11px}
#notif-drawer.open{display:block}

/* Analytics */
.analytics-row{display:flex;justify-content:space-between;padding:5px 0;border-bottom:1px solid #21262d;font-size:11px}
.analytics-row:last-child{border:none}

/* Recommended badge */
.rec-badge{background:rgba(255,193,7,.15);border:1px solid #ffc10788;color:#ffc107;
  font-size:8px;font-weight:900;padding:2px 6px;border-radius:8px;margin-left:4px}

/* Weather bar */
#wx-bar{display:none;background:#0d1520;border-bottom:1px solid #21262d;padding:5px 20px;
  font-size:10px;font-weight:700;gap:16px;align-items:center;flex-shrink:0;flex-wrap:wrap;}
.wx-chip{display:flex;align-items:center;gap:4px;color:#8b949e;}
.wx-chip.warn{color:#f39c12;}
.wx-chip.danger{color:#e74c3c;}

/* Unit search */
#unit-search{width:100%;background:#21262d;border:1px solid #30363d;border-radius:8px;
  padding:6px 10px;font-size:10px;color:#e6edf3;font-family:-apple-system,BlinkMacSystemFont,'SF Pro Text','Helvetica Neue',Arial,sans-serif;
  outline:none;margin-bottom:6px;}
#unit-search:focus{border-color:#58a6ff;}

/* ICS badge */
.ics-badge{font-size:8px;font-weight:900;padding:1px 5px;border-radius:5px;margin-left:4px;
  background:rgba(88,166,255,.12);border:1px solid #58a6ff44;color:#58a6ff;}

/* Pre-plan panel (in active-inc) */
.pp-panel{background:#1a2030;border:1px solid #f39c1244;border-radius:8px;
  padding:8px 10px;margin-top:8px;font-size:10px;}
.pp-row{display:flex;gap:6px;align-items:flex-start;margin-bottom:3px;color:#8b949e;}
.pp-row:last-child{margin-bottom:0;}
.pp-val{color:#e6edf3;font-weight:700;}

/* Station marker tooltip */
.stn-popup{font-family:-apple-system,BlinkMacSystemFont,'SF Pro Text','Helvetica Neue',Arial,sans-serif;font-size:11px;min-width:130px;}

/* Map layer toggles strip */
#map-layers-strip{position:absolute;bottom:60px;right:12px;z-index:10;
  display:flex;flex-direction:column;gap:4px;align-items:flex-end;}
.layer-btn{background:rgba(16,20,28,0.9);border:1px solid #30363d;color:#8b949e;
  border-radius:8px;padding:5px 10px;font-size:10px;font-weight:700;cursor:pointer;
  font-family:-apple-system,BlinkMacSystemFont,'SF Pro Text','Helvetica Neue',Arial,sans-serif;white-space:nowrap;transition:.15s;}
.layer-btn.on{border-color:#58a6ff55;color:#58a6ff;background:rgba(88,166,255,.08);}

/* SCBA Accountability Board */
#acct-modal{display:none;position:fixed;inset:0;background:rgba(0,0,0,.65);z-index:10001;
  align-items:center;justify-content:center;font-family:-apple-system,BlinkMacSystemFont,'SF Pro Text','Helvetica Neue',Arial,sans-serif;}
.acct-panel{background:#161b22;border:1px solid #30363d;border-radius:14px;
  width:460px;max-width:95vw;max-height:85vh;display:flex;flex-direction:column;
  box-shadow:0 8px 40px rgba(0,0,0,.8);}
.acct-header{display:flex;align-items:center;justify-content:space-between;
  padding:14px 18px;border-bottom:1px solid #21262d;}
.acct-body{overflow-y:auto;flex:1;padding:10px 14px;}
.acct-row{display:grid;grid-template-columns:1fr 80px 80px 80px auto;gap:8px;
  align-items:center;padding:8px 6px;border-bottom:1px solid #21262d;font-size:11px;}
.acct-row:last-child{border:none}
.acct-name{font-weight:800;color:#e6edf3;}
.acct-timer{font-variant-numeric:tabular-nums;font-weight:800;text-align:center;}
.acct-timer.warn{color:#f39c12;}
.acct-timer.danger{color:#e74c3c;animation:pulse-red 1s infinite;}
@keyframes pulse-red{0%,100%{opacity:1}50%{opacity:.5}}
.acct-btn{padding:3px 8px;border-radius:6px;border:none;cursor:pointer;
  font-size:9px;font-weight:900;font-family:-apple-system,BlinkMacSystemFont,'SF Pro Text','Helvetica Neue',Arial,sans-serif;text-transform:uppercase;}
.acct-btn.enter{background:rgba(231,76,60,.12);color:#e74c3c;border:1px solid #e74c3c44;}
.acct-btn.exit{background:rgba(46,204,113,.12);color:#2ecc71;border:1px solid #2ecc7144;}
.acct-btn.clear{background:rgba(72,79,88,.15);color:#8b949e;border:1px solid #30363d;}
.acct-add-row{display:flex;gap:6px;padding:10px 6px;}

/* Reply popover */
#reply-popover{display:none;position:fixed;bottom:20px;right:20px;z-index:10002;
  background:#1c2333;border:1px solid #30363d;border-radius:12px;padding:12px 14px;
  width:280px;box-shadow:0 4px 24px rgba(0,0,0,.7);font-family:-apple-system,BlinkMacSystemFont,'SF Pro Text','Helvetica Neue',Arial,sans-serif;}

/* Drop-pin mode cursor */
body.pin-drop-mode #dsp-map{cursor:crosshair!important;}
body.pin-drop-mode #dsp-map *{cursor:crosshair!important;}

/* Narrative log */
.narr-entry{padding:6px 8px;border-left:3px solid #30363d;margin-bottom:5px;font-size:10px;border-radius:0 6px 6px 0;background:#21262d;}
.narr-entry .nt{color:#484f58;font-size:9px;font-weight:700;margin-bottom:2px;}
.narr-entry.system{border-left-color:#58a6ff;}
.narr-entry.action{border-left-color:#f39c12;}
.narr-entry.alert{border-left-color:#e74c3c;}

/* PAR modal */
#par-modal{display:none;position:fixed;inset:0;background:rgba(0,0,0,.7);z-index:10002;
  align-items:center;justify-content:center;font-family:-apple-system,BlinkMacSystemFont,'SF Pro Text','Helvetica Neue',Arial,sans-serif;}
.par-panel{background:#161b22;border:1.5px solid #e74c3c44;border-radius:14px;
  width:440px;max-width:95vw;box-shadow:0 8px 40px rgba(0,0,0,.8);}
.par-unit-row{display:flex;align-items:center;justify-content:space-between;
  padding:7px 14px;border-bottom:1px solid #21262d;font-size:11px;}
.par-unit-row:last-child{border:none;}
.par-status{font-size:9px;font-weight:900;padding:2px 8px;border-radius:6px;text-transform:uppercase;}
.par-status.waiting{background:rgba(243,156,18,.15);color:#f39c12;}
.par-status.ok{background:rgba(46,204,113,.15);color:#2ecc71;}
.par-status.missed{background:rgba(231,76,60,.15);color:#e74c3c;}

/* Roster */
#roster-modal{display:none;position:fixed;inset:0;background:rgba(0,0,0,.65);z-index:10001;
  align-items:center;justify-content:center;font-family:-apple-system,BlinkMacSystemFont,'SF Pro Text','Helvetica Neue',Arial,sans-serif;}
.roster-panel{background:#161b22;border:1px solid #30363d;border-radius:14px;
  width:480px;max-width:95vw;max-height:80vh;display:flex;flex-direction:column;
  box-shadow:0 8px 40px rgba(0,0,0,.8);}
.roster-row{display:grid;grid-template-columns:1fr 90px 90px auto;gap:8px;
  align-items:center;padding:7px 14px;border-bottom:1px solid #21262d;font-size:11px;}

/* Medical pre-alert */
#medalert-modal{display:none;position:fixed;inset:0;background:rgba(0,0,0,.65);z-index:10001;
  align-items:center;justify-content:center;font-family:-apple-system,BlinkMacSystemFont,'SF Pro Text','Helvetica Neue',Arial,sans-serif;}
.medalert-panel{background:#161b22;border:1px solid #2ecc7144;border-radius:14px;
  width:420px;max-width:95vw;box-shadow:0 8px 40px rgba(0,0,0,.8);padding:20px;}

/* Radio channel plan */
.radio-row{display:flex;align-items:center;gap:6px;margin-bottom:4px;}
.radio-label{font-size:9px;font-weight:800;color:#484f58;text-transform:uppercase;letter-spacing:.5px;min-width:70px;}
.radio-input{flex:1;background:#21262d;border:1px solid #30363d;border-radius:6px;
  padding:4px 7px;font-size:10px;color:#e6edf3;font-family:-apple-system,BlinkMacSystemFont,'SF Pro Text','Helvetica Neue',Arial,sans-serif;outline:none;}
.radio-input:focus{border-color:#58a6ff;}

/* Waypoint mode */
body.waypoint-mode #dsp-map{cursor:crosshair!important;}
body.waypoint-mode #dsp-map *{cursor:crosshair!important;}

/* Triage modal cards */
.triage-card{background:#21262d;border:2px solid #30363d;border-radius:10px;padding:10px;text-align:center;}
.triage-tag{font-size:8px;font-weight:900;padding:2px 6px;border-radius:4px;color:#fff;margin-bottom:6px;display:inline-block;letter-spacing:.5px;}
.triage-count{font-size:36px;font-weight:900;color:#e6edf3;line-height:1;margin:6px 0;font-variant-numeric:tabular-nums;}
.triage-btns{display:flex;gap:6px;justify-content:center;}
.triage-btn{width:36px;height:28px;border-radius:6px;border:1px solid #30363d;background:#161b22;color:#8b949e;font-size:16px;font-weight:900;cursor:pointer;font-family:-apple-system,BlinkMacSystemFont,'SF Pro Text','Helvetica Neue',Arial,sans-serif;line-height:1;}
.triage-btn:hover{opacity:.8;}

/* Auth modal input focus */
#auth-pin:focus{border-color:#e74c3c!important;outline:none;}

/* Inc tabs — active dot */
.inc-tab{display:flex;align-items:center;gap:4px;white-space:nowrap;}

/* Outcome badge */
.outcome-badge{display:inline-block;font-size:9px;font-weight:900;padding:2px 8px;border-radius:6px;margin-top:4px;text-transform:uppercase;letter-spacing:.5px;}
.outcome-badge.resolved{background:rgba(46,204,113,.15);color:#2ecc71;border:1px solid #2ecc7144;}
.outcome-badge.false_alarm{background:rgba(88,166,255,.15);color:#58a6ff;border:1px solid #58a6ff44;}
.outcome-badge.cancelled{background:rgba(72,79,88,.2);color:#8b949e;border:1px solid #30363d;}
.outcome-badge.working{background:rgba(231,76,60,.15);color:#e74c3c;border:1px solid #e74c3c44;}


/* ── Loading dots ───────────────────────────────────────────────────────────
   Replaces the hourglass in any "working" or "waking up" message. Three dots
   that breathe, so a wait reads as ongoing rather than as a frozen glyph. */
.ks-dots { display:inline-flex; align-items:center; gap:3px; vertical-align:middle; }
.ks-dots i {
    width:4px; height:4px; border-radius:50%; background:currentColor;
    opacity:0.3; animation:ks-dot-pulse 1.05s infinite ease-in-out;
}
.ks-dots i:nth-child(2) { animation-delay:0.15s; }
.ks-dots i:nth-child(3) { animation-delay:0.30s; }
@keyframes ks-dot-pulse {
    0%, 80%, 100% { opacity:0.25; transform:translateY(0); }
    40%           { opacity:1;    transform:translateY(-2px); }
}
@media (prefers-reduced-motion: reduce) {
    .ks-dots i { animation:none; opacity:0.6; }
}
