/* Familien-App: iOS-nah, System-Schrift, Tippflaechen >= 44 px.
   Hell und dunkel folgen dem Geraet (prefers-color-scheme, R10). Farben
   stehen NUR in den beiden Token-Bloecken; Regeln benutzen var(--...).
   Personenfarben kommen aus den Daten (--farbe am Punkt). */
:root {
  --grund: #f2f2f7;
  --flaeche: #ffffff;
  --text: #1c1c1e;
  --leise: #6e6e73;
  --linie: #d1d1d6;
  --akzent: #2f6fde;
  --einkauf: #34a853;
  --kalender: #2f6fde;
  --notizen: #d9a400;
  --aufgaben: #8a4fd6;
  --reiter-grund: rgba(249, 249, 249, 0.94);
  --reiter-aus: #8e8e93;
  --hinweis-grund: rgba(28, 28, 30, 0.94);
  --hinweis-text: #ffffff;
  --hinweis-knopf: #6ea8ff;
  --schatten: rgba(0, 0, 0, 0.06);
  --schatten-hinweis: rgba(0, 0, 0, 0.2);
  --punkt-grau: #8e8e93;
  --punkt-ring: rgba(0, 0, 0, 0);
  --gefahr: #c40012;
  --gefahr-text: #ffffff;
  --feld: #e9e9ee;
  --hervor: rgba(47, 111, 222, 0.16);
  --auf-akzent: #ffffff;
  --abdunkeln: rgba(0, 0, 0, 0.32);
  --radius: 14px;
  --reiter-hoehe: 56px;
  --unten: env(safe-area-inset-bottom, 0px);
  color-scheme: light dark;
}

/* Erzwungenes Hell (Einstellungen -> Darstellung): data-theme am <html>. */
:root[data-theme="hell"] {
  --grund: #f2f2f7;
  --flaeche: #ffffff;
  --text: #1c1c1e;
  --leise: #6e6e73;
  --linie: #d1d1d6;
  --akzent: #2f6fde;
  --einkauf: #34a853;
  --kalender: #2f6fde;
  --notizen: #d9a400;
  --aufgaben: #8a4fd6;
  --reiter-grund: rgba(249, 249, 249, 0.94);
  --reiter-aus: #8e8e93;
  --hinweis-grund: rgba(28, 28, 30, 0.94);
  --hinweis-text: #ffffff;
  --hinweis-knopf: #6ea8ff;
  --schatten: rgba(0, 0, 0, 0.06);
  --schatten-hinweis: rgba(0, 0, 0, 0.2);
  --punkt-grau: #8e8e93;
  --punkt-ring: rgba(0, 0, 0, 0);
  --gefahr: #c40012;
  --gefahr-text: #ffffff;
  --feld: #e9e9ee;
  --hervor: rgba(47, 111, 222, 0.16);
  --auf-akzent: #ffffff;
  --abdunkeln: rgba(0, 0, 0, 0.32);
  color-scheme: light;
}

