:root {
  /* Stil "A · Ruhig" (Redesign Okt. 2026): neutraler, iOS-naher Grund,
     Grün nur noch als Akzent für Aktionen/Auswahl - nicht mehr als Fläche
     hinter weißem Text (der Kontrast war dort nur ~1,9:1). */
  --color-primary: #2f9e6e;
  --color-on-primary: #ffffff;
  --color-primary-soft: #e3f4ec;
  --color-danger: #d64545;
  --color-bg: #f2f2f7;
  --color-card: #ffffff;
  --color-text: #1c1c1e;
  --color-muted: #8a8a8e;
  --color-border: #d8d8dc;
  --color-subtle-bg: #f0f0f4;
  --color-subtle-text: #b7b9bc;
  --color-hairline: #e3e3e8;
  /* Für farbige Hervorhebungen (z.B. Wetter: ausgewählte Uhrzeit/Tagesabschnitt,
     Anziehempfehlungs-Karte) - im Dunkelmodus unten auf dunklere Tönungen
     umgestellt, sonst wäre der (dann helle) Text auf diesen hellen Flächen
     kaum lesbar. */
  --color-highlight-bg: #e3f4ec;
  --color-highlight-border: #2f9e6e;
  --color-accent-bg: #fff7e6;
  --radius: 14px;
  /* Sagt dem Browser, dass die Seite sowohl helles als auch dunkles Farbschema
     unterstützt - native Elemente (z.B. Scrollbalken, Systemdialoge) und
     Formularfelder ohne eigene Farbangabe passen sich dann automatisch an die
     Geräteeinstellung an, zusätzlich zu den Variablen unten. */
  color-scheme: light dark;
}

/* Übernimmt automatisch die Geräte-/Systemeinstellung (Hell/Dunkel) - es gibt
   bewusst keinen manuellen Umschalter in der App, nur diese Media Query. */
@media (prefers-color-scheme: dark) {
  :root {
    --color-primary: #4cc38a;
    --color-on-primary: #06281a;
    --color-primary-soft: #163326;
    --color-danger: #ff6b6b;
    --color-bg: #000000;
    --color-card: #1c1c1e;
    --color-text: #f2f2f7;
    --color-muted: #8e8e93;
    --color-border: #3a3a3c;
    --color-subtle-bg: #2c2c2e;
    --color-subtle-text: #6c6c70;
    --color-hairline: #38383a;
    --color-highlight-bg: #163326;
    --color-highlight-border: #4cc38a;
    --color-accent-bg: #3a3220;
  }
}

* { box-sizing: border-box; }

/* Google Material Icons (siehe <link> in index.html). .material-icons ist
   die von Google vorgegebene Basisklasse für die Ligature-Schrift; icon()
   in app.js erzeugt daraus konsistent formatierte <span>-Icons. */
.material-icons {
  font-family: 'Material Icons';
  font-weight: normal;
  font-style: normal;
  font-size: 20px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  vertical-align: -5px;
  -webkit-font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
}

/* WICHTIG: html/body scrollen NICHT selbst - nur #content tut das (s.u.).
   Das vermeidet den bekannten iOS-Safari-Bug, bei dem "position: fixed"-
   Elemente (wie die Tab-Leiste) beim Scrollen kurz springen/abgeschnitten wirken. */
html, body {
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
}

#login-view {
  height: 100%;
  overflow-y: auto;
}

#app-view {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh; /* falls vom Browser unterstützt: berücksichtigt dynamische Safari-Leisten */
}

header.topbar {
  flex: 0 0 auto;
  background: var(--color-bg);
  color: var(--color-text);
  padding: calc(14px + env(safe-area-inset-top)) 20px 8px;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.01em;
  display: flex;
  flex-wrap: wrap; /* zweite Zeile für den Essen-Umschalter */
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px 12px;
  /* Feste Mindesthöhe für den Inhalt, damit die Kopfzeile immer gleich hoch
     bleibt - egal ob gerade ein "+"/Zahnrad-Button da ist oder nicht. */
  min-height: 40px;
  box-sizing: content-box;
}

