/* „Wie ging das?“ – Familien-Handbuch im Schulheft-Stil
 * Papier mit feinem Karo · Königsblau als Tinte · Textmarker-Gelb als einzige laute Farbe · Signalrot nur für Notfall
 * Überschriften: Schola (Schulbuch-Antiqua, eingebettet in schrift.css) · Text: Systemschrift */
:root {
  --papier: #f5f7fb;
  --karo: #e3e9f3;
  --blatt: #ffffff;
  --blatt2: #eef2f8;
  --linie: #d9e0ec;
  --text: #1c2233;
  --leise: #5d6679;
  --tinte: #2442c4;
  --tinte-dunkel: #1a2f8f;
  --tinte-hell: #e6ebfb;
  --marker: #ffe14d;
  --marker-hell: #fff5c2;
  --rot: #d23a2f;
  --rot-hell: #fbe4e1;
  --gruen: #2c8a55;
  --schatten: 0 1px 0 rgba(28, 34, 51, .04), 0 6px 18px -8px rgba(28, 34, 51, .18);
  --rand: 1px solid var(--linie);
  --r-gross: 18px;
  --r: 12px;
  --r-klein: 8px;
  --oben: env(safe-area-inset-top, 0px);
  --unten: env(safe-area-inset-bottom, 0px);
  --navh: 64px;
  --kopfschrift: 'Schola', 'Century Schoolbook', 'TeX Gyre Schola', Georgia, serif;
  --textschrift: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --papier: #131826;
    --karo: #1b2234;
    --blatt: #1a2030;
    --blatt2: #222a3d;
    --linie: #2c3550;
    --text: #e8ecf6;
    --leise: #9aa3ba;
    --tinte: #8ea4ff;
    --tinte-dunkel: #b4c3ff;
    --tinte-hell: #232d52;
    --marker: #f5d43a;
    --marker-hell: #3a3520;
    --rot: #ff6a5c;
    --rot-hell: #3d2224;
    --gruen: #5cc98a;
    --schatten: 0 1px 0 rgba(0, 0, 0, .25), 0 8px 20px -10px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--text);
  background-color: var(--papier);
  background-image:
    linear-gradient(var(--karo) 1px, transparent 1px),
    linear-gradient(90deg, var(--karo) 1px, transparent 1px);
  background-size: 22px 22px;
  background-attachment: fixed;
  font: 16px/1.5 var(--textschrift);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
a { color: var(--tinte); text-underline-offset: 2px; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--kopfschrift); font-weight: 700; line-height: 1.15; margin: 0; letter-spacing: -.005em; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--tinte); outline-offset: 2px; border-radius: 6px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* Textmarker: das eine laute Element */
.marker {
  background-image: linear-gradient(100deg, transparent 0 .2em, var(--marker) .2em calc(100% - .15em), transparent calc(100% - .15em));
  background-size: 100% .62em; background-repeat: no-repeat; background-position: 0 88%;
  -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 .12em;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .marker { background-image: linear-gradient(100deg, transparent 0 .2em, rgba(245, 212, 58, .35) .2em calc(100% - .15em), transparent calc(100% - .15em)); } }

/* ---------- Kopf ---------- */
#kopf {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 8px;
  padding: calc(8px + var(--oben)) 12px 8px;
  background: color-mix(in srgb, var(--papier) 88%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  min-height: calc(56px + var(--oben));
}
#kopf h1 { font-size: 1.2rem; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#kopf .logo { display: flex; align-items: center; gap: 9px; flex: 1; font-family: var(--kopfschrift); font-weight: 700; font-size: 1.25rem; }
#kopf .logo img { width: 30px; height: 30px; border-radius: 9px; }
.kopfknopf {
  border: 0; background: transparent; width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center; font-size: 1.35rem; cursor: pointer; color: var(--text); flex: none; text-decoration: none;
}
.kopfknopf:hover { background: var(--blatt2); }
.kopfknopf.an { background: var(--marker); color: #1c2233; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: #fff;
  font-weight: 700; font-size: .9rem; flex: none; text-decoration: none; box-shadow: 0 0 0 2px var(--blatt);
}
.avatar.klein { width: 22px; height: 22px; font-size: .7rem; box-shadow: none; }
.hilfe-knopf {
  font-family: var(--kopfschrift); font-weight: 700; font-size: 1rem; text-decoration: none; width: 34px; height: 34px; border-radius: 50%;
  border: 1.5px solid var(--linie); display: grid; place-items: center; color: var(--leise); flex: none; background: var(--blatt);
}

