/* DispatchDesk – Design
   Dunkles Navy, ruhige native Bedienelemente, Systemschrift */
:root {
  --bg: #090d18;
  --p1: #0f1729;
  --p2: #131d33;
  --p3: #1a2742;
  --p4: #22314f;
  --line: #22304d;
  --line2: #2c3d61;
  --tx: #e7ecf5;
  --tx2: #a3b0c8;
  --tx3: #6c7b98;
  --blue: #3b82f6;
  --blue2: #60a5fa;
  --green: #16a34a;
  --green2: #22c55e;
  --red: #ef4444;
  --red2: #f87171;
  --orange: #f59e0b;
  --purple: #a78bfa;
  --s1: #38bdf8; --s2: #22c55e; --s3: #facc15; --s4: #ef4444; --s5: #f97316;
  --s6: #64748b; --s7: #c084fc; --s8: #ec4899; --s9: #94a3b8; --s0: #f43f5e;
  --r: 8px;
  --r2: 12px;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --shadow: 0 18px 50px rgba(0, 0, 0, .55);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--tx);
  font: 13px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
kbd { font: 600 10px var(--mono); background: var(--p3); border: 1px solid var(--line2); border-bottom-width: 2px; border-radius: 4px; padding: 1px 5px; color: var(--tx); }
.ic { flex: none; display: block; }
.muted { color: var(--tx3); }
.pad { padding: 10px; }
.grow { flex: 1; }
.pos { color: var(--green2); }
.neg { color: var(--red2); }
.err-txt { color: var(--red2); font-weight: 600; }

