/* ==========================================================================
   BiteWise — design system
   Restrained palette: one green accent, four semantic colours for the
   numbers that matter (calories, protein, fat, net carbs). Net carbs is
   amber everywhere in the app; it never changes colour.
   ========================================================================== */

:root {
  --bg: #f4f6f3;
  --surface: #ffffff;
  --surface-2: #eceff0;
  --surface-3: #e3e7e5;
  --ink: #131b18;
  --text: #1f2825;
  --muted: #6c7772;
  --faint: #9aa5a0;
  --line: #e2e6e3;
  --accent: #1e6b5c;
  --accent-soft: #e4f0ec;
  --accent-ink: #ffffff;
  --kcal: #d9622b;
  --kcal-soft: #fbeae1;
  --protein: #3556c9;
  --protein-soft: #e6eafa;
  --fat: #7a8f2a;
  --fat-soft: #eef2df;
  --carb: #c98b06;
  --carb-soft: #fbf0d6;
  --danger: #b93a1b;
  --danger-soft: #fbe7e1;
  --ok: #2f8f5b;
  --ok-soft: #e3f3ea;
  --shadow: 0 1px 2px rgba(19, 27, 24, 0.04), 0 8px 24px -12px rgba(19, 27, 24, 0.18);
  --shadow-lg: 0 24px 60px -24px rgba(19, 27, 24, 0.35);
  --radius: 20px;
  --radius-sm: 14px;
  --radius-xs: 10px;
  --tabbar: 64px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1311;
    --surface: #161c19;
    --surface-2: #1d2521;
    --surface-3: #263029;
    --ink: #f1f4f2;
    --text: #e4e9e6;
    --muted: #97a39d;
    --faint: #66716c;
    --line: #26302b;
    --accent: #4fb69c;
    --accent-soft: #163229;
    --accent-ink: #08130f;
    --kcal: #f0855a;
    --kcal-soft: #3a231a;
    --protein: #7d95f0;
    --protein-soft: #1d2542;
    --fat: #a9c24d;
    --fat-soft: #263118;
    --carb: #e9b040;
    --carb-soft: #3a2d10;
    --danger: #ee7a5a;
    --danger-soft: #3d1f16;
    --ok: #5cc48c;
    --ok-soft: #173325;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px -12px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 24px 60px -24px rgba(0, 0, 0, 0.8);
  }
}
:root[data-theme="dark"] {
  --bg: #0e1311;
  --surface: #161c19;
  --surface-2: #1d2521;
  --surface-3: #263029;
  --ink: #f1f4f2;
  --text: #e4e9e6;
  --muted: #97a39d;
  --faint: #66716c;
  --line: #26302b;
  --accent: #4fb69c;
  --accent-soft: #163229;
  --accent-ink: #08130f;
  --kcal: #f0855a;
  --kcal-soft: #3a231a;
  --protein: #7d95f0;
  --protein-soft: #1d2542;
  --fat: #a9c24d;
  --fat-soft: #263118;
  --carb: #e9b040;
  --carb-soft: #3a2d10;
  --danger: #ee7a5a;
  --danger-soft: #3d1f16;
  --ok: #5cc48c;
  --ok-soft: #173325;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px -12px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 24px 60px -24px rgba(0, 0, 0, 0.8);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
h1, h2, h3 { margin: 0; color: var(--ink); letter-spacing: -0.02em; }
p { margin: 0; }
svg { display: block; }
.num { font-variant-numeric: tabular-nums; }

/* ---- shell ------------------------------------------------------------- */
.shell {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(14px + env(safe-area-inset-top)) 16px calc(var(--tabbar) + 32px + env(safe-area-inset-bottom));
  min-height: 100vh;
  animation: fade 0.25s var(--ease);
}
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 6px 0 18px; }
.page-head h1 { font-size: 1.7rem; font-weight: 800; }
.eyebrow { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.sub { color: var(--muted); font-size: 0.95rem; }
.section { margin: 22px 0 10px; display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.section h2 { font-size: 1.05rem; font-weight: 700; }
.section .link { font-size: 0.9rem; font-weight: 600; }
.stack > * + * { margin-top: 10px; }
.row { display: flex; align-items: center; gap: 10px; }
.row--between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.tiny { font-size: 0.75rem; }
.strong { font-weight: 700; color: var(--ink); }
.center { text-align: center; }
.mt { margin-top: 12px; }
.mb { margin-bottom: 12px; }
.wrap { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---- cards -------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.card--flat { box-shadow: none; }
.card--soft { background: var(--surface-2); border-color: transparent; box-shadow: none; }
.card--accent { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.card--accent h2, .card--accent h3, .card--accent .strong { color: inherit; }
.card--accent .muted { color: inherit; opacity: 0.8; }
.card + .card { margin-top: 10px; }
.card--tap { transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease); }
.card--tap:active { transform: scale(0.99); }

/* ---- buttons ------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 18px; border-radius: 14px; border: 1px solid transparent;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 0.98rem;
  transition: transform 0.12s var(--ease), opacity 0.12s, background 0.15s;
  -webkit-tap-highlight-color: transparent; white-space: nowrap;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn--ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn--soft { background: var(--accent-soft); color: var(--accent); }
.btn--danger { background: var(--danger-soft); color: var(--danger); }
.btn--sm { min-height: 38px; padding: 0 14px; font-size: 0.9rem; border-radius: 12px; }
.btn--xs { min-height: 32px; padding: 0 11px; font-size: 0.82rem; border-radius: 10px; }
.btn--block { width: 100%; }
.btn--icon { width: 46px; padding: 0; }
.iconbtn {
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface);
  display: inline-flex; align-items: center; justify-content: center; color: var(--muted);
}
.iconbtn svg { width: 18px; height: 18px; }
.link { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 600; }
.btn-row { display: flex; gap: 8px; }
.btn-row > .btn { flex: 1; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 12px; border-radius: 999px;
  background: var(--surface-2); color: var(--text); border: 1px solid transparent; font-size: 0.88rem; font-weight: 600;
  -webkit-tap-highlight-color: transparent;
}
.chip--on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.chip--kcal { background: var(--kcal-soft); color: var(--kcal); }
.chip--protein { background: var(--protein-soft); color: var(--protein); }
.chip--carb { background: var(--carb-soft); color: var(--carb); }
.chip--ok { background: var(--ok-soft); color: var(--ok); }
.chip--danger { background: var(--danger-soft); color: var(--danger); }
.chip--sm { min-height: 26px; padding: 0 9px; font-size: 0.75rem; }

.seg { display: flex; background: var(--surface-2); border-radius: 12px; padding: 3px; gap: 2px; }
.seg__btn { flex: 1; min-height: 36px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-weight: 600; font-size: 0.9rem; }
.seg__btn--on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* ---- metrics -------------------------------------------------------------- */
.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.metric { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 12px 10px; box-shadow: var(--shadow); }
.metric__label { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.metric__value { font-size: 1.45rem; font-weight: 800; color: var(--ink); letter-spacing: -0.03em; margin-top: 2px; line-height: 1.1; }
.metric__unit { font-size: 0.8rem; font-weight: 600; color: var(--muted); margin-left: 2px; }
.metric__note { font-size: 0.75rem; color: var(--muted); margin-top: 3px; }
.metric--kcal .metric__value { color: var(--kcal); }
.metric--ok .metric__value { color: var(--ok); }
.metric--danger .metric__value { color: var(--danger); }
.metric--big { grid-column: 1 / -1; }

.bar { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.bar__fill { height: 100%; border-radius: 999px; background: var(--accent); transition: width 0.5s var(--ease); }
.bar__fill--kcal { background: var(--kcal); }
.bar__fill--protein { background: var(--protein); }
.bar__fill--carb { background: var(--carb); }
.bar__fill--fat { background: var(--fat); }
.bar__fill--over { background: var(--danger); }
.macro { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.macro + .macro { border-top: 1px solid var(--line); }
.macro__name { width: 84px; font-size: 0.85rem; font-weight: 700; color: var(--muted); }
.macro__nums { width: 96px; text-align: right; font-weight: 700; color: var(--ink); font-size: 0.92rem; }
.macro__nums span { color: var(--muted); font-weight: 500; }
.macro .bar { flex: 1; }

.rings { display: flex; justify-content: space-around; align-items: center; gap: 8px; }
.ring { position: relative; width: 92px; height: 92px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring__track { fill: none; stroke: var(--surface-3); stroke-width: 8; }
.ring__fill { fill: none; stroke-width: 8; stroke-linecap: round; transition: stroke-dashoffset 0.6s var(--ease); }
.ring__label { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.ring__value { font-size: 1.05rem; font-weight: 800; color: var(--ink); line-height: 1; letter-spacing: -0.02em; }
.ring__unit { font-size: 0.68rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 3px; }

/* ---- meal cards -------------------------------------------------------------- */
.meal {
  display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px;
  box-shadow: var(--shadow); color: inherit;
}
.meal + .meal { margin-top: 8px; }
.meal--done { opacity: 0.72; }
.meal--empty { background: var(--surface-2); box-shadow: none; border-style: dashed; }
.meal__icon { width: 44px; height: 44px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; font-size: 1.25rem; }
.meal__icon--done { background: var(--ok-soft); color: var(--ok); }
.meal__slot { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.meal__name { font-weight: 700; color: var(--ink); font-size: 0.98rem; line-height: 1.25; margin-top: 1px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.meal__macros { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 5px; font-size: 0.8rem; font-weight: 600; color: var(--muted); }
.meal__macros b { color: var(--ink); font-weight: 700; }
.m-kcal { color: var(--kcal); }
.m-protein { color: var(--protein); }
.m-fat { color: var(--fat); }
.m-carb { color: var(--carb); }
.meal__side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.tick { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line); background: var(--surface); display: inline-flex; align-items: center; justify-content: center; color: transparent; }
.tick--on { background: var(--ok); border-color: var(--ok); color: #fff; }
.tick svg { width: 16px; height: 16px; }

.hero {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow);
}
.hero__top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.hero__name { font-size: 1.25rem; font-weight: 800; color: var(--ink); letter-spacing: -0.02em; line-height: 1.2; }
.macro-strip { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 8px; }
.macro-strip div { font-size: 0.85rem; font-weight: 700; }
.macro-strip small { display: block; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }

/* ---- lists -------------------------------------------------------------- */
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow); overflow: hidden; }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; min-height: 54px; color: inherit; }
.item + .item { border-top: 1px solid var(--line); }
.item__main { flex: 1; min-width: 0; }
.item__title { font-weight: 600; color: var(--ink); }
.item__sub { font-size: 0.82rem; color: var(--muted); margin-top: 1px; }
.item__end { font-weight: 700; color: var(--ink); font-size: 0.92rem; text-align: right; white-space: nowrap; }
.item--done .item__title { text-decoration: line-through; color: var(--muted); }
.item--have { opacity: 0.6; }
.item--tap:active { background: var(--surface-2); }
.check { width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--line); background: var(--surface); flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; color: transparent; }
.check--on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.check svg { width: 15px; height: 15px; }
.group-head { display: flex; justify-content: space-between; align-items: baseline; margin: 18px 4px 8px; }
.group-head h3 { font-size: 0.85rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }

/* ---- day strip ---------------------------------------------------------- */
.days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin: 6px 0 14px; }
.day { border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 8px 0 6px; text-align: center; color: var(--muted); }
.day__n { display: block; font-size: 0.65rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; }
.day__d { display: block; font-size: 1.05rem; font-weight: 800; color: var(--ink); line-height: 1.2; margin-top: 1px; }
.day__dot { display: block; width: 6px; height: 6px; border-radius: 50%; margin: 5px auto 0; background: transparent; }
.day--today .day__n { color: var(--accent); }
.day--on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.day--on .day__d, .day--on .day__n { color: inherit; }
.day .day__dot--ok { background: var(--ok); }
.day .day__dot--part { background: var(--carb); }

/* ---- forms ---------------------------------------------------------------- */
.field { display: block; margin-bottom: 12px; }
.field__label { display: block; font-size: 0.82rem; font-weight: 700; color: var(--muted); margin-bottom: 5px; }
.input, .select, .textarea {
  width: 100%; min-height: 46px; padding: 10px 13px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font-size: 1rem; outline: none;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.select { -webkit-appearance: none; appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.input--sm { min-height: 40px; padding: 6px 10px; font-size: 0.95rem; }
.error { color: var(--danger); font-size: 0.9rem; font-weight: 600; margin: 6px 0; }
.hint { color: var(--muted); font-size: 0.85rem; margin-top: 4px; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; }
.switch + .switch { border-top: 1px solid var(--line); }
.toggle { position: relative; width: 48px; height: 28px; border-radius: 999px; background: var(--surface-3); border: 0; flex: 0 0 auto; transition: background 0.2s; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.25); transition: transform 0.2s var(--ease); }
.toggle--on { background: var(--accent); }
.toggle--on::after { transform: translateX(20px); }

/* ---- sheet ------------------------------------------------------------- */
.sheet { position: fixed; inset: 0; z-index: 60; }
.sheet__backdrop { position: absolute; inset: 0; background: rgba(8, 12, 10, 0.45); backdrop-filter: blur(2px); animation: fade 0.2s; }
.sheet__panel {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 92vh; display: flex; flex-direction: column;
  background: var(--surface); border-radius: 24px 24px 0 0; box-shadow: var(--shadow-lg);
  max-width: 560px; margin: 0 auto; animation: rise 0.28s var(--ease);
  padding-bottom: env(safe-area-inset-bottom);
}
@keyframes rise { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet__grip { width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 10px auto 0; }
.sheet__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 12px 18px 8px; }
.sheet__title { font-size: 1.15rem; font-weight: 800; color: var(--ink); letter-spacing: -0.02em; }
.sheet__sub { font-size: 0.85rem; color: var(--muted); margin-top: 2px; }
.sheet__body { overflow-y: auto; padding: 4px 18px 22px; -webkit-overflow-scrolling: touch; }

.toast { position: fixed; left: 50%; bottom: calc(var(--tabbar) + 18px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 70;
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-weight: 600; font-size: 0.92rem; box-shadow: var(--shadow-lg); max-width: 90vw; animation: rise 0.2s var(--ease); }
.toast--danger { background: var(--danger); color: #fff; }

/* ---- tab bar ------------------------------------------------------------- */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom); }
.tabbar { display: flex; justify-content: center; }
.tabbar .tab { flex: 1; max-width: 112px; height: var(--tabbar); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--faint); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.02em; -webkit-tap-highlight-color: transparent; }
.tab__icon svg { width: 22px; height: 22px; }
.tab--active { color: var(--accent); }

.fab { position: fixed; right: max(16px, calc((100vw - 560px) / 2 + 16px)); bottom: calc(var(--tabbar) + 16px + env(safe-area-inset-bottom)); z-index: 45; width: 54px; height: 54px; border-radius: 18px; border: 0; background: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow-lg); display: flex; align-items: center; justify-content: center; }
.fab svg { width: 24px; height: 24px; }

/* ---- misc components ------------------------------------------------------ */
.empty { text-align: center; padding: 34px 20px; color: var(--muted); }
.empty__icon { font-size: 2rem; margin-bottom: 8px; }
.empty h3 { font-size: 1.05rem; margin-bottom: 4px; }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: var(--radius-sm); height: 84px; }
.skeleton + .skeleton { margin-top: 10px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--carb-soft); color: var(--ink); font-size: 0.9rem; }
.notice--ok { background: var(--ok-soft); }
.notice--danger { background: var(--danger-soft); }
.notice--soft { background: var(--surface-2); }
.notice b { color: var(--ink); }
.pill-row { display: flex; gap: 6px; flex-wrap: wrap; }
.streaks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.streak { text-align: center; padding: 10px 6px; border-radius: 12px; background: var(--surface-2); }
.streak__n { font-size: 1.3rem; font-weight: 800; color: var(--ink); line-height: 1; }
.streak__l { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin-top: 4px; }
.steps { counter-reset: step; }
.step { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.step:first-child { border-top: 0; }
.step__n { width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 0.8rem; flex: 0 0 auto; }
.ingredients .item { min-height: 44px; padding: 9px 14px; }
.rate { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.rate__btn { min-height: 52px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); font-weight: 700; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 0.82rem; color: var(--muted); }
.rate__btn span { font-size: 1.25rem; }
.rate__btn--on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.rate__btn--no.rate__btn--on { border-color: var(--danger); background: var(--danger-soft); color: var(--danger); }
.big-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.big-action { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 14px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 700; text-align: left; }
.big-action span { font-size: 1.4rem; }
.big-action small { font-weight: 500; color: var(--muted); font-size: 0.8rem; }

/* cook mode */
.cook { position: fixed; inset: 0; z-index: 80; background: var(--bg); display: flex; flex-direction: column; padding: calc(16px + env(safe-area-inset-top)) 20px calc(20px + env(safe-area-inset-bottom)); max-width: 560px; margin: 0 auto; }
.cook__step { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.cook__text { font-size: 1.6rem; font-weight: 700; color: var(--ink); line-height: 1.35; letter-spacing: -0.02em; }
.cook__ings { margin-top: 20px; color: var(--muted); font-size: 0.95rem; line-height: 1.6; }
.cook__nav { display: flex; gap: 10px; }
.cook__nav .btn { flex: 1; min-height: 54px; }

/* weight chart */
.chart { width: 100%; height: 190px; }
.chart .axis { stroke: var(--line); stroke-width: 1; }
.chart .grid { stroke: var(--line); stroke-dasharray: 2 4; }
.chart .pts { fill: var(--surface); stroke: var(--accent); stroke-width: 2; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.chart .raw { fill: none; stroke: var(--faint); stroke-width: 1.5; stroke-dasharray: 3 3; }
.chart .lbl { fill: var(--muted); font-size: 10px; font-weight: 600; }
.chart .goal { stroke: var(--carb); stroke-dasharray: 4 4; stroke-width: 1.5; }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 110px; }
.bars__col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.bars__bar { width: 100%; border-radius: 6px 6px 3px 3px; background: var(--accent); min-height: 3px; }
.bars__bar--neg { background: var(--danger); }
.bars__bar--none { background: var(--surface-3); }
.bars__l { font-size: 0.62rem; font-weight: 700; color: var(--muted); }

/* photos */
.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.photo { position: relative; aspect-ratio: 3 / 4; border-radius: 12px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo__cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 5px 7px; font-size: 0.68rem; font-weight: 700; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,0.65)); }
.photo--sel { outline: 3px solid var(--accent); }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.compare .photo { aspect-ratio: 3 / 4; }

/* sign in page */
.signin { display: flex; flex-direction: column; justify-content: center; min-height: 100vh; padding-bottom: 40px; }
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.brand__logo { width: 52px; height: 52px; border-radius: 12px; }
.brand h1 { font-size: 1.8rem; font-weight: 800; }
.brand__accent { color: var(--accent); }
.brand__slogan { color: var(--muted); font-size: 0.9rem; }
.footnote { color: var(--muted); font-size: 0.82rem; margin-top: 14px; }
.signin__switch { margin-top: 12px; text-align: center; }

/* ---- Trial sign-up ---- */
.agree { display: flex; gap: 10px; align-items: flex-start; margin: 4px 0 14px; font-size: 0.86rem; color: var(--muted); line-height: 1.45; }
.agree input { width: 20px; height: 20px; margin-top: 1px; flex: none; accent-color: var(--accent); }
.agree a { color: var(--accent); }
.signin__switch { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; }
.stack-text h2 { font-size: 1.05rem; margin: 18px 0 6px; }
.stack-text h2:first-child { margin-top: 0; }
.stack-text p, .stack-text li { line-height: 1.55; color: var(--ink); }
.stack-text ul { padding-left: 1.2em; margin: 0; }
.stack-choices { display: grid; gap: 8px; }
.choice { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice input { margin-top: 3px; width: 18px; height: 18px; flex: none; accent-color: var(--accent); }
.choice b { display: block; font-size: 0.95rem; }
.choice small { display: block; color: var(--muted); font-size: 0.82rem; margin-top: 2px; line-height: 1.4; }
.code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-weight: 700; letter-spacing: 0.08em; }
.code--big { font-size: 1.8rem; padding: 8px 14px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); display: inline-block; }

