:root {
  --bg: #f5f4f0;
  --surface: #ffffff;
  --text: #1f2421;
  --muted: #6b716d;
  --border: #dcdad3;
  --accent: #2f7d5b;
  --accent-text: #ffffff;
  --red: #c0392b;
  --red-bg: #fbe9e7;
  --yellow: #b7791f;
  --yellow-bg: #fdf3dc;
  --rec: #d64545;
  --orange: #c05621;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161917;
    --surface: #202421;
    --text: #e8ebe8;
    --muted: #9aa19c;
    --border: #343a36;
    --accent: #4fae83;
    --accent-text: #0e1a14;
    --red: #ef7b6e;
    --red-bg: #3a2320;
    --yellow: #e6b35a;
    --yellow-bg: #3a3020;
    --orange: #f0955a;
    --shadow: none;
  }
}

* { box-sizing: border-box; }

/* Eine Klassen-Regel mit display: grid oder flex ist staerker als das display: none,
   das der Browser fuer [hidden] mitbringt. Das einmal hier nachziehen, statt es an
   jedem Element einzeln zu wiederholen - sonst steht frueher oder spaeter wieder
   etwas auf dem Schirm, das versteckt sein sollte. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

body { padding-bottom: 140px; }

header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg);
  padding: 12px 16px 8px;
  display: flex;
  align-items: center;
  gap: 12px;
}

header h1 { font-size: 1.3rem; margin: 0; flex: 1; }
header a { color: var(--accent); text-decoration: none; font-weight: 600; }

/* Modul-Navigation: bleibt oben, damit unten Platz fuer die Hauptaktion der Seite ist */
nav.modules {
  position: sticky;
  top: 52px;
  z-index: 5;
  background: var(--bg);
  display: flex;
  gap: 5px;
  max-width: 760px;
  margin: 0 auto;
  padding: 0 16px 10px;
}
nav.modules a {
  flex: 1;
  min-width: 0;
  text-align: center;
  padding: 7px 2px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  /* Vier Reiter sollen auch auf schmalen Handys in einer Zeile bleiben,
     ohne mehr Hoehe zu brauchen: Schrift schrumpft mit der Fensterbreite mit. */
  font-size: clamp(0.8rem, 3.4vw, 0.95rem);
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
}
nav.modules a.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}

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

.status-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--muted);
  display: inline-block;
}
.status-dot.ready { background: var(--accent); }
.status-dot.loading, .status-dot.pending { background: var(--yellow); }
.status-dot.error { background: var(--red); }

input, select, button, textarea {
  font: inherit;
  color: inherit;
}

/* Kein ungewolltes Zoomen auf dem Smartphone:
   - touch-action: manipulation schaltet Doppeltipp-Zoom ab (Tippen bleibt schnell)
   - Eingabefelder mindestens 16px, sonst zoomt iOS beim Antippen automatisch rein
     (betrifft Felder in kleiner beschrifteten Labels, die die Schrift erben) */
html { touch-action: manipulation; }
input, select, textarea { font-size: max(16px, 1em); }

input[type="text"], input[type="search"], input[type="number"], input[type="date"], select {
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

button {
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
}
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
button.danger { color: var(--red); }
button:disabled { opacity: 0.5; cursor: default; }

.filters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}
.filters .search { grid-column: 1 / -1; }
.sort-toggle { display: flex; gap: 6px; grid-column: 1 / -1; }
.sort-toggle button { flex: 1; }
.sort-toggle button[data-sort="added"] { flex: 1.6; }
.sort-toggle button.active { background: var(--text); color: var(--bg); border-color: var(--text); }

.diet-hidden { margin: 0 0 10px; }
.diet-hidden a { color: var(--accent); }
.summary { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 12px; font-size: 0.9rem; }
.pill { padding: 4px 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); }
.pill.red { background: var(--red-bg); color: var(--red); border-color: transparent; }
.pill.yellow { background: var(--yellow-bg); color: var(--yellow); border-color: transparent; }
button.pill { min-height: 0; font: inherit; cursor: pointer; }
.pill.opened { color: var(--orange); border-color: var(--orange); background: transparent; }
.pill.opened.active { background: var(--orange); color: #fff; }
.opened-badge {
  display: inline-block;
  margin-left: 4px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--orange);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  vertical-align: 2px;
}
.row .opened-since { color: var(--orange); font-weight: 600; }
.row .meta .linkish { font-size: inherit; }