/* ---------- Buttons ---------- */
.btn {
  height: 32px; padding: 0 12px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--line2);
  border-radius: var(--r);
  color: var(--tx);
  font-weight: 500; font-size: 13px;
  cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s, box-shadow .12s;
}
.btn:hover { background: rgba(255, 255, 255, .09); border-color: #3a4f7a; }
.btn:active { background: rgba(255, 255, 255, .13); }
.btn:focus-visible, .seg button:focus-visible, .qbtn:focus-visible { outline: 2px solid var(--blue2); outline-offset: 2px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-sm { height: 26px; padding: 0 9px; font-size: 12px; gap: 5px; }
.btn-lg { height: 40px; padding: 0 18px; font-size: 14px; font-weight: 600; }
.btn-icon { width: 32px; padding: 0; }
.btn-icon.btn-sm { width: 26px; }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-primary:hover { background: #2f74e8; border-color: #2f74e8; }
.btn-success { background: var(--green); border-color: var(--green); color: #fff; }
.btn-success:hover { background: #15913f; border-color: #15913f; }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-danger-ghost { background: transparent; border-color: rgba(248, 113, 113, .4); color: var(--red2); }
.btn-danger-ghost:hover { background: rgba(239, 68, 68, .12); border-color: var(--red2); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--tx2); }
.btn-ghost:hover { background: rgba(255, 255, 255, .07); color: var(--tx); }
.btn.armed { background: var(--red); border-color: var(--red); color: #fff; }
.btn-alarm { width: 100%; background: #dc2626; border-color: #dc2626; color: #fff; }
.btn-alarm:hover { background: #c81e1e; }
.btn-alarm:disabled { background: var(--p3); border-color: var(--line2); color: var(--tx3); opacity: 1; }
.btn-play { width: 38px; height: 34px; background: var(--green); border-color: var(--green); color: #fff; }
.btn-play:hover { background: #15913f; }
.btn-play.running { background: var(--p3); border-color: var(--line2); color: var(--tx); }
.link { background: none; border: 0; color: var(--blue2); cursor: pointer; padding: 6px 0; font-size: 12px; }
.link:hover { text-decoration: underline; }

.seg { display: inline-flex; background: var(--p1); border: 1px solid var(--line2); border-radius: var(--r); padding: 2px; gap: 2px; }
.seg button { border: 0; background: transparent; color: var(--tx2); height: 28px; min-width: 34px; padding: 0 9px; border-radius: 6px; cursor: pointer; font-size: 12px; font-weight: 600; }
.seg button:hover { color: var(--tx); background: rgba(255, 255, 255, .05); }
.seg button.on { background: var(--p4); color: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .4); }
.seg-sm button { height: 22px; min-width: 30px; font-size: 11px; padding: 0 7px; }

.badge { min-width: 22px; height: 20px; padding: 0 7px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; background: var(--p4); font: 700 11px var(--mono); color: var(--tx); }
.badge.sm { height: 17px; min-width: 18px; font-size: 10px; margin-left: 4px; }
.badge.err { background: var(--red); color: #fff; }
.badge.warn { background: var(--orange); color: #1a1200; }
.tag { display: inline-block; font-size: 10px; font-weight: 600; padding: 1px 6px; border-radius: 4px; background: var(--p4); color: var(--tx2); vertical-align: 1px; }
.tag.warn { background: rgba(245, 158, 11, .18); color: #fbbf24; }

.fms { width: 26px; height: 24px; flex: none; display: inline-grid; place-items: center; border-radius: 5px; font: 800 13px var(--mono); color: #0b1020; }
.fms.s1 { background: var(--s1); } .fms.s2 { background: var(--s2); } .fms.s3 { background: var(--s3); }
.fms.s4 { background: var(--s4); color: #fff; } .fms.s5 { background: var(--s5); color: #fff; animation: blink 1s infinite; }
.fms.s6 { background: var(--s6); color: #fff; } .fms.s7 { background: var(--s7); } .fms.s8 { background: var(--s8); color: #fff; }
.fms.s9 { background: var(--s9); } .fms.s0 { background: var(--s0); color: #fff; }
@keyframes blink { 50% { opacity: .55; } }

.fld { display: flex; flex-direction: column; gap: 5px; font-size: 11px; font-weight: 600; color: var(--tx2); text-transform: uppercase; letter-spacing: .04em; }
.fld input, .fld select, .fld textarea, .sel, .sel-sm {
  background: var(--p1); border: 1px solid var(--line2); border-radius: var(--r);
  padding: 8px 10px; font-size: 13px; font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--tx);
}
.fld textarea { resize: vertical; min-height: 54px; }
.fld input:focus, .fld select:focus, .fld textarea:focus, .sel:focus, .sel-sm:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(59, 130, 246, .2); }
.sel-sm { padding: 3px 8px; font-size: 12px; height: 26px; }
.fld-row { display: flex; justify-content: space-between; align-items: baseline; }
.fld-val { color: var(--blue2); text-transform: none; letter-spacing: 0; font-weight: 600; }
input[type=range] { accent-color: var(--blue); width: 100%; }
.chk { display: inline-flex; align-items: center; gap: 7px; color: var(--tx2); font-size: 13px; cursor: pointer; }
.chk input { accent-color: var(--blue); width: 15px; height: 15px; margin: 0; }
.chk.sm { font-size: 11px; gap: 5px; }
.chk.sm input { width: 13px; height: 13px; }

.logo { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; font-weight: 800; font-size: 13px; letter-spacing: .5px; color: #fff; background: linear-gradient(135deg, #2563eb, #7c3aed); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .15); }
.logo.lg { width: 52px; height: 52px; border-radius: 14px; font-size: 18px; }

/* ---------- Startbildschirm ---------- */
.welcome {
  position: fixed; inset: 0; display: grid; place-items: center; padding: 24px; overflow: auto;
  background: radial-gradient(circle at 25% 20%, rgba(59, 130, 246, .16), transparent 45%), radial-gradient(circle at 80% 85%, rgba(124, 58, 237, .12), transparent 45%), var(--bg);
}
.wl-card { width: 100%; max-width: 500px; background: var(--p1); border: 1px solid var(--line2); border-radius: 18px; padding: 32px; box-shadow: var(--shadow); }
.wl-brand { display: flex; gap: 16px; align-items: center; margin-bottom: 26px; }
.wl-brand h1 { margin: 0; font-size: 24px; letter-spacing: -.01em; }
.wl-brand p { margin: 2px 0 0; color: var(--tx2); }
.wl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 22px; }
.wl-grid .full { grid-column: 1 / -1; }
.wl-actions { display: flex; flex-direction: column; gap: 8px; }
.wl-note { color: var(--tx3); font-size: 12px; margin: 10px 0 4px; min-height: 1em; }

/* ---------- App ---------- */
.app { height: 100vh; display: grid; grid-template-rows: 56px 1fr; }
.topbar { display: flex; align-items: center; gap: 18px; padding: 0 14px; background: linear-gradient(180deg, #111b31, #0c1426); border-bottom: 1px solid var(--line); position: relative; z-index: 1000; }
.tb-brand { display: flex; align-items: center; gap: 10px; min-width: 170px; }
.tb-title { font-weight: 700; font-size: 14px; }
.tb-sub { font-size: 11px; color: var(--tx2); max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-clock { padding-left: 16px; border-left: 1px solid var(--line); min-width: 120px; }
.tb-date { font-size: 10px; color: var(--tx2); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.tb-time { font: 700 21px/1.1 var(--mono); letter-spacing: 1px; }
.tb-sim { display: flex; align-items: center; gap: 8px; }
.tb-stats { display: flex; flex: 1; justify-content: center; }
.kpi { padding: 0 14px; border-left: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; }
.kpi:first-child { border-left: 0; }
.kpi span { font-size: 9px; color: var(--tx3); text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.kpi b { font: 800 18px/1.2 var(--mono); }
.kpi b.ok { color: var(--green2); } .kpi b.err { color: var(--red2); }
.tb-actions { display: flex; align-items: center; gap: 6px; }
.route-badge { font-size: 11px; color: #fbbf24; background: rgba(245, 158, 11, .12); border: 1px solid rgba(245, 158, 11, .3); padding: 3px 8px; border-radius: 6px; }

.ws { display: grid; min-height: 0; gap: 8px; padding: 8px;
  grid-template-columns: 350px minmax(0, 1fr) 350px;
  grid-template-rows: minmax(0, 1fr) 270px;
  grid-template-areas: "calls map res" "calls bottom radio"; }
.p-calls { grid-area: calls; } .p-map { grid-area: map; } .p-bottom { grid-area: bottom; } .p-res { grid-area: res; } .p-radio { grid-area: radio; }
.panel { background: linear-gradient(180deg, var(--p2), var(--p1)); border: 1px solid var(--line); border-radius: var(--r2); display: flex; flex-direction: column; min-height: 0; min-width: 0; overflow: hidden; }
.ph { height: 42px; flex: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 12px; border-bottom: 1px solid var(--line); }
.ph h2 { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; display: flex; align-items: center; gap: 8px; }
.ph-tools { display: flex; align-items: center; gap: 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.red { background: var(--red); box-shadow: 0 0 8px var(--red); } .dot.blue { background: var(--blue); box-shadow: 0 0 8px var(--blue); }
.dot.green { background: var(--green2); box-shadow: 0 0 8px var(--green2); } .dot.purple { background: var(--purple); box-shadow: 0 0 8px var(--purple); }
.scroll { flex: 1; overflow-y: auto; min-height: 0; }
.empty { padding: 26px 16px; text-align: center; color: var(--tx3); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.empty p { margin: 0; font-size: 12px; }
.tabs { display: flex; gap: 2px; }
.tab { height: 30px; padding: 0 12px; border: 0; background: transparent; color: var(--tx2); border-radius: 6px; cursor: pointer; font-weight: 600; font-size: 12px; display: inline-flex; align-items: center; }
.tab:hover { color: var(--tx); background: rgba(255, 255, 255, .05); }
.tab.active { background: var(--p4); color: #fff; }

/* ---------- Notrufe ---------- */
.queue { flex: none; max-height: 40%; overflow-y: auto; border-bottom: 1px solid var(--line); }
.q-item { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; padding: 10px 12px; border-bottom: 1px solid rgba(255, 255, 255, .04); cursor: pointer; }
.q-item:hover { background: rgba(34, 197, 94, .07); }
.q-item.blocked { cursor: default; }
.q-ring { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--green); color: #fff; animation: ring 1.4s infinite; }
@keyframes ring { 0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, .55); } 60% { box-shadow: 0 0 0 9px rgba(34, 197, 94, 0); } }
.q-phone { font: 600 13px var(--mono); }
.q-sub { font-size: 11px; color: var(--tx2); }
.q-bar { height: 3px; background: rgba(255, 255, 255, .07); border-radius: 2px; margin-top: 5px; overflow: hidden; }
.q-bar i { display: block; height: 100%; background: var(--green2); border-radius: 2px; transition: width .2s linear; }
.q-bar i.warn { background: var(--orange); } .q-bar i.crit { background: var(--red); }
.q-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.q-time { font: 11px var(--mono); color: var(--tx3); }

.callbox { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.cb-empty { margin: auto; text-align: center; color: var(--tx3); padding: 20px 28px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.cb-empty b { color: var(--tx2); }
.cb-empty p { margin: 0; font-size: 12px; }
.cb-head { flex: none; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 12px; background: rgba(34, 197, 94, .07); border-bottom: 1px solid var(--line); }
.cb-phone { font: 600 13px var(--mono); }
.cb-sub { font-size: 12px; color: var(--tx2); display: flex; gap: 4px; align-items: center; }
.live { display: inline-flex; gap: 5px; align-items: center; font-size: 11px; color: var(--green2); font-weight: 600; white-space: nowrap; }
.cb-chat { flex: 1; min-height: 80px; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; background: rgba(0, 0, 0, .12); }
.msg { max-width: 88%; padding: 7px 10px; border-radius: 10px; font-size: 12.5px; line-height: 1.4; }
.msg.disp { align-self: flex-end; background: #1e4fae; color: #fff; border-bottom-right-radius: 3px; }
.msg.caller { align-self: flex-start; background: var(--p4); border-bottom-left-radius: 3px; }
.msg.sys { align-self: center; color: var(--tx3); font-size: 11px; font-style: italic; padding: 2px; }
.cb-q { flex: none; display: grid; grid-template-columns: 1fr 1fr; gap: 5px; padding: 8px 10px; border-top: 1px solid var(--line); max-height: 150px; overflow-y: auto; }
.qbtn { text-align: left; padding: 6px 9px; font-size: 12px; line-height: 1.3; background: var(--p1); border: 1px solid var(--line2); border-radius: 7px; color: var(--tx); cursor: pointer; }
.qbtn:hover { border-color: var(--blue); background: rgba(59, 130, 246, .1); }
.qbtn.cpr { border-color: rgba(239, 68, 68, .45); color: #fecaca; }
.cb-actions { flex: none; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 10px; border-top: 1px solid var(--line); background: var(--p1); }
.cb-actions .btn-primary { grid-column: 1 / -1; height: 36px; font-weight: 600; }

/* ---------- Karte ---------- */
.legend { display: flex; align-items: center; gap: 12px; font-size: 11px; color: var(--tx2); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.lg-inc { background: var(--red); } .lg-call { background: transparent; border: 2px dashed var(--green2); }
.lg-veh { background: var(--s3); border-radius: 3px !important; } .lg-st { background: #1e40af; border-radius: 2px !important; } .lg-hs { background: #db2777; }
.map-wrap { flex: 1; min-height: 0; position: relative; }
#map { position: absolute; inset: 0; background: #0b1322; }
.leaflet-container { font: inherit; background: #0b1322; }
.leaflet-control-zoom a { background: var(--p2) !important; color: var(--tx) !important; border-color: var(--line2) !important; }
.leaflet-control-attribution { background: rgba(9, 13, 24, .8) !important; color: var(--tx3) !important; font-size: 10px; }
.leaflet-control-attribution a { color: var(--blue2) !important; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--p2); color: var(--tx); box-shadow: var(--shadow); }
.leaflet-popup-content { margin: 10px 12px; font-size: 12px; }
.leaflet-tooltip { background: var(--p2); color: var(--tx); border: 1px solid var(--line2); box-shadow: 0 6px 18px rgba(0, 0, 0, .4); font-size: 12px; }
.leaflet-tooltip-top:before { border-top-color: var(--line2); }
.map-inverted .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.85) contrast(1.3); }
.map-light .leaflet-tile-pane { filter: none; }
.map-badge { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 500; background: rgba(245, 158, 11, .15); border: 1px solid rgba(245, 158, 11, .4); color: #fbbf24; font-size: 11px; padding: 4px 10px; border-radius: 6px; }
.mk-wrap { background: none; border: 0; }
.mk-st { width: 26px; height: 20px; border-radius: 4px; display: grid; place-items: center; font: 800 9px var(--mono); color: #fff; border: 1.5px solid rgba(255, 255, 255, .8); }
.mk-st.fw { background: #b91c1c; } .mk-st.rd { background: #1e40af; } .mk-st.pol { background: #0f766e; width: 30px; }
.mk-hs { width: 22px; height: 22px; border-radius: 5px; background: #db2777; color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 12px; border: 1.5px solid #fff; }
.mk-inc { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: #dc2626; border: 2px solid #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, .5); animation: pulse 1.6s infinite; cursor: pointer; }
.mk-inc.p-low { background: #475569; } .mk-inc.p-mid { background: #2563eb; } .mk-inc.p-high { background: #d97706; }
.mk-inc.arrived { animation: none; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, .6); } 60% { box-shadow: 0 0 0 12px rgba(239, 68, 68, 0); } }
.mk-call { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: var(--green); border: 2px solid #fff; animation: ring 1.4s infinite; cursor: pointer; }
.talk .mk-call { background: var(--blue); animation: none; }
.mk-veh { display: flex; align-items: stretch; height: 20px; border-radius: 4px; overflow: hidden; border: 1.5px solid rgba(255, 255, 255, .9); box-shadow: 0 2px 6px rgba(0, 0, 0, .5); cursor: pointer; font: 700 10px var(--mono); }
.mk-veh span { background: #111827; color: #fff; padding: 0 4px; display: grid; place-items: center; }
.mk-veh b { min-width: 16px; display: grid; place-items: center; color: #0b1020; }
.mk-veh.s1 b { background: var(--s1); } .mk-veh.s3 b { background: var(--s3); } .mk-veh.s4 b { background: var(--s4); color: #fff; }
.mk-veh.s5 b { background: var(--s5); color: #fff; } .mk-veh.s7 b { background: var(--s7); } .mk-veh.s8 b { background: var(--s8); color: #fff; }
.mk-veh.s2 b { background: var(--s2); } .mk-veh.s6 b { background: var(--s6); }
.pp b { display: block; margin-bottom: 4px; }
.pp-row { display: flex; align-items: center; gap: 6px; padding: 2px 0; }
.pp-row .fms { width: 18px; height: 16px; font-size: 10px; }
.pp-row i { color: var(--tx3); font-style: normal; }

/* ---------- Einsätze / Protokoll ---------- */
.i-head, .i-row { display: grid; grid-template-columns: 92px minmax(0, 1fr) minmax(0, 190px) 120px 30px; gap: 10px; align-items: center; padding: 0 12px; }
.i-head { height: 28px; font-size: 10px; font-weight: 700; color: var(--tx3); text-transform: uppercase; letter-spacing: .06em; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--p2); z-index: 1; }
.i-row { min-height: 46px; border-bottom: 1px solid rgba(255, 255, 255, .04); cursor: pointer; border-left: 3px solid transparent; }
.i-row:hover { background: rgba(59, 130, 246, .07); }
.i-row.p-crit { border-left-color: var(--red); } .i-row.p-high { border-left-color: var(--orange); }
.i-id { font: 600 12px var(--mono); display: flex; flex-direction: column; }
.i-id span, .i-kw span { font: 11px inherit; color: var(--tx3); }
.i-kw { display: flex; flex-direction: column; font-weight: 600; min-width: 0; }
.i-kw span { font-weight: 400; font-family: inherit; color: var(--tx2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.i-units { display: flex; flex-wrap: wrap; gap: 3px; }
.u { font: 700 10px var(--mono); padding: 2px 5px; border-radius: 4px; color: #0b1020; }
.u.s1 { background: var(--s1); } .u.s2 { background: var(--s2); } .u.s3 { background: var(--s3); } .u.s4 { background: var(--s4); color: #fff; }
.u.s5 { background: var(--s5); color: #fff; } .u.s6 { background: var(--s6); color: #fff; } .u.s7 { background: var(--s7); } .u.s8 { background: var(--s8); color: #fff; }
.i-state { font-size: 12px; font-weight: 600; }
.i-state.err { color: var(--red2); } .i-state.warn { color: #fbbf24; } .i-state.drive { color: var(--s3); }
.i-state.scene { color: var(--red2); } .i-state.trans { color: var(--s7); } .i-state.done { color: var(--tx3); }
.l-row { display: grid; grid-template-columns: 64px 1fr; gap: 10px; padding: 3px 12px; font: 11.5px/1.45 var(--mono); color: var(--tx2); border-bottom: 1px solid rgba(255, 255, 255, .03); }
.l-row span:first-child { color: var(--tx3); }
.l-row.ok span:last-child { color: var(--green2); } .l-row.warn span:last-child { color: #fbbf24; } .l-row.err span:last-child { color: var(--red2); }
.l-row.call span:last-child { color: #86efac; } .l-row.alarm span:last-child { color: #fca5a5; } .l-row.fms span:last-child { color: var(--tx3); }

/* ---------- Fahrzeuge ---------- */
.v-group { display: flex; justify-content: space-between; padding: 7px 12px 4px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--tx3); background: var(--p1); position: sticky; top: 0; z-index: 1; border-bottom: 1px solid rgba(255, 255, 255, .03); }
.v-row { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: center; padding: 6px 12px; border-bottom: 1px solid rgba(255, 255, 255, .03); cursor: pointer; }
.v-row:hover { background: rgba(59, 130, 246, .08); }
.v-row.sprech { background: rgba(249, 115, 22, .08); }
.v-main { min-width: 0; }
.v-cs { font-weight: 600; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v-sub { font-size: 11px; color: var(--tx2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v-t { font: 11px var(--mono); color: var(--tx3); }

/* ---------- Funk ---------- */
.r-msg { padding: 8px 12px; border-bottom: 1px solid rgba(255, 255, 255, .04); }
.r-msg.open { background: rgba(249, 115, 22, .07); border-left: 3px solid var(--s5); padding-left: 9px; }
.r-head { display: flex; align-items: center; gap: 6px; font-size: 12px; flex-wrap: wrap; }
.r-t { font: 11px var(--mono); color: var(--tx3); }
.r-text { font-size: 12.5px; color: var(--tx2); margin-top: 3px; }
.r-msg.open .r-text { color: var(--tx); }
.inc-chip { font: 600 10.5px var(--mono); background: var(--p4); border: 0; color: var(--blue2); border-radius: 4px; padding: 1px 6px; cursor: pointer; }
.inc-chip:hover { background: var(--line2); }
.r-act { display: flex; gap: 6px; margin-top: 7px; }
.r-dept { font-size: 11px; color: var(--tx2); margin-top: 6px; }
.r-hosp { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; margin-top: 6px; }
.h-btn { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 6px 8px; background: var(--p1); border: 1px solid var(--line2); border-radius: 7px; cursor: pointer; text-align: left; }
.h-btn b { font-size: 12px; }
.h-btn small { font-size: 10.5px; color: var(--tx2); }
.h-btn:hover { border-color: var(--blue); background: rgba(59, 130, 246, .1); }
.h-btn.rec { border-color: var(--green2); background: rgba(34, 197, 94, .09); }
.h-btn.nodept small { color: var(--red2); }
.h-btn:disabled { opacity: .45; cursor: not-allowed; }

/* ---------- Modale ---------- */
.modal-bg { position: fixed; inset: 0; z-index: 3000; background: rgba(3, 6, 14, .66); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); display: grid; place-items: center; padding: 20px; animation: fade .15s ease; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--p1); border: 1px solid var(--line2); border-radius: 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; max-height: calc(100vh - 40px); width: 100%; animation: pop .18s ease; }
@keyframes pop { from { transform: translateY(8px) scale(.99); opacity: 0; } }
.modal.md { max-width: 640px; }
.modal.xl { max-width: 1180px; height: calc(100vh - 60px); }
.m-head { flex: none; position: relative; padding: 14px 56px 12px 20px; border-bottom: 1px solid var(--line); }
.m-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.m-title h3 { margin: 0; font: 700 17px var(--mono); }
.m-kw { font-weight: 600; font-size: 15px; color: var(--tx); }
.m-sub { font-size: 12px; color: var(--tx2); margin-top: 4px; display: flex; align-items: center; gap: 5px; }
.m-x { position: absolute; right: 12px; top: 12px; }
.m-body { flex: 1; overflow-y: auto; padding: 16px 20px; min-height: 0; }
.m-foot { flex: none; display: flex; gap: 8px; align-items: center; padding: 12px 20px; border-top: 1px solid var(--line); background: rgba(0, 0, 0, .15); border-radius: 0 0 14px 14px; }
.pill { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 10px; text-transform: uppercase; letter-spacing: .04em; }
.pill.p-low { background: #475569; } .pill.p-mid { background: #2563eb; } .pill.p-high { background: #d97706; color: #1a1200; } .pill.p-crit { background: #dc2626; }

.im { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 0; padding: 0; overflow: hidden; }
.im-left { overflow-y: auto; padding: 4px 20px 16px; border-right: 1px solid var(--line); }
.im-right { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.im-right .sect { padding: 12px 18px 4px; }
.im-right .sect.grow { flex: 1; overflow-y: auto; min-height: 0; }
.sect { padding: 12px 0; border-bottom: 1px solid rgba(255, 255, 255, .05); display: flex; flex-direction: column; gap: 10px; }
.sect:last-child { border-bottom: 0; }
.sect h4, .settings h4, .help h4 { margin: 0; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--blue2); }
details.sect summary { cursor: pointer; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--blue2); font-weight: 700; }
.im-tr { display: flex; flex-direction: column; gap: 5px; margin-top: 8px; }
.im-hist { font-size: 12px; color: var(--tx2); max-height: 180px; overflow-y: auto; }
.im-hist div { padding: 2px 0; }
.im-hist span { font: 11px var(--mono); color: var(--tx3); margin-right: 8px; }
.im-alarm { flex: none; padding: 12px 18px; border-top: 1px solid var(--line); }
.note { display: flex; gap: 7px; align-items: flex-start; font-size: 12px; padding: 8px 10px; border-radius: 8px; background: rgba(59, 130, 246, .1); color: #bfdbfe; line-height: 1.4; }
.note .ic { margin-top: 1px; }
.note.ok { background: rgba(34, 197, 94, .1); color: #bbf7d0; }
.note.warn { background: rgba(245, 158, 11, .1); color: #fde68a; }
.note.err { background: rgba(239, 68, 68, .1); color: #fecaca; }
.prog { display: grid; grid-template-columns: 1fr 120px 42px; gap: 10px; align-items: center; font-size: 12px; }
.bar { height: 6px; background: rgba(255, 255, 255, .08); border-radius: 3px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--green2); }
.prog b { font: 11px var(--mono); text-align: right; }
.pat { display: flex; gap: 10px; align-items: flex-start; font-size: 12.5px; }
.pat small { display: block; color: var(--tx2); font-size: 11.5px; }
.pat-n { width: 20px; height: 20px; border-radius: 50%; background: var(--p4); display: grid; place-items: center; font: 700 11px var(--mono); flex: none; }
.sc-row { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; padding: 2px 0; color: var(--tx2); }
.sc-row.total { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 6px; color: var(--tx); font-weight: 600; }
.d-head { font-size: 11px; font-weight: 700; color: var(--tx2); margin: 6px 0 2px; }
.d-row, .u-row { display: grid; grid-template-columns: 18px 26px minmax(0, 1fr) auto; gap: 9px; align-items: center; padding: 6px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--p2); cursor: pointer; }
.u-row { grid-template-columns: 26px minmax(0, 1fr) auto; cursor: default; }
.d-row:hover { border-color: #3a4f7a; }
.d-row.on { border-color: var(--blue); background: rgba(59, 130, 246, .13); }
.cbx { width: 16px; height: 16px; border-radius: 4px; border: 1.5px solid var(--line2); display: grid; place-items: center; color: #fff; }
.d-row.on .cbx { background: var(--blue); border-color: var(--blue); }
.d-cs { font-weight: 600; font-size: 12.5px; display: flex; flex-direction: column; min-width: 0; }
.d-cs small { font-weight: 400; font-size: 11px; color: var(--tx2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.d-eta { font: 600 12px var(--mono); color: var(--tx2); }
.tchips { display: flex; flex-wrap: wrap; gap: 4px; }
.tchip { height: 22px; padding: 0 8px; border-radius: 11px; background: var(--p2); border: 1px solid var(--line2); color: var(--tx2); font: 600 10.5px var(--mono); cursor: pointer; }
.tchip:hover { color: var(--tx); }
.tchip.on { background: var(--blue); border-color: var(--blue); color: #fff; }
#imDisp { display: flex; flex-direction: column; gap: 5px; }
#imUnits { display: flex; flex-direction: column; gap: 5px; }

.settings h4 { margin: 18px 0 6px; }
.settings h4:first-child { margin-top: 0; }
.set-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 9px 0; border-bottom: 1px solid rgba(255, 255, 255, .05); cursor: pointer; }
.set-row > span:first-child { display: flex; flex-direction: column; font-size: 13px; font-weight: 500; }
.set-row small { font-size: 11.5px; color: var(--tx3); font-weight: 400; }
.set-ctl { display: flex; align-items: center; gap: 10px; min-width: 210px; }
.set-ctl b { font: 600 12px var(--mono); white-space: nowrap; min-width: 46px; }
.set-row .sel { min-width: 170px; }
.switch { position: relative; width: 38px; height: 22px; flex: none; }
.switch input { opacity: 0; position: absolute; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: 11px; background: var(--p4); transition: background .15s; }
.switch i::after { content: ""; position: absolute; left: 2px; top: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0, 0, 0, .4); }
.switch input:checked + i { background: var(--green); }
.switch input:checked + i::after { transform: translateX(16px); }
.set-btns { display: flex; flex-wrap: wrap; gap: 8px; }

.grade { display: flex; gap: 16px; align-items: center; margin-bottom: 16px; }
.grade-g { width: 64px; height: 64px; border-radius: 14px; display: grid; place-items: center; font-size: 34px; font-weight: 800; background: var(--p4); }
.g-A { background: var(--green); } .g-B { background: #2563eb; } .g-C { background: #d97706; } .g-D, .g-E { background: #b91c1c; }
.grade b { font-size: 20px; display: block; }
.grade span { color: var(--tx2); }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: var(--p2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; }
.stat span { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--tx3); font-weight: 700; }
.stat b { font: 800 20px/1.3 var(--mono); }
.stat small { font-size: 11px; color: var(--tx2); }
.help ol { padding-left: 18px; margin: 0 0 12px; display: flex; flex-direction: column; gap: 8px; }
.help p { color: var(--tx2); }
.fms-legend { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 8px; font-size: 12px; }
.fms-legend span { display: flex; gap: 8px; align-items: center; }
.fms-legend .fms { animation: none; font-style: normal; }

/* ---------- Popover & Toasts ---------- */
.pop { position: fixed; z-index: 4000; min-width: 250px; max-width: 360px; max-height: 70vh; overflow-y: auto; background: var(--p2); border: 1px solid var(--line2); border-radius: 10px; box-shadow: var(--shadow); padding: 5px; animation: fade .12s; }
.pop-head { display: flex; gap: 10px; align-items: center; padding: 6px 8px 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.pop-head small { display: block; color: var(--tx2); font-size: 11px; }
.pop-title { font-size: 11px; font-weight: 700; color: var(--tx2); padding: 6px 8px; text-transform: uppercase; letter-spacing: .05em; }
.pop button { width: 100%; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 8px 9px; background: transparent; border: 0; border-radius: 6px; color: var(--tx); text-align: left; cursor: pointer; font-size: 12.5px; }
.pop button small { width: 100%; color: var(--tx2); font-size: 11px; }
.pop button:hover { background: var(--p4); }
.pop button.danger { color: var(--red2); }
.toasts { position: fixed; left: 50%; top: 66px; transform: translateX(-50%); z-index: 5000; display: flex; flex-direction: column; align-items: center; gap: 6px; width: max-content; max-width: 520px; pointer-events: none; }
.toast { background: var(--p2); border: 1px solid var(--line2); border-left: 4px solid var(--blue); border-radius: 9px; padding: 10px 14px; font-size: 12.5px; box-shadow: var(--shadow); animation: tin .2s ease; transition: opacity .25s, transform .25s; }
.toast.ok { border-left-color: var(--green2); } .toast.warn { border-left-color: var(--orange); } .toast.err { border-left-color: var(--red); }
.toast.out { opacity: 0; transform: translateX(12px); }
@keyframes tin { from { opacity: 0; transform: translateX(12px); } }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--p4); border-radius: 6px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Kleinere Bildschirme ---------- */
@media (max-width: 1500px) {
  .ws { grid-template-columns: 320px minmax(0, 1fr) 320px; }
  .kpi { padding: 0 10px; }
  .tb-actions .btn span { display: none; }
}
@media (max-width: 1280px) {
  .ws { grid-template-columns: 300px minmax(0, 1fr) 300px; grid-template-rows: minmax(0, 1fr) 240px; }
  .legend span { display: none; }
  .tb-stats .kpi:nth-child(3), .tb-stats .kpi:nth-child(4) { display: none; }
  .i-head, .i-row { grid-template-columns: 84px minmax(0, 1fr) 110px 96px 30px; }
}
@media (max-width: 1050px) {
  body { overflow: auto; }
  .app { height: auto; min-height: 100vh; }
  .ws { grid-template-columns: 1fr 1fr; grid-template-rows: 460px 420px 300px 300px;
    grid-template-areas: "map map" "calls res" "bottom bottom" "radio radio"; }
  .tb-stats { display: none; }
  .topbar { flex-wrap: wrap; height: auto; padding: 8px 12px; gap: 10px; }
  .app { grid-template-rows: auto 1fr; }
  .im { grid-template-columns: 1fr; overflow-y: auto; }
  .im-right { overflow: visible; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* ---------- Ergänzungen v5: Polizei, Nachfragen, Kartenstil ---------- */
.mk-veh.o-FW span { background: #7f1d1d; } .mk-veh.o-RD span { background: #1e3a8a; } .mk-veh.o-POL span { background: #115e59; }
.lg-pol { background: #0f766e; border-radius: 2px !important; }
.cb-q .qh { grid-column: 1 / -1; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; color: var(--tx3); margin-top: 2px; }
.cb-q .qh.fu { color: #fbbf24; }
.qbtn.fu { border-color: rgba(245, 158, 11, .45); background: rgba(245, 158, 11, .07); }
.qbtn.fu:hover { border-color: #f59e0b; background: rgba(245, 158, 11, .15); }
.cb-q { max-height: 190px; }
.set-row input.txt { width: 230px; background: var(--p1); border: 1px solid var(--line2); border-radius: 7px; color: var(--tx); padding: 6px 8px; font: 12px var(--mono); }
.i-units .u.o-POL { outline: 1px solid #2dd4bf; outline-offset: -1px; }
.kpi { padding: 0 11px; }
.kpi span { white-space: nowrap; }
