/* ================================================================
   LEANLY — design system
   Canvas: warm snow white · Ink: deep forest green · Tints: keylime,
   mint, sage · Punctuation: lime pulse · Flat, shadowless, pill-soft.
   Type: Cormorant Garamond 300 (display) · Inter (UI) · IBM Plex Mono
   (numbers — specimen labels).
   ================================================================ */

:root {
  --cream: #FCFCF7;
  --paper: #FFFEFC;
  --stone: #EEEEE9;
  --keylime: #E1F4DF;
  --mint: #CFE7D3;
  --sage: #B1DBB8;
  --lime: #D3FA99;
  --apricot: #FEE9D1;
  --sandstone: #D1A883;
  --ink: #1C3A13;
  --ink-deep: #12290B;
  --muted: #68705F;
  --faint: #9AA091;
  --border: #E6E6DC;

  --r-card: 16px;
  --r-panel: 20px;
  --r-input: 12px;
  --r-pill: 999px;

  --sans: 'Inter', -apple-system, system-ui, sans-serif;
  --serif: 'Cormorant Garamond', Georgia, serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;

  --ease-spring: cubic-bezier(.34,1.4,.44,1);
  --ease-out: cubic-bezier(.22,.8,.36,1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }

body {
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--stone);
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input { font: inherit; color: inherit; }
svg { display: block; }
button svg, .icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.mono { font-family: var(--mono); }
.serif { font-family: var(--serif); font-weight: 300; }
.hidden { display: none !important; }

/* ---------- stage & phone frame ---------- */
.stage {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.phone {
  position: relative;
  width: 390px;
  height: 844px;
  max-height: calc(100vh - 48px);
  background: var(--cream);
  border-radius: 44px;
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
@media (max-width: 460px) {
  .stage { padding: 0; }
  .phone { width: 100%; height: 100vh; height: 100dvh; max-height: none; border-radius: 0; border: none; }
}

.flow { position: absolute; inset: 0; display: flex; flex-direction: column; }

/* ---------- screens ---------- */
.screen {
  position: absolute; inset: 0;
  display: none;
  flex-direction: column;
  background: var(--cream);
}
.screen.active { display: flex; }

/* ---------- onboarding ---------- */
.ob-header {
  position: relative; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 20px 4px;
}
.ob-header.hidden-soft { visibility: hidden; }
.ob-spacer { width: 40px; }
.ob-progress { display: flex; gap: 8px; }
.ob-dot {
  width: 24px; height: 4px; border-radius: var(--r-pill);
  background: var(--mint);
  transition: background .3s var(--ease-out), width .3s var(--ease-out);
}
.ob-dot.on { background: var(--ink); }

.ob-screen { padding-top: 56px; }
#ob-welcome { padding-top: 0; }
.ob-body { flex: 1; padding: 8px 24px 0; overflow-y: auto; }
.ob-title { font-size: 34px; line-height: 1.1; letter-spacing: -0.3px; }
.ob-sub { color: var(--muted); font-size: 14px; margin: 6px 0 24px; }
.ob-footer { padding: 12px 24px 28px; display: flex; flex-direction: column; gap: 10px; }

/* welcome */
#ob-welcome { justify-content: flex-end; }
.welcome-art {
  position: absolute; top: 0; left: 0; right: 0; height: 46%;
  display: flex; align-items: flex-end; justify-content: center;
  background: linear-gradient(180deg, var(--keylime), var(--cream));
}
.sprig { height: 82%; }
.sprig path, .sprig circle { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; }
.sprig-bud { fill: var(--lime); stroke: var(--ink); }
.welcome-copy { padding: 0 24px; margin-bottom: 8px; }
.display {
  font-family: var(--serif); font-weight: 300;
  font-size: 64px; line-height: 1.02; letter-spacing: -1.3px;
  margin: 14px 0 10px;
}
.lede { color: var(--muted); font-size: 16px; max-width: 30ch; }
.micro-note { text-align: center; font-size: 12px; color: var(--faint); }

/* badges */
.badge {
  display: inline-block;
  font-size: 12px; font-weight: 500; letter-spacing: .04em;
  padding: 6px 12px; border-radius: var(--r-pill);
}
.badge-lime { background: var(--lime); color: var(--ink); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 500; font-size: 16px;
  border-radius: var(--r-pill);
  padding: 16px 24px;
  transition: transform .15s var(--ease-spring), background .2s;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--ink); color: var(--cream); }
.btn-primary:hover { background: var(--ink-deep); }
.btn-block { width: 100%; }
.btn-small { font-size: 13px; padding: 9px 16px; background: var(--ink); color: var(--cream); }
.btn-ghost { background: transparent; border: 1.5px solid var(--ink); color: var(--ink); }
.btn-text {
  font-size: 14px; font-weight: 500; color: var(--ink);
  text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1.5px;
  padding: 8px; align-self: center;
}
.icon-btn {
  width: 40px; height: 40px; border-radius: var(--r-pill);
  display: flex; align-items: center; justify-content: center;
  transition: background .2s;
}
.icon-btn:hover { background: var(--keylime); }

/* fields */
.field { margin-bottom: 22px; }
.field-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.field-label {
  display: block;
  font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink); margin-bottom: 10px;
}
.field-head .field-label { margin-bottom: 0; }
.field-value { font-size: 20px; font-weight: 500; }
.why { font-style: normal; font-size: 11px; font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--faint); text-decoration: underline dotted; margin-left: 6px; cursor: help; }