/* Pick-several chips (days, meals, meals to prep) — a checkbox inside a chip */
.pick-row { display: flex; flex-wrap: wrap; gap: 6px; }
.pick { cursor: pointer; user-select: none; }
.pick:has(input:checked) { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.pick:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.pick input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.pick { position: relative; }
.pick:has(input:checked)::before { content: "✓"; margin-right: 4px; font-weight: 700; }

/* Dashboard charts — one hue (the accent), thin bars, rounded data ends */
.hbars { display: grid; gap: 8px; }
.hbar { display: grid; grid-template-columns: minmax(90px, 38%) 1fr auto; align-items: center; gap: 10px; font-size: 0.85rem; }
.hbar__label { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar__track { height: 10px; background: var(--surface-2); border-radius: 5px; overflow: hidden; }
.hbar__fill { display: block; height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; }
.hbar__n { color: var(--text); font-weight: 600; min-width: 2.5ch; text-align: right; }
.hbar__n small { color: var(--muted); font-weight: 400; }
.vbars { display: flex; align-items: flex-end; gap: 2px; height: 150px; }
.vbar { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; min-width: 0; }
.vbar__n { font-size: 0.75rem; color: var(--text); height: 1.2em; }
.vbar__col { flex: 1; width: 100%; max-width: 28px; display: flex; align-items: flex-end; }
.vbar__fill { display: block; width: 100%; background: var(--accent); border-radius: 4px 4px 0 0; }
.vbar__l { font-size: 0.68rem; color: var(--muted); margin-top: 4px; white-space: nowrap; }
.vbars { border-bottom: 1px solid var(--line); padding-bottom: 2px; }

/* Feedback: star rating and a 0–10 scale */
.stars { display: flex; gap: 6px; }
.star { font-size: 1.9rem; line-height: 1; background: none; border: 0; color: var(--line); cursor: pointer; padding: 2px; }
.star--on { color: #e5a50a; }
.scale { display: grid; grid-template-columns: repeat(11, 1fr); gap: 3px; }
.scale__n { padding: 8px 0; border: 1.5px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); font-weight: 600; cursor: pointer; font-size: 0.85rem; }
.scale__n--on { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ==========================================================================
   Public welcome page (signed-out front door)
   ========================================================================== */
.welcome { background: var(--bg); }
.welcome main { max-width: 960px; margin: 0 auto; padding: 0 16px 40px; }
.w-top { display: flex; align-items: center; justify-content: space-between; max-width: 960px; margin: 0 auto; padding: 16px; }
.w-brand { display: flex; align-items: center; gap: 10px; font-size: 1.25rem; font-weight: 800; color: var(--ink); text-decoration: none; letter-spacing: -0.02em; }
.w-brand img { border-radius: 9px; }
.w-brand b { color: var(--accent); }
.w-hero { padding: 36px 0 28px; max-width: 680px; }
.w-hero h1 { font-size: clamp(2rem, 6vw, 3rem); line-height: 1.08; font-weight: 800; }
.w-hero h1 span { color: var(--accent); }
.w-lead { font-size: 1.08rem; color: var(--text); margin: 16px 0 22px; line-height: 1.55; }
.w-cta { display: flex; flex-wrap: wrap; gap: 10px; }
.w-note { color: var(--muted); font-size: 0.9rem; margin-top: 14px; }
.w-section { padding: 26px 0; }
.w-section h2 { font-size: 1.45rem; margin-bottom: 14px; }
.w-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.w-card { background: var(--surface); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.w-card h3 { font-size: 1.05rem; margin: 6px 0; }
.w-card p { color: var(--text); font-size: 0.93rem; line-height: 1.5; margin: 0; }
.w-ico { font-size: 1.6rem; }
.w-steps { margin: 0; padding-left: 1.3em; display: grid; gap: 12px; line-height: 1.55; }
.w-small { color: var(--muted); font-size: 0.92rem; margin-top: 14px; }
.w-price { background: var(--surface); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; align-items: start; }
.w-price__big { font-size: 2.4rem; font-weight: 800; color: var(--ink); }
.w-price__big span { font-size: 1rem; font-weight: 600; color: var(--muted); }
.w-price ul { margin: 0; padding-left: 1.2em; display: grid; gap: 8px; line-height: 1.5; }
.w-faq { background: var(--surface); border-radius: var(--radius-sm); padding: 14px 16px; margin-bottom: 8px; box-shadow: var(--shadow); }
.w-faq summary { font-weight: 700; cursor: pointer; color: var(--ink); }
.w-faq p { margin: 10px 0 0; line-height: 1.55; }
.w-contact p { font-size: 1.02rem; }
.w-foot { text-align: center; color: var(--muted); font-size: 0.88rem; padding: 20px 16px 40px; }
.w-cta .btn { white-space: normal; text-align: center; }
@media (max-width: 480px) { .w-cta .btn { width: 100%; } }
