/* TrackR — matches the LeanR client app design system */
:root {
  --bg: #E9DFD1;            /* page beige (same as LeanR app body) */
  --bg-2: #FFFDF8;          /* warm white cards (LeanR app cards) */
  --bg-3: #FBF5EE;          /* soft cream insets / inputs */
  --forest: #2D4F3E;        /* LeanR forest (chrome, wordmark) */
  --forest-dk: #1E3A2C;
  --forest-lt: #3F6B54;
  --ink: #0F0F0F;           /* primary text */
  --ink-2: #3A3A3A;         /* secondary text */
  --ink-3: #6B6B6B;         /* muted text */
  --line: rgba(15,15,15,0.08);
  --line-2: rgba(15,15,15,0.12);
  --orange: #E85D1F;        /* primary accent / CTAs */
  --orange-dk: #C94D15;     /* hover state */
  --orange-soft: rgba(232,93,31,0.10);
  --orange-ring: rgba(232,93,31,0.30);
  --green: #3F6B54;         /* secondary accent (verified, success) */
  --green-dk: #2D4F3E;
  --green-soft: rgba(63,107,84,0.12);
  --green-ring: rgba(63,107,84,0.30);
  /* Macro indicator colors — brighter, clearly distinct, still on-brand */
  --p: #4C8A66;             /* protein → bright forest green */
  --c: #E85D1F;             /* carbs → LeanR burnt orange (CTA accent) */
  --f: #DDA62B;             /* fat → editorial gold */
  --p-soft: rgba(76,138,102,0.14);
  --c-soft: rgba(232,93,31,0.12);
  --f-soft: rgba(221,166,43,0.16);
  --err: #B33020;
  --err-bg: rgba(179,48,32,0.08);
  --ok-bg: rgba(63,107,84,0.10);
  --radius: 12px;
  --radius-lg: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink);
  font-family: "Fraunces", Georgia, serif;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  min-height: 100vh; min-height: 100dvh; padding-bottom: env(safe-area-inset-bottom);
  letter-spacing: -0.005em;
}
a { color: var(--ink); text-decoration: none; }
a:hover { color: var(--orange); }
button { font-family: inherit; cursor: pointer; }

/* Sans for UI chrome / numbers — same stack the LeanR website uses for nav */
.brand, .topnav, .navlink, .btn-primary, .btn-ghost, .meal-add, .badge,
.label, .field input, .field select, .field textarea, .search-input,
.entry-meta, .totals-num, .totals-lbl, .mb-lbl, .mb-num, .meal-sub,
.rr-name, .rr-sub, .prev-kcal, .prev-macros, .preview, .alert,
.history-meta, .empty, .entry-name, .entry-brand, .dn-date, .dn-sub,
.section-h, .totals-target, .auth-h, .auth-foot, .auth-brand, .log-meal, .log-date {
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  letter-spacing: -0.005em;
}

/* Top bar */
.topbar { background: rgba(250,250,247,0.94); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50;
  padding-top: env(safe-area-inset-top); }
.topbar-inner { max-width: 760px; margin: 0 auto; padding: 12px 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { font-weight: 700; letter-spacing: -0.02em; font-size: 18px; color: var(--ink); }
.brand-accent { color: var(--orange); font-style: italic; font-weight: 600; }
.topnav { display: flex; gap: 18px; align-items: center; }
.navlink { font-size: 14px; color: var(--ink-3); font-weight: 500; }
.navlink:hover { color: var(--ink); }
.navlink.subtle { color: var(--ink-3); }

/* Main */
.main { max-width: 760px; margin: 0 auto; }
.page-pad { padding: 16px 18px 28px; }
.section-h { font-family: "Fraunces", Georgia, serif;
  font-size: 22px; font-weight: 600; margin: 22px 0 10px; letter-spacing: -0.02em; color: var(--ink); }

/* Auth */
.auth-body { background: var(--bg); min-height: 100vh; }
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 28px 22px; }
.auth-card { width: 100%; max-width: 380px; background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 30px 26px; }
.auth-brand { font-size: 17px; font-weight: 600; margin-bottom: 18px; color: var(--ink); }
.auth-h { font-family: "Fraunces", Georgia, serif; font-size: 26px; font-weight: 600;
  margin: 0 0 16px; letter-spacing: -0.02em; }
.auth-foot { margin: 16px 0 0; font-size: 14px; color: var(--ink-3); text-align: center; }
.auth-foot a { color: var(--orange); font-weight: 600; }

/* Forms */
.field { display: block; margin: 12px 0; }
.field .label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink-3); margin-bottom: 6px; font-weight: 600; }
.field input, .field select, .field textarea {
  width: 100%; padding: 12px 14px; background: var(--bg-3); color: var(--ink);
  border: 1px solid var(--line-2); border-radius: 10px; font-size: 16px;
  outline: none; -webkit-appearance: none; appearance: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.field input:focus, .field select:focus { border-color: var(--orange); box-shadow: 0 0 0 3px var(--orange-ring); }
.field .hint { display: block; font-size: 12px; color: var(--ink-3); margin-top: 5px; }
.btn-primary { display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--orange); color: #fff; border: 0; padding: 13px 18px; border-radius: 10px;
  font-weight: 600; font-size: 15px; width: 100%; margin-top: 10px;
  transition: background 120ms ease; }
.btn-primary:hover { background: var(--orange-dk); }
.btn-ghost { background: transparent; color: var(--ink-2); border: 1px solid var(--line-2);
  padding: 11px 14px; border-radius: 10px; font-size: 14px; width: 100%; margin-top: 16px;
  font-weight: 500; transition: background 120ms ease; }
.btn-ghost:hover { background: var(--bg-2); color: var(--ink); }
.alert { padding: 10px 14px; border-radius: 10px; font-size: 13px; margin: 8px 0;
  border: 1px solid transparent; }