.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }

.row {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border-left: 6px solid transparent;
  padding: 10px 12px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 10px;
  align-items: center;
}
.row.red { border-left-color: var(--red); }
.row.yellow { border-left-color: var(--yellow); }
.row .name { font-weight: 600; }
.row .qty { color: var(--muted); font-weight: 400; }
.row .meta { color: var(--muted); font-size: 0.85rem; }
.row .date { font-size: 0.9rem; }
.row .added { color: var(--accent); font-weight: 600; }
.day-head { font-size: 0.9rem; font-weight: 700; color: var(--muted); margin: 10px 0 0; }
.day-head:first-child { margin-top: 0; }
.row.red .when { color: var(--red); font-weight: 600; }
.row.yellow .when { color: var(--yellow); font-weight: 600; }
.row .actions { grid-row: 1 / span 3; grid-column: 2; display: flex; gap: 6px; }
.row .actions button { min-width: 48px; padding: 6px 10px; }
/* Zeile für das Verschieben des MHD: eigene Zeile über die ganze Breite, damit die
   Knöpfe auf dem Handy nicht mit "−1" um den Platz streiten */
.row .extend {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, 1fr) auto;
  align-items: center;
  gap: 4px 6px;
  padding-top: 4px;
}
.row .extend .label { grid-column: 1 / -1; color: var(--muted); font-size: 0.85rem; }
.row .extend button { min-height: 36px; padding: 4px; font-size: 0.85rem; white-space: nowrap; }
.row .extend button.cancel { border: none; background: none; color: var(--muted); }

/* Lagerort ändern: der Lagerort in der Meta-Zeile ist der Auslöser (gepunktet unterstrichen,
   damit er nicht wie ein Knopf mehr Platz braucht); die Auswahl klappt erst beim Antippen auf */
.row .loc { color: inherit; text-decoration: underline dotted; }
.row .move { grid-column: 1 / -1; display: grid; gap: 6px; padding-top: 4px; }
.row .move-head { display: flex; justify-content: space-between; align-items: center; }
.row .move .label { color: var(--muted); font-size: 0.85rem; }
.row .move-amount { display: flex; align-items: center; gap: 6px; font-size: 0.9rem; }
.row .move-amount input { width: 64px; min-height: 36px; }
.row .move-targets { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 6px; }
.row .move button { min-height: 36px; padding: 4px; font-size: 0.85rem; white-space: nowrap; }
.row .move button.cancel { border: none; background: none; color: var(--muted); }
.row .move button.linkish { min-height: 0; padding: 0; font-size: 0.9rem; }

.empty { color: var(--muted); text-align: center; padding: 30px 0; }

/* Aufnahme-Leiste unten */
.dock {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  z-index: 10;
}
.dock-inner { max-width: 760px; margin: 0 auto; display: flex; gap: 8px; align-items: center; }
.dock form { flex: 1; display: flex; gap: 6px; }
.rec {
  flex: 0 0 auto;
  min-height: 60px;
  min-width: 150px;
  border-radius: 30px;
  font-size: 1.05rem;
  font-weight: 700;
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}
.rec.recording { background: var(--rec); border-color: var(--rec); color: #fff; animation: pulse 1.2s infinite; }
.rec.busy { background: var(--muted); border-color: var(--muted); color: #fff; }
@keyframes pulse { 50% { opacity: 0.75; } }

/* Bestätigung */
.sheet-backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 20;
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  background: var(--bg);
  width: 100%;
  max-width: 760px;
  max-height: 92vh;
  overflow-y: auto;
  border-radius: 18px 18px 0 0;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
}
.sheet h2 { margin: 0 0 4px; font-size: 1.15rem; }
.transcript { color: var(--muted); font-style: italic; margin: 0 0 12px; }
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px;
  margin-bottom: 10px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.card label { font-size: 0.8rem; color: var(--muted); display: grid; gap: 2px; }
.card .full { grid-column: 1 / -1; }
.qty-input { display: grid; grid-template-columns: 1fr auto; gap: 4px; }
.qty-input select { width: auto; padding: 8px 4px; }
.take-form { display: flex; gap: 6px; }
.take-form input { width: 90px; min-height: 40px; }
.card .hint { font-size: 0.85rem; color: var(--muted); }
.card .error { font-size: 0.9rem; color: var(--red); }
.card .card-head { display: flex; justify-content: space-between; align-items: center; }
.card .card-head button { min-height: 32px; padding: 2px 10px; }
.linkish { background: none; border: none; color: var(--accent); padding: 0; min-height: 0; text-decoration: underline; }
.sheet-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; }
.sheet-actions .wide { grid-column: 1 / -1; }

