:root {
  --bg: #FAF8F5;
  --card: #FFFFFF;
  --ink: #343A35;
  --muted: #8B908A;
  --line: #ECE7E0;
  --sand: #EFEAE2;
  --sand-deep: #DDD5C9;
  --sage: #7F9C85;
  --sage-deep: #637F69;
  --sage-soft: #E4ECE2;
  --sage-mist: #F1F5EF;
  --warn: #C98B6B;
  --danger: #B5675A;
  --protein: #7F9C85;
  --carbs: #D2B48C;
  --fat: #B9A7C4;
  --radius: 22px;
  --radius-sm: 14px;
  --shadow: 0 1px 2px rgba(52, 58, 53, .04), 0 8px 24px rgba(52, 58, 53, .05);
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
/* No zoom: pans only (blocks pinch where supported) and no double-tap zoom. */
html { touch-action: pan-x pan-y; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
* { touch-action: manipulation; }
#w-chart { touch-action: pan-y; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Heebo", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-weight: 300;
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
body.locked { overflow: hidden; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; font-weight: 400; letter-spacing: -.01em; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

.muted { color: var(--muted); }
.small { font-size: 14px; }
.xs { font-size: 12px; }
.center { text-align: center; }

.view {
  max-width: 480px;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 16px calc(24px + var(--safe-b));
}
body.has-tabbar .view { padding-bottom: calc(108px + var(--safe-b)); }
button { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 14px;
}
.card-title { font-size: 15px; font-weight: 500; margin-bottom: 14px; color: var(--sage-deep); }

/* ---------- buttons ---------- */
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%;
  display: inline-grid; place-items: center;
  color: var(--ink); transition: background .2s;
}
.icon-btn:hover, .icon-btn:focus-visible { background: var(--sand); }
.icon-btn.sm { width: 36px; height: 36px; }
.icon-btn.sm svg { width: 18px; height: 18px; }
.icon-btn.soft { background: var(--sand); font-size: 20px; flex: none; }

.btn-primary {
  width: 100%; height: 54px; border-radius: 999px;
  background: var(--sage); color: #fff; font-weight: 500; font-size: 16px;
  transition: background .2s, transform .1s;
}
.btn-primary:hover { background: var(--sage-deep); }
.btn-primary:active { transform: scale(.985); }
.btn-primary:disabled { opacity: .5; }
.btn-soft {
  height: 44px; padding: 0 20px; border-radius: 999px;
  background: var(--sage-soft); color: var(--sage-deep); font-weight: 500;
}
.btn-ghost { height: 44px; padding: 0 18px; border-radius: 999px; color: var(--muted); }
.btn-ghost.danger { display: block; margin: 14px auto 0; color: var(--danger); font-size: 14px; }

/* ---------- form fields ---------- */
.field { display: block; margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field small { font-size: 12px; }
/* iOS zooms into any focused field under 16px, so fields stay at 16px. */
input[type="text"], input[type="number"], input[type="date"], input[type="search"], select {
  font-size: 16px;
  width: 100%; height: 50px; padding: 0 16px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--bg); outline: none; font-weight: 400;
  transition: border-color .2s, background .2s;
  appearance: none; -webkit-appearance: none;
}
input:focus, select:focus { border-color: var(--sage); background: #fff; }
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238B908A' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-size: 18px; background-position: left 14px center;
  padding-left: 40px;
}
input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; }

.unit-input { position: relative; }
.unit-input input { padding-left: 64px; }
.unit-input em {
  position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
  font-style: normal; font-size: 13px; color: var(--muted); pointer-events: none;
}
.unit-input.big input { height: 60px; font-size: 24px; text-align: center; padding: 0 64px; }

.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row-2 .field { margin-bottom: 16px; }

.segmented {
  display: flex; background: var(--sand); border-radius: 999px; padding: 4px; gap: 4px;
}
.segmented button {
  flex: 1; height: 40px; border-radius: 999px; color: var(--muted); font-size: 14px;
  transition: background .2s, color .2s, box-shadow .2s;
}
.segmented button.on { background: #fff; color: var(--ink); font-weight: 400; box-shadow: 0 1px 4px rgba(0,0,0,.06); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button {
  height: 38px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--line); background: #fff; font-size: 14px; color: var(--ink);
  transition: all .2s;
}
.chips button.on { background: var(--sage-soft); border-color: var(--sage); color: var(--sage-deep); font-weight: 400; }
#detail-presets { margin-top: 10px; }
.unit-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -20px; padding-inline: 20px; }
.unit-chips::-webkit-scrollbar { display: none; }
.unit-chips button { flex: none; white-space: nowrap; }
.amount-row .unit-input input { padding: 0 72px; }