/* segmented control */
.seg-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.seg-row .field-label { margin-bottom: 0; }
.seg { display: flex; background: var(--stone); border-radius: var(--r-pill); padding: 3px; }
.seg-opt {
  flex: 1; padding: 10px 18px; border-radius: var(--r-pill);
  font-size: 14px; font-weight: 500; color: var(--muted);
  transition: background .25s var(--ease-out), color .25s;
  white-space: nowrap;
}
.seg-sm .seg-opt { padding: 7px 14px; font-size: 13px; }
.seg-opt.active { background: var(--ink); color: var(--cream); }

/* rulers */
.ruler-wrap {
  border-radius: var(--r-input);
  background:
    repeating-linear-gradient(90deg, var(--sage) 0 1.5px, transparent 1.5px 12px),
    var(--keylime);
  background-position: 6px center;
  padding: 4px 6px;
}
.ruler { -webkit-appearance: none; appearance: none; width: 100%; height: 44px; background: transparent; }
.ruler::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 36px; border-radius: 9px;
  background: var(--ink); border: 3px solid var(--cream);
  cursor: grab;
}
.ruler::-moz-range-thumb {
  width: 12px; height: 30px; border-radius: 9px;
  background: var(--ink); border: 3px solid var(--cream); cursor: grab;
}
.ruler:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: var(--r-input); }

/* choices & chips */
.choice-list { display: flex; flex-direction: column; gap: 10px; }
.choice {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  text-align: left;
  padding: 16px; border-radius: var(--r-card);
  background: var(--paper); border: 1.5px solid var(--border);
  transition: border-color .2s, background .2s, transform .15s var(--ease-spring);
}
.choice:active { transform: scale(.98); }
.choice.active { background: var(--keylime); border-color: var(--ink); }
.choice-title { font-weight: 500; }
.choice-sub { font-size: 12px; color: var(--muted); }

.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 10px 18px; border-radius: var(--r-pill);
  border: 1.5px solid var(--border); background: var(--paper);
  font-size: 14px; font-weight: 500; color: var(--muted);
  transition: all .2s var(--ease-out);
}
.chip.active { background: var(--ink); border-color: var(--ink); color: var(--cream); }
.chip-scroll { flex-wrap: nowrap; overflow-x: auto; padding: 2px 20px 12px; scrollbar-width: none; }
.chip-scroll::-webkit-scrollbar { display: none; }
.chip-scroll .chip { flex-shrink: 0; }

/* panels */
.panel { border-radius: var(--r-panel); padding: 20px; }
.panel-keylime { background: var(--keylime); }
.panel-mint { background: var(--mint); }
.panel-cream { background: var(--paper); border: 1.5px solid var(--border); }
.panel-forest { background: var(--ink); color: var(--cream); }
.panel-note { font-size: 12px; color: var(--muted); margin-top: 10px; }

