/* Familienplaner – ruhiges Wanddisplay fürs iPad.
   Bewusst ohne neuere CSS-Features (kein flex-gap, color-mix, inset, :is),
   damit es auch auf älteren iPads (ab iOS 12) läuft. Dunkel auf Wunsch (Setup → Darstellung).

   Formen: Karten 10px, Knöpfe und Felder 8px, Chips 6px, Termine 4px. Rund nur Avatare und Haken.
   Farbe: eine Akzentfarbe (Grün) für Aktionen und Auswahl; die Personenfarben tragen den Rest. */

@font-face { font-family: "Geist"; src: url("fonts/Geist-Regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Geist"; src: url("fonts/Geist-Medium.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Geist"; src: url("fonts/Geist-SemiBold.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }

:root {
  --bg: #f1f2f0;
  --rail: #e8eae7;
  --surface: #fdfdfc;
  --soft: #f2f3f1;
  --line: #e1e4e0;
  --text: #16191a;
  --muted: #5a6066;
  --faint: #8b9196;
  --accent: #1e6a55;
  --accent-soft: #dcece5;
  --on-accent: #ffffff;
  --warn: #b4432a;
  --warn-soft: #f5e0d9;
  --ok: #2f8a5f;
  --scrim: rgba(17, 22, 20, .42);
  --ghost: rgba(253, 253, 252, .55);
  --shadow: 0 1px 2px rgba(20, 30, 25, .05), 0 6px 18px rgba(20, 30, 25, .05);
  --shadow-lg: 0 24px 64px rgba(14, 22, 18, .22), 0 2px 6px rgba(14, 22, 18, .08);
  --r-card: 10px;
  --r-ctl: 8px;
  --r-chip: 6px;
  --r-tag: 4px;
  --ease: cubic-bezier(.16, .84, .44, 1);   /* Einblenden (Ansichtswechsel, Bilder) */
  --ease-ui: cubic-bezier(.23, 1, .32, 1);  /* Rückmeldung auf Tippen */
  color-scheme: light;
}
/* Darstellung (Setup): ohne Angabe hell; «dunkel» immer; «auto» folgt dem Gerät */
:root[data-theme="dark"] {
  --bg: #111413;
  --rail: #0b0d0c;
  --surface: #1a1e1c;
  --soft: #232826;
  --line: #2d3330;
  --text: #eceeed;
  --muted: #a6aeaa;
  --faint: #727a76;
  --accent: #5fc4a1;
  --accent-soft: #173a2f;
  --on-accent: #0b1a14;
  --warn: #f08b70;
  --warn-soft: #3b221b;
  --ok: #6bd39a;
  --scrim: rgba(0, 0, 0, .6);
  --ghost: rgba(26, 30, 28, .6);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .25);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, .55), 0 2px 6px rgba(0, 0, 0, .3);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --bg: #111413;
    --rail: #0b0d0c;
    --surface: #1a1e1c;
    --soft: #232826;
    --line: #2d3330;
    --text: #eceeed;
    --muted: #a6aeaa;
    --faint: #727a76;
    --accent: #5fc4a1;
    --accent-soft: #173a2f;
    --on-accent: #0b1a14;
    --warn: #f08b70;
    --warn-soft: #3b221b;
    --ok: #6bd39a;
    --scrim: rgba(0, 0, 0, .6);
    --ghost: rgba(26, 30, 28, .6);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .25);
    --shadow-lg: 0 24px 64px rgba(0, 0, 0, .55), 0 2px 6px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
/* Wanddisplay: die Seite selbst bewegt sich nie, nur Bereiche darin scrollen.
   Sonst stellt iOS beim Start eine alte Scroll-Position wieder her und die Kopfzeile ist weg. */
body { position: fixed; top: 0; right: 0; bottom: 0; left: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 400 17px/1.45 "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none; user-select: none; overflow: hidden;
  -webkit-text-size-adjust: 100%;
}
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; padding: 0; }
input, select, textarea { font: inherit; color: var(--text); -webkit-user-select: text; user-select: text; caret-color: var(--accent); }
::selection { background: var(--accent-soft); color: var(--text); }
a { color: var(--accent); text-underline-offset: 3px; }
[hidden] { display: none !important; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
::-webkit-scrollbar-track { background: transparent; }

/* Phosphor-Icons (Füllform) */
.ic { display: inline-block; width: 22px; height: 22px; line-height: 0; flex: none; }
.ic svg, .btn svg, .nav-btn svg { width: 100%; height: 100%; fill: currentColor; }

#app { display: flex; flex-direction: column; height: 100%; }

/* ---------- Navigation unten: volle Breite für Personen und Wochentage ---------- */
.nav {
  flex: none; display: flex; height: 64px; height: calc(64px + env(safe-area-inset-bottom)); padding: 0 12px env(safe-area-inset-bottom);
  background: var(--rail); border-top: 1px solid var(--line);
}
.nav-btn {
  flex: 1; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--muted); font-size: 13px; font-weight: 500; letter-spacing: -.005em;
  -webkit-transition: color .2s var(--ease-ui); transition: color .2s var(--ease-ui);
}
.nav-btn .ic { width: 24px; height: 24px; margin-bottom: 4px; }
.nav-btn.on { color: var(--accent); font-weight: 600; }
.nav-btn.on:before { content: ''; position: absolute; top: -1px; left: 50%; width: 24px; height: 2px; margin-left: -12px; background: var(--accent); border-radius: 0 0 2px 2px; }
.nav-btn:active .ic { -webkit-transform: scale(.92); transform: scale(.92); }

/* ---------- Kopfzeile: Uhr, Datum, Wetter, Setup ---------- */
.main { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.top { display: flex; align-items: center; padding: 12px 20px 6px; padding-top: calc(12px + env(safe-area-inset-top)); }
.top-fill { flex: 1; }
.clock { display: flex; align-items: baseline; }
.time { font-size: 32px; font-weight: 600; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; margin-right: 12px; }
.date { font-size: 17px; font-weight: 500; color: var(--muted); letter-spacing: -.01em; }
.weather { display: flex; align-items: center; padding: 6px 8px; border-radius: var(--r-ctl); }
.weather .wi { width: 26px; height: 26px; margin-right: 8px; color: var(--accent); }
.weather .wt { font-size: 21px; font-weight: 600; letter-spacing: -.02em; margin-right: 8px; font-variant-numeric: tabular-nums; }
.weather .ws { font-size: 13px; color: var(--muted); text-align: left; line-height: 1.3; }
.gear { width: 44px; height: 44px; margin-left: 6px; display: flex; align-items: center; justify-content: center; border-radius: var(--r-ctl); color: var(--faint); }
.gear .ic { width: 22px; height: 22px; }
.gear.on { color: var(--accent); background: var(--accent-soft); }

.view { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 6px 20px 14px; }
.scroll { overflow-y: auto; -webkit-overflow-scrolling: touch; }

/* Ansichtswechsel: ruhig einblenden, nur einmal pro Wechsel.
   Der Inhalt ist immer sichtbar; nur die Animation startet unsichtbar («backwards»).
   Läuft sie nicht (Seite im Hintergrund, Bildschirmschoner), bleibt nichts leer. */
@media (prefers-reduced-motion: no-preference) {
  .enter > * { -webkit-animation: rise .5s var(--ease) backwards; animation: rise .5s var(--ease) backwards; }
  .enter > *:nth-child(2) { -webkit-animation-delay: .06s; animation-delay: .06s; }
  .enter > *:nth-child(3) { -webkit-animation-delay: .12s; animation-delay: .12s; }
  .enter > *:nth-child(n+4) { -webkit-animation-delay: .18s; animation-delay: .18s; }
  .enter > .people-cols { -webkit-animation: none; animation: none; }
  .enter .people-cols > * { -webkit-animation: rise .5s var(--ease) backwards; animation: rise .5s var(--ease) backwards; }
  .enter .people-cols > *:nth-child(2) { -webkit-animation-delay: .12s; animation-delay: .12s; }
  .enter .people-cols > *:nth-child(3) { -webkit-animation-delay: .18s; animation-delay: .18s; }
  .enter .people-cols > *:nth-child(n+4) { -webkit-animation-delay: .24s; animation-delay: .24s; }
}
@-webkit-keyframes rise { from { opacity: 0; -webkit-transform: translateY(16px); } }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }

/* ---------- Werkzeugleiste ---------- */
.bar { display: flex; align-items: center; flex-wrap: wrap; margin-bottom: 16px; min-height: 50px; }
.bar > * { margin-right: 10px; }
.bar h2 { margin: 0 14px 0 2px; font-size: 26px; font-weight: 600; letter-spacing: -.02em; }
.bar .fill { flex: 1; margin: 0; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 18px;
  border-radius: var(--r-ctl); background: var(--surface); box-shadow: var(--shadow); font-weight: 500; white-space: nowrap;
  -webkit-transition: -webkit-transform .16s var(--ease-ui), background .2s; transition: transform .16s var(--ease-ui), background .2s;
}
.btn .ic { width: 20px; height: 20px; margin-right: 8px; }
.btn:active { -webkit-transform: scale(.97); transform: scale(.97); }
.btn.sq { width: 48px; padding: 0; }
.btn.sq .ic { margin: 0; }
.btn.primary { background: var(--accent); color: var(--on-accent); box-shadow: none; font-weight: 600; }
.btn.danger { color: var(--warn); }
.btn.plain { background: transparent; box-shadow: none; color: var(--muted); }
.btn[disabled] { opacity: .45; }
.seg { display: inline-flex; padding: 3px; border-radius: var(--r-ctl); background: var(--rail); }
.seg button { padding: 9px 16px; border-radius: var(--r-chip); color: var(--muted); font-weight: 500; }
.seg button.on { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow); }