.alert.err { background: var(--err-bg); color: var(--err); border-color: rgba(179,48,32,0.20); }
.alert.ok { background: var(--ok-bg); color: var(--green-dk); border-color: var(--green-ring); }
.alert.warn { background: rgba(232,93,31,0.08); color: var(--orange-dk, #C94D15); border-color: rgba(232,93,31,0.25); }

/* Coach-locked pill (TrackR for LeanR members) */
.coach-pill { display: flex; align-items: center; gap: 10px; padding: 12px 14px; margin: 6px 0 14px;
  background: var(--ok-bg, rgba(63,107,84,0.08)); color: var(--green-dk, #2D4F3E);
  border: 1px solid var(--green-ring, rgba(63,107,84,0.25)); border-radius: 12px; font-size: 13px; }
.coach-pill-ico { color: var(--green-dk, #3F6B54); font-size: 16px; line-height: 1; }
.coach-pill-text strong { font-weight: 600; }
.form-locked input[readonly] { background: rgba(15,15,15,0.03); color: var(--ink-2); cursor: not-allowed; }
.form-locked { opacity: 0.96; }

/* Date nav */
.date-nav { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 10px; padding: 6px 0 16px; }
.dn-btn { display: grid; place-items: center; height: 38px; border-radius: 10px; background: var(--bg-2);
  border: 1px solid var(--line); color: var(--ink); font-size: 20px; line-height: 1; }
.dn-btn:hover { background: var(--bg-3); }
.dn-center { text-align: center; }
.dn-date { font-size: 17px; font-weight: 600; letter-spacing: -0.015em; }
.dn-sub { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.dn-sub a { color: var(--orange); font-weight: 500; }

/* Totals card */
.totals-card { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 18px 18px 16px; margin-bottom: 14px;
  box-shadow: 0 1px 2px rgba(15,15,15,0.03); }
.totals-row { display: grid; grid-template-columns: minmax(120px, 160px) 1fr; gap: 18px; align-items: center; }
.totals-big { text-align: center; }
.totals-num { font-family: "Fraunces", Georgia, serif; font-size: 44px; font-weight: 600;
  letter-spacing: -0.03em; line-height: 1; color: var(--ink); }
.totals-lbl { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-3); margin-top: 5px; font-weight: 600; }
.totals-target { font-size: 12px; color: var(--ink-3); margin-top: 3px; }
.macro-bars { display: flex; flex-direction: column; gap: 9px; }
.macro-bar { background: var(--bg-3); border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; }
.mb-head { display: flex; justify-content: space-between; align-items: center; }
.mb-lbl { font-size: 12px; color: var(--ink-3); font-weight: 500; }
.mb-num { font-size: 12px; color: var(--ink); font-variant-numeric: tabular-nums; font-weight: 600; }
.mb-track { height: 5px; background: rgba(15,15,15,0.06); border-radius: 999px; margin-top: 7px; overflow: hidden; }
.mb-fill { height: 100%; border-radius: 999px; transition: width 220ms ease; }
.mb-p .mb-fill { background: var(--p); }
.mb-c .mb-fill { background: var(--c); }
.mb-f .mb-fill { background: var(--f); }

/* Meal cards */
.meal-card { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-lg);
  margin-bottom: 12px; overflow: hidden;
  box-shadow: 0 1px 2px rgba(15,15,15,0.03); }
.meal-head { display: flex; align-items: center; justify-content: space-between;
  padding: 13px 16px; border-bottom: 1px solid var(--line); }
.meal-name { font-family: "Fraunces", Georgia, serif; font-weight: 600; font-size: 17px; letter-spacing: -0.015em; }
.meal-sub { font-size: 12px; color: var(--ink-3); margin-top: 3px; font-variant-numeric: tabular-nums; }
.meal-add { background: var(--orange); color: #fff; padding: 7px 14px; border-radius: 8px;
  font-size: 13px; font-weight: 600; border: 0; }
.meal-add:hover { background: var(--orange-dk); color: #fff; }

.entry-list { list-style: none; padding: 0; margin: 0; background: var(--bg-3); }
.entry-row { display: flex; align-items: center; gap: 8px; padding: 11px 16px;
  border-bottom: 1px solid var(--line); }
.entry-row:last-child { border-bottom: 0; }
.entry-main { flex: 1; min-width: 0; }
.entry-name { font-size: 14px; line-height: 1.35; color: var(--ink); }
.entry-brand { color: var(--ink-3); font-size: 12px; margin-left: 6px; }
.entry-meta { font-size: 12px; color: var(--ink-3); margin-top: 3px; font-variant-numeric: tabular-nums; }
.entry-del { background: transparent; color: var(--ink-3); border: 0; font-size: 22px;
  line-height: 1; padding: 2px 8px; border-radius: 6px; }
.entry-del:hover { color: var(--err); background: var(--err-bg); }
.entry-empty { padding: 14px 16px; font-size: 13px; color: var(--ink-3); text-align: center; background: var(--bg-3); font-style: italic; }

.copy-form { margin-top: 10px; }

/* Log / search page */
.log-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 6px 0 12px; }
.log-meal { font-weight: 600; font-size: 16px; }
.log-date { text-align: right; font-size: 13px; color: var(--ink-3); }
.back-link { font-size: 14px; color: var(--ink-3); }

.search-wrap { position: sticky; top: 60px; background: var(--bg); padding: 6px 0 10px; z-index: 5; }
.search-input { width: 100%; padding: 14px 16px; font-size: 16px; background: var(--bg-2); color: var(--ink);
  border: 1px solid var(--line-2); border-radius: 12px; outline: none; -webkit-appearance: none; }
.search-input:focus { border-color: var(--orange); box-shadow: 0 0 0 3px var(--orange-ring); }
.search-input::placeholder { color: var(--ink-3); }

.search-results { display: flex; flex-direction: column; gap: 8px; padding-top: 8px; }
.result-row { background: var(--bg-2); border: 1px solid var(--line); padding: 12px 14px; border-radius: 12px;
  display: flex; align-items: center; gap: 10px; cursor: pointer; text-align: left; color: var(--ink); width: 100%;
  transition: background 120ms ease, border-color 120ms ease; }
.result-row:hover { background: var(--bg-3); border-color: var(--line-2); }
.rr-main { flex: 1; min-width: 0; }
.rr-name { font-size: 15px; line-height: 1.3; display: flex; align-items: center; gap: 8px; color: var(--ink); }
.rr-sub { font-size: 12px; color: var(--ink-3); margin-top: 3px; font-variant-numeric: tabular-nums; }
.rr-arrow { color: var(--ink-3); font-size: 18px; }
.empty { padding: 32px 14px; text-align: center; color: var(--ink-3); font-size: 14px; font-style: italic; }

.badge { font-size: 10px; padding: 2px 7px; border-radius: 999px; border: 1px solid transparent;
  vertical-align: 1px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.badge.verified { background: var(--green-soft); color: var(--green-dk); border-color: var(--green-ring); }
.badge.recent { background: var(--orange-soft); color: var(--orange-dk); border-color: var(--orange-ring); }
.badge.fav { background: rgba(201,77,21,0.10); color: var(--orange-dk); border-color: rgba(201,77,21,0.30); }

/* Slide-up sheet */
.sheet { position: fixed; inset: 0; background: rgba(15,15,15,0.45); display: grid; align-items: end; z-index: 100; }
.sheet.hidden { display: none; }
.sheet-inner { background: var(--bg-2); border-top-left-radius: 18px; border-top-right-radius: 18px;
  padding: 22px 22px calc(22px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line);
  max-width: 760px; margin: 0 auto; width: 100%; box-shadow: 0 -8px 32px rgba(15,15,15,0.15); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.sheet-title { font-family: "Fraunces", Georgia, serif; font-size: 18px; font-weight: 600; flex: 1; min-width: 0; line-height: 1.3; letter-spacing: -0.015em; }
.sheet-close { background: transparent; border: 0; color: var(--ink-3); font-size: 24px; line-height: 1; padding: 0 6px; }
.preview { display: flex; align-items: center; gap: 16px; padding: 14px 16px; background: var(--bg-2);
  border: 1px solid var(--line); border-radius: 12px; margin: 12px 0 16px; }
.prev-kcal { display: flex; align-items: baseline; gap: 5px; font-variant-numeric: tabular-nums; }
.prev-kcal #prevKcal { font-family: "Fraunces", Georgia, serif; font-size: 30px; font-weight: 600; letter-spacing: -0.02em; }
.prev-lbl { font-size: 11px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; }
.prev-macros { display: flex; gap: 14px; font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.prev-macros b { color: var(--ink); font-weight: 600; }

/* Targets */
.card { background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: 16px;
  box-shadow: 0 1px 2px rgba(15,15,15,0.03); }
.form-card { padding: 18px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 380px) { .grid-2 { grid-template-columns: 1fr; } }
.history-list { list-style: none; padding: 0; margin: 14px 0 0; }
.history-row { padding: 11px 0; border-bottom: 1px solid var(--line); }
.history-row:last-child { border-bottom: 0; }
.history-meta { font-size: 12px; color: var(--ink-3); margin-top: 3px; }
.history-meta em { color: var(--ink); font-style: normal; font-weight: 500; }


/* ============================================================
   v1 additions: bottom nav, toasts, charts, ingredient rows,
   weight pill, page-h-row, AI sheet, scanner.
   ============================================================ */

/* Spacing so bottom nav doesn't cover content */
.main { padding-bottom: calc(78px + env(safe-area-inset-bottom)); }

/* Top-right settings icon */
.topbar-icon { display: grid; place-items: center; width: 34px; height: 34px;
  border-radius: 8px; color: var(--ink-2); }
.topbar-icon:hover { background: var(--bg-2); color: var(--ink); }

/* Bottom nav */
.bottomnav { position: fixed; left: 0; right: 0; bottom: 0;
  background: rgba(250,250,247,0.96); backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  display: grid; grid-template-columns: repeat(5, 1fr);
  z-index: 60; max-width: 760px; margin: 0 auto;
}
.bn-item { display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--ink-3); font-size: 10.5px; padding: 4px 2px; text-decoration: none;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  letter-spacing: 0.01em; font-weight: 500;
}
.bn-item svg { stroke: currentColor; }
.bn-item.active { color: var(--orange); }
.bn-item:hover { color: var(--ink); }
.bn-item.active:hover { color: var(--orange-dk); }

/* Toast */
.toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom));
  transform: translate(-50%, 30px); background: var(--ink); color: var(--bg);
  padding: 10px 18px; border-radius: 999px; font-size: 14px; font-weight: 500;
  box-shadow: 0 8px 24px rgba(15,15,15,0.20);
  opacity: 0; transition: transform 220ms ease, opacity 220ms ease;
  z-index: 200; max-width: 80vw; text-align: center;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", sans-serif;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast.err { background: var(--err); color: #fff; }

/* Page header with right-side button */
.page-h-row { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 6px; }
.page-h-row .section-h { margin: 14px 0 0; }
.btn-primary.inline { display: inline-flex; width: auto; margin: 0; padding: 9px 14px; font-size: 13px; }
.btn-primary.inline.tiny { padding: 7px 12px; font-size: 12px; }
.btn-ghost.danger { color: var(--err); border-color: rgba(179,48,32,0.30); }
.btn-ghost.danger:hover { background: var(--err-bg); color: var(--err); }

/* Quick action row on log page */
.quickrow { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; padding: 10px 0 4px; }
.qr-btn { background: var(--bg-2); border: 1px solid var(--line); color: var(--ink);
  padding: 10px 6px; border-radius: 10px; font-size: 12.5px; font-weight: 500;
  display: flex; align-items: center; justify-content: center; gap: 4px;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", sans-serif; text-align: center; }
.qr-btn:hover { background: var(--bg-3); color: var(--ink); }

/* Weight pill on diary page */
.weight-pill { display: flex; align-items: center; justify-content: space-between;
  background: var(--bg-2); border: 1px solid var(--line); padding: 10px 14px;
  border-radius: 10px; font-size: 13px; margin: 0 0 12px; color: var(--ink-2);
  font-family: -apple-system, BlinkMacSystemFont, sans-serif; }
.weight-pill b { color: var(--ink); font-weight: 600; }
.weight-pill-empty { color: var(--ink-3); justify-content: center; font-style: italic; }
.weight-pill-empty:hover { color: var(--orange); border-color: var(--orange-ring); }
.weight-edit { color: var(--ink-3); font-size: 12px; }

/* Big empty state */
.big-empty { text-align: center; padding: 40px 16px; }
.big-empty p { color: var(--ink-3); margin: 6px 0; line-height: 1.5; max-width: 360px; margin-left: auto; margin-right: auto; }
.big-empty p:first-child { color: var(--ink); font-size: 17px; font-weight: 600; margin-bottom: 10px; }
.big-empty .btn-primary { display: inline-flex; width: auto; margin-top: 12px; padding: 11px 22px; }
.sub-help { color: var(--ink-3); font-size: 13px; line-height: 1.5; margin: 6px 0 12px;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", sans-serif; }

/* Flat entry-list (used by my-foods, recipes, history) */
.entry-list.flat { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-lg); }

/* Stat cards (weight page) */
.stat-card { padding: 18px; }
.stat-card.link { display: block; color: var(--ink); }
.stat-card.link:hover { background: var(--bg-3); }
.stat-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.stat-big { text-align: left; }
.stat-num { font-family: "Fraunces", Georgia, serif; font-size: 38px; font-weight: 600; letter-spacing: -0.03em; line-height: 1; }
.stat-lbl { font-size: 12px; color: var(--ink-3); margin-top: 5px; font-weight: 500; }
.stat-trend { text-align: right; }
.trend-num { font-family: "Fraunces", Georgia, serif; font-size: 22px; font-weight: 600; letter-spacing: -0.02em; }
.trend-lbl { font-size: 11px; color: var(--ink-3); margin-top: 2px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }

/* Charts */
.chart-card { padding: 14px; }
canvas { display: block; }

/* Weekly bars */
.weekbars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; height: 140px;
  align-items: end; padding: 8px 4px 0; }
.weekbar { display: flex; flex-direction: column; height: 100%; align-items: center; justify-content: end; }
.weekbar-track { height: 100%; width: 100%; max-width: 28px; background: rgba(15,15,15,0.04); border-radius: 6px 6px 2px 2px;
  position: relative; overflow: hidden; }
.weekbar-fill { position: absolute; bottom: 0; width: 100%; background: var(--orange);
  border-radius: 6px 6px 2px 2px; transition: height 240ms ease; }
.weekbar-lbl { font-size: 10px; color: var(--ink-3); margin-top: 6px;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif; font-variant-numeric: tabular-nums; }

/* Insights */
.insight-list { list-style: none; padding: 0; margin: 0; }
.insight-row { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0;
  font-size: 14px; color: var(--ink); line-height: 1.5;
  border-bottom: 1px solid var(--line); }
.insight-row:last-child { border-bottom: 0; }
.insight-dot { width: 8px; height: 8px; border-radius: 999px; background: var(--orange); margin-top: 7px; flex-shrink: 0; }

/* Ingredient list (recipes, routines) */
.ing-list { list-style: none; padding: 0; margin: 0 0 8px;
  background: var(--bg-3); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.ing-list:empty { display: none; }
.ing-row { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.ing-row:last-child { border-bottom: 0; }
.ing-main { flex: 1; min-width: 0; }
.ing-name { font-size: 14px; color: var(--ink); }
.ing-sub { font-size: 13px; color: var(--ink-3); margin-top: 4px; display: flex; align-items: center; gap: 6px;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif; }
.ing-qty { width: 60px; padding: 5px 8px; border: 1px solid var(--line-2); border-radius: 6px;
  background: var(--bg-3); font-size: 13px; -webkit-appearance: none; font-variant-numeric: tabular-nums; }
.ing-qty:focus { outline: none; border-color: var(--orange); }

.recipe-preview { background: var(--bg-3); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin: 14px 0; }
.rp-row { display: flex; justify-content: space-between; align-items: center; font-family: -apple-system, sans-serif; }
.rp-lbl { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-3); font-weight: 600; }
.rp-vals { display: flex; gap: 14px; font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.rp-vals b { color: var(--ink); font-weight: 600; }

/* AI photo results */
.ai-list { list-style: none; padding: 0; margin: 14px 0; background: var(--bg-3); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.ai-row { display: flex; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); align-items: flex-start; }
.ai-row:last-child { border-bottom: 0; }
.ai-main { flex: 1; min-width: 0; }
.ai-name { width: 100%; padding: 7px 10px; border: 1px solid var(--line-2); border-radius: 8px;
  background: var(--bg-3); font-size: 14px; font-weight: 600; margin-bottom: 6px; -webkit-appearance: none; }
.ai-name:focus { outline: none; border-color: var(--orange); }
.ai-meta { display: flex; gap: 10px; margin: 4px 0; flex-wrap: wrap;
  font-family: -apple-system, sans-serif; }
.ai-meta label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3);
  display: flex; align-items: center; gap: 6px; font-weight: 600; }
.ai-meta input { width: 70px; padding: 5px 8px; border: 1px solid var(--line-2); border-radius: 6px;
  background: var(--bg-3); font-size: 13px; -webkit-appearance: none; font-variant-numeric: tabular-nums; text-transform: none; }
.ai-meta input:focus { outline: none; border-color: var(--orange); }
.ai-notes { font-size: 12px; color: var(--ink-3); font-style: italic; margin-top: 6px; }

/* Scanner */
.scan-frame { position: absolute; inset: 18%; border: 2px solid #fff;
  border-radius: 10px; opacity: 0.7; pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(0,0,0,0.20) inset; }

/* Settings key-value rows */
.kv-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0;
  border-bottom: 1px solid var(--line); font-family: -apple-system, sans-serif; font-size: 14px; }
.kv-row:last-child { border-bottom: 0; }
.kv-k { color: var(--ink-3); }
.kv-v { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }


/* ============================================================
   v2 additions: streak pill, donut chart, quick widget grid,
   daily note, activity, measurements, progress photos, more page.
   ============================================================ */

/* Streak + date nav inline */
.streak-row { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 12px; padding: 4px 0 12px; }
.streak-pill { display: flex; align-items: center; gap: 6px; background: var(--orange-soft);
  border: 1px solid var(--orange-ring); color: var(--orange-dk); padding: 6px 12px; border-radius: 999px;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif; }
.streak-flame { font-size: 16px; line-height: 1; }
.streak-num { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.streak-unit { font-size: 12px; font-weight: 500; color: var(--orange-dk); }

.date-nav-inline { display: grid; grid-template-columns: 36px 1fr 36px; align-items: center; gap: 8px; }
.date-nav-inline .dn-btn { height: 34px; }
.date-nav-inline .dn-date { font-size: 15px; }
.date-nav-inline .dn-sub { font-size: 11px; }

/* Progress rings: big kcal ring left, three macro rings right */
.totals-grid { display: grid; grid-template-columns: 1.25fr 1fr; gap: 16px; align-items: center; }
@media (max-width: 420px) { .totals-grid { gap: 10px; } }
.ring-wrap { position: relative; }
.ring { width: 100%; height: auto; aspect-ratio: 1 / 1; }
.ring circle { transition: stroke-dashoffset 480ms ease; }
.ring .ring-track { stroke: rgba(15,15,15,0.07); }
.ring .ring-fill { stroke: var(--orange); stroke-linecap: round;
  transform: rotate(-90deg); transform-origin: center; }
.ring .ring-fill.over { stroke: var(--err); }
.ring-num { font-family: "Fraunces", Georgia, serif; font-size: 24px; font-weight: 700; fill: var(--ink); text-anchor: middle; letter-spacing: -0.02em; }
.ring-lbl { font-size: 9px; fill: var(--ink-3); text-anchor: middle; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; }
.ring-meta { display: flex; flex-direction: column; gap: 2px; font-size: 11.5px; margin-top: 8px;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-3); border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px; }
.ring-meta .dt-row { display: flex; justify-content: space-between; gap: 8px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.ring-meta .dt-row b { color: var(--ink); font-weight: 600; }
.ring-meta .dt-rem { border-top: 1px solid var(--line); padding-top: 3px; margin-top: 1px; }
.ring-meta .dt-rem b { color: var(--green-dk); }
.ring-meta .dt-rem.over b { color: var(--err); }
.ring-meta a { color: var(--orange); }

.macro-rings { display: flex; flex-direction: column; gap: 10px; }
.macro-ring { display: grid; grid-template-columns: 56px 1fr; gap: 10px; align-items: center; }
.macro-ring .mring { width: 56px; height: 56px; }
.macro-ring .mring .ring-fill { stroke-linecap: round; transform: rotate(-90deg); transform-origin: center; }
.mring-p .ring-fill { stroke: var(--p); }
.mring-c .ring-fill { stroke: var(--c); }
.mring-f .ring-fill { stroke: var(--f); }
.mring-num { font-family: "Fraunces", Georgia, serif; font-size: 13px; font-weight: 700; fill: var(--ink); text-anchor: middle; letter-spacing: -0.02em; }
.mring-info { font-family: -apple-system, BlinkMacSystemFont, sans-serif; min-width: 0; }
.mring-lbl { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.mring-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.mring-p-dot { background: var(--p); } .mring-c-dot { background: var(--c); } .mring-f-dot { background: var(--f); }
.mring-sub { font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; margin-top: 1px; }
.totals-card { padding-bottom: 16px; }

/* Quick widget grid */
.widget-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0; }
.widget { background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px;
  color: var(--ink); display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif; text-align: left; cursor: pointer; min-height: 78px; }
.widget:hover { background: var(--bg-3); }
.widget-lbl { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-3); font-weight: 600; }
.widget-num { font-family: "Fraunces", Georgia, serif; font-size: 22px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; }
.widget-num.widget-empty { color: var(--orange); font-weight: 400; }
.widget-unit { font-size: 13px; color: var(--ink-3); font-weight: 500; font-family: -apple-system, sans-serif; }
.widget-sub { font-size: 11px; color: var(--ink-3); }
.widget.water-w .widget-num { color: var(--ink); }

/* Daily note */
.daily-note-card { margin: 14px 0; padding: 14px 16px; }
.dn-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.dn-h { font-size: 13px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.06em; font-family: -apple-system, sans-serif; }
.dn-save { background: var(--orange); color: #fff; border: 0; padding: 4px 10px; border-radius: 6px; font-size: 12px; font-weight: 600; }
.daily-note-card textarea { width: 100%; min-height: 70px; resize: vertical; padding: 10px 12px;
  background: var(--bg-3); border: 1px solid var(--line); border-radius: 8px; font-size: 14px;
  font-family: "Fraunces", Georgia, serif; color: var(--ink); -webkit-appearance: none; outline: none; line-height: 1.45; }
.daily-note-card textarea:focus { border-color: var(--orange); box-shadow: 0 0 0 3px var(--orange-ring); }

/* Measurements grid */
.meas-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.meas-stat { padding: 10px 0; border-bottom: 1px solid var(--line); }
.meas-stat:nth-last-child(-n+2) { border-bottom: 0; }
.meas-lbl { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); font-weight: 600; }
.meas-num { font-family: "Fraunces", Georgia, serif; font-size: 20px; font-weight: 600; letter-spacing: -0.02em; margin-top: 2px; }
.meas-num span { font-size: 12px; color: var(--ink-3); font-family: -apple-system, sans-serif; font-weight: 500; }
.meas-date { font-size: 11px; color: var(--ink-3); margin-top: 12px; text-align: right; font-family: -apple-system, sans-serif; }

/* Progress photos */
.ba-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0; }
.ba-cell img { width: 100%; height: auto; border-radius: 10px; border: 1px solid var(--line); display: block; }
.ba-cap { font-size: 12px; color: var(--ink-3); text-align: center; margin-top: 6px; font-family: -apple-system, sans-serif; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.photo-cell { position: relative; }
.photo-cell img { width: 100%; aspect-ratio: 3/4; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); display: block; }
.photo-cap { font-size: 11px; color: var(--ink-3); margin-top: 5px; font-family: -apple-system, sans-serif; }
.photo-del { position: absolute; top: 6px; right: 6px; background: rgba(15,15,15,0.6); color: #fff;
  border: 0; width: 28px; height: 28px; border-radius: 999px; font-size: 16px; line-height: 1; }
.photo-del:hover { background: var(--err); }

/* More page */
.more-list { background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; margin-top: 8px; }
.more-row { display: grid; grid-template-columns: 36px 1fr 16px; align-items: center; gap: 12px;
  padding: 14px 16px; color: var(--ink); border-bottom: 1px solid var(--line);
  font-family: -apple-system, BlinkMacSystemFont, sans-serif; }
.more-row:last-child { border-bottom: 0; }
.more-row:hover { background: var(--bg-3); }
.more-ico { font-size: 22px; }
.more-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.more-name { font-size: 15px; font-weight: 600; color: var(--ink); }
.more-sub { font-size: 12px; color: var(--ink-3); }
.more-arrow { font-size: 18px; color: var(--ink-3); }


/* ============================================================
   Entry tap-to-edit + drag-and-drop
   ============================================================ */
.entry-row { cursor: pointer; transition: background 100ms ease; user-select: none; -webkit-user-select: none; }
.entry-row:active { background: var(--bg-3); }
.entry-row:hover { background: var(--bg-3); }
.entry-row.dragging { opacity: 0.4; }
.entry-handle { color: var(--ink-3); font-size: 14px; line-height: 1; padding: 2px 6px 2px 0;
  letter-spacing: -2px; font-weight: 700; cursor: grab; align-self: center; }
.entry-handle:active { cursor: grabbing; }
.meal-card.drop-target { outline: 2px dashed var(--orange); outline-offset: -2px; background: var(--orange-soft); }
.meal-card.drop-target .meal-head { background: var(--orange-soft); }

/* Targets: live macro balance readout */
.macro-balance { margin: 4px 0 12px; padding: 10px 12px; background: var(--bg-3); border: 1px solid var(--line);
  border-radius: 10px; font-family: -apple-system, BlinkMacSystemFont, sans-serif; }
.mbal-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px;
  font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.mbal-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.mbal-row span:not(.mbal-dot) { margin-right: 6px; }
.mbal-sum { font-size: 12px; margin-top: 6px; font-weight: 600; }

/* ============================================================
   TrackR theme — aligned to the LeanR client app (Inter UI,
   Fraunces display, beige page w/ gradient, white cards,
   forest chrome, orange CTAs)
   ============================================================ */
body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  background:
    linear-gradient(90deg, rgba(45,79,62,0.08), transparent 28%, transparent 72%, rgba(232,93,31,0.08)),
    var(--bg);
}
.section-h, .auth-h, .meal-name, .dn-date,
.totals-num, .widget-num, .meas-num { font-family: "Fraunces", Georgia, serif; }
/* Ring numbers: Inter, heavy + tabular — Fraunces was hard to read at a glance */
.ring-num, .mring-num {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.03em;
}

/* Wordmark: forest like the LeanR app, orange R */
.brand { color: var(--forest-dk); font-weight: 900; font-size: 21px; letter-spacing: -0.01em; }
.brand-accent { color: var(--orange); font-style: italic; font-weight: 900; }
.topbar { background: rgba(250,250,247,0.88); backdrop-filter: blur(18px); }

/* Cards: white, bigger radius, soft LeanR shadow */
.card, .totals-card, .meal-card, .auth-card {
  border-radius: 18px;
  border-color: rgba(15,15,15,0.09);
  box-shadow: 0 10px 26px rgba(15,15,15,0.06);
}

/* Bottom nav: forest active pill (LeanR app style) */
.bn-item { font-weight: 700; border-radius: 12px; margin: 0 6px; }
.bn-item.active, .bn-item.active:hover {
  color: var(--forest-dk);
  background: rgba(45,79,62,0.10);
}

/* Labels/eyebrows lean forest like the app */
.widget-lbl, .field .label, .dn-h { color: var(--forest); }

/* Search result polish: section headers + macro colors in rows */
.rr-section { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--forest); padding: 14px 2px 6px;
  font-family: "Inter", -apple-system, sans-serif; }