/* body-fat picker */
.bf-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 4px; }
.bf-opt {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 12px 4px 10px; border-radius: var(--r-card);
  background: var(--paper); border: 1.5px solid transparent;
  font-family: var(--mono); font-size: 12px; color: var(--muted);
  transition: all .2s var(--ease-out);
}
.bf-opt svg { width: 22px; height: 38px; fill: var(--sage); stroke: none; }
.bf-opt.active { border-color: var(--ink); color: var(--ink); }
.bf-opt.active svg { fill: var(--ink); }

/* pace slider */
.pace-stage { margin-top: 8px; }
.pace-readout { text-align: center; margin-bottom: 36px; }
.pace-zone {
  display: inline-block; font-size: 12px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase;
  background: var(--lime); border-radius: var(--r-pill); padding: 6px 14px;
}
.pace-kcal { margin-top: 14px; display: flex; align-items: baseline; justify-content: center; gap: 8px; }
.pace-kcal .mono { font-size: 56px; font-weight: 300; letter-spacing: -1px; line-height: 1; }
.pace-unit { color: var(--muted); font-size: 14px; }
.pace-line { color: var(--muted); font-size: 14px; margin-top: 8px; }

.pace-slider { position: relative; padding: 10px 0 34px; touch-action: none; }
.pace-slider:focus-visible { outline: 2px solid var(--ink); outline-offset: 8px; border-radius: 8px; }
.pace-track {
  height: 14px; border-radius: var(--r-pill);
  background: linear-gradient(90deg, var(--keylime) 0 33%, var(--mint) 33% 66%, var(--sage) 66%);
  overflow: hidden;
}
.pace-fill { height: 100%; width: 50%; background: var(--ink); border-radius: var(--r-pill); }
.pace-thumb {
  position: absolute; top: -5px; left: 50%;
  width: 44px; height: 44px; margin-left: -22px;
  background: var(--cream); border: 2px solid var(--ink); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: grab;
}
.pace-thumb:active { cursor: grabbing; }
.pace-thumb svg { width: 18px; height: 18px; fill: var(--ink); stroke: none; }
.pace-zones { display: flex; justify-content: space-between; margin-top: 22px; padding: 0 2px; }
.pace-zones span { font-size: 12px; font-weight: 500; color: var(--faint); transition: color .2s; }
.pace-zones span.on { color: var(--ink); }
.pace-eta { text-align: center; font-size: 13px; color: var(--muted); margin-top: 20px; }
.pace-warn {
  text-align: center; font-size: 13px; color: var(--ink);
  background: var(--apricot); border-radius: var(--r-card);
  padding: 10px 14px; margin-top: 12px;
  opacity: 0; transform: translateY(4px);
  transition: opacity .3s, transform .3s;
}
.pace-warn.show { opacity: 1; transform: none; }

/* plan reveal */
.plan-body { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.plan-big { font-size: 88px; font-weight: 300; letter-spacing: -2px; line-height: 1; margin-top: 22px; }
.plan-unit { color: var(--muted); margin-top: 4px; }
.plan-macros { display: flex; gap: 10px; margin-top: 28px; }
.plan-macro {
  display: flex; flex-direction: column; gap: 2px;
  background: var(--keylime); border-radius: var(--r-card);
  padding: 14px 18px; min-width: 86px;
  font-size: 12px; color: var(--muted);
}
.plan-macro-num { font-size: 18px; font-weight: 500; color: var(--ink); }
.plan-loss { margin-top: 24px; font-size: 14px; }
.plan-honesty { margin-top: 10px; font-size: 12px; color: var(--faint); max-width: 30ch; }

/* ---------- app shell ---------- */
.app-screen { padding-bottom: 76px; }
.scroll { flex: 1; overflow-y: auto; padding: 0 20px; }
.scroll-pad { height: 24px; }
.page-head { padding: 22px 20px 12px; }
.page-title { font-size: 30px; letter-spacing: -0.3px; }

/* date bar */
.date-bar { display: flex; align-items: center; justify-content: space-between; padding: 16px 12px 8px; }
.date-label {
  display: flex; align-items: center; gap: 6px;
  font-family: var(--serif); font-weight: 400; font-size: 21px;
  padding: 6px 14px; border-radius: var(--r-pill);
  transition: background .2s;
}
.date-label:hover { background: var(--keylime); }
.date-caret { width: 16px; height: 16px; }

/* budget hero */
.budget-card { display: flex; gap: 16px; align-items: center; margin-top: 8px; }
.ring-wrap { position: relative; width: 150px; height: 150px; flex-shrink: 0; }
.ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--paper); stroke-width: 12; }
.ring-val {
  fill: none; stroke: var(--ink); stroke-width: 12; stroke-linecap: round;
  stroke-dasharray: 490; stroke-dashoffset: 490;
}
.ring-val.over { stroke: var(--sandstone); }
.ring-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
}
.ring-eaten { font-size: 30px; font-weight: 500; letter-spacing: -0.5px; }
.ring-of { font-size: 11px; color: var(--muted); }
.ring-left { font-size: 11px; font-weight: 500; color: var(--ink); margin-top: 3px; }