.card { background: var(--surface); border-radius: var(--r-card); box-shadow: var(--shadow); }
.muted { color: var(--muted); }
.small { font-size: 15px; }
.empty { color: var(--muted); padding: 16px 4px; font-size: 15px; }
.hint { color: var(--muted); font-size: 15px; line-height: 1.5; margin: 4px 0 14px; max-width: 64ch; }

/* ---------- Personen ---------- */
.av { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 50%; color: #fff; font-weight: 600; font-size: 16px; flex: none; }
.av.lg { width: 48px; height: 48px; font-size: 20px; }
.av.xs { width: 24px; height: 24px; font-size: 12px; }
.people-cols { flex: 1; min-height: 0; display: -ms-grid; display: grid; grid-gap: 12px; grid-auto-flow: column; grid-auto-columns: minmax(180px, 1fr); overflow-x: auto; -webkit-overflow-scrolling: touch; }
.pcol { display: flex; flex-direction: column; min-height: 0; padding: 0; overflow: hidden; }
.pcol-head { display: flex; align-items: center; padding: 12px 12px 11px; background: var(--t); border-bottom: 2px solid var(--c); }
.pcol-head .av { margin-right: 10px; }
.pcol-head b { font-size: 19px; font-weight: 600; letter-spacing: -.015em; display: block; line-height: 1.15; }
.pcol-head small { color: var(--muted); font-size: 13px; }
.pcol-head .add { margin-left: auto; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: var(--r-ctl); color: var(--c); }
.pcol-head .add .ic { width: 20px; height: 20px; }
.pcol-body { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 8px; }
.sect { font-size: 13px; font-weight: 600; color: var(--muted); margin: 14px 4px 6px; }
.sect:first-child { margin-top: 8px; }

/* ---------- Einträge (Termin, To-do, Ämtli) ---------- */
.row {
  display: flex; align-items: center; padding: 6px 4px 6px 12px; border-radius: var(--r-ctl); background: var(--soft); margin-bottom: 6px; min-height: 52px;
  -webkit-transition: background .2s, -webkit-transform .16s var(--ease-ui); transition: background .2s, transform .16s var(--ease-ui);
}
.row:active { -webkit-transform: scale(.985); transform: scale(.985); }
.row .tx { flex: 1; min-width: 0; }
/* Ganze Wörter, höchstens zwei Zeilen: keine «Ge-schenk»-Trennungen in schmalen Spalten */
.row .tx { padding: 4px 0; }
.row .tx b { font-size: 16px; font-weight: 500; line-height: 1.3; overflow-wrap: break-word; word-wrap: break-word; -webkit-hyphens: manual; hyphens: manual;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.row .tx small { display: block; color: var(--muted); font-size: 13px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .when { width: 56px; flex: none; color: var(--c, var(--muted)); font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.row.ev { background: var(--t); }
.row.overdue small { color: var(--warn); font-weight: 600; }
.tick { width: 44px; height: 44px; flex: none; display: flex; align-items: center; justify-content: center; }
.tick i {
  width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--c, var(--accent));
  display: flex; align-items: center; justify-content: center; color: #fff;
  -webkit-transition: background .2s var(--ease), -webkit-transform .16s var(--ease-ui); transition: background .2s var(--ease), transform .16s var(--ease-ui);
}
.tick:active i { -webkit-transform: scale(.88); transform: scale(.88); }
.tick svg { width: 15px; height: 15px; fill: currentColor; opacity: 0; -webkit-transform: scale(.6); transform: scale(.6); -webkit-transition: opacity .2s, -webkit-transform .22s var(--ease-ui); transition: opacity .2s, transform .22s var(--ease-ui); }
.done .tick i { background: var(--c, var(--accent)); }
.done .tick svg { opacity: 1; -webkit-transform: none; transform: none; }
.done .tx b { text-decoration: line-through; color: var(--muted); }
/* Ziehen */
.row { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.row.lifted { opacity: .35; }
.row.ghost { position: fixed; z-index: 60; margin: 0; pointer-events: none; background: var(--surface); box-shadow: var(--shadow-lg); -webkit-transform: scale(1.03); transform: scale(1.03); }
.pcol.drop-on { box-shadow: 0 0 0 2px var(--c), var(--shadow); }
.row.drop-before { box-shadow: 0 -3px 0 var(--c, var(--accent)); }


/* ---------- Heute: oben Termine heute/morgen und das Essen ---------- */
.band { display: flex; flex: none; height: 132px; margin-bottom: 12px; overflow: hidden; }
.band-col { flex: 1; min-width: 0; padding: 12px 14px 10px; border-right: 1px solid var(--line); }
.band-l { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.ag { display: flex; align-items: baseline; width: 100%; text-align: left; padding: 3px 0 3px 9px; border-left: 3px solid var(--c); margin-bottom: 3px; }
.ag-t { flex: none; width: 46px; font-size: 14px; font-weight: 600; color: var(--c); font-variant-numeric: tabular-nums; }
.ag-n { flex: 1; min-width: 0; font-size: 16px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ag-empty { color: var(--faint); font-size: 15px; padding-top: 2px; }
.ag-more { color: var(--muted); font-size: 13px; padding-left: 12px; }
.band-meal { flex: 1.15; min-width: 0; display: flex; align-items: stretch; text-align: left; overflow: hidden; }
.band-meal img { width: 42%; flex: none; object-fit: cover; display: block; }
.band-meal > span { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; padding: 12px 16px; }
.band-meal b { font-size: 20px; font-weight: 600; letter-spacing: -.015em; line-height: 1.2; overflow-wrap: break-word; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.band-meal.noimg b { color: var(--text); }
.nowrap { white-space: nowrap; }

/* ---------- Kalender Woche: eine Fläche, Tage durch Linien getrennt ---------- */
.week { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); overflow: hidden; }
.wday { display: flex; flex-direction: column; min-height: 0; padding: 10px 6px; border-left: 1px solid var(--line); }
.wday:first-child { border-left: 0; }
.wday.today { background: var(--accent-soft); }
.wday-h { text-align: center; margin-bottom: 10px; color: var(--muted); font-size: 13px; font-weight: 500; }
.wday-h b { display: block; width: 34px; height: 34px; line-height: 34px; margin: 2px auto 0; border-radius: 50%; font-size: 20px; font-weight: 500; letter-spacing: -.02em; color: var(--text); font-variant-numeric: tabular-nums; }
.wday.today .wday-h { color: var(--accent); font-weight: 600; }
.wday.today .wday-h b { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.wday-b { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
/* Termin: Personenfarbe als Balken links, Titel ganz (höchstens zwei Zeilen) */
.chip { display: block; padding: 5px 7px 5px 8px; margin-bottom: 5px; border-radius: var(--r-tag); border-left: 3px solid var(--c); background: var(--t); font-size: 14px; font-weight: 500; line-height: 1.25; }
.chip i { font-style: normal; color: var(--c); font-size: 12px; font-weight: 600; display: block; font-variant-numeric: tabular-nums; white-space: nowrap; }
.chip .ct { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: break-word; -webkit-hyphens: manual; hyphens: manual; }
.chip.all { font-weight: 600; }
.chip .dots { display: block; margin-top: 4px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 3px; }

/* ---------- Kalender Monat ---------- */
.month { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.mhead, .mrow { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.mhead div { text-align: center; color: var(--muted); font-size: 13px; font-weight: 500; padding: 8px 6px; }
.mrow { flex: 1; min-height: 0; }
.mcell { border-top: 1px solid var(--line); border-left: 1px solid var(--line); padding: 4px 5px; overflow: hidden; }
.mcell:first-child { border-left: 0; }
.mcell.out .mnum { color: var(--faint); }
.mcell.out .chip { opacity: .5; }
.mnum { display: inline-block; width: 26px; height: 26px; line-height: 26px; text-align: center; border-radius: 50%; font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; }
.mcell.today .mnum { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.mcell .chip { padding: 2px 6px; margin-bottom: 3px; font-size: 13px; }
.mcell .chip .ct { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mcell .more { font-size: 12px; color: var(--muted); padding-left: 4px; }

/* ---------- Essen: Bilder zeigen, was es gibt. Mittag/Abend als Zeilentitel, damit die Tage breiter sind ---------- */
.meals { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-template-rows: auto auto 1fr auto 1fr; grid-gap: 8px; }
.meals .mh { text-align: center; color: var(--muted); font-size: 13px; font-weight: 500; }
.meals .mh b { display: block; width: 32px; height: 32px; line-height: 32px; margin: 2px auto 0; border-radius: 50%; font-size: 19px; font-weight: 500; letter-spacing: -.02em; color: var(--text); font-variant-numeric: tabular-nums; }
.meals .mh.today { color: var(--accent); font-weight: 600; }
.meals .mh.today b { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.meals .ml { grid-column: 1 / -1; font-weight: 600; color: var(--muted); font-size: 13px; margin: 4px 2px -2px; }
.meal {
  position: relative; padding: 0; display: flex; flex-direction: column; justify-content: flex-end;
  font-size: 15px; font-weight: 500; line-height: 1.25; overflow: hidden; text-align: left;
}
.meal .mimg { flex: 1; min-height: 0; width: 100%; object-fit: cover; display: block; }
.meal .mt { padding: 8px 9px 9px; flex: none; }
.meal .mt span { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: break-word; -webkit-hyphens: manual; hyphens: manual; }
.meal.noimg { justify-content: center; }
.meal.noimg .mt span { -webkit-line-clamp: 4; }
.meal.none { align-items: center; justify-content: center; color: var(--faint); box-shadow: none; background: transparent; border: 1px dashed var(--line); }
.meal.none .ic { width: 20px; height: 20px; }

/* ---------- Einkauf ---------- */
.shop { flex: 1; min-height: 0; display: flex; flex-direction: column; width: 100%; padding: 16px 18px; }
.addrow { display: flex; margin-bottom: 12px; }
.addrow input { flex: 1; margin-right: 10px; }
.item { display: flex; align-items: center; padding: 11px 4px; border-bottom: 1px solid var(--line); font-size: 18px; }
.item .box {
  width: 28px; height: 28px; border-radius: 6px; border: 2px solid var(--accent); margin-right: 14px; flex: none;
  display: flex; align-items: center; justify-content: center; color: var(--on-accent);
  -webkit-transition: background .2s var(--ease); transition: background .2s var(--ease);
}
.item .box svg { width: 16px; height: 16px; fill: currentColor; opacity: 0; -webkit-transform: scale(.6); transform: scale(.6); -webkit-transition: opacity .2s, -webkit-transform .22s var(--ease-ui); transition: opacity .2s, transform .22s var(--ease-ui); }
.item.done .box { background: var(--accent); }
.item.done .box svg { opacity: 1; -webkit-transform: none; transform: none; }
.item.done .t { color: var(--muted); text-decoration: line-through; }
.item .t { flex: 1; }
.item .src { color: var(--muted); font-size: 13px; margin-left: 8px; }
.item .x { color: var(--faint); width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; border-radius: var(--r-ctl); }
.item .x svg { width: 16px; height: 16px; fill: currentColor; }
.swipe { position: relative; overflow: hidden; }
.swipe-bg {
  position: absolute; top: 0; right: 0; bottom: 0; left: 0; display: flex; align-items: center; justify-content: flex-end; padding-right: 22px;
  background: var(--warn-soft); color: var(--warn); font-weight: 600; font-size: 15px;
  -webkit-transition: background .15s, color .15s; transition: background .15s, color .15s;
}
.swipe.armed .swipe-bg { background: var(--warn); color: #fff; }
.swipe-bg { visibility: hidden; }
.swipe.moving .swipe-bg { visibility: visible; }
.swipe .item { position: relative; background: var(--surface); }
.shop .sect:first-child { margin-top: 4px; }
.quick { display: flex; flex-wrap: wrap; margin: 0 0 6px; }
.quick button { padding: 8px 14px; margin: 0 8px 8px 0; border-radius: var(--r-chip); background: var(--soft); color: var(--text); font-size: 15px; font-weight: 500; }
.quick button:active { background: var(--accent-soft); color: var(--accent); }

/* Einkaufsbudget */
.budget { display: flex; align-items: center; width: 100%; padding: 12px 18px; margin-bottom: 12px; text-align: left; font-size: 16px; }
.budget .bl { flex: none; }
.budget .bar-track { flex: 1; height: 8px; margin: 0 18px; border-radius: 4px; background: var(--soft); overflow: hidden; }
.budget .bar-track i { display: block; height: 100%; border-radius: 4px; background: var(--accent); }
.budget.over .bar-track i { background: var(--warn); }
.budget.over .bl.muted { color: var(--warn); }
.addrow input[type=number] { flex: 0 0 140px; }

/* Druckansicht der Einkaufsliste */
#print { display: none; }
@media print {
  @page { margin: 14mm; }
  body { background: #fff; color: #000; }
  #app, #modal-root, #toast, .fab { display: none !important; }
  #print { display: block; color: #000; font-size: 12pt; }
  #print h1 { font-size: 20pt; font-weight: 600; margin: 0; }
  #print > p { margin: 2pt 0 14pt; color: #555; }
  #print .pcols { -webkit-column-count: 2; column-count: 2; -webkit-column-gap: 12mm; column-gap: 12mm; }
  #print section { -webkit-column-break-inside: avoid; break-inside: avoid; margin-bottom: 10pt; }
  #print h2 { font-size: 11pt; font-weight: 600; color: #444; margin: 0 0 4pt; padding-bottom: 2pt; border-bottom: .5pt solid #999; }
  #print .pi { display: flex; align-items: center; padding: 3pt 0; }
  #print .pi span { width: 10pt; height: 10pt; border: 1pt solid #000; border-radius: 2pt; margin-right: 7pt; flex: none; }
}

/* ---------- Einstellungen ---------- */
/* Setup in vier Bereiche (Familie, Anzeige, Essen & Einkauf, Gerät), je zwei Spalten */
.settings { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: 8px; }
.sgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); grid-gap: 12px; align-items: start; }
.settings .card { padding: 18px 20px; }
.settings h3 { margin: 0 0 8px; font-size: 18px; font-weight: 600; letter-spacing: -.01em; }
.line { display: flex; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.line:last-child { border-bottom: 0; }
.line .grow { flex: 1; min-width: 0; margin: 0 12px; }
.line .grow b { font-weight: 500; }
.line .grow small { display: block; color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.line .thumb { width: 54px; height: 54px; border-radius: var(--r-chip); object-fit: cover; flex: none; }
.status { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--faint); margin-right: 8px; }
.status.ok { background: var(--ok); }
.status.bad { background: var(--warn); }

/* ---------- Formulare ---------- */
input[type=text], input[type=url], input[type=date], input[type=time], input[type=password], input[type=number], select, textarea {
  -webkit-appearance: none; appearance: none; width: 100%; min-height: 50px; padding: 12px 14px; border-radius: var(--r-ctl);
  border: 1px solid var(--line); background: var(--soft); outline: none; font-size: 17px;
  -webkit-transition: border-color .15s, background .15s; transition: border-color .15s, background .15s;
}
::-webkit-input-placeholder { color: var(--muted); }
::placeholder { color: var(--muted); }
select { background-image: none; }
textarea { min-height: 96px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); background: var(--surface); }
.f { display: block; margin-bottom: 16px; }
.f > span { display: block; font-size: 14px; font-weight: 500; color: var(--muted); margin-bottom: 7px; }
.two { display: grid; grid-template-columns: 1fr 1fr; grid-gap: 12px; }
.opts { display: flex; flex-wrap: wrap; }
.opts button { padding: 9px 15px; margin: 0 8px 8px 0; border-radius: var(--r-chip); background: var(--soft); border: 2px solid transparent; display: inline-flex; align-items: center; font-weight: 500; }
.opts button .av { margin: -4px 8px -4px -8px; }
.opts button.on { border-color: var(--c, var(--accent)); background: var(--t, var(--accent-soft)); font-weight: 600; }
.colors button { width: 42px; height: 42px; border-radius: 50%; margin: 0 8px 8px 0; border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--line); }
.colors button.on { box-shadow: 0 0 0 3px var(--text); }
.check { display: flex; align-items: center; margin-bottom: 14px; }
.check input { width: 24px; height: 24px; margin: 0 10px 0 0; accent-color: var(--accent); }

/* Schalter */
.toggle { cursor: pointer; }
.toggle .grow { margin-left: 0; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle i { position: relative; width: 52px; height: 32px; border-radius: 16px; background: var(--line); flex: none; -webkit-transition: background .2s; transition: background .2s; }
.toggle i:after { content: ''; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); -webkit-transition: -webkit-transform .22s var(--ease); transition: transform .22s var(--ease); }
.toggle input:checked + i { background: var(--accent); }
.toggle input:checked + i:after { -webkit-transform: translateX(20px); transform: translateX(20px); }

/* ---------- Dialog ---------- */
.modal-bg { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: var(--scrim); display: flex; align-items: center; justify-content: center; padding: 24px; z-index: 50; }
.modal {
  width: 100%; max-width: 620px; max-height: 92%; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 26px;
  background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg);
}
@media (prefers-reduced-motion: no-preference) {
  .modal-bg { -webkit-animation: fade .2s var(--ease); animation: fade .2s var(--ease); }
  .modal { -webkit-animation: pop .28s var(--ease); animation: pop .28s var(--ease); }
}
@-webkit-keyframes fade { from { opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
@-webkit-keyframes pop { from { opacity: 0; -webkit-transform: translateY(12px) scale(.98); } }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.98); } }
.modal.wide { max-width: 880px; }
.modal h2 { margin: 0 0 16px; font-size: 24px; font-weight: 600; letter-spacing: -.02em; }
.actions { display: flex; justify-content: flex-end; flex-wrap: wrap; margin-top: 20px; }
.actions .btn { margin: 0 0 8px 10px; }
.actions .left { margin-right: auto; margin-left: 0; }
.detail { display: flex; margin: 8px 0; }
.detail .k { width: 90px; color: var(--muted); flex: none; }

/* QR */
.qr { text-align: center; }
.qr svg, .qr img { width: 300px; height: 300px; max-width: 100%; border-radius: var(--r-ctl); background: #fff; }
.qr p { color: var(--muted); font-size: 15px; margin: 12px auto 0; max-width: 420px; }

/* KI-Rezepte */
.recipes { display: grid; grid-template-columns: 1fr 1fr; grid-gap: 14px; }
.recipe { padding: 0 0 14px; border-radius: var(--r-card); background: var(--soft); display: flex; flex-direction: column; overflow: hidden; }
.recipe > :not(.rimg) { margin-left: 16px; margin-right: 16px; }
.recipe .rimg { width: 100%; height: 160px; object-fit: cover; display: block; margin-bottom: 14px; }
.recipe .rimg.ph { background: var(--line); }
.recipe img.rimg { opacity: 0; -webkit-transition: opacity .5s var(--ease); transition: opacity .5s var(--ease); }
.recipe img.rimg.in { opacity: 1; }
.recipe h4 { margin: 0 0 4px; font-size: 18px; font-weight: 600; letter-spacing: -.01em; line-height: 1.25; }
.recipe .meta { color: var(--muted); font-size: 14px; margin-bottom: 8px; }
.recipe p { margin: 0 0 8px; font-size: 15px; color: var(--muted); }
.recipe .ing { font-size: 14px; color: var(--text); margin-bottom: 12px; flex: 1; }
.recipe .btns { display: flex; flex-wrap: wrap; }
.recipe .btns .btn { min-height: 42px; padding: 0 14px; font-size: 15px; margin: 0 6px 6px 0; }
@media (prefers-reduced-motion: reduce) { .recipe img.rimg { -webkit-transition: none; transition: none; } }
/* Laden: Platzhalter in der Form der Ergebnisse statt Drehrad */
.skeleton { display: grid; grid-template-columns: 1fr 1fr; grid-gap: 14px; }
.skeleton div { height: 300px; border-radius: var(--r-card); background: var(--soft); }
@media (prefers-reduced-motion: no-preference) {
  .skeleton div { -webkit-animation: breathe 1.4s ease-in-out infinite; animation: breathe 1.4s ease-in-out infinite; }
}
@-webkit-keyframes breathe { 50% { opacity: .55; } }
@keyframes breathe { 50% { opacity: .55; } }
.spinner { width: 32px; height: 32px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); margin: 20px auto; -webkit-animation: spin .9s linear infinite; animation: spin .9s linear infinite; }
@-webkit-keyframes spin { to { -webkit-transform: rotate(360deg); } }
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed; left: 50%; bottom: 30px; -webkit-transform: translateX(-50%); transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 13px 20px; border-radius: var(--r-ctl); z-index: 100; max-width: 90%; text-align: center;
  font-weight: 500; box-shadow: var(--shadow-lg); display: flex; align-items: center;
}
@media (prefers-reduced-motion: no-preference) {
  .toast:not([hidden]) { -webkit-animation: toastIn .22s var(--ease-ui); animation: toastIn .22s var(--ease-ui); }
}
@-webkit-keyframes toastIn { from { opacity: 0; -webkit-transform: translate(-50%, 12px); } }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 12px); } }
.toast button { margin-left: 18px; color: var(--accent-soft); font-weight: 600; }

.fab {
  position: fixed; right: 28px; bottom: 28px; bottom: calc(28px + env(safe-area-inset-bottom)); width: 66px; height: 66px; border-radius: 50%;
  background: var(--accent); color: var(--on-accent); display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 24px rgba(20, 60, 45, .28); z-index: 20; -webkit-transition: -webkit-transform .16s var(--ease-ui); transition: transform .16s var(--ease-ui);
}
.fab svg { width: 28px; height: 28px; fill: currentColor; }
.fab:active { -webkit-transform: scale(.94); transform: scale(.94); }

/* ---------- Hochformat / kleine Bildschirme ---------- */
@media (max-width: 900px) {
  .nav { padding: 0 4px env(safe-area-inset-bottom); }
  .nav-btn { font-size: 12px; }
  .top, .view { padding-left: 14px; padding-right: 14px; }
  .band { height: auto; flex-wrap: wrap; }
  .band-col { flex: 1 1 45%; }
  .band-meal { flex: 1 1 100%; height: 96px; border-top: 1px solid var(--line); }
  .people-cols { grid-auto-flow: row; grid-auto-columns: auto; grid-template-columns: 1fr 1fr; grid-auto-rows: minmax(260px, auto); overflow-x: hidden; overflow-y: auto; }
  .pcol-body { overflow: visible; }
  .week { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 46%; overflow-x: auto; }
  .meals { grid-template-columns: repeat(7, 128px); overflow-x: auto; }
  .recipes, .skeleton { grid-template-columns: 1fr; }
  .sgrid { grid-template-columns: 1fr; }
  .two { grid-template-columns: 1fr; }
  .meal-hero img { width: 180px; height: 130px; }
  .meal-hero b { font-size: 22px; }
}

/* ---------- Schule ---------- */
.school { flex: 1; min-height: 0; display: -ms-grid; display: grid; grid-template-columns: minmax(0, 1fr) 280px; grid-gap: 12px; }
.tt-wrap { padding: 14px 16px 16px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.tt-row { display: -ms-grid; display: grid; grid-template-columns: 64px repeat(5, minmax(0, 1fr)); grid-gap: 6px; margin-bottom: 6px; }
.tt-head { position: -webkit-sticky; position: sticky; top: -14px; z-index: 1; background: var(--surface); padding-top: 2px; margin-bottom: 8px; }
.tt-day { text-align: center; color: var(--muted); font-size: 15px; font-weight: 500; padding: 6px 0; border-radius: var(--r-chip); }
.tt-day.today { color: var(--c); font-weight: 600; background: var(--t); }
.tt-time { font-size: 13px; color: var(--muted); line-height: 1.25; font-variant-numeric: tabular-nums; padding-top: 7px; }
.tt-time b { display: block; color: var(--text); font-weight: 500; font-size: 14px; }
.tt-cell { position: relative; min-height: 48px; padding: 6px 4px; border-radius: var(--r-chip); overflow-wrap: break-word; -webkit-hyphens: manual; hyphens: manual; background: var(--soft); font-size: 15px; font-weight: 500; line-height: 1.2; text-align: center; color: var(--text);
  word-wrap: break-word; -webkit-hyphens: auto; hyphens: auto; -webkit-transition: -webkit-transform .16s var(--ease-ui); transition: transform .16s var(--ease-ui); }
.tt-cell:active { -webkit-transform: scale(.97); transform: scale(.97); }
.tt-cell.on { background: var(--t); }
.tt-cell.today { box-shadow: inset 0 0 0 1.5px var(--c); }
.tt-cell.exam { background: var(--c); color: #fff; }
.tt-cell .ic { position: absolute; top: 4px; right: 5px; width: 14px; height: 14px; }
.tt-cell .ic svg { width: 14px; height: 14px; fill: currentColor; }
.tt-gap { margin: 10px 0 12px 70px; font-size: 13px; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 6px; }
.exams { display: flex; flex-direction: column; min-height: 0; padding: 0; overflow: hidden; }
.exams-h { display: flex; align-items: center; padding: 14px 14px 10px 18px; }
.exams-h h3 { flex: 1; margin: 0; font-size: 19px; font-weight: 600; letter-spacing: -.01em; }
.exams-b { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 0 12px 12px; }
.row.exam, .row.school-day { background: var(--soft); }
.row.exam.soon { background: var(--t); }
.row.exam .when, .row.school-day .when { display: flex; align-items: center; width: 40px; }
.row.exam .when svg, .row.school-day .when svg { width: 22px; height: 22px; fill: var(--c); }
.intro { max-width: 520px; padding: 28px; }
.intro > .ic svg { width: 36px; height: 36px; fill: var(--accent); }
.intro h3 { margin: 10px 0 4px; font-size: 21px; font-weight: 600; }
.line.per input[type=time] { width: 116px; min-height: 44px; margin: 0 8px; }
@media (max-width: 900px) {
  .school { grid-template-columns: 1fr; grid-auto-rows: auto; overflow-y: auto; }
  .tt-wrap { overflow: visible; }
}

/* ======================================================================
 * Bildschirmschoner
 * ==================================================================== */
.saver { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 100; background: #0b0c0c; color: #fff; overflow: hidden; cursor: pointer; opacity: 0; }
.saver.on { opacity: 1; }
.sv-img { position: absolute; top: 0; right: 0; bottom: 0; left: 0; background: center / cover no-repeat; opacity: 0; }
.sv-img.fit { background-size: contain; }
.sv-img.show { opacity: 1; -webkit-transform: scale(1.04); transform: scale(1.04); }
.saver.photos:after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 45%; background: linear-gradient(to top, rgba(0, 0, 0, .5), rgba(0, 0, 0, 0)); pointer-events: none; }
.sv-info { position: absolute; left: 56px; bottom: 48px; z-index: 1; text-shadow: 0 1px 16px rgba(0, 0, 0, .3); }
.sv-time { font-size: 104px; font-weight: 600; letter-spacing: -.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.sv-date { font-size: 24px; font-weight: 500; margin-top: 10px; opacity: .92; }
.sv-next { font-size: 18px; margin-top: 6px; opacity: .8; }
.saver.night { background: #000; }
.saver.night .sv-img { display: none; }
.saver.night .sv-info { left: 0; right: 0; bottom: auto; top: 50%; -webkit-transform: translateY(-50%); transform: translateY(-50%); text-align: center; color: rgba(255, 255, 255, .3); text-shadow: none; }
.saver.night .sv-time { font-size: 80px; }
.saver.night .sv-date { font-size: 20px; }
@media (prefers-reduced-motion: no-preference) {
  .saver { -webkit-transition: opacity .7s var(--ease); transition: opacity .7s var(--ease); }
  .sv-img { -webkit-transition: opacity 1.6s ease, -webkit-transform var(--sv-zoom, 32s) linear; transition: opacity 1.6s ease, transform var(--sv-zoom, 32s) linear; }
  .sv-img.reset { -webkit-transition: none; transition: none; }
}
@media (max-width: 700px) {
  .sv-info { left: 24px; bottom: 28px; }
  .sv-time { font-size: 72px; }
}

/* Übertragungscode */
.paircode { font-size: 48px; font-weight: 600; letter-spacing: .12em; text-align: center; font-variant-numeric: tabular-nums; padding: 18px 0 22px; }
.paircode-in { font-size: 28px; letter-spacing: .2em; text-transform: uppercase; text-align: center; }

/* Rezept ansehen: Zutaten links, Zubereitung rechts. Ohne grid-gap-Abhängigkeit für ältere iPads. */
.rv-img { width: calc(100% + 52px); height: 220px; object-fit: cover; display: block; margin: -26px -26px 22px; border-radius: 14px 14px 0 0; }
.rv h2 { margin-bottom: 4px; }
.rv-meta { color: var(--muted); font-size: 15px; margin: 0 0 20px; }
.rv-cols { display: flex; align-items: flex-start; }
.rv-cols > div:first-child { width: 36%; flex: none; padding-right: 28px; }
.rv-cols > div:last-child { flex: 1; min-width: 0; padding-left: 28px; border-left: 1px solid var(--line); }
.rv h3 { margin: 0 0 10px; font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.rv-ing { list-style: none; margin: 0 0 22px; padding: 0; }
.rv-ing li { display: flex; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 16px; line-height: 1.35; }
.rv-ing li:last-child { border-bottom: 0; }
.rv-ing .q { width: 78px; flex: none; color: var(--muted); font-variant-numeric: tabular-nums; }
.rv-steps { margin: 0; padding: 0; list-style: none; counter-reset: s; }
.rv-steps li { position: relative; padding: 0 0 16px 40px; font-size: 17px; line-height: 1.55; max-width: 60ch; counter-increment: s; }
.rv-steps li:before { content: counter(s); position: absolute; left: 0; top: 1px; width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 14px; font-weight: 600; text-align: center; line-height: 26px; }
.rv-sk div { height: 18px; border-radius: 9px; background: var(--soft); margin-bottom: 12px; }
.rv-sk div:nth-child(2) { width: 82%; }
.rv-sk div:nth-child(3) { width: 64%; }
.rl-open { text-align: left; padding: 0; }
.rl-open small { display: block; color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 700px) {
  .rv-cols { display: block; }
  .rv-cols > div:first-child { width: auto; padding-right: 0; }
  .rv-cols > div:last-child { padding-left: 0; border-left: 0; }
  .rv-img { height: 170px; }
}

/* Setup-Code: grosser Ziffernblock fürs Tablet */
.pin { text-align: center; }
.pin .actions { text-align: left; }
.pin .hint { margin: 0 auto 18px; }
.hint.bad { color: var(--warn); }
.pin-dots { display: flex; justify-content: center; margin-bottom: 24px; }
.pin-dots i { width: 14px; height: 14px; border-radius: 50%; margin: 0 9px; border: 2px solid var(--faint); }
.pin-dots i.on { background: var(--text); border-color: var(--text); }
.pin-keys { display: flex; flex-wrap: wrap; width: 288px; margin: 0 auto; }
.pin-keys > * { width: 80px; height: 72px; margin: 6px 8px; }
.pin-keys button { border-radius: var(--r-card); background: var(--soft); font-size: 26px; font-weight: 500; font-variant-numeric: tabular-nums; display: flex; align-items: center; justify-content: center; }
.pin-keys button .ic svg { width: 24px; height: 24px; }
@media (prefers-reduced-motion: no-preference) {
  .pin-keys button { -webkit-transition: -webkit-transform .12s var(--ease-ui); transition: transform .12s var(--ease-ui); }
  .pin-keys button:active { -webkit-transform: scale(.94); transform: scale(.94); }
  .pin-dots.shake { -webkit-animation: shake .32s var(--ease-ui); animation: shake .32s var(--ease-ui); }
}
@-webkit-keyframes shake { 25% { -webkit-transform: translateX(-8px); } 75% { -webkit-transform: translateX(8px); } }
@keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }

.shop .scroll::-webkit-scrollbar { width: 0; }
/* Einkauf in zwei Spalten, wenn die Liste lang ist: Abteilungen bleiben zusammen */
@media (min-width: 900px) {
  .shop-cols { -webkit-column-count: 2; column-count: 2; -webkit-column-gap: 32px; column-gap: 32px; }
  .shop-cols .sect-wrap { -webkit-column-break-inside: avoid; break-inside: avoid; }
}
.linkbtn { color: var(--muted); font-size: 15px; font-weight: 500; padding: 10px 4px; text-decoration: underline; text-underline-offset: 3px; }

/* Umzug auf die neue Adresse */
.movebar { flex: none; width: 100%; margin-bottom: 10px; padding: 12px 16px; border-radius: var(--r-card); background: var(--accent-soft); color: var(--accent); font-size: 16px; text-align: left; }
.movebar b { font-weight: 600; }
.steps { margin: 0 0 12px; padding-left: 22px; } .steps li { margin-bottom: 6px; }
