:root {
  --bg: #f2f5f1;
  --card: #ffffff;
  --ink: #12201a;
  --muted: #66766c;
  --line: #e2e8e1;
  --soft: #e7f6ef;
  --accent: #12b886;
  --accent-2: #0b946d;
  --accent-ink: #ffffff;
  --warn-bg: #fff4dc;
  --warn-ink: #7a5300;
  --danger: #e8493c;
  --danger-bg: #fdeceb;
  --ring-a: #3ddc9f;
  --ring-b: #0e9f74;
  --mp: #8b5cf6;
  --mc: #3b82f6;
  --mf: #f59e0b;
  --shadow: 0 1px 2px rgba(18, 32, 26, .05), 0 8px 24px rgba(18, 32, 26, .06);
  --radius: 22px;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1411;
    --card: #151f1a;
    --ink: #e8f2ec;
    --muted: #8fa497;
    --line: #25322b;
    --soft: #173126;
    --warn-bg: #3a2e12;
    --warn-ink: #f3cf7d;
    --danger-bg: #3a1d1b;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.38 ui-rounded, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
body.lock { overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; text-align: inherit; touch-action: manipulation; }
button:disabled { cursor: default; }
h1, h2, h3, p { margin: 0; }
small { font-size: .78em; color: var(--muted); font-weight: 500; }
.ic { display: block; flex: none; }
[hidden] { display: none !important; }
.grow { flex: 1; min-width: 0; }

#app { max-width: 560px; margin: 0 auto; padding: calc(var(--sat) + 6px) 16px calc(112px + var(--sab)); min-height: 100dvh; }
.page { animation: fadeUp .35s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Navigation ---------- */
#nav {
  position: fixed; z-index: 20; left: 50%; bottom: 0; transform: translateX(-50%);
  width: min(100%, 560px);
  display: grid; grid-template-columns: 1fr 1fr 92px 1fr 1fr;
  padding: 8px 8px calc(8px + var(--sab));
  background: color-mix(in srgb, var(--card) 86%, transparent);
  backdrop-filter: saturate(1.6) blur(18px); -webkit-backdrop-filter: saturate(1.6) blur(18px);
  border-top: 1px solid var(--line);
}
.nav-btn { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0; color: var(--muted); font-size: 11px; font-weight: 600; transition: color .2s; }
.nav-btn.on { color: var(--accent-2); }
@media (prefers-color-scheme: dark) { .nav-btn.on { color: var(--accent); } }
.fab-slot { position: relative; }
.fab-slot::after { content: 'Tracken'; position: absolute; bottom: 6px; left: 0; right: 0; text-align: center; font-size: 11px; font-weight: 700; color: var(--accent-2); }
.fab {
  position: absolute; left: 50%; bottom: calc(34px + var(--sab)); transform: translateX(-50%);
  width: 66px; height: 66px; border-radius: 50%; display: grid; place-items: center; color: #fff;
  background: linear-gradient(145deg, #2ee6a8, #0b9a72);
  box-shadow: 0 10px 24px rgba(18, 184, 134, .45), 0 0 0 5px var(--bg);
  transition: transform .15s;
}
.fab:active { transform: translateX(-50%) scale(.92); }
.fab span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Top bar ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0 12px; }
.topbar.plain h1 { font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
.date-title { flex: 1; text-align: center; display: grid; line-height: 1.15; }
.date-title b { font-size: 21px; font-weight: 800; letter-spacing: -.01em; }
.date-title small { margin-top: 2px; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: var(--ink); background: var(--card); box-shadow: var(--shadow); flex: none; }
.icon-btn:disabled { opacity: .3; box-shadow: none; }
.icon-btn:active:not(:disabled) { transform: scale(.94); }
.icon-btn.sm { width: 34px; height: 34px; box-shadow: none; background: transparent; color: var(--muted); }

.card { background: var(--card); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 14px; }
h2.sec { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 4px 8px; }
h2.sec.in { margin: 0 0 12px; }

/* ---------- Heute ---------- */
.hero { display: flex; align-items: center; gap: 18px; padding: 20px; background: linear-gradient(160deg, var(--card) 0%, var(--soft) 140%); }
.ring-wrap { position: relative; width: 168px; flex: none; }
.ring { width: 100%; display: block; }
.ring circle { fill: none; stroke-width: 15; }
.ring-bg { stroke: var(--line); }
.ring-fg { stroke-linecap: round; transition: stroke-dashoffset 1.1s cubic-bezier(.2, .8, .2, 1); }
.ring stop:nth-child(1) { stop-color: var(--ring-a); }
.ring stop:nth-child(2) { stop-color: var(--ring-b); }
.ring.over { --ring-a: #ff9d6c; --ring-b: #f0483c; }
.ring-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring-center b { font-size: 34px; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.ring-center span { font-size: 12px; color: var(--muted); font-weight: 600; margin-top: 4px; }
.hero-side { display: grid; gap: 14px; flex: 1; }
.stat small { display: block; }
.stat b { font-size: 24px; font-weight: 800; letter-spacing: -.02em; }

.macros { display: grid; gap: 14px; }
.macro-top { display: flex; justify-content: space-between; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.macro-top b { font-weight: 750; }
.bar { height: 9px; border-radius: 99px; background: var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 99px; transition: width .9s cubic-bezier(.2, .8, .2, 1); animation: grow .9s cubic-bezier(.2, .8, .2, 1) backwards; }
@keyframes grow { from { width: 0 !important; } }
.mp .bar i { background: var(--mp); } .mc .bar i { background: var(--mc); } .mf .bar i { background: var(--mf); }

.meal { margin-bottom: 14px; }
.meal-head { display: flex; align-items: center; gap: 10px; padding: 0 4px 8px; }
.meal-head h3 { font-size: 17px; font-weight: 750; flex: 1; }
.m-ic { font-size: 20px; }
.m-sum { font-size: 14px; color: var(--muted); font-weight: 650; }
.add-mini { width: 32px; height: 32px; border-radius: 50%; background: var(--soft); color: var(--accent-2); display: grid; place-items: center; }
.entries { background: var(--card); border-radius: 18px; box-shadow: var(--shadow); overflow: hidden; }
.entry { display: flex; align-items: center; gap: 12px; width: 100%; padding: 13px 16px; }
.entry + .entry { border-top: 1px solid var(--line); }
.entry:active { background: var(--soft); }
.e-main { flex: 1; min-width: 0; display: grid; }
.e-main b, .r-main b { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.e-main small, .r-main small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.e-kcal { text-align: right; font-weight: 750; white-space: nowrap; }
.e-kcal small, .r-kcal small { display: block; font-weight: 500; }
.meal-empty { width: 100%; padding: 13px; border: 1.5px dashed var(--line); border-radius: 18px; color: var(--muted); text-align: center; font-weight: 600; font-size: 15px; }
.meal-empty:active { background: var(--soft); }

/* ---------- Verlauf ---------- */
.chart svg { width: 100%; display: block; overflow: visible; }
.chart { padding: 14px 12px 8px; }
.vbar { transition: opacity .2s; }
.vbar.ok { fill: var(--accent); } .vbar.over { fill: #f0786a; } .vbar.none { fill: var(--line); }
.bar-g { cursor: pointer; }
.bar-g.is-today .ax { fill: var(--ink); font-weight: 700; }
.ax { fill: var(--muted); font-size: 10px; font-family: inherit; }
.goal-line { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 4 4; opacity: .6; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 4px; }
.stat-card { padding: 14px 12px; margin: 0; text-align: center; display: grid; gap: 2px; }
.stat-card b { font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.stat-card span { font-size: 12px; color: var(--muted); }
.seg { display: flex; background: var(--soft); border-radius: 14px; padding: 4px; gap: 2px; }
.seg button { flex: 1; padding: 10px 6px; border-radius: 11px; font-weight: 650; font-size: 15px; text-align: center; color: var(--muted); transition: background .2s, color .2s; }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 4px rgba(0, 0, 0, .12); }
.seg.small { flex: none; }
.seg.small button { padding: 7px 12px; font-size: 14px; white-space: nowrap; flex: none; }
.list { padding: 6px 16px; }
.hrow { display: grid; grid-template-columns: 92px 1fr 56px; align-items: center; gap: 10px; width: 100%; padding: 12px 0; }
.hrow + .hrow { border-top: 1px solid var(--line); }
.hrow > span:first-child { font-weight: 600; }
.hrow b { text-align: right; }
.hbar { height: 8px; background: var(--line); border-radius: 9px; overflow: hidden; }
.hbar i { display: block; height: 100%; background: var(--accent); border-radius: 9px; }
.hbar i.over { background: #f0786a; }

/* ---------- Listen / Reihen ---------- */
.row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; margin-bottom: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; transition: transform .1s, background .15s; }
.row:active { transform: scale(.985); background: var(--soft); }
.page > .list .row, #plist .row { border: 0; border-radius: 0; margin: 0; padding: 12px 0; background: none; }
#plist .row + .row { border-top: 1px solid var(--line); }
.r-main { flex: 1; min-width: 0; display: grid; }
.r-kcal { text-align: right; font-weight: 750; white-space: nowrap; font-size: 17px; }
.r-kcal small { font-size: 11px; }
.thumb { position: relative; width: 46px; height: 46px; border-radius: 14px; background: var(--soft); display: grid; place-items: center; overflow: hidden; flex: none; }
.thumb .emo { font-size: 23px; line-height: 1; display: grid; place-items: center; color: var(--accent-2); }
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.thumb.lg { width: 64px; height: 64px; border-radius: 18px; }
.thumb.lg .emo { font-size: 32px; }
.add-row .thumb, .code-row .thumb { background: var(--soft); }
.list-label { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; margin: 16px 4px 8px; display: flex; gap: 8px; align-items: baseline; }
.list-label i { font-style: normal; text-transform: none; letter-spacing: 0; font-weight: 500; opacity: .8; }
.empty { text-align: center; color: var(--muted); padding: 24px 12px; }
.hero-empty { text-align: center; padding: 34px 20px; color: var(--muted); display: grid; gap: 6px; justify-items: center; }
.hero-empty b { color: var(--ink); font-size: 18px; }
.hero-empty p { max-width: 300px; font-size: 15px; }
.big-emo { font-size: 54px; line-height: 1; margin-bottom: 6px; }
.mini-actions { display: grid; gap: 8px; margin-top: 16px; }

.note { padding: 12px 14px; border-radius: 14px; background: var(--soft); font-size: 14px; margin: 12px 0; }
.note.warn { background: var(--warn-bg); color: var(--warn-ink); }
.note.soft { color: var(--muted); }
.note b { font-weight: 700; }
.err { color: var(--danger); background: var(--danger-bg); padding: 10px 14px; border-radius: 12px; font-size: 14px; font-weight: 600; margin: 10px 0; }
.muted { color: var(--muted); font-size: 14px; }
.hint { min-height: 20px; text-align: center; color: var(--muted); font-size: 14px; margin: 8px 0; }
.loading { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 14px 4px; font-size: 15px; }
.spin { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid var(--line); border-top-color: var(--accent); animation: rot .7s linear infinite; flex: none; }
@keyframes rot { to { transform: rotate(360deg); } }
.link { color: var(--accent-2); font-weight: 650; padding: 8px 2px; }
.link.block { display: block; width: 100%; text-align: center; margin-top: 4px; }
@media (prefers-color-scheme: dark) { .link { color: var(--accent); } }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 14px 18px; border-radius: 16px; font-weight: 700; background: var(--soft); color: var(--ink); text-align: center; transition: transform .1s, opacity .2s; }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn.primary { background: linear-gradient(145deg, #1fcf9a, #0d9a73); color: #fff; box-shadow: 0 6px 16px rgba(18, 184, 134, .32); }
.btn.primary:disabled { opacity: .4; box-shadow: none; }
.btn.ghost { background: var(--soft); color: var(--accent-2); }
@media (prefers-color-scheme: dark) { .btn.ghost { color: var(--accent); } }
.btn.danger { background: var(--danger-bg); color: var(--danger); }
.btn.danger.ghosty { background: transparent; }
.btn.icon { width: 54px; padding: 0; flex: none; }
.btn.wide { width: 100%; }
.btn.small { padding: 9px 14px; font-size: 14px; border-radius: 13px; }
.btn-col { display: grid; gap: 10px; }
.btn-col label.btn { cursor: pointer; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-left: -18px; margin-right: -18px; padding: 2px 18px; }
.chips.scroll::-webkit-scrollbar { display: none; }
.field .chips.scroll { margin-left: 0; margin-right: 0; padding-left: 0; padding-right: 0; }
.chip { flex: none; padding: 9px 14px; border-radius: 99px; background: var(--card); border: 1px solid var(--line); font-weight: 600; font-size: 15px; white-space: nowrap; transition: background .15s, color .15s, border-color .15s; }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip.soft { background: var(--soft); border-color: transparent; color: var(--accent-2); }
@media (prefers-color-scheme: dark) { .chip.soft { color: var(--accent); } }

/* ---------- Formulare ---------- */
.field { display: grid; gap: 6px; margin-bottom: 14px; min-width: 0; }
.field > span { font-size: 13px; font-weight: 650; color: var(--muted); }
.field > span i { font-style: normal; font-weight: 500; opacity: .8; }
.field input, .field select, .search input {
  width: 100%; height: 50px; padding: 0 14px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--card);
  font-size: 16px; outline: none; transition: border-color .15s, box-shadow .15s; -webkit-appearance: none; appearance: none;
}
.field select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 21px, calc(100% - 15px) 21px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
.field input:focus, .field select:focus, .search input:focus, .amount-in input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); }
.big-field input { height: 62px; font-size: 28px; font-weight: 750; padding-right: 60px; }
.with-unit { position: relative; }
.with-unit i { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-style: normal; color: var(--muted); font-weight: 600; pointer-events: none; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mt { margin-top: 12px; }
.urow { display: grid; grid-template-columns: 1fr auto 76px auto 34px; gap: 8px; align-items: center; margin-bottom: 8px; }
.urow input { height: 44px !important; }
.urow span { color: var(--muted); font-size: 14px; }
.photo-row { display: flex; gap: 14px; align-items: flex-end; }
.photo { width: 76px; height: 76px; border-radius: 22px; background: var(--soft); color: var(--accent-2); display: grid; place-items: center; overflow: hidden; border: 1.5px dashed color-mix(in srgb, var(--accent) 50%, transparent); flex: none; margin-bottom: 14px; }
.photo img { width: 100%; height: 100%; object-fit: cover; }

.search { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1.5px solid var(--line); border-radius: 18px; padding: 0 14px; margin-bottom: 14px; box-shadow: var(--shadow); color: var(--muted); }
.search:focus-within { border-color: var(--accent); }
.search input { border: 0 !important; box-shadow: none !important; padding: 0; height: 52px; background: transparent; flex: 1; min-width: 0; color: var(--ink); }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }

/* ---------- Sheets ---------- */
#sheets { position: relative; z-index: 50; }
.sheet-wrap { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
.sheet-wrap.open { pointer-events: auto; }
.backdrop { position: absolute; inset: 0; background: rgba(8, 16, 12, .5); opacity: 0; transition: opacity .28s; }
.sheet-wrap.open .backdrop { opacity: 1; }
.sheet {
  position: absolute; left: 50%; bottom: 0; width: min(100%, 560px); max-height: 94dvh;
  background: var(--bg); border-radius: 28px 28px 0 0; display: flex; flex-direction: column; overflow: hidden;
  transform: translate(-50%, 102%); transition: transform .34s cubic-bezier(.2, .85, .2, 1);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, .25);
}
.sheet-wrap.open .sheet { transform: translate(-50%, 0); }
.sheet.tall { height: min(94dvh, 900px); }
.sheet.full { height: 100dvh; max-height: none; border-radius: 0; }
.grab { width: 40px; height: 5px; border-radius: 9px; background: var(--line); margin: 8px auto 2px; flex: none; }
.sh-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 18px 12px; flex: none; }
.sh-head h2 { font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.sh-sub { display: block; font-size: 13px; color: var(--muted); font-weight: 500; margin-top: 1px; }
.sh-head .icon-btn { box-shadow: none; background: var(--soft); }
.sh-body { flex: 1; overflow-y: auto; padding: 4px 18px 24px; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.sh-foot { flex: none; display: flex; gap: 10px; padding: 12px 18px calc(12px + var(--sab)); background: var(--bg); border-top: 1px solid var(--line); }

.big-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 4px; }
.big { position: relative; display: grid; align-content: end; gap: 1px; min-height: 132px; padding: 14px 16px; border-radius: 24px; color: #fff; overflow: hidden; transition: transform .12s; }
.big:active { transform: scale(.97); }
.big b { font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
.big small { color: rgba(255, 255, 255, .82); }
.big .big-ic { position: absolute; top: 14px; left: 16px; font-size: 28px; line-height: 1; opacity: .95; }
.big.scan { background: linear-gradient(150deg, #20d3a0, #0a8e69); box-shadow: 0 10px 24px rgba(18, 184, 134, .32); }
.big.deliv { background: linear-gradient(150deg, #ffb347, #ee5a24); box-shadow: 0 10px 24px rgba(238, 90, 36, .28); }
.big::after { content: ''; position: absolute; right: -24px; top: -24px; width: 100px; height: 100px; border-radius: 50%; background: rgba(255, 255, 255, .14); }

.gridcards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.gcard { display: grid; gap: 2px; padding: 14px; border-radius: 20px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); transition: transform .1s; }
.gcard:active { transform: scale(.97); }
.gcard .gicon { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-size: 24px; background: color-mix(in srgb, var(--gc) 18%, transparent); margin-bottom: 8px; }
.gcard b { font-weight: 700; line-height: 1.2; }

/* Menge */
.prod-head { display: flex; gap: 14px; align-items: center; margin: 4px 0 8px; }
.prod-head h3 { font-size: 20px; font-weight: 800; letter-spacing: -.01em; line-height: 1.2; }
.prod-head p { color: var(--muted); font-size: 14px; }
.kcal-hero { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 0 6px; }
.kcal-num { display: flex; align-items: baseline; gap: 6px; }
.kcal-num span { font-size: 58px; font-weight: 800; letter-spacing: -.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.kcal-num small { font-size: 16px; font-weight: 700; }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { padding: 6px 10px; border-radius: 99px; font-size: 13px; font-weight: 700; background: var(--card); border: 1px solid var(--line); white-space: nowrap; }
.pill::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: currentColor; }
.pill.p::before { color: var(--mp); } .pill.c::before { color: var(--mc); } .pill.f::before { color: var(--mf); }
.amount { display: grid; grid-template-columns: 58px 1fr 58px; gap: 12px; align-items: center; margin: 14px 0 4px; }
.step { width: 58px; height: 58px; border-radius: 50%; background: var(--card); box-shadow: var(--shadow); display: grid; place-items: center; color: var(--accent-2); border: 1px solid var(--line); }
.step:active { transform: scale(.92); background: var(--soft); }
.amount-in { position: relative; }
.amount-in input { width: 100%; height: 66px; text-align: center; font-size: 34px; font-weight: 800; border-radius: 20px; border: 1.5px solid var(--line); background: var(--card); outline: none; padding: 0 8px 14px; font-variant-numeric: tabular-nums; }
.amount-in input.bad { border-color: var(--danger); }
.amount-in span { position: absolute; left: 0; right: 0; bottom: 6px; text-align: center; font-size: 12px; color: var(--muted); font-weight: 700; pointer-events: none; }

/* Scanner */
.sheet.scan { background: #000; }
.sheet.scan .grab { display: none; }
.scan-view { position: relative; flex: 1; overflow: hidden; background: #0a0f0d; min-height: 0; }
.scan-view video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.reticle { position: absolute; left: 50%; top: 42%; width: min(78%, 360px); aspect-ratio: 1.9; transform: translate(-50%, -50%); border-radius: 22px; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .52); }
.reticle b { position: absolute; width: 34px; height: 34px; border: 4px solid #fff; }
.reticle .c1 { left: -3px; top: -3px; border-right: 0; border-bottom: 0; border-top-left-radius: 22px; }
.reticle .c2 { right: -3px; top: -3px; border-left: 0; border-bottom: 0; border-top-right-radius: 22px; }
.reticle .c3 { left: -3px; bottom: -3px; border-right: 0; border-top: 0; border-bottom-left-radius: 22px; }
.reticle .c4 { right: -3px; bottom: -3px; border-left: 0; border-top: 0; border-bottom-right-radius: 22px; }
.reticle i { position: absolute; left: 8%; right: 8%; top: 10%; height: 2px; background: #3ddc9f; box-shadow: 0 0 14px 2px #3ddc9f; border-radius: 2px; animation: laser 2s ease-in-out infinite alternate; }
@keyframes laser { to { top: 88%; } }
.scan-top { position: absolute; top: calc(var(--sat) + 12px); left: 14px; right: 14px; display: flex; justify-content: space-between; }
.round { width: 46px; height: 46px; border-radius: 50%; background: rgba(0, 0, 0, .45); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); color: #fff; display: grid; place-items: center; }
.round.on { background: #ffd43b; color: #000; }
.scan-msg { position: absolute; left: 24px; right: 24px; top: calc(42% + min(78vw, 360px) / 3.8 + 28px); text-align: center; color: #fff; font-weight: 650; text-shadow: 0 1px 8px rgba(0, 0, 0, .6); }
.scan-view.nocam { background: linear-gradient(160deg, #15251d, #0a0f0d); }
.scan-view.nocam .reticle, .scan-view.nocam video { display: none; }
.scan-view.nocam .scan-msg { top: 50%; transform: translateY(-50%); line-height: 1.5; }
.scan-panel { position: absolute; left: 12px; right: 12px; bottom: 12px; padding: 16px; border-radius: 22px; background: var(--card); box-shadow: 0 10px 40px rgba(0, 0, 0, .5); display: grid; gap: 6px; }
.scan-panel p { color: var(--muted); font-size: 14px; }
.row-btns { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.row-btns .btn { flex: 1; padding: 12px 10px; font-size: 14px; }
.scan-foot { flex: none; background: var(--bg); padding: 12px 16px calc(12px + var(--sab)); display: grid; gap: 10px; }
#manual { display: flex; gap: 8px; }
#manual input { flex: 1; min-width: 0; height: 50px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--card); padding: 0 14px; font-size: 16px; outline: none; letter-spacing: .04em; }
#manual input:focus { border-color: var(--accent); }
.scan-foot .btn.wide { cursor: pointer; }

/* ---------- Toasts ---------- */
#toasts { position: fixed; z-index: 90; left: 0; right: 0; bottom: calc(100px + var(--sab)); display: grid; gap: 8px; justify-items: center; pointer-events: none; padding: 0 16px; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 14px; max-width: 520px; padding: 12px 16px; border-radius: 16px; background: #17231d; color: #fff; font-weight: 600; font-size: 15px; box-shadow: 0 10px 30px rgba(0, 0, 0, .3); opacity: 0; transform: translateY(12px) scale(.98); transition: opacity .25s, transform .25s; }
@media (prefers-color-scheme: dark) { .toast { background: #e8f2ec; color: #12201a; } .toast button { color: #0b8f6a; } }
.toast.in { opacity: 1; transform: none; }
.toast.out { opacity: 0; transform: translateY(8px); }
.toast button { color: #4be3b0; font-weight: 800; padding: 4px 2px; }

.about p { font-size: 14px; color: var(--muted); margin-bottom: 8px; }
.calc-res { margin-top: 14px; padding: 14px; background: var(--soft); border-radius: 16px; display: grid; gap: 8px; }
.calc-res p { font-size: 14px; }
.calc-res .big-line { font-size: 18px; }
.calc-res .big-line b { font-size: 24px; color: var(--accent-2); }

@media (min-width: 700px) {
  .sheet { border-radius: 28px; bottom: 4vh; }
  .sheet.full { border-radius: 28px; height: 92dvh; bottom: 4vh; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
.ocr-btn { margin: 4px 0 6px; cursor: pointer; }

/* Rezept im Produktformular */
.irow { display: grid; grid-template-columns: 1fr auto 34px; gap: 8px; align-items: center; padding: 8px 12px; margin-bottom: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
.i-main { display: grid; min-width: 0; text-align: left; }
.i-main b { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); font-size: 15px; }
.i-main small { color: var(--muted); }
.i-kcal { text-align: right; font-weight: 750; font-size: 15px; white-space: nowrap; }
.i-kcal small { display: block; font-size: 11px; }
.rsum { background: var(--soft); border-radius: 16px; padding: 12px 14px; display: grid; gap: 8px; margin: 4px 0 6px; }
.rsum-line { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; }
.rsum-line.strong { font-weight: 700; }
.rsum-line.strong b { text-align: right; font-size: 14px; }
.rport { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; }
.rport input { width: 80px; height: 42px; text-align: center; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card); font-size: 16px; font-weight: 700; outline: none; }
.rport input:focus { border-color: var(--accent); }
.field input[readonly] { background: var(--soft); color: var(--muted); }