.rr-sub b, .rr-sub span { font-weight: 600; font-variant-numeric: tabular-nums; }
.rr-p { color: var(--p); } .rr-c { color: var(--c); } .rr-f { color: #B8860B; }
.badge.verified { color: var(--green-dk); background: var(--green-soft); }

/* Week chart: goal line + over-goal bars */
.weekbar-track { position: relative; overflow: visible; }
.weekbar-goal { position: absolute; left: -2px; right: -2px; height: 0;
  border-top: 2px dashed rgba(45,79,62,0.55); z-index: 2; }
.weekbar-fill.over { background: var(--err); }
.weekbars-legend { margin-top: 10px; font-size: 11.5px; color: var(--ink-3); text-align: center;
  font-family: "Inter", -apple-system, sans-serif; }
.weekbars-legend .wl-over { color: var(--err); font-weight: 700; }

/* ============ Onboarding wizard ============ */
.ob { max-width: 460px; margin: 0 auto; padding-top: 28px; }
.ob-progress { height: 5px; background: rgba(15,15,15,0.07); border-radius: 999px; margin-bottom: 26px; overflow: hidden; }
.ob-bar { height: 100%; width: 16%; background: var(--orange); border-radius: 999px; transition: width 280ms ease; }
.ob-eyebrow { margin: 0 0 4px; font-size: 11px; font-weight: 800; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--forest); font-family: "Inter", sans-serif; }
.ob-h { font-family: "Fraunces", Georgia, serif; font-size: clamp(26px, 6.4vw, 32px);
  margin: 0 0 8px; letter-spacing: -0.01em; line-height: 1.12; }