/* Titel + optionale Unterzeile ("5 offen", Datum ...) */
.topbar-titles { display: flex; flex-direction: column; min-width: 0; }
.topbar-title { line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-sub { font-size: 14px; font-weight: 400; letter-spacing: 0; color: var(--color-muted); margin-top: 3px; }
.topbar-sub:empty { display: none; }

.header-action-btn {
  background: var(--color-card);
  border: none;
  color: var(--color-primary);
  font-size: 15px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 999px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.header-action-btn .material-icons { vertical-align: 0; }

/* Manuelle Raumtemperatur (Anziehempfehlung Drinnen/Nachts), falls kein
   aktueller Eve-Messwert da ist. */
.room-temp-stepper {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}
.room-temp-stepper span.card-meta {
  flex: 1;
}
.room-temp-stepper button {
  padding: 4px 8px;
  display: flex;
  align-items: center;
}
.room-temp-stepper strong {
  min-width: 56px;
  text-align: center;
}

/* Gemeinsamer Container für alle Kopfzeilen-Buttons (Zahnrad/Umschalter/
   Export/"+") - hält sie als EINE Gruppe zusammen, statt dass
   "justify-content: space-between" in header.topbar jeden Button einzeln
   über die Breite verteilt (fiel v.a. am Desktop auf, wo der Header breiter
   ist: ein einzelner Button landete dann mittig statt neben dem "+"). */
.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 0 0 auto;
}

main {
  flex: 1 1 auto;
  min-height: 0; /* wichtig, damit der Flex-Child scrollen kann statt zu wachsen */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
}

/* Pull-to-Refresh: als Home-Bildschirm-App (standalone) fehlt Safaris
   eingebautes Pull-to-Refresh, daher bauen wir es selbst nach. Das Element
   sitzt zwischen Header und #content und wird per Höhe ein-/ausgeblendet,
   während man am oberen Rand der Liste nach unten zieht (siehe app.js). */
.pull-indicator {
  flex: 0 0 auto;
  height: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--color-muted);
  background: var(--color-bg);
  transition: height 0.15s ease;
}

.pull-indicator.armed {
  color: var(--color-primary);
  font-weight: 600;
}

.card {
  background: var(--color-card);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 12px;
}

.card.done {
  opacity: 0.55;
}

/* --- Rich-Text-Editor (Notizen) --- */
.rte-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 6px;
}

.rte-toolbar button {
  padding: 6px 10px;
  font-size: 13px;
  background: var(--color-card);
}

.rte-editor {
  min-height: 100px;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-card);
  color: var(--color-text);
  font-size: 16px;
}

.rte-editor:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: -1px;
}

.rte-editor ul, .rte-editor ol {
  padding-left: 22px;
}

.note-body {
  font-size: 15px;
  line-height: 1.4;
  margin-top: 8px;
}
.note-body ul, .note-body ol {
  padding-left: 22px;
}

/* --- Anhänge (Notizen) --- */
.attachment-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.attachment-item {
  position: relative;
}

.attachment-thumb {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 10px;
  display: block;
}

.attachment-file {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  background: var(--color-subtle-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  text-align: center;
  color: var(--color-text);
  padding: 4px;
}

.attachment-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #e04b4b;
  color: white;
  border: none;
  font-size: 11px;
  padding: 0;
  line-height: 1;
}

.card-title {
  font-weight: 600;
  font-size: 16px;
}

.card-meta {
  color: var(--color-muted);
  font-size: 13px;
  margin-top: 4px;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  color: white;
  font-size: 12px;
  margin-right: 6px;
}

form.inline-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

input, textarea, select, button {
  font-size: 16px; /* verhindert Zoom bei Fokus auf iOS */
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--color-border);
  font-family: inherit;
  background: var(--color-card);
  color: var(--color-text);
}

button.primary {
  background: var(--color-primary);
  color: white;
  border: none;
  font-weight: 600;
}

nav.tabbar {
  flex: 0 0 auto; /* normaler Flex-Child am Ende von #app-view, kein "fixed" mehr nötig */
  display: flex;
  background: var(--color-card);
  border-top: 1px solid var(--color-hairline);
  padding-bottom: env(safe-area-inset-bottom);
}

nav.tabbar button {
  flex: 1 1 0;
  min-width: 0;
  background: none;
  border: none;
  padding: 8px 2px 6px;
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600; /* immer gleich fett wie .active - sonst "springt" das Label
                        beim Antippen, weil sich seine Textbreite ändert */
  color: var(--color-muted);
  border-radius: 0;
}

nav.tabbar button.active {
  color: var(--color-primary);
}

nav.tabbar button .material-icons {
  font-size: 22px;
  vertical-align: -6px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkbox-row input[type="checkbox"] {
  width: 22px;
  height: 22px;
}

.empty-state {
  text-align: center;
  color: var(--color-muted);
  padding: 40px 20px;
}

.login-screen {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 320px;
  margin: 80px auto;
  padding: 0 20px;
}

/* --- Rezeptbuch: ganze Karte klickbar zum Auf-/Zuklappen --- */
.recipe-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.recipe-card {
  cursor: pointer;
  background: var(--color-card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.recipe-cover {
  height: 140px;
  background-size: cover;
  background-position: center;
  background-color: var(--color-subtle-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  color: var(--color-subtle-text);
  position: relative;
}

.recipe-cover:not(.recipe-cover-empty) {
  color: transparent; /* Emoji-Fallback ausblenden, wenn ein echtes Bild da ist */
}

.category-pill {
  position: absolute;
  top: 10px;
  left: 10px;
  /* Sitzt auf dem Rezeptfoto, nicht auf der Karte selbst - bleibt deshalb
     bewusst IMMER hell mit dunklem Text (nicht var(--color-text), das im
     Dunkelmodus hell wird und auf hellem Grund unlesbar wäre). */
  background: rgba(255,255,255,0.92);
  color: #1c1c1e;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
}

.recipe-card-body {
  padding: 12px 14px 14px;
}

.recipe-card-title {
  font-family: Georgia, 'Iowan Old Style', 'Times New Roman', serif;
  font-size: 19px;
  font-weight: 600;
  color: var(--color-text);
}

.recipe-detail-section {
  margin-top: 10px;
}

.recipe-detail-section p {
  font-size: 14px;
  line-height: 1.5;
}

.ingredient-checklist {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
}

.ingredient-checklist li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--color-hairline);
  font-size: 14px;
}

.ingredient-checklist li:last-child {
  border-bottom: none;
}

.ingredient-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-primary);
  flex: 0 0 auto;
}

