:root {
  --bg: #E9ECE4;          /* Formulargrün-grau */
  --surface: #FFFFFF;
  --ink: #1D2620;
  --ink-2: #4E5A51;
  --line: #C6CDC1;
  --bar: #2B3A2F;         /* Feldgrün */
  --plate: #F2C230;       /* Signalgelb, Fachschild */
  --plate-ink: #1D2620;
  --ok: #2E7A47;
  --ok-bg: #E3F0E6;
  --part: #A86F00;
  --part-bg: #FBEFD3;
  --miss: #B3261E;
  --miss-bg: #F9E1DE;
  --open: #8A9388;
  --pm: #5B6BA8;
  --radius-s: 6px;
  --radius-l: 12px;
  --font: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-c: "Barlow Condensed", "Arial Narrow", "Roboto Condensed", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151A16; --surface: #1F2620; --ink: #E7EDE6; --ink-2: #A4B0A5; --line: #344036;
    --bar: #0F1410; --ok: #6CC48A; --ok-bg: #1E3325; --part: #E2AD3E; --part-bg: #3A2F14;
    --miss: #F07A6F; --miss-bg: #3D1E1B; --open: #7D877E; --pm: #9AA8E0;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; touch-action: manipulation; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.4 var(--font);
  padding-bottom: env(safe-area-inset-bottom);
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--plate); outline-offset: 2px; }
.muted { color: var(--ink-2); }
.pad { padding: 16px; }
h1, h2, h3 { font-family: var(--font-c); font-weight: 600; line-height: 1.15; margin: 0; }
h1 { font-size: 28px; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }

/* Kopfzeile */
#bar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  background: var(--bar); color: #F3F5F0;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
}
#home { font-family: var(--font-c); font-weight: 700; font-size: 20px; text-decoration: none; letter-spacing: .01em; }
#nav { margin-left: auto; display: flex; gap: 14px; font-size: 15px; }
#nav a { text-decoration: none; opacity: .85; }
#nav a:hover { opacity: 1; text-decoration: underline; }
#sync { width: 10px; height: 10px; border-radius: 50%; background: transparent; flex: none; }
#sync.on { background: #6CC48A; }
#sync.wait { background: var(--plate); }
#sync.off { background: #F07A6F; }

main { max-width: 760px; margin: 0 auto; }
.page { padding: 16px; display: grid; gap: 16px; }
.page > * { min-width: 0; }  /* Rasterspalte nicht durch breiten Inhalt aufblähen (Handy: keine waagrechte Scrollleiste) */