.ob-sub { margin: 0 0 18px; color: var(--ink-3); font-size: 14.5px; line-height: 1.45;
  font-family: "Inter", sans-serif; }
.ob-options { display: grid; gap: 11px; }
.ob-options.ob-row2 { grid-template-columns: 1fr 1fr; }
.ob-opt { text-align: left; background: var(--bg-2); border: 1.5px solid var(--line-2);
  border-radius: 16px; padding: 16px 17px; display: grid; gap: 3px;
  font-family: "Inter", sans-serif; transition: border-color 120ms ease, background 120ms ease; }
.ob-opt:hover { border-color: var(--forest); }
.ob-opt.sel { border-color: var(--orange); background: #FFF6EF; }
.ob-opt.sm { text-align: center; }
.ob-opt-title { font-size: 16.5px; font-weight: 800; color: var(--ink); }
.ob-opt-sub { font-size: 12.5px; color: var(--ink-3); }
.ob-rec { background: var(--green-soft); border: 1px solid var(--green-ring); color: var(--forest-dk);
  border-radius: 14px; padding: 13px 15px; font-size: 14px; line-height: 1.5; margin-bottom: 14px;
  font-family: "Inter", sans-serif; }
.ob-goal-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-bottom: 12px; }
.ob-goal-tabs button { border: 1.5px solid var(--line-2); background: var(--bg-2); border-radius: 999px;
  padding: 9px 4px; font-size: 12.5px; font-weight: 700; color: var(--ink-2); font-family: "Inter", sans-serif; }