.toast {
  position: fixed;
  left: 50%; bottom: 100px;
  transform: translateX(-50%);
  background: var(--text); color: var(--bg);
  padding: 10px 16px; border-radius: 10px;
  z-index: 30;
  max-width: calc(100% - 32px);
}
.toast.error { background: var(--red); color: #fff; }
.toast.with-action { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.toast.with-action button {
  min-height: 36px; padding: 4px 12px;
  background: transparent; color: inherit; border-color: currentColor; font-weight: 600;
}

header button.icon { min-height: 36px; padding: 2px 8px; border: none; background: transparent; font-size: 1.2rem; }

/* Umschalter Dauerbetrieb / Einzeln, nur ohne laufende Sitzung sichtbar */
.rec-mode {
  max-width: 760px;
  margin: 0 auto 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--muted);
}
.rec-mode[hidden] { display: none; }
.rec-mode button {
  flex: 1 1 auto;
  min-height: 36px;
  padding: 2px 8px;
  border-radius: 999px;
  /* Drei Knöpfe sollen auch auf schmalen Handys nebeneinander bleiben (wie die Reiter oben) */
  font-size: clamp(0.78rem, 3.3vw, 0.9rem);
  white-space: nowrap;
}
.rec-mode button.active { background: var(--text); color: var(--bg); border-color: var(--text); }

.session-status {
  max-width: 760px;
  margin: 0 auto 8px;
  text-align: center;
  font-weight: 600;
  color: var(--muted);
}
.session-status #statusText { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.session-status .level {
  height: 6px;
  margin: 6px auto 0;
  max-width: 240px;
  border-radius: 3px;
  background: var(--border);
  overflow: hidden;
  visibility: hidden;
}
.session-status.listening .level { visibility: visible; }
.level-bar { height: 100%; width: 0; background: var(--muted); transition: width 60ms linear; }
.level-bar.speaking { background: var(--rec); }
.level-debug { font-size: 0.75rem; font-weight: 400; font-variant-numeric: tabular-nums; }
.level-debug:empty { display: none; }

.banner { background: var(--yellow-bg); color: var(--yellow); padding: 10px 12px; border-radius: 10px; margin-bottom: 10px; }

/* Pflege */
.tabs {
  position: sticky;
  top: 96px;
  z-index: 4;
  background: var(--bg);
  display: flex;
  gap: 6px;
  max-width: 760px;
  margin: 0 auto;
  padding: 4px 16px 12px;
}
/* Seit dem Reiter Protokoll sind es vier: wie bei den Modulen schrumpft die Schrift
   mit der Breite, damit auch auf 360 px nichts abgeschnitten wird (15.11.2026) */