.ingredient-qty {
  margin-left: auto;
  color: var(--color-muted);
  font-size: 13px;
}

.rec-image-preview-img {
  max-width: 160px;
  max-height: 100px;
  border-radius: 8px;
  margin-top: 6px;
  display: block;
  object-fit: cover;
}

/* --- Lightbox: einheitliches Fenster für JEDE Detailansicht/Bearbeitung
   in der App (Rezept ansehen/bearbeiten, geplantes Essen, Notiz bearbeiten) --- */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.lightbox-box {
  background: var(--color-card);
  border-radius: var(--radius);
  width: 100%;
  max-width: 420px;
  /* Relativ zur Overlay-Höhe statt fixer vh - das Overlay wird per JS exakt
     auf den sichtbaren Bereich gesetzt (siehe openLightbox in app.js), auch
     wenn die Tastatur offen ist und den Viewport verkleinert. */
  max-height: 90%;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 30px rgba(0,0,0,0.3);
  overflow: hidden;
}

.lightbox-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  padding: 16px 16px 8px;
  flex: 0 0 auto;
}

.lightbox-title {
  font-family: Georgia, 'Iowan Old Style', 'Times New Roman', serif;
  font-size: 19px;
  font-weight: 600;
  color: var(--color-text);
}

.lightbox-close {
  background: none;
  border: none;
  color: var(--color-muted);
  font-size: 15px;
  padding: 2px 6px;
  flex: 0 0 auto;
}

.lightbox-body {
  padding: 0 16px 18px;
  overflow-y: auto;
}

.lightbox-body .inline-form,
.lightbox-body form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lightbox-recipe-image {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-radius: 10px;
  margin-bottom: 4px;
}

/* Zutatenzeile: darf nie breiter als der Bildschirm werden. min-width:0 ist
   entscheidend - ohne das weigern sich Text-Inputs in einer Flex-Reihe,
   unter ihre "natürliche" Breite zu schrumpfen, und die Zeile läuft über. */
.ingredient-row {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
}

.ingredient-row .ing-name {
  flex: 1 1 auto;
  min-width: 0;
}

.ingredient-row .ing-qty {
  flex: 0 0 72px;
  min-width: 0;
  padding-left: 6px;
  padding-right: 6px;
}

.ingredient-row .remove-row {
  flex: 0 0 auto;
  padding: 4px 8px;
}

/* =====================================================================
   Redesign-Bausteine (Stil A): gruppierte Listen, Inline-Details,
   Schnell-Eingabe unten, Toast mit "Rückgängig", Fläschchen-Schnelleintrag
   ===================================================================== */
.section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 18px 4px 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.section-title:first-child { margin-top: 4px; }
.section-title button {
  background: none; border: none; padding: 0;
  font-size: 13px; font-weight: 600; text-transform: none; letter-spacing: 0;
  color: var(--color-primary);
}

.list {
  background: var(--color-card);
  border-radius: var(--radius);
  overflow: hidden;
}
.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  min-height: 50px;
  border-top: 1px solid var(--color-hairline);
}
.list > :first-child .list-row,
.list > .list-row:first-child { border-top: 0; }
.list-row .main { flex: 1; min-width: 0; }
.list-row .title { font-size: 16px; overflow-wrap: anywhere; }
.list-row .meta { font-size: 13px; color: var(--color-muted); margin-top: 1px; overflow-wrap: anywhere; }
.list-row .trail { font-size: 15px; color: var(--color-muted); white-space: nowrap; }
.list-row.tappable { cursor: pointer; }
.list-row.tappable:active { background: var(--color-subtle-bg); }
.row-thumb {
  width: 36px; height: 36px; border-radius: 8px; object-fit: cover;
  background: var(--color-subtle-bg); flex: 0 0 auto;
  display: grid; place-items: center; font-size: 18px;
}