.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; color: var(--muted); }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track { width: 40px; height: 24px; border-radius: 999px; background: var(--sand-deep); position: relative; transition: background .2s; }
.switch-track::after {
  content: ""; position: absolute; top: 3px; right: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 2px rgba(0,0,0,.15);
}
.switch input:checked + .switch-track { background: var(--sage); }
.switch input:checked + .switch-track::after { transform: translateX(-16px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--sage); outline-offset: 2px; }

.check { display: flex; align-items: center; gap: 8px; margin-top: 14px; font-size: 14px; color: var(--muted); }
.check input { width: 18px; height: 18px; accent-color: var(--sage); }

/* ---------- onboarding ---------- */
.ob-header { text-align: center; padding: 28px 8px 24px; position: relative; }
.ob-header #ob-close { position: absolute; top: 0; left: 0; }
.ob-logo { display: block; width: 220px; height: auto; margin: 0 auto 20px; }
.brand-bar { display: flex; align-items: center; justify-content: space-between; margin: 0 0 6px; }
.brand-logo { display: block; height: 32px; width: auto; }
.ob-header h1 { font-size: 26px; font-weight: 300; margin-bottom: 6px; }
.kcal-reco { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.kcal-reco-num { font-size: 38px; font-weight: 300; color: var(--sage-deep); line-height: 1.1; }
.plan-note {
  margin: 14px 0 0; padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--sage-mist); color: var(--sage-deep); font-size: 14px;
}
.plan-note:empty { display: none; }
.plan-note.warn { background: #F7EEE8; color: var(--warn); }
.form-error { color: var(--danger); font-size: 14px; text-align: center; min-height: 1px; margin: 4px 0 12px; }

/* ---------- dashboard ---------- */
.top-bar { display: flex; align-items: flex-start; justify-content: space-between; margin: 4px 0 18px; }
.top-bar .muted { margin: 0 0 2px; padding-inline-start: 4px; }
.day-nav { display: flex; align-items: center; gap: 2px; margin-inline-start: -8px; }
.day-nav h1 { font-size: 24px; font-weight: 400; min-width: 70px; text-align: center; }
.day-nav .icon-btn:disabled { opacity: .25; pointer-events: none; }

.goal-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.goal-pct { font-size: 20px; font-weight: 400; color: var(--sage-deep); }
.goal-track { position: relative; height: 10px; border-radius: 999px; background: var(--sand); }
.goal-fill {
  position: absolute; inset-block: 0; right: 0; width: 0; border-radius: 999px;
  background: linear-gradient(to left, #A9C0AD, var(--sage)); transition: width .8s cubic-bezier(.2,.8,.2,1);
}
.goal-dot {
  position: absolute; top: 50%; right: 0; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; border: 3px solid var(--sage); transform: translate(50%, -50%);
  transition: right .8s cubic-bezier(.2,.8,.2,1);
}
.goal-scale { display: flex; justify-content: space-between; align-items: flex-end; margin-top: 14px; }
.goal-scale > * { display: flex; flex-direction: column; gap: 2px; }
.goal-scale > *:last-child { text-align: left; }
.goal-scale strong { font-weight: 400; font-size: 15px; }
.goal-current { align-items: center; padding: 4px 12px; border-radius: 12px; background: var(--sage-mist); }
.goal-current strong { color: var(--sage-deep); font-weight: 500; }
.goal-date { margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); text-align: center; }
.goal-date b { color: var(--ink); font-weight: 400; }
.goal-card.no-goal .goal-track, .goal-card.no-goal .goal-pct { display: none; }

.ring-card { padding: 26px 20px 20px; }
.ring-wrap { position: relative; width: 210px; height: 210px; margin: 0 auto; }
.ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 12; }
.ring-bg { stroke: var(--sage-mist); }
.ring-fg {
  stroke: var(--sage); stroke-linecap: round;
  stroke-dasharray: 540.35; stroke-dashoffset: 540.35;
  transition: stroke-dashoffset .9s cubic-bezier(.2,.8,.2,1), stroke .3s;
}
.ring-fg.over { stroke: var(--warn); }
.ring-center {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
}
.ring-eaten { font-size: 44px; font-weight: 300; line-height: 1; letter-spacing: -.02em; }
.ring-target {
  display: inline-flex; align-items: center; gap: 4px; margin-top: 6px;
  padding: 4px 10px; border-radius: 999px; color: var(--muted); font-size: 14px;
  transition: background .2s;
}
.ring-target:hover, .ring-target:focus-visible { background: var(--sand); }
.ring-target svg { width: 14px; height: 14px; }
.ring-left { margin-top: 6px; color: var(--sage-deep); font-weight: 400; }
.ring-left.over { color: var(--warn); }