.ob-goal-tabs button.sel { border-color: var(--forest); background: rgba(45,79,62,0.10); color: var(--forest-dk); }
.ob-plan { padding: 20px; text-align: center; }
.ob-kcal { font-family: "Inter", sans-serif; }
.ob-kcal span { font-size: 44px; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.ob-kcal em { display: block; font-style: normal; font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--ink-3); font-weight: 700; margin-top: 2px; }
.ob-macros { display: flex; justify-content: center; gap: 18px; margin: 14px 0 10px;
  font-family: "Inter", sans-serif; font-size: 13.5px; color: var(--ink-2); }
.ob-macros div { display: flex; align-items: center; gap: 6px; }
.ob-macros b { font-variant-numeric: tabular-nums; }
.ob-plan-note { font-size: 12.5px; color: var(--ink-3); line-height: 1.5; font-family: "Inter", sans-serif; }
.ob-foot { text-align: center; font-size: 12.5px; color: var(--ink-3); font-family: "Inter", sans-serif; }

.ob-step.hidden, .ob .hidden { display: none; }


/* ============================================================
   Photo AI — capture → analyzing → results UX
   ============================================================ */
.photo-page .photo-state { display: flex; flex-direction: column; gap: 14px; }

/* Capture state */
.tip-card { background: var(--bg-2); border: 1px solid var(--line);
  border-left: 4px solid var(--green); border-radius: 12px; padding: 14px 16px;
  display: flex; gap: 14px; align-items: flex-start;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif; }