/* Runder Abhaken-Kreis */
.round-check {
  width: 26px; height: 26px; border-radius: 50%; padding: 0;
  border: 2px solid var(--color-border); background: transparent;
  flex: 0 0 auto; display: grid; place-items: center; cursor: pointer;
  /* größere Tippfläche ohne das Layout zu verschieben */
  box-shadow: 0 0 0 10px transparent;
}
.round-check.on { background: var(--color-primary); border-color: var(--color-primary); }
.round-check.on::after {
  content: ""; width: 10px; height: 6px;
  border: 2px solid var(--color-on-primary); border-top: 0; border-right: 0;
  transform: rotate(-45deg) translate(1px, -1px);
}
.list-row.is-done .title { color: var(--color-muted); text-decoration: line-through; }

/* ⓘ-Knopf, klappt die Details IN der Liste auf */
.info-btn {
  width: 32px; height: 32px; border-radius: 50%; border: none; padding: 0;
  background: transparent; color: var(--color-primary);
  display: grid; place-items: center; flex: 0 0 auto; cursor: pointer;
}
.info-btn .material-icons { font-size: 24px; vertical-align: 0; }
.row-wrap.open .info-btn { background: var(--color-primary-soft); }
.row-details { display: none; padding: 2px 14px 12px 52px; }
.row-wrap.open .row-details { display: block; }
.detail-field {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 0; border-bottom: 1px solid var(--color-hairline);
  min-height: 44px;
}
.detail-field > label { width: 84px; flex: 0 0 auto; font-size: 14px; color: var(--color-muted); }
.detail-field input[type="text"], .detail-field input[type="time"], .detail-field input[type="number"] {
  flex: 1; min-width: 0; border: none; background: transparent; padding: 6px 0; border-radius: 0;
}
.detail-field input:focus { outline: none; }
.detail-field.top { align-items: flex-start; }
.detail-field.top > label { padding-top: 7px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 0; }
.chip {
  border: 1px solid var(--color-hairline); background: var(--color-subtle-bg); color: var(--color-text);
  border-radius: 999px; padding: 5px 11px; font-size: 14px; cursor: pointer;
}
.chip.on { background: var(--color-primary); border-color: var(--color-primary); color: var(--color-on-primary); }
.detail-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 8px; }
.link-btn { background: none; border: none; padding: 6px 0; font-size: 15px; font-weight: 600; color: var(--color-primary); cursor: pointer; }
.link-btn.danger { color: var(--color-danger); }
.detail-photo { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; }

/* Schnell-Eingabe unten am Daumen (über der Tab-Leiste) */
#dock {
  flex: 0 0 auto;
  padding: 8px 12px;
  background: var(--color-bg);
  border-top: 1px solid var(--color-hairline);
  max-width: 640px; width: 100%; margin: 0 auto;
}
.dock-input {
  display: flex; align-items: center; gap: 10px;
  background: var(--color-card); border-radius: 999px; padding: 4px 6px 4px 12px;
}
.dock-input .plus {
  width: 24px; height: 24px; border-radius: 50%; flex: 0 0 auto;
  background: var(--color-primary); color: var(--color-on-primary);
  display: grid; place-items: center; font-size: 18px; line-height: 1;
}
.dock-input input {
  flex: 1; min-width: 0; border: none; background: transparent; padding: 8px 0; border-radius: 0;
}
.dock-input input:focus { outline: none; }
.dock-suggest {
  background: var(--color-card); border-radius: var(--radius);
  margin-bottom: 8px; overflow: hidden;
  box-shadow: 0 -2px 16px rgba(0,0,0,0.08);
}
.dock-suggest[hidden] { display: none; }
.dock-suggest button {
  display: flex; align-items: center; gap: 10px; width: 100%;
  border: none; border-radius: 0; background: transparent; padding: 10px 14px;
  text-align: left; font-size: 15px; color: var(--color-text);
  border-top: 1px solid var(--color-hairline);
}
.dock-suggest button:first-child { border-top: 0; }
.dock-suggest button.hl { background: var(--color-subtle-bg); }
.dock-suggest .cat { margin-left: auto; font-size: 12px; color: var(--color-muted); }
.dock-suggest img { width: 28px; height: 28px; border-radius: 6px; object-fit: cover; }

