:root {
  --bg: #11161c; --panel: #19212a; --panel2: #202a35; --line: #2c3946; --text: #dfe6ee; --muted: #8a99a8;
  --accent: #e8452c; --warn: #f2a33a; --ok: #3fb56b;
  --s1: #7fd38f; --s2: #2f9e55; --s3: #f2c230; --s4: #e8452c; --sA: #ff7a45; --s6: #6b7680;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 13px/1.35 system-ui, -apple-system, "Segoe UI", sans-serif; }
button { font: inherit; color: var(--text); background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 5px 10px; cursor: pointer; }
button:hover { border-color: #4a5c6e; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.warnbtn { border-color: #6b4a1c; }
button:disabled { opacity: .45; cursor: default; }
select, input[type=text] { font: inherit; color: var(--text); background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; }
h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 10px 10px 6px; display: flex; align-items: center; gap: 8px; }
h2 small { text-transform: none; letter-spacing: 0; font-weight: 400; }
.hidden { display: none !important; }

#top { height: 48px; display: flex; align-items: center; gap: 12px; padding: 0 12px; background: #0b0f13; border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; white-space: nowrap; }
.brand span { font-weight: 400; color: var(--muted); margin-left: 6px; }
.clock { font: 600 20px/1 ui-monospace, Menlo, monospace; margin-left: auto; }
.speed { display: flex; gap: 4px; }
.speed button { padding: 4px 8px; }
.speed button.on { background: var(--accent); border-color: var(--accent); }
.toggle { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.toggle.on { color: var(--warn); font-weight: 600; }
.score { white-space: nowrap; }
.score b { font-size: 16px; }

main { display: grid; grid-template-columns: 340px 1fr 320px; grid-template-rows: 1fr 36vh; height: calc(100% - 48px); gap: 1px; background: #070a0d; }
.pane { background: var(--panel); display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.ph { flex: none; display: flex; align-items: center; gap: 10px; height: 30px; padding: 0 10px; background: #0d1217; border-bottom: 1px solid var(--line);
  font: 700 11px/1 system-ui; text-transform: uppercase; letter-spacing: .08em; color: #aebccb; }
.ph small { text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--muted); }
.pb { overflow-y: auto; padding-top: 8px; min-height: 0; }
#left { grid-row: 1 / 3; }
#left .pb { flex: 1; }
#right #notices { flex: 1 1 50%; }
#right #doneList { flex: 1 1 50%; }
#mapPane { position: relative; min-width: 0; min-height: 0; }
#map { position: absolute; inset: 0; }
#logPane { grid-column: 2 / 4; }
#log { flex: 1; overflow-y: auto; font: 13px/1.5 ui-monospace, Menlo, monospace; }
.tabs { display: flex; gap: 2px; margin-left: 12px; }
.tabs button { padding: 3px 10px; font: 600 11px system-ui; text-transform: none; letter-spacing: 0; border-radius: 4px; background: transparent; border-color: transparent; color: var(--muted); }
.tabs button.on { background: var(--panel2); border-color: var(--line); color: var(--text); }
.mini { font-size: 11px; text-transform: none; letter-spacing: 0; font-weight: 400; display: flex; gap: 4px; align-items: center; margin-left: auto; }
.logl { display: grid; grid-template-columns: 74px 220px 1fr; gap: 10px; padding: 3px 12px; border-bottom: 1px solid #1c252f; }
.logl:nth-child(even) { background: #161d25; }
.logl.fresh { animation: fresh 2s; }
@keyframes fresh { from { background: #2d3f55; } }
.logl .t { color: var(--muted); }
.logl .f { color: #9ec3ff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logl.warn { color: var(--warn); }
.logl.crit { color: #ff6b57; font-weight: 600; }
.logl.status { color: var(--muted); }

/* Einsatzliste */
.inc { margin: 0 8px 6px; padding: 7px 9px; background: var(--panel2); border: 1px solid var(--line); border-left: 4px solid var(--muted); border-radius: 6px; cursor: pointer; }
.inc:hover { border-color: #4a5c6e; }
.inc.ringing { border-left-color: var(--accent); animation: ring 1s infinite; }
.inc.neu { border-left-color: var(--warn); }
.inc.alarmiert, .inc.Fax { border-left-color: var(--s3); }
.inc.vor.Ort, .inc.Abarbeitung { border-left-color: var(--s2); }
.inc .row1 { display: flex; gap: 6px; align-items: baseline; }
.inc .kw { font-weight: 700; color: #fff; background: #3a2422; padding: 0 5px; border-radius: 4px; }
.inc .st { margin-left: auto; color: var(--muted); font-size: 11px; }
.inc .addr { color: var(--muted); margin-top: 2px; }
.flags { margin-top: 3px; display: flex; gap: 4px; flex-wrap: wrap; }
.flag { font-size: 11px; padding: 0 5px; border-radius: 4px; background: #4a2a1a; color: #ffb27a; }
.flag.crit { background: #5a1d1d; color: #ff8a7a; animation: ring 1.2s infinite; }
@keyframes ring { 50% { background-color: #3a1f1f; } }
.done { margin: 0 8px 4px; padding: 5px 9px; background: #151c23; border-radius: 6px; cursor: pointer; color: var(--muted); }
.done b { color: var(--text); }
.done .pts { float: right; font-weight: 700; }
.done .pts.pos { color: var(--ok); } .done .pts.neg { color: #ff6b57; }
.done ul { margin: 4px 0 0; padding-left: 16px; }

/* Fahrzeugliste */
.stgrp { margin: 0 8px 8px; }
.stgrp .sth { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; margin-bottom: 3px; }
.stgrp .sth b { color: var(--text); font-size: 12px; }
.badge { font-size: 10px; padding: 0 4px; border-radius: 3px; background: #2c3946; margin-left: 4px; }
.badge.bf { background: #5a1d1d; }
.badge.uw { background: #6b4a1c; }
.units { display: flex; flex-wrap: wrap; gap: 4px; }
.unit { display: flex; align-items: center; gap: 5px; padding: 2px 6px 2px 2px; background: var(--panel2); border-radius: 4px; font-size: 11px; cursor: default; }
.fms { width: 18px; height: 18px; display: grid; place-items: center; border-radius: 3px; font-weight: 700; color: #111; }
.fms.s1 { background: var(--s1); } .fms.s2 { background: var(--s2); color: #fff; } .fms.s3 { background: var(--s3); }
.fms.s4 { background: var(--s4); color: #fff; } .fms.s5 { background: #3a8dde; color: #fff; animation: blink .8s infinite; } .fms.sA { background: var(--sA); animation: blink .6s infinite; } .fms.s6 { background: var(--s6); }
@keyframes blink { 50% { opacity: .35; } }

/* Karte */
.mk-st { font-size: 10px; padding: 1px 4px; background: #222c; color: #fff; border: 1px solid #fff6; border-radius: 3px; white-space: nowrap; }
.mk-inc { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); border: 2px solid #fff; display: grid; place-items: center; font-size: 13px; cursor: pointer; box-shadow: 0 0 0 4px #e8452c55; }
.mk-inc.ringing { animation: pulse 1s infinite; }
.mk-inc.uw { background: #3a7bd5; box-shadow: 0 0 0 4px #3a7bd555; }
@keyframes pulse { 50% { box-shadow: 0 0 0 10px #e8452c22; } }
.mk-unit { font: 700 10px/1 system-ui; padding: 3px 5px; border-radius: 3px; border: 1px solid #000a; color: #111; white-space: nowrap; }
.mk-unit.s3 { background: var(--s3); } .mk-unit.s4 { background: var(--s4); color: #fff; } .mk-unit.s1 { background: var(--s1); }

/* Modal / Einsatzmaske */
#modal, .overlay { position: fixed; inset: 0; background: #000a; display: grid; place-items: center; z-index: 50; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; width: min(860px, calc(100vw - 32px)); max-height: calc(100vh - 40px); overflow-y: auto; }
.startcard { width: min(440px, calc(100vw - 32px)); }
.startcard label { display: flex; flex-direction: column; gap: 4px; margin: 10px 0; color: var(--muted); }
.startcard .primary { width: 100%; margin-top: 8px; padding: 9px; }
.hint { color: var(--muted); font-size: 11px; }
.mhead { display: flex; align-items: center; gap: 10px; }
.mhead h3 { margin: 0; font-size: 17px; }
.mhead .x { margin-left: auto; }
.caller { margin: 10px 0; padding: 10px 12px; background: #0f1419; border-left: 3px solid var(--accent); border-radius: 4px; font-style: italic; font-size: 14px; }
.mgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.mbox { background: var(--panel2); border-radius: 8px; padding: 10px; }
.mbox h4 { margin: 0 0 6px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.kwsel { width: 100%; }
.stlist { max-height: 300px; overflow-y: auto; }
.stl { padding: 5px 0; border-bottom: 1px solid var(--line); }
.stl .n { display: flex; justify-content: space-between; font-size: 12px; }
.stl .n span { color: var(--muted); }
.stl label { display: inline-flex; align-items: center; gap: 4px; margin: 3px 8px 0 0; font-size: 12px; }
.stl label.busy { opacity: .4; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; align-items: center; }
.assigned .a { display: flex; align-items: center; gap: 6px; padding: 2px 0; }
.assigned .a button { margin-left: auto; padding: 1px 6px; font-size: 11px; }
.scorelist { margin: 4px 0 0; padding-left: 16px; }

#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: #22303d; border: 1px solid #f2c230; border-radius: 8px; padding: 10px 14px; min-width: 240px; animation: slide .3s; }
.toast b { display: block; }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }

/* FMS-Statustableau (schwebend oder abgedockt) */
.float { position: fixed; z-index: 40; top: 70px; right: 16px; width: min(760px, calc(100vw - 32px)); height: 60vh; background: var(--panel); border: 1px solid #3a4b5c;
  border-radius: 8px; box-shadow: 0 12px 40px #000c; display: flex; flex-direction: column; resize: both; overflow: hidden; }
.fh { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: #0d1217; border-bottom: 1px solid var(--line); cursor: move; font-weight: 700; user-select: none; }
.fh button { padding: 2px 8px; font-size: 12px; }
.fmslegend { margin-left: auto; font: 400 11px system-ui; color: var(--muted); display: flex; align-items: center; gap: 3px; flex-wrap: wrap; }
.fmslegend i { font-style: normal; font-weight: 700; color: #111; width: 16px; text-align: center; border-radius: 3px; margin-left: 6px; }
.fmsbody { flex: 1; overflow-y: auto; padding: 8px; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; align-content: start; }
.fmssum { grid-column: 1 / -1; display: flex; gap: 6px; flex-wrap: wrap; font-size: 12px; }
.fmssum span { padding: 2px 8px; border-radius: 4px; background: var(--panel2); }
.fmsst { background: var(--panel2); border-radius: 6px; padding: 6px; }
.fmsst .n { font-size: 11px; font-weight: 700; margin-bottom: 4px; display: flex; justify-content: space-between; gap: 4px; }
.fmsst .n span { color: var(--muted); font-weight: 400; }
.fz { display: grid; grid-template-columns: 22px 1fr; align-items: center; gap: 6px; padding: 2px 4px 2px 2px; margin-top: 2px; border-radius: 4px; background: #121920; font-size: 11px; }
.fz b { display: grid; place-items: center; height: 20px; border-radius: 3px; color: #111; }
.fz.s1 b, .fmslegend .s1 { background: var(--s1); } .fz.s2 b, .fmslegend .s2 { background: var(--s2); color: #fff; }
.fz.s3 b, .fmslegend .s3 { background: var(--s3); } .fz.s4 b, .fmslegend .s4 { background: var(--s4); color: #fff; }
.fz.s5 b, .fmslegend .s5 { background: #3a8dde; color: #fff; } .fz.s6 b, .fmslegend .s6 { background: var(--s6); }
.fz.sA b, .fmslegend .sA { background: var(--sA); }
.fz.s5 b, .fz.sA b { animation: blink .7s infinite; }
.fz.s5, .fz.inc { cursor: pointer; }
.fz.s5:hover, .fz.inc:hover { outline: 1px solid #4a5c6e; }
.fz small { color: var(--muted); }
body.popout { overflow: hidden; }
body.popout .fmsbody { position: fixed; inset: 0; }

@media (max-width: 1100px) {
  main { grid-template-columns: 300px 1fr; grid-template-rows: 1fr 32vh auto; }
  #right { grid-column: 1 / 3; grid-row: 3; max-height: 40vh; }
  #logPane { grid-column: 2; }
}
@media (max-width: 760px) {
  #top { flex-wrap: wrap; height: auto; padding: 6px 16px; }
  .brand span { display: none; }
  main { grid-template-columns: 1fr; grid-template-rows: 45vh auto auto auto; height: auto; }
  #left, #mapPane, #right, #logPane { grid-column: 1; grid-row: auto; }
  #left { max-height: 50vh; }
  #logPane { height: 40vh; }
  .logl { grid-template-columns: 64px 1fr; }
  .logl span:last-child { grid-column: 1 / 3; }
  .mgrid { grid-template-columns: 1fr; }
}

.cats { border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; margin: 10px 0; color: var(--muted); }
.cats label { flex-direction: row !important; align-items: center; gap: 6px !important; margin: 4px 0 !important; color: var(--text); }
.startcard input[type=range] { width: 100%; accent-color: var(--accent); }
.stormbadge { background: #3a2a10; border: 1px solid #f2a33a; color: #ffcf80; padding: 4px 10px; border-radius: 6px; white-space: nowrap; animation: blink 1.6s infinite; }
.legend { position: absolute; left: 10px; bottom: 28px; background: #11161cdd; border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; font-size: 11px; z-index: 5; }
.legend i { display: inline-block; width: 12px; height: 10px; margin: 0 3px 0 6px; border-radius: 2px; vertical-align: middle; }
#center { position: relative; }

.notice { margin: 0 8px 6px; padding: 7px 9px; background: #1d2633; border: 1px solid var(--line); border-left: 4px solid #3a8dde; border-radius: 6px; }
.notice.s6 { border-left-color: var(--s6); }
.notice.ok { opacity: .65; }
.notice .row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.notice .row b { flex: 1; }
.notice select { max-width: 100%; margin-top: 4px; font-size: 12px; padding: 3px 6px; }
.notice button { padding: 3px 8px; font-size: 12px; }
.unit.click { cursor: pointer; outline: 1px solid #3a8dde; }

.logl.dme { color: #d2b4ff; }
.logl.dme .f { color: #b48cff; font-weight: 700; }
#mNote { width: 100%; resize: vertical; font: inherit; color: var(--text); background: #0f1419; border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; }
.askbtn { padding: 0 5px; font-size: 10px; margin: 3px 8px 0 -4px; vertical-align: middle; }

.logl.lage { color: #9fe3b0; }
.incLog { max-height: 220px; overflow-y: auto; border: 1px solid var(--line); border-radius: 6px; font: 12px/1.45 ui-monospace, Menlo, monospace; }
.incLog .logl { grid-template-columns: 64px 170px 1fr; padding: 2px 8px; }

.advice { margin: 8px 0; padding: 8px 10px; background: #14271c; border-left: 3px solid var(--ok); border-radius: 4px; }

.startcard input[type=email], .startcard input[type=password], .startcard input[type=text] { width: 100%; font: inherit; color: var(--text); background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; }
.authtabs { margin: 12px 0 4px; }
.authtabs button { font-size: 13px; padding: 5px 14px; }
#authForm .primary { width: 100%; margin-top: 8px; padding: 9px; }
#authMsg.err { color: #ff8a7a; } #authMsg.ok { color: var(--ok); }
#authMsg a { color: #9ec3ff; word-break: break-all; }
.userbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; background: var(--panel2); border-radius: 8px; margin-bottom: 10px; font-size: 12px; }
.userbar b { font-size: 13px; }
#adminBox { margin-bottom: 8px; }
#adminBox input { margin-top: 6px; font-size: 12px; }
.usertag { color: var(--muted); white-space: nowrap; font-size: 12px; }
.rank { width: 100%; border-collapse: collapse; margin-top: 8px; }
.rank td, .rank th { text-align: left; padding: 5px 8px; border-bottom: 1px solid var(--line); }
.rank tr.me { background: #1d2a1f; }
.rank td.n { text-align: right; font-variant-numeric: tabular-nums; }

body.farzoom .mk-st:not(.bf) { font-size: 0; padding: 0; width: 7px; height: 7px; border-radius: 50%; background: #e8452c; border: 1px solid #fff; }