.tip-icon { font-size: 24px; line-height: 1; flex-shrink: 0; }
.tip-body { font-size: 14px; color: var(--ink-2); line-height: 1.4; }
.tip-body strong { color: var(--ink); display: block; margin-bottom: 4px; font-weight: 600; }
.photo-cta { font-size: 16px; padding: 16px; }
.photo-fallback { display: block; text-align: center; color: var(--ink-3);
  text-decoration: none; font-size: 14px; padding: 8px; margin-top: 6px;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif; }
.photo-fallback:hover { color: var(--orange); }

/* Analyzing state */
.photo-preview { width: 100%; }
.photo-preview img { width: 100%; aspect-ratio: 4/3; object-fit: cover;
  border-radius: 16px; border: 1px solid var(--line); display: block; }
.analyze-pulse { display: flex; gap: 8px; justify-content: center; padding: 8px; }
.analyze-pulse span { width: 10px; height: 10px; border-radius: 50%;
  background: var(--orange); animation: pulse 1.4s infinite ease-in-out; }
.analyze-pulse span:nth-child(2) { animation-delay: 0.2s; }
.analyze-pulse span:nth-child(3) { animation-delay: 0.4s; }
@keyframes pulse {
  0%, 60%, 100% { transform: scale(0.6); opacity: 0.4; }
  30% { transform: scale(1); opacity: 1; }
}
.analyze-step { text-align: center; font-size: 16px; font-weight: 600; color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, sans-serif; }
.analyze-sub { text-align: center; font-size: 12px; color: var(--ink-3);
  font-family: -apple-system, BlinkMacSystemFont, sans-serif; }