.macros { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); text-align: center; }
.macros > div { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.macros strong { font-weight: 400; font-size: 15px; }
.macros strong::after { content: " ג׳"; font-size: 12px; color: var(--muted); }
.macro-dot { width: 6px; height: 6px; border-radius: 50%; margin-bottom: 2px; }
.macro-dot.p { background: var(--protein); }
.macro-dot.c { background: var(--carbs); }
.macro-dot.f { background: var(--fat); }

.meal { padding: 16px 20px 8px; }
.meal-head { display: flex; align-items: center; justify-content: space-between; padding-bottom: 8px; }
.meal-head h2 { font-size: 16px; font-weight: 400; display: flex; align-items: center; gap: 10px; }
.meal-icon { width: 32px; height: 32px; border-radius: 10px; background: var(--sage-mist); display: grid; place-items: center; font-size: 16px; }
.meal-kcal { font-size: 14px; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.meal-kcal .icon-btn { color: var(--sage-deep); }
.meal-empty { font-size: 13px; color: var(--muted); padding: 2px 0 10px; margin: 0; }
.meal-items { list-style: none; margin: 0; padding: 0; }
.meal-items li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.meal-items .info { flex: 1; min-width: 0; }
.meal-items .name { font-size: 15px; font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meal-items .sub { font-size: 12px; color: var(--muted); }
.meal-items .kcal { font-size: 14px; white-space: nowrap; }
.meal-items .del { width: 32px; height: 32px; color: var(--muted); }
.meal-items .del svg { width: 16px; height: 16px; }


/* ---------- thumbs & results ---------- */
.thumb {
  width: 46px; height: 46px; flex: none; border-radius: 12px; background: var(--sand) center / cover no-repeat;
  display: grid; place-items: center; font-size: 20px; overflow: hidden;
}
.thumb.lg { width: 72px; height: 72px; border-radius: 16px; font-size: 30px; }

.search-box { position: relative; }
.search-box svg { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 20px; height: 20px; }
.search-box input { padding-right: 44px; border-radius: 999px; }
.search-box input::-webkit-search-cancel-button { -webkit-appearance: none; }
.list-label { margin: 16px 4px 4px; }
.list-label:empty { display: none; }
.results { list-style: none; padding: 0; margin: 0; }
.results li button {
  width: 100%; display: flex; align-items: center; gap: 12px; text-align: right;
  padding: 10px 6px; border-radius: 14px; transition: background .15s;
}
.results li button:hover, .results li button:focus-visible { background: var(--sage-mist); outline: none; }
.results .info { flex: 1; min-width: 0; }
.results .name { font-weight: 400; font-size: 15px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.results .sub { font-size: 12px; color: var(--muted); }
.results .kcal { text-align: left; font-size: 14px; white-space: nowrap; }
.results .kcal small { display: block; font-size: 11px; color: var(--muted); }
.results li + li { border-top: 1px solid var(--line); }
.skeleton { height: 66px; border-radius: 14px; margin: 6px 0; background: linear-gradient(90deg, var(--sand) 0%, var(--sage-mist) 50%, var(--sand) 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- sheet ---------- */
.sheet-backdrop, .dialog-backdrop {
  position: fixed; inset: 0; background: rgba(52, 58, 53, .28); z-index: 30;
  animation: fade .25s ease;
  backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
}
.sheet {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 31;
  max-width: 520px; margin: 0 auto; height: min(88vh, 760px); height: min(88dvh, 760px);
  background: var(--card); border-radius: 28px 28px 0 0;
  display: flex; flex-direction: column;
  box-shadow: 0 -10px 40px rgba(52, 58, 53, .12);
  animation: slide-up .32s cubic-bezier(.2,.8,.2,1);
}
.sheet.closing { animation: slide-down .22s ease forwards; }
.sheet-grip { width: 40px; height: 4px; border-radius: 4px; background: var(--sand-deep); margin: 10px auto 0; flex: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 14px 0 14px; flex: none; }
.sheet-head h2 { font-size: 18px; flex: 1; padding-inline: 6px; }
.tabs { display: flex; gap: 4px; margin: 12px 20px 4px; padding: 4px; background: var(--sand); border-radius: 999px; flex: none; }
.tabs button { flex: 1; height: 38px; border-radius: 999px; font-size: 14px; color: var(--muted); transition: all .2s; }
.tabs button[aria-selected="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.sheet-body { flex: 1; overflow-y: auto; padding: 14px 20px calc(24px + var(--safe-b)); overscroll-behavior: contain; }

.scanner {
  position: relative; aspect-ratio: 4 / 3; border-radius: var(--radius); overflow: hidden;
  background: var(--sand); display: grid; place-items: center;
}
.scanner video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scanner-frame {
  position: absolute; inset: 22% 14%; border-radius: 16px;
  box-shadow: 0 0 0 999px rgba(52, 58, 53, .18); border: 2px solid rgba(255,255,255,.9);
  pointer-events: none; opacity: 0; transition: opacity .3s;
}
.scanner.live .scanner-frame { opacity: 1; }
/* The video is positioned, so the button needs its own stacking to stay tappable above it. */
#scanner-start { position: relative; z-index: 1; }
.scanner.live #scanner-start { display: none; }
.scanner-frame::after {
  content: ""; position: absolute; inset-inline: 10%; top: 50%; height: 2px; background: var(--sage);
  box-shadow: 0 0 12px var(--sage); animation: scan 1.8s ease-in-out infinite alternate;
}
@keyframes scan { from { transform: translateY(-34px); } to { transform: translateY(34px); } }
#scanner-status { margin: 14px 0; }
.barcode-manual { display: flex; gap: 8px; }
.barcode-manual input { flex: 1; border-radius: 999px; }
.barcode-manual .btn-soft { height: 50px; }

.detail-head { display: flex; gap: 14px; align-items: center; margin-bottom: 20px; }
.detail-head h3 { font-size: 18px; font-weight: 400; }
.detail-head p { margin: 2px 0 0; }
.amount-row { display: flex; align-items: center; gap: 8px; }
.amount-row .unit-input { flex: 1; }
.amount-row input { text-align: center; font-size: 18px; }
.detail-total {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 16px; margin: 4px 0 18px; border-radius: var(--radius-sm); background: var(--sage-mist);
}
.detail-total strong { font-size: 30px; font-weight: 300; color: var(--sage-deep); }

/* ---------- dialog & toast ---------- */
.dialog-backdrop { display: grid; place-items: center; padding: 16px; z-index: 40; }
.dialog {
  width: 100%; max-width: 360px; background: #fff; border-radius: var(--radius);
  padding: 24px 20px 16px; box-shadow: 0 20px 50px rgba(0,0,0,.15);
  animation: pop .25s cubic-bezier(.2,.8,.2,1);
}
.dialog h3 { font-size: 18px; margin-bottom: 4px; }
.dialog > p { margin: 0 0 16px; }
.dialog-actions { display: flex; gap: 8px; margin-top: 18px; }
.dialog-actions .btn-primary { height: 46px; flex: 1; }

.toast {
  position: fixed; left: 50%; bottom: calc(96px + var(--safe-b)); z-index: 50;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 14px;
  transition: opacity .25s, transform .25s; white-space: nowrap; max-width: calc(100% - 32px);
  overflow: hidden; text-overflow: ellipsis;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@keyframes fade { from { opacity: 0; } }
@keyframes slide-up { from { transform: translateY(100%); } }
@keyframes slide-down { to { transform: translateY(100%); } }
@keyframes pop { from { transform: scale(.94); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- weekly weigh-in & pace ---------- */
.nudge {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: right;
  background: var(--sage-mist); box-shadow: none; border: 1px solid var(--sage-soft);
}
.nudge-icon { width: 40px; height: 40px; border-radius: 12px; background: #fff; display: grid; place-items: center; font-size: 20px; flex: none; }
.nudge-body { flex: 1; display: flex; flex-direction: column; }
.nudge-body strong { font-weight: 500; color: var(--sage-deep); }
.nudge > svg { color: var(--sage-deep); width: 18px; height: 18px; }

.goal-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.goal-foot .pace { margin: 0; }
.link-btn { display: inline-flex; align-items: center; gap: 2px; color: var(--sage-deep); font-weight: 400; padding: 6px 4px; margin-inline-start: auto; }
.link-btn svg { width: 16px; height: 16px; }
.pace { display: inline-block; padding: 5px 12px; border-radius: 999px; background: var(--sage-mist); color: var(--sage-deep); font-weight: 400; }
.pace.behind { background: #F7EEE8; color: #9A5F3F; }
#ws-pace { margin: 14px 0 0; }

/* ---------- weight log ---------- */
.w-stats { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; }
.w-stats > div { display: flex; flex-direction: column; gap: 2px; }
.w-stats strong { font-weight: 400; font-size: 18px; }
.chart-legend { display: flex; gap: 16px; margin: 18px 0 4px; font-size: 12px; color: var(--muted); }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { display: inline-block; width: 18px; height: 0; border-top: 2px solid; }
.lg-actual { border-color: #3F8A5A !important; }
.lg-plan { border-color: #B07FC0 !important; border-top-style: dashed !important; }
.chart-wrap { position: relative; direction: ltr; }
#w-chart { width: 100%; height: auto; display: block; overflow: visible; touch-action: pan-y; stroke: none; fill: none; stroke-width: 0; }
#w-chart text { font-family: inherit; font-size: 10px; fill: var(--muted); }
#w-chart .lbl { fill: var(--ink); font-size: 11px; font-weight: 500; }
#w-chart .hit { fill: transparent; cursor: pointer; }
.chart-tip {
  position: absolute; transform: translate(-50%, calc(-100% - 12px)); pointer-events: none;
  background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px;
  box-shadow: var(--shadow); font-size: 12px; white-space: nowrap; direction: rtl; text-align: right; z-index: 2;
}
.chart-tip strong { display: block; font-size: 15px; font-weight: 500; }
#add-weight { margin-bottom: 14px; }
.w-list { list-style: none; margin: 0; padding: 0; }
.w-list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.w-list li:first-child { border-top: 0; }
.w-list .when { flex: 1; font-size: 14px; }
.w-list .kg { font-weight: 400; min-width: 64px; text-align: left; }
.w-list .delta { font-size: 12px; color: var(--muted); min-width: 52px; text-align: left; }
.w-list .del { width: 32px; height: 32px; color: var(--muted); }
.w-list .del svg { width: 16px; height: 16px; }
.dialog-date { margin: 14px 0 0; }

/* ---------- bottom tab bar ---------- */
.tabbar {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: 1fr 96px 1fr; align-items: center;
  padding: 6px max(16px, calc((100% - 480px) / 2)) calc(6px + var(--safe-b));
  background: rgba(255, 255, 255, .9); border-top: 1px solid var(--line);
  backdrop-filter: saturate(1.4) blur(16px); -webkit-backdrop-filter: saturate(1.4) blur(16px);
}
.tab {
  height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 11px; color: var(--muted); border-radius: 14px; transition: color .2s;
}
.tab svg { width: 24px; height: 24px; }
.tab[aria-current="page"] { color: var(--sage-deep); font-weight: 500; }
.tab[aria-current="page"] svg { stroke-width: 2; }
.tab-add {
  justify-self: center; width: 60px; height: 60px; margin-top: -30px; border-radius: 50%;
  background: var(--sage); color: #fff; display: grid; place-items: center;
  box-shadow: 0 8px 22px rgba(99, 127, 105, .38), 0 0 0 5px var(--bg);
  transition: transform .15s, background .2s;
}
.tab-add:active { transform: scale(.94); }
.tab-add svg { width: 28px; height: 28px; stroke-width: 2; }
.page-title { font-size: 24px; font-weight: 400; padding-inline-start: 4px; }

/* ---------- iPhone install hint ---------- */
.install-hint { display: flex; align-items: center; gap: 12px; padding: 14px 14px 14px 8px; }
.install-hint img { border-radius: 11px; flex: none; }
.install-hint p { flex: 1; margin: 0; line-height: 1.6; }
.install-hint b { font-weight: 500; }
.share-ic { width: 18px; height: 18px; vertical-align: -3px; color: #0A84FF; }

/* ---------- sign in ---------- */
.auth-mode { margin-bottom: 18px; }
input[type="email"], input[type="password"] {
  width: 100%; height: 50px; padding: 0 16px; font-size: 16px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--bg); outline: none; font-weight: 400; transition: border-color .2s, background .2s;
  -webkit-appearance: none; appearance: none; text-align: left;
}
.pw-input input { padding-left: 72px; }
.pw-toggle {
  position: absolute; left: 8px; top: 50%; transform: translateY(-50%);
  height: 34px; padding: 0 10px; border-radius: 10px; font-size: 13px; color: var(--sage-deep);
}
.auth-info {
  margin: 0 0 14px; padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--sage-mist); color: var(--sage-deep); font-size: 14px; line-height: 1.5;
}
.auth-info:empty { display: none; }
.auth-forgot { display: block; margin: 10px auto 0; font-size: 14px; }
.account-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.account-row b { font-weight: 400; color: var(--ink); }
.account-row .btn-ghost { color: var(--sage-deep); font-weight: 400; }

/* ---------- favorites & saved meals ---------- */
.detail-info { flex: 1; min-width: 0; }
.fav-btn { flex: none; align-self: flex-start; color: var(--muted); }
.fav-btn svg { width: 26px; height: 26px; }
.fav-btn[aria-pressed="true"] { color: #C9A227; }
.fav-btn[aria-pressed="true"] svg { fill: currentColor; }
.list-section { list-style: none; margin: 16px 4px 4px; font-size: 12px; color: var(--muted); }
.list-section:first-child { margin-top: 4px; }
.results li.list-section + li { border-top: 0; }
.fav-star { color: #C9A227; font-size: 12px; margin-inline-start: 4px; }
.saved-meals li { display: flex; align-items: center; gap: 4px; }
.saved-meals li > button[data-mid] { flex: 1; min-width: 0; }
.saved-meals .del { width: 36px; height: 36px; color: var(--muted); flex: none; }
.saved-meals .del svg { width: 16px; height: 16px; }
.meal-icon-lg { width: 46px; height: 46px; flex: none; border-radius: 12px; background: var(--sage-mist); display: grid; place-items: center; font-size: 20px; }
.inline-ic { width: 16px; height: 16px; vertical-align: -3px; }
.meal-kcal .save-meal { color: var(--muted); }
.meal-kcal .save-meal svg { width: 17px; height: 17px; }
.tabs button { font-size: 13px; }

/* ---------- days over / under target ---------- */
.stats-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
.stats-head .card-title { margin: 0; }
.segmented.mini { padding: 3px; gap: 2px; }
.segmented.mini button { height: 30px; padding: 0 10px; font-size: 12px; flex: none; }
.stats-split { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 14px 8px; border-radius: var(--radius-sm); }
.stat strong { font-size: 30px; font-weight: 300; line-height: 1.1; }
.stat span { font-size: 13px; }
.stat.under { background: var(--sage-mist); color: var(--sage-deep); }
.stat.over { background: #F7EEE8; color: #9A5F3F; }
.stats-bar { display: flex; height: 8px; border-radius: 999px; overflow: hidden; margin: 14px 0 10px; background: var(--sand); gap: 2px; }
.stats-bar i { display: block; height: 100%; transition: width .6s cubic-bezier(.2,.8,.2,1); }
.stats-bar i.under { background: var(--sage); }
.stats-bar i.over { background: var(--warn); }
.stats-foot { margin: 0; text-align: center; }