/* Dunkel folgt dem Geraet, ausser Hell ist erzwungen. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="hell"]) {
    --grund: #000000;
    --flaeche: #1c1c1e;
    --text: #f2f2f7;
    --leise: #98989f;
    --linie: #38383a;
    --akzent: #4a8cff;
    --einkauf: #30d158;
    --kalender: #4a8cff;
    --notizen: #ffd60a;
    --aufgaben: #bf8cff;
    --reiter-grund: rgba(22, 22, 24, 0.92);
    --reiter-aus: #8e8e93;
    --hinweis-grund: rgba(58, 58, 60, 0.96);
    --hinweis-text: #ffffff;
    --hinweis-knopf: #8fbaff;
    --schatten: rgba(0, 0, 0, 0);
    --schatten-hinweis: rgba(0, 0, 0, 0.5);
    --punkt-grau: #8e8e93;
    --punkt-ring: rgba(255, 255, 255, 0.3);
    --gefahr: #ff6961;
    --gefahr-text: #000000;
    --feld: #2c2c2e;
    --hervor: rgba(74, 140, 255, 0.28);
    --auf-akzent: #ffffff;
    --abdunkeln: rgba(0, 0, 0, 0.55);
  }
}

/* Erzwungenes Dunkel: derselbe Satz noch einmal (CSS kann ihn nicht teilen). */
:root[data-theme="dunkel"] {
  --grund: #000000;
  --flaeche: #1c1c1e;
  --text: #f2f2f7;
  --leise: #98989f;
  --linie: #38383a;
  --akzent: #4a8cff;
  --einkauf: #30d158;
  --kalender: #4a8cff;
  --notizen: #ffd60a;
  --aufgaben: #bf8cff;
  --reiter-grund: rgba(22, 22, 24, 0.92);
  --reiter-aus: #8e8e93;
  --hinweis-grund: rgba(58, 58, 60, 0.96);
  --hinweis-text: #ffffff;
  --hinweis-knopf: #8fbaff;
  --schatten: rgba(0, 0, 0, 0);
  --schatten-hinweis: rgba(0, 0, 0, 0.5);
  --punkt-grau: #8e8e93;
  --punkt-ring: rgba(255, 255, 255, 0.3);
  --gefahr: #ff6961;
  --gefahr-text: #000000;
  --feld: #2c2c2e;
  --hervor: rgba(74, 140, 255, 0.28);
  --auf-akzent: #ffffff;
  --abdunkeln: rgba(0, 0, 0, 0.55);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
html, body { touch-action: manipulation; }
/* Anzeigegroesse (Einstellungen -> Groesse): zoom auf html skaliert Schrift, Knoepfe,
   Abstaende und die fixierte Reiterleiste gleichmaessig; data-groesse setzt
   darstellung-frueh.js vor dem ersten Zeichnen. */
:root { --zoom: 1; }
html[data-groesse="mittel"] { zoom: 1.12; --zoom: 1.12; }
html[data-groesse="gross"] { zoom: 1.25; --zoom: 1.25; }
/* vh/dvh/vw werden unter zoom mitskaliert: Hoehen daraus durch var(--zoom) teilen. */
/* Z1: iOS Safari zoomt beim Fokus in ein Feld mit Schrift < 16 px. Untergrenze
   fuer ALLE Felder (auch in kleinen Beschriftungen wie .ek-label, deren
   Felder "font: inherit" haben); 1em behaelt groessere geerbte Schrift (17 px).
   !important, weil Klassenregeln sonst gewinnen. Der Zoom ist seit S1
   bewusst gesperrt (Viewport + touch-action). test/stil.test.js prueft das. */
input, select, textarea { font-size: max(16px, 1em) !important; }
body {
  margin: 0;
  background: var(--grund);
  color: var(--text);
  font: 17px/1.35 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  padding:
    env(safe-area-inset-top, 0px)
    env(safe-area-inset-right, 0px)
    calc(var(--reiter-hoehe) + var(--unten) + 16px)
    env(safe-area-inset-left, 0px);
}
body.ohne-reiter { padding-bottom: calc(var(--unten) + 16px); }
body.ohne-reiter .reiterleiste { display: none; }

main { max-width: 640px; margin: 0 auto; padding: 0 16px; }

.kopf { padding: 20px 4px 12px; }
/* "‹ Zurück" ueber dem Seitentitel (dom.js zurueckLink), auf jeder Bereichsseite. */
.zurueck {
  display: inline-flex; align-items: center; min-height: 44px; margin: 0 0 2px -8px; padding: 0 8px;
  color: var(--akzent); text-decoration: none; font-size: 17px;
}
.zurueck:focus-visible { outline: 2px solid var(--akzent); outline-offset: 2px; border-radius: 8px; }
.kopf h1 { margin: 0; font-size: 34px; line-height: 1.15; font-weight: 700; letter-spacing: -0.02em; }
.kopf-datum { margin: 0 0 2px; color: var(--leise); font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }

.abschnitt { margin: 28px 4px 8px; font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.leise { color: var(--leise); margin: 8px 4px; }

/* Kacheln */
.kacheln { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.kachel {
  display: flex; flex-direction: column; justify-content: space-between;
  min-height: 112px; padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--flaeche); color: var(--text); text-decoration: none;
  box-shadow: 0 1px 2px var(--schatten);
  border-top: 4px solid var(--akzent);
}
.kachel:active { transform: scale(0.98); }
.kachel-einkauf { border-top-color: var(--einkauf); }
.kachel-kalender { border-top-color: var(--kalender); }
.kachel-aufgaben { border-top-color: var(--aufgaben); }
.kachel-notizen { grid-column: 1 / -1; min-height: 0; gap: 4px; border-top-color: var(--notizen); }
.kachel-notizen .kachel-zahl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kachel-titel { font-size: 20px; font-weight: 700; }
.kachel-zahl { color: var(--leise); font-size: 15px; }
.kachel-hervor { color: var(--gefahr); font-weight: 600; }
.kachel-unten { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kachel-vorschau {
  font-size: 16px; font-weight: 600; overflow-wrap: anywhere; overflow: hidden;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2;
}

/* Listen (iOS-Gruppen) */
.liste {
  list-style: none; margin: 0; padding: 0;
  background: var(--flaeche); border-radius: var(--radius); overflow: hidden;
}
.zeile {
  display: flex; align-items: center; gap: 10px;
  min-height: 44px; padding: 10px 16px;
  border-bottom: 0.5px solid var(--linie);
}
.zeile:last-child { border-bottom: 0; }

.tag { margin: 18px 4px 6px; font-size: 15px; font-weight: 600; color: var(--leise); }
.termin .zeit { flex: 0 1 auto; min-width: 82px; max-width: 40%; overflow-wrap: anywhere; color: var(--leise); font-variant-numeric: tabular-nums; font-size: 15px; }
.termin .titel { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.punkte { display: inline-flex; gap: 3px; flex: 0 0 auto; }
/* Ring nur im Dunkelmodus sichtbar: dunkle Personenfarben heben sich ab. */
.punkt { width: 10px; height: 10px; border-radius: 50%; background: var(--farbe, var(--punkt-grau)); box-shadow: 0 0 0 1px var(--punkt-ring); }

/* Hinweis-Leiste */
.hinweis {
  position: fixed; z-index: 20;
  left: 12px; right: 12px;
  bottom: calc(var(--reiter-hoehe) + var(--unten) + 10px);
  max-width: 616px; margin: 0 auto;
  display: flex; align-items: center; gap: 12px;
  min-height: 48px; padding: 6px 8px 6px 16px;
  border-radius: 12px;
  background: var(--hinweis-grund); color: var(--hinweis-text);
  box-shadow: 0 4px 16px var(--schatten-hinweis);
}
.hinweis-text { flex: 1 1 auto; font-size: 15px; }
.hinweis-knopf {
  flex: 0 0 auto; min-height: 44px; min-width: 44px; padding: 0 12px;
  border: 0; border-radius: 10px; background: transparent;
  color: var(--hinweis-knopf); font: inherit; font-weight: 600;
}

/* Reiterleiste unten */
.reiterleiste {
  position: fixed; z-index: 10; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: space-around;
  height: calc(var(--reiter-hoehe) + var(--unten));
  padding: 0 env(safe-area-inset-right, 0px) var(--unten) env(safe-area-inset-left, 0px);
  background: var(--reiter-grund);
  border-top: 0.5px solid var(--linie);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
}
.reiter {
  flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 44px; color: var(--reiter-aus); text-decoration: none; font-size: 11px; font-weight: 500;
}
.reiter { min-width: 0; padding: 0 1px; }
.reiter span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reiter svg { width: 26px; height: 26px; }
/* Fuenf Reiter auf 375 pt bei Groesse "Gross" (zoom 1.25 = 300 CSS-px): etwas kleinere Beschriftung. */
html[data-groesse="gross"] .reiter { font-size: 10px; }
.reiter[aria-current="page"] { color: var(--akzent); }

/* Einkauf */
.ek-kopf { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.ek-neu { margin: 4px 0 8px; }
.ek-vorschlaege {
  margin-top: 6px; border-radius: 12px; overflow: hidden;
  background: var(--flaeche); box-shadow: 0 1px 2px var(--schatten);
}
.ek-vorschlaege[hidden] { display: none; }
.ek-vorschlag {
  display: block; width: 100%; min-height: 44px; padding: 10px 14px;
  border: 0; border-top: 1px solid var(--linie); border-radius: 0;
  background: transparent; color: var(--text); font: inherit; text-align: left;
}
.ek-vorschlag:first-child { border-top: 0; }
.ek-vorschlag.aktiv, .ek-vorschlag:active { background: var(--hervor); }
.ek-eingabe, .ek-feld {
  width: 100%; min-height: 44px; padding: 10px 14px;
  border: 0; border-radius: 12px; background: var(--flaeche); color: var(--text);
  font: inherit; box-shadow: 0 1px 2px var(--schatten);
}
.ek-feld { background: var(--feld); box-shadow: none; }
.ek-eingabe:focus-visible, .ek-feld:focus-visible, .ek-knopf:focus-visible, .ek-kreis:focus-visible,
.ek-mehr:focus-visible, .ek-pfeil:focus-visible, .ek-wisch-loeschen:focus-visible { outline: 2px solid var(--akzent); outline-offset: 2px; }
.ek-knopf {
  min-height: 44px; padding: 0 14px; border: 0; border-radius: 12px;
  background: var(--flaeche); color: var(--akzent); font: inherit; font-weight: 600;
}
.ek-kopf .ek-knopf { background: transparent; padding: 0 4px; font-weight: 500; font-size: 15px; }
.ek-gefahr { color: var(--gefahr); }
.abteilung { margin: 22px 4px 6px; font-size: 15px; font-weight: 600; color: var(--leise); text-transform: uppercase; letter-spacing: 0.03em; }
.ek-wisch { position: relative; overflow: hidden; }
.ek-zeile { background: var(--flaeche); border-bottom: 0.5px solid var(--linie); touch-action: pan-y; }
.ek-zeile:last-child { border-bottom: 0; }
.ek-inhalt {
  position: relative; display: flex; align-items: center; gap: 4px; min-height: 52px; padding: 0 4px 0 6px;
  background: var(--flaeche); transform: translateX(var(--wisch, 0px)); transition: transform 0.18s ease;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.ek-inhalt:active { transition: none; }
.ek-zeile.gewischt .ek-inhalt { transform: translateX(-96px); }
.ek-wisch-loeschen {
  position: absolute; top: 0; right: 0; bottom: 0; width: 96px; border: 0;
  background: var(--gefahr); color: var(--gefahr-text); font: inherit; font-weight: 600;
}
.ek-kreis {
  flex: 0 0 auto; width: 44px; height: 44px; padding: 0; border: 0; background: transparent; position: relative;
}
.ek-kreis::before {
  content: ""; position: absolute; inset: 9px; border-radius: 50%;
  border: 2px solid var(--reiter-aus); background: transparent;
}
.ek-kreis[aria-checked="true"]::before { background: var(--einkauf); border-color: var(--einkauf); }
.ek-kreis[aria-checked="true"]::after {
  content: ""; position: absolute; left: 16px; top: 13px; width: 6px; height: 12px;
  border: solid var(--flaeche); border-width: 0 2.5px 2.5px 0; transform: rotate(40deg);
}
.ek-text { flex: 1 1 auto; min-width: 0; display: flex; align-items: baseline; gap: 8px; padding: 10px 0; }
.ek-name { overflow-wrap: anywhere; }
.ek-menge { color: var(--leise); font-size: 15px; white-space: nowrap; }
.abgehakt .ek-name { color: var(--leise); text-decoration: line-through; }
.ek-mehr {
  flex: 0 0 auto; width: 44px; height: 44px; border: 0; background: transparent;
  color: var(--leise); font-size: 22px; line-height: 1;
}
.ek-panel { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; padding: 8px 16px 16px; }
.ek-label { display: grid; gap: 4px; font-size: 13px; color: var(--leise); font-weight: 600; }
.ek-panel-knoepfe { display: flex; flex-wrap: wrap; gap: 10px; }
.ek-panel-knoepfe .ek-knopf { flex: 1 1 0; background: var(--feld); }
.ek-abt .ek-name { flex: 1 1 auto; }
.ek-pfeil {
  flex: 0 0 auto; width: 44px; height: 44px; border: 0; border-radius: 10px;
  background: var(--feld); color: var(--akzent); font: inherit; font-size: 20px;
}
.ek-pfeil:disabled { color: var(--leise); opacity: 0.4; }
.ek-leer { text-align: center; margin: 32px 4px; }

/* Aufgaben (nutzt die Zeilen des Einkaufs: .ek-zeile, .ek-inhalt, .ek-kreis) */
.au-kreis[aria-checked="true"]::before { background: var(--aufgaben); border-color: var(--aufgaben); }
.au-kreis-platz { flex: 0 0 auto; width: 12px; height: 44px; }
.au-text {
  flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  min-height: 52px; justify-content: center; padding: 8px 8px 8px 0;
  border: 0; background: transparent; color: var(--text); font: inherit; text-align: left;
}
.au-text:focus-visible, .au-erledigt-kopf:focus-visible, .au-kein-datum:focus-visible { outline: 2px solid var(--akzent); outline-offset: 2px; }
.au-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; color: var(--leise); font-size: 14px; }
.au-spaet { color: var(--gefahr); font-weight: 600; }
.au-grau .ek-name, .au-grau .au-meta { color: var(--leise); }
.au-grau .ek-name { font-style: italic; }
.au-ueberfaellig .abteilung { color: var(--gefahr); }
.au-erledigt-kopfzeile { display: flex; align-items: center; gap: 8px; margin-top: 22px; }
.au-alle-loeschen {
  flex: 0 0 auto; min-height: 44px; min-width: 44px; padding: 0 10px; border: 0; border-radius: 10px;
  background: transparent; color: var(--gefahr); font: inherit; font-size: 15px; font-weight: 600;
}
.au-alle-loeschen:focus-visible { outline: 2px solid var(--akzent); outline-offset: 2px; }
.au-leiste { padding-top: 0; }
.au-frage { margin-top: 6px; border-radius: var(--radius); background: var(--flaeche); box-shadow: 0 1px 2px var(--schatten); }
.au-frage p { margin: 0; }
.au-frage .ek-knopf, .au-leiste .ek-knopf { min-width: 44px; }
.au-erledigt-kopf {
  flex: 1 1 auto; display: flex; align-items: center; justify-content: space-between; min-width: 44px; min-height: 44px; padding: 0 4px;
  border: 0; background: transparent; color: var(--leise); font: inherit; font-size: 15px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.03em;
}
.au-erledigt .liste { margin-top: 6px; }
.au-hinweis { margin: 0; color: var(--gefahr); font-size: 14px; }
.au-hinweis[hidden] { display: none; }
.au-panel .kal-personen { margin: 4px 0 0; }
.au-datum-zeile { display: flex; gap: 10px; align-items: center; }
.au-datum-zeile .ek-feld { flex: 1 1 auto; min-width: 0; }
.au-datum-zeile .ek-knopf { flex: 0 0 auto; background: var(--feld); }

/* Kalender */
.kal-kopf { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.kal-plus {
  flex: 0 0 auto; width: 44px; height: 44px; border: 0; border-radius: 50%;
  background: transparent; color: var(--akzent); font: inherit; font-size: 32px; line-height: 1; font-weight: 300;
}
.kal-segmente { display: flex; gap: 2px; padding: 2px; margin: 0 0 4px; border-radius: 10px; background: var(--feld); }
.kal-segment {
  flex: 1 1 0; min-height: 36px; border: 0; border-radius: 8px; background: transparent;
  color: var(--text); font: inherit; font-size: 15px; font-weight: 500;
}
.kal-segment[aria-pressed="true"] { background: var(--flaeche); box-shadow: 0 1px 3px var(--schatten-hinweis); font-weight: 600; }
.kal-tag { scroll-margin-top: 12px; }
.kal-tag-leer { margin: 0 4px 8px; font-size: 15px; }
.kal-leer { text-align: center; margin: 32px 4px; }
.kal-eintrag {
  width: 100%; border: 0; border-bottom: 0.5px solid var(--linie); background: transparent; color: var(--text);
  font: inherit; text-align: left; scroll-margin: 80px;
}
li:last-child > .kal-eintrag { border-bottom: 0; }
.kal-eintrag:active { background: var(--feld); }
.kal-eintrag .titel { display: flex; flex-direction: column; }
.kal-ort { color: var(--leise); font-size: 14px; }
.kal-serie { flex: 0 0 auto; color: var(--leise); font-size: 15px; }
.kal-hervor { animation: kal-hervor 2.5s ease-out; }
@keyframes kal-hervor { 0%, 60% { background: var(--hervor); } 100% { background: transparent; } }
.kal-mehr { display: flex; justify-content: center; padding: 12px 0; }
.kal-knopf-text {
  min-height: 44px; padding: 0 12px; border: 0; border-radius: 10px; background: transparent;
  color: var(--akzent); font: inherit;
}
.kal-fett { font-weight: 600; }
.kal-gefahr { color: var(--gefahr); }
.kal-plus:focus-visible, .kal-segment:focus-visible, .kal-eintrag:focus-visible, .kal-knopf-text:focus-visible,
.kal-tagfeld:focus-visible, .kal-pfeil:focus-visible, .kal-person:focus-visible,
.kal-tag-knopf:focus-visible, .kal-blatt-knopf:focus-visible, .kal-loeschen:focus-visible, .kal-eingabe:focus-visible {
  outline: 2px solid var(--akzent); outline-offset: 2px;
}

/* Monat */
.kal-monat-kopf { display: flex; align-items: center; justify-content: space-between; margin: 8px 0; }
.kal-monat-kopf h2 { margin: 0; font-size: 20px; font-weight: 700; }
.kal-pfeil { width: 44px; height: 44px; border: 0; border-radius: 10px; background: transparent; color: var(--akzent); font: inherit; font-size: 28px; line-height: 1; }
.kal-raster { background: var(--flaeche); border-radius: var(--radius); padding: 6px; }
.kal-raster-zeile { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.kal-wotage span { text-align: center; font-size: 12px; font-weight: 600; color: var(--leise); padding: 4px 0; }
.kal-tagfeld {
  display: flex; flex-direction: column; align-items: center; gap: 3px; min-height: 52px; padding: 6px 0 4px;
  border: 0; border-radius: 10px; background: transparent; color: var(--text); font: inherit;
}
.kal-tagfeld:active { background: var(--feld); }
.kal-tagzahl { display: inline-flex; align-items: center; justify-content: center; width: min(30px, 100%); aspect-ratio: 1; border-radius: 50%; font-size: 16px; font-variant-numeric: tabular-nums; }
.kal-fremd { color: var(--leise); opacity: 0.55; }
.kal-heute .kal-tagzahl { background: var(--akzent); color: var(--auf-akzent); font-weight: 700; }
.kal-tagfeld .punkte { gap: 2px; min-height: 6px; }
.kal-tagfeld .punkt { width: 6px; height: 6px; }

/* Formular */
.kal-form { padding-bottom: 24px; }
.kal-form-kopf {
  position: sticky; top: 0; z-index: 5; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  margin: 0 -16px 8px; padding: calc(env(safe-area-inset-top, 0px) + 8px) 8px 8px; background: var(--grund);
  border-bottom: 0.5px solid var(--linie);
}
.kal-form-kopf h2 { margin: 0; font-size: 17px; font-weight: 600; text-align: center; }
.kal-form-kopf .kal-knopf-text:first-child { justify-self: start; }
.kal-form-kopf .kal-knopf-text:last-child { justify-self: end; }
.kal-gruppe { margin: 0 0 20px; background: var(--flaeche); border-radius: var(--radius); overflow: hidden; }
.kal-gruppe > * { border-bottom: 0.5px solid var(--linie); }
.kal-gruppe > *:last-child { border-bottom: 0; }
.kal-gruppen-titel { margin: 0 4px 6px; font-size: 13px; font-weight: 600; color: var(--leise); text-transform: uppercase; letter-spacing: 0.03em; }
.kal-feld, .kal-zeile-feld { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding: 4px 4px 4px 16px; }
.kal-feld-name { flex: 0 0 auto; }
.kal-eingabe {
  min-width: 0; min-height: 44px; padding: 8px 12px; border: 0; border-radius: 10px;
  background: transparent; color: var(--text); font: inherit;
}
.kal-feld .kal-eingabe { flex: 0 1 auto; text-align: right; color: var(--akzent); }
.kal-feld select.kal-eingabe { appearance: none; -webkit-appearance: none; }
.kal-gruppe > .kal-eingabe { display: block; width: 100%; padding: 12px 16px; border-radius: 0; }
.kal-zeile-feld { justify-content: flex-start; }
.kal-zeile-feld .kal-eingabe { width: 72px; text-align: center; background: var(--feld); }
.kal-notiz { resize: vertical; min-height: 88px; }
.kal-schalter {
  appearance: none; -webkit-appearance: none; position: relative; flex: 0 0 auto; width: 51px; height: 31px; margin: 0 8px 0 0;
  border-radius: 16px; background: var(--feld); transition: background 0.2s;
}
.kal-schalter::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%;
  background: var(--flaeche); box-shadow: 0 1px 3px var(--schatten-hinweis); transition: transform 0.2s;
}
.kal-schalter:checked { background: var(--einkauf); }
.kal-schalter:checked::after { transform: translateX(20px); }
.kal-schalter:focus-visible { outline: 2px solid var(--akzent); outline-offset: 2px; }
.kal-tage { display: flex; justify-content: space-between; gap: 4px; padding: 8px 12px; }
.kal-tag-knopf {
  flex: 1 1 0; min-width: 0; height: 44px; border: 0; border-radius: 10px; background: var(--feld);
  color: var(--text); font: inherit; font-size: 15px;
}
.kal-tag-knopf[aria-pressed="true"] { background: var(--akzent); color: var(--auf-akzent); font-weight: 600; }
.kal-radios { display: grid; padding: 4px 16px; }
.kal-radio { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.kal-radio input { width: 20px; height: 20px; margin: 0; accent-color: var(--akzent); }
.kal-hinweis { margin: 0; padding: 10px 16px; color: var(--leise); font-size: 14px; }
.kal-personen { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 20px; }
.kal-person {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px 0 12px;
  border: 2px solid transparent; border-radius: 22px; background: var(--flaeche); color: var(--text); font: inherit;
}
.kal-person[aria-pressed="true"] { border-color: var(--farbe, var(--akzent)); background: var(--feld); font-weight: 600; }
.kal-person[aria-pressed="false"] .punkt { opacity: 0.45; }
.kal-loeschen {
  display: block; width: 100%; min-height: 48px; border: 0; border-radius: var(--radius);
  background: var(--flaeche); color: var(--gefahr); font: inherit; font-weight: 500;
}
.kal-fehler { margin: 0 4px 12px; color: var(--gefahr); font-weight: 600; }

/* Aktionsblatt (Serien-Rückfrage) */
.kal-blatt-grund {
  position: fixed; inset: 0; z-index: 30; display: flex; align-items: flex-end; justify-content: center;
  background: var(--abdunkeln); padding: 0 8px calc(var(--unten) + 8px);
}
.kal-blatt { width: 100%; max-width: 480px; display: grid; gap: 8px; }
.kal-blatt-gruppe { display: grid; background: var(--flaeche); border-radius: var(--radius); overflow: hidden; }
.kal-blatt-text { margin: 0; padding: 14px 16px; text-align: center; color: var(--leise); font-size: 13px; border-bottom: 0.5px solid var(--linie); }
.kal-blatt-knopf {
  min-height: 56px; border: 0; border-bottom: 0.5px solid var(--linie); background: transparent;
  color: var(--akzent); font: inherit; font-size: 19px;
}
.kal-blatt-knopf:last-child { border-bottom: 0; }
.kal-blatt-knopf.kal-gefahr { color: var(--gefahr); }

@media (min-width: 700px) {
  .kachel { min-height: 132px; }
}

/* Einrichtung und Anmeldung (/einrichten, /willkommen) */
.ein-seite { padding-top: 24px; padding-bottom: 32px; }
.ein-zaehler { margin: 12px 4px 0; }
.ein-text { margin: 8px 4px 20px; font-size: 18px; }
.ein-knopf {
  display: flex; align-items: center; justify-content: center; width: 100%; min-height: 56px;
  border: 0; border-radius: 14px; background: var(--akzent); color: var(--auf-akzent);
  font: inherit; font-size: 19px; font-weight: 600; text-decoration: none;
}
.ein-knopf:active { transform: scale(0.98); }
.ein-knopf:disabled { opacity: 0.6; }
.ein-text-knopf {
  display: block; margin: 12px auto 0; min-height: 44px; padding: 0 16px; border: 0; background: transparent;
  color: var(--akzent); font: inherit;
}
.ein-knopf:focus-visible, .ein-text-knopf:focus-visible { outline: 3px solid var(--akzent); outline-offset: 2px; }
.ein-meldung {
  margin: 14px 4px 0; padding: 12px 14px; border-radius: 12px;
  background: var(--flaeche); color: var(--gefahr); box-shadow: 0 1px 2px var(--schatten);
}
.ein-anleitung { list-style: none; margin: 0 0 12px; padding: 0; background: var(--flaeche); border-radius: var(--radius); }
.ein-anleitung li { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; border-bottom: 0.5px solid var(--linie); }
.ein-anleitung li:last-child { border-bottom: 0; }
.ein-nr {
  flex: 0 0 auto; width: 28px; height: 28px; border-radius: 50%; background: var(--hervor); color: var(--akzent);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px;
}
.ein-symbol { vertical-align: -6px; margin: 0 2px; }

/* Startseite: Hinweis auf ungesendete Aenderungen (M5), Zahnrad oben rechts. */
.ausstehend { margin: 0 4px 8px; color: var(--gefahr); font-size: 15px; font-weight: 600; }
.kopf-start { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.zahnrad {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: center; width: 44px; height: 44px;
  margin-top: 4px; border-radius: 50%; color: var(--akzent); text-decoration: none;
}
.zahnrad svg { width: 26px; height: 26px; }
.zahnrad:active { background: var(--feld); }
.zahnrad:focus-visible { outline: 2px solid var(--akzent); outline-offset: 2px; }

/* Einstellungen: Gruppen wie in iOS. */
.es-kopf { padding-bottom: 4px; }
.es-gruppe .abschnitt { margin-top: 24px; }
.es-unterzeile { margin: 16px 4px 8px; font-size: 15px; font-weight: 600; color: var(--leise); }
.es-gruppe .leise { margin-top: 0; font-size: 15px; }
.es-karte { padding: 10px; border-radius: var(--radius); background: var(--flaeche); box-shadow: 0 1px 2px var(--schatten); }
.es-segmente { display: flex; gap: 2px; padding: 2px; border-radius: 10px; background: var(--feld); }
.es-segment {
  flex: 1 1 0; min-width: 0; min-height: 44px; padding: 0 4px; border: 0; border-radius: 8px; background: transparent;
  color: var(--text); font: inherit; font-size: 15px; font-weight: 500; white-space: nowrap;
}
html[data-groesse="gross"] .es-segment { font-size: 14px; padding: 0 2px; }
.es-segment[aria-checked="true"] { background: var(--flaeche); box-shadow: 0 1px 3px var(--schatten-hinweis); font-weight: 600; }
.es-segment:focus-visible, .es-schalter:focus-visible, .es-knopf:focus-visible, .es-feld:focus-visible { outline: 2px solid var(--akzent); outline-offset: 2px; }
.es-zeile { justify-content: space-between; min-height: 52px; }
.es-text { flex: 1 1 auto; min-width: 0; }
.es-schalter {
  position: relative; flex: 0 0 auto; width: 51px; height: 31px; padding: 0; border: 0; border-radius: 16px;
  background: var(--linie); transition: background 0.15s;
}
.es-schalter::before { content: ""; position: absolute; inset: -7px -4px; } /* Tippflaeche >= 44 px */
.es-schalter[aria-checked="true"] { background: var(--einkauf); }
.es-schalter-knauf {
  position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%;
  background: var(--auf-akzent); box-shadow: 0 1px 3px var(--schatten-hinweis); transition: transform 0.15s;
}
.es-schalter[aria-checked="true"] .es-schalter-knauf { transform: translateX(20px); }
.es-hinweis { margin: 8px 4px 0; color: var(--gefahr); font-size: 15px; }
.es-profil { display: grid; gap: 10px; }
.es-feld {
  width: 100%; min-height: 44px; padding: 8px 12px; border: 0; border-radius: 10px;
  background: var(--feld); color: var(--text); font: inherit;
}
.es-knopf {
  min-height: 44px; padding: 0 16px; border: 0; border-radius: 12px; background: var(--feld);
  color: var(--akzent); font: inherit; font-weight: 600;
}
.es-knopf:disabled { opacity: 0.6; }
.es-knopf-voll { background: var(--akzent); color: var(--auf-akzent); }
.es-knopf-leise { background: transparent; font-weight: 400; }
.es-gefahr { color: var(--gefahr); }
.es-knopfspalte { display: grid; gap: 4px; }
.es-knopf-neutral { color: var(--text); font-weight: 500; }
.es-frage { padding: 12px 16px; border-radius: var(--radius); background: var(--flaeche); }
.es-frage p { margin: 0 0 4px; }
.es-knopfreihe { display: flex; justify-content: flex-end; gap: 8px; }

/* Notizen: ein ganzseitiges Textfeld, waechst mit dem Inhalt (kein eigener Scrollbalken) */
.nz-feld {
  display: block; width: 100%; resize: none; overflow: hidden;
  min-height: calc(100dvh / var(--zoom) - var(--reiter-hoehe) - var(--unten) - env(safe-area-inset-top, 0px) - 112px);
  margin: 0; padding: 16px 4px 8px; border: 0; border-radius: 0;
  background: transparent; color: var(--text); font: inherit; line-height: 1.45;
}
.nz-feld:focus { outline: none; }
.nz-feld::placeholder { color: var(--leise); }
.nz-kopf { order: -1; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 4px 0; }
.nz-status {
  min-height: 20px; margin: 0; text-align: right;
  color: var(--leise); font-size: 13px; line-height: 20px;
}
#ansicht-notizen:not([hidden]) { display: flex; flex-direction: column; }
.es-name { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.es-name-text { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