main { padding: 6px 16px calc(var(--navh) + 34px + var(--unten)); max-width: 760px; margin: 0 auto; }

/* ---------- Navigation: ruhige Leiste, gelber Plus-Knopf ---------- */
#nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: space-around; align-items: stretch;
  height: calc(var(--navh) + var(--unten)); padding-bottom: var(--unten);
  background: color-mix(in srgb, var(--blatt) 94%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: var(--rand);
}
#nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--leise); text-decoration: none; font-size: .72rem; position: relative; font-weight: 500;
}
#nav a .i { font-size: 1.3rem; line-height: 1; filter: grayscale(1); opacity: .65; }
#nav a.aktiv { color: var(--tinte); font-weight: 700; }
#nav a.aktiv .i { filter: none; opacity: 1; }
#nav a.aktiv::before { content: ""; position: absolute; top: 0; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: var(--tinte); }
#nav a.neu::before { display: none; }
#nav a.neu .i {
  background: var(--marker); color: #1c2233; width: 54px; height: 54px; border-radius: 50%; margin-top: -26px;
  display: grid; place-items: center; filter: none; opacity: 1; font-size: 1.9rem; font-weight: 400;
  box-shadow: 0 0 0 5px var(--papier), 0 8px 18px -6px rgba(28, 34, 51, .45);
}
#nav a.neu { color: var(--text); font-weight: 600; justify-content: flex-end; padding-bottom: 8px; }
#nav .zahl {
  position: absolute; top: 7px; left: calc(50% + 7px); background: var(--rot); color: #fff;
  border-radius: 9px; font-size: .66rem; min-width: 18px; height: 18px; padding: 0 5px; display: grid; place-items: center; font-weight: 700;
}

/* ---------- Knöpfe & Felder ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1.5px solid var(--linie); background: var(--blatt); color: var(--text);
  padding: 10px 16px; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: .95rem;
  text-decoration: none; min-height: 46px; line-height: 1.15; text-align: center; transition: transform .08s;
}
.btn:active { transform: scale(.97); }
.btn.primaer { background: var(--tinte); border-color: var(--tinte); color: #fff; }
.btn.warm { background: var(--rot); border-color: var(--rot); color: #fff; }
.btn.leise { background: transparent; border-color: transparent; color: var(--tinte); }
.btn.gefahr { color: var(--rot); }
.btn.klein { padding: 6px 12px; min-height: 36px; font-size: .86rem; }
.btn.breit { width: 100%; }
.btn:disabled { opacity: .45; pointer-events: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.primaer { color: #10152a; } }
.btnreihe { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btnreihe.ende { justify-content: flex-end; }

label.feld { display: block; margin: 0 0 16px; }
label.feld > span, .feldtitel { display: block; font-size: .84rem; font-weight: 600; color: var(--leise); margin-bottom: 6px; }
input[type=text], input[type=password], input[type=search], input[type=number], input[type=date], input[type=url], select, textarea {
  width: 100%; border: 1.5px solid var(--linie); background: var(--blatt); border-radius: var(--r);
  padding: 11px 13px; font-size: 16px; outline: none; min-height: 48px;
}
textarea { resize: vertical; min-height: 84px; line-height: 1.45; }
input:focus, select:focus, textarea:focus { border-color: var(--tinte); box-shadow: 0 0 0 4px var(--tinte-hell); }
.hinweistext { font-size: .86rem; color: var(--leise); margin: 4px 0 0; }
.schalter { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 6px 0; }
.schalter input { width: 22px; height: 22px; accent-color: var(--tinte); flex: none; }

/* ---------- Blätter (Karten) & Abschnitte ---------- */
.karte { background: var(--blatt); border-radius: var(--r-gross); box-shadow: var(--schatten); padding: 16px; margin: 0 0 14px; border: var(--rand); }
.abschnitt { margin: 26px 0 10px; display: flex; align-items: baseline; gap: 10px; }
.abschnitt h2 { flex: 1; font-size: 1.15rem; }
.leer { text-align: center; color: var(--leise); padding: 28px 12px; }
.leer .gross { font-size: 2.6rem; display: block; margin-bottom: 6px; }