.tabs button { flex: 1; min-width: 0; padding: 8px 4px; font-size: clamp(0.8rem, 3.6vw, 1rem); }
.tabs button.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.badge {
  display: inline-block;
  min-width: 1.4em;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--yellow);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.4em;
}
.badge[hidden] { display: none; }
.product-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 480px) { .product-filters { grid-template-columns: 1fr; } }
.admin section { margin-bottom: 28px; }
.admin h2 { font-size: 1.1rem; margin: 0 0 8px; }
.admin .add { display: flex; gap: 6px; margin-bottom: 8px; }
.admin table { width: 100%; border-collapse: collapse; }
.admin td { padding: 4px 3px; vertical-align: middle; }
.admin td.num { color: var(--muted); text-align: right; white-space: nowrap; font-size: 0.85rem; }
.admin tr.nocat td:first-child input { border-color: var(--yellow); }
.prod-list { display: grid; gap: 8px; margin-top: 8px; }
.prod { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 8px; }
.prod-main { display: grid; grid-template-columns: 1.3fr 1fr auto auto; gap: 6px; align-items: center; }
.prod-main .num { color: var(--muted); font-size: 0.85rem; white-space: nowrap; }
.prod-main .toggle { min-width: 40px; padding: 4px 8px; }
.prod.nocat .prod-main input[name="name"] { border-color: var(--yellow); }
.prod-aliases { margin: 4px 2px 0; }
.prod-details { display: grid; gap: 8px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.prod-details label { display: grid; gap: 4px; font-size: 0.9rem; }
.prod-actions { display: flex; justify-content: flex-end; }
.min-row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.diet-lookup { margin: 4px 0 8px; }
.diet-lookup p { margin: 0 0 6px; }
.diet-buttons { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.diet-buttons button { flex: 1 1 auto; min-height: 36px; padding: 4px 8px; font-size: 0.9rem; }

/* Einkaufsliste */
body.shop { padding-bottom: 140px; }
.ask {
  background: var(--surface);
  border: 1px solid var(--yellow);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 10px;
  margin-bottom: 8px;
  display: grid;
  gap: 8px;
  font-size: 0.95rem;
}
.ask-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.ask-actions button { flex: 1 1 auto; }
.shop-top { display: flex; justify-content: flex-end; min-height: 4px; }
#cleanup[hidden] { display: none; }
.shop-group h2 { font-size: 0.9rem; font-weight: 700; color: var(--muted); margin: 16px 0 6px; }
.shop-group:first-child h2 { margin-top: 6px; }
.shop-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.shop-item {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 10px;
  align-items: center;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 10px;
}
.shop-item .tick {
  width: 30px; height: 30px; min-height: 30px; padding: 0;
  border-radius: 50%; border: 2px solid var(--border); background: transparent;
  font-size: 1rem; line-height: 1;
}
.shop-item.checked .tick { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.shop-name { display: grid; gap: 2px; min-width: 0; }
.shop-name .small { color: var(--muted); font-size: 0.8rem; }
.shop-qty { color: var(--muted); font-size: 0.9rem; white-space: nowrap; }
.shop-item.checked { opacity: 0.55; }
.shop-item.checked .shop-title, .shop-item.checked .shop-qty { text-decoration: line-through; }
.shop-item .drop { border: none; background: transparent; color: var(--muted); font-size: 1.3rem; min-height: 36px; padding: 0 4px; }
.shop-item .drop.confirm { font-size: 0.85rem; font-weight: 600; color: var(--red); }
.prod-details label.prod-check { display: flex; align-items: flex-start; gap: 8px; }
.prod-details label.prod-check input { margin-top: 0; }

/* iOS zeichnet Checkboxen sonst winzig (ca. 13px) - feste Größe erzwingen */
input[type="checkbox"] {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  margin: 0;
  accent-color: var(--accent);
}
.prod-details .warn { color: var(--yellow); margin: -4px 0 0; }
.admin .grid-loc { display: grid; grid-template-columns: 1fr 1.4fr auto; gap: 6px; margin-bottom: 6px; }
.admin .small { color: var(--muted); font-size: 0.85rem; }

@media (max-width: 480px) {
  .rec { min-width: 120px; }
  .admin .grid-loc { grid-template-columns: 1fr auto; }
  .admin .grid-loc input.aliases { grid-column: 1 / -1; grid-row: 2; }
  .prod-main { grid-template-columns: 1fr auto auto; }
  .prod-main input[name="name"] { grid-column: 1 / -1; }
}

/* Rezepte */
body.recipes { padding-bottom: 40px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.chip {
  min-height: 0;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
  font-size: 0.85rem;
  font-weight: 600;
}

a.row.recipe { text-decoration: none; color: inherit; display: grid; grid-template-columns: 1fr; }
a.row.recipe.incomplete { border-left-color: var(--border); }
.row.recipe .name { font-weight: 600; }
.row.recipe .meta.ok { color: var(--accent); }
.row.recipe .meta.warn { color: var(--muted); }
.row.recipe .meta.soon { color: var(--yellow); font-weight: 600; }
.row.recipe .meta.expired { color: var(--red); font-weight: 600; }

.stars { display: flex; align-items: center; gap: 2px; }
.stars.small { display: inline; color: var(--yellow); letter-spacing: 1px; font-size: 0.85rem; }
.star {
  min-height: 0;
  padding: 2px 3px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 1.35rem;
  line-height: 1;
}
.star.on { color: var(--yellow); }
.stars .small { margin-left: 6px; color: var(--muted); }

.recipe-head h2 { margin: 6px 0 4px; font-size: 1.25rem; }
.recipe-head .meta { color: var(--muted); font-size: 0.9rem; margin: 6px 0 0; }
.recipes main h3 { font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin: 22px 0 8px; }

.servings { display: flex; align-items: center; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.servings input { width: 76px; }
.servings .small { color: var(--muted); font-size: 0.85rem; }

.ing-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ing {
  display: grid;
  grid-template-columns: minmax(64px, auto) 1fr auto;
  gap: 10px;
  align-items: baseline;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 9px 12px;
}
.ing.missing { opacity: 0.75; }
.ing-amount { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ing-name { display: grid; gap: 2px; min-width: 0; }
/* Die Namen einer Gruppe gehoeren in einen Textfluss. Ohne die Klammer waere jede
   Alternative ein eigenes Grid-Element und damit eine eigene Zeile. */
.ing-title { min-width: 0; }
.ing-name .small { color: var(--muted); font-size: 0.8rem; }
/* Das "oder" zwischen Alternativen soll die Namen nicht überstrahlen */
.ing-name .alt { color: var(--muted); font-weight: 400; }
.ing-state { font-size: 0.8rem; font-weight: 600; white-space: nowrap; }
.ing-state.warn { color: var(--red); }
/* Fehlt etwas, das ohnehin "nach Belieben" ist, ist das keine schlechte Nachricht */
.ing-state.faint { color: var(--muted); font-weight: 400; }
.ing-state.soon { color: var(--yellow); }

/* "Bestand einblenden": Überschrift und Knopf in einer Zeile */
.ing-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.ing-head .linkish { font-size: 0.85rem; }
/* Der Bestand steht unter dem Namen, nicht unter der Rezeptmenge */
.ing-stock-box { grid-column: 2 / -1; display: grid; gap: 2px; font-size: 0.8rem; color: var(--muted); }
.ing-stock-name { color: var(--text); font-weight: 600; margin-top: 2px; }
.ing-stock { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.ing-stock li::before { content: "• "; }
.ing-stock li.warn { color: var(--red); }
.ing-stock li.soon { color: var(--yellow); }

.step-list { margin: 0; padding-left: 1.3em; display: grid; gap: 10px; }
.step-list li { padding-left: 4px; }

#missingBox { margin-top: 10px; display: grid; gap: 6px; justify-items: start; }
#missingBox .small { color: var(--muted); margin: 0; }

.recipe-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 24px 0 8px; }

.recipes form { display: grid; gap: 14px; margin-top: 8px; }
.recipes form h2 { margin: 6px 0 0; font-size: 1.25rem; }
.recipes form label { display: grid; gap: 4px; font-weight: 600; }
.recipes form label .small { color: var(--muted); font-size: 0.82rem; font-weight: 400; }
/* align-items: end, damit die Felder auf einer Linie stehen, auch wenn die eine
   Beschriftung zweizeilig umbricht und die andere nicht */
.recipes .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: end; }
.recipes textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  font-weight: 400;
  line-height: 1.5;
  resize: vertical;
}

/* Kochassistent: legt sich ueber die Seite. In der Kueche zaehlt nur der Schritt. */
body.as-open { overflow: hidden; }
.as {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: var(--bg);
  padding: 12px 16px calc(16px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
}
.as-top { display: flex; align-items: center; gap: 10px; }
.as-mic {
  flex: 1;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
}
.as-mic::before {
  content: "";
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--muted);
  flex: none;
}
.as-mic.listening::before { background: var(--accent); animation: pulse 1.6s infinite; }
.as-mic.processing::before, .as-mic.speaking::before { background: var(--yellow); }
.as-mic.paused::before { background: var(--red); }
.as-mic.huh { color: var(--yellow); }
.as-mic.huh::before { background: var(--yellow); }

.as-level { height: 4px; border-radius: 2px; background: var(--border); overflow: hidden; }
.as-level > div { height: 100%; width: 0; background: var(--muted); transition: width 0.08s linear; }
.as-level > div.speaking { background: var(--accent); }

.as-count { margin: 4px 0 0; color: var(--muted); font-size: 0.9rem; font-weight: 600; }
/* Der Schritt ist ein Knopf: mit teigigen Haenden trifft man lieber die halbe Seite
   als einen kleinen Knopf am Rand. */
.as-step {
  /* Nicht mitwachsen: ein kurzer Schritt soll nicht in einem halbseitigen weissen
     Kasten schweben. Den freien Platz bekommen stattdessen die Knoepfe unten. */
  flex: none;
  min-height: 150px;
  text-align: left;
  padding: 18px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  font-size: clamp(1.3rem, 5.5vw, 1.9rem);
  line-height: 1.35;
  font-weight: 600;
  display: flex;
  align-items: center;
}
.as-peek { margin: 0; color: var(--muted); font-size: 0.9rem; }
.as-resume { align-self: start; }
/* margin-top: auto schiebt die Knoepfe an den unteren Rand, in Daumenreichweite */
.as-actions { display: grid; grid-template-columns: 1fr 1fr 1.2fr; gap: 8px; margin-top: auto; }
.as-actions button { min-height: 60px; font-size: 1rem; font-weight: 600; }
.as-help { margin: 0; color: var(--muted); font-size: 0.82rem; text-align: center; }
.as-start { width: 100%; margin-bottom: 10px; }

/* Der Reiter "Kategorien" fuehrt zwei getrennte Listen: eine fuer Produkte,
   eine fuer Rezepte. */
.admin .cat-head { font-size: 1rem; margin: 22px 0 2px; }
.admin .cat-head:first-child { margin-top: 4px; }
.admin .cat-head + .small { margin: 0 0 10px; }

/* Einkaufs-Tipps in der Rezeptliste */
.tips { margin: 4px 0 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.tips summary { padding: 8px 12px; cursor: pointer; font-size: 0.9rem; }
.tips-list { list-style: none; margin: 0; padding: 0 12px 8px; }
.tips-list li { display: flex; flex-direction: column; gap: 6px; padding: 8px 0; border-top: 1px solid var(--border); }
.tips-list .tip-text { display: flex; flex-direction: column; gap: 2px; }
.tips-list .tip-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.tips .small { color: var(--muted); font-size: 0.85rem; }

/* Strichcode-Scanner (Seite /scan) */
body.scan { padding-bottom: 40px; }

.scan-box {
  position: relative;
  aspect-ratio: 4 / 3;
  max-height: 46vh;
  width: 100%;
  background: #111;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 10px;
}
.scan-box video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-frame {
  position: absolute;
  left: 12%; right: 12%; top: 32%; bottom: 32%;
  border: 3px solid rgba(255, 255, 255, 0.85);
  border-radius: 10px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.28);
  pointer-events: none;
}
.scan-box:not(.live) .scan-frame { display: none; }
.scan-msg {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 0.9rem;
  text-align: center;
}
.scan-controls { display: grid; gap: 8px; margin-bottom: 6px; }
.scan-controls form { display: flex; gap: 6px; }
.scan-sub { font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin: 18px 0 8px; }
.row.scanned .actions { grid-row: auto; }
.chips.mhd { margin: 0; }
.chip.ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.chip.pick { text-align: left; }
.chip.pick small { display: block; font-weight: 400; opacity: 0.85; }
.card .sum { font-weight: 600; }

/* Pflege: Protokoll */
.device-form input { flex: 1; }
.admin .device-form[hidden] { display: none; }
button.link { min-height: 0; padding: 0; border: 0; background: none; color: var(--accent); font: inherit; text-decoration: underline; cursor: pointer; }
#logRanges { flex-wrap: nowrap; }
#logRanges .chip { padding: 4px 8px; white-space: nowrap; }
.log-free { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: -4px 0 10px; }
.log-free label { display: flex; align-items: center; gap: 6px; min-width: 0; color: var(--muted); font-size: 0.9rem; }
.log-free input { flex: 1; min-width: 0; }
.log-filters { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 8px; margin-bottom: 8px; }
@media (max-width: 600px) {
  .log-filters { grid-template-columns: 1fr 1fr 1fr; }
  .log-filters input[type="search"] { grid-column: 1 / -1; }
}
.log-day {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 16px 0 4px;
}
.log-row {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  gap: 2px 8px;
  align-items: baseline;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
}
.log-time { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 0.85rem; }
.log-device { font-size: 0.8rem; color: var(--muted); white-space: nowrap; }
.log-device.unknown { opacity: 0.6; }
.log-row.has-said { cursor: pointer; }
.log-row.has-said .log-text::after { content: " 💬"; font-size: 0.8em; opacity: 0.6; }
.log-said { display: none; color: var(--muted); font-style: italic; font-size: 0.9rem; margin-top: 2px; }
.log-row.open .log-said { display: block; }
.log-row.open .log-text::after { content: none; }
.log-more { display: block; margin: 12px auto 0; }

/* Sets (15.11.2026): kein eigener Reiter, sondern ein kleiner Knopf oben rechts im Kopf.
   Rot: ein Set mit Alarm hat zu wenig. Gelb: wird durch das MHD bald zu wenig haben. */
header a.sets-link {
  flex: 0 0 auto;
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.85rem;
}
header a.sets-link.active { border-color: var(--accent); color: var(--accent); }
header a.sets-link.yellow { background: var(--yellow); border-color: var(--yellow); color: #fff; }
header a.sets-link.red { background: var(--red); border-color: var(--red); color: #fff; }

.sets form label.check { display: flex; align-items: flex-start; gap: 8px; font-weight: 400; }
.sets form label.check input { margin-top: 3px; width: auto; min-height: 0; }

.row.set { display: block; border-left-color: var(--accent); }
.row.set.yellow { border-left-color: var(--yellow); }
.row.set.red { border-left-color: var(--red); }
/* Set ohne Alarm, dem etwas fehlt: kein Alarmrot, nur ein dezenter Rand */
.row.set.missing { border-left-color: var(--border); }
.row.set summary { cursor: pointer; display: grid; gap: 2px; list-style: none; }
.row.set summary::-webkit-details-marker { display: none; }
.row.set summary .name::before { content: "▸ "; color: var(--muted); }
.row.set details[open] summary .name::before { content: "▾ "; }
.row.set .recipe-actions { margin: 12px 0 2px; }

.set-group { border-top: 1px solid var(--border); margin-top: 10px; padding-top: 8px; display: grid; gap: 2px; }
.set-group-head { display: flex; justify-content: space-between; gap: 8px; }
.set-group-head .name { font-weight: 600; }
.set-group-head .count { color: var(--muted); white-space: nowrap; }
.set-group.red .count { color: var(--red); font-weight: 600; }
.set-group.yellow .count { color: var(--yellow); font-weight: 600; }
.set-group .meta .ok { color: var(--accent); }
.set-group .meta .warn.red { color: var(--red); font-weight: 600; }
.set-group .meta .warn.yellow { color: var(--yellow); font-weight: 600; }
.set-group .small { color: var(--muted); font-size: 0.85rem; margin: 0; }
/* "Bestand einblenden" wie beim Rezept (gleiche Listen-Optik, .ing-stock) */
.set-tools { display: flex; justify-content: flex-end; margin-top: 6px; }
.set-tools .linkish { font-size: 0.85rem; }
.set-stock-box { display: grid; gap: 2px; font-size: 0.8rem; color: var(--muted); margin-top: 2px; }
.set-stock-box li.red { color: var(--red); }
.set-stock-box li.yellow { color: var(--yellow); }
.set-stock-box li.muted { color: var(--muted); }
