/* Verbandbuch – Richtung „Verbandpäckchen".
   Weiß, eine Druckfarbe (Petrol), Rot nur für den Notruf. Schrift Jost (liegt lokal
   in fonts/, kein Abruf bei Dritten). Umriss-Piktogramme, gestrichelte Trennlinien
   wie die Aufreißlinie einer Verpackung, viel Weißraum. */
@font-face { font-family: "Jost"; src: url("fonts/jost-latin-wght.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap; }

:root {
  --paper: #ffffff; --ink: #0b3944; --ink-2: #3f6b76; --print: var(--brand, #0e5a6b);
  --tear: #8fb4bd; --line: #c9dde2; --alarm: #c8281e; --on-print: var(--on-brand, #ffffff);
  --font: "Jost", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --safe-top: var(--safe-area-inset-top, env(safe-area-inset-top, 0px));
  --safe-bottom: var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));
}
[data-theme="dark"] {
  --paper: #0f252b; --ink: #e6f1f3; --ink-2: #a3c3ca; --print: #1d7b8f; --on-print: #ffffff;
  --tear: #4a7480; --line: #25444d; --alarm: #d5382f;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--paper); }
html, body { margin: 0; height: 100%; color: var(--ink); font: 400 17px/1.45 var(--font); }
body { display: flex; flex-direction: column; max-width: 560px; margin: 0 auto; min-height: 100dvh; background: var(--paper); }
:focus-visible { outline: 3px solid var(--print); outline-offset: 2px; }
.i { width: 1em; height: 1em; flex: none; }
a { color: inherit; text-underline-offset: 3px; }

/* Typo */
h1 { font-size: 44px; line-height: 1; font-weight: 500; letter-spacing: -.5px; margin: 0 0 18px; }
h2 { font-size: 22px; line-height: 1.2; font-weight: 500; margin: 26px 0 10px; }
.muted { color: var(--ink-2); }
.small { font-size: 14px; }
.err { color: var(--alarm); font-size: 15px; }
[data-theme="dark"] .err { color: #f0857d; }
.lock { color: var(--ink-2); font-size: 14px; display: flex; gap: 8px; align-items: flex-start; margin: 14px 0; }
.lock .i { font-size: 18px; margin-top: 1px; }

/* Kopfzeile: Wortmarke, kein Balken */
.appbar { position: sticky; top: 0; z-index: 10; background: var(--paper);
  padding: calc(14px + var(--safe-top)) 24px 8px; display: flex; align-items: center; gap: 8px; }
.appbar .logo { color: var(--print); font-size: 22px; display: grid; }
.appbar .title { font-weight: 600; font-size: 17px; color: var(--print); }
[data-theme="dark"] .appbar .logo, [data-theme="dark"] .appbar .title { color: var(--ink); }
.appbar .spacer { flex: 1; }
.iconbtn { width: 44px; height: 44px; min-height: 0; padding: 0; background: none; color: var(--ink-2); font-size: 22px;
  display: inline-grid; place-items: center; border-radius: 999px; }
.iconbtn.sos { width: auto; height: 40px; padding: 0 16px; background: none; color: var(--alarm);
  border: 1.5px solid var(--alarm); font-size: 17px; font-weight: 600; }
[data-theme="dark"] .iconbtn.sos { color: #f0857d; border-color: #f0857d; }

main { flex: 1; padding: 14px 24px 108px; }

/* Gruppen: gestrichelter Rahmen statt Karte mit Schatten */
.card { border: 1.5px dashed var(--tear); border-radius: 16px; padding: 18px; margin-bottom: 18px; }
.card > h2:first-child { margin-top: 0; }
.card p { margin: 0 0 10px; }
.card p:last-child { margin-bottom: 0; }

/* Formulare */
label { display: block; font-size: 16px; font-weight: 500; margin: 0 0 6px; }
input, select, textarea { width: 100%; min-height: 52px; padding: 12px 14px; border-radius: 12px;
  border: 1.5px solid var(--tear); background: var(--paper); color: var(--ink); font: 400 17px/1.4 var(--font); }
textarea { min-height: 92px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid var(--print); outline-offset: 0; border-color: var(--print); }
.row { display: grid; gap: 12px; }
.row.two { grid-template-columns: 1fr 1fr; }
.check { display: flex; align-items: center; gap: 12px; font-weight: 400; font-size: 17px; }
.check input { width: 24px; height: 24px; min-height: 0; accent-color: var(--print); flex: none; }
.check.big { padding: 12px 0; border-bottom: 1px solid var(--line); margin: 0; }

button, .btn { font: 500 19px/1.2 var(--font); margin: 0; cursor: pointer; border: none; border-radius: 16px;
  min-height: 56px; padding: 12px 20px; background: var(--print); color: var(--on-print); width: 100%;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
button.ghost, .btn.ghost { background: none; color: var(--ink); border: 1.5px solid var(--print); }
[data-theme="dark"] button.ghost, [data-theme="dark"] .btn.ghost { border-color: var(--tear); }
a.btn.danger { background: var(--alarm); }
button.link { background: none; color: var(--ink-2); width: auto; min-height: 44px; padding: 8px 8px 8px 0; font-size: 17px; font-weight: 400; }
button:disabled { opacity: .5; }
.btnrow { display: flex; gap: 10px; }
.btnrow > * { flex: 1; }
.btnrow.mini { margin-top: 12px; }
.btnrow.mini button { min-height: 46px; font-size: 16px; padding: 8px 12px; border-radius: 12px; }
.back { margin: -6px 0 6px; }

/* Notruf: das einzige farbige Feld */
.plate { display: flex; align-items: center; justify-content: space-between; text-decoration: none; color: #fff;
  background: var(--alarm); border-radius: 16px; padding: 16px 24px; margin-bottom: 14px; }
.plate > span { display: flex; flex-direction: column; }
.plate-n { font-size: 60px; line-height: 1; font-weight: 600; }
.plate-k { font-size: 17px; }
.plate .i { font-size: 40px; }

/* Verzeichnis: Piktogramm ohne Kasten, Aufreißlinien */
.dirlist { border-bottom: 1.5px dashed var(--tear); margin-bottom: 18px; }
.dir { background: none; color: var(--ink); border-radius: 0; border-top: 1.5px dashed var(--tear);
  justify-content: flex-start; text-align: left; gap: 16px; padding: 10px 0; min-height: 68px; }
.dir b { display: block; font-size: 20px; line-height: 1.2; font-weight: 500; }
.dir small { display: block; font-size: 15px; line-height: 1.3; font-weight: 400; color: var(--ink-2); }
.pic { font-size: 28px; color: var(--print); display: grid; flex: none; }
[data-theme="dark"] .pic { color: var(--ink-2); }

/* Listen */
.entry { border-top: 1.5px dashed var(--tear); padding: 14px 0; }
.entry:last-of-type { border-bottom: 1.5px dashed var(--tear); }
.entry .top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.entry .name { font-weight: 500; font-size: 20px; line-height: 1.2; }
.entry .meta { color: var(--ink-2); font-size: 15px; margin-top: 2px; }
.entry .top + .meta { color: var(--ink); font-size: 17px; }
.entry p { margin: 8px 0 0; font-size: 16px; }
.li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.li:last-child { border-bottom: none; padding-bottom: 0; }
.li span { flex: 1; min-width: 40%; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0; }
.kv dt { color: var(--ink-2); font-size: 15px; }
.kv dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.steps { margin: 0; padding-left: 22px; }
.steps li { margin-bottom: 7px; }
.acc.card { border: none; border-top: 1.5px dashed var(--tear); border-radius: 0; padding: 0; margin: 0; }
.acc summary { font-size: 20px; font-weight: 500; cursor: pointer; padding: 16px 0; margin-left: 20px; }
.acc[open] { padding-bottom: 14px; }

/* Status: Punkt + Wort */
.badge, .syncchip, .entry .sync { display: inline-flex; align-items: center; gap: 7px; font: 400 14px/1.2 var(--font);
  color: var(--ink-2); white-space: nowrap; }
.badge::before, .syncchip .dot, .entry .sync .dot { content: ""; width: 9px; height: 9px; border-radius: 50%;
  background: currentColor; flex: none; }
.badge.ok, .syncchip.ok, .entry .sync.ok { color: var(--print); }
[data-theme="dark"] .badge.ok, [data-theme="dark"] .syncchip.ok, [data-theme="dark"] .entry .sync.ok { color: var(--ink-2); }
.badge.danger { color: var(--alarm); font-weight: 600; }
[data-theme="dark"] .badge.danger { color: #f0857d; }
/* „Wartet"/„fällig": offener Ring und kräftiges Wort – ohne zweite Farbe */
.badge.amber, .syncchip.wait, .syncchip.busy, .entry .sync.wait { color: var(--ink); font-weight: 600; }
.badge.amber::before, .syncchip.wait .dot, .syncchip.busy .dot, .entry .sync.wait .dot {
  background: none; border: 1.5px dashed currentColor; width: 11px; height: 11px; }
.syncchip { width: auto; min-height: 44px; padding: 0; background: none; border-radius: 0; }
.list-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }

/* Fußleiste */
.tabbar { position: fixed; bottom: 0; left: 0; right: 0; max-width: 560px; margin: 0 auto; background: var(--paper);
  border-top: 1px solid var(--line); display: flex; padding: 0 8px var(--safe-bottom); }
.tabbar button { background: none; color: var(--ink-2); border-radius: 0; min-height: 64px; padding: 6px 2px;
  flex-direction: column; gap: 2px; font-size: 14px; font-weight: 400; border-top: 2.5px solid transparent; }
.tabbar button.active { color: var(--ink); font-weight: 600; border-top-color: var(--print); }
[data-theme="dark"] .tabbar button.active { border-top-color: var(--ink); }
.tabbar .ico { font-size: 24px; line-height: 1; display: grid; }

/* Eintrags-Assistent + Körperkarte */
.wizard-steps { display: flex; gap: 6px; margin: 0 0 18px; }
.wizard-steps span { flex: 1; height: 5px; border-radius: 3px; background: var(--line); }
.wizard-steps span.done { background: var(--print); }
.step { display: none; }
.step.active { display: block; }
.wizard-nav { display: flex; gap: 10px; }
#wiz-next, #btn-save { flex: 1; }
.bodymap { display: flex; justify-content: center; padding: 6px 0 2px; }
.bodymap svg { max-width: 100%; height: auto; }
.reg { fill: var(--paper); stroke: var(--print); stroke-width: 1.5; cursor: pointer; }
[data-theme="dark"] .reg { stroke: var(--ink-2); }
.reg.sel { fill: var(--print); stroke: var(--print); }
.region-chip { text-align: center; font-size: 16px; color: var(--ink-2); margin: 8px 0 14px; }
.region-chip b { color: var(--ink); font-weight: 600; }

/* Eintrag als Schaltfläche in der Liste */
button.entry { display: block; width: 100%; min-height: 0; background: none; color: inherit; text-align: left;
  border-radius: 0; font-weight: 400; font-size: 17px; line-height: 1.45; }
.entry .meta { display: block; }

/* Eintrag als Dokument (Ansicht und Druck) */
.doc { border-top: 1.5px dashed var(--tear); padding: 16px 0; break-inside: avoid; }
.doc h2 { margin: 0 0 10px; }
.fields { margin: 0; }
.fields dt { color: var(--ink-2); font-size: 14px; margin-top: 10px; }
.fields dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.doc-head { margin: 18px 0 6px; }
.doc-head h1 { margin-bottom: 8px; }

/* Fotos am Eintrag */
.photos { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 4px 0 16px; }
.photos:empty { display: none; }
.photos img { width: 100%; display: block; border-radius: 12px; break-inside: avoid; }
input[type="file"] { padding: 10px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.sr-only:focus-visible + * , label.btn:has(+ .sr-only:focus-visible) { outline: 3px solid var(--print); outline-offset: 2px; }

/* Start-Passwort: Schrift mit unterscheidbaren Zeichen, mit einem Tipp markierbar */
.secret { font: 600 22px/1.3 ui-monospace, "SF Mono", Consolas, monospace; letter-spacing: 1px; user-select: all;
  overflow-wrap: anywhere; margin: 4px 0 12px; }
div.dir { display: flex; align-items: center; }

/* Auswertung */
.bar { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 3px 12px; padding: 7px 0; }
.bar span { grid-column: 1 / -1; font-size: 15px; }
.bar i { height: 10px; border-radius: 5px; background: var(--print); justify-self: start; }
.bar b { font-weight: 600; font-size: 15px; min-width: 2ch; text-align: right; }

@media print {
  .appbar, .tabbar, .net-banner, .toast, .no-print { display: none !important; }
  html, body { background: #fff; color: #000; }
  body { max-width: none; }
  main { padding: 0; }
  .doc { border-top: 1px solid #999; }
  .fields dt { color: #444; }
}

/* Meldungen */
.net-banner { background: var(--ink); color: var(--paper); font-size: 15px; padding: 10px 24px; }
.toast { position: fixed; left: 24px; right: 24px; bottom: calc(80px + var(--safe-bottom)); max-width: 512px; margin: 0 auto;
  background: var(--ink); color: var(--paper); padding: 14px 18px; border-radius: 16px; font-size: 16px;
  opacity: 0; transition: opacity .15s; pointer-events: none; }
.toast.show { opacity: 1; }
.fab-note { font-size: 14px; color: var(--ink-2); margin: 10px 0 0; }
.center { min-height: 60dvh; display: flex; flex-direction: column; justify-content: center; }
.hidden { display: none !important; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Last-Minute-Check: eine Frage mit drei Antworten */
.q { border-bottom: 1px solid var(--line); padding: 14px 0; }
.q p { margin: 0 0 6px; font-size: 17px; }
.opts { display: flex; flex-wrap: wrap; gap: 0 22px; }
.opts .check { min-height: 44px; }

/* Notfallplan: Plan in voller Breite, Antippen vergrößert */
.planbox { overflow: auto; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; }
.planbox img { display: block; width: 100%; cursor: zoom-in; }
.planbox img.zoom { width: 250%; max-width: none; cursor: zoom-out; }

/* Punkt am Reiter, wenn eine Frist überfällig ist */
.tabbar button { position: relative; }
.tabbar button.due::after { content: ""; position: absolute; top: 9px; left: calc(50% + 10px); width: 9px; height: 9px;
  border-radius: 50%; background: var(--print); }

/* Organigramm: Unterteams eingerückt an einer gestrichelten Linie */
.org { border-top: 1.5px dashed var(--tear); }
.org .org { margin-left: 12px; padding-left: 14px; border-left: 1.5px dashed var(--tear); border-top: 1px solid var(--line); }
.org-team { padding: 12px 0; }
.org-team .top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.org-team b { font-size: 19px; font-weight: 500; }
.org-team .meta { color: var(--ink-2); font-size: 15px; margin-top: 3px; }

/* Verwaltung: am Handy einspaltig, ab 900 px breiter und zweispaltig */
.cols > * + * { margin-top: 18px; }
@media (min-width: 900px) {
  body:has(#view-prep:not(.hidden) > #prep-body.wide) { max-width: 1040px; }
  .wide .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 40px; align-items: start; }
  .wide .cols > * + * { margin-top: 0; }
  .wide > .dirlist { display: grid; grid-template-columns: 1fr 1fr; column-gap: 40px; }
}

/* Erscheinungsbild der Firma: Logo in der Kopfzeile, Hinweis der Firma auf einer Seite */
.appbar .logo img { height: 28px; width: auto; max-width: 140px; display: block; }
.note { border-top: 1.5px dashed var(--tear); border-bottom: 1.5px dashed var(--tear); padding: 10px 0; margin: 0 0 16px; white-space: pre-line; }
.logo-preview { max-height: 56px; max-width: 220px; display: block; margin: 6px 0 10px; }
