:root {
  --bg: #f3f4f6;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e5e7eb;
  --text: #111827;
  --muted: #6b7280;
  --red: #b91c1c;
  --red-600: #dc2626;
  --red-50: #fef2f2;
  --navy: #111827;
  --navy-2: #1f2937;
  --green: #16a34a;
  --green-soft: #dcfce7;
  --amber: #d97706;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.06);
  --radius: 14px;
  --heat-0: #f1f5f9;
  --heat-1: #ede9fe;
  --heat-2: #c4b5fd;
  --heat-3: #8b5cf6;
  --heat-4: #5b21b6;
  --violet: #7c3aed;
  color-scheme: light;
}
:root[data-theme="dark"] {
    --bg: #0b0f17;
    --surface: #131a24;
    --surface-2: #19212d;
    --border: #263042;
    --text: #e5e7eb;
    --muted: #94a3b8;
    --red-50: #2a1214;
    --green-soft: #12301f;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.3);
    --heat-0: #1a2230;
    --heat-1: #2e1f4d;
    --heat-2: #4c1d95;
    --heat-3: #6d28d9;
    --heat-4: #8b5cf6;
    color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0f17;
    --surface: #131a24;
    --surface-2: #19212d;
    --border: #263042;
    --text: #e5e7eb;
    --muted: #94a3b8;
    --red-50: #2a1214;
    --green-soft: #12301f;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.3);
    --heat-0: #1a2230;
    --heat-1: #2e1f4d;
    --heat-2: #4c1d95;
    --heat-3: #6d28d9;
    --heat-4: #8b5cf6;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--muted); }

/* ---------- Auth-Seiten ---------- */
.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(220,38,38,.35), transparent 60%),
    radial-gradient(900px 500px at 110% 110%, rgba(220,38,38,.25), transparent 60%),
    linear-gradient(160deg, #111827, #1f2937);
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border-radius: 20px;
  padding: 32px 28px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.auth-card.wide { max-width: 560px; }
.auth-logo { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; margin-bottom: 24px; }
.logo-big { width: 150px; height: 150px; object-fit: contain; background: #fff; border-radius: 20px; padding: 6px; }
.auth-logo strong { font-size: 24px; display: block; letter-spacing: .02em; }
.auth-logo span { color: var(--muted); font-size: 13px; }
.auth h2 { margin: 0 0 4px; font-size: 18px; }
.auth p.lead { margin: 0 0 20px; color: var(--muted); font-size: 14px; }

.logo { width: 46px; height: 46px; flex: none; object-fit: contain; background: #fff; border-radius: 10px; padding: 2px; }
.sidebar .logo { width: 64px; height: 64px; border-radius: 12px; }
.topbar .logo { width: 38px; height: 38px; }

/* ---------- Formulare ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label, .label { font-size: 13px; font-weight: 600; color: var(--muted); }
.input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--red-600); box-shadow: 0 0 0 3px rgba(220,38,38,.15); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .row { grid-template-columns: 1fr; } }
.form-error { color: var(--red-600); font-size: 13px; min-height: 18px; margin: 4px 0 8px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-600); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-danger { color: var(--red-600); }
.btn-block { width: 100%; padding: 12px; }
.btn-sm { padding: 6px 10px; font-size: 13px; }
.icon-btn { padding: 8px; }

/* Funktions-Auswahl */
.func-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.func-picker label {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  user-select: none;
  background: var(--surface-2);
}
.func-picker input { display: none; }
.func-picker label:has(input:checked) { background: var(--red); border-color: var(--red); color: #fff; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }

/* ---------- Layout ---------- */
.layout { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar {
  background: linear-gradient(180deg, #111827, #1a2232);
  color: #e5e7eb;
  display: flex; flex-direction: column;
  padding: 20px 14px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 22px; }
.brand strong { display: block; font-size: 17px; color: #fff; }
.brand span { font-size: 12px; color: #9ca3af; }
.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  text-decoration: none;
  color: #cbd5e1;
  font-weight: 600;
  font-size: 14px;
}
.nav a svg { width: 19px; height: 19px; flex: none; }
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.active { background: var(--red); color: #fff; box-shadow: 0 4px 14px rgba(185,28,28,.4); }
.nav .nav-section { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #6b7280; padding: 16px 12px 6px; }
.userbox {
  display: flex; align-items: center; gap: 10px;
  padding: 12px; border-radius: 12px;
  background: rgba(255,255,255,.05);
}
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--red); color: #fff; font-weight: 700; font-size: 13px; flex: none;
}
.userbox .who { flex: 1; min-width: 0; }
.userbox .who strong { display: block; font-size: 14px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.userbox .who span { font-size: 12px; color: #9ca3af; }
.userbox button { background: transparent; border: 0; color: #9ca3af; cursor: pointer; padding: 6px; border-radius: 8px; }
.userbox button:hover { color: #fff; background: rgba(255,255,255,.08); }
.userbox svg { width: 18px; height: 18px; display: block; }

.topbar { display: none; }
main { padding: 28px 32px 48px; min-width: 0; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { margin: 0; font-size: 24px; letter-spacing: -.02em; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.card + .card { margin-top: 16px; }
.card h3 { margin: 0 0 12px; font-size: 16px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stat .k { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat .v { font-size: 26px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat .v small { font-size: 14px; color: var(--muted); font-weight: 600; }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.toolbar .group { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.weeknav { display: flex; align-items: center; gap: 6px; }
.weeknav .label-week { font-weight: 700; min-width: 190px; text-align: center; font-variant-numeric: tabular-nums; }
.weeknav .label-week small { display: block; font-weight: 500; color: var(--muted); font-size: 12px; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  background: var(--red-50);
  color: var(--red-600);
  border: 1px solid rgba(220,38,38,.2);
  white-space: nowrap;
}
.badge.gray { background: var(--surface-2); color: var(--muted); border-color: var(--border); }
.badges { display: flex; flex-wrap: wrap; gap: 4px; }

/* ---------- Wochenraster ---------- */
.grid-wrap { overflow-x: auto; }
.wgrid {
  display: grid;
  grid-template-columns: 52px repeat(7, minmax(40px, 1fr));
  gap: 3px;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  touch-action: pan-x pan-y; /* Wischen scrollt; Markieren per Tippen / langem Drücken */
  min-width: 340px;
}
.wgrid .dh {
  text-align: center; font-size: 12px; font-weight: 700; padding: 6px 2px;
  border-radius: 8px; cursor: pointer; color: var(--muted);
}
.wgrid .dh b { display: block; font-size: 15px; color: var(--text); }
.wgrid .dh.today { background: var(--red-50); color: var(--red-600); }
.wgrid .dh.today b { color: var(--red-600); }
.wgrid .dh:hover { background: var(--surface-2); }
.wgrid .hl {
  font-size: 11px; color: var(--muted); text-align: right; padding-right: 6px;
  display: flex; align-items: center; justify-content: flex-end; cursor: pointer; font-variant-numeric: tabular-nums;
}
.wgrid .hl:hover { color: var(--text); }
.wgrid .c {
  height: 22px;
  border-radius: 5px;
  background: var(--heat-0);
  cursor: pointer;
  transition: background .08s;
  position: relative;
  font-size: 11px;
  font-weight: 700;
  display: grid; place-items: center;
  font-variant-numeric: tabular-nums;
}
.wgrid .c:hover { outline: 2px solid rgba(220,38,38,.35); outline-offset: -1px; }
.wgrid .c.on { background: var(--green); }
.wgrid .c.past { opacity: .5; cursor: not-allowed;
  background-image: repeating-linear-gradient(135deg, rgba(120,120,120,.55) 0 2px, transparent 2px 6px); }
.wgrid .c.past:hover { outline: none; }
.wgrid .c.now { outline: 2px solid var(--red); outline-offset: -2px; position: relative; z-index: 1; }
.wgrid .dh.past { opacity: .45; text-decoration: line-through; }
.legend i.lg-past { background-color: var(--heat-0); opacity: .6;
  background-image: repeating-linear-gradient(135deg, rgba(120,120,120,.7) 0 2px, transparent 2px 5px); }
.legend i.lg-now { background: var(--heat-0); box-shadow: inset 0 0 0 2px var(--red); }
.wgrid .night { }
.wgrid .c.l1 { background: var(--heat-1); }
.wgrid .c.l2 { background: var(--heat-2); }
.wgrid .c.l3 { background: var(--heat-3); color: #fff; }
.wgrid .c.l4 { background: var(--heat-4); color: #fff; }
.wgrid .c.sel { outline: 2px solid var(--text); outline-offset: -1px; }
.wgrid .c.full { background: var(--green); color: #fff; }
.wgrid .c.sp::after {
  content: '⚡'; position: absolute; top: -3px; right: 1px; font-size: 9px; line-height: 1;
}

/* ---------- Spontan ---------- */
.spontan-btn {
  display: flex; align-items: center; gap: 10px; width: 100%;
  margin: 0 0 16px; padding: 11px 12px;
  border-radius: 12px; border: 1px solid rgba(251,191,36,.45);
  background: linear-gradient(135deg, rgba(251,191,36,.18), rgba(217,119,6,.12));
  color: #fde68a; cursor: pointer; text-align: left;
  transition: transform .08s, background .15s;
}
.spontan-btn:hover { background: linear-gradient(135deg, rgba(251,191,36,.28), rgba(217,119,6,.2)); }
.spontan-btn:active { transform: scale(.98); }
.spontan-btn .bolt { font-size: 20px; }
.bolt { display: inline-block; animation: boltBlink 1s steps(2, jump-none) infinite; }
@keyframes boltBlink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: .15; } }
@media (prefers-reduced-motion: reduce) { .bolt { animation-duration: 2s; } }
.sp-pop { position: relative; text-align: center; max-width: 360px; }
.sp-pop h2 { margin: 4px 0 8px; font-size: 22px; letter-spacing: .5px; }
.sp-pop p { color: var(--muted); margin: 0 0 18px; }
.sp-pop-bolt { font-size: 46px; line-height: 1; animation: boltBlink 1s steps(2, jump-none) infinite; }
.sp-pop-x { position: absolute; top: 10px; right: 10px; width: 36px; height: 36px; border-radius: 50%;
  border: 0; background: var(--surface-2); color: var(--text); font-size: 17px; cursor: pointer; }
.sp-pop-go { background: linear-gradient(135deg, #fbbf24, #f59e0b); border-color: #f59e0b; color: #111827; font-weight: 800; font-size: 16px; padding: 13px; }
.spontan-btn .sb-text b { display: block; font-size: 14px; color: #fff; }
.spontan-btn .sb-text small { font-size: 12px; color: #fcd34d; }
.spontan-btn.active { background: linear-gradient(135deg, #16a34a, #15803d); border-color: #22c55e; box-shadow: 0 4px 16px rgba(22,163,74,.4); }
.spontan-btn.active .sb-text small { color: #dcfce7; }
.spontan-btn.sm { display: none; }
.pulse {
  width: 10px; height: 10px; border-radius: 50%; background: #fff; flex: none;
  box-shadow: 0 0 0 0 rgba(255,255,255,.7); animation: pulse 1.6s infinite;
}
.sp-status .pulse, .live-dot { background: var(--green); box-shadow: 0 0 0 0 rgba(22,163,74,.6); }
@keyframes pulse { 70% { box-shadow: 0 0 0 9px rgba(255,255,255,0); } 100% { box-shadow: 0 0 0 0 rgba(255,255,255,0); } }
.sp-status {
  display: flex; gap: 12px; align-items: center; padding: 12px 14px; margin-bottom: 14px;
  border-radius: 12px; background: var(--green-soft); border: 1px solid rgba(22,163,74,.3);
}
.sp-status small { display: block; color: var(--muted); }
.time-big { font-size: 26px; font-weight: 700; padding: 10px 14px; font-variant-numeric: tabular-nums; }
.sp-hint { font-size: 14px; color: var(--muted); min-height: 20px; }
.sp-tag { display: inline-block; font-size: 11.5px; font-weight: 700; color: var(--amber); white-space: nowrap; }
.muted-sm { display: block; font-size: 12px; color: var(--muted); }

.now-card { border-left: 4px solid var(--green); }
.now-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.now-head h3 { margin: 0; flex: 1; }
.live-dot { width: 10px; height: 10px; border-radius: 50%; animation: pulse 1.6s infinite; }
.now-count { font-size: 22px; font-weight: 800; color: var(--green); }
.now-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.now-person { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.now-person .sp-tag, .now-person .muted-sm { display: block; }
.now-person.is-sp { border-color: rgba(217,119,6,.45); }
.now-person .avatar { background: var(--violet); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-top: 12px; align-items: center; }
.legend i { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: -2px; margin-right: 6px; }

.split { display: grid; grid-template-columns: 1fr 320px; gap: 16px; align-items: start; }
@media (max-width: 1100px) { .split { grid-template-columns: 1fr; } }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); cursor: pointer; font-size: 13px; font-weight: 600;
}
.chip.active { background: var(--navy); color: #fff; border-color: var(--navy); }
:root[data-theme="dark"] .chip.active { background: #e5e7eb; color: #111827; border-color: #e5e7eb; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .chip.active { background: #e5e7eb; color: #111827; border-color: #e5e7eb; } }

.detail-empty { color: var(--muted); font-size: 14px; }
.flist { list-style: none; padding: 0; margin: 0; }
.flist li { padding: 8px 0; border-bottom: 1px solid var(--border); }
.flist li:last-child { border-bottom: 0; }
.flist .fname { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; display: flex; justify-content: space-between; }
.flist .people { margin-top: 4px; font-size: 14px; }
.flist .none { color: var(--muted); font-style: italic; font-size: 13px; }

/* ---------- Tabellen ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--border); }
td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td .name { display: flex; align-items: center; gap: 10px; font-weight: 600; }
td .name small { display: block; color: var(--muted); font-weight: 500; font-size: 12.5px; }
td.actions { text-align: right; white-space: nowrap; }

/* ---------- Programm-Platzhalter ---------- */
.func-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.func-card { border: 1px solid var(--border); border-radius: 12px; padding: 14px; background: var(--surface-2); }
.func-card .t { font-weight: 700; }
.func-card .n { font-size: 28px; font-weight: 800; color: var(--red-600); }
.func-card .m { font-size: 13px; color: var(--muted); }
.notice {
  display: flex; gap: 14px; align-items: flex-start;
  border: 1px dashed rgba(220,38,38,.45);
  background: var(--red-50);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
}
.notice svg { width: 26px; height: 26px; color: var(--red-600); flex: none; }
.notice h3 { margin: 0 0 4px; }
.notice p { margin: 0; color: var(--muted); }

/* ---------- Modal & Toast ---------- */
.modal-back {
  position: fixed; inset: 0; background: rgba(15,23,42,.55);
  display: grid; place-items: center; padding: 16px; z-index: 50;
  animation: fade .15s ease-out;
}
.modal {
  background: var(--surface); border-radius: 18px; width: 100%; max-width: 540px;
  max-height: calc(100vh - 32px); overflow: auto;
  box-shadow: 0 24px 60px rgba(0,0,0,.35); padding: 24px;
  animation: pop .18s ease-out;
}
.modal h2 { margin: 0 0 16px; font-size: 19px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }

#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  background: #111827; color: #fff; padding: 11px 18px; border-radius: 12px;
  font-size: 14px; font-weight: 600; opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; z-index: 60; box-shadow: 0 10px 30px rgba(0,0,0,.3);
  max-width: calc(100vw - 32px);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { background: var(--red-600); }

.muted-p { color: var(--muted); font-size: 14px; margin: 0 0 12px; }
.ok-line { color: var(--green); font-weight: 700; }
.steps { margin: 0; padding-left: 20px; font-size: 14px; line-height: 1.9; }
.kbd { display: inline-block; padding: 0 6px; border: 1px solid var(--border); border-radius: 6px; font-size: 12px; }
.report { margin-top: 14px; padding: 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); font-size: 14px; }
.report ul { margin: 8px 0 0; padding-left: 18px; }
.report p { margin: 8px 0 0; color: var(--muted); }

.dirty-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); display: inline-block; }

/* ---------- Mobil ---------- */
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; bottom: 0; top: auto; left: 0; right: 0; height: auto;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    z-index: 40; flex-direction: row;
  }
  .sidebar .brand, .sidebar .userbox, .nav .nav-section { display: none; }
  .nav { flex-direction: row; justify-content: space-around; gap: 2px; }
  .nav a { flex-direction: column; gap: 3px; font-size: 10.5px; padding: 7px 4px; flex: 1; text-align: center; }
  .nav a.active { box-shadow: none; }
  .topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: #111827; color: #fff;
    position: sticky; top: 0; z-index: 30;
  }
  .topbar .brand { padding: 0; }
  .topbar button { background: transparent; border: 0; color: #cbd5e1; padding: 6px; }
  .topbar-actions { display: flex; align-items: center; gap: 6px; }
  .sidebar .spontan-btn { display: none; }
  .topbar .spontan-btn.sm {
    display: inline-flex; width: auto; margin: 0; padding: 8px 12px; gap: 7px;
    font-weight: 700; font-size: 13.5px; color: #111827; white-space: nowrap;
    background: linear-gradient(135deg, #fbbf24, #f59e0b); border: 0; border-radius: 999px;
  }
  .topbar .spontan-btn.sm.active { background: linear-gradient(135deg, #16a34a, #15803d); color: #fff; }
  .topbar svg { width: 20px; height: 20px; display: block; }
  main { padding: 18px 16px 100px; }
  .page-head h1 { font-size: 21px; }
  .weeknav .label-week { min-width: 0; flex: 1; }
  .weeknav { width: 100%; }
  .wgrid { grid-template-columns: 38px repeat(7, minmax(0, 1fr)); gap: 2px; min-width: 0; }
  .wgrid .c { height: 20px; font-size: 10px; }
  .card { padding: 14px; }
  .hide-sm { display: none; }
  #toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
}

/* Admin: Kalender eines anderen Mitglieds bearbeiten */
.admin-edit-note { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  background: rgba(245, 158, 11, .14); border: 1px solid rgba(245, 158, 11, .55); color: var(--text);
  border-radius: 12px; padding: 10px 14px; margin: 0 0 16px; font-size: 15px; }

/* Dispo-Knopf: rot, angetippt (aktiv) grün */
.nav a.nav-dispo.active { background: var(--green); box-shadow: 0 4px 14px rgba(22,163,74,.4); }
@media (max-width: 860px) {
  /* Reihenfolge in der unteren Leiste: Dispo genau in der Mitte */
  /* Mitglied: Übungen · DISPO · Status (Profil oben) */
  /* Unten für alle gleich: Agenda · DISPO · Status – Übersicht, Mitglieder, Profil oben als Symbole */
  .nav a[data-r="uebungen"] { order: 1; } .nav a[data-r="dispo"] { order: 2; } .nav a[data-r="status"] { order: 3; }
  .nav a[data-r="profil"], .nav a[data-r="uebersicht"], .nav a[data-r="mitglieder"], .nav a[data-r="nachrichten"], .nav .nav-section { display: none !important; }
  .topbar .tb-icon { display: inline-flex; color: #cbd5e1; padding: 6px; border-radius: 8px; }
  .topbar .tb-icon.active { color: #fff; background: rgba(255,255,255,.12); }
  .topbar .tb-icon svg { width: 22px; height: 22px; }
  .nav a.nav-dispo {
    flex: 0 0 auto; width: 64px; height: 64px; margin-top: -26px; padding: 0; justify-content: center;
    border-radius: 50%; background: var(--red); color: #fff; font-weight: 700;
    border: 4px solid #111827; box-shadow: 0 6px 18px rgba(185,28,28,.5);
  }
  .nav a.nav-dispo svg { width: 24px; height: 24px; }
  .nav a.nav-dispo:hover { background: var(--red); color: #fff; }
  .nav a.nav-dispo.active { background: var(--green); box-shadow: 0 6px 18px rgba(22,163,74,.5); }
}

/* Zwei Kalender: 🚒 Feuerwehr (rot) / 🚑 RTW (weiß) */
.cal-switch { display: flex; gap: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 5px; margin: 0 0 16px; box-shadow: var(--shadow); }
.cal-switch button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 10px; padding: 11px 10px; font: inherit; font-weight: 700; font-size: 15px;
  background: transparent; color: var(--muted); cursor: pointer; }
.cal-switch .cal-ico { height: 30px; width: auto; flex: none; pointer-events: none;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,.25)); }
.cal-switch button:not(.active) .cal-ico { opacity: .55; filter: grayscale(.4); }
.cal-switch button.cal-fw.active .cal-ico { filter: drop-shadow(0 0 2px rgba(255,255,255,.9)); }
.cal-switch button.cal-fw.active { background: var(--red); color: #fff; box-shadow: 0 4px 12px rgba(185,28,28,.35); }
.cal-switch button.cal-rtw.active { background: #fff; color: #b91c1c; box-shadow: inset 0 0 0 2px #b91c1c; }
.card.cal-card-rtw { box-shadow: inset 0 4px 0 #e5e7eb, var(--shadow); }
.card.cal-card-fw { box-shadow: inset 0 4px 0 var(--red), var(--shadow); }

/* ---------- Fahrzeugstatus (wie im Statusbot) ---------- */
.veh-grid { display: flex; flex-direction: column; gap: 8px; padding: 10px; border: 2px solid var(--border);
  border-radius: 14px; background: var(--surface-2); }
.veh { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px;
  border-radius: 10px; background: #222b38; border: 1px solid #2a3340; color: #fff; }
.veh .n { font-weight: 700; color: #c9d1d9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.veh .s { font-size: 26px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.veh.s-black { background: #000; border-color: #2a2a2a; }
.veh.s-blue { background: #1f6feb; border-color: #1f6feb; }
.veh.s-blue .n { color: #dbe9ff; }
.veh.s-yellow { background: #f5c400; border-color: #f5c400; color: #111; }
.veh.s-yellow .n { color: #3a2f00; }
.veh.s-lgreen { background: #8fe388; border-color: #8fe388; color: #0d2b0b; }
.veh.s-lgreen .n { color: #1d4a19; }
.veh.s-green { background: #1e9e3a; border-color: #1e9e3a; color: #fff; }
.veh.s-green .n { color: #dcf7e2; }
.veh.s-red { background: #d62828; border-color: #d62828; color: #fff; }
.veh.s-red .n { color: #ffe0e0; }
.veh-legend .vl-row { display: flex; align-items: center; gap: 10px; padding: 5px 0; font-size: 15px; }
.veh-dot { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 8px; font-weight: 800; background: #222b38; color: #fff; }
.veh-dot.s-lgreen { background: #8fe388; color: #0d2b0b; } .veh-dot.s-green { background: #1e9e3a; }
.veh-dot.s-yellow { background: #f5c400; color: #111; } .veh-dot.s-blue { background: #1f6feb; } .veh-dot.s-red { background: #d62828; }
.veh.blink { animation: veh-blink 1s infinite; }
@keyframes veh-blink { 50% { opacity: .55; } }
.veh-foot { margin-top: 10px; font-size: 12.5px; color: var(--muted); }

/* ---------- Owner / Wartungsmodus ---------- */
.badge.owner { background: #fef3c7; color: #92400e; }
.maint-banner { background: #f59e0b; color: #111827; padding: 10px 16px; font-size: 14px; border-radius: 12px; margin: 0 0 16px; }
.maint-banner a { color: #111827; font-weight: 700; margin-left: 8px; }
.maint-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.maint-box { max-width: 420px; text-align: center; background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; padding: 32px 24px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; align-items: center; }
.maint-box h1 { margin: 4px 0 0; }
.maint-box p { margin: 0 0 8px; color: var(--muted); }
.maint-logo { width: 84px; height: 84px; border-radius: 16px; }

.tb-icon { display: none; }
.ueb-note { margin-top: 6px; padding: 8px 10px; border-radius: 8px; background: var(--surface-2); font-size: 14px; white-space: pre-wrap; }

/* ---------- Einsatzprogramm: meine Angaben ---------- */
.me-card .me-row { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); align-items: baseline; }
.me-card .me-row:first-of-type { border-top: 0; }
.me-card .k { width: 100px; flex: none; color: var(--muted); font-size: 14px; }
.me-card .v { font-weight: 600; }

/* ---------- Übungen ---------- */
.ueb { margin-bottom: 12px; border-left: 5px solid var(--border); }
.ueb.me-yes { border-left-color: var(--green); }
.ueb.me-no { border-left-color: var(--red); }
.ueb.is-off { opacity: .6; }
.ueb.is-off .ueb-date b, .ueb.is-off .ueb-title b { text-decoration: line-through; }
.ueb-head { display: flex; gap: 16px; align-items: flex-start; }
.ueb-date { flex: none; min-width: 92px; display: flex; flex-direction: column; }
.ueb-date b { font-size: 18px; }
.ueb-date span { font-size: 13px; color: var(--muted); }
.ueb-title { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ueb-title b { font-size: 16px; margin-right: 4px; }
.ueb-title .muted-sm { flex-basis: 100%; }
.badge.off { background: #fee2e2; color: #991b1b; }
.badge.cuf { background: #dbeafe; color: #1e40af; }
.ueb-count { display: flex; gap: 14px; margin: 12px 0 4px; font-weight: 600; font-size: 14px; }
.ueb-count .yes { color: var(--green); } .ueb-count .no { color: var(--red); }
.ueb-names { font-size: 13.5px; color: var(--muted); margin: 4px 0 0; }
.ueb-names summary { cursor: pointer; }
.ueb-names div { margin-top: 4px; }
.ueb-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.ueb-actions .btn { flex: 1; justify-content: center; min-width: 140px; }
.btn.btn-success { background: var(--green); border-color: var(--green); color: #fff; }
.ueb-cuf { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border); display: flex; justify-content: flex-end; }

/* ---------- Grade ---------- */
.grade-ico { flex: none; border-radius: 4px; vertical-align: middle; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.grade-tag { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; }
.grade-pick { display: flex; gap: 10px; align-items: center; }
.grade-pick select { flex: 1; }
.grade-prev { width: 44px; height: 44px; flex: none; }
td .name .grade-ico { margin-left: auto; }

/* Ungespeicherte Dispo: Speichern-Knopf blinkt rot */
#saveBtn.save-blink { background: var(--red); border-color: var(--red); color: #fff; animation: save-blink 1s ease-in-out infinite; }
@keyframes save-blink { 0%, 100% { box-shadow: 0 0 0 0 rgba(220,38,38,.7); opacity: 1; } 50% { box-shadow: 0 0 0 8px rgba(220,38,38,0); opacity: .55; } }
@media (prefers-reduced-motion: reduce) { #saveBtn.save-blink { animation-duration: 2s; } }

/* ---------- Persönliche Statistik ---------- */
:root { --ring-bg: #e5e7eb; --ring-plan: #fca5a5; }
:root[data-theme="dark"] { --ring-bg: #2a3340; --ring-plan: #7f1d1d; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --ring-bg: #2a3340; --ring-plan: #7f1d1d; } }
.seg { display: flex; gap: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 4px; margin: 0 0 12px; }
.seg button { flex: 1; border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 600; font-size: 14px; padding: 8px 4px; border-radius: 9px; cursor: pointer; }
.seg button.active { background: var(--red); color: #fff; }
.rings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.ring-box { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.ring { width: 100%; max-width: 160px; height: auto; aspect-ratio: 1; }
.ring circle { transition: stroke-dasharray .5s ease; }
.ring-v { font-size: 26px; font-weight: 800; fill: var(--text); dominant-baseline: middle; }
.ring-s { font-size: 11px; fill: var(--muted); }
.ring-leg { display: flex; flex-direction: column; align-items: flex-start; gap: 6px 14px; font-size: 13px; color: var(--muted); }
.ring-leg i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }

/* ---------- Mitglieder-Suche / Einstellungen ---------- */
.msearch { margin: 0 0 12px; }
.msearch .input { width: 100%; }
td .name small.grade-l { color: var(--text); opacity: .75; }
.settings-card .label { display: block; margin: 4px 0 6px; }
.settings-card .seg { margin-bottom: 14px; }

/* Handy: Hinweis zum Markieren, Rückmeldung beim langen Drücken */
.touch-tip { display: none; }
@media (hover: none) { .touch-tip { display: inline; } }
.wgrid.painting { outline: 2px dashed var(--green); outline-offset: 3px; border-radius: 6px; }

/* ---------- Nachricht an Mitglieder ---------- */
.pm-list { display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow: auto; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); margin-top: 8px; }
.pm-list label { display: flex; gap: 8px; align-items: center; font-size: 15px; }
#pmFunc { margin-top: 8px; }
.nopush { font-size: 12px; opacity: .7; }
#pmFunc[hidden], .pm-list[hidden] { display: none !important; }
@media (max-width: 420px) { .cal-switch button { gap: 5px; padding: 10px 6px; } .cal-switch .cal-ico { height: 24px; } }

/* ---------- SPONTAN DISPO neben jeder Überschrift ---------- */
.page-head { align-items: center; }
.spontan-btn.sm.head { display: inline-flex; align-items: center; width: auto; margin: 0; padding: 9px 15px; gap: 7px;
  font-weight: 800; font-size: 14px; color: #111827; white-space: nowrap; border: 0; border-radius: 999px;
  background: linear-gradient(135deg, #fbbf24, #f59e0b); box-shadow: 0 3px 10px rgba(245,158,11,.35); }
.spontan-btn.sm.head:hover { background: linear-gradient(135deg, #fcd34d, #fbbf24); }
.spontan-btn.sm.head.active { background: linear-gradient(135deg, #16a34a, #15803d); color: #fff; box-shadow: 0 3px 10px rgba(22,163,74,.35); }
/* ---------- Tagesansicht ---------- */
.wgrid.day { grid-template-columns: 52px 1fr; min-width: 0; }
.view-toggle { font-weight: 700; min-width: 64px; }
/* ---------- Ersteller ---------- */
.credit { text-align: center; color: var(--muted); font-size: 12.5px; margin: 18px 0 4px; }
.sidebar .credit { color: #94a3b8; margin: 10px 0 0; }
@media (max-width: 860px) { .sidebar .credit { display: none; } }
.page-head:has(> :nth-child(2):last-child.spontan-btn) { flex-wrap: nowrap; }
.page-head:has(> :nth-child(2):last-child.spontan-btn) > div:first-child { flex: 1; min-width: 0; }
/* iPhone: Bereich hinter Uhrzeit/Akku immer dunkel wie die Kopfzeile (auch im hellen Design).
   iOS färbt diesen Bereich nach dem Seiten-Hintergrund – deshalb ist body dunkel und nur der Inhalt hell. */
@media (max-width: 860px) {
  html, body { background: #111827; }
  .layout, .auth { background: var(--bg); min-height: 100vh; min-height: 100dvh; }
  body::before { content: ''; position: fixed; top: 0; left: 0; right: 0; height: env(safe-area-inset-top);
    background: #111827; z-index: 50; pointer-events: none; }
}

/* ---------- Nachrichten ---------- */
.tb-mail { position: relative; }
.unread-n { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: #dc2626; color: #fff;
  font-size: 11px; font-weight: 800; line-height: 18px; text-align: center; display: inline-block; }
.unread-n[hidden] { display: none !important; }
.tb-mail .unread-n { position: absolute; top: -2px; right: -4px; box-shadow: 0 0 0 2px #111827; }
.nav a[data-r="nachrichten"] .unread-n { margin-left: auto; }
.msg { padding: 14px 16px; margin-bottom: 10px; }
.msg.unread { border-left: 4px solid #dc2626; }
.msg.sent { opacity: .85; }
.msg-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.msg-top small { color: var(--muted); white-space: nowrap; font-size: 12.5px; }
.msg-title { display: flex; align-items: center; gap: 7px; }
.msg-dot { width: 8px; height: 8px; border-radius: 50%; background: #dc2626; flex: none; }
.msg-body { white-space: pre-line; margin-top: 6px; }
.msg-foot { display: flex; justify-content: space-between; gap: 10px; margin-top: 8px; color: var(--muted); font-size: 13px; }
.msg-link { color: var(--accent, #dc2626); font-weight: 700; text-decoration: none; }
@media (max-width: 420px) { .topbar .brand > div { display: none; } }

/* ---------- Statusbot-Meldungen (Owner) ---------- */
.feed-opt { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--border); font-size: 15px; cursor: pointer; }
.feed-opt:first-child { border-top: 0; }
.feed-opt input { width: 20px; height: 20px; accent-color: #dc2626; flex: none; }
.feed-diag { list-style: none; margin: 12px 0 10px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: 13.5px; display: grid; gap: 5px; }
.feed-diag .d-bad { color: #dc2626; font-weight: 600; }
.feed-diag .d-path { color: var(--muted); font-size: 11.5px; word-break: break-all; }
.veh-cis { margin-bottom: 14px; }
.veh-cis button { flex: 1; font-weight: 700; }
.badge.bot { background: #e0f2fe; color: #075985; }

/* ---------- Einsatz-Pop-up ---------- */
.einsatz-pop { position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,.6); display: grid; place-items: center;
  padding: calc(12px + env(safe-area-inset-top)) 12px calc(12px + env(safe-area-inset-bottom)); }
.ez-box { position: relative; width: min(640px, 100%); max-height: 100%; overflow: auto; border-radius: 18px; background: var(--surface);
  color: var(--text); box-shadow: 0 20px 70px rgba(255,0,0,.45); }
.ez-head { padding: 16px 56px 14px 18px; color: #fff; background: linear-gradient(90deg, #b4151b, #ff3b30, #b4151b); animation: ezAlarm 1s infinite; }
@keyframes ezAlarm { 50% { filter: brightness(1.25); } }
@media (prefers-reduced-motion: reduce) { .ez-head { animation: none; } }
.ez-t { font-size: 24px; font-weight: 900; letter-spacing: .04em; }
.ez-sub { font-size: 13px; opacity: .9; margin-top: 2px; }
.ez-x { position: absolute; top: 10px; right: 10px; z-index: 2; width: 40px; height: 40px; border-radius: 50%; border: 0;
  background: rgba(255,255,255,.95); color: #b4151b; font-size: 19px; font-weight: 800; cursor: pointer; }
.ez-info { padding: 12px 18px; display: grid; gap: 6px; font-size: 16px; }
.ez-map { position: relative; height: 260px; margin: 0 12px; border-radius: 12px; overflow: hidden; background: #cfd8dc; }
.ez-map img { position: absolute; width: 256px; height: 256px; max-width: none; }
.ez-map svg { position: absolute; left: 0; top: 0; }
.ez-osm { position: absolute; right: 4px; bottom: 3px; font-size: 10.5px; background: rgba(255,255,255,.85); color: #333; padding: 0 5px; border-radius: 4px; }
.ez-steps { margin: 12px 18px 16px; padding-left: 20px; display: grid; gap: 5px; font-size: 14.5px; }
.ez-steps li { display: flex; justify-content: space-between; gap: 10px; }
.ez-steps small { color: var(--muted); white-space: nowrap; }
#einsatzTest { margin-left: 6px; }
.ez-map { margin-bottom: 14px; }

/* ---------- Déngschtplang (live von deinst.cgdis.it) ---------- */
.dp-wrap { max-width: 1280px; }
.dp-updated { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); font-weight: 600; margin-top: 6px; }
.dp-live { width: 9px; height: 9px; border-radius: 50%; background: var(--green); animation: dp-pulse 2s infinite; }
.dp-live.off { background: var(--amber); animation: none; }
@keyframes dp-pulse { 0% { box-shadow: 0 0 0 0 rgba(22,163,74,.55); } 70% { box-shadow: 0 0 0 8px rgba(22,163,74,0); } 100% { box-shadow: 0 0 0 0 rgba(22,163,74,0); } }
.dp-stats { grid-template-columns: repeat(3, 1fr); }
.dp-stats .v.ok { color: var(--green); }
.dp-stats .v.bad { color: var(--red-600); }

.dp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }
.dp-grid .dp-card.wide { grid-column: 1 / -1; }
.dp-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.card.dp-card + .card.dp-card { margin-top: 0; }
.dp-card-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); position: relative; }
.dp-card-head::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--red-600); }
.dp-card.is-ok .dp-card-head::before { background: var(--green); }
.dp-veh { width: 54px; height: 36px; object-fit: contain; flex: none; }
.dp-title { flex: 1; min-width: 0; }
.dp-title strong { display: block; font-size: 16px; letter-spacing: -.01em; }
.dp-title .badges { margin-top: 3px; }
.dp-cg { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: .02em; }
.dp-state { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap;
  background: var(--red-50); color: var(--red-600); border: 1px solid rgba(220,38,38,.25); }
.dp-state::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.dp-card.is-ok .dp-state { background: var(--green-soft); color: var(--green); border-color: rgba(22,163,74,.3); }

.dp-table-wrap { overflow-x: auto; }
.dp-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.dp-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700;
  padding: 9px 10px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.dp-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.dp-table tr:last-child td { border-bottom: 0; }
.dp-table td.dp-time { width: 1%; font-weight: 700; font-variant-numeric: tabular-nums; position: relative; padding-left: 16px; }
.dp-table td.dp-time::before { content: ''; position: absolute; left: 6px; top: 50%; width: 4px; height: 60%; transform: translateY(-50%); border-radius: 4px; background: var(--red-600); opacity: .8; }
.dp-table tr.ok td.dp-time::before { background: var(--green); }
.dp-table tr.bad td { background: color-mix(in srgb, var(--red-50) 55%, transparent); }
.dp-table tr.now td { background: color-mix(in srgb, var(--green-soft) 70%, transparent); }
.dp-table tr.bad.now td { background: var(--red-50); }
.dp-table tr.now td.dp-time::after { content: 'jetzt'; margin-left: 6px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  padding: 1px 6px; border-radius: 999px; background: var(--text); color: var(--surface); vertical-align: 1px; }
.dp-table tr.past td { opacity: .45; }
.dp-empty { color: var(--muted); opacity: .6; }
.dp-me { display: inline-block; padding: 1px 7px; border-radius: 6px; background: var(--red); color: #fff; font-weight: 700; }
.dp-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 16px; font-size: 13px; color: var(--muted); }
.dp-legend span { display: inline-flex; align-items: center; gap: 6px; }
.dp-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
@media (max-width: 860px) {
  /* am Handy unten rechts neben Status – Agenda bekommt links gleich viel Platz wie Status + Plan rechts,
     damit DISPO genau in der Mitte bleibt */
  .nav { display: grid; grid-template-columns: 1fr 1fr 64px 1fr 1fr; align-items: end; }
  .nav a[data-r="uebungen"] { grid-column: span 2; }
  .nav a[data-r="dienstplan"] { order: 4; }
}
@media (max-width: 520px) {
  .dp-grid { grid-template-columns: 1fr; }
  .dp-stats { gap: 8px; }
  .dp-stats .stat { padding: 10px 12px; }
  .dp-stats .k { font-size: 10.5px; letter-spacing: .02em; }
  .dp-stats .v { font-size: 22px; }
  .dp-table { font-size: 12.5px; }
  .dp-table td, .dp-table th { padding: 7px 8px; }
  .dp-veh { width: 44px; height: 30px; }
}

/* Déngschtplang am Handy: keine Seitwärts-Wischerei – Namen brechen um, Funktion klein darüber */
@media (max-width: 700px) {
  .dp-table-wrap { overflow-x: visible; }
  .dp-table thead { display: none; }
  .dp-table, .dp-table tbody { display: block; width: 100%; }
  .dp-table tr { display: grid; grid-template-columns: 62px repeat(2, minmax(0, 1fr)); border-bottom: 1px solid var(--border); }
  .dp-table tr:last-child { border-bottom: 0; }
  .dp-table td { border-bottom: 0; white-space: normal; overflow-wrap: anywhere; min-width: 0; padding: 5px 6px; font-size: 12.5px; line-height: 1.25; }
  .dp-table td.dp-time { width: auto; grid-row: span 12; align-self: stretch; white-space: nowrap; font-size: 12px; }
  .dp-table tr.now td.dp-time::after { display: block; margin: 3px 0 0; width: fit-content; }
  .dp-table td[data-col]::before { content: attr(data-col); display: block; font-size: 10px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .04em; color: var(--muted); margin-bottom: 1px; }
  .dp-veh { width: 64px; height: 34px; }
}

/* ---------- Dashboard (Bildschirm in der Kaserne) ---------- */
.kiosk { --k-bg: #0b0f17; --k-card: #151b27; --k-line: #263043; --k-mut: #94a3b8; --k-txt: #f1f5f9;
  min-height: 100vh; min-height: 100dvh; background: radial-gradient(ellipse at top, #1a2233 0%, var(--k-bg) 60%); color: var(--k-txt);
  display: flex; flex-direction: column; font-size: clamp(14px, 1.15vw, 22px); }
.kiosk.is-plan { background: var(--bg); color: var(--text); }
.k-top { display: flex; align-items: center; gap: 1.2em; padding: .8em 1.6em; border-bottom: 1px solid var(--k-line); background: rgba(11,15,23,.85); color: var(--k-txt); }
.k-brand { display: flex; align-items: center; gap: .7em; flex: 1; min-width: 0; }
.k-brand img { width: 2.6em; height: 2.6em; border-radius: .6em; background: #fff; padding: .15em; }
.k-brand b { display: block; font-size: 1.25em; letter-spacing: -.01em; }
.k-brand span { color: var(--k-mut); font-size: .85em; }
.k-clock-s { font-size: 1.6em; font-weight: 800; font-variant-numeric: tabular-nums; }
.k-dots { display: flex; gap: .45em; }
.k-dots i { width: .7em; height: .7em; border-radius: 50%; background: var(--k-line); }
.k-dots i.on { background: var(--red, #e11d2e); box-shadow: 0 0 0 .2em rgba(225,29,46,.25); }
.k-dots i.warn { outline: 2px solid #f59e0b; }
.k-btn { background: transparent; border: 1px solid var(--k-line); color: var(--k-txt); border-radius: .6em; width: 2.4em; height: 2.4em; font-size: 1em; cursor: pointer; opacity: .55; }
.k-btn:hover { opacity: 1; }
.k-main { flex: 1; padding: 1.6em; display: flex; flex-direction: column; min-height: 0; }
.kiosk.is-plan .k-main { max-width: none; width: 100%; margin: 0; }
.k-progress { height: 4px; background: var(--k-line); }
.k-progress i { display: block; height: 100%; width: 0; background: var(--red, #e11d2e); transition: width 1s linear; }
.k-pg { flex: 1; display: flex; flex-direction: column; gap: 1.6em; animation: kIn .5s ease; }
@keyframes kIn { from { opacity: 0; transform: translateY(8px); } }
.k-empty { color: var(--k-mut); }

/* Uhr & Wetter */
.k-uhr { justify-content: center; }
.k-clock { text-align: center; }
.k-time { font-size: clamp(90px, 15vw, 300px); font-weight: 800; line-height: .95; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.k-time span { font-size: .35em; color: var(--k-mut); font-weight: 700; letter-spacing: 0; }
.k-date { font-size: clamp(22px, 2.6vw, 54px); font-weight: 600; color: #cbd5e1; margin-top: .2em; }
.k-wx { background: var(--k-card); border: 1px solid var(--k-line); border-radius: 1.2em; padding: 1.2em 1.6em; display: grid; gap: 1.2em;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.4fr); align-items: center; }
.k-wx-now { display: flex; align-items: center; gap: 1em; grid-row: span 2; }
.k-wx-ic { font-size: 5.5em; line-height: 1; }
.k-wx-t { font-size: 4.2em; font-weight: 800; line-height: 1; }
.k-wx-tx { font-size: 1.3em; font-weight: 700; margin-top: .2em; }
.k-wx-sub { color: var(--k-mut); margin-top: .5em; line-height: 1.6; }
.k-wx-hours, .k-wx-days { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: .4em; text-align: center; }
.k-wx-hours > div, .k-wx-days > div { display: flex; flex-direction: column; align-items: center; gap: .15em; padding: .5em .2em; border-radius: .8em; background: rgba(255,255,255,.03); }
.k-wx-hours span, .k-wx-days span { font-size: 1.8em; line-height: 1.2; }
.k-wx-hours small, .k-wx-days small { color: var(--k-mut); font-size: .8em; }
.k-wx-days b small { color: var(--k-mut); font-weight: 600; font-size: .85em; }
.k-veh { display: flex; flex-wrap: wrap; gap: .6em; justify-content: center; }
.veh-chip { display: inline-flex; align-items: center; gap: .5em; background: var(--k-card); border: 1px solid var(--k-line); border-radius: 999px; padding: .3em .9em .3em .3em; font-weight: 700; }
.veh-chip .veh-dot { min-width: 2em; height: 2em; font-size: .9em; }

/* Statistik */
.k-stats { display: grid; grid-template-columns: 1.3fr 1fr; gap: 1.6em; }
.k-card { background: var(--k-card); border: 1px solid var(--k-line); border-radius: 1.2em; padding: 1.4em 1.6em; display: flex; flex-direction: column; gap: 1.1em; min-width: 0; }
.k-card h2 { margin: 0; font-size: 1.5em; letter-spacing: -.01em; }
.k-big { font-size: 4.5em; font-weight: 800; line-height: 1; }
.k-big small { font-size: .3em; color: var(--k-mut); font-weight: 600; }
.k-bars { display: grid; gap: .7em; }
.k-bar { display: grid; grid-template-columns: 9em 1fr 3em; align-items: center; gap: .8em; }
.k-bar-n { display: flex; align-items: center; gap: .5em; min-width: 0; }
.k-bar-n img { width: 3.2em; height: 1.8em; object-fit: contain; }
.k-bar-t { height: 1.2em; background: rgba(255,255,255,.06); border-radius: 999px; overflow: hidden; }
.k-bar-t i { display: block; height: 100%; min-width: .3em; background: linear-gradient(90deg, #b4151b, #ff3b30); border-radius: 999px; }
.k-bar-c { text-align: right; font-size: 1.2em; }
.k-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7em; margin-top: auto; }
.k-facts > div { background: rgba(255,255,255,.04); border-radius: .8em; padding: .7em .9em; }
.k-facts small { display: block; color: var(--k-mut); font-size: .8em; text-transform: uppercase; letter-spacing: .04em; font-weight: 700; }
.k-facts b { font-size: 1.35em; }
.k-facts .ok b { color: #4ade80; } .k-facts .bad b { color: #f87171; }
.k-ring { --p: 0; width: 13em; height: 13em; margin: 0 auto; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(#22c55e calc(var(--p) * 1%), #ef4444 0); }
.k-ring > div { width: 76%; height: 76%; border-radius: 50%; background: var(--k-card); display: grid; place-content: center; text-align: center; }
.k-ring b { font-size: 3em; line-height: 1; } .k-ring small { color: var(--k-mut); }

/* Warnung (LU-Alert / Wetter) */
.k-alert { justify-content: center; }
.k-alert-box { border-radius: 1.4em; overflow: hidden; border: 3px solid #f59e0b; background: var(--k-card); }
.k-alert.lu .k-alert-box { border-color: #ef4444; }
.k-alert-h { padding: .8em 1.2em; font-size: 2.2em; font-weight: 900; background: #f59e0b; color: #111; display: flex; justify-content: space-between; align-items: baseline; gap: 1em; }
.k-alert.lu .k-alert-h { background: #ef4444; color: #fff; animation: ezAlarm 1.4s infinite; }
.k-alert-h small { font-size: .45em; font-weight: 700; opacity: .85; }
.k-alert-t { padding: 1.2em 1.4em; font-size: 1.8em; line-height: 1.45; white-space: pre-wrap; }

/* Einsatz-Fenster (25 Min.) */
.k-alarm { position: fixed; inset: 0; z-index: 300; background: #0b0f17; color: #fff; display: flex; flex-direction: column; font-size: clamp(14px, 1.15vw, 22px); }
.k-alarm .ez-x { top: 1em; right: 1em; width: 2.6em; height: 2.6em; font-size: 1.1em; opacity: .7; }
.k-al-head { padding: 1em 5em 1em 1.6em; background: linear-gradient(90deg, #b4151b, #ff3b30, #b4151b); animation: ezAlarm 1s infinite; }
.k-al-t { font-size: clamp(36px, 4.6vw, 96px); font-weight: 900; letter-spacing: .03em; line-height: 1.05; }
.k-al-sub { font-size: 1.4em; opacity: .92; margin-top: .2em; }
.k-al-body { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); gap: 1.6em; padding: 1.6em; min-height: 0; }
.k-al-info { display: flex; flex-direction: column; gap: 1.2em; font-size: 1.6em; }
.k-al-veh { display: flex; flex-wrap: wrap; gap: .6em; }
.k-al-veh span { display: inline-flex; align-items: center; gap: .5em; background: #151b27; border: 1px solid #263043; border-radius: .8em; padding: .4em .8em; }
.k-al-veh img { width: 3.6em; height: 2em; object-fit: contain; }
.k-al-adr b { font-size: 1.15em; }
.k-al-map { height: auto !important; min-height: 50vh; margin: 0 !important; border-radius: 1em; }
.k-al-body:not(:has(.k-al-map)) { grid-template-columns: 1fr; }

/* Auswahl beim Start */
.kc { align-items: center; justify-content: center; padding: 1.5em; }
.kc-box { width: min(900px, 100%); text-align: center; }
.kc-logo { width: 5em; height: 5em; border-radius: 1em; background: #fff; padding: .3em; }
.kc h1 { font-size: 2.2em; margin: .5em 0 .2em; }
.kc-box > p { color: var(--k-mut); font-size: 1.2em; margin: 0 0 1.4em; }
.kc-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2em; }
.kc-choices button { background: var(--k-card); color: var(--k-txt); border: 2px solid var(--k-line); border-radius: 1.2em; padding: 1.6em 1em; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: .3em; font: inherit; transition: border-color .15s, transform .15s; }
.kc-choices button:hover { border-color: var(--red, #e11d2e); transform: translateY(-2px); }
.kc-choices button.last { border-color: var(--red, #e11d2e); }
.kc-choices span { font-size: 3.4em; } .kc-choices b { font-size: 1.6em; } .kc-choices small { color: var(--k-mut); }
.kc-auto { color: #fbbf24 !important; font-weight: 700; margin-top: 1.2em !important; min-height: 1.4em; }
.kc-tools { display: flex; flex-wrap: wrap; justify-content: center; gap: .6em; margin-top: 1em; }
.kc-tools button { background: transparent; color: var(--k-mut); border: 1px solid var(--k-line); border-radius: 999px; padding: .45em 1em; font: inherit; font-size: .9em; cursor: pointer; }
.kc-hint { color: var(--k-mut); font-size: .85em !important; margin-top: 1.4em !important; }
@media (max-width: 900px) {
  .k-wx, .k-stats, .k-al-body, .kc-choices { grid-template-columns: 1fr; }
  .k-wx-now { grid-row: auto; }
}
.k-al-body:not(:has(.k-al-map)) .k-al-info { align-items: center; justify-content: center; text-align: center; font-size: 2.4em; }
.k-al-body:not(:has(.k-al-map)) .k-al-veh { justify-content: center; }
.k-al-wait { color: #94a3b8; font-size: .6em; }

/* Dashboard: Symbole statt Emojis */
.ki { width: 1em; height: 1em; vertical-align: -0.15em; flex: none; }
.kc-choices span .ki { width: 1em; height: 1em; color: var(--red, #e11d2e); }
.kc-tools .ki { margin-right: .2em; }
.k-btn { display: inline-grid; place-items: center; } .k-btn .ki { width: 1.1em; height: 1.1em; }
.k-card h2 .ki { color: var(--red, #e11d2e); margin-right: .2em; }
.k-wx-ic .ki { width: 1em; height: 1em; stroke-width: 1.5; }
.k-wx-hours span .ki, .k-wx-days span .ki { width: 1em; height: 1em; stroke-width: 1.8; }
.k-wx-sub { display: flex; flex-wrap: wrap; gap: .3em 1.1em; }
.k-wx-sub span { display: inline-flex; align-items: center; gap: .35em; }
.k-wx-hours small .ki, .k-wx-days small .ki { width: .95em; height: .95em; color: #60a5fa; }
.wx-sun { color: #fbbf24; } .wx-moon { color: #c7d2fe; } .wx-cloudSun { color: #fcd34d; } .wx-cloud, .wx-fog { color: #cbd5e1; }
.wx-drizzle, .wx-rain { color: #60a5fa; } .wx-snow { color: #e0f2fe; } .wx-storm { color: #facc15; } .wx-thermo { color: #f87171; }
.k-alert-h span { display: inline-flex; align-items: center; gap: .4em; }
.k-al-t .ki { width: .9em; height: .9em; vertical-align: -0.08em; }
.k-al-sub .ki { margin: 0 .2em 0 .1em; }
.k-alarm .ez-x { display: grid; place-items: center; } .k-alarm .ez-x .ki { width: 1.2em; height: 1.2em; stroke-width: 2.6; }
.k-al-adr .ki, .k-al-km .ki { color: #f87171; margin-right: .2em; }
.k-al-veh .ki { width: 1.6em; height: 1.6em; }
.k-al-wait .ki { margin-right: .3em; }
/* Permanence beim Einsatz */
.k-al-crew { display: grid; gap: .7em; font-size: .62em; width: 100%; text-align: left; }
.k-al-crew:empty { display: none; }
.k-crew-t { font-weight: 800; color: #94a3b8; text-transform: uppercase; letter-spacing: .05em; display: flex; align-items: center; gap: .4em; }
.k-crew { background: #151b27; border: 1px solid #263043; border-left: 5px solid #ef4444; border-radius: .9em; padding: .7em .9em; }
.k-crew.ok { border-left-color: #22c55e; }
.k-crew-h { display: flex; align-items: center; gap: .6em; margin-bottom: .55em; }
.k-crew-h img { width: 3.2em; height: 1.8em; object-fit: contain; }
.k-crew-h b { font-size: 1.25em; } .k-crew-h small { color: #94a3b8; flex: 1; }
.k-crew-h span { font-size: .8em; font-weight: 800; padding: .2em .7em; border-radius: 999px; background: rgba(239,68,68,.15); color: #f87171; }
.k-crew.ok .k-crew-h span { background: rgba(34,197,94,.15); color: #4ade80; }
.k-crew-g { display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5em, 1fr)); gap: .45em .8em; }
.k-crew-g small { display: block; color: #94a3b8; font-size: .72em; font-weight: 800; letter-spacing: .05em; }
.k-crew-g b { font-size: 1.05em; }
.k-al-body:not(:has(.k-al-map)) .k-al-crew { max-width: 60em; font-size: .42em; }
/* Permanence: Paare untereinander (CSec über Mach, CBin1 über Eq1, CBin2 über Eq2) */
.k-crew-g { grid-template-columns: none; grid-template-rows: repeat(2, auto); grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
/* Ersteller auf dem Dashboard */
.k-foot .credit { margin: 0; padding: .35em 1.6em .5em; text-align: right; font-size: .75em; color: var(--k-mut, #94a3b8); }
.kiosk.is-plan .k-foot .credit { color: var(--muted); }
.kc .credit { color: var(--k-mut); margin-top: 1.4em; font-size: .85em; }

/* Depesche: weitere Einsatzmittel im Dashboard-Alarm */
.k-al-units { display: flex; flex-wrap: wrap; gap: .5em; font-size: .8em; }
.k-al-units span { display: inline-flex; align-items: center; gap: .45em; background: #151b27; border: 1px solid #263043; border-radius: .7em; padding: .35em .7em; }
.k-al-units i { font-style: normal; color: #9aa4b8; }
.k-al-units .ki { width: 1.2em; height: 1.2em; color: #f87171; }
.k-al-body:not(:has(.k-al-map)) .k-al-units { justify-content: center; }
/* Depesche: Sachverhalt + Warnhinweis (Einsatztext zum Objekt) */
.ez-sv { font-weight: 700; font-size: 17px; }
.ez-warn { background: #fef3c7; color: #78350f; border: 1px solid #f59e0b; border-radius: 10px; padding: 8px 10px; font-size: 14px; line-height: 1.35; }
.k-al-sv { font-weight: 700; font-size: 1.05em; line-height: 1.25; }
.k-al-warn { display: flex; gap: .5em; align-items: flex-start; background: rgba(245, 158, 11, .14); border: 1px solid #f59e0b; color: #fde68a;
  border-radius: .6em; padding: .45em .7em; font-size: .62em; line-height: 1.35; }
.k-al-warn .ki { flex: none; width: 1.4em; height: 1.4em; color: #f59e0b; }
.k-al-body:not(:has(.k-al-map)) .k-al-warn { text-align: left; }
/* Alarm mit Depesche: rechte Spalte = Karte + weitere Einheiten, alles etwas kompakter */
.k-al-side { display: flex; flex-direction: column; gap: .8em; min-height: 0; }
.k-al-side .k-al-map { flex: 1; min-height: 0; }
.k-al-side .k-al-units { font-size: 1.05em; justify-content: flex-start; }
.k-alarm.dense .k-al-info { font-size: 1.22em; gap: .6em; overflow: hidden; }
.k-alarm.dense .k-al-veh img { width: 3em; height: 1.7em; }
.k-alarm.dense .k-al-warn { font-size: .8em; }
.k-alarm.dense .k-al-crew { font-size: .78em; }
/* Dashboard: Logo ganz leicht im Hintergrund */
.kiosk { position: relative; isolation: isolate; }
.kiosk:not(.is-plan)::before { content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: url(/logo.png) center 30% / min(54vh, 46vw) no-repeat; opacity: .22; }
/* Dashboard: News-Seite */
/* Mehrere Einsätze gleichzeitig */
.k-al-n { display: inline-flex; align-items: center; gap: .35em; background: rgba(0,0,0,.28); border-radius: 999px; padding: .1em .7em; margin-right: .6em; font-weight: 800; }
.k-al-n i { width: .55em; height: .55em; border-radius: 50%; background: rgba(255,255,255,.4); }
.k-al-n i.on { background: #fff; }
.ez-tabs { display: flex; gap: 6px; padding: 8px 56px 0 10px; background: #7f1d1d; overflow-x: auto; }
.ez-tabs button { flex: 1; min-width: 110px; border: 0; border-radius: 10px 10px 0 0; padding: 7px 10px; background: rgba(255,255,255,.14); color: #fff;
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px; cursor: pointer; font: inherit; text-align: left; }
.ez-tabs button b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.ez-tabs button small { font-size: 11px; opacity: .85; }
.ez-tabs button.on { background: #ff3b30; }

/* Ersteller oben beim Déngschtplang */
.dp-credit { font-size: 11px; color: var(--muted); white-space: nowrap; opacity: .8; }
.dp-credit b { font-weight: 600; }
.kiosk.is-plan .dp-credit { font-size: .7em; }

/* Einsatz-Timer: bis 10 Min. grün blinkend, danach rot blinkend, bei 15 Min. rot stehend */
.ez-timer { display: flex; align-items: center; justify-content: center; gap: .7em; padding: .5em 1em; background: #0b0f17; border-bottom: 1px solid rgba(255,255,255,.08); }
.ez-timer span { color: #94a3b8; font-size: .8em; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.ez-timer b { font-size: 2em; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: .02em; line-height: 1; }
.ez-timer.green b { color: #22c55e; animation: ezBlink 1s steps(1) infinite; }
.ez-timer.red b { color: #ef4444; animation: ezBlink 1s steps(1) infinite; }
.ez-timer.red.done b { animation: none; }
@keyframes ezBlink { 50% { opacity: .15; } }
.k-alarm .k-al-head { padding-right: 17em; }
.k-alarm > .ez-timer { position: absolute; top: .75em; right: 4.4em; border: 2px solid rgba(255,255,255,.25); border-radius: .8em; padding: .35em .9em; flex-direction: column; gap: .1em; z-index: 2; }
.k-alarm > .ez-timer span { font-size: .7em; }
.k-alarm > .ez-timer b { font-size: 2.4em; }

/* Wartungsmodus: Hinweis auf die WhatsApp-Gruppe */
.maint-wa { margin: 4px 0 18px; padding: 12px 14px; border-radius: 12px; background: rgba(37, 211, 102, .12); border: 1px solid rgba(37, 211, 102, .45); font-size: 14.5px; line-height: 1.5; text-align: center; }
.maint-wa b { color: #16a34a; white-space: nowrap; }