/* Results state */
.results-photo img { width: 100%; aspect-ratio: 4/3; object-fit: cover;
  border-radius: 16px; border: 1px solid var(--line); display: block; }
.photo-totals { margin-top: 8px; padding-bottom: 16px; }
.confidence-row { display: flex; justify-content: space-between; align-items: center;
  margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line);
  font-size: 12px; font-family: -apple-system, BlinkMacSystemFont, sans-serif; }
#confLabel { color: var(--green-dk); font-weight: 600; }
.conf-help { color: var(--ink-3); }

.photo-section-h { font-family: ui-serif, Georgia, serif; font-size: 18px;
  font-weight: 600; margin: 18px 0 8px; letter-spacing: -0.015em;
  display: flex; align-items: center; gap: 8px; }
.photo-section-count { background: var(--bg-3); color: var(--ink-3);
  font-family: -apple-system, BlinkMacSystemFont, sans-serif; font-size: 12px;
  padding: 2px 8px; border-radius: 999px; font-weight: 600; }

/* Items list */
.photo-items { list-style: none; padding: 0; margin: 0; display: flex;
  flex-direction: column; gap: 10px; }
.photo-item { background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 14px;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif; }
.photo-item-head { display: flex; align-items: center; gap: 8px; }
.photo-item-name { flex: 1; }
.photo-item-name input { width: 100%; padding: 6px 8px; border: 1px solid transparent;
  border-radius: 6px; background: transparent; color: var(--ink);
  font-size: 15px; font-weight: 600; -webkit-appearance: none; outline: none;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif; }
.photo-item-name input:focus { border-color: var(--orange); background: var(--bg); }
.photo-item-del { background: transparent; color: var(--ink-3); border: 0;
  font-size: 22px; line-height: 1; padding: 4px 10px; border-radius: 6px; }
.photo-item-del:hover { color: var(--err); background: var(--err-bg); }

.photo-item-swap { background: var(--bg); border: 1px solid var(--line);
  border-radius: 8px; padding: 7px 10px; margin: 6px 0;
  display: flex; align-items: center; gap: 6px; width: 100%; cursor: pointer;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif; font-size: 13px; color: var(--ink-2); }