/* Begrüßung auf der Startseite */
.gruss { margin: 6px 2px 14px; }
.gruss h1 { font-size: clamp(1.9rem, 7.5vw, 2.5rem); line-height: 1.05; }
.gruss p { margin: 6px 0 0; color: var(--leise); }

/* Liste als ein Blatt mit Linien */
.liste { background: var(--blatt); border-radius: var(--r-gross); box-shadow: var(--schatten); border: var(--rand); overflow: hidden; }
.eintrag {
  display: flex; gap: 14px; align-items: center; padding: 11px 14px; text-decoration: none; color: inherit; min-height: 78px;
  border-bottom: var(--rand); position: relative;
}
.eintrag:last-child { border-bottom: 0; }
.eintrag:active { background: var(--blatt2); }
.eintrag .bild {
  width: 58px; height: 58px; border-radius: var(--r); flex: none; background: var(--blatt2) center/cover no-repeat;
  display: grid; place-items: center; font-size: 1.6rem;
}
.eintrag img.bild { object-fit: cover; }
.eintrag .inhalt { flex: 1; min-width: 0; }
.eintrag .titel { font-family: var(--kopfschrift); font-weight: 700; font-size: 1.06rem; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.eintrag .meta { font-size: .8rem; color: var(--leise); margin-top: 4px; display: flex; gap: 9px; flex-wrap: wrap; align-items: center; }
.eintrag .stern { color: #c9a400; }
mark { background: var(--marker); color: #1c2233; border-radius: 2px; padding: 0 1px; }

.chips { display: flex; gap: 7px; overflow-x: auto; padding: 2px 16px 10px; margin: 0 -16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1.5px solid var(--linie); background: var(--blatt); border-radius: 999px; padding: 7px 14px;
  font-size: .88rem; cursor: pointer; white-space: nowrap; color: var(--text); font-weight: 500;
}
.chip.an { background: var(--text); border-color: var(--text); color: var(--papier); }
.marke { display: inline-flex; align-items: center; gap: 4px; font-size: .78rem; background: var(--blatt2); border-radius: 999px; padding: 2px 10px; color: var(--leise); font-weight: 600; }
.marke.warm { background: var(--marker-hell); color: #6b5800; }
.marke.akzent { background: var(--tinte-hell); color: var(--tinte-dunkel); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .marke.warm { color: var(--marker); } }

.quer { display: flex; gap: 12px; overflow-x: auto; margin: 0 -16px; padding: 2px 16px 10px; scrollbar-width: none; }
.quer::-webkit-scrollbar { display: none; }
.kachel { flex: none; width: 132px; text-decoration: none; color: inherit; }
.kachel .bild { height: 96px; border-radius: var(--r); background: var(--blatt2) center/cover; display: grid; place-items: center; font-size: 1.8rem; box-shadow: var(--schatten); border: var(--rand); }
.kachel .t { padding: 7px 2px 0; font-size: .86rem; font-weight: 600; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- Suche ---------- */
.suche { position: sticky; top: calc(56px + var(--oben)); z-index: 15; padding: 2px 0 12px; }
.suche .feld { position: relative; }
.suche input {
  padding-left: 46px; border-radius: 999px; min-height: 54px; background: var(--blatt); box-shadow: var(--schatten);
  border: 1.5px solid var(--linie); font-size: 17px;
}
.suche input:focus { border-color: var(--tinte); }
.suche .lupe { position: absolute; left: 17px; top: 50%; transform: translateY(-50%); opacity: .55; pointer-events: none; }
.suche .x { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); }
.frage-knopf {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border: 1.5px dashed var(--tinte);
  background: var(--tinte-hell); color: var(--tinte-dunkel); border-radius: var(--r-gross); padding: 13px 16px; cursor: pointer; font-weight: 600; margin: 2px 0 14px;
}
.antwort { white-space: pre-wrap; }

/* ---------- Bald dran: kleine Merkzettel ---------- */
.faellig {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--marker-hell); border-radius: var(--r);
  margin-bottom: 8px; text-decoration: none; color: inherit; border-left: 5px solid var(--marker);
}
.faellig .t { flex: 1; font-weight: 600; }
.faellig .d { font-size: .82rem; color: var(--leise); font-weight: 600; white-space: nowrap; }

/* ---------- Notfall ---------- */
.notfall-leiste { background: var(--rot); color: #fff; border-radius: var(--r-gross); padding: 12px 14px; margin: 0 0 14px; display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.notfall-leiste .kopf { font-family: var(--kopfschrift); font-weight: 700; font-size: 1.1rem; margin-right: 4px; }
.notfall-leiste a { color: #fff; background: rgba(255, 255, 255, .2); border-radius: 999px; padding: 6px 12px; text-decoration: none; font-weight: 600; font-size: .9rem; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .notfall-leiste, :root:not([data-theme="light"]) .notfall-band { background: #a8302a; } }
.notfall-band { background: var(--rot); color: #fff; font-weight: 700; border-radius: 999px; padding: 4px 12px; display: inline-block; margin-bottom: 6px; font-size: .88rem; }

/* ---------- Erfassen ---------- */
.quellen { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 10px 0 18px; }
.quelle {
  border: var(--rand); background: var(--blatt); box-shadow: var(--schatten); border-radius: var(--r-gross); padding: 15px 6px 12px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: .84rem; font-weight: 600; color: var(--text); text-align: center; line-height: 1.2;
}
.quelle .i { font-size: 1.75rem; }
.quelle:active { transform: scale(.97); }
.teile { display: grid; gap: 10px; }
.teil { background: var(--blatt); border-radius: var(--r-gross); box-shadow: var(--schatten); border: var(--rand); padding: 11px; display: flex; gap: 11px; align-items: flex-start; }
.teil .nr { font-family: var(--kopfschrift); font-weight: 700; color: var(--tinte); width: 22px; text-align: center; padding-top: 6px; flex: none; }
.teil .vb { width: 88px; height: 88px; border-radius: var(--r); object-fit: cover; background: var(--blatt2); flex: none; cursor: zoom-in; }
.teil .rechts { flex: 1; min-width: 0; }
.teil textarea { min-height: 62px; font-size: 15px; }
.teil .werkzeug, .werkzeug { display: flex; gap: 2px; justify-content: flex-end; margin-top: 5px; }
.mini { border: 0; background: transparent; padding: 6px 8px; border-radius: 10px; cursor: pointer; font-size: 1rem; color: var(--leise); min-width: 38px; min-height: 36px; text-decoration: none; display: inline-grid; place-items: center; }
.mini:hover { background: var(--blatt2); }
.mini:disabled { opacity: .3; }
.fortschritt { height: 5px; background: var(--blatt2); border-radius: 3px; overflow: hidden; margin-top: 7px; }
.fortschritt i { display: block; height: 100%; background: var(--tinte); width: 0; transition: width .2s; }
.unten-leiste {
  position: sticky; bottom: calc(var(--navh) + var(--unten) + 10px); z-index: 10; display: flex; gap: 8px;
  padding: 10px 0 0; margin-top: 16px;
}
.unten-leiste .btn { flex: 1; box-shadow: var(--schatten); }

/* ---------- Editor ---------- */
.schritt-ed { background: var(--blatt); border-radius: var(--r-gross); box-shadow: var(--schatten); border: var(--rand); padding: 12px; margin-bottom: 10px; }
.schritt-ed .kopfzeile { display: flex; align-items: center; gap: 4px; margin-bottom: 8px; }
.schritt-ed .kopfzeile b { flex: 1; font-family: var(--kopfschrift); font-size: 1.02rem; color: var(--tinte); }
.schritt-ed .reihe { display: flex; gap: 10px; align-items: flex-start; }
.schritt-ed .bildfeld {
  width: 98px; height: 98px; border-radius: var(--r); flex: none; background: var(--blatt2) center/cover;
  border: 2px dashed var(--linie); display: grid; place-items: center; cursor: pointer; font-size: 1.5rem; color: var(--leise); position: relative;
}
.schritt-ed .bildfeld.hat { border-style: solid; border-color: transparent; }
.schritt-ed .bildfeld .weg { position: absolute; top: -8px; right: -8px; width: 26px; height: 26px; border-radius: 50%; background: var(--blatt); box-shadow: var(--schatten); border: var(--rand); font-size: .8rem; cursor: pointer; }
.schritt-ed textarea { min-height: 98px; }
.offen-hinweis { background: var(--marker-hell); border-left: 5px solid var(--marker); border-radius: var(--r); padding: 11px 14px; font-size: .92rem; margin-bottom: 16px; }
.zeile2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.anhang-ed { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: var(--rand); }
.anhang-ed:last-child { border-bottom: 0; }
.anhang-ed .n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .93rem; }
.anhang-ed img { width: 44px; height: 44px; border-radius: var(--r-klein); object-fit: cover; }
.anhang-ed .ic { width: 44px; height: 44px; border-radius: var(--r-klein); background: var(--blatt2); display: grid; place-items: center; font-size: 1.3rem; }
details.karte summary { cursor: pointer; list-style-position: inside; }

/* ---------- Ansicht ---------- */
.hero { margin: 0 -16px 14px; height: 230px; background: var(--blatt2) center/cover; position: relative; }
@media (min-width: 760px) { .hero { margin: 0 0 14px; border-radius: var(--r-gross); height: 300px; } }
.ansicht h1.titel { font-size: clamp(1.7rem, 6.5vw, 2.2rem); margin: 8px 0 10px; line-height: 1.12; }
.ansicht .meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: .84rem; color: var(--leise); margin-bottom: 14px; }
.ansicht .meta > span { display: inline-flex; align-items: center; gap: 5px; }
.ansicht .kurz { font-size: 1.06rem; margin: 0 0 16px; }
.aktionen { display: flex; gap: 8px; margin: 0 0 18px; flex-wrap: wrap; }
.aktionen .btn { flex: 1 1 auto; }
.material { list-style: none; margin: 0; padding: 0; }
.material li { display: flex; align-items: center; gap: 12px; padding: 9px 2px; border-bottom: var(--rand); cursor: pointer; }
.material li:last-child { border-bottom: 0; }
.material .box { width: 24px; height: 24px; border-radius: 7px; border: 2px solid var(--linie); flex: none; display: grid; place-items: center; font-size: .8rem; color: transparent; }
.material li.hab .box { background: var(--gruen); border-color: var(--gruen); color: #fff; }
.material li.hab span { color: var(--leise); text-decoration: line-through; }

/* Schritte als verbundene Nummernkette */
.schritt { display: flex; gap: 14px; margin-bottom: 4px; position: relative; padding-bottom: 18px; }
.schritt::before { content: ""; position: absolute; left: 16px; top: 36px; bottom: 0; border-left: 2px dashed var(--linie); }
.schritt:last-of-type::before { display: none; }
.schritt .num {
  width: 34px; height: 34px; border-radius: 50%; background: var(--tinte); color: #fff;
  font-family: var(--kopfschrift); font-weight: 700; display: grid; place-items: center; flex: none; font-size: 1.05rem; position: relative; z-index: 1;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .schritt .num { color: #10152a; } }
.schritt .inhalt { flex: 1; min-width: 0; }
.schritt img { width: 100%; border-radius: var(--r); display: block; margin-bottom: 8px; cursor: zoom-in; background: var(--blatt2); max-height: 520px; object-fit: contain; border: var(--rand); }
.schritt .text { white-space: pre-wrap; overflow-wrap: anywhere; padding-top: 5px; font-size: 1.02rem; }

.anhang { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: var(--rand); text-decoration: none; color: inherit; }
.anhang:last-child { border-bottom: 0; }
.anhang .ic { width: 42px; height: 42px; border-radius: var(--r-klein); background: var(--blatt2); display: grid; place-items: center; font-size: 1.2rem; flex: none; }
.anhang .n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
video, audio { width: 100%; border-radius: var(--r); background: #000; display: block; }
audio { background: transparent; }
.medienblock { margin-bottom: 12px; }
.medienblock .unter { font-size: .82rem; color: var(--leise); margin-top: 5px; }
.hinweis { padding: 11px 0; border-bottom: var(--rand); display: flex; gap: 10px; }
.hinweis:last-of-type { border-bottom: 0; }
.hinweis .t { flex: 1; white-space: pre-wrap; overflow-wrap: anywhere; }
.hinweis .wer { font-size: .78rem; color: var(--leise); margin-bottom: 2px; font-weight: 600; }
.erinnerung { display: flex; gap: 12px; align-items: center; }
.erinnerung .ic { font-size: 1.6rem; }
.erinnerung .t { flex: 1; }
.erinnerung .t small { display: block; color: var(--leise); }
.ort-zeile { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: var(--rand); }
.ort-zeile:last-of-type { border-bottom: 0; }
.ort-zeile span { flex: 1; }
.tabelle td.warnung { color: #a07f00; font-weight: 700; }
.tabelle td.leise { color: var(--leise); }

/* ---------- Schritt für Schritt ---------- */
.sfs { position: fixed; inset: 0; z-index: 60; background: var(--blatt); display: flex; flex-direction: column; padding: calc(10px + var(--oben)) 0 calc(12px + var(--unten)); }
.sfs .oben { display: flex; align-items: center; gap: 8px; padding: 0 12px 8px; }
.sfs .oben .pos { flex: 1; font-weight: 600; color: var(--leise); font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sfs .balken { height: 5px; background: var(--blatt2); margin: 0 16px 12px; border-radius: 3px; overflow: hidden; }
.sfs .balken i { display: block; height: 100%; background: var(--tinte); transition: width .25s; }
.sfs .buehne { flex: 1; overflow-y: auto; padding: 0 18px; display: flex; flex-direction: column; }
.sfs .buehne img { width: 100%; max-height: 55vh; object-fit: contain; border-radius: var(--r-gross); background: var(--blatt2); margin-bottom: 16px; }
.sfs .buehne .text { font-size: 1.35rem; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.sfs .buehne .gross-num { font-family: var(--kopfschrift); font-size: 1.05rem; font-weight: 700; color: var(--tinte); margin-bottom: 8px; }
.sfs .unten { display: flex; gap: 10px; padding: 12px 16px 0; }
.sfs .unten .btn { flex: 1; min-height: 58px; font-size: 1.08rem; }

/* ---------- Dialoge, Bildbetrachter ---------- */
#ebene:empty { display: none; }
.dunkel { position: fixed; inset: 0; z-index: 80; background: rgba(16, 20, 34, .5); display: flex; align-items: flex-end; justify-content: center; animation: ein .15s ease; }
@media (min-width: 640px) { .dunkel { align-items: center; } }
.dialog {
  background: var(--blatt); width: 100%; max-width: 560px; border-radius: 24px 24px 0 0; max-height: 92vh; overflow-y: auto;
  padding: 20px 18px calc(18px + var(--unten)); box-shadow: 0 -12px 40px rgba(0, 0, 0, .25);
}
@media (min-width: 640px) { .dialog { border-radius: 24px; } }
.dialog::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 2px; background: var(--linie); margin: -8px auto 14px; }
@media (min-width: 640px) { .dialog::before { display: none; } }
.dialog h2 { margin-bottom: 12px; font-size: 1.3rem; }
.dialog .btnreihe { margin-top: 16px; }
.dialog.dialog-gross { max-width: 960px; }
@keyframes ein { from { opacity: 0; } }
.betrachter { position: fixed; inset: 0; z-index: 90; background: #000; display: flex; flex-direction: column; }
.betrachter .flaeche { flex: 1; overflow: auto; display: flex; align-items: center; justify-content: center; touch-action: pan-x pan-y pinch-zoom; }
.betrachter img { max-width: 100%; max-height: 100%; object-fit: contain; }
.betrachter.zoom img { max-width: none; max-height: none; width: 220%; }
.betrachter .zu { position: absolute; top: calc(10px + var(--oben)); right: 10px; z-index: 2; background: rgba(0, 0, 0, .55); color: #fff; border: 0; width: 44px; height: 44px; border-radius: 50%; font-size: 1.2rem; }
.betrachter .unterschrift { color: #ddd; padding: 10px 16px calc(14px + var(--unten)); font-size: .95rem; white-space: pre-wrap; max-height: 30vh; overflow-y: auto; }

/* Aufnahme */
.aufnahme video { max-height: 50vh; background: #000; }
.bildraster { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; margin-top: 10px; }
.bildraster button { position: relative; border: 3px solid transparent; padding: 0; border-radius: 10px; overflow: hidden; background: var(--blatt2); cursor: pointer; aspect-ratio: 16/10; }
.bildraster button img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bildraster button.an { border-color: var(--tinte); }
.bildraster button.an::after { content: "✓"; position: absolute; top: 3px; right: 3px; background: var(--tinte); color: #fff; width: 20px; height: 20px; border-radius: 50%; font-size: .75rem; display: grid; place-items: center; }
.bildraster button span { position: absolute; left: 3px; bottom: 3px; background: rgba(0, 0, 0, .6); color: #fff; font-size: .68rem; padding: 0 4px; border-radius: 4px; }
.mikro { text-align: center; padding: 10px 0; }
.mikro .kreis {
  width: 112px; height: 112px; border-radius: 50%; background: var(--rot); color: #fff; margin: 10px auto; display: grid; place-items: center;
  font-size: 2.6rem; border: 0; cursor: pointer; animation: puls 1.5s infinite;
}
.mikro .zeit { font-family: var(--kopfschrift); font-size: 1.8rem; font-variant-numeric: tabular-nums; font-weight: 700; }
@keyframes puls { 0% { box-shadow: 0 0 0 0 rgba(210, 58, 47, .5); } 70% { box-shadow: 0 0 0 22px rgba(210, 58, 47, 0); } 100% { box-shadow: 0 0 0 0 rgba(210, 58, 47, 0); } }

/* Markieren */
.mark-leiste { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 10px; }
.mark-w { width: 42px; height: 42px; border-radius: 50%; border: 1.5px solid var(--linie); background: var(--blatt); font-size: 1.15rem; cursor: pointer; color: var(--text); font-weight: 700; }
.mark-w.an { background: var(--tinte); color: #fff; border-color: var(--tinte); }
.mark-f { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--linie); cursor: pointer; }
.mark-f.an { outline: 3px solid var(--text); outline-offset: 2px; }
.mark-trenner { width: 1px; height: 26px; background: var(--linie); margin: 0 2px; }
.mark-flaeche { background: #000; border-radius: var(--r); overflow: hidden; display: flex; justify-content: center; }
.mark-flaeche canvas { max-width: 100%; max-height: 62vh; width: auto; height: auto; touch-action: none; display: block; cursor: crosshair; }

/* ---------- Rückmeldungen, Laden ---------- */
#toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--navh) + 18px + var(--unten)); z-index: 100; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; padding: 0 16px; }
.toast { background: var(--text); color: var(--papier); padding: 11px 18px; border-radius: 999px; font-size: .92rem; box-shadow: var(--schatten); max-width: 520px; animation: ein .2s; pointer-events: auto; font-weight: 500; }
.toast.fehler { background: var(--rot); color: #fff; border-radius: var(--r); }
.kreisel { width: 22px; height: 22px; border: 3px solid var(--linie); border-top-color: var(--tinte); border-radius: 50%; display: inline-block; animation: dreh .8s linear infinite; vertical-align: middle; }
.btn .kreisel { width: 16px; height: 16px; border-width: 2px; border-color: rgba(255, 255, 255, .4); border-top-color: #fff; }
.laden-gross { display: grid; place-items: center; padding: 70px 0; }
.ki-laden { text-align: center; padding: 30px 10px; }
.ki-laden .kreisel { width: 40px; height: 40px; border-width: 4px; }
.ki-laden p { color: var(--leise); }
@keyframes dreh { to { transform: rotate(360deg); } }

/* ---------- Anmelden ---------- */
.anmelden { max-width: 390px; margin: 8vh auto 0; text-align: center; }
.anmelden img { width: 88px; height: 88px; border-radius: 24px; box-shadow: var(--schatten); }
.anmelden h1 { font-size: 2.2rem; margin: 16px 0 6px; }
.anmelden p { color: var(--leise); margin: 0 0 22px; }
.anmelden form { text-align: left; }

/* ---------- Menüs, Tabellen ---------- */
.menue { background: var(--blatt); border-radius: var(--r-gross); box-shadow: var(--schatten); border: var(--rand); overflow: hidden; margin-bottom: 16px; }
.menue a, .menue button.zeile {
  display: flex; align-items: center; gap: 13px; padding: 14px 16px; color: inherit; text-decoration: none; border: 0;
  border-bottom: var(--rand); width: 100%; background: transparent; text-align: left; cursor: pointer; font-size: 1rem;
}
.menue a:last-child, .menue button.zeile:last-child { border-bottom: 0; }
.menue a:active, .menue button.zeile:active { background: var(--blatt2); }
.menue .i { font-size: 1.25rem; width: 28px; text-align: center; display: grid; place-items: center; }
.menue .t { flex: 1; font-weight: 600; }
.menue .t small { display: block; color: var(--leise); font-size: .8rem; font-weight: 400; }
.menue .pfeil { color: var(--leise); font-size: 1.2rem; }
.tabelle { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tabelle th, .tabelle td { text-align: left; padding: 7px 4px; border-bottom: var(--rand); vertical-align: top; }
.tabelle th { color: var(--leise); font-weight: 600; font-size: .82rem; }
.tabelle td.z, .tabelle th.z { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kennzahl { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.kennzahl div { background: var(--blatt); border: var(--rand); border-radius: var(--r); padding: 11px; }
.kennzahl b { display: block; font-family: var(--kopfschrift); font-size: 1.3rem; }
.kennzahl small { color: var(--leise); }
.code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .8rem; background: var(--blatt2); padding: 9px 11px; border-radius: var(--r-klein); overflow-wrap: anywhere; user-select: all; }

/* Besorgen */
.besorgen-zeile { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: var(--rand); }
.besorgen-zeile:last-child { border-bottom: 0; }
.besorgen-zeile .box { width: 28px; height: 28px; border-radius: 8px; border: 2px solid var(--linie); flex: none; display: grid; place-items: center; color: transparent; cursor: pointer; background: transparent; }
.besorgen-zeile.erledigt .box { background: var(--gruen); border-color: var(--gruen); color: #fff; }
.besorgen-zeile .t { flex: 1; min-width: 0; }
.besorgen-zeile.erledigt .t { color: var(--leise); text-decoration: line-through; }
.besorgen-zeile .t small { display: block; font-size: .78rem; color: var(--leise); text-decoration: none; }
.besorgen-zeile .t small a { color: var(--leise); }

/* Hilfe */
.hilfe h2 { margin: 26px 0 8px; font-size: 1.35rem; scroll-margin-top: 72px; }
.hilfe ol, .hilfe ul { padding-left: 1.3em; margin: 6px 0 10px; }
.hilfe li { margin-bottom: 5px; }
.hilfe p, .hilfe li { max-width: 68ch; }
.hilfe .tipp { background: var(--marker-hell); border-left: 5px solid var(--marker); border-radius: var(--r); padding: 9px 13px; margin: 10px 0; font-size: .94rem; }

/* QR & Druck */
.vorschau-qr { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 6px 0; }
.vorschau-qr svg { width: 150px; height: 150px; border-radius: 8px; }
.vorschau-qr small { overflow-wrap: anywhere; text-align: center; }
.qr-bogen { display: flex; flex-wrap: wrap; gap: 0.4cm; }
.qr-etikett { border: 1px dashed #b8c2d6; border-radius: 6px; padding: 0.3cm; text-align: center; background: #fff; color: #000; break-inside: avoid; }
.qr-etikett svg { width: 100%; height: 100%; display: block; }
.qr-titel { font-family: var(--kopfschrift); font-weight: 700; margin-top: 4px; line-height: 1.15; }
.qr-unter { font-size: 7pt; color: #555; margin-top: 2px; }
.druckseite h1 { font-size: 1.8rem; margin: 8px 0; }
.druckseite h2 { font-size: 1.15rem; margin: 18px 0 8px; }
.druckseite .schritt { break-inside: avoid; }
.druckseite .schritt img { max-height: 9cm; width: auto; max-width: 100%; }
.druck-liste { list-style: none; padding: 0; }
.druck-fuss { display: flex; gap: 12px; align-items: center; margin-top: 24px; border-top: var(--rand); padding-top: 10px; font-size: .85rem; color: var(--leise); }
.druck-fuss svg { width: 2.6cm; height: 2.6cm; }
body.druck #nav { display: none; }
@media print {
  @page { margin: 1.2cm; }
  body { background: #fff !important; color: #000 !important; }
  #kopf, #nav, #toasts, .nicht-drucken { display: none !important; }
  main { padding: 0 !important; max-width: none; }
  a { color: #000; text-decoration: none; }
  .schritt .num { background: #000 !important; color: #fff !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .schritt::before { border-color: #bbb; }
}

@media (min-width: 900px) {
  .quellen { grid-template-columns: repeat(6, 1fr); }
}

/* Breite Bildschirme: Kopf und Leiste auf die Inhaltsbreite ausrichten */
@media (min-width: 800px) {
  #kopf { padding-left: calc((100% - 760px) / 2 + 8px); padding-right: calc((100% - 760px) / 2 + 8px); }
  #nav { padding-left: calc((100% - 760px) / 2); padding-right: calc((100% - 760px) / 2); }
  #nav a.aktiv::before { left: 34%; right: 34%; }
}
