/* KochSmart – Oberfläche (mobil zuerst, hell/dunkel) */
:root {
  --bg: #f7f4ee;
  --flaeche: #ffffff;
  --flaeche-2: #f0ece4;
  --linie: #e2ddd2;
  --text: #1d211e;
  --text-2: #5c625d;
  --primaer: #23604a;
  --primaer-hell: #e3efe8;
  --primaer-text: #ffffff;
  --akzent: #b45309;
  --akzent-hell: #fdf1e2;
  --gefahr: #b42318;
  --gefahr-hell: #fdecea;
  --gefahr-text: #ffffff;
  --warn: #8a5a00;
  --warn-hell: #fff6dc;
  --ok: #1f7a4d;
  --schatten: 0 1px 2px rgba(30, 30, 20, .06), 0 4px 16px rgba(30, 30, 20, .06);
  --radius: 14px;
  --radius-k: 10px;
  --nav-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121512; --flaeche: #1b1f1c; --flaeche-2: #232824; --linie: #2f3631; --text: #e7ebe7; --text-2: #a3aba5;
    --primaer: #5cb48a; --primaer-hell: #1f3329; --primaer-text: #0d1a13; --akzent: #f0a24b; --akzent-hell: #33261a;
    --gefahr: #f2867a; --gefahr-hell: #3a1d1a; --gefahr-text: #2a0d0a; --warn: #f3c561; --warn-hell: #33290f; --ok: #6fcf97;
    --schatten: 0 1px 2px rgba(0, 0, 0, .4); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121512; --flaeche: #1b1f1c; --flaeche-2: #232824; --linie: #2f3631; --text: #e7ebe7; --text-2: #a3aba5;
  --primaer: #5cb48a; --primaer-hell: #1f3329; --primaer-text: #0d1a13; --akzent: #f0a24b; --akzent-hell: #33261a;
  --gefahr: #f2867a; --gefahr-hell: #3a1d1a; --gefahr-text: #2a0d0a; --warn: #f3c561; --warn-hell: #33290f; --ok: #6fcf97;
  --schatten: 0 1px 2px rgba(0, 0, 0, .4); color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 16px);
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
body.ohne-nav { padding-bottom: 24px; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; letter-spacing: -.01em; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.02rem; }
p { margin: 0 0 .75rem; }
a { color: var(--primaer); }
button, input, select, textarea { font: inherit; color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Kopf */
.kopf {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: .5rem;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px; background: var(--bg);
  border-bottom: 1px solid var(--linie);
}
.kopf .titel { font-weight: 700; font-size: 1.1rem; flex: 1; display: flex; align-items: center; gap: .5rem; min-width: 0; }
.kopf .titel span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logo { width: 28px; height: 28px; flex: none; }

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

/* Navigation unten */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--flaeche); border-top: 1px solid var(--linie);
}
.nav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--text-2); text-decoration: none; font-size: .72rem; font-weight: 600; min-height: 44px;
}
.nav a svg { width: 24px; height: 24px; }
.nav a[aria-current="page"] { color: var(--primaer); }

/* Karten, Listen */
.karte { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; box-shadow: var(--schatten); }
.karte.flach { box-shadow: none; }
.abschnitt { margin: 20px 0 8px; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.abschnitt h2 { margin: 0; }
.liste { list-style: none; margin: 0; padding: 0; }
.liste > li { display: flex; align-items: center; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--linie); min-height: 52px; }
.liste > li:last-child { border-bottom: 0; }
.liste .haupt { flex: 1; min-width: 0; }
.liste .neben { color: var(--text-2); font-size: .88rem; }
.leer { text-align: center; color: var(--text-2); padding: 28px 12px; }
.leer svg { width: 44px; height: 44px; opacity: .5; display: block; margin: 0 auto 8px; }
.gruppe-titel { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); margin: 16px 0 4px; font-weight: 700; }

/* Formulare */
label { display: block; font-weight: 600; font-size: .92rem; margin: 12px 0 6px; }
.feld { width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid var(--linie); border-radius: var(--radius-k); background: var(--flaeche); }
.feld:focus-visible, button:focus-visible, a:focus-visible, .chip input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--primaer) 45%, transparent); outline-offset: 2px; }
textarea.feld { min-height: 80px; resize: vertical; }
.reihe { display: flex; gap: 8px; align-items: center; }
.reihe > .feld { flex: 1; min-width: 0; }
.raster-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.hilfe { color: var(--text-2); font-size: .85rem; margin-top: 4px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; margin: 12px 0; }
.check input { width: 22px; height: 22px; margin: 1px 0 0; flex: none; accent-color: var(--primaer); }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; display: inline-flex; }
.chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chip span {
  display: inline-flex; align-items: center; min-height: 40px; padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--linie); background: var(--flaeche); font-size: .92rem; font-weight: 500; user-select: none;
}
.chip input:checked + span { background: var(--primaer); border-color: var(--primaer); color: var(--primaer-text); }
.chip.warn input:checked + span { background: var(--gefahr); border-color: var(--gefahr); color: var(--gefahr-text); }