.photo-item-swap:hover { background: var(--bg-3); }
.photo-item-swap .match-tick { color: var(--green-dk); font-weight: 700; flex-shrink: 0; }
.photo-item-swap .match-name { flex: 1; text-align: left; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); font-weight: 500; }
.photo-item-swap .match-name em { color: var(--ink-3); font-style: normal; font-weight: 400; }
.photo-item-swap .match-edit { font-size: 11px; color: var(--orange); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em; }
.photo-item-swap-empty .match-tick { color: var(--err); }
.photo-item-swap-empty { border-color: rgba(179,48,32,0.30); background: var(--err-bg); }

.photo-item-row { display: flex; align-items: center; justify-content: space-between;
  margin-top: 8px; gap: 8px; font-size: 13px; }
.photo-item-portion { background: var(--bg); border: 1px solid var(--line);
  color: var(--ink); font-size: 13px; padding: 6px 12px; border-radius: 999px;
  font-weight: 600; font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  font-variant-numeric: tabular-nums; }
.photo-item-portion:hover { border-color: var(--orange); color: var(--orange-dk); }
.photo-item-portion .muted { color: var(--ink-3); font-weight: 400; }
.photo-item-macros { color: var(--ink-3); font-variant-numeric: tabular-nums; font-size: 12px; text-align: right; }
.photo-item-macros b { color: var(--ink); font-weight: 600; }
.photo-item-note { font-size: 12px; color: var(--ink-3); font-style: italic;
  margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }
.photo-item-warn { font-size: 12px; color: var(--err); margin-top: 6px; font-weight: 600;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif; }

.photo-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 12px;
  position: sticky; bottom: calc(86px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 60%, transparent);
  padding-top: 16px; padding-bottom: 4px; z-index: 4; }

/* SVG icon buttons (replaced emojis) */
.ic { vertical-align: -3px; flex: none; }
.qr-btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.qr-btn .ic { color: var(--forest); }
.qr-btn .ic-sparkle { color: var(--orange); }
.qr-btn .ic-bolt { color: var(--f); }
.streak-flame .ic { color: var(--orange); display: block; }
.photo-cta { gap: 9px; }
.photo-cta .ic { color: #fff; }
.tip-icon .ic { color: var(--forest); }
.more-ico { display: grid; place-items: center; color: var(--forest); }

/* One-tap quick log button on search rows */
.result-row { cursor: pointer; }
.rr-quick { flex: none; width: 38px; height: 38px; margin-left: 8px; border-radius: 12px;
  border: 1.5px solid var(--orange-ring); background: var(--orange-soft); color: var(--orange);
  font-size: 22px; font-weight: 700; line-height: 1; display: grid; place-items: center;
  font-family: "Inter", sans-serif; transition: background 120ms ease; }
.rr-quick:hover { background: var(--orange); color: #fff; }
.rr-quick.done { background: var(--green-soft); border-color: var(--green-ring); color: var(--green-dk); }

/* Micros line in the serving sheet */
.prev-micros { width: 100%; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line);
  font-size: 12px; color: var(--ink-3); font-family: "Inter", sans-serif;
  font-variant-numeric: tabular-nums; text-align: center; }
.prev-micros:empty { display: none; }

/* Metabolism (adherence TDEE) card */
.metab-card { font-family: "Inter", -apple-system, sans-serif; }
.metab-grid { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: center; }
.metab-num { font-size: 38px; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; color: var(--forest-dk); }
.metab-lbl { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-3); font-weight: 700; margin-top: 2px; }
.metab-stats { display: grid; gap: 5px; }
.metab-row { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.metab-row b { color: var(--ink); font-weight: 600; }
.metab-note { margin-top: 12px; padding: 11px 13px; background: var(--green-soft); border: 1px solid var(--green-ring);
  border-radius: 12px; font-size: 13px; line-height: 1.5; color: var(--forest-dk); }
.metab-locked { font-size: 13.5px; color: var(--ink-2); line-height: 1.5; }
.metab-locked-h { font-weight: 700; font-size: 15px; color: var(--ink); margin-bottom: 6px; }
.metab-locked p { margin: 0 0 10px; }
.metab-progress { display: flex; gap: 8px; flex-wrap: wrap; }
.metab-progress span { background: var(--bg-3); border: 1px solid var(--line); border-radius: 999px;
  padding: 5px 11px; font-size: 12px; font-weight: 600; color: var(--ink-2); }

/* Onboarding: photo BF option + status + rec reasoning */
.ob-photo-opt { border-style: dashed; }
.ob-photo-opt .ob-opt-title { display: inline-flex; align-items: center; gap: 8px; color: var(--forest-dk); }
.ob-photo-opt .ic { color: var(--orange); }
.ob-photo-status { margin-top: 10px; padding: 11px 13px; background: var(--orange-soft);
  border: 1px solid var(--orange-ring); border-radius: 12px; font-size: 13px; color: var(--ink-2);
  font-family: "Inter", sans-serif; line-height: 1.45; }
.ob-rec-sub { margin-top: 7px; padding-top: 7px; border-top: 1px solid var(--green-ring);
  font-size: 12.5px; color: var(--forest); }

/* 4-goal tabs + recommended chip + bulk warning */
.ob-goal-tabs-4 { grid-template-columns: repeat(2, 1fr); }
.ob-goal-tabs-4 button { position: relative; padding: 12px 4px 11px; font-size: 13px; }
.rec-chip { position: absolute; top: -8px; left: 50%; transform: translateX(-50%);
  background: var(--orange); color: #fff; font-size: 9px; font-weight: 800;
  letter-spacing: 0.06em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px;
  white-space: nowrap; }
.rec-chip.hidden { display: none; }
.ob-plan-warn { margin-top: 10px; padding: 10px 13px; background: var(--orange-soft);
  border: 1px solid var(--orange-ring); border-radius: 12px; font-size: 12.5px;
  color: var(--orange-dk); line-height: 1.5; font-family: "Inter", sans-serif; }
.ob-plan-warn.hidden { display: none; }

/* Legal pages */
.legal-card { font-family: "Inter", sans-serif; font-size: 14px; line-height: 1.6; color: var(--ink-2); }
.legal-card h3 { font-family: "Fraunces", Georgia, serif; font-size: 17px; margin: 18px 0 6px; color: var(--ink); }
.legal-card p { margin: 0 0 10px; }
.legal-card a { color: var(--orange); font-weight: 600; }
