:root {
  --bg: #f7f1ea;
  --flaeche: #fffaf5;
  --flaeche-2: #f0e7dd;
  --tinte: #2b2420;
  --leise: #7a6d64;
  --linie: #e5d9cc;
  --akzent: #c8553d;
  --akzent-sanft: #f6dcd3;
  --salbei: #5f7f68;
  --salbei-sanft: #dfe9e1;
  --gold: #b9893b;
  --schatten: 0 1px 2px rgba(60, 40, 30, .06), 0 6px 20px rgba(60, 40, 30, .07);
  --radius: 18px;
  --serif: ui-serif, "New York", "Iowan Old Style", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1816; --flaeche: #262019; --flaeche-2: #322a22; --tinte: #f3ebe2; --leise: #b3a598;
    --linie: #3d342b; --akzent: #e7765c; --akzent-sanft: #4a2c24; --salbei: #8fb39a; --salbei-sanft: #26342a;
    --gold: #d9ad62; --schatten: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--tinte); font: 16px/1.45 var(--sans); -webkit-font-smoothing: antialiased; }
body { min-height: 100dvh; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -.01em; margin: 0; }
[hidden] { display: none !important; }

/* Login */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login-karte { width: min(380px, 100%); text-align: center; }
.login-karte .logo { font-family: var(--serif); font-size: 56px; color: var(--akzent); line-height: 1; }
.login-karte h1 { font-size: 40px; margin: 8px 0 4px; }
.login-karte p { color: var(--leise); margin: 0 0 28px; }
.login-karte form { display: grid; gap: 12px; }

/* Kopf & Tabs */
.kopf { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: flex-end;
  padding: calc(env(safe-area-inset-top) + 14px) 20px 12px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.kopf h1 { font-size: 32px; line-height: 1.1; }
.kopf-gruss { margin: 0 0 2px; color: var(--leise); font-size: 14px; }
main { padding: 4px 16px calc(env(safe-area-inset-bottom) + 96px); max-width: 720px; margin: 0 auto; outline: none; }
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 6px 8px calc(env(safe-area-inset-bottom) + 6px); background: color-mix(in srgb, var(--flaeche) 92%, transparent);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-top: 1px solid var(--linie); }
.tabs button { position: relative; display: grid; justify-items: center; gap: 1px; padding: 6px 0; border: 0; background: none;
  color: var(--leise); font-size: 11px; font-weight: 600; letter-spacing: .02em; }
.tabs button span { font-size: 21px; line-height: 1.1; }
.tabs button.aktiv { color: var(--akzent); }
.tabs b { position: absolute; top: 2px; left: calc(50% + 8px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--akzent); color: #fff; font-size: 11px; line-height: 18px; }

/* Bausteine */
.abschnitt { margin: 22px 0 10px; display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.abschnitt h2 { font-size: 21px; }
.abschnitt .link { border: 0; background: none; color: var(--akzent); font-weight: 600; font-size: 14px; padding: 0; }
.karte { background: var(--flaeche); border-radius: var(--radius); box-shadow: var(--schatten); padding: 16px; }
.karte + .karte { margin-top: 10px; }
.leise { color: var(--leise); }
.klein { font-size: 13px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 18px;
  border-radius: 14px; border: 1px solid var(--linie); background: var(--flaeche); font-weight: 600; }
.btn.primaer { background: var(--akzent); border-color: var(--akzent); color: #fff; }
.btn.sanft { background: var(--akzent-sanft); border-color: transparent; color: var(--akzent); }
.btn.gruen { background: var(--salbei-sanft); border-color: transparent; color: var(--salbei); }
.btn.voll { width: 100%; }
.btn:disabled { opacity: .55; }
.btn-reihe { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-reihe .btn { flex: 1 1 auto; }
input[type=text], input[type=password], input[type=search], input[type=date], textarea, select {
  width: 100%; min-height: 46px; padding: 11px 14px; border-radius: 14px; border: 1px solid var(--linie);
  background: var(--flaeche); outline: none; }
input:focus, textarea:focus, select:focus { border-color: var(--akzent); box-shadow: 0 0 0 3px var(--akzent-sanft); }
textarea { min-height: 80px; resize: vertical; }
.fehler { color: var(--akzent); min-height: 1.4em; margin: 0; font-size: 14px; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; margin: 0 -16px; padding-inline: 16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--linie); background: var(--flaeche); border-radius: 999px; padding: 7px 13px; font-size: 14px; white-space: nowrap; }
.chip.an { background: var(--tinte); color: var(--bg); border-color: var(--tinte); }
.tag { display: inline-block; font-size: 12px; padding: 3px 8px; border-radius: 999px; background: var(--flaeche-2); color: var(--leise); margin: 0 4px 4px 0; }
.tag.ki { background: var(--salbei-sanft); color: var(--salbei); }
.suche { margin: 6px 0 10px; }

/* Karten-Listen */
.liste-karten { display: grid; gap: 10px; }
.eintrag { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: start; text-align: left; width: 100%;
  border: 0; background: var(--flaeche); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--schatten); }
.eintrag h3 { font-size: 17px; line-height: 1.25; }
.eintrag .meta { grid-column: 1 / -1; color: var(--leise); font-size: 13px; }
.eintrag .herz { color: var(--akzent); font-size: 18px; }

/* Heute */
.held { background: linear-gradient(140deg, var(--akzent) 0%, #d9784a 100%); color: #fff; border-radius: 24px; padding: 20px; box-shadow: var(--schatten); }
.held .ueber { opacity: .85; font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; margin: 0 0 6px; }
.held h2 { font-size: 26px; line-height: 1.15; margin-bottom: 8px; }
.held p { margin: 0 0 14px; opacity: .95; }
.held .btn { background: rgba(255,255,255,.18); border-color: rgba(255,255,255,.3); color: #fff; }
.held .btn.weiss { background: #fff; color: var(--akzent); border-color: #fff; }
.raster-2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.mini { border: 0; text-align: left; background: var(--flaeche); border-radius: var(--radius); padding: 14px; box-shadow: var(--schatten); display: grid; gap: 6px; }
.mini .emoji { font-size: 26px; }
.mini h3 { font-size: 16px; line-height: 1.25; }
.mini .meta { color: var(--leise); font-size: 12.5px; }
.kennzahlen { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.kennzahl { background: var(--flaeche); border-radius: var(--radius); padding: 12px; text-align: center; box-shadow: var(--schatten); border: 0; }
.kennzahl b { display: block; font-family: var(--serif); font-size: 26px; }
.kennzahl span { color: var(--leise); font-size: 12px; }

/* Liste */
.einkauf-neu { display: flex; gap: 8px; margin: 6px 0 4px; }
.einkauf-neu input { flex: 1; }
.einkauf-neu .btn { flex: none; width: 50px; padding: 0; font-size: 22px; }
.gruppe { margin-top: 18px; }
.gruppe h3 { font-family: var(--sans); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--leise); margin: 0 0 6px 4px; }
.posten { display: flex; align-items: center; gap: 12px; padding: 11px 14px; background: var(--flaeche); border-bottom: 1px solid var(--linie); }
.posten:first-of-type { border-radius: 14px 14px 0 0; }
.posten:last-child { border-radius: 0 0 14px 14px; border-bottom: 0; }
.posten:only-of-type { border-radius: 14px; }
.haken { flex: none; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--linie); background: none; display: grid; place-items: center; color: #fff; font-size: 14px; padding: 0; }
.posten.erledigt .haken { background: var(--salbei); border-color: var(--salbei); }
.posten.erledigt .p-name { text-decoration: line-through; color: var(--leise); }
.p-text { flex: 1; min-width: 0; }
.p-name { display: block; }
.p-quelle { display: block; font-size: 12px; color: var(--leise); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-menge { color: var(--leise); font-size: 14px; white-space: nowrap; }
.p-weg { border: 0; background: none; color: var(--leise); font-size: 18px; padding: 4px 6px; }
.leer { text-align: center; color: var(--leise); padding: 40px 16px; }
.leer .gross { font-size: 42px; display: block; margin-bottom: 6px; }

/* Sheet */
.sheet { position: fixed; inset: 0; z-index: 20; display: grid; align-items: end; justify-items: center; }
.sheet-hinter { position: absolute; inset: 0; background: rgba(20, 12, 8, .38); animation: ein .2s ease; }
.sheet-karte { position: relative; width: min(720px, 100%); max-height: 92dvh; overflow: auto; background: var(--bg);
  border-radius: 26px 26px 0 0; padding: 22px 20px calc(env(safe-area-inset-bottom) + 24px); animation: hoch .26s cubic-bezier(.2,.8,.2,1); overscroll-behavior: contain; }
.sheet-zu { position: sticky; top: 0; float: right; margin: -6px -6px 0 0; width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--flaeche-2); z-index: 1; }
.sheet h2 { font-size: 26px; line-height: 1.15; margin: 4px 44px 6px 0; }
.sheet .unter { color: var(--leise); margin: 0 0 14px; }
.sheet h3 { font-size: 18px; margin: 20px 0 8px; }
.sheet ol { padding-left: 22px; margin: 0; }
.sheet ol li { margin-bottom: 10px; }
.zutaten { list-style: none; padding: 0; margin: 0; background: var(--flaeche); border-radius: 14px; }
.zutaten li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--linie); }
.zutaten li:last-child { border-bottom: 0; }
.zutaten li span:last-child { color: var(--leise); white-space: nowrap; }
.stepper { display: inline-flex; align-items: center; gap: 4px; background: var(--flaeche); border-radius: 12px; border: 1px solid var(--linie); }
.stepper button { width: 36px; height: 34px; border: 0; background: none; font-size: 18px; }
.stepper b { min-width: 72px; text-align: center; font-size: 14px; }
.zeile { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 20px 0 8px; }
.zeile h3 { margin: 0; }
.fakten { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 16px; }
.fakt { background: var(--flaeche); border-radius: 12px; padding: 8px 12px; font-size: 14px; }
.fakt b { font-family: var(--serif); }
.sterne { display: flex; gap: 6px; margin: 6px 0 12px; }
.sterne button { border: 0; background: none; font-size: 30px; color: var(--linie); padding: 0; }
.sterne button.an { color: var(--gold); }
.formular { display: grid; gap: 10px; }
.ki-lade { display: grid; place-items: center; gap: 10px; padding: 34px 0; color: var(--leise); text-align: center; }
.punkt { width: 12px; height: 12px; border-radius: 50%; background: var(--akzent); animation: puls 1s infinite ease-in-out; }
.vorschlag { background: var(--flaeche); border-radius: var(--radius); padding: 16px; margin-top: 12px; box-shadow: var(--schatten); }
.vorschlag h3 { margin: 0 0 4px; }
.vorschlag p { margin: 6px 0 12px; }

.toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 84px); transform: translate(-50%, 20px); opacity: 0;
  background: var(--tinte); color: var(--bg); padding: 10px 16px; border-radius: 14px; font-size: 14px; z-index: 30; pointer-events: none;
  transition: all .25s ease; max-width: calc(100% - 32px); text-align: center; }
.toast.zeigen { opacity: 1; transform: translate(-50%, 0); }

@keyframes hoch { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes ein { from { opacity: 0; } }
@keyframes puls { 0%, 100% { transform: scale(.7); opacity: .5; } 50% { transform: scale(1); opacity: 1; } }
@keyframes wuerfel { 0% { transform: rotate(0) scale(1); } 50% { transform: rotate(180deg) scale(.85); } 100% { transform: rotate(360deg) scale(1); } }
.dreht { animation: wuerfel .45s ease; display: inline-block; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