/* Buttons */
.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 10px 18px;
  border-radius: var(--radius-k); border: 1px solid transparent; background: var(--primaer); color: var(--primaer-text);
  font-weight: 650; cursor: pointer; text-decoration: none; -webkit-tap-highlight-color: transparent;
}
.knopf:active { transform: translateY(1px); }
.knopf[disabled] { opacity: .55; cursor: not-allowed; }
.knopf.breit { width: 100%; }
.knopf.zweit { background: var(--flaeche); color: var(--text); border-color: var(--linie); }
.knopf.leise { background: transparent; color: var(--primaer); padding: 8px 10px; min-height: 40px; }
.knopf.gefahr { background: var(--gefahr); color: var(--gefahr-text); }
.knopf.klein { min-height: 36px; padding: 6px 12px; font-size: .9rem; }
.knopf svg { width: 20px; height: 20px; }
.icon-knopf { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 12px; border: 0; background: transparent; color: var(--text-2); cursor: pointer; flex: none; }
.icon-knopf svg { width: 22px; height: 22px; }
.icon-knopf.aktiv { color: var(--gefahr); }
.knopf-reihe { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.knopf-reihe > .knopf { flex: 1 1 140px; }

/* Hinweise */
.hinweis { border-radius: var(--radius-k); padding: 12px 14px; margin: 12px 0; font-size: .94rem; border: 1px solid transparent; }
.hinweis ul { margin: 6px 0 0; padding-left: 20px; }
.hinweis.warn { background: var(--warn-hell); color: var(--text); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.hinweis.gefahr { background: var(--gefahr-hell); border-color: color-mix(in srgb, var(--gefahr) 35%, transparent); }
.hinweis.info { background: var(--primaer-hell); }
.hinweis strong { display: block; margin-bottom: 2px; }
.klein-text { font-size: .82rem; color: var(--text-2); }
.marke { display: inline-block; font-size: .74rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--flaeche-2); color: var(--text-2); white-space: nowrap; }
.marke.ok { background: var(--primaer-hell); color: var(--primaer); }
.marke.warn { background: var(--warn-hell); color: var(--warn); }
.marke.gefahr { background: var(--gefahr-hell); color: var(--gefahr); }

/* Rezept */
.rezept-kopf h1 { font-size: 1.6rem; margin-bottom: 4px; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--text-2); font-size: .92rem; margin: 6px 0 12px; }
.meta span { display: inline-flex; align-items: center; gap: 4px; }
.meta svg { width: 16px; height: 16px; }
.zutaten li { padding: 9px 0; min-height: 0; }
.zutaten .menge { min-width: 86px; font-weight: 650; font-variant-numeric: tabular-nums; }
.schritte { counter-reset: s; list-style: none; padding: 0; margin: 0; }
.schritte li { position: relative; padding: 4px 0 16px 44px; }
.schritte li::before {
  counter-increment: s; content: counter(s); position: absolute; left: 0; top: 2px; width: 30px; height: 30px; border-radius: 50%;
  background: var(--primaer-hell); color: var(--primaer); font-weight: 750; display: flex; align-items: center; justify-content: center; font-size: .9rem;
}
.portionen { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--linie); border-radius: 999px; padding: 2px; }
.portionen button { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--flaeche-2); font-weight: 700; cursor: pointer; }
.portionen output { min-width: 84px; text-align: center; font-weight: 650; }
.naehr { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.naehr div { background: var(--flaeche-2); border-radius: 10px; padding: 8px 4px; }
.naehr b { display: block; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.naehr small { color: var(--text-2); font-size: .76rem; }

/* Lade-Ansicht */
.laden { text-align: center; padding: 36px 8px; }
.kreis { width: 56px; height: 56px; margin: 0 auto 16px; border-radius: 50%; border: 5px solid var(--primaer-hell); border-top-color: var(--primaer); animation: dreh 1s linear infinite; }
@keyframes dreh { to { transform: rotate(360deg); } }
.fortschritt { height: 6px; background: var(--flaeche-2); border-radius: 99px; overflow: hidden; margin: 16px auto 8px; max-width: 320px; }
.fortschritt div { height: 100%; width: 0; background: var(--primaer); transition: width .8s ease; }
@media (prefers-reduced-motion: reduce) { .kreis { animation: none; } .fortschritt div { transition: none; } }

/* Kochmodus */
.kochmodus { position: fixed; inset: 0; z-index: 50; background: var(--bg); display: flex; flex-direction: column; padding: calc(env(safe-area-inset-top) + 12px) 16px calc(env(safe-area-inset-bottom) + 16px); }
.kochmodus .oben { display: flex; align-items: center; gap: 8px; }
.kochmodus .oben .klein-text { flex: 1; }
.kochmodus .schritt-text { font-size: 1.45rem; line-height: 1.45; font-weight: 550; margin: 18px 0; flex: 1; overflow-y: auto; }
.kochmodus .schritt-zutaten { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.kochmodus .schritt-zutaten span { background: var(--akzent-hell); color: var(--akzent); border-radius: 999px; padding: 4px 12px; font-weight: 600; font-size: .95rem; }
.timer { font-size: 2.2rem; font-weight: 750; font-variant-numeric: tabular-nums; text-align: center; margin: 8px 0; }
.timer.fertig { color: var(--gefahr); }
.balken { display: flex; gap: 4px; margin-top: 10px; }
.balken i { flex: 1; height: 4px; border-radius: 2px; background: var(--linie); }
.balken i.an { background: var(--primaer); }

/* Dialog */
dialog { border: 0; border-radius: 18px; padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); background: var(--flaeche); color: var(--text); box-shadow: 0 10px 40px rgba(0, 0, 0, .25); }
dialog::backdrop { background: rgba(10, 12, 10, .45); }
dialog .inhalt { padding: 18px 16px; overflow-y: auto; max-height: calc(100dvh - 120px); }
dialog .fuss { display: flex; gap: 8px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--linie); }
dialog .fuss .knopf { flex: 1; }

/* Toast / Banner */
.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 20px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60; background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-weight: 600; max-width: calc(100vw - 32px); box-shadow: var(--schatten); }
.banner { background: var(--akzent-hell); color: var(--text); padding: 10px 16px; display: flex; gap: 8px; align-items: center; justify-content: space-between; font-size: .92rem; }

