:root {
  --bg: #efe8dd;
  --ink: #2f2426;
  --muted: #7c7370;
  --line: #e4dbcf;
  --card: #fffaf2;
  --white: #ffffff;
  --green: #6fa88b;
  --green-dark: #43745c;
  --orchid: #9c7bc9;
  --plum: #72559e;
  --orchid-soft: #f0e9fa;
  --yellow: #e5ad44;
  --red: #d9655b;
  --blue: #587b9d;
  --shadow: 0 24px 80px rgba(47, 36, 38, 0.2);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 12% 10%, #fff7ea 0, transparent 26%), var(--bg); }
button, input, select { font: inherit; }
button { border: 0; cursor: pointer; }

.stage {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 430px) minmax(280px, 520px);
  gap: 56px;
  align-items: center;
  justify-content: center;
  padding: 34px;
}

.phone {
  width: min(100%, 390px);
  height: min(844px, calc(100vh - 34px));
  min-height: 700px;
  margin: 0 auto;
  border: 8px solid var(--ink);
  border-radius: 42px;
  background: var(--white);
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
}

.screen { height: 100%; display: flex; flex-direction: column; background: #fffaf3; }
.scroll { flex: 1; overflow: auto; padding: 18px 18px 96px; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 18px 18px 8px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: 0; }
.leaf { width: 36px; height: 36px; background: url("../icons/nutriveal-mark.png") center/contain no-repeat; }
.brand span { background: linear-gradient(90deg, var(--green) 0%, var(--green) 45%, var(--orchid) 55%, var(--orchid) 100%); -webkit-background-clip: text; background-clip: text; color: transparent; font-weight: 700; font-size: 20px; letter-spacing: -0.5px; }
.icon-btn { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 14px; background: #f1e8dc; color: var(--plum); }
.icon { width: 20px; height: 20px; stroke: currentColor; stroke-width: 2.2; fill: none; stroke-linecap: round; stroke-linejoin: round; }

.headline { font-size: 32px; line-height: 1.02; margin: 18px 0 10px; letter-spacing: 0; }
.subtle { color: var(--muted); line-height: 1.45; }
.section-title { font-size: 16px; margin: 24px 0 12px; font-weight: 800; }
.section-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.section-row .section-title { margin-bottom: 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 14px; }
.hero-panel { background: #2f2426; color: white; border-radius: 8px; padding: 18px; min-height: 190px; display: grid; grid-template-columns: 1fr 112px; gap: 14px; overflow: hidden; }
.hero-panel p { color: rgba(255,255,255,.72); margin: 8px 0 16px; font-size: 14px; }
.product-art { align-self: end; justify-self: center; width: 104px; height: 142px; border-radius: 10px; background: linear-gradient(180deg, #fafafa, #ddd); box-shadow: 0 18px 34px rgba(0,0,0,.25); position: relative; overflow: hidden; }
.product-art:before { content: ""; position: absolute; inset: 22px 13px 40px; border-radius: 8px; background: var(--green); }
.product-art:after { content: "WHEY"; position: absolute; left: 0; right: 0; top: 52px; text-align: center; color: #fff; font-size: 17px; font-weight: 900; }
.primary { min-height: 52px; border-radius: 16px; background: var(--green); color: white; font-weight: 800; padding: 0 18px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.purple-cta { background: var(--plum); box-shadow: 0 12px 24px rgba(114, 85, 158, .24); }
.secondary { min-height: 48px; border-radius: 16px; background: #efe6d8; color: var(--ink); font-weight: 800; padding: 0 16px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.secondary.compact { min-height: 52px; padding-inline: 14px; }
.ghost { background: transparent; color: var(--green-dark); font-weight: 800; }
.mini-btn { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 12px; background: #f1e8dc; color: var(--muted); font-size: 22px; line-height: 1; flex: none; }
.quick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.quick { border-radius: 8px; background: white; border: 1px solid var(--line); padding: 12px 8px; text-align: left; min-height: 86px; }
.quick strong { display: block; font-size: 21px; }
.quick span { color: var(--muted); font-size: 12px; }
.quick-premium { background: var(--orchid-soft); border-color: #ded0f0; }
.quick-premium strong { color: var(--plum); }
.quick-good strong { color: var(--green-dark); }
.quick-risk strong { color: #a83a32; }
.summary-card { border-radius: 8px; border: 1px solid var(--line); background: white; padding: 14px; margin-bottom: 10px; }
.summary-card strong { display: block; font-size: 28px; line-height: 1; }
.summary-card span { color: var(--muted); font-size: 13px; }
.home-hero { padding: 8px 0 6px; }
.home-hero .headline { margin-top: 10px; }
.eyebrow, .soft-pill { display: inline-flex; width: fit-content; align-items: center; border-radius: 999px; background: var(--orchid-soft); color: var(--plum); padding: 6px 10px; font-size: 12px; font-weight: 900; }
.home-actions { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 16px; }
.today-panel { border: 1px solid #ded0f0; background: linear-gradient(135deg, #fff, var(--orchid-soft)); border-radius: 8px; padding: 14px; margin-top: 12px; }
.today-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.today-head span, .today-head small { color: var(--muted); font-size: 12px; font-weight: 800; }
.today-head strong { display: block; font-size: 31px; line-height: 1.05; margin-top: 3px; }
.macro-mini { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.macro-mini span { border-radius: 8px; background: rgba(255,255,255,.7); padding: 9px 7px; color: var(--muted); font-size: 11px; }
.macro-mini strong { display: block; color: var(--ink); font-size: 14px; }
.insight-card { border-radius: 8px; background: var(--plum); color: white; padding: 14px; margin-top: 14px; }
.insight-card .soft-pill { background: rgba(255,255,255,.16); color: white; padding-block: 5px; }
.insight-card strong { display: block; margin-top: 10px; }
.insight-card p { margin: 5px 0 0; color: rgba(255,255,255,.74); font-size: 13px; line-height: 1.4; }

.list { display: grid; gap: 10px; }
.row { display: flex; align-items: center; gap: 12px; border-radius: 8px; background: white; border: 1px solid var(--line); padding: 11px; }
.thumb { width: 48px; height: 58px; border-radius: 8px; background: linear-gradient(180deg, #fff, #e9e0d5); flex: none; position: relative; overflow: hidden; }
.thumb:after { content: ""; position: absolute; left: 8px; right: 8px; top: 19px; height: 18px; border-radius: 5px; background: var(--p, var(--green)); }
.row-copy { min-width: 0; flex: 1; }
.row-copy strong, .row-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-copy span { color: var(--muted); font-size: 12px; }
.badge { border-radius: 999px; padding: 6px 9px; font-size: 12px; font-weight: 900; background: #e3f1e9; color: var(--green-dark); }
.badge.yellow { background: #fff0ce; color: #9b6a09; }
.badge.red { background: #ffe0dc; color: #a83a32; }

.nav { position: absolute; left: 14px; right: 14px; bottom: 14px; height: 70px; border-radius: 22px; background: rgba(255,250,242,.92); border: 1px solid var(--line); display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 8px; backdrop-filter: blur(16px); }
.nav button { border-radius: 16px; background: transparent; color: var(--muted); display: grid; place-items: center; gap: 3px; font-size: 10px; font-weight: 800; }
.nav button.active { background: #e3f1e9; color: var(--green-dark); }
.nav button:nth-child(3).active, .nav button:nth-child(4).active { background: var(--orchid-soft); color: var(--plum); }

.scanner { flex: 1; background: #111; color: white; position: relative; overflow: hidden; }
.scanner-reader { position: absolute; inset: 0; width: 100%; height: 100%; background: #111; z-index: 0; }
.scanner-video { position: absolute; inset: 0; display: none; width: 100%; height: 100%; object-fit: cover; background: #111; z-index: 0; }
.scanner-video.active { display: block; }
.scanner-reader video { width: 100% !important; height: 100% !important; object-fit: cover; }
.scanner-reader div { border: 0 !important; box-shadow: none !important; }
.scanner-bg { position: absolute; inset: 0; z-index: 1; pointer-events: none; background: linear-gradient(160deg, rgba(34,23,25,.5), rgba(95,110,97,.28) 52%, rgba(21,19,20,.58)); }
.scan-box { position: absolute; left: 50%; top: 42%; z-index: 2; pointer-events: none; transform: translate(-50%, -50%); width: min(88vw, 430px); height: 210px; border: 2px solid rgba(255,255,255,.8); border-radius: 18px; box-shadow: 0 0 0 999px rgba(0,0,0,.38); }
.scan-line { position: absolute; left: 14px; right: 14px; height: 3px; top: 32px; border-radius: 4px; background: var(--green); animation: scan 2.4s linear infinite; box-shadow: 0 0 20px var(--green); }
@keyframes scan { 0%,100% { transform: translateY(0); } 50% { transform: translateY(138px); } }
.scanner-actions { position: absolute; left: 18px; right: 18px; bottom: 28px; z-index: 5; display: grid; gap: 10px; }
.scanner-top { position: absolute; left: 18px; right: 18px; top: 18px; z-index: 6; display: flex; justify-content: space-between; align-items: center; pointer-events: none; }
.scanner-top .icon-btn, .scanner-top .badge { pointer-events: auto; }
.manual-scan { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.manual-scan input { min-width: 0; border-radius: 16px; border: 1px solid rgba(255,255,255,.2); background: rgba(255,255,255,.16); color: white; padding: 0 14px; outline: 0; }
.manual-scan input::placeholder { color: rgba(255,255,255,.72); }
.manual-scan button { min-height: 48px; border-radius: 16px; background: white; color: var(--ink); font-weight: 800; padding: 0 14px; }
.scanner-note { margin: 0; border-radius: 12px; background: rgba(255,255,255,.13); color: rgba(255,255,255,.78); padding: 9px 11px; font-size: 11px; line-height: 1.35; }
.scanner-status.loading { background: #fff0ce; color: #7b5508; }
.scanner-status.searching { background: var(--orchid-soft); color: var(--plum); }
.scanner-status.success { background: #e3f1e9; color: var(--green-dark); }
.scanner-status.error { background: #ffe0dc; color: #a83a32; }
.demo-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.demo-strip button { min-height: 44px; border-radius: 14px; background: rgba(255,255,255,.16); color: white; font-size: 12px; font-weight: 900; padding: 0 8px; }
.scanner-close { min-height: 44px; border-radius: 14px; background: rgba(255,255,255,.92); color: var(--ink); font-weight: 900; }

.score-card { color: white; background: var(--green); border-radius: 8px; padding: 18px; display: grid; grid-template-columns: 116px 1fr; gap: 14px; align-items: center; }
.score-card.yellow { background: var(--yellow); }
.score-card.red { background: var(--red); }
.score-card small { display: block; margin-top: 8px; color: rgba(255,255,255,.72); font-size: 12px; font-weight: 800; }
.ring { width: 108px; height: 108px; border-radius: 50%; background: conic-gradient(#fff calc(var(--score) * 1%), rgba(255,255,255,.25) 0); display: grid; place-items: center; }
.ring span { width: 80px; height: 80px; border-radius: 50%; background: rgba(0,0,0,.16); display: grid; place-items: center; font-size: 28px; font-weight: 900; }
.fact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fact { border-radius: 8px; padding: 12px; border: 1px solid var(--line); background: white; }
.fact span { color: var(--muted); font-size: 12px; display: block; }
.fact strong { display: block; margin-top: 3px; }
.check-list { display: grid; gap: 8px; }
.check { display: flex; gap: 9px; align-items: flex-start; line-height: 1.35; font-size: 14px; }
.dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; flex: none; background: var(--green); }
.dot.warn { background: var(--yellow); }
.dot.bad { background: var(--red); }
.ingredient { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.ingredient:last-child { border-bottom: 0; }
.ingredient small { color: var(--muted); display: block; }
.add-card { display: grid; gap: 12px; }
.add-card span { color: var(--muted); display: block; font-size: 13px; margin-top: 3px; }
.add-card label { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 14px; }
.add-card input, .add-card select { width: 118px; border: 1px solid var(--line); border-radius: 12px; padding: 10px; background: white; color: var(--ink); }
.reason-grid { display: grid; gap: 10px; }
.reason-card { display: grid; gap: 8px; }
.reason-card > strong { margin-bottom: 2px; }
.alternative-card { display: grid; gap: 8px; }
.alternative-card p { margin: 0; border-radius: 8px; background: var(--orchid-soft); color: var(--plum); padding: 11px; font-size: 13px; line-height: 1.4; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-row span { border-radius: 999px; background: #e3f1e9; color: var(--green-dark); padding: 6px 9px; font-size: 11px; font-weight: 900; }
.macro-card { display: grid; gap: 14px; }
.macro-line { display: grid; gap: 8px; }
.macro-line > div:first-child { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.macro-line span { color: var(--muted); font-size: 12px; }
.bar { height: 9px; border-radius: 999px; background: #eadfd0; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: inherit; background: var(--green); }
.bar.purple { background: #e5d9f1; margin-top: 12px; }
.bar.purple i { background: linear-gradient(90deg, var(--plum), var(--orchid)); }
.empty { display: grid; gap: 10px; }
.empty span { color: var(--muted); font-size: 14px; }
.not-found-card { margin-top: 18px; }
.not-found-card strong { font-size: 22px; }
.app-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 9999;
  transform: translateX(-50%);
  max-width: min(420px, calc(100vw - 28px));
  border-radius: 14px;
  padding: 12px 16px;
  background: #2f2426;
  color: #fff;
  font-size: 13px;
  font-weight: 850;
  box-shadow: 0 18px 48px rgba(47,36,38,.22);
}
.app-toast.success { background: var(--green-dark); }
.app-toast.error { background: #a83a32; }
.app-toast.info { background: #2f2426; }
.meal-section { display: grid; gap: 8px; margin-bottom: 12px; }
.meal-head { display: flex; justify-content: space-between; align-items: center; border-radius: 8px; background: var(--orchid-soft); color: var(--plum); padding: 10px 12px; }
.meal-head span { font-size: 12px; font-weight: 900; }
.meal-empty { border: 1px dashed var(--line); border-radius: 8px; color: var(--muted); padding: 12px; font-size: 13px; }

.profile-grid { display: grid; gap: 10px; padding-bottom: 88px; }
.toggle-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.toggle-row input[type="checkbox"] { appearance: none; width: 48px; height: 28px; border-radius: 999px; background: #d7cdc0; position: relative; flex: none; transition: .16s ease; }
.toggle-row input[type="checkbox"]:after { content: ""; width: 22px; height: 22px; border-radius: 50%; background: white; position: absolute; top: 3px; left: 3px; transition: .16s ease; }
.toggle-row input[type="checkbox"]:checked { background: var(--green); }
.toggle-row input[type="checkbox"]:checked:after { transform: translateX(20px); }
.switch { width: 48px; height: 28px; border-radius: 999px; background: var(--green); position: relative; flex: none; }
.switch:after { content: ""; width: 22px; height: 22px; border-radius: 50%; background: white; position: absolute; top: 3px; right: 3px; }
.goal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.field { display: grid; gap: 6px; border-radius: 8px; border: 1px solid var(--line); background: white; padding: 11px; font-size: 13px; color: var(--muted); }
.field div { display: flex; align-items: center; gap: 6px; }
.field input, .field select { width: 100%; min-width: 0; border: 0; outline: 0; color: var(--ink); background: transparent; font-weight: 800; }
.field small { color: var(--muted); font-weight: 800; }
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-bottom: 14px; }
.tabs button { border-radius: 14px; padding: 10px 4px; background: #efe6d8; color: var(--muted); font-weight: 900; font-size: 12px; }
.tabs button.active { color: white; background: var(--ink); }

.auth { flex: 1; display: flex; flex-direction: column; justify-content: space-between; padding: 10px 22px 28px; }
.auth-scroll { padding: 8px 0 20px; overflow: visible; }
.auth-code { display: grid; gap: 10px; }
.auth-code input { width: 100%; border: 1px solid var(--line); background: white; border-radius: 16px; padding: 16px; outline: 0; }
.pitch { max-width: 520px; }
.pitch h1 { font-size: clamp(34px, 5vw, 62px); line-height: .98; margin: 0 0 20px; letter-spacing: 0; }
.pitch p { color: #5f5551; font-size: 18px; line-height: 1.55; }
.pitch-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 26px; }
.pitch-card { background: rgba(255,250,242,.68); border: 1px solid var(--line); border-radius: 8px; padding: 16px; }
.pitch-card strong { display: block; margin-bottom: 6px; }
.pitch-card span { color: var(--muted); font-size: 14px; line-height: 1.4; }

@media (max-width: 900px) {
  .stage { grid-template-columns: 1fr; padding: 0; gap: 0; }
  .phone { width: 100%; height: 100vh; min-height: 100vh; border: 0; border-radius: 0; box-shadow: none; }
  .pitch { display: none; }
}

/* ============ TAGES-SCORE ============ */
.home-hero.compact { padding: 4px 0 2px; }
.home-hero.compact .headline { font-size: 26px; margin: 8px 0 4px; }
.day-score { margin-top: 14px; border-radius: 14px; padding: 16px; display: grid; grid-template-columns: 132px 1fr; gap: 14px; align-items: center; background: linear-gradient(135deg, #fff, var(--orchid-soft)); border: 1px solid #ded0f0; color: var(--plum); }
.day-score.yellow { background: linear-gradient(135deg, #fff, #fff0ce); border-color: #f1d995; color: #9b6a09; }
.day-score.red { background: linear-gradient(135deg, #fff, #ffe0dc); border-color: #f3b8b1; color: #a83a32; }
.ds-ring { width: 132px; height: 132px; border-radius: 50%; background: conic-gradient(currentColor calc(var(--score) * 1%), rgba(0,0,0,.06) 0); display: grid; place-items: center; }
.ds-inner { width: 100px; height: 100px; border-radius: 50%; background: white; display: grid; place-items: center; box-shadow: inset 0 0 0 1px rgba(0,0,0,.04); color: currentColor; }
.ds-value { font-size: 36px; font-weight: 900; line-height: 1; }
.ds-inner small { color: var(--muted); font-size: 11px; font-weight: 800; margin-top: 2px; }
.ds-meta { display: grid; gap: 10px; }
.ds-trend strong { display: block; font-size: 22px; font-weight: 900; }
.ds-trend span { color: var(--muted); font-size: 12px; font-weight: 700; }
.ds-spark { color: currentColor; }
.spark { width: 100%; height: 36px; display: block; }

.ds-breakdown { display: grid; gap: 10px; margin-top: 14px; }
.ds-row { background: white; border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; display: grid; gap: 6px; }
.ds-row-head { display: flex; justify-content: space-between; align-items: baseline; }
.ds-row-head strong { font-size: 13px; }
.ds-row-head span { font-weight: 900; font-size: 16px; }
.ds-row-head small { color: var(--muted); font-weight: 700; margin-left: 4px; font-size: 11px; }
.ds-row.good .bar i { background: var(--green); }
.ds-row.warn .bar i { background: var(--yellow); }
.ds-row.bad .bar i { background: var(--red); }
.ds-hint { color: var(--muted); font-size: 11px; }

.tip-card { background: white; border: 1px solid var(--line); border-left: 4px solid var(--orchid); border-radius: 10px; padding: 11px 12px; display: grid; gap: 4px; }
.tip-card strong { font-size: 13px; color: var(--plum); }
.tip-card span { color: var(--muted); font-size: 12px; line-height: 1.4; }
.tip-card.good { border-left-color: var(--green); }
.tip-card.good strong { color: var(--green-dark); }

/* Wasser */
.water-card { margin-top: 16px; background: linear-gradient(135deg, #fff, #e8f1f8); border: 1px solid #cfddea; border-radius: 14px; padding: 14px; display: grid; gap: 10px; color: var(--blue); }
.water-pill { background: rgba(88,123,157,.12); color: var(--blue); padding-block: 5px; }
.water-card strong { font-size: 24px; font-weight: 900; color: var(--ink); }
.water-card small { color: var(--muted); font-weight: 800; }
.water-card .bar { background: rgba(88,123,157,.18); }
.water-card .bar i { background: linear-gradient(90deg, var(--blue), #79a3c4); }
.water-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.water-row button { min-height: 40px; border-radius: 12px; background: white; color: var(--blue); font-weight: 900; font-size: 13px; border: 1px solid #cfddea; }
.water-row button.ghost-btn { background: transparent; color: var(--muted); border-color: var(--line); }

/* Makro-Ampel */
.macro-amp { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.amp-cell { background: white; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: grid; gap: 4px; position: relative; }
.amp-cell span { color: var(--muted); font-size: 12px; font-weight: 800; }
.amp-cell strong { font-size: 18px; font-weight: 900; }
.amp-good { border-color: #b6d4c2; background: #f1faf4; }
.amp-neutral { border-color: #f1d995; background: #fff8e6; }
.amp-bad { border-color: #f3b8b1; background: #fff1ee; }
.lite { display: inline-block; width: 12px; height: 12px; border-radius: 50%; position: absolute; top: 12px; right: 12px; }
.lite-good { background: var(--green); }
.lite-neutral { background: var(--yellow); }
.lite-bad { background: var(--red); }
.macro-lights { display: inline-flex; gap: 3px; flex: none; position: relative; }
.macro-lights .lite { position: static; }

/* Ingredient buttons + Modal */
.ingredient-btn { width: 100%; background: transparent; border: 0; border-bottom: 1px solid var(--line); text-align: left; cursor: pointer; }
.ingredient-btn:last-child { border-bottom: 0; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(47,36,38,.55); display: grid; place-items: center; z-index: 50; padding: 18px; }
.modal { background: var(--card); border-radius: 18px; padding: 22px; width: 100%; max-width: 320px; position: relative; box-shadow: 0 24px 60px rgba(0,0,0,.3); display: grid; gap: 10px; }
.modal h3 { margin: 0; font-size: 22px; }
.modal h4 { margin: 8px 0 -4px; font-size: 13px; color: var(--muted); }
.modal p { margin: 0; line-height: 1.45; font-size: 14px; }
.modal-close { position: absolute; top: 10px; right: 10px; width: 32px; height: 32px; display: grid; place-items: center; background: rgba(0,0,0,.06); border-radius: 50%; color: var(--ink); }

/* Diary head + Insights */
.diary-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.diary-score { padding: 10px 14px; border-radius: 14px; display: grid; place-items: center; min-width: 86px; background: var(--orchid-soft); color: var(--plum); }
.diary-score.yellow { background: #fff0ce; color: #9b6a09; }
.diary-score.red { background: #ffe0dc; color: #a83a32; }
.diary-score strong { font-size: 24px; font-weight: 900; line-height: 1; }
.diary-score span { font-size: 10px; font-weight: 800; margin-top: 2px; }

.insight-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.stat { display: grid; gap: 4px; text-align: left; }
.stat span { color: var(--muted); font-size: 11px; font-weight: 800; }
.stat strong { font-size: 26px; font-weight: 900; line-height: 1; }
.stat small { color: var(--muted); font-size: 10px; }
.big-spark { color: var(--plum); padding: 14px 10px 4px; }
.spark-lg { width: 100%; height: auto; display: block; }

/* Nav */
.nav { grid-template-columns: repeat(7, 1fr); }
.nav button:nth-child(4).active { background: var(--orchid-soft); color: var(--plum); }
.nav button:nth-child(5).active { background: #efe6d8; color: var(--ink); }

/* ====== Personalization additions ====== */
.ds-focus { display: grid; gap: 4px; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }
.ds-focus strong { font-size: 16px; font-weight: 800; color: var(--ink); }
.ds-focus strong small { color: var(--muted); font-weight: 700; font-size: 11px; margin-left: 4px; }
.ds-focus .bar { height: 6px; background: #f0e7d8; border-radius: 999px; overflow: hidden; }
.ds-focus .bar i { display: block; height: 100%; border-radius: 999px; transition: width .3s ease; }

.reminder-card { display: grid; gap: 4px; border-left: 4px solid var(--plum); background: linear-gradient(180deg, #fffaf3, #f7f0ff); margin-top: 12px; }
.reminder-card strong { font-size: 16px; font-weight: 800; }
.reminder-card .subtle { font-size: 13px; }

.checkin-card { display: grid; gap: 12px; margin-top: 14px; }
.checkin-grid { display: grid; gap: 10px; }
.ci-row { display: grid; gap: 4px; }
.ci-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; font-weight: 800; color: var(--muted); }
.ci-head strong { color: var(--plum); font-size: 16px; }
.ci-row input[type="range"] { width: 100%; accent-color: var(--plum); }
.ci-scale { display: flex; justify-content: space-between; font-size: 10px; color: var(--muted); }
.checkin-card .primary.compact { min-height: 44px; font-size: 14px; }
.checkin-trend { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding-top: 10px; border-top: 1px dashed var(--line); }
.checkin-trend > div { display: grid; gap: 2px; font-size: 11px; color: var(--muted); font-weight: 700; }
.checkin-trend strong { font-size: 14px; color: var(--ink); }
.mini-spark { width: 100%; height: 18px; display: block; }

.plan-card { display: grid; gap: 10px; }
.plan-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; padding-bottom: 8px; border-bottom: 1px dashed var(--line); }
.plan-row:last-of-type { border-bottom: 0; padding-bottom: 0; }
.plan-row .eyebrow { font-size: 10px; color: var(--plum); font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.plan-row strong { font-weight: 700; font-size: 14px; line-height: 1.35; }
.plan-row.done .plan-copy { opacity: .62; }
.plan-row.done strong { text-decoration: line-through; }
.plan-copy { display: grid; gap: 2px; }
.plan-copy small { color: var(--muted); font-weight: 700; }
.plan-actions { display: flex; gap: 6px; align-items: center; }
.plan-actions .mini-btn { width: 32px; height: 32px; display: grid; place-items: center; }
.plan-actions .mini-btn .icon { width: 15px; height: 15px; }
.plan-focus { display: flex; gap: 8px; align-items: flex-start; padding: 10px; border-radius: 12px; background: var(--orchid-soft); color: var(--plum); font-size: 13px; }
.plan-focus .icon { stroke: currentColor; flex: none; }

/* Food search in scanner */
.search-block { display: grid; gap: 10px; padding: 14px; border-radius: 16px; background: rgba(255,255,255,.95); color: var(--ink); margin-top: 10px; }
.search-head strong { font-size: 14px; font-weight: 800; }
.filter-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 6px 12px; border-radius: 999px; background: #f1e8dc; color: var(--ink); font-size: 12px; font-weight: 700; border: 1px solid transparent; }
.chip.active { background: var(--plum); color: white; border-color: var(--plum); }
.search-results { max-height: 220px; overflow: auto; }
.search-results .row { background: #fffaf3; }

/* ====== Scanner search toggle ====== */
.scanner-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.manual-scan.grow { width: 100%; }
.search-toggle { min-height: 48px; border-radius: 16px; background: rgba(255,255,255,.16); color: white; font-weight: 800; padding: 0 14px; font-size: 13px; border: 1px solid rgba(255,255,255,.22); }
.search-toggle.active { background: var(--plum); border-color: var(--plum); }
.search-block.hidden { display: none; }
.search-block { max-height: 320px; overflow: auto; }

/* ====== Reminders ====== */
.reminder-list { display: grid; gap: 8px; }
.reminder-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(96px, 132px) auto; align-items: center; gap: 12px; background: white; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.reminder-row.on { border-left: 4px solid var(--plum); }
.reminder-row.off { opacity: .68; }
.rr-time { width: 100%; height: 36px; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; background: var(--cream); color: var(--ink); font-weight: 800; }
.rr-meta { display: grid; gap: 2px; }
.rr-meta strong { font-size: 13px; font-weight: 800; }
.rr-meta span { color: var(--muted); font-size: 11px; font-weight: 700; }
.reminder-row input[type="checkbox"] { appearance: none; width: 40px; height: 24px; border-radius: 999px; background: #d7cdc0; position: relative; flex: none; transition: .16s; cursor: pointer; }
.reminder-row input[type="checkbox"]:after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: white; transition: .16s; }
.reminder-row input[type="checkbox"]:checked { background: var(--plum); }
.reminder-row input[type="checkbox"]:checked:after { transform: translateX(16px); }

/* ====== Einkaufsliste ====== */
.shopping-card { display: grid; gap: 12px; }
.manual-scan.light input { background: white; color: var(--ink); border: 1px solid var(--line); }
.manual-scan.light input::placeholder { color: var(--muted); }
.manual-scan.light button { min-height: 44px; border-radius: 14px; background: var(--plum); color: white; font-weight: 900; padding: 0 16px; }
.shopping-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.shopping-actions .chip { background: var(--orchid-soft); color: var(--plum); }
.shopping-actions .chip.ghost-chip { background: transparent; color: var(--muted); border: 1px dashed var(--line); }
.shop-group { display: grid; gap: 6px; }
.shop-cat { font-size: 11px; font-weight: 900; color: var(--plum); text-transform: uppercase; letter-spacing: .06em; padding-top: 6px; border-top: 1px dashed var(--line); }
.shop-item { display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; align-items: center; padding: 6px 0; font-size: 14px; cursor: pointer; }
.shop-item input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--green); cursor: pointer; }
.shop-item.done span { text-decoration: line-through; color: var(--muted); }
.shop-item .mini-btn { width: 26px; height: 26px; font-size: 16px; }

/* ====== Wochen-Fortschritt ====== */
.progress-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.progress-card { background: white; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: grid; gap: 6px; min-height: 132px; }
.progress-card.good { border-left: 3px solid var(--green); }
.progress-card.bad { border-left: 3px solid var(--red); }
.progress-card.neutral { border-left: 3px solid var(--muted); }
.pc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.pc-head strong { display: block; font-size: 18px; font-weight: 900; margin-top: 2px; }
.pc-trend { text-align: right; }
.pc-trend span { font-size: 11px; font-weight: 900; }
.pc-trend small { display: block; color: var(--muted); font-size: 10px; font-weight: 700; }
.progress-card.good .pc-trend span { color: var(--green-dark); }
.progress-card.bad .pc-trend span { color: #a83a32; }
.progress-card.neutral .pc-trend span { color: var(--muted); }
.pc-spark { width: 100%; height: 28px; display: block; }
.pc-interp { margin: 0; font-size: 11px; color: var(--muted); line-height: 1.35; }

/* ====== Compact Home ====== */
.scroll.compact { padding: 14px 14px 96px; }
.home-hero.tight { padding: 2px 0 4px; }
.home-hero.tight .headline { font-size: 24px; margin: 6px 0 4px; }
.home-hero.tight .nba { margin: 0; font-size: 13px; line-height: 1.4; }
.home-hero.tight .nba strong { color: var(--plum); }
.dash-card { margin-top: 10px; padding: 12px; border-radius: 8px; border: 1px solid #ded0f0; background: linear-gradient(135deg, #fff, var(--orchid-soft)); display: grid; grid-template-columns: 88px 1fr; gap: 12px; align-items: center; }
.dash-card.yellow { border-color: #f1d995; background: linear-gradient(135deg, #fff, #fff0ce); }
.dash-card.red { border-color: #f3b8b1; background: linear-gradient(135deg, #fff, #ffe0dc); }
.dash-ring { width: 88px; height: 88px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--plum) calc(var(--score) * 1%), rgba(0,0,0,.06) 0); }
.dash-card.yellow .dash-ring { background: conic-gradient(#9b6a09 calc(var(--score) * 1%), rgba(0,0,0,.06) 0); }
.dash-card.red .dash-ring { background: conic-gradient(#a83a32 calc(var(--score) * 1%), rgba(0,0,0,.06) 0); }
.dash-ring-inner { width: 68px; height: 68px; border-radius: 50%; background: white; display: grid; place-items: center; }
.dash-ring-inner span { font-size: 22px; font-weight: 900; color: var(--ink); line-height: 1; }
.dash-ring-inner small { font-size: 10px; color: var(--muted); font-weight: 800; }
.dash-stats { display: grid; gap: 6px; }
.dash-stat .ds-line { display: flex; justify-content: space-between; align-items: baseline; font-size: 11px; color: var(--muted); font-weight: 800; }
.dash-stat .ds-line strong { font-size: 13px; color: var(--ink); font-weight: 900; }
.dash-stat .ds-line strong small { color: var(--muted); font-weight: 700; margin-left: 3px; font-size: 10px; }
.dash-stat .bar { height: 6px; }
.activity-card { grid-template-columns: 154px minmax(0, 1fr); gap: 16px; }
.activity-rings {
  --cal-color: #f05a7e;
  --protein-color: #a9f84b;
  --water-color: #5ed6df;
  width: 154px;
  height: 154px;
  position: relative;
  display: grid;
  place-items: center;
}
.activity-ring {
  position: absolute;
  inset: var(--inset);
  border-radius: 50%;
  background:
    conic-gradient(from -90deg, var(--ring-color) calc(var(--value) * 1%), rgba(47,36,38,.1) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - var(--thickness)), #000 calc(100% - var(--thickness) + 1px));
  mask: radial-gradient(farthest-side, transparent calc(100% - var(--thickness)), #000 calc(100% - var(--thickness) + 1px));
}
.activity-ring-cal { --inset: 0px; --thickness: 16px; --ring-color: var(--cal-color); --value: var(--cal); }
.activity-ring-protein { --inset: 22px; --thickness: 16px; --ring-color: var(--protein-color); --value: var(--protein); }
.activity-ring-water { --inset: 44px; --thickness: 16px; --ring-color: var(--water-color); --value: var(--water); }
.activity-score {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #fffaf3;
  border: 1px solid rgba(47,36,38,.06);
  display: grid;
  place-items: center;
  align-content: center;
  box-shadow: 0 10px 26px rgba(47,36,38,.1);
  z-index: 1;
}
.activity-score span { font-size: 20px; font-weight: 950; line-height: 1; color: var(--ink); }
.activity-score small { font-size: 8px; font-weight: 900; color: var(--muted); margin-top: 1px; }
.activity-legend { display: grid; gap: 8px; min-width: 0; }
.activity-stat {
  display: grid;
  grid-template-columns: 11px 1fr auto;
  gap: 8px;
  align-items: center;
  min-width: 0;
  padding: 7px 8px;
  border-radius: 8px;
  background: rgba(255,255,255,.62);
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}
.activity-dot { width: 10px; height: 10px; border-radius: 50%; background: currentColor; }
.activity-stat.cal { color: #d63f65; }
.activity-stat.protein { color: #6fa80f; }
.activity-stat.water { color: #2298a6; }
.activity-stat span:nth-child(2) {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.activity-stat strong { color: var(--ink); font-size: 13px; font-weight: 950; white-space: nowrap; }
.activity-stat small { color: var(--muted); font-size: 10px; font-weight: 750; margin-left: 3px; }

@media (max-width: 420px) {
  .activity-card { grid-template-columns: 132px minmax(0, 1fr); gap: 12px; }
  .activity-rings { width: 132px; height: 132px; }
  .activity-ring-cal { --thickness: 14px; }
  .activity-ring-protein { --inset: 19px; --thickness: 14px; }
  .activity-ring-water { --inset: 38px; --thickness: 14px; }
  .activity-score { width: 32px; height: 32px; }
  .activity-score span { font-size: 16px; }
  .activity-stat { grid-template-columns: 9px 1fr; gap: 6px; }
  .activity-stat strong { grid-column: 2; font-size: 12px; }
  .widget-grid { grid-template-columns: 1fr 1fr; }
  .widget-tile { min-height: 78px; }
}

.quick-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 10px; }
.quick-btn { display: grid; place-items: center; gap: 4px; padding: 12px 4px; border-radius: 8px; background: white; border: 1px solid var(--line); color: var(--ink); font-size: 11px; font-weight: 800; line-height: 1.2; text-align: center; min-height: 64px; }
.quick-btn.primary-tint { background: var(--orchid-soft); border-color: #ded0f0; color: var(--plum); }
.quick-btn .icon { width: 18px; height: 18px; }
.widget-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.widget-tile { min-height: 86px; border-radius: 8px; background: white; border: 1px solid var(--line); color: var(--ink); display: grid; align-content: center; justify-items: start; gap: 8px; padding: 12px; text-align: left; }
.widget-tile .icon { width: 20px; height: 20px; color: var(--green-dark); }
.widget-tile span { display: grid; gap: 3px; min-width: 0; }
.widget-tile strong { font-size: 13px; font-weight: 900; }
.widget-tile small { color: var(--muted); font-size: 11px; line-height: 1.25; }
.widget-back { display: inline-flex; align-items: center; gap: 4px; padding: 0; margin-bottom: 10px; }
.widget-view .home-section,
.widget-view .checkin-card,
.widget-view .quick-row,
.widget-view .mini-reminder { margin-top: 12px; }

.scroll.compact:not(.widget-view) > .quick-row,
.scroll.compact:not(.widget-view) > .mini-reminder,
.scroll.compact:not(.widget-view) > .checkin-card,
.scroll.compact:not(.widget-view) > .home-section,
.scroll.compact:not(.widget-view) > .more-details,
.scroll.compact:not(.widget-view) > .section-row,
.scroll.compact:not(.widget-view) > .list {
  display: none;
}

.mini-reminder { margin-top: 10px; display: flex; justify-content: space-between; align-items: center; gap: 12px; border-left: 4px solid var(--plum); padding: 10px 12px; }
.mini-reminder strong { display: block; font-size: 14px; font-weight: 800; margin-top: 2px; }
.mini-reminder .subtle { font-size: 11px; }
.rr-toggle input { appearance: none; width: 40px; height: 24px; border-radius: 999px; background: #d7cdc0; position: relative; cursor: pointer; }
.rr-toggle input:after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: white; transition: .16s; }
.rr-toggle input:checked { background: var(--plum); }
.rr-toggle input:checked:after { transform: translateX(16px); }

.today-macros { margin-top: 10px; }
.today-macros .section-row strong { font-size: 14px; font-weight: 800; }
.macro-mini.five { grid-template-columns: repeat(5, 1fr); gap: 4px; margin-top: 0; }
.macro-mini.five span { padding: 7px 2px; text-align: center; font-size: 10px; }
.macro-mini.five strong { display: block; color: var(--ink); font-size: 12px; margin-bottom: 1px; }

.more-details { margin-top: 12px; }
.more-details summary { cursor: pointer; font-weight: 800; color: var(--plum); font-size: 13px; padding: 6px 0; list-style: none; }
.more-details summary::-webkit-details-marker { display: none; }
.more-details summary:before { content: "▸ "; }
.more-details[open] summary:before { content: "▾ "; }

/* ====== Food Search ====== */
.scanner-fallback { min-height: 42px; border-radius: 12px; background: rgba(156,123,201,.28); color: white; font-weight: 800; font-size: 13px; padding: 0 12px; border: 1px solid rgba(255,255,255,.18); }
.slider-card { display: grid; gap: 14px; margin-top: 12px; }
.macro-slider { display: grid; gap: 4px; }
.ms-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; color: var(--muted); font-weight: 800; }
.ms-head strong { color: var(--plum); font-size: 14px; font-weight: 900; }
.macro-slider input[type="range"] { width: 100%; accent-color: var(--plum); height: 26px; }
.ms-scale { display: flex; justify-content: space-between; font-size: 10px; color: var(--muted); }
.food-matches { display: grid; gap: 10px; }
.food-match { background: white; border: 1px solid var(--line); border-radius: 8px; padding: 12px; display: grid; gap: 8px; }
.fm-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.fm-head strong { display: block; font-size: 14px; }
.fm-head .subtle { font-size: 11px; }
.fm-match { text-align: right; flex: none; }
.fm-match strong { display: block; font-size: 22px; font-weight: 900; color: var(--plum); line-height: 1; }
.fm-match small { font-size: 10px; color: var(--muted); font-weight: 800; }
.fm-macros { display: flex; flex-wrap: wrap; gap: 4px; }
.fm-macros span { font-size: 11px; padding: 4px 8px; background: #f5efe4; border-radius: 999px; color: var(--ink); font-weight: 700; }
.fm-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.fm-actions button { min-height: 40px; font-size: 13px; padding: 0 10px; }

/* ====== Auth + account ====== */
.auth-form { background: rgba(255,250,242,.78); border: 1px solid var(--line); border-radius: 8px; padding: 14px; }
.auth-form input,
.auth-form select { width: 100%; border: 1px solid var(--line); background: white; border-radius: 14px; padding: 14px; outline: 0; color: var(--ink); }
.auth-select-label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 850; }
.auth-select-label select { appearance: auto; font-weight: 850; }
.auth-tabs { margin-bottom: 2px; }
.auth-error { margin: 0; border-radius: 12px; background: #ffe0dc; color: #a83a32; padding: 10px 12px; font-size: 12px; font-weight: 800; }
.auth-db-note { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.35; }
.account-card { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.account-card strong,
.account-card span { display: block; }
.account-card span { color: var(--muted); font-size: 12px; margin-top: 2px; }

.screen.plain-screen .auth {
  width: 100%;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(340px, 42vw) minmax(0, 1fr);
  gap: 0;
  padding: 0;
}

.screen.plain-screen .auth > div:first-child {
  order: 2;
  min-height: calc(100vh - 22px);
  display: grid;
  align-content: stretch;
  padding: 34px 34px 22px;
  background: linear-gradient(135deg, #2f2426 0%, #4f3d55 52%, #43745c 100%);
}

.screen.plain-screen .auth-code {
  order: 1;
  width: min(100%, 440px);
  align-self: center;
  justify-self: center;
  margin: 0;
}

.screen.plain-screen .auth .topbar {
  display: none;
}

.screen.plain-screen .auth .auth-scroll {
  padding: 0;
}

.screen.plain-screen .auth .headline,
.screen.plain-screen .auth .subtle {
  display: none;
}

.screen.plain-screen .auth .hero-panel {
  margin-top: 0 !important;
  height: 100%;
  min-height: calc(100vh - 90px);
  grid-template-columns: minmax(0, 1fr) 190px;
  align-content: center;
  align-items: center;
  padding: clamp(28px, 5vw, 72px);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(255,255,255,.12), rgba(255,255,255,.04));
  color: white;
}

.screen.plain-screen .auth .hero-panel strong {
  display: block;
  font-size: clamp(34px, 5vw, 68px);
  line-height: .95;
  max-width: 660px;
}

.screen.plain-screen .auth .hero-panel p {
  max-width: 520px;
  margin-top: 18px;
  font-size: clamp(16px, 1.5vw, 22px);
  color: rgba(255,255,255,.78);
}

.screen.plain-screen .auth .hero-panel .primary {
  display: none;
}

.screen.plain-screen .auth .product-art {
  width: min(190px, 18vw);
  height: min(260px, 25vw);
  align-self: center;
}

.screen.plain-screen .auth-form {
  box-shadow: 0 24px 70px rgba(47, 36, 38, .14);
}

@media (max-width: 900px) {
  .screen.plain-screen .auth {
    position: relative;
    min-height: 100svh;
    grid-template-columns: 1fr;
    overflow: hidden;
    background: linear-gradient(135deg, #2f2426 0%, #4f3d55 52%, #43745c 100%);
  }

  .screen.plain-screen .auth > div:first-child {
    position: absolute;
    inset: 10px;
    min-height: 0;
    padding: 0;
    border-radius: 18px;
    overflow: hidden;
    opacity: .96;
  }

  .screen.plain-screen .auth-code {
    position: relative;
    z-index: 2;
    width: min(100% - 32px, 430px);
    align-self: center;
    justify-self: center;
    padding: 18px;
    background: rgba(255,250,242,.92);
    border-color: rgba(255,255,255,.46);
    box-shadow: 0 24px 80px rgba(20, 17, 18, .3);
    backdrop-filter: blur(20px);
  }

  .screen.plain-screen .auth .hero-panel {
    height: 100%;
    min-height: calc(100svh - 20px);
    grid-template-columns: minmax(0, 1fr) 112px;
    align-content: center;
    padding: 24px;
    border-radius: 18px;
    border: 1px solid rgba(255,255,255,.16);
  }

  .screen.plain-screen .auth .hero-panel strong {
    font-size: clamp(36px, 12vw, 58px);
    max-width: 7ch;
  }

  .screen.plain-screen .auth .hero-panel p {
    max-width: 24ch;
    font-size: 14px;
  }

  .screen.plain-screen .auth .product-art {
    width: 96px;
    height: 136px;
    opacity: .9;
  }
}

@media (max-width: 520px) {
  .screen.plain-screen .auth-code {
    align-self: end;
    margin-bottom: max(18px, env(safe-area-inset-bottom));
  }

  .screen.plain-screen .auth .hero-panel {
    grid-template-columns: 1fr;
    align-content: start;
    padding: 32px 24px;
  }

  .screen.plain-screen .auth .hero-panel p {
    display: none;
  }

  .screen.plain-screen .auth .product-art {
    position: absolute;
    right: 24px;
    top: 34px;
    width: 86px;
    height: 122px;
  }
}

/* Auth mobile fix must stay after every auth overlay override. */
@media (max-width: 900px) {
  .screen.plain-screen {
    height: 100svh;
    min-height: 0;
    overflow: hidden;
  }

  .screen.plain-screen .auth {
    height: 100svh;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    align-content: start;
    padding: clamp(150px, 32svh, 240px) 0 calc(28px + env(safe-area-inset-bottom));
  }

  .screen.plain-screen .auth-code {
    align-self: start;
    justify-self: center;
    margin: 0 auto;
    max-height: none;
  }
}

@media (max-width: 520px) {
  .screen.plain-screen .auth {
    padding-top: clamp(132px, 28svh, 210px);
    padding-bottom: calc(18px + env(safe-area-inset-bottom));
  }

  .screen.plain-screen .auth-code {
    align-self: start;
    margin: 0 auto;
  }
}

/* Last-write mobile auth fix: keep registration fully reachable */
@media (max-width: 900px) {
  .screen.plain-screen {
    height: 100svh;
    min-height: 0;
    overflow: hidden;
  }

  .screen.plain-screen .auth {
    height: 100svh;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    align-content: start;
    padding: clamp(150px, 32svh, 240px) 0 calc(28px + env(safe-area-inset-bottom));
  }

  .screen.plain-screen .auth-code {
    align-self: start;
    justify-self: center;
    margin: 0 auto;
    max-height: none;
  }
}

@media (max-width: 520px) {
  .screen.plain-screen .auth {
    padding-top: clamp(132px, 28svh, 210px);
    padding-bottom: calc(18px + env(safe-area-inset-bottom));
  }

  .screen.plain-screen .auth-code {
    align-self: start;
    margin: 0 auto;
  }
}

/* Mobile auth scroll fix */
@media (max-width: 900px) {
  .screen.plain-screen {
    height: 100svh;
    min-height: 0;
    overflow: hidden;
  }

  .screen.plain-screen .auth {
    height: 100svh;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    align-content: start;
    padding: clamp(150px, 32svh, 240px) 0 calc(28px + env(safe-area-inset-bottom));
  }

  .screen.plain-screen .auth-code {
    align-self: start;
    justify-self: center;
    margin: 0 auto;
    max-height: none;
  }
}

@media (max-width: 520px) {
  .screen.plain-screen .auth {
    padding-top: clamp(132px, 28svh, 210px);
    padding-bottom: calc(18px + env(safe-area-inset-bottom));
  }

  .screen.plain-screen .auth-code {
    align-self: start;
    margin: 0 auto;
  }
}

/* ====== SPA layout overrides ====== */
.stage {
  height: 100vh;
  min-height: 100vh;
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
  overflow: hidden;
}

.phone {
  width: 100%;
  max-width: none;
  height: 100vh;
  min-height: 100vh;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: hidden;
}

.screen { height: 100%; background: transparent; }

.screen.app-screen {
  height: 100vh;
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.screen.plain-screen {
  display: flex;
  min-height: 100vh;
}

.screen.app-screen .topbar {
  grid-column: 2;
  grid-row: 1;
  position: relative;
  z-index: 1;
  padding: 22px 40px 12px;
  justify-content: flex-end;
  background: rgba(255, 250, 243, .76);
  border-bottom: 1px solid rgba(228, 219, 207, .72);
  backdrop-filter: blur(18px);
}

.screen.app-screen .topbar .brand { margin-left: 0 !important; }
.screen.app-screen .topbar .icon-btn { display: none; }

.screen.app-screen .scroll {
  grid-column: 2;
  grid-row: 2;
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  align-content: start;
  gap: 16px;
  overflow: auto;
  min-height: 0;
  padding: 24px 40px 56px;
}

.screen.app-screen .scroll > * { grid-column: 1 / -1; }

.screen.app-screen .nav {
  grid-column: 1;
  grid-row: 1 / 3;
  position: fixed;
  top: 0;
  left: 0;
  right: auto;
  bottom: auto;
  width: 232px;
  max-height: 100vh;
  overflow: auto;
  min-height: 100vh;
  z-index: 100;
  pointer-events: auto;
  border-radius: 0;
  border: 0;
  border-right: 1px solid var(--line);
  background: rgba(255, 250, 242, .9);
  backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 98px 18px 18px;
  box-shadow: 18px 0 48px rgba(47, 36, 38, .06);
}

.screen.app-screen .nav::before {
  content: "Nutriveal";
  position: absolute;
  top: 28px;
  left: 28px;
  font-size: 24px;
  font-weight: 900;
  color: var(--green-dark);
}

.screen.app-screen .nav button {
  width: 100%;
  min-height: 54px;
  grid-template-columns: 28px 1fr;
  grid-auto-flow: column;
  justify-content: start;
  justify-items: start;
  place-items: center start;
  gap: 12px;
  border-radius: 8px;
  padding: 0 14px;
  font-size: 13px;
  text-align: left;
  pointer-events: auto;
  cursor: pointer;
}

.screen.app-screen .nav .icon { width: 21px; height: 21px; }
.screen.plain-screen .auth,
.screen.plain-screen .scanner { width: 100%; }
.screen.plain-screen .auth { padding: 24px 40px 40px; }
.screen.plain-screen .auth .scroll { display: block; padding: 18px 0 40px; }

.home-hero.tight { grid-column: 1 / 8; }
.dash-card { grid-column: 8 / -1; grid-row: span 2; align-self: stretch; min-height: 210px; }
.quick-row,
.mini-reminder,
.widget-grid { grid-column: 1 / -1; }
.home-section,
.checkin-card,
.water-card,
.plan-card,
.shopping-card,
.slider-card,
.food-matches { grid-column: span 6; }
.ds-breakdown,
.progress-grid,
.insight-row,
.big-spark,
.profile-grid { grid-column: 1 / -1; }

.progress-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  min-width: 0;
}
.progress-card { min-width: 0; overflow: hidden; }
.pc-head,
.pc-head > div,
.pc-trend { min-width: 0; }
.pc-head strong,
.pc-trend small,
.pc-interp { overflow-wrap: anywhere; }

.big-spark {
  display: block;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  padding: 18px 20px 14px;
}
.spark-lg {
  width: 100%;
  max-width: 100%;
  height: auto;
  aspect-ratio: 700 / 214;
  color: var(--plum);
}

.mini-reminder > div { display: grid; gap: 7px; }

@media (min-width: 761px) {
  body { overflow: hidden; }
}

@media (max-width: 1180px) {
  .screen.app-screen { grid-template-columns: 210px minmax(0, 1fr); }
  .screen.app-screen .nav { width: 210px; }
  .screen.app-screen .scroll,
  .screen.app-screen .topbar { padding-left: 28px; padding-right: 28px; }

  .home-hero.tight,
  .dash-card,
  .quick-row,
  .mini-reminder,
  .widget-grid,
  .home-section,
  .checkin-card,
  .water-card,
  .plan-card,
  .shopping-card,
  .slider-card,
  .food-matches { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
  .stage {
    height: 100svh;
    min-height: 100svh;
    overflow: hidden;
  }

  .phone {
    height: 100svh;
    min-height: 100svh;
    overflow: hidden;
  }

  .screen.app-screen {
    height: 100svh;
    min-height: 0;
    overflow: hidden;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto minmax(0, 1fr);
  }

  .screen.app-screen .nav {
    grid-column: 1;
    grid-row: 1;
    min-height: 0;
    height: auto;
    max-height: none;
    position: sticky;
    top: 0;
    left: auto;
    width: auto;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    box-shadow: none;
  }

  .screen.app-screen .nav::before { content: none; }
  .screen.app-screen .nav button {
    min-width: 92px;
    min-height: 50px;
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
    padding: 0 10px;
    font-size: 10px;
  }

  .screen.app-screen .topbar {
    grid-column: 1;
    grid-row: 2;
    padding: 14px 18px 8px;
  }

  .screen.app-screen .scroll {
    grid-column: 1;
    grid-row: 3;
    display: block;
    min-height: 0;
    height: 100%;
    overflow: auto;
    overscroll-behavior: contain;
    padding: 18px 18px 40px;
  }
}

/* Final auth split overrides for direct index.html opening */
.screen.plain-screen .auth {
  width: 100%;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(340px, 42vw) minmax(0, 1fr);
  gap: 0;
  padding: 0;
}

.screen.plain-screen .auth > div:first-child {
  order: 2;
  min-height: calc(100vh - 22px);
  display: grid;
  align-content: stretch;
  padding: 34px 34px 22px;
  background: linear-gradient(135deg, #2f2426 0%, #4f3d55 52%, #43745c 100%);
}

.screen.plain-screen .auth-code {
  order: 1;
  width: min(100%, 440px);
  align-self: center;
  justify-self: center;
  margin: 0;
}

.screen.plain-screen .auth .topbar,
.screen.plain-screen .auth .headline,
.screen.plain-screen .auth .subtle {
  display: none;
}

.screen.plain-screen .auth .auth-scroll {
  padding: 0;
}

.screen.plain-screen .auth .hero-panel {
  margin-top: 0 !important;
  height: 100%;
  min-height: calc(100vh - 90px);
  grid-template-columns: minmax(0, 1fr) 190px;
  align-content: center;
  align-items: center;
  padding: clamp(28px, 5vw, 72px);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(255,255,255,.12), rgba(255,255,255,.04));
  color: white;
}

.screen.plain-screen .auth .hero-panel strong {
  display: block;
  font-size: clamp(34px, 5vw, 68px);
  line-height: .95;
  max-width: 660px;
}

.screen.plain-screen .auth .hero-panel p {
  max-width: 520px;
  margin-top: 18px;
  font-size: clamp(16px, 1.5vw, 22px);
  color: rgba(255,255,255,.78);
}

.screen.plain-screen .auth .hero-panel .primary {
  display: none;
}

.screen.plain-screen .auth .product-art {
  width: min(190px, 18vw);
  height: min(260px, 25vw);
  align-self: center;
}

@media (max-width: 900px) {
  .screen.plain-screen .auth {
    grid-template-columns: 1fr;
  }

  .screen.plain-screen .auth > div:first-child {
    min-height: 320px;
    padding: 18px;
  }

  .screen.plain-screen .auth-code {
    width: min(100% - 36px, 440px);
    padding: 28px 0;
  }

  .screen.plain-screen .auth .hero-panel {
    min-height: 280px;
    grid-template-columns: 1fr 96px;
    padding: 24px;
  }

  .screen.plain-screen .auth .product-art {
    width: 88px;
    height: 122px;
  }
}

/* Final mobile auth overlay */
@media (max-width: 900px) {
  .screen.plain-screen .auth {
    position: relative;
    height: 100svh;
    min-height: 0;
    grid-template-columns: 1fr;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    align-content: start;
    padding: clamp(150px, 32svh, 240px) 0 calc(28px + env(safe-area-inset-bottom));
    background: linear-gradient(135deg, #2f2426 0%, #4f3d55 52%, #43745c 100%);
  }

  .screen.plain-screen .auth > div:first-child {
    position: absolute;
    inset: 10px;
    min-height: 0;
    padding: 0;
    border-radius: 18px;
    overflow: hidden;
    opacity: .96;
  }

  .screen.plain-screen .auth-code {
    position: relative;
    z-index: 2;
    width: min(100% - 32px, 430px);
    align-self: start;
    justify-self: center;
    margin: 0 auto;
    padding: 18px;
    background: rgba(255,250,242,.92);
    border-color: rgba(255,255,255,.46);
    box-shadow: 0 24px 80px rgba(20, 17, 18, .3);
    backdrop-filter: blur(20px);
  }

  .screen.plain-screen .auth .hero-panel {
    height: 100%;
    min-height: calc(100svh - 20px);
    grid-template-columns: minmax(0, 1fr) 112px;
    align-content: center;
    padding: 24px;
    border-radius: 18px;
    border: 1px solid rgba(255,255,255,.16);
  }

  .screen.plain-screen .auth .hero-panel strong {
    font-size: clamp(36px, 12vw, 58px);
    max-width: 7ch;
  }

  .screen.plain-screen .auth .hero-panel p {
    max-width: 24ch;
    font-size: 14px;
  }

  .screen.plain-screen .auth .product-art {
    width: 96px;
    height: 136px;
    opacity: .9;
  }
}

@media (max-width: 520px) {
  .screen.plain-screen .auth-code {
    align-self: start;
    margin: 0 auto;
  }

  .screen.plain-screen .auth {
    padding-top: clamp(132px, 28svh, 210px);
    padding-bottom: calc(18px + env(safe-area-inset-bottom));
  }

  .screen.plain-screen .auth .hero-panel {
    grid-template-columns: 1fr;
    align-content: start;
    padding: 32px 24px;
  }

  .screen.plain-screen .auth .hero-panel p {
    display: none;
  }

  .screen.plain-screen .auth .product-art {
    position: absolute;
    right: 24px;
    top: 34px;
    width: 86px;
    height: 122px;
  }
}