/* Knöpfe */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 16px; border-radius: var(--radius-s);
  border: 1.5px solid var(--ink); background: transparent; cursor: pointer;
  font-weight: 600; text-decoration: none;
}
.btn.primary { background: var(--bar); border-color: var(--bar); color: #F3F5F0; }
.btn.danger { border-color: var(--miss); color: var(--miss); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 15px; }
.btn:disabled { opacity: .45; cursor: default; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Formulare */
label.f { display: grid; gap: 4px; font-weight: 500; }
input[type=text], input[type=password], input[type=number], input[type=search], textarea, select {
  border: 1.5px solid var(--line); background: var(--surface); border-radius: var(--radius-s);
  padding: 10px 12px; min-height: 44px; width: 100%;
}
textarea { min-height: 70px; resize: vertical; }
.check { display: flex; gap: 10px; align-items: center; min-height: 40px; }
.check input { width: 22px; height: 22px; accent-color: var(--bar); }

/* Listen allgemein */
.list { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius-l); overflow: hidden; }
.list > * { background: var(--surface); padding: 14px 16px; display: block; text-decoration: none; }
.list > .row { display: flex; }  /* Zeilen mit Knöpfen (Fahrzeuge, Formationen) bleiben nebeneinander */
.list > a:hover { background: color-mix(in srgb, var(--surface) 92%, var(--ink)); }
.list .t { font-weight: 600; font-size: 17px; }
.list .s { color: var(--ink-2); font-size: 14px; margin-top: 2px; }
.empty { padding: 24px 16px; text-align: center; color: var(--ink-2); border: 1.5px dashed var(--line); border-radius: var(--radius-l); }
.empty.small { padding: 12px 16px; font-size: 14px; }
.cnt-h { font-weight: 500; font-size: 16px; }

/* M+ Kontrollschild: weiss, schwarz umrandet, wie am Fahrzeug */
.mplate {
  display: inline-flex; align-items: baseline; gap: 1px; flex: none;
  background: #fff; color: #111; border: 1.5px solid #111; border-radius: 4px;
  padding: 0 5px; font-family: var(--font-c); font-weight: 700; font-size: 15px; line-height: 1.35;
  font-variant-numeric: tabular-nums; letter-spacing: .02em;
}
.mplate i { font-style: normal; font-size: .8em; margin-right: 2px; }
.mplate.lg { font-size: 20px; padding: 0 7px; border-width: 2px; }
.vrow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.vrow > span:first-child, .vrow > h1 { min-width: 0; overflow-wrap: anywhere; }
.vrow .plus { color: var(--ink-2); font-weight: 600; }
.vrow.big h1 { margin-right: 2px; }

.stage-h { display: flex; align-items: baseline; gap: 8px; font-family: var(--font-c); font-weight: 600; font-size: 18px; margin-top: 6px; }
.stage-h > b { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--bar); color: #F3F5F0; font-size: 15px; }
.stage-h .muted { font-family: var(--font); font-weight: 500; font-size: 15px; }
.stage-tag { display: inline-block; background: var(--bar); color: #F3F5F0; border-radius: var(--radius-s); padding: 1px 8px; margin-right: 8px; font-size: 13px; font-weight: 600; vertical-align: 2px; }
.de-head { padding: 10px 16px 0; font-size: 15px; }
.tab-lbl { flex: none; align-self: center; font-family: var(--font-c); font-weight: 600; font-size: 14px; color: var(--ink-2); margin-left: 4px; }
.tab-lbl:not(:first-child) { margin-left: 6px; padding-left: 8px; border-left: 1.5px solid var(--line); }
.note { border-left: 4px solid var(--plate); background: var(--surface); padding: 10px 14px; border-radius: 0 var(--radius-s) var(--radius-s) 0; font-size: 15px; }
.note.bad { border-color: var(--miss); }

/* Statuszahlen */
.stat { display: inline-flex; align-items: baseline; gap: 4px; font-family: var(--font-c); font-weight: 600; }
.pill { display: inline-block; padding: 1px 7px; border-radius: 99px; font-size: 13px; font-weight: 600; border: 1px solid currentColor; }
.pill.ok { color: var(--ok); } .pill.miss { color: var(--miss); } .pill.open { color: var(--ink-2); } .pill.pm { color: var(--pm); }

/* ---------------- Checkliste ---------------- */
.ck-head { position: sticky; top: var(--bar-h, 48px); z-index: 15; background: var(--bg); padding: 8px 16px 6px; border-bottom: 1px solid var(--line); }
.ck-title { flex-wrap: nowrap; gap: 6px; }
.ck-title h1 { font-size: 21px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 0 1 auto; }
.ck-sub { font-size: 13px; color: var(--ink-2); display: flex; gap: 10px; align-items: baseline; margin-top: 2px; }
.ck-sub-t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; }
.ck-sub a { font-weight: 600; color: var(--ink); white-space: nowrap; }
.progress { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 6px 0 4px; display: flex; }
.progress i { display: block; height: 100%; }
.progress .p-ok { background: var(--ok); } .progress .p-miss { background: var(--miss); }
.ck-tools { display: flex; gap: 8px; align-items: center; margin-top: 4px; }
.ck-tools #cnt { margin-left: auto; font-size: 14px; white-space: nowrap; font-family: var(--font-c); font-weight: 600; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1.5px solid var(--line); background: var(--surface); border-radius: var(--radius-s);
  padding: 4px 10px; font-family: var(--font-c); font-weight: 600; font-size: 15px; cursor: pointer; white-space: nowrap;
}
.chip.done { background: var(--ok); border-color: var(--ok); color: #fff; }
.chip.with-miss { position: relative; }
.chip.with-miss::after { content: ""; position: absolute; top: -4px; right: -4px; width: 12px; height: 12px; border-radius: 50%; background: var(--miss); border: 2px solid var(--bg); }
.chip.active { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--ink); }
.chip .frac { font-weight: 500; opacity: .8; }
.seg { display: inline-flex; border: 1.5px solid var(--line); border-radius: var(--radius-s); overflow: hidden; }
.seg button { border: 0; background: var(--surface); padding: 6px 10px; font-size: 14px; cursor: pointer; }
.seg button[aria-pressed=true] { background: var(--bar); color: #F3F5F0; }

.de-tabs { display: flex; flex-wrap: wrap; gap: 8px 6px; padding: 10px 16px 0; align-items: center; }

.sec { padding: 0 12px; margin-top: 18px; scroll-margin-top: calc(var(--bar-h, 48px) + var(--head-h, 130px) + 8px); }
.sec.hidden { display: none; }
/* Fachschild: gelbes Etikett wie am Gestell */
.plate {
  display: flex; align-items: center; gap: 10px;
  background: var(--plate); color: var(--plate-ink);
  border-radius: var(--radius-s); padding: 6px 8px 6px 12px;
  box-shadow: inset 0 0 0 2px var(--plate-ink);
}
.plate.done { background: var(--ok); color: #fff; box-shadow: none; }
.mpill { display: inline-block; background: var(--miss); color: #fff; border-radius: 99px; padding: 1px 8px; margin-right: 8px; font-size: 14px; vertical-align: 2px; }
.plate .area { font-size: 12px; font-weight: 600; display: block; opacity: .8; line-height: 1.1; }
.plate .fach { font-family: var(--font-c); font-weight: 700; font-size: 22px; line-height: 1.05; }
.plate .cnt { margin-left: auto; font-family: var(--font-c); font-weight: 700; font-size: 18px; white-space: nowrap; }
.plate { flex-wrap: wrap; }
.plate > div:first-child { flex: 1 0 auto; max-width: 100%; overflow-wrap: break-word; }
.plate .btn { flex-shrink: 0; min-height: 36px; border-color: var(--plate-ink); color: var(--plate-ink); background: rgba(255,255,255,.35); font-size: 14px; padding: 0 10px; }
.sec-notes { font-size: 14px; color: var(--ink-2); margin: 6px 4px 0; }

.items { margin-top: 6px; display: grid; gap: 6px; }
.grp { background: var(--surface); border-radius: var(--radius-l); border: 1px solid var(--line); overflow: hidden; }
.grp.excluded { opacity: .55; }
.alt-bar { display: flex; gap: 6px; align-items: center; padding: 8px 10px 0; font-size: 14px; color: var(--ink-2); flex-wrap: wrap; }

.it { display: grid; grid-template-columns: 52px 1fr auto; align-items: stretch; min-height: 64px; }
.it + .it, .kids .it { border-top: 1px solid var(--line); }
.tick {
  border: 0; background: transparent; cursor: pointer; display: grid; place-items: center;
  border-right: 1px solid var(--line);
}
.tick span {
  width: 34px; height: 34px; border-radius: 50%; border: 2.5px solid var(--open);
  display: grid; place-items: center; color: transparent;
}
.tick svg { width: 20px; height: 20px; }
.st-ok .tick span { background: var(--ok); border-color: var(--ok); color: #fff; }
.st-partial .tick span { background: var(--part); border-color: var(--part); color: #fff; font-family: var(--font-c); font-weight: 700; font-size: 15px; }
.st-missing .tick span { background: var(--miss); border-color: var(--miss); color: #fff; }
.st-partial { background: var(--part-bg); }
.st-missing { background: var(--miss-bg); }

.body { padding: 9px 10px 9px 12px; cursor: pointer; min-width: 0; }
.qd { display: block; }
.q { font-family: var(--font-c); font-weight: 700; font-size: 21px; line-height: 1; white-space: nowrap; margin-right: 6px; }
.q small { font-size: 13px; font-weight: 600; }
.d { font-size: 15px; line-height: 1.3; overflow-wrap: anywhere; }
.m { font-size: 12.5px; color: var(--ink-2); margin-top: 3px; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.m .pill { font-size: 11.5px; padding: 0 6px; }
.who { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; }
.who b { color: var(--ink); }
.more {
  border: 0; border-left: 1px solid var(--line); background: transparent; cursor: pointer;
  width: 48px; font-family: var(--font-c); font-weight: 700; font-size: 22px; color: var(--ink-2);
}

.edit { grid-column: 1 / -1; border-top: 1px dashed var(--line); padding: 12px; display: grid; gap: 10px; background: var(--surface); }
.stepper { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.stepper .n { width: 84px; text-align: center; font-family: var(--font-c); font-weight: 700; font-size: 24px; padding: 4px; }
.stepper .pm-btn { width: 52px; min-height: 52px; font-size: 26px; padding: 0; }
.stepper .of { font-family: var(--font-c); font-weight: 600; font-size: 18px; color: var(--ink-2); }

.kids { background: color-mix(in srgb, var(--surface) 94%, var(--ink)); }
.kids .it { grid-template-columns: 44px 1fr auto; min-height: 54px; }
.kids .tick span { width: 28px; height: 28px; }
.kids .tick svg { width: 16px; height: 16px; }
.kids .q { font-size: 18px; }
.kids .d { font-size: 14px; }
.lvl-2 .body { padding-left: 26px; } .lvl-3 .body { padding-left: 40px; }
.kids { border-top: 1px solid var(--line); }
.kids .it:first-child { border-top: 0; }
.list > .de-row { border-left: 6px solid transparent; }
.list > .de-row.de-done { border-left-color: var(--ok); background: var(--ok-bg); }

.de-row .t { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.de-frac { font-family: var(--font-c); font-weight: 600; font-size: 16px; color: var(--ink-2); white-space: nowrap; }
.de-done .de-frac { color: var(--ok); } .de-frac .m { color: var(--miss); }
.st-na { opacity: .5; }
.st-na .tick span { border-style: dashed; }
.tick:disabled { cursor: default; }
.it.flash { animation: flash 1.2s ease-out; }
@keyframes flash { 0%, 30% { box-shadow: inset 0 0 0 3px var(--plate); } 100% { box-shadow: inset 0 0 0 3px transparent; } }

.endnav { display: grid; gap: 10px; padding-bottom: calc(48px + env(safe-area-inset-bottom)); margin-top: 8px; }
.end-status { font-family: var(--font-c); font-weight: 600; font-size: 18px; text-align: center; color: var(--ink-2); }
.end-status.done { color: var(--ok); }
.btn.big { min-height: 64px; flex-direction: column; gap: 0; font-size: 18px; }
.btn.big small { font-weight: 500; font-size: 13px; opacity: .8; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Bericht */
table.rep { width: 100%; border-collapse: collapse; background: var(--surface); font-size: 14px; }
table.rep th, table.rep td { padding: 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.rep td.n { text-align: right; white-space: nowrap; font-family: var(--font-c); font-weight: 600; font-size: 16px; }
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-l); }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); padding: 10px 12px; }
.kpi b { display: block; font-family: var(--font-c); font-size: 30px; line-height: 1; white-space: nowrap; }
.kpi span { font-size: 13px; color: var(--ink-2); }
.kpi.bad b { color: var(--miss); }

/* Verwaltung: DE-Vorschau */
.prev-item { font-size: 14px; padding: 4px 0; border-bottom: 1px solid var(--line); }
.drop { border: 2px dashed var(--line); border-radius: var(--radius-l); padding: 22px; text-align: center; background: var(--surface); }
.drop.over { border-color: var(--bar); }

#toast {
  position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: var(--radius-s);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: 90vw; z-index: 50;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (min-width: 640px) {
  .sec { padding: 0 16px; }
  .d { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) { #toast { transition: none; } .it.flash { animation: none; outline: 3px solid var(--plate); } }

/* ---------------- Verschiebungen ---------------- */
.linkbtn { border: 0; background: none; padding: 4px 0; color: var(--ink); text-decoration: underline; cursor: pointer; font-size: 14px; font-weight: 500; }
.mv-item { display: flex !important; align-items: center; gap: 10px; }
.mv-item .mv-main { flex: 1; min-width: 0; text-decoration: none; }
.vp-list { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius-l); overflow: auto; max-height: 46vh; }
.vp-row { display: grid; grid-template-columns: 26px 1fr; gap: 0 8px; align-items: center; background: var(--surface); padding: 9px 12px; cursor: pointer; }
.vp-row input { width: 20px; height: 20px; accent-color: var(--bar); }
.vp-row .vp-s { grid-column: 2; font-size: 13px; }
.vp-row[hidden] { display: none; }

/* Fahrer */
.pick-v { display: grid !important; gap: 2px; width: 100%; text-align: left; border: 0; cursor: pointer; font: inherit; }
.pick-v:disabled { opacity: .5; cursor: default; }
.drive-card > * { min-width: 0; }
.drive-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); padding: 16px; display: grid; gap: 12px; }
.btn.big.depart { min-height: 96px; font-size: 26px; font-family: var(--font-c); letter-spacing: .02em; }
.btn.big.arrive { min-height: 80px; font-size: 24px; font-family: var(--font-c); border-width: 2.5px; }
.btn.big.depart small, .btn.big.arrive small { font-family: var(--font); font-size: 14px; white-space: normal; }
.tr-st { border-radius: var(--radius-s); padding: 10px 12px; font-weight: 600; font-size: 15px; }
.tr-st.ok { background: var(--ok-bg); color: var(--ok); }
.tr-st.wait { background: var(--part-bg); color: var(--part); }
.tr-st.bad { background: var(--miss-bg); color: var(--miss); }
.setup { padding: 12px 14px; }
.setup ol { margin: 10px 0; padding-left: 22px; display: grid; gap: 10px; }
.setup code, .dlg code { font-size: 12.5px; background: var(--bg); padding: 1px 4px; border-radius: 3px; overflow-wrap: anywhere; }

/* Dialog */
.dlg { border: 0; border-radius: var(--radius-l); padding: 18px; width: min(460px, calc(100vw - 32px)); max-height: calc(100vh - 32px);
  background: var(--surface); color: var(--ink); box-shadow: 0 10px 40px rgba(0,0,0,.35); }
.dlg::backdrop { background: rgba(15, 20, 16, .55); }
.dlg-x { position: absolute; top: 6px; right: 6px; margin: 0; }
.dlg-x button { border: 0; background: none; font-size: 28px; line-height: 1; width: 40px; height: 40px; cursor: pointer; color: var(--ink-2); }
.dlg h2 { padding-right: 36px; }
.qr { background: #fff; padding: 10px; border-radius: var(--radius-s); width: min(300px, 100%); margin: 0 auto; }
.qr svg { display: block; width: 100%; height: auto; }

/* Lage */
body.wide main { max-width: none; }
.lage { display: flex; flex-direction: column; height: calc(100dvh - var(--bar-h, 48px)); }
.lage-head { display: flex; gap: 10px 16px; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; padding: 8px 16px; border-bottom: 1px solid var(--line); }
.lage-head h1 { font-size: 24px; }
.lage-head .lh-t { min-width: 0; }
.lage-head .lh-t .muted { font-size: 14px; }
.lage-head .lh-t a { font-size: 13px; }
.lh-b .btn[aria-pressed=true] { background: var(--plate); border-color: var(--plate-ink); color: var(--plate-ink); }
.lage-alert { display: flex; gap: 10px; align-items: center; padding: 10px 16px; font-size: 17px; background: var(--plate); color: var(--plate-ink); }
.lage-alert[hidden] { display: none; }
.lage-alert.last { background: var(--ok); color: #fff; }
.lage-alert.alarm { background: var(--miss); color: #fff; }
.lage-alert .la-t { font-family: var(--font-c); font-weight: 700; font-size: 20px; }
.lage-alert b { flex: 1; }
.lage-alert button { border: 0; background: none; color: inherit; font-size: 26px; cursor: pointer; width: 36px; }
.lage-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr minmax(320px, 400px); }
#map { min-height: 300px; background: #dfe3da; z-index: 0; }
#map.placing, #map.placing .leaflet-interactive { cursor: crosshair; }
.lage-side { overflow: auto; padding: 12px; border-left: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.lage-side > * { flex: none; }
.ltabs { display: flex; width: 100%; }
.ltabs button { flex: 1; font-weight: 600; }
.ltabs button span { font-weight: 500; opacity: .75; }
@media (max-width: 820px) {
  .lage { height: auto; }
  .lage-body { grid-template-columns: 1fr; }
  #map { height: 52vh; }
  .lage-side { border-left: 0; padding: 12px 16px 40px; }
}

.vlist, .cplist, .evlist { display: grid; gap: 6px; }
.vcard { display: grid; grid-template-columns: 6px 1fr; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-s); overflow: hidden; cursor: pointer; }
.vcard .sw { width: 6px; }
.vc-b { padding: 8px 10px; min-width: 0; }
.vc-b .vrow b { font-size: 16px; }
.vc-b .s { font-size: 13.5px; color: var(--ink-2); margin-top: 1px; }
.vc-b .s .bad { color: var(--miss); font-weight: 600; }
.vc-a { display: flex; gap: 12px; }
.vc-a:empty { display: none; }
.vcard.dropped, .vcard.arrived { opacity: .7; }
.vcard.stale { border-color: var(--miss); }
.st { margin-left: auto; font-size: 12px; font-weight: 600; padding: 1px 7px; border-radius: 99px; border: 1px solid currentColor; white-space: nowrap; }
.st-moving { color: var(--ok); } .st-waiting { color: var(--ink-2); } .st-arrived { color: var(--pm); } .st-dropped { color: var(--miss); }
.sw { display: inline-block; flex: none; }

.cpcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-s); overflow: hidden; }
.cp-h { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; cursor: pointer; font: inherit; }
.cpb { flex: none; display: inline-grid; place-items: center; min-width: 34px; height: 30px; padding: 0 6px; border-radius: var(--radius-s);
  background: var(--plate); color: var(--plate-ink); box-shadow: inset 0 0 0 2px var(--plate-ink); font-family: var(--font-c); font-weight: 700; font-size: 17px; }
.cpcard.done .cpb { background: var(--ok); color: #fff; box-shadow: none; }
.cp-n { display: grid; min-width: 0; }
.cp-n .s { font-size: 13.5px; color: var(--ink-2); }
.cp-body { padding: 4px 10px 10px; border-top: 1px solid var(--line); }
.cp-v { display: flex; gap: 8px; align-items: center; padding: 5px 0; font-size: 14.5px; }
.cp-v .sw { width: 10px; height: 10px; border-radius: 50%; }
.cp-v .cp-t { margin-left: auto; font-family: var(--font-c); font-weight: 600; font-size: 16px; }
.cp-v.dim { opacity: .5; }
.cp-v + .cp-v { border-top: 1px solid var(--line); }

.ev { display: flex; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--plate); border-radius: var(--radius-s); padding: 8px 10px; font-size: 14.5px; }
.ev.last { border-left-color: var(--ok); }
.ev.alarm { border-left-color: var(--miss); }
.ev.first_void, .ev.last_void { opacity: .55; text-decoration: line-through; }
.ev.quiet { border-left-color: var(--line); }
.ev-t { font-family: var(--font-c); font-weight: 700; font-size: 16px; flex: none; }

/* Kartensymbole */
.vm { display: inline-flex; align-items: center; gap: 0; transform: translate(0, 0); white-space: nowrap; pointer-events: auto; }
.vm::before { content: ""; width: 14px; height: 14px; border-radius: 50%; background: var(--c); border: 2.5px solid #fff; box-shadow: 0 0 0 1.5px var(--c), 0 1px 4px rgba(0,0,0,.4); flex: none; }
.vm span { margin-left: 4px; background: var(--c); color: #fff; font: 600 12.5px/1.3 var(--font); padding: 1px 6px; border-radius: 4px; box-shadow: 0 1px 3px rgba(0,0,0,.35); }
.vm.stale::before { background: #fff; border-color: #6b736c; box-shadow: 0 0 0 1.5px #6b736c, 0 1px 4px rgba(0,0,0,.4); }
.vm.stale span { background: #6b736c; }
.vm.arrived span, .vm.dropped span { opacity: .65; }
.cpm { position: relative; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; background: var(--plate); color: #1D2620; border: 2px solid #1D2620;
  border-radius: 6px; padding: 1px 6px; font: 700 14px/1.25 var(--font-c); box-shadow: 0 1px 4px rgba(0,0,0,.35);
  transform: translate(-50%, calc(-100% - 9px)); }
.cpm::after { content: ""; position: absolute; left: 50%; bottom: -9px; margin-left: -6px; border: 6px solid transparent; border-top: 7px solid #1D2620; border-bottom: 0; }
.cpm.done::after { border-top-color: #fff; }
.cpm span { font-weight: 600; }
.cpm i { font-style: normal; font-weight: 600; opacity: .8; padding-left: 4px; border-left: 1.5px solid currentColor; }
.cpm.done { background: #2E7A47; color: #fff; border-color: #fff; }
.cpm.part { background: #FCE9A6; }
.cpm.drag { outline: 3px solid #D7263D; cursor: move; }
.cp-form { display: grid; gap: 8px; font: 15px var(--font); color: #1D2620; }
.cp-form input, .cp-form select { min-height: 40px; padding: 6px 10px; background: #fff; color: #1D2620; }
.leaflet-container { font-family: var(--font); }

@media (max-width: 560px) {
  #home { display: none; }
  #nav { margin-left: 0; gap: 16px; font-size: 15px; }
}
@media (max-width: 380px) { #bar { padding-left: 12px; padding-right: 12px; } #nav { gap: 12px; font-size: 14px; } }

/* ---------------- Route ---------------- */
.re-wrap { display: grid; gap: 10px; }
.re-map { height: 340px; border-radius: var(--radius-l); border: 1px solid var(--line); background: #dfe3da; z-index: 0; }
@media (min-width: 760px) { .re-wrap { grid-template-columns: 1fr 300px; } .re-map { height: 420px; } }
.re { display: grid; gap: 8px; }
.re-f { display: flex; align-items: center; gap: 8px; }
.re-s { position: relative; flex: 1; min-width: 0; }
.re-res { position: absolute; left: 0; right: 0; top: calc(100% + 2px); z-index: 1100; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-s); box-shadow: 0 6px 20px rgba(0,0,0,.18); max-height: 280px; overflow: auto; }
.re-res[hidden] { display: none; }
.re-res button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 9px 12px; cursor: pointer; font: inherit; font-size: 15px; }
.re-res button + button { border-top: 1px solid var(--line); }
.re-res button:hover, .re-res button:focus { background: var(--bg); }
.re-res small { display: block; color: var(--ink-2); font-size: 12.5px; }
.re-res .muted { padding: 9px 12px; font-size: 14px; }
.re-via { display: flex; align-items: center; gap: 8px; padding-left: 4px; font-size: 14px; color: var(--ink-2); }
.re-via span:nth-child(2) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.re-via .linkbtn { font-size: 20px; text-decoration: none; padding: 0 8px; }
.re-sum { font-size: 17px; font-family: var(--font-c); font-weight: 600; min-height: 24px; }
.re-sum.bad { color: var(--miss); font-family: var(--font); font-size: 15px; }
.re-alts { display: flex; flex-wrap: wrap; gap: 6px; }
.re-alts:empty { display: none; }
.re-more summary { cursor: pointer; font-size: 14px; color: var(--ink-2); }
.re-n { width: 110px; font-size: 14px; }
.re-help { font-size: 13px; margin: 0; }
.re-tools .btn { flex: none; }
.re-mode { font-family: var(--font-c); font-size: 17px; margin-right: 4px; }
.re-pop { display: grid; gap: 6px; }
.rwp { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; border: 2.5px solid #fff; color: #fff;
  font: 700 14px/1 var(--font-c); box-shadow: 0 1px 5px rgba(0,0,0,.45); cursor: grab; }
.rwp.s { background: #2E7A47; }
.rwp.z { background: #1D2620; }
.rwp.v { width: 16px; height: 16px; background: #fff; border: 3px solid #1B6FB5; margin: 5px; }
.rwp.ghost { width: 16px; height: 16px; background: #fff; border: 3px solid #1B6FB5; opacity: .9; }
.rwp.sm { flex: none; width: 24px; height: 24px; font-size: 13px; cursor: default; box-shadow: none; }
.rwp.v.sm { width: 14px; height: 14px; margin: 0 5px; }

/* Lage ohne Verwaltung: nur Karte */
.lage.simple { height: calc(100dvh - var(--bar-h, 48px)); }
.lage.simple .lage-body { grid-template-columns: 1fr; }
.lage.simple #map { height: auto; min-height: 260px; }

/* ---------------- Marschachsen ---------------- */
.list-link { display: grid; gap: 2px; padding: 14px 16px; text-decoration: none; }
.list-link span { font-size: 14px; }
.lh-code { font-family: var(--font); font-size: 14px; vertical-align: middle; }
.msec { display: grid; gap: 8px; }
.msec h2 { font-size: 20px; }
.axlist { display: flex; flex-wrap: wrap; gap: 6px; }
.axchip { display: inline-flex; align-items: center; gap: 6px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 99px; padding: 3px 10px 3px 6px; font: 600 14px/1.3 var(--font); cursor: pointer; }
.axchip i { width: 12px; height: 12px; border-radius: 50%; background: var(--c); flex: none; }
.axchip small { font-weight: 500; color: var(--ink-2); }
.axchip[aria-pressed=false] { opacity: .45; }
.axchip[aria-pressed=false] i { background: transparent; border: 2px solid var(--c); }
.axchip.static { cursor: default; }
.axchip.on { border-color: var(--c); cursor: default; padding-right: 4px; }
.axchip.on button { border: 0; background: none; font-size: 18px; line-height: 1; padding: 0 4px; cursor: pointer; color: var(--ink-2); }
.axseq { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.axseq select { min-height: 36px; padding: 4px 8px; width: auto; flex: 1; min-width: 150px; }
.axarr { color: var(--ink-2); font-weight: 600; }
.axd { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; font-size: 13px; white-space: nowrap; }
.axd::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.mform { display: grid; gap: 10px; }
.mform h3 { font-size: 18px; margin-top: 6px; }
.row2 { display: grid; grid-template-columns: 1fr 110px; gap: 10px; }
.mfix { font-weight: 600; padding: 6px 0; }
.pplist { border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface); overflow: hidden; }
.pph { display: flex; justify-content: space-between; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: 14px; }
.ppr { display: grid; grid-template-columns: 26px auto 1fr; gap: 2px 8px; align-items: baseline; padding: 6px 10px; font-size: 14.5px; }
.ppr + .ppr { border-top: 1px solid var(--line); }
.ppn { color: var(--ink-2); font-family: var(--font-c); font-weight: 600; text-align: right; }
.ppo { min-width: 0; overflow-wrap: anywhere; }
.ppa { grid-column: 2 / -1; display: flex; gap: 8px; flex-wrap: wrap; }
.pp-pop { font: 14.5px/1.4 var(--font); color: #1D2620; display: grid; gap: 3px; min-width: 180px; }
.pp-pop .btn { min-height: 34px; padding: 0 10px; }
/* Passierpunkt auf der Karte: farbiger Punkt, Nummer ab Zoom 11 */
.ppm { position: relative; width: 16px; height: 16px; }
.ppm i { position: absolute; inset: 0; border-radius: 50%; border: 2.5px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.45), 0 1px 3px rgba(0,0,0,.35); }
.ppm.multi i { inset: -3px; border-width: 3px; box-shadow: 0 0 0 1.5px #1D2620, 0 1px 3px rgba(0,0,0,.4); }
.ppm span { display: none; position: absolute; left: 20px; top: -3px; white-space: nowrap; background: rgba(255,255,255,.92); color: #1D2620;
  font: 700 12.5px/1.3 var(--font-c); padding: 0 4px; border-radius: 3px; box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.pp-labels .ppm span, .ppm.on span { display: block; }
.ppm.dim { opacity: .5; }
.ppm.on i { box-shadow: 0 0 0 2.5px #1D2620, 0 1px 4px rgba(0,0,0,.45); }
.ppm em { position: absolute; left: -9px; top: -13px; min-width: 16px; height: 16px; border-radius: 8px; background: #1D2620; color: #fff;
  font: 700 11px/16px var(--font); text-align: center; font-style: normal; padding: 0 3px; }

/* Fahrer-Ansicht mit Karte */
.drive-page { gap: 12px; }
.drive-card.join { gap: 8px; }
.drive-map { height: 58vh; min-height: 300px; border-radius: var(--radius-l); border: 1px solid var(--line); background: #dfe3da; z-index: 0; }
.cpm.sm { font-size: 12.5px; padding: 0 5px; border-width: 1.5px; }
.vm.mine::before { width: 18px; height: 18px; border-width: 3px; }
.vm.mine span { font-size: 14px; }
.vchoose { display: grid; gap: 8px; margin-top: 8px; max-height: 70vh; overflow: auto; }
.vc-h { font-weight: 600; font-size: 14px; color: var(--ink-2); margin-top: 4px; }
.vchoose .pick-v[hidden] { display: none !important; }
.ev.mail { border-left-color: var(--pm); }
.ev.mail.sent { border-left-color: var(--ok); }
.ev.mail.failed { border-left-color: var(--miss); }
.pplink { border-top: 1px dashed var(--line); padding: 3px 10px 3px 44px; font-size: 13px; color: var(--ink-2); font-style: italic; }
.pplink + .ppr { border-top: 0; }
/* Routen-Editor: Punkte von Hand */
.ppr.ed { grid-template-columns: 26px auto 1fr auto; }
.ppr.ed .ppa { grid-column: 2 / -1; }
.ppb { display: flex; gap: 2px; }
.ppb button { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 6px; min-width: 30px; height: 30px;
  font: 600 15px/1 var(--font); cursor: pointer; }
.ppin { font: 700 14.5px var(--font); padding: 3px 6px; min-height: 30px; width: 100%; min-width: 80px; }
.ppm.custom i { background: #1D2620; border-radius: 3px; transform: rotate(45deg); }
#map.placing .ppm { pointer-events: none; }
.row2.r3 { grid-template-columns: 1fr 120px; }
.mcalc { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface); padding: 10px; }
.mcalc div { display: grid; gap: 2px; min-width: 0; }
.mcalc span { font-size: 13px; }
.mcalc b { font-size: 17px; }
.ppt { display: grid; text-align: right; font-weight: 700; font-size: 14px; margin-right: 6px; white-space: nowrap; }
.ppt small { font-weight: 500; color: var(--ink-2); font-size: 12px; }
/* Punkte der Marschachse des zuletzt gewählten Punkts */
.ppm.hl { transform: scale(1.3); }
.ppm.hl i { box-shadow: 0 0 0 3px #fff, 0 0 0 5px rgba(29,38,32,.6), 0 2px 6px rgba(0,0,0,.45); }
.ppm.hl span { display: block; }

/* Unter-DEs */
.list > .de-row.de-sub { margin-left: calc(var(--depth, 1) * 18px); }
.de-from { font-size: 14px; color: var(--ink-2); margin-top: 2px; }
.lnk { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-decoration: underline; cursor: pointer; }
.chip.sub { font-weight: 500; }
.chip.off { opacity: .45; text-decoration: line-through; }
.pill-link { cursor: pointer; background: none; font-family: inherit; }

/* Unter-DE inline unter dem Artikel, der darauf verweist */
.subde { margin: 6px 0 10px 18px; border-left: 4px solid var(--line); border-radius: 0 var(--radius-s) var(--radius-s) 0; }
.subde.done { border-left-color: var(--ok); }
.subde.with-miss { border-left-color: var(--miss); }
.subde.off { opacity: .6; }
.subde-h { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--surface); font-size: 14px; }
.subde-h > div { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.subde-h .cnt { font-weight: 700; white-space: nowrap; }
.subde-sec { padding: 8px 10px 2px; font-size: 12.5px; font-weight: 700; letter-spacing: .02em; color: var(--ink-2); text-transform: uppercase; }
.subde-b > .grp { margin-top: 4px; }

.subde-h .btn { flex-shrink: 0; }

/* Orte im Unter-DE: Gestell-Übersicht, Tablar, Platz */
.subde-h .fold { border: 0; background: none; font-size: 18px; width: 28px; height: 28px; padding: 0; cursor: pointer; color: var(--ink); }
.subde-h [data-fold] { cursor: pointer; }
.subde.folded .subde-h { border-radius: 0 var(--radius-s) var(--radius-s) 0; }
.lplan { display: grid; gap: 6px; padding: 10px; background: var(--surface); border-top: 1px solid var(--line); }
.lrow { display: grid; grid-template-columns: 78px 1fr; gap: 6px; align-items: center; }
.lrow-h { font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.lcells { display: flex; flex-wrap: wrap; gap: 5px; }
.lcell { display: grid; justify-items: center; min-width: 52px; padding: 4px 6px; border: 2px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); cursor: pointer; font: inherit; line-height: 1.1; }
.lcell b { font-family: var(--font-c); font-size: 17px; }
.lcell small { font-size: 11px; opacity: .8; }
.lcell.done { background: var(--ok); border-color: var(--ok); color: #fff; }
.lcell.with-miss { background: var(--miss-bg, #f6d9d6); border-color: var(--miss); color: var(--ink); }
.lgrp { margin-top: 10px; }
.lgrp-h { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: var(--plate-ink, #1c2a1f); color: #fff; font-family: var(--font-c); font-weight: 700; font-size: 18px; border-radius: 6px 6px 0 0; }
.lgrp-h .cnt { margin-left: auto; font-size: 15px; }
.lgrp-h.done { background: var(--ok); }
.loc { scroll-margin-top: calc(var(--head-h, 160px) + 8px); }
.loc-h { display: flex; align-items: center; gap: 8px; margin-top: 8px; padding: 4px 6px 4px 10px; border-left: 5px solid var(--plate); background: var(--surface); }
.loc-h .loc-n { font-family: var(--font-c); font-weight: 700; font-size: 20px; }
.loc-h.loose .loc-n { font-size: 15px; font-weight: 600; color: var(--ink-2); }
.loc-h .cnt { margin-left: auto; font-weight: 700; white-space: nowrap; }
.loc-h .btn { flex-shrink: 0; }
.loc-h.done { border-left-color: var(--ok); }
.loc-h.with-miss { border-left-color: var(--miss); }
.loc.flash > .loc-h { animation: flash 1.2s; }
.subde { scroll-margin-top: calc(var(--head-h, 160px) + 8px); }

/* Verschiebungen: Anfragen, Eintritt/Austritt, Grundeinstellung der Achsen */
.badge { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px;
  background: var(--miss); color: #fff; font: 700 13px var(--font); vertical-align: 2px; }
.ppr.end { background: color-mix(in srgb, var(--surface) 94%, var(--ink)); grid-template-columns: 26px auto 1fr auto; }
.ppe { font-weight: 600; font-size: 13px; color: var(--ink-2); text-transform: uppercase; letter-spacing: .03em; }
.ppb button[aria-pressed="true"] { background: var(--bar); color: #fff; border-color: var(--bar); }
.ppm.drag i { cursor: grab; box-shadow: 0 0 0 2px #fff, 0 0 0 4px #1D2620; }
.via { width: 18px; height: 18px; border-radius: 4px; background: #fff; border: 3px solid var(--c, #1B6FB5); transform: rotate(45deg);
  box-shadow: 0 1px 3px rgba(0,0,0,.4); cursor: grab; }
/* Fahrer-App und Routenkarte */
.vm.stopped span, .vm.waiting span { opacity: .75; }
.vm.stale::before { background: #c9cec8; }
.cpm.role { background: #1D2620; color: #fff; }
.vcard.stopped { opacity: .8; }
#zown { min-height: 36px; max-width: 220px; }
.fleet .pick-v .s { color: var(--ink-2); font-size: 13.5px; }
/* Meldungen der Fahrer */
.rpm { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.rpm b { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; background: #E36414; color: #fff;
  border: 2px solid #fff; box-shadow: 0 0 0 1.5px #E36414, 0 1px 4px rgba(0,0,0,.45); font: 700 13px var(--font); }
.rpm span { display: none; background: rgba(255,255,255,.95); color: #1D2620; font: 600 12px var(--font); padding: 1px 5px; border-radius: 4px; box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.pp-labels .rpm span, .rpm.neu span, .rpm.hl span { display: block; }
.rpm.k-unfall b, .rpm.k-blockade b { background: #B3261E; box-shadow: 0 0 0 1.5px #B3261E, 0 1px 4px rgba(0,0,0,.45); }
.rpm.k-natur b { background: #6A994E; box-shadow: 0 0 0 1.5px #6A994E, 0 1px 4px rgba(0,0,0,.45); }
.rpm.k-freitext b { background: #1B6FB5; box-shadow: 0 0 0 1.5px #1B6FB5, 0 1px 4px rgba(0,0,0,.45); }
.rpm.neu b { border-style: dashed; outline: 2px dashed #B3261E; outline-offset: 2px; }
.rpm.hl b { outline: 3px solid #FFD400; outline-offset: 1px; }
.rp-pop { display: grid; gap: 2px; min-width: 180px; }
.rp-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.rp-btn { min-height: 76px; font-size: 16px; padding: 0 6px; white-space: normal; overflow-wrap: anywhere; hyphens: auto; }
.rp-btn b { font: 700 20px var(--font-c); }
@media (max-width: 380px) { .rp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.drive-mapwrap { position: relative; }
.drive-hint { position: absolute; z-index: 600; left: 8px; right: 8px; top: 8px; display: flex; gap: 8px; align-items: center;
  background: #FFF4C2; color: #1D2620; border: 2px solid #E2A400; border-radius: var(--radius-s); padding: 8px 10px; font-weight: 600; box-shadow: 0 2px 8px rgba(0,0,0,.3); }
.drive-hint[hidden] { display: none; }
.drive-hint span { flex: 1; }
.drive-hint button { border: 0; background: none; font-size: 20px; cursor: pointer; }
/* Übersicht VT: Warnungen */
.vm.warn::before { box-shadow: 0 0 0 3px #B3261E, 0 0 0 6px rgba(179, 38, 30, .35), 0 1px 4px rgba(0,0,0,.4); }
.vm.warn span { background: #B3261E; }
.list > .warnrow { border-left: 5px solid var(--miss); background: var(--miss-bg, #fdecea); }
