@font-face { font-family: "Inter"; src: url("/fonts/inter.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Bricolage Grotesque"; src: url("/fonts/bricolage.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }

:root {
  --bg: #FBF7F2; --card: #FFFFFF; --line: #EFE5D8; --field: #E2D6C8; --surface: #F1E8DC; --surface2: #E4D7C6;
  --ink: #2B1E17; --muted: #6E5847; --muted2: #5A4636; --brand: #674B3B; --accent: #F2B544;
  --cta: #B5302F; --ok: #3F7A4A; --on-dark: #E9DCCD;
  --display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --text: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --nav-h: 72px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--text); font-size: 16px; -webkit-text-size-adjust: 100%; }
body { min-height: 100dvh; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

#app { max-width: 560px; margin: 0 auto; min-height: 100dvh; position: relative; }
.screen { padding: calc(20px + env(safe-area-inset-top)) 20px calc(var(--nav-h) + 110px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; }
.screen.no-nav { padding-bottom: calc(110px + env(safe-area-inset-bottom)); }

h1, h2, h3 { font-family: var(--display); margin: 0; letter-spacing: -0.02em; }
h1 { font-weight: 800; font-size: 30px; line-height: 1.08; }
h2 { font-weight: 700; font-size: 19px; }
.sub { margin: 2px 0 0; font-size: 14px; color: var(--muted); }
.eyebrow { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.count { font-size: 14px; font-weight: 600; color: var(--muted); }

/* Buttons */
.btn { min-height: 52px; padding: 0 20px; border: 0; border-radius: 16px; background: var(--ink); color: var(--bg); font-weight: 600; font-size: 16px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; cursor: pointer; text-decoration: none; }
.btn.brand { background: var(--brand); color: #FFF; }
.btn.cta { background: var(--cta); color: #FFF; }
.btn.ghost { background: transparent; color: var(--muted2); border: 1.5px solid var(--field); }
.btn.danger { background: transparent; color: var(--cta); border: 1.5px solid #E7B9B4; }
.btn.small { min-height: 44px; padding: 0 16px; font-size: 14px; border-radius: 12px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: default; }
.icon-btn { width: 44px; height: 44px; flex: none; border-radius: 14px; border: 1.5px solid var(--field); background: var(--card); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--brand); padding: 0; }
.icon-btn.round { border-radius: 50%; border: 0; background: var(--bg); color: var(--ink); box-shadow: 0 2px 8px rgba(43,30,23,0.12); }
.avatar { width: 44px; height: 44px; flex: none; border-radius: 50%; border: 0; background: var(--brand); color: #FFF; font-weight: 600; font-size: 15px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; text-decoration: none; }
.avatar.sm { width: 30px; height: 30px; font-size: 12px; cursor: default; }
.avatar.xs { width: 22px; height: 22px; font-size: 10px; cursor: default; }
.avatar.alt { background: var(--accent); color: var(--ink); }
svg.i { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
svg.i.sm { width: 18px; height: 18px; }

/* Felder */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-size: 13px; font-weight: 600; color: var(--muted2); }
.input, select.input, textarea.input { width: 100%; min-height: 52px; border-radius: 14px; border: 1.5px solid var(--field); background: var(--card); padding: 0 16px; font-size: 16px; color: var(--ink); }
textarea.input { padding: 14px 16px; min-height: 140px; line-height: 1.5; resize: vertical; }
.input:focus { outline: none; border-color: var(--brand); }
.hint { font-size: 13px; color: var(--muted); margin: 0; }
.search { display: flex; align-items: center; gap: 10px; min-height: 50px; padding: 0 16px; border-radius: 14px; background: var(--card); border: 1.5px solid var(--field); color: var(--muted); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 16px; color: var(--ink); min-height: 48px; }
.switch { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 10px 14px; border-radius: 14px; background: var(--card); border: 1.5px solid var(--field); cursor: pointer; }
.switch input { width: 22px; height: 22px; accent-color: var(--brand); margin: 0; }

/* Chips */
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 0; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1.5px solid var(--field); background: var(--card); color: var(--muted2); font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.chip[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--bg); }

/* Rezeptkarten */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.card { display: flex; flex-direction: column; text-decoration: none; color: inherit; border-radius: 20px; overflow: hidden; background: var(--card); border: 1px solid var(--line); position: relative; }
.thumb { position: relative; aspect-ratio: 4 / 3; display: flex; align-items: center; justify-content: center; font-family: var(--display); font-weight: 800; font-size: 34px; color: rgba(43,30,23,0.55); overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.card .fav { position: absolute; right: 8px; top: 8px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255,255,255,0.95); display: flex; align-items: center; justify-content: center; color: var(--brand); cursor: pointer; z-index: 1; }
.fav[aria-pressed="true"] svg { fill: #E8875B; stroke: #E8875B; }
.card-body { padding: 10px 12px 12px; }
.card-title { margin: 0; font-weight: 600; font-size: 14px; line-height: 1.3; }
.card-meta { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.list { display: flex; flex-direction: column; gap: 10px; }
.list-item { display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: 20px; background: var(--card); border: 1px solid var(--line); }
.list-item .thumb { width: 64px; height: 64px; aspect-ratio: auto; flex: none; border-radius: 14px; font-size: 22px; }
.list-link { display: flex; gap: 12px; align-items: center; flex: 1; min-width: 0; text-decoration: none; color: inherit; }
.saved-btn[aria-pressed="true"] { background: var(--ok); border-color: var(--ok); color: #FFF; }

.empty { text-align: center; padding: 40px 16px; border-radius: 20px; background: var(--surface); color: var(--muted2); display: flex; flex-direction: column; gap: 12px; align-items: center; }
.empty p { margin: 0; }

/* Schwebende Elemente */
.fab { position: fixed; z-index: 20; right: max(16px, calc(50% - 264px)); bottom: calc(var(--nav-h) + 30px + env(safe-area-inset-bottom)); min-height: 54px; padding: 0 20px 0 16px; border-radius: 18px; border: 0; background: var(--cta); color: #FFF; text-decoration: none; display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; box-shadow: 0 8px 20px rgba(43,30,23,0.25); cursor: pointer; }
.bottom-bar { position: fixed; z-index: 20; left: 50%; transform: translateX(-50%); width: min(560px, 100%); padding: 0 16px; bottom: calc(20px + env(safe-area-inset-bottom)); display: flex; gap: 10px; }
.bottom-bar.above-nav { bottom: calc(var(--nav-h) + 28px + env(safe-area-inset-bottom)); }
nav.tabs { position: fixed; z-index: 30; left: 50%; transform: translateX(-50%); width: calc(min(560px, 100%) - 24px); bottom: calc(16px + env(safe-area-inset-bottom)); height: var(--nav-h); border-radius: 24px; background: var(--ink); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; padding: 8px; }
nav.tabs a { border-radius: 16px; color: var(--on-dark); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-decoration: none; font-size: 11px; font-weight: 600; position: relative; }
nav.tabs a[aria-current="page"] { background: var(--accent); color: var(--ink); }
nav.tabs .dot { position: absolute; top: 6px; right: calc(50% - 18px); width: 9px; height: 9px; border-radius: 50%; background: var(--cta); border: 2px solid var(--ink); }

/* Rezept-Detail */
.hero { position: relative; margin: calc(-20px - env(safe-area-inset-top)) -20px 0; height: 260px; display: flex; align-items: center; justify-content: center; font-family: var(--display); font-weight: 800; font-size: 64px; color: rgba(43,30,23,0.45); overflow: hidden; }
.hero img { width: 100%; height: 100%; object-fit: cover; }
.hero .tl, .hero .tr { position: absolute; top: calc(16px + env(safe-area-inset-top)); display: flex; gap: 8px; }
.hero .tl { left: 16px; } .hero .tr { right: 16px; }
.sheet-top { margin: -28px -20px 0; padding: 22px 20px 0; border-radius: 24px 24px 0 0; background: var(--bg); position: relative; display: flex; flex-direction: column; gap: 6px; }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.fact { padding: 12px; border-radius: 16px; background: var(--surface); }
.fact p { margin: 0; font-size: 12px; color: var(--muted); }
.fact strong { display: block; margin-top: 2px; font-size: 16px; }
.box { border-radius: 22px; background: var(--surface); padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.segmented { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; padding: 4px; border-radius: 14px; background: var(--surface2); }
.segmented button { min-height: 44px; border: 0; border-radius: 10px; background: transparent; color: var(--muted2); font-weight: 600; font-size: 14px; cursor: pointer; }
.segmented button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(43,30,23,0.15); }
.stepper { display: flex; align-items: center; gap: 4px; padding: 4px; border-radius: 14px; background: var(--card); }
.stepper button { width: 44px; height: 44px; border: 0; border-radius: 10px; background: var(--surface); font-size: 20px; cursor: pointer; color: var(--ink); }
.stepper output { min-width: 44px; text-align: center; font-size: 18px; font-weight: 700; }
.result { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px; background: var(--ink); color: var(--bg); font-size: 14px; }
.result strong { font-family: var(--display); font-weight: 800; font-size: 20px; color: var(--accent); }
details summary { cursor: pointer; font-weight: 600; font-size: 13px; color: var(--muted2); min-height: 28px; display: flex; align-items: center; }
details p { margin: 6px 0 0; font-size: 13px; line-height: 1.5; color: var(--muted2); }
.ing { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.ing span:last-child { font-weight: 600; color: var(--brand); text-align: right; white-space: nowrap; }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; counter-reset: s; }
.steps li { display: flex; gap: 14px; counter-increment: s; font-size: 15px; line-height: 1.55; }
.steps li::before { content: counter(s); width: 32px; height: 32px; flex: none; border-radius: 50%; background: var(--accent); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; }
.notes { margin: 0; padding: 14px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); font-size: 15px; line-height: 1.5; white-space: pre-line; }
.badge { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 0 10px; border-radius: 999px; background: var(--surface); font-size: 12px; font-weight: 600; color: var(--muted2); }

/* Chat */
.chat-log { display: flex; flex-direction: column; gap: 10px; }
.msg { display: flex; gap: 8px; align-items: flex-end; max-width: 85%; }
.msg.me { align-self: flex-end; flex-direction: row-reverse; }
.bubble { padding: 10px 14px; border-radius: 18px 18px 18px 6px; background: var(--card); border: 1px solid var(--line); font-size: 15px; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.me .bubble { border-radius: 18px 18px 6px 18px; background: var(--brand); color: #FFF; border-color: var(--brand); }
.msg .who { font-size: 11px; font-weight: 600; color: var(--muted); margin: 0 0 2px 4px; }
.msg-recipe { display: flex; gap: 10px; align-items: center; padding: 8px; border-radius: 16px; background: var(--surface); text-decoration: none; color: var(--ink); margin-top: 6px; min-width: 200px; }
.msg-recipe .thumb { width: 48px; height: 48px; aspect-ratio: auto; border-radius: 12px; font-size: 18px; }
.day { align-self: center; font-size: 12px; color: var(--muted); padding: 4px 0; }
.composer { flex: 1; display: flex; gap: 8px; align-items: center; padding: 6px; border-radius: 20px; background: var(--card); border: 1.5px solid var(--field); box-shadow: 0 6px 18px rgba(43,30,23,0.1); }
.composer input { flex: 1; min-width: 0; min-height: 44px; border: 0; outline: 0; background: transparent; font-size: 16px; }
.composer .send { width: 44px; height: 44px; border: 0; border-radius: 14px; background: var(--cta); color: #FFF; display: flex; align-items: center; justify-content: center; cursor: pointer; }

/* Einkaufen */
.progress { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.progress div { height: 100%; border-radius: 999px; background: var(--ok); transition: width 0.25s; }
.shop-group { display: flex; flex-direction: column; gap: 6px; }
.shop-box { border-radius: 18px; background: var(--card); border: 1px solid var(--line); overflow: hidden; }
.shop-row { display: flex; align-items: center; gap: 12px; min-height: 54px; padding: 0 6px 0 14px; border-top: 1px solid #F3ECE2; }
.shop-row:first-child { border-top: 0; }
.shop-row label { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; min-height: 52px; cursor: pointer; }
.shop-row input { width: 22px; height: 22px; accent-color: var(--ok); margin: 0; flex: none; }
.shop-row .name { flex: 1; font-size: 15px; }
.shop-row .amt { font-size: 14px; color: var(--muted); white-space: nowrap; }
.shop-row.done .name { color: #8A7462; text-decoration: line-through; }
.shop-row .icon-btn { border: 0; background: transparent; color: var(--muted); }

/* Anmeldung */
.auth-hero { position: relative; margin: 0; min-height: 340px; background: var(--brand); display: flex; flex-direction: column; justify-content: flex-end; padding: calc(28px + env(safe-area-inset-top)) 28px 32px; overflow: hidden; color: #FFF; }
.auth-hero .rings { position: absolute; right: -70px; top: -40px; width: 300px; height: 300px; opacity: 0.18; }
.logo { display: flex; align-items: center; gap: 10px; margin-bottom: auto; font-family: var(--display); font-weight: 700; font-size: 18px; }
.logo span.mark { width: 40px; height: 40px; border-radius: 12px; background: var(--accent); display: flex; align-items: center; justify-content: center; color: var(--ink); }
.auth-hero .eyebrow { color: var(--accent); margin-bottom: 10px; }
.auth-hero h1 { color: #FFF; font-size: 40px; line-height: 1.02; }
.auth-form { padding: 28px 28px calc(28px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 16px; }
.links { display: flex; justify-content: space-between; font-size: 14px; }
.links button { background: none; border: 0; color: var(--brand); text-decoration: underline; cursor: pointer; min-height: 44px; padding: 0; font-size: 14px; }
.error { margin: 0; padding: 12px 14px; border-radius: 12px; background: #FBE7E4; color: #8E2420; font-size: 14px; }

/* Dialoge */
dialog.sheet { border: 0; padding: 0; margin: auto auto 0; width: min(560px, 100%); max-width: 100%; max-height: 88dvh; border-radius: 24px 24px 0 0; background: var(--bg); color: var(--ink); }
dialog.sheet::backdrop { background: rgba(43,30,23,0.45); }
.sheet-inner { padding: 22px 20px calc(24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; overflow-y: auto; max-height: 88dvh; }
.menu { display: flex; flex-direction: column; border-radius: 18px; background: var(--card); border: 1px solid var(--line); overflow: hidden; }
.menu button { display: flex; align-items: center; gap: 12px; min-height: 54px; padding: 0 16px; border: 0; border-top: 1px solid #F3ECE2; background: transparent; text-align: left; font-size: 15px; cursor: pointer; color: var(--ink); }
.menu button:first-child { border-top: 0; }
.menu button.danger { color: var(--cta); }
.people { display: flex; flex-direction: column; border-radius: 18px; background: var(--card); border: 1px solid var(--line); overflow: hidden; }
.people .p { display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 6px 8px 6px 14px; border-top: 1px solid #F3ECE2; }
.people .p:first-child { border-top: 0; }
.code { font-family: ui-monospace, Menlo, Consolas, monospace; font-weight: 700; font-size: 17px; letter-spacing: 0.08em; }

.toast { position: fixed; z-index: 100; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + 100px + env(safe-area-inset-bottom)); max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 14px; background: var(--ink); color: var(--bg); font-size: 14px; box-shadow: 0 8px 24px rgba(43,30,23,0.3); }
.loading { padding: 60px 0; text-align: center; color: var(--muted); }

@media (min-width: 600px) {
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  dialog.sheet { margin: auto; border-radius: 24px; }
}