/* Toast unten, optional mit "Rückgängig" */
.toast {
  position: fixed; left: 50%; bottom: calc(110px + env(safe-area-inset-bottom));
  transform: translate(-50%, 10px); opacity: 0; pointer-events: none;
  width: calc(100% - 32px); max-width: 420px;
  background: #1c1c1e; color: #fff; border-radius: 12px; padding: 12px 14px;
  font-size: 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  transition: opacity .2s, transform .2s; z-index: 900;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast button { background: none; border: none; padding: 0; color: #7ee0ae; font-weight: 700; font-size: 14px; }

/* ---- Fläschchen ---- */
.feed-hero { background: var(--color-card); border-radius: var(--radius); padding: 16px; }
.feed-hero .small { font-size: 14px; color: var(--color-muted); }
.feed-hero .big { font-size: 34px; font-weight: 700; letter-spacing: -0.02em; margin-top: 2px; }
.feed-hero .big span { font-size: 18px; font-weight: 600; color: var(--color-muted); }
.progress { height: 8px; background: var(--color-subtle-bg); border-radius: 99px; overflow: hidden; margin: 12px 0 6px; }
.progress > div { height: 100%; background: var(--color-primary); border-radius: 99px; }
.progress.over > div { background: var(--color-primary); }
.feed-quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.feed-quick button {
  border: none; border-radius: 12px; background: var(--color-card); color: var(--color-text);
  padding: 12px 6px; font-size: 14px; font-weight: 600;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.feed-quick button .emo { font-size: 22px; line-height: 1; }
.feed-quick.four { grid-template-columns: repeat(4, 1fr); }
.feed-quick button.primary { background: var(--color-primary); color: var(--color-on-primary); }
.feed-composer {
  background: var(--color-card); border-radius: var(--radius); padding: 14px; margin-top: 12px;
  border: 2px solid var(--color-primary);
}
.feed-composer .top { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 14px; color: var(--color-muted); }
.time-pill { border: none; background: var(--color-subtle-bg); color: var(--color-text); font-size: 14px; font-weight: 600; border-radius: 999px; padding: 6px 12px; }
.time-pill input[type="time"] { border: none; background: transparent; padding: 0; font-size: 16px; font-weight: 600; }
.ml-stepper { display: flex; align-items: center; justify-content: center; gap: 18px; margin: 12px 0; }
.ml-stepper button { width: 46px; height: 46px; border-radius: 50%; border: none; background: var(--color-subtle-bg); color: var(--color-text); font-size: 24px; padding: 0; }
.ml-stepper .val { font-size: 42px; font-weight: 700; min-width: 120px; text-align: center; letter-spacing: -0.02em; }
.ml-stepper .val small { font-size: 18px; color: var(--color-muted); font-weight: 600; }
.ml-stepper input {
  width: 110px; text-align: center; border: none; background: transparent;
  font-size: 42px; font-weight: 700; padding: 0; letter-spacing: -0.02em;
}
.ml-stepper input:focus { outline: none; }
.feed-composer .chip-row { justify-content: center; }
.btn-block { width: 100%; margin-top: 12px; border: none; border-radius: 12px; background: var(--color-primary); color: var(--color-on-primary); font-weight: 700; padding: 13px; }
.day-nav { display: inline-flex; gap: 2px; text-transform: none; letter-spacing: 0; }
.day-nav button { font-size: 15px; padding: 2px 8px; }

/* Beim Tippen in der Schnell-Eingabe die Tab-Leiste ausblenden (mehr Platz über der Tastatur) */
#app-view.typing nav.tabbar { display: none; }

/* ---- Navigation (5 Tabs) ---- */
.back-btn {
  align-self: flex-start;
  display: inline-flex; align-items: center;
  background: none; border: none; padding: 0 0 2px; margin-left: -6px;
  font-size: 16px; font-weight: 400; letter-spacing: 0; color: var(--color-primary);
}
.back-btn .material-icons { font-size: 26px; vertical-align: 0; }
.segmented {
  display: flex; background: var(--color-subtle-bg); border-radius: 10px; padding: 2px;
}
@media (prefers-color-scheme: light) { .segmented { background: #e4e4ea; } }
.segmented button {
  flex: 1; border: none; background: transparent; border-radius: 8px; padding: 6px 0;
  font-size: 14px; font-weight: 600; color: var(--color-text);
}
.segmented button.on { background: var(--color-card); box-shadow: 0 1px 3px rgba(0,0,0,0.12); }
.topbar-segmented { flex: 1 0 100%; margin-top: 6px; }

/* Rezepte: Suchfeld oben im Inhalt */
.search-field {
  display: flex; align-items: center; gap: 6px;
  background: var(--color-card); border-radius: 10px; padding: 2px 12px; margin-bottom: 14px;
}
.search-field .material-icons { color: var(--color-muted); font-size: 20px; vertical-align: 0; }
.search-field input { flex: 1; min-width: 0; border: none; background: transparent; padding: 9px 0; border-radius: 0; }
.search-field input:focus { outline: none; }

/* Schalter (Einstellungen) statt Häkchen */
input.switch {
  appearance: none; -webkit-appearance: none;
  width: 50px; height: 30px; border-radius: 99px; padding: 0; margin: 0; border: none; flex: 0 0 auto;
  background: var(--color-border); position: relative; cursor: pointer; transition: background .2s;
}
input.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 26px; height: 26px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.25); transition: transform .2s;
}
input.switch:checked { background: var(--color-primary); }
input.switch:checked::after { transform: translateX(20px); }

/* ---- Heute ---- */
.today-hero { background: var(--color-card); border-radius: var(--radius); overflow: hidden; cursor: pointer; }
.today-hero .img { height: 130px; background-size: cover; background-position: center; }
.today-hero .img.placeholder { display: grid; place-items: center; font-size: 46px; background: var(--color-primary-soft); }
.today-hero .txt { padding: 12px 14px 14px; }
.today-hero .kicker { font-size: 12px; font-weight: 600; color: var(--color-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.today-hero .name { font-size: 20px; font-weight: 700; margin-top: 2px; }
.today-hero .s { font-size: 14px; color: var(--color-muted); margin-top: 2px; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.tiles:first-child { margin-top: 0; }
.tile { background: var(--color-card); border-radius: var(--radius); padding: 12px 14px; cursor: pointer; min-width: 0; }
.tile:active, .today-hero:active { opacity: 0.85; }
.tile .k { font-size: 13px; color: var(--color-muted); }
.tile .v { font-size: 22px; font-weight: 700; margin-top: 2px; overflow-wrap: anywhere; }
.tile .v-small { font-size: 16px; }
.tile .s {
  font-size: 13px; color: var(--color-muted); margin-top: 2px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.today-hero + .tiles { margin-top: 10px; }

/* ---- Essen: Woche / Monat ---- */
.week-nav {
  display: flex; align-items: center; justify-content: space-between;
  margin: 0 0 4px; font-size: 15px; font-weight: 600;
}
.week-nav > button:not(.link-btn) {
  width: 36px; height: 36px; border-radius: 50%; border: none; padding: 0;
  background: var(--color-card); color: var(--color-primary); display: grid; place-items: center;
}
.week-nav .material-icons { vertical-align: 0; font-size: 24px; }
.meal-day.past .list { opacity: 0.6; }
.row-thumb.add { background: var(--color-primary-soft); color: var(--color-primary); font-size: 22px; font-weight: 600; }
.add-line .title { color: var(--color-primary); }
.meal-add-panel { padding: 10px 10px 6px; border-top: 1px solid var(--color-hairline); }
.meal-add-panel:first-child { border-top: 0; }
.meal-add-panel .search-field { background: var(--color-subtle-bg); }
.meal-add-panel .list-row { padding-left: 4px; padding-right: 4px; }
.trail.material-icons { vertical-align: 0; }

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; background: var(--color-card); border-radius: var(--radius); padding: 8px; }
.cal-head { text-align: center; font-size: 12px; font-weight: 600; color: var(--color-muted); padding-bottom: 4px; }
.cal-cell {
  position: relative; aspect-ratio: 1 / 1.25; border: none; border-radius: 10px; padding: 3px 0 0;
  background: transparent; display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--color-text);
}
.cal-cell.empty { background: none; }
.cal-cell .num { font-size: 13px; font-weight: 600; }
.cal-cell.today .num { background: var(--color-primary); color: var(--color-on-primary); border-radius: 99px; padding: 0 6px; }
.cal-cell.past { opacity: 0.55; }
.cal-cell .pic { width: 32px; height: 32px; border-radius: 50%; background-size: cover; background-position: center; display: grid; place-items: center; font-size: 15px; }
.cal-cell .pic.none { background: var(--color-primary-soft); }
.cal-cell .pic.free { border: 1.5px dashed var(--color-border); }
.cal-cell .more { position: absolute; top: 18px; right: 2px; font-size: 10px; font-weight: 700; color: var(--color-muted); }

/* ---- Rezepte (Stil A): 2er-Raster, schlichte Titel statt Serifen ---- */
.recipe-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.recipe-grid > .empty-state, .recipe-grid > p { grid-column: 1 / -1; }
.recipe-card { box-shadow: none; }
.recipe-cover { height: 110px; font-size: 32px; }
.recipe-card-body { padding: 10px 12px 12px; }
.recipe-card-title { font-family: inherit; font-size: 15px; font-weight: 600; line-height: 1.25; }
.recipe-card .card-meta { font-size: 12px; }
.category-pill { top: 8px; left: 8px; font-size: 11px; }
.lightbox-title { font-family: inherit; font-size: 18px; font-weight: 700; }

/* ---- Erinnerungen ---- */
.list-row .meta .badge { font-size: 11px; padding: 1px 7px; margin-right: 6px; vertical-align: 1px; }
.detail-field input[type="datetime-local"] { flex: 1; min-width: 0; border: none; background: transparent; padding: 6px 0; border-radius: 0; }

/* ---- Notizen ---- */
.note-preview { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 3px; }
.row-details .note-body { margin: 0 0 8px; font-size: 15px; line-height: 1.45; overflow-wrap: anywhere; }
.row-details .rte-toolbar { margin-top: 8px; }
.row-details .rte-toolbar button { background: var(--color-subtle-bg); border: none; }
.row-details .rte-editor { background: var(--color-subtle-bg); border: none; }
.note-edit, #note-composer .row-details { padding-left: 14px; }
.attachment-row { margin-bottom: 6px; }
.detail-field input[type="file"] { flex: 1; min-width: 0; border: none; background: none; padding: 4px 0; font-size: 14px; }

/* ---- Wetter ---- */
.weather-hero { background: var(--color-card); border-radius: var(--radius); padding: 14px 16px; }
.weather-hero .place { font-size: 14px; color: var(--color-muted); display: flex; align-items: center; gap: 2px; }
.weather-hero .place .material-icons { font-size: 16px; vertical-align: 0; }
.weather-hero .now { display: flex; align-items: center; gap: 14px; margin-top: 6px; }
.weather-hero .icon { font-size: 46px; line-height: 1; }
.weather-hero .temp { font-size: 40px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.05; }
.weather-hero .small { font-size: 14px; color: var(--color-muted); }
.weather-hero .stats { display: flex; gap: 14px; margin-top: 10px; font-size: 14px; color: var(--color-muted); }
.day-chips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 10px; }
.day-chip {
  border: 2px solid transparent; background: var(--color-card); border-radius: 12px; padding: 8px 4px;
  display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--color-text);
}
.day-chip.on { border-color: var(--color-primary); }
.day-chip .d { font-size: 13px; font-weight: 600; }
.day-chip .i { font-size: 22px; line-height: 1.2; }
.day-chip .t { font-size: 14px; font-weight: 600; }
.day-chip .t small { color: var(--color-muted); font-weight: 400; }
.hour-strip { display: flex; gap: 8px; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
.hour {
  flex: 0 0 58px; border: 2px solid transparent; background: var(--color-card); border-radius: 12px;
  padding: 8px 2px; display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--color-text);
}
.hour.on { border-color: var(--color-primary); }
.hour .h { font-size: 12px; color: var(--color-muted); }
.hour .i { font-size: 20px; line-height: 1.2; }
.hour .t { font-size: 15px; font-weight: 600; }
.list-row.selected { background: var(--color-primary-soft); }
.clothing-card { background: var(--color-primary-soft); border-radius: var(--radius); padding: 14px 16px; }
.clothing-card .title { font-weight: 700; display: flex; align-items: center; gap: 6px; }
.clothing-card .title .material-icons { font-size: 20px; vertical-align: 0; color: var(--color-primary); }
.clothing-card p { margin: 6px 0 0; font-size: 15px; line-height: 1.45; }
.clothing-card p.hint { font-size: 12px; color: var(--color-muted); }
.room-temp-stepper button { background: var(--color-card); border: none; border-radius: 99px; }

/* ---- Dialoge als Blatt von unten (Rezept, Wachstum, Export ...) ----
   Auf dem Handy kommt das Fenster von unten hoch (Daumen-Reichweite),
   Speichern-Knöpfe kleben unten am Blatt statt mitzuscrollen. Ab Tablet-
   Breite bleibt es ein zentriertes Fenster. */
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (max-width: 600px) {
  .lightbox-overlay { align-items: flex-end; padding: 0; }
  .lightbox-box {
    max-width: none; max-height: 92%;
    border-radius: 18px 18px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
    animation: sheet-up .22s ease-out;
  }
  .lightbox-box::before {
    content: ""; display: block; width: 38px; height: 5px; border-radius: 3px;
    background: var(--color-border); margin: 8px auto 0; flex: 0 0 auto;
  }
}
.lightbox-header { padding: 12px 16px 8px; align-items: center; }
.lightbox-close {
  width: 30px; height: 30px; border-radius: 50%; padding: 0;
  background: var(--color-subtle-bg); display: grid; place-items: center;
}
.lightbox-close .material-icons { vertical-align: 0 !important; }
.lightbox-body form > button.primary:last-child,
.lightbox-body form > div:last-child:has(> button.primary) {
  position: sticky; bottom: 0; z-index: 2;
  box-shadow: 0 -12px 12px -4px var(--color-card);
}
.lightbox-body form > div:last-child:has(> button.primary) { background: var(--color-card); padding-top: 6px; }

/* ---- Login ---- */
.login-screen { max-width: 340px; margin: 0 auto; padding: calc(80px + env(safe-area-inset-top)) 20px 40px; }
.login-screen h2 { font-size: 30px; font-weight: 700; margin: 0 0 8px; letter-spacing: -0.01em; }
.login-screen input { border: none; background: var(--color-card); padding: 13px 14px; }
.login-screen button.primary { padding: 13px; border-radius: 12px; margin-top: 4px; }

/* Kleiner Dreifach-Umschalter (Einstellungen: Leiste / Mehr / Aus) */
.seg-mini { display: flex; background: var(--color-subtle-bg); border-radius: 8px; padding: 2px; flex: 0 0 auto; }
@media (prefers-color-scheme: light) { .seg-mini { background: #e4e4ea; } }
.seg-mini button { border: none; background: transparent; border-radius: 6px; padding: 5px 9px; font-size: 13px; font-weight: 600; color: var(--color-muted); }
.seg-mini button.on { background: var(--color-card); color: var(--color-text); box-shadow: 0 1px 2px rgba(0,0,0,0.12); }

/* Heute: gleichmäßiger Abstand zwischen allen Blöcken, egal in welcher Reihenfolge */
.dash-stack { display: flex; flex-direction: column; gap: 10px; }
.dash-stack > .tiles { margin-top: 0; }
.dash-stack .section-title { margin-top: 8px; }
/* Eine einzelne (bzw. die letzte ungerade) Kachel nimmt die ganze Breite */
.tiles > .tile:last-child:nth-child(odd) { grid-column: 1 / -1; }
.tile .k { word-spacing: 3px; }
.tile .v-small { display: block; line-height: 1.3; }

/* Baby: Tagesleiste mit großen Tipp-Flächen */
.day-bar {
  display: flex; align-items: center; gap: 8px;
  background: var(--color-card); border-radius: var(--radius); padding: 6px; margin-bottom: 10px;
}
.day-bar > button {
  width: 48px; height: 48px; flex: 0 0 auto; border: none; border-radius: 12px; padding: 0;
  background: var(--color-subtle-bg); color: var(--color-primary); display: grid; place-items: center;
}
.day-bar > button .material-icons { font-size: 30px; vertical-align: 0; }
.day-bar > button:disabled { color: var(--color-subtle-text); opacity: 0.5; }
.day-label {
  position: relative; flex: 1; min-width: 0; text-align: center; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; line-height: 1.2;
}
.day-label .name { font-size: 18px; font-weight: 700; }
.day-label .date { font-size: 13px; color: var(--color-muted); }
/* unsichtbares Datumsfeld über der Mitte - Antippen öffnet den iOS-Kalender */
.day-label input[type="date"] { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; padding: 0; border: none; cursor: pointer; }

/* ---- Erinnerungen (übersichtlicher) ---- */
.person-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; vertical-align: 1px; }
.chip .person-dot { margin-right: 5px; }
.due-overdue { color: var(--color-danger); font-weight: 600; }
.section-title.overdue span:first-child { color: var(--color-danger); }
.snooze-btn {
  flex: 0 0 auto; border: none; border-radius: 99px; padding: 6px 12px;
  background: var(--color-primary-soft); color: var(--color-primary); font-size: 14px; font-weight: 600;
}
.reminder-preview { padding: 10px 14px; }
.reminder-preview .preview-title { font-weight: 600; font-size: 16px; margin-bottom: 6px; }
.reminder-preview .chip { cursor: default; font-size: 13px; padding: 4px 10px; }
.reminder-preview .hint { font-size: 12px; color: var(--color-muted); margin-top: 6px; }
.detail-field .chip-row:has([data-rf-preset]) { margin-top: 2px; }

/* Einkauf: optionales Mengen-Feld rechts in der Schnell-Eingabe */
.dock-qty {
  flex: 0 0 82px; width: 82px; min-width: 0;
  border: none; border-left: 1px solid var(--color-hairline); border-radius: 0;
  background: transparent; padding: 8px 6px 8px 10px; color: var(--color-text);
}
.dock-qty:focus { outline: none; }

/* ---- Familie / Einladung ---- */
.invite-code { font-size: 30px; font-weight: 700; letter-spacing: 0.12em; margin: 4px 0 10px; font-family: ui-monospace, Menlo, monospace; }
.token-box { display: block; font-size: 13px; word-break: break-all; background: var(--color-subtle-bg); border-radius: 8px; padding: 6px 8px; user-select: all; -webkit-user-select: all; }
.login-screen .section-title { margin-left: 0; margin-right: 0; }
.login-screen .link-btn { align-self: center; }

/* Ankündigung aus dem Admin-Bereich */
.announcement { display: flex; align-items: flex-start; gap: 10px; margin: 0 16px 8px; padding: 10px 12px; border-radius: 12px; background: var(--color-primary-soft); color: var(--color-text); font-size: 15px; }
.announcement[hidden] { display: none; }
.announcement.warn { background: #fbf1dc; color: #5a4310; }
.announcement span { flex: 1; }
.announcement button { border: 0; background: transparent; color: inherit; font-size: 16px; padding: 0 2px; cursor: pointer; opacity: .7; }
@media (prefers-color-scheme: dark) { .announcement.warn { background: #3a2f16; color: #f3dca8; } }

/* Testzeit abgelaufen: nur noch lesen - Eingabezeile unten ausblenden */
body.access-expired #dock { display: none !important; }