.budget-side { flex: 1; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.week-chip {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--paper); border-radius: var(--r-pill);
  padding: 8px 8px 8px 14px;
  transition: transform .15s var(--ease-spring);
}
.week-chip:active { transform: scale(.96); }
.week-chip-label { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.week-chip-val {
  font-size: 13px; font-weight: 500;
  background: var(--lime); border-radius: var(--r-pill); padding: 4px 10px;
}
.week-chip-val.neg { background: var(--apricot); }

.macros { display: flex; flex-direction: column; gap: 8px; }
.macro-head { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-bottom: 3px; }
.macro-head .mono { font-size: 11px; }
.bar { height: 6px; border-radius: var(--r-pill); background: var(--paper); overflow: hidden; }
.bar-fill { height: 100%; width: 0%; border-radius: var(--r-pill); background: var(--ink); }

/* week popover */
.week-pop { background: var(--paper); border: 1.5px solid var(--border); border-radius: var(--r-card); padding: 14px 16px; margin-top: 10px; }
.week-pop-title { font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.week-pop-bars { display: flex; gap: 8px; align-items: flex-end; height: 56px; }
.wp-day { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.wp-bar { width: 100%; border-radius: 4px 4px 0 0; background: var(--mint); }
.wp-bar.over { background: var(--sandstone); }
.wp-day span { font-size: 9px; color: var(--faint); text-transform: uppercase; }

/* food list */
.list-head { display: flex; align-items: baseline; justify-content: space-between; margin: 24px 0 10px; }
.list-title { font-size: 22px; }
.list-count { font-size: 12px; color: var(--muted); }
.food-list { display: flex; flex-direction: column; gap: 8px; }

.strip {
  display: flex; align-items: center; gap: 12px;
  background: var(--paper); border: 1.5px solid var(--border);
  border-radius: var(--r-card); padding: 10px;
  cursor: pointer;
  transition: border-color .2s, transform .15s var(--ease-spring);
}
.strip:active { transform: scale(.985); }
.strip:hover { border-color: var(--sage); }
.strip-img {
  width: 52px; height: 52px; border-radius: 12px; flex-shrink: 0;
  background: var(--apricot); object-fit: cover;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-size: 22px; color: var(--ink);
  overflow: hidden;
}
.strip-img img { width: 100%; height: 100%; object-fit: cover; }
.strip-img, .food-card-img, .detail-img, .food-chip-img, .photo-opt { position: relative; }
.strip-img img, .food-card-img img, .detail-img img, .food-chip-img img, .photo-opt img { position: absolute; inset: 0; }
.strip-main { flex: 1; min-width: 0; }
.strip-name { font-weight: 500; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.strip-meta { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.strip-end { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.strip-kcal { font-size: 14px; font-weight: 500; }
.strip-kcal small { font-size: 10px; color: var(--muted); font-weight: 400; }

.qty-ctl { display: flex; align-items: center; gap: 2px; background: var(--keylime); border-radius: var(--r-pill); padding: 2px; }
.qty-btn {
  width: 30px; height: 30px; border-radius: var(--r-pill);
  display: flex; align-items: center; justify-content: center;
  transition: background .2s, transform .12s var(--ease-spring);
}
.qty-btn svg { width: 14px; height: 14px; }
.qty-btn:hover { background: var(--paper); }
.qty-btn:active { transform: scale(.85); }
.qty-x { font-family: var(--mono); font-size: 12px; font-weight: 500; min-width: 24px; text-align: center; }

/* empty state */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 36px 20px 8px; }
.empty-art { width: 110px; }
.empty-art ellipse { fill: var(--keylime); }
.empty-art path { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; }
.empty-art .empty-leaf { stroke: var(--ink); fill: var(--lime); }
.empty-line { color: var(--muted); font-size: 14px; margin-top: 14px; max-width: 24ch; }

/* foods grid */
.search-row { padding: 0 20px 12px; }
.search-box {
  display: flex; align-items: center; gap: 10px;
  background: var(--paper); border: 1.5px solid var(--border);
  border-radius: var(--r-pill); padding: 12px 16px;
}
.search-box svg { width: 18px; height: 18px; color: var(--faint); flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.search-box input { flex: 1; border: none; outline: none; background: none; font-size: 15px; min-width: 0; }
.search-box input::placeholder { color: var(--faint); }
.search-box:focus-within { border-color: var(--ink); }

.foods-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding-top: 4px; }
.food-card {
  border-radius: var(--r-card); overflow: hidden; text-align: left;
  background: var(--paper); border: 1.5px solid var(--border);
  transition: border-color .2s, transform .15s var(--ease-spring);
  display: flex; flex-direction: column;
}
.food-card:hover { border-color: var(--sage); }
.food-card:active { transform: scale(.97); }
.food-card-img { height: 96px; background: var(--apricot); display: flex; align-items: center; justify-content: center; font-family: var(--serif); font-size: 30px; overflow: hidden; }
.food-card-img img { width: 100%; height: 100%; object-fit: cover; }
.food-card-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.food-card-name { font-weight: 500; font-size: 13px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.food-card-kcal { font-size: 12px; color: var(--muted); margin-top: auto; }

/* progress */
.trend-card { margin-top: 4px; }
.trend-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.trend-now { font-size: 34px; font-weight: 300; letter-spacing: -0.5px; }
.trend-unit { font-size: 13px; color: var(--muted); margin-left: 4px; }
.trend-chart { width: 100%; height: auto; }
.trend-line { font-size: 12px; color: var(--muted); margin-top: 12px; }
.stat-row { display: flex; margin-top: 12px; padding: 18px 8px; }
.stat { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.stat + .stat { border-left: 1.5px solid var(--border); }
.stat-num { font-size: 20px; font-weight: 500; }
.stat-label { font-size: 10px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.recal-note { font-size: 12px; color: var(--faint); text-align: center; margin-top: 16px; padding: 0 24px; }

/* profile */
.profile-hero { display: flex; flex-direction: column; align-items: center; padding: 28px 20px; margin-top: 4px; }
.profile-kcal { font-size: 44px; font-weight: 300; letter-spacing: -1px; }
.profile-kcal-label { font-size: 12px; opacity: .75; margin-top: 2px; }
.profile-pills { display: flex; gap: 8px; margin-top: 16px; }
.pill-ghost {
  font-size: 12px; font-weight: 500;
  border: 1.5px solid rgba(252,252,247,.4); border-radius: var(--r-pill);
  padding: 6px 12px;
}
.settings { display: flex; flex-direction: column; margin-top: 16px; background: var(--paper); border: 1.5px solid var(--border); border-radius: var(--r-card); overflow: hidden; }
.setting {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px; font-size: 15px; font-weight: 500; text-align: left;
  transition: background .2s;
}
.setting:hover { background: var(--keylime); }
.setting + .setting { border-top: 1.5px solid var(--border); }
.setting svg { width: 16px; height: 16px; color: var(--faint); }
.setting-val { font-style: normal; font-weight: 400; color: var(--muted); margin-left: 8px; font-size: 13px; }
.version-note { text-align: center; font-size: 11px; color: var(--faint); margin-top: 20px; }

/* ---------- nav ---------- */
.nav {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-around;
  background: var(--cream);
  border-top: 1.5px solid var(--border);
  padding: 8px 8px calc(14px + env(safe-area-inset-bottom, 0px));
}
.nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 10px; font-weight: 500; color: var(--faint);
  padding: 6px 10px; border-radius: 14px;
  transition: color .2s, background .25s var(--ease-out);
  min-width: 56px;
}
.nav-item svg { width: 22px; height: 22px; }
.nav-item.active { color: var(--ink); background: var(--keylime); }
.nav-add {
  width: 54px; height: 54px; border-radius: var(--r-pill);
  background: var(--ink); color: var(--lime);
  display: flex; align-items: center; justify-content: center;
  margin-top: -22px;
  border: 4px solid var(--cream);
  transition: transform .2s var(--ease-spring), background .2s;
}
.nav-add svg { width: 22px; height: 22px; stroke-width: 2; }
.nav-add:hover { background: var(--ink-deep); }
.nav-add:active { transform: scale(.92) rotate(90deg); }

/* ---------- sheets ---------- */
.backdrop {
  position: absolute; inset: 0; z-index: 30;
  background: rgba(18, 41, 11, .32);
  opacity: 0; transition: opacity .25s;
}
.backdrop.show { opacity: 1; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 40;
  background: var(--cream);
  border-radius: 28px 28px 0 0;
  border-top: 1.5px solid var(--border);
  padding: 8px 20px 24px;
  max-height: 86%;
  display: flex; flex-direction: column;
  transform: translateY(105%);
}
.sheet-grip { width: 36px; height: 4px; border-radius: var(--r-pill); background: var(--mint); margin: 6px auto 14px; flex-shrink: 0; }
.detail-scroll { overflow-y: auto; flex: 1; }

/* calendar */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-title { font-size: 22px; }
.cal-dow { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; font-size: 10px; font-weight: 600; letter-spacing: .05em; color: var(--faint); margin-bottom: 6px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 14px; }
.cal-day {
  aspect-ratio: 1 / 1.15;
  border-radius: 12px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  font-size: 14px; font-weight: 500;
  border: 1.5px solid transparent;
  transition: border-color .15s, background .15s;
}
.cal-day:hover { background: var(--keylime); }
.cal-day.blank { visibility: hidden; }
.cal-day.under { background: var(--keylime); }
.cal-day.over { background: var(--apricot); }
.cal-day.future { color: var(--faint); }
.cal-day.selected { border-color: var(--ink); }
.cal-day.today .cal-num { text-decoration: underline; text-underline-offset: 3px; }
.cal-kcal { font-family: var(--mono); font-size: 8.5px; color: var(--muted); }
.cal-legend { display: flex; gap: 14px; justify-content: center; font-size: 11px; color: var(--muted); margin-bottom: 16px; }
.cal-legend span { display: flex; align-items: center; gap: 5px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-under { background: var(--keylime); border: 1px solid var(--sage); }
.dot-over { background: var(--apricot); border: 1px solid var(--sandstone); }
.dot-none { background: var(--paper); border: 1px solid var(--border); }

/* food detail sheet */
.detail-hero { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; }
.detail-img { width: 84px; height: 84px; border-radius: var(--r-card); background: var(--apricot); overflow: hidden; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-family: var(--serif); font-size: 34px; }
.detail-img img { width: 100%; height: 100%; object-fit: cover; }
.detail-name { font-family: var(--serif); font-weight: 400; font-size: 26px; line-height: 1.1; }
.detail-kcal { font-size: 14px; color: var(--muted); margin-top: 4px; }
.detail-section { margin-top: 16px; }
.detail-label { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 8px; }
.ing-list { display: flex; flex-direction: column; }
.ing-row { display: flex; justify-content: space-between; align-items: baseline; padding: 8px 0; border-bottom: 1.5px solid var(--stone); font-size: 14px; }
.ing-row:last-child { border-bottom: none; }
.ing-row .mono { font-size: 12px; color: var(--muted); }
.macro-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.macro-cell { background: var(--keylime); border-radius: 12px; padding: 10px 6px; text-align: center; }
.macro-cell .mono { display: block; font-size: 16px; font-weight: 500; }
.macro-cell span:last-child { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.detail-actions { display: flex; gap: 10px; margin-top: 20px; }
.detail-actions .btn { flex: 1; padding: 14px; font-size: 14px; }
.detail-qty { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 16px; background: var(--stone); border-radius: var(--r-pill); padding: 6px; }
.detail-qty .qty-btn { width: 40px; height: 40px; background: var(--paper); }
.detail-qty .qty-x { font-size: 16px; min-width: 44px; }

/* add sheet */
.sheet-tall { height: 86%; }
.add-title { font-family: var(--serif); font-weight: 300; font-size: 28px; margin-bottom: 14px; }
.camera-btn {
  width: 100%; display: flex; align-items: center; gap: 14px;
  background: var(--ink); color: var(--cream);
  border-radius: var(--r-panel); padding: 18px;
  transition: transform .15s var(--ease-spring);
  text-align: left;
}
.camera-btn:active { transform: scale(.98); }
.camera-btn svg { width: 26px; height: 26px; color: var(--lime); flex-shrink: 0; }
.camera-btn-title { font-weight: 500; display: block; }
.camera-btn-sub { font-size: 12px; opacity: .7; display: block; }
.add-search { margin-top: 12px; }
.add-group-label { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 18px 0 8px; }
.recent-row { display: flex; gap: 8px; flex-wrap: wrap; }
.food-chip {
  display: flex; align-items: center; gap: 8px;
  border: 1.5px solid var(--border); background: var(--paper);
  border-radius: var(--r-pill); padding: 6px 12px 6px 6px;
  font-size: 13px; font-weight: 500;
  transition: border-color .2s, transform .15s var(--ease-spring);
}
.food-chip:hover { border-color: var(--sage); }
.food-chip:active { transform: scale(.95); }
.food-chip-img { width: 28px; height: 28px; border-radius: 50%; background: var(--apricot); overflow: hidden; display: flex; align-items: center; justify-content: center; font-family: var(--serif); font-size: 13px; }
.food-chip-img img { width: 100%; height: 100%; object-fit: cover; }
.food-chip .mono { font-size: 11px; color: var(--muted); }
.create-btn { margin-top: 20px; width: 100%; }

/* create form */
.form-field { margin-top: 14px; }
.form-field label { display: block; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 8px; }
.text-input, .text-area {
  width: 100%; border: 1.5px solid var(--border); border-radius: var(--r-input);
  background: var(--paper); padding: 14px; font-size: 15px; outline: none;
  font-family: var(--sans); color: var(--ink); resize: none;
}
.text-input:focus, .text-area:focus { border-color: var(--ink); }
.text-input::placeholder, .text-area::placeholder { color: var(--faint); }
.photo-pick { display: flex; gap: 8px; }
.photo-opt { width: 64px; height: 64px; border-radius: var(--r-card); overflow: hidden; border: 2px solid transparent; background: var(--stone); flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: var(--faint); transition: border-color .2s; }
.photo-opt img { width: 100%; height: 100%; object-fit: cover; }
.photo-opt.active { border-color: var(--ink); }
.photo-opt svg { width: 22px; height: 22px; }

/* AI receipt */
.receipt { margin-top: 18px; }
.receipt-row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 10px 0; border-bottom: 1.5px dashed var(--mint);
  font-size: 14px; opacity: 0;
}
.receipt-row .mono { font-size: 13px; }
.receipt-total { display: flex; justify-content: space-between; align-items: baseline; padding: 14px 0 4px; font-weight: 500; opacity: 0; }
.receipt-total .mono { font-size: 24px; }
.thinking { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; padding: 16px 0; }
.thinking-dots { display: flex; gap: 4px; }
.thinking-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--sage); }

/* camera simulation */
.cam-stage { border-radius: var(--r-panel); background: var(--ink); color: var(--cream); padding: 20px; text-align: center; margin-top: 4px; }
.cam-frame { border: 1.5px dashed rgba(252,252,247,.4); border-radius: var(--r-card); padding: 20px; }
.cam-frame img { width: 120px; height: 120px; border-radius: var(--r-card); object-fit: cover; }
.cam-status { font-size: 13px; opacity: .8; margin-top: 12px; }
.match-card { margin-top: 14px; }

/* toast */
.toast {
  position: absolute; left: 50%; bottom: 104px; z-index: 60;
  transform: translateX(-50%);
  background: var(--ink); color: var(--cream);
  font-size: 13px; font-weight: 500;
  border-radius: var(--r-pill); padding: 10px 18px;
  white-space: nowrap;
  opacity: 0;
}
.toast .mono { color: var(--lime); }

/* reveals */
.reveal { opacity: 0; }

/* focus visibility */
button:focus-visible, input:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* ---------- capture mode (?s=…) ----------
   Pins the phone to the top-left at an exact 2× size so headless
   screenshots for the case study are pixel-deterministic. */
body[data-capture] { background: var(--cream); }
body[data-capture] .stage { padding: 0; display: block; min-height: 0; }
body[data-capture] .phone {
  zoom: 2;
  width: 390px; height: 844px; max-height: none;
  border-radius: 0; border: none; margin: 0;
}

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