/* Auth */
.auth { max-width: 420px; margin: 0 auto; padding: 32px 16px; }
.auth .logo-gross { width: 64px; height: 64px; display: block; margin: 8px auto 12px; }
.auth h1 { text-align: center; }
.auth .unter { text-align: center; color: var(--text-2); margin-bottom: 20px; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--flaeche-2); border-radius: 12px; padding: 4px; margin-bottom: 8px; }
.tabs button { min-height: 40px; border: 0; border-radius: 9px; background: transparent; font-weight: 650; cursor: pointer; color: var(--text-2); }
.tabs button[aria-selected="true"] { background: var(--flaeche); color: var(--text); box-shadow: var(--schatten); }
.fehler-text { color: var(--gefahr); font-weight: 600; margin-top: 10px; }

.unter-tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 12px; scrollbar-width: none; }
.unter-tabs a { flex: none; padding: 8px 14px; border-radius: 999px; background: var(--flaeche); border: 1px solid var(--linie); text-decoration: none; color: var(--text); font-weight: 600; font-size: .92rem; }
.unter-tabs a[aria-current="page"] { background: var(--text); color: var(--bg); border-color: var(--text); }

.tag { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.trenner { height: 1px; background: var(--linie); margin: 12px 0; }
.code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1.4rem; letter-spacing: .12em; font-weight: 700; text-align: center; padding: 10px; background: var(--flaeche-2); border-radius: 10px; }
.vorschlag-liste { position: absolute; left: 0; right: 0; top: 100%; z-index: 15; background: var(--flaeche); border: 1px solid var(--linie); border-radius: 10px; box-shadow: var(--schatten); margin-top: 4px; max-height: 260px; overflow-y: auto; }
.vorschlag-liste button { display: block; width: 100%; text-align: left; padding: 11px 12px; border: 0; background: transparent; cursor: pointer; border-bottom: 1px solid var(--linie); }
.vorschlag-liste button:last-child { border-bottom: 0; }
.relativ { position: relative; }
.zahl-feld { width: 92px; flex: none !important; }
@media (min-width: 720px) { main { padding: 24px; } }

.toast[hidden] { display: none; }
.liste .knopf.leise.haupt { justify-content: flex-start; text-align: left; padding: 6px 0; min-height: 44px; color: var(--text); font-weight: 500; }
.liste .knopf.leise.haupt span { display: block; }
.liste a.haupt { color: var(--text); text-decoration: none; }
.kochmodus .knopf.zweit { width: 100%; }

/* Nutzerverwaltung */
.banner-link { text-decoration: none; }
.banner-link .knopf { pointer-events: none; }
.nutzer-liste { display: grid; gap: 12px; }
.nutzer .nutzer-kopf { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-bottom: 6px; }
.nutzer .nutzer-mail { flex: 1 1 100%; overflow-wrap: anywhere; }
.nutzer .klein-text { margin: 0 0 10px; }
.nutzer-liste .karte { margin-bottom: 0; }
.nutzer .knopf-reihe { margin-top: 0; }
.rollen-info { margin-top: 16px; }
.rollen-info summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; }
.rollen-info ul { margin: 6px 0 10px; padding-left: 20px; }
.admin-link { justify-content: space-between; text-decoration: none; color: var(--text); min-height: 52px; }

/* Abgleich mit dem Vorrat (Wunschgericht) */
.abschnitt-kopf { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 4px; }
.abschnitt-kopf h2 { margin: 0; font-size: 1.05rem; }
.abgleich .liste > li { flex-wrap: wrap; }
.abgleich .liste .haupt { flex: 1 1 60%; }
