:root {
    --bg: #e8ecf1; --panel: #fff; --line: #d5dbe3; --text: #1c2733; --muted: #6b7785;
    --brand: #0c2a5b; --brand2: #164a96; --accent: #c8102e; --ok: #2fb35a;
    --f0: #e63946; --f1: #2fb35a; --f2: #1e7a3c; --f3: #f2b705; --f4: #f07f13; --f5: #e63946; --f6: #8a949e; --f7: #2a6fdb; --f8: #8a4fd0;
}
body.org-pol { --brand: #0b3b2e; --brand2: #13684f; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.35 system-ui, "Segoe UI", Roboto, Arial, sans-serif; }
.hidden { display: none !important; }
button { font: inherit; cursor: pointer; border: 1px solid var(--brand2); background: var(--brand2); color: #fff; border-radius: 6px; padding: 7px 14px; }
button:hover { filter: brightness(1.1); }
button.small { padding: 3px 9px; font-size: 12px; }
button.ghost { background: transparent; color: var(--brand2); }
button.primary { background: var(--ok); border-color: var(--ok); }
button.danger { background: var(--accent); border-color: var(--accent); font-weight: 600; }
input, select, textarea { font: inherit; width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--text); }
textarea { resize: vertical; }
code { background: #eef1f5; padding: 1px 5px; border-radius: 4px; }
.muted { color: var(--muted); }
.small-text { font-size: 12px; }
.error { color: var(--accent); min-height: 1.2em; }

/* login */
.login { height: 100%; display: flex; align-items: center; justify-content: center; background: radial-gradient(circle at 30% 20%, #1d3f78, #0a1f44); }
.login-box { width: 340px; background: #fff; border-radius: 14px; padding: 28px; text-align: center; display: flex; flex-direction: column; gap: 12px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.login-box img { width: 110px; height: 110px; object-fit: contain; margin: 0 auto; padding: 14px; border-radius: 50%; background: var(--brand); }
.login-box h1 { margin: 0; font-size: 20px; }
.login-box input { text-align: center; font-size: 26px; letter-spacing: 6px; }

/* layout */
.app { height: 100%; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 18px; padding: 6px 14px; background: var(--brand); color: #fff; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; }
.brand img { height: 30px; }
.topstats { display: flex; gap: 16px; flex: 1; justify-content: center; }
.topstats span { background: rgba(255,255,255,.1); padding: 3px 10px; border-radius: 12px; }
.topstats .alert { background: var(--f5); animation: blink 1s steps(2) infinite; }
.topright { display: flex; align-items: center; gap: 14px; }
.topright button.ghost { color: #fff; border-color: rgba(255,255,255,.5); padding: 3px 10px; }
.clock { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 16px; }
.conn { font-size: 12px; padding: 2px 8px; border-radius: 10px; }
.conn.ok { background: rgba(47,179,90,.3); } .conn.bad { background: var(--f5); }

.grid { flex: 1; display: grid; grid-template-columns: 24% 1fr 30%; gap: 10px; padding: 10px; min-height: 0; }
.col { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.panel.grow, .block.grow { flex: 1; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; font-weight: 700; border-bottom: 1px solid var(--line); background: #f5f7fa; }
.panel-head.big { font-size: 17px; }
.panel-head .hint { font-weight: 400; font-size: 11px; color: var(--muted); }
.badge { background: var(--muted); color: #fff; border-radius: 10px; padding: 0 8px; font-size: 12px; }
.badge.alert { background: var(--f5); animation: blink 1s steps(2) infinite; }
.list { overflow: auto; padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.empty { color: var(--muted); text-align: center; padding: 16px; }
.row { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.row.end { justify-content: flex-end; }

.call { border: 2px solid var(--f5); border-radius: 8px; padding: 8px; background: #fff4f4; animation: pulse 1.6s infinite; }
.call-text { margin: 4px 0; font-weight: 600; }
.einsatz { border: 1px solid var(--line); border-left: 5px solid var(--f6); border-radius: 8px; padding: 8px; cursor: pointer; }
.einsatz.st-alarmiert { border-left-color: var(--accent); }
.einsatz.st-offen { border-left-color: var(--f3); }
.einsatz.sel { background: #e9f1ff; border-color: var(--brand2); }
.stw { font-weight: 700; color: var(--accent); }
.chips, .sugg { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 5px; background: #f0f3f7; border-radius: 12px; padding: 2px 8px 2px 2px; font-size: 12px; }

.fms { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; color: #fff; font-weight: 700; font-size: 12px; background: var(--f6); }
.f0 { background: var(--f0); } .f1 { background: var(--f1); } .f2 { background: var(--f2); } .f3 { background: var(--f3); color: #222; } .f4 { background: var(--f4); }
.f5 { background: var(--f5); } .f6 { background: var(--f6); } .f7 { background: var(--f7); } .f8 { background: var(--f8); }

/* editor */
.placeholder { margin: auto; text-align: center; color: var(--muted); padding: 30px; }
.editor-body { flex: 1; overflow: auto; padding: 12px; display: flex; flex-direction: column; gap: 12px; }
.form { display: flex; flex-direction: column; gap: 8px; }
.form label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); font-weight: 600; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.two.plz-row { grid-template-columns: 1fr 110px; }
.plz { color: var(--brand2); }
.block { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; min-height: 0; }
.block-head { font-weight: 700; font-size: 13px; }
.assigned { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.assigned button { margin-left: auto; }
.alarm-row { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }
.status { font-size: 12px; text-transform: uppercase; padding: 2px 8px; border-radius: 10px; background: #eef1f5; }
.status.st-alarmiert { background: var(--accent); color: #fff; }
.log { flex: 1; min-height: 90px; max-height: 260px; overflow: auto; font-size: 12.5px; font-family: ui-monospace, Consolas, monospace; background: #fafbfc; border-radius: 6px; padding: 6px; }
.log-row { padding: 1px 0; }
.log .who { color: var(--brand2); font-weight: 600; }
.note { display: flex; gap: 6px; }
.note button { white-space: nowrap; }
.actions { display: flex; gap: 8px; justify-content: flex-end; }

/* units */
.units { overflow: auto; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.unit { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; cursor: pointer; }
.unit.sel { outline: 3px solid var(--brand2); background: #e9f1ff; }
.unit.wants { animation: pulse 1.2s infinite; border-color: var(--f5); }
.unit-fms { width: 38px; height: 38px; border-radius: 8px; color: #fff; font-size: 22px; font-weight: 800; display: flex; align-items: center; justify-content: center; flex: none; }
.unit-info { flex: 1; min-width: 0; font-size: 12.5px; }
.unit-info .muted { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.type { font-size: 11px; background: #eef1f5; border-radius: 6px; padding: 0 5px; color: var(--muted); }
.type.busy { background: #fde7c9; color: #8a5300; }
.unit-actions { display: flex; flex-direction: column; gap: 4px; }

.map-panel { height: 34%; }
#map { flex: 1; width: 100%; min-height: 0; display: block; }

.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: #1c2733; color: #fff; padding: 9px 18px; border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.3); z-index: 10; }
.toast.bad { background: var(--accent); }

@keyframes blink { 50% { opacity: .55; } }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(230,57,70,.0); } 50% { box-shadow: 0 0 0 4px rgba(230,57,70,.35); } }

@media (max-width: 1100px) {
    .grid { grid-template-columns: 1fr; overflow: auto; }
    .topstats { display: none; }
}

/* Funk: Notruf, Funkmeldungen, Funkstatus */
.notrufbar { background: var(--f5); color: #fff; font-weight: 700; padding: 6px 14px; display: flex; flex-direction: column; gap: 4px; animation: blink 1s steps(2) infinite; }
.notrufbar .nr-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.notrufbar button { background: #fff; color: var(--f5); font-weight: 700; }
.meldungen-panel { max-height: 30%; }
.meldung { display: flex; align-items: flex-start; gap: 8px; border: 1px solid var(--line); border-left: 4px solid var(--f7); border-radius: 6px; padding: 5px 8px; font-size: 12.5px; }
.meldung.notruf { border-left-color: var(--f5); background: #fff4f4; }
.meldung.kurzmeldung { border-left-color: var(--f3); }
.meldung.done { opacity: .55; }
.meldung .micon { font-weight: 800; width: 16px; text-align: center; }
.meldung .mtext { flex: 1; min-width: 0; word-break: break-word; }
.unit.notruf { background: #ffe5e7; border-color: var(--f5); animation: pulse .7s infinite; }
.funk { display: inline-block; padding: 0 5px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.funk.tmo { background: #dff3e5; color: #1e7a3c; } .funk.dmo { background: #fff1c2; color: #8a6400; } .funk.off { background: #eceff3; color: #6b7785; }
select.anw { font-size: 11px; padding: 1px 2px; max-width: 64px; border: 1px solid var(--line); border-radius: 4px; background: #fff; }
#map { cursor: grab; touch-action: none; }
#map:active { cursor: grabbing; }
body.map-big .map-panel { position: fixed; inset: 96px 14px 14px 14px; height: auto; z-index: 8; box-shadow: 0 10px 40px rgba(0,0,0,.4); }
