/* ---------- Tokens (Pinterest "Nutrition app" palette) ---------- */
:root {
  --green-50:  #f0faf3;
  --green-100: #d9f2df;      /* pastel mint highlight card */
  --green-200: #b6e5c2;
  --green-300: #7fd394;
  --green-400: #2dd170;
  --green-500: #00c896;      /* PRIMARY emerald */
  --green-600: #00a87b;
  --green-700: #07814f;
  --green-dark: #0d3324;     /* dark forest (bottom nav, dark text) */
  --green-darker: #08231a;

  /* aliases kept so older rules still work */
  --teal-50:  var(--green-50);
  --teal-100: var(--green-100);
  --teal-200: var(--green-200);
  --teal-300: var(--green-300);
  --teal-400: var(--green-500);
  --teal-500: var(--green-500);
  --teal-600: var(--green-600);
  --teal-700: var(--green-700);

  --gray-50:  #fafafa;
  --gray-100: #f4f5f6;
  --gray-200: #e6e8eb;
  --gray-300: #d3d7dc;
  --gray-500: #8c93a0;
  --gray-700: #4a525e;
  --gray-900: #1c2128;

  --orange:  #ff8a3d;
  --red:     #e84545;
  --carbs:   #4ec1f3;        /* cyan to match chart legend */
  --protein: #a888f0;        /* purple */
  --fat:     #ff6b81;        /* coral */
  --water:   #00c896;
  --burn:    #ff8a3d;

  --shadow-sm: 0 1px 2px rgba(13,51,36,.04), 0 1px 1px rgba(13,51,36,.02);
  --shadow-md: 0 8px 22px rgba(13,51,36,.08), 0 2px 4px rgba(13,51,36,.04);
  --shadow-fab: 0 8px 24px rgba(0,200,150,.4);

  --radius: 22px;
  --radius-sm: 14px;

  --ease-out: cubic-bezier(.22,.61,.36,1);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--gray-900);
  background: var(--gray-50);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  padding-bottom: 90px;
}

h1, h2, h3, h4 { margin: 0 0 .25rem; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.05rem; }
h4 { font-size: .95rem; margin-top: .6rem; }
p { margin: 0 0 .5rem; }
.muted { color: var(--gray-500); }
.small { font-size: .85rem; }
.hidden { display: none !important; }

button, input, select, textarea { font: inherit; }
textarea { font-family: inherit; }

/* ---------- Views ---------- */
.view {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 16px 0;
}

/* ---------- Auth ---------- */
.auth-bg {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, var(--teal-50), var(--gray-50) 60%);
  padding-bottom: 16px;
}
.auth-card {
  width: min(420px, 92vw);
  background: #fff;
  border-radius: var(--radius);
  padding: 28px 22px;
  box-shadow: var(--shadow-md);
}
.brand { font-size: 1.8rem; color: var(--teal-600); margin: 0 0 4px; }
.brand-sub { color: var(--gray-500); margin: 0 0 18px; }

.tabs {
  display: flex;
  background: var(--gray-100);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 16px;
}
.tabs.small { margin: 0 0 14px; flex-wrap: wrap; }
.tab-btn {
  flex: 1;
  min-width: 60px;
  padding: 9px 0;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--gray-500);
  cursor: pointer;
  font-weight: 600;
  transition: background .15s, color .15s;
  font-size: .9rem;
}
.tab-btn.active { background: #fff; color: var(--teal-600); box-shadow: var(--shadow-sm); }

/* ---------- Forms ---------- */
.auth-form, form#form-onboard, form#form-goals, form#form-manual-food,
form#form-activity, form#form-recipe, form#form-water-settings {
  display: flex; flex-direction: column; gap: 12px;
}
form label {
  display: flex; flex-direction: column; gap: 6px;
  color: var(--gray-700); font-size: .9rem; font-weight: 500;
}
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date],
select, textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  background: var(--gray-50);
  outline: none;
  transition: border-color .15s, background .15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--teal-400); background: #fff;
}
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

/* ---------- Buttons ---------- */
.btn-primary, .btn-danger, .btn-dark {
  padding: 12px 18px; border: none; border-radius: var(--radius-sm);
  font-weight: 600; cursor: pointer; transition: transform .05s, background .15s, opacity .15s;
}
.btn-primary { background: var(--teal-500); color: #fff; }
.btn-primary:hover { background: var(--teal-600); }
.btn-primary.small { padding: 9px 14px; font-size: .9rem; }
.btn-primary.wide, .btn-danger.wide { width: 100%; }
.btn-primary:active, .btn-danger:active, .btn-dark:active { transform: scale(.99); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }

.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #c43838; }

.btn-dark { background: var(--gray-900); color: #fff; padding: 8px 16px; font-size: .85rem; border-radius: 999px; }
.btn-dark:hover { background: #000; }

.btn-ghost {
  background: transparent; border: none; color: var(--gray-500);
  cursor: pointer; font-size: 1.1rem; padding: 6px 10px; border-radius: 8px;
}
.btn-ghost:hover { background: var(--gray-100); color: var(--gray-900); }

.link-btn {
  background: transparent; border: none; color: var(--teal-600);
  cursor: pointer; font-size: .9rem; font-weight: 600; padding: 4px 6px;
}
.link-btn.small { font-size: .8rem; }
.link-btn:hover { color: var(--teal-700); text-decoration: underline; }

.form-error { color: #c0392b; font-size: .85rem; min-height: 1.2em; }

/* ---------- Top bar ---------- */
.top-bar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.top-bar h2 { margin: 0; }
.top-left { display: flex; gap: 8px; align-items: center; }

.streak-pill, .diamond-pill {
  display: inline-flex; align-items: center; gap: 4px;
  background: #fff; border: 1px solid var(--gray-200);
  border-radius: 999px; padding: 5px 10px;
  font-weight: 700; font-size: .85rem; color: var(--gray-900);
  box-shadow: var(--shadow-sm);
}
.streak-icon { font-size: 1rem; }
.diamond { font-size: 1rem; }

/* ---------- Greeting ---------- */
.greeting-block { margin: 14px 0 12px; }
.greeting-h {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--green-dark);
  letter-spacing: -.02em;
  margin: 0;
}
.greeting-h .accent { color: var(--green-500); }

/* ---------- Date strip ---------- */
.date-strip {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 14px;
}
.date-day {
  background: #fff;
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 8px 0;
  text-align: center;
  cursor: pointer;
  transition: background .2s var(--ease-out), color .2s var(--ease-out), transform .08s;
  box-shadow: var(--shadow-sm);
}
.date-day:active { transform: scale(.97); }
.date-day .dd-label { font-size: .7rem; color: var(--gray-500); font-weight: 600; text-transform: uppercase; }
.date-day .dd-num   { font-size: 1.1rem; font-weight: 700; color: var(--gray-900); margin-top: 2px; }
.date-day.active {
  background: var(--green-dark);
  border-color: var(--green-dark);
}
.date-day.active .dd-label,
.date-day.active .dd-num { color: var(--green-500); }
.date-day.today:not(.active) .dd-num { color: var(--green-600); }

/* ---------- Hero mint card (semi-circle gauge) ---------- */
.hero-card {
  background: var(--green-100);
  border-radius: 28px;
  padding: 20px 18px 18px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}
.gauge-wrap {
  position: relative;
  display: grid; place-items: center;
  margin-bottom: 6px;
}
.gauge { display: block; }
.gauge-bg, .gauge-fg {
  fill: none;
  stroke-width: 14;
  stroke-linecap: round;
}
.gauge-bg { stroke: #ffffff; }
.gauge-fg {
  stroke: var(--green-500);
  stroke-dasharray: 251.3;     /* semi-circle perimeter ≈ π × 80 */
  stroke-dashoffset: 251.3;
  transition: stroke-dashoffset .8s var(--ease-out), stroke .3s;
  filter: drop-shadow(0 2px 6px rgba(0,200,150,.3));
}
.gauge-inner {
  position: absolute;
  inset: 30% 0 0 0;
  text-align: center;
}
.gauge-label { font-size: .85rem; color: var(--green-700); font-weight: 600; letter-spacing: .02em; }
.gauge-val {
  font-size: 2.6rem; font-weight: 800; color: var(--green-dark);
  font-variant-numeric: tabular-nums; line-height: 1;
  margin: 2px 0;
}
.gauge-sub { font-size: .78rem; color: var(--gray-500); font-weight: 500; }

.hero-bottom-row {
  display: flex; align-items: center; justify-content: space-around;
  gap: 8px; padding: 4px 4px 14px;
  margin-top: -8px;
}
.hero-stat { text-align: center; flex: 1; }
.hero-stat-num {
  font-size: 1.4rem; font-weight: 800; color: var(--green-dark);
  font-variant-numeric: tabular-nums;
  display: inline-flex; align-items: baseline; gap: 3px;
}
.hero-stat-suffix { font-size: .7rem; color: var(--gray-500); font-weight: 600; }
.hero-stat-num.burned { color: var(--orange); }
.hero-stat-label { font-size: .75rem; color: var(--gray-500); margin-top: 2px; letter-spacing: .03em; }
.hero-divider { width: 1px; height: 32px; background: rgba(13,51,36,.12); }

/* Macro legend dots */
.dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  margin-right: 6px; vertical-align: middle;
}
.dot.c { background: var(--carbs); }
.dot.p { background: var(--protein); }
.dot.f { background: var(--fat); }

.macros-row { display: flex; flex-direction: column; gap: 10px; }
.macro-head { font-size: .82rem; }

/* ---------- Section header ---------- */
.section-h {
  display: flex; justify-content: space-between; align-items: center;
  margin: 16px 4px 8px;
}
.section-h h3 {
  font-size: 1.1rem; font-weight: 800; color: var(--green-dark);
  margin: 0;
}

/* ---------- Meal list (cards) ---------- */
.meal-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 4px; }
.meal-card-v2 {
  background: #fff;
  border-radius: 18px;
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
  transition: transform .1s var(--ease-out);
}
.meal-card-v2:active { transform: scale(.99); }
.meal-card-head {
  display: flex; align-items: center; gap: 12px;
}
.meal-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--green-100);
  display: grid; place-items: center;
  font-size: 1.4rem; flex-shrink: 0;
}
.meal-card-info { flex: 1; min-width: 0; }
.meal-card-name { font-weight: 700; color: var(--green-dark); }
.meal-card-meta { color: var(--gray-500); font-size: .8rem; margin-top: 2px; }
.meal-card-meta b { color: var(--green-dark); font-weight: 700; }
.meal-add-fab {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--green-500); color: #fff;
  border: none; cursor: pointer; font-size: 1.2rem; font-weight: 300;
  display: grid; place-items: center;
  box-shadow: var(--shadow-fab);
  transition: transform .08s;
}
.meal-add-fab:active { transform: scale(.92); }
.meal-card-items { margin-top: 8px; padding-left: 56px; display: flex; flex-direction: column; gap: 4px; }
.meal-card-items .meal-item {
  display: flex; justify-content: space-between; align-items: center;
  font-size: .85rem; padding: 4px 0;
  border-top: 1px dashed var(--gray-200);
}
.meal-card-items .meal-item:first-child { border-top: none; }
.meal-card-items .meal-item .name { flex: 1; color: var(--gray-700); padding-right: 6px; }
.meal-card-items .meal-item .kcal-small { color: var(--gray-500); font-variant-numeric: tabular-nums; margin-right: 6px; }
.meal-card-items .meal-item .del {
  background: transparent; border: none; color: var(--gray-300);
  cursor: pointer; padding: 0 4px;
}
.meal-card-items .meal-item .del:hover { color: var(--red); }

/* ---------- Water v2 ---------- */
.water-card-v2 {
  background: var(--green-100);
  border-radius: 22px;
  padding: 16px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 4px;
}
.water-head-v2 {
  display: flex; justify-content: space-between; align-items: flex-end;
  margin-bottom: 10px;
}
.water-head-v2 .water-amount {
  font-size: 1.4rem; font-weight: 800; color: var(--green-dark);
  font-variant-numeric: tabular-nums;
}
.water-head-v2 .water-sub { font-size: .75rem; color: var(--gray-500); margin-top: 2px; }
.water-pct {
  background: var(--green-500); color: #fff;
  padding: 6px 14px; border-radius: 999px;
  font-weight: 700; font-size: .85rem;
}
.glasses-v2 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
  gap: 6px;
  background: var(--green-500);
  padding: 12px 10px;
  border-radius: 16px;
  margin-bottom: 8px;
}
.glasses-v2 .glass { padding: 0; }
.glasses-v2 .glass svg { width: 36px; height: 44px; }
.water-from-food {
  font-size: .78rem; color: var(--green-700);
  text-align: center; font-weight: 500;
}

/* ---------- Activity v2 ---------- */
.activity-card-v2 {
  background: #fff;
  border-radius: 22px;
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 4px;
}
.activity-summary-row {
  display: flex; align-items: center; gap: 12px;
}
.activity-icon-circle {
  width: 44px; height: 44px; border-radius: 14px;
  background: var(--green-100);
  display: grid; place-items: center;
  font-size: 1.3rem;
}
.activity-summary-info { flex: 1; }
.activity-summary-title { font-weight: 700; color: var(--green-dark); }
.activity-summary-sub { color: var(--gray-500); font-size: .82rem; margin-top: 2px; }
.burnt-text { color: var(--orange); font-weight: 600; }
.chevron {
  background: transparent; border: none; color: var(--gray-500);
  font-size: 1.6rem; cursor: pointer; padding: 4px 8px;
  transition: transform .2s var(--ease-out);
}
.chevron.open { transform: rotate(90deg); }
.activity-expanded { padding-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.activity-expanded .btn-dark, .activity-expanded .steps-manual {
  align-self: stretch;
}

/* ---------- Cards ---------- */
.card {
  background: #fff;
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 14px;
}
.card-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px;
}

/* ---------- Summary card (tri-cell + ring) ---------- */
.summary-card .summary-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  margin: 6px 0 14px;
}
.summary-cell { text-align: center; }
.summary-val {
  font-size: 1.4rem; font-weight: 700; color: var(--gray-900);
  font-variant-numeric: tabular-nums;
}
.summary-val.big { font-size: 2rem; }
.summary-val.burned { color: var(--burn); }
.summary-label { font-size: .8rem; color: var(--gray-500); margin-top: 2px; }
.ring-cell { position: relative; width: 130px; }
.ring { transform: rotate(-90deg); }
.ring.big { transform: rotate(-90deg); }
.ring-bg, .ring-fg { fill: none; stroke-width: 10; stroke-linecap: round; }
.ring-bg { stroke: var(--gray-200); }
.ring-fg {
  stroke: var(--teal-500);
  stroke-dasharray: 326.7;
  stroke-dashoffset: 326.7;
  transition: stroke-dashoffset .5s ease, stroke .3s;
}
.ring-fg.fast { stroke: var(--teal-400); stroke-dasharray: 376.99; stroke-dashoffset: 376.99; }
.ring-inner {
  position: absolute; inset: 0;
  display: grid; place-content: center; text-align: center;
}

.macros-row { display: flex; flex-direction: column; gap: 10px; }
.macro-head {
  display: flex; justify-content: space-between;
  font-size: .85rem; color: var(--gray-700); margin-bottom: 4px;
}
.bar { height: 6px; background: var(--gray-200); border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; width: 0%; transition: width .4s ease; border-radius: 4px; }
.bar-fill.carbs   { background: var(--carbs); }
.bar-fill.protein { background: var(--protein); }
.bar-fill.fat     { background: var(--fat); }

/* ---------- Meals ---------- */
.meals { display: flex; flex-direction: column; gap: 4px; }
.meal-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--gray-100);
}
.meal-row:first-child { border-top: none; }
.meal-emoji { font-size: 1.6rem; }
.meal-info { flex: 1; }
.meal-title { font-weight: 600; }
.meal-sub { color: var(--gray-500); font-size: .82rem; }
.meal-kcal { font-weight: 700; font-variant-numeric: tabular-nums; }
.meal-add-circle {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--gray-900); color: #fff;
  border: none; cursor: pointer; font-size: 1.1rem;
  display: grid; place-items: center;
}
.meal-add-circle:hover { background: var(--teal-600); }
.meal-items { padding-left: 42px; margin-top: 6px; }
.meal-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 4px 0; font-size: .9rem;
}
.meal-item .name { flex: 1; padding-right: 6px; }
.meal-item .kcal-small { color: var(--gray-500); font-variant-numeric: tabular-nums; }
.meal-item .del {
  background: transparent; border: none; color: var(--gray-400);
  cursor: pointer; padding: 0 4px;
}
.meal-item .del:hover { color: var(--red); }

/* ---------- Water ---------- */
.water-summary {
  display: flex; justify-content: center; padding: 4px 0 10px;
}
.water-big { text-align: center; }
.water-amount { font-size: 1.8rem; font-weight: 700; color: var(--gray-900); }
.glasses {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(46px, 1fr));
  gap: 8px;
  padding: 6px 0;
}
.glass {
  background: transparent; border: none; cursor: pointer;
  padding: 4px; display: grid; place-items: center;
  transition: transform .08s;
}
.glass:active { transform: scale(.92); }
.glass svg { width: 38px; height: 48px; }
.glass.add { color: var(--gray-500); }
.water-from-food { text-align: center; padding: 8px 0 0; }

/* ---------- Activities ---------- */
.steps-block { padding: 4px 0 8px; }
.steps-row { display: flex; align-items: center; gap: 12px; padding: 6px 0; }
.steps-icon { font-size: 1.6rem; }
.steps-text { flex: 1; }
.steps-title { font-weight: 600; }
.steps-bar { height: 8px; background: var(--gray-200); border-radius: 4px; overflow: hidden; margin: 6px 0; }
.steps-fill { height: 100%; width: 0%; background: var(--teal-500); transition: width .4s ease; }
.steps-manual { display: block; text-align: center; margin: 0 auto; }

.activity-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.activity-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  background: var(--gray-50);
  border-radius: 12px;
}
.activity-emoji { font-size: 1.4rem; }
.activity-info { flex: 1; }
.activity-name { font-weight: 600; font-size: .9rem; }
.activity-meta { color: var(--gray-500); font-size: .8rem; }
.activity-row .del {
  background: transparent; border: none; color: var(--gray-400);
  cursor: pointer; padding: 4px;
}

/* ---------- Weight chart ---------- */
.weight-card .card-head { gap: 8px; }
.inline-form { display: flex; gap: 6px; align-items: center; }
.inline-form input { width: 84px; padding: 8px 10px; }
#weight-chart { display: block; margin-top: 4px; }
.chart-line { fill: none; stroke: var(--teal-500); stroke-width: 2; }
.chart-area { fill: var(--teal-100); opacity: .6; }
.chart-dot { fill: var(--teal-600); }

/* ---------- Stats grid ---------- */
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.stat { font-size: 1.4rem; font-weight: 700; color: var(--teal-700); }

/* ---------- Fasting ---------- */
.fast-ring-wrap {
  position: relative;
  display: grid; place-items: center;
  margin: 8px auto 14px;
}
.fast-state { font-weight: 600; color: var(--gray-500); font-size: .9rem; }
.fast-time { font-size: 2rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.presets {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  margin: 12px 0;
}
.preset {
  padding: 10px 0; background: var(--gray-100);
  border: 2px solid transparent; border-radius: var(--radius-sm);
  cursor: pointer; font-weight: 600; color: var(--gray-700);
}
.preset.active { background: var(--teal-50); border-color: var(--teal-400); color: var(--teal-700); }
.fast-actions { display: flex; gap: 8px; align-items: center; }
.fast-actions .btn-primary, .fast-actions .btn-danger { flex: 1; }
#fast-history { display: flex; flex-direction: column; gap: 6px; }
.fast-history-row {
  display: flex; justify-content: space-between; padding: 8px 10px;
  background: var(--gray-50); border-radius: 10px; font-size: .9rem;
}

/* ---------- Recipes ---------- */
.recipes-list { display: flex; flex-direction: column; gap: 10px; }
.recipe-card {
  background: #fff; border-radius: var(--radius); padding: 14px;
  box-shadow: var(--shadow-sm);
}
.recipe-head {
  display: flex; justify-content: space-between; align-items: center;
}
.recipe-name { font-weight: 700; }
.recipe-meta { color: var(--gray-500); font-size: .82rem; margin-top: 2px; }
.recipe-actions { display: flex; gap: 6px; }

/* ---------- Bottom nav (floating dark green pill) ---------- */
.bottom-nav {
  position: fixed;
  left: 50%; bottom: calc(16px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(420px, calc(100vw - 32px));
  padding: 10px 14px;
  background: var(--green-dark);
  border-radius: 999px;
  display: flex;
  justify-content: space-around;
  align-items: center;
  gap: 2px;
  z-index: 30;
  box-shadow: 0 14px 30px rgba(13,51,36,.22);
}
.nav-btn {
  flex: 1;
  padding: 8px 0;
  background: transparent;
  border: none;
  color: rgba(255,255,255,.5);
  font-weight: 600; font-size: 0;            /* hide labels — icon-only pill */
  cursor: pointer;
  border-radius: 999px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  transition: color .15s, background .15s;
  position: relative;
}
.nav-btn.active { color: var(--green-500); }
.nav-btn.active::after {
  content: '';
  position: absolute; bottom: 2px; left: 50%;
  transform: translateX(-50%);
  width: 18px; height: 3px; border-radius: 2px;
  background: var(--green-500);
}
.nav-icon { font-size: 1.3rem; }
.nav-btn.fab {
  background: var(--green-500);
  color: var(--green-dark);
  border-radius: 50%;
  width: 56px; height: 56px;
  font-size: 2rem;
  font-weight: 300;
  margin-top: -24px;
  align-self: center;
  flex: 0 0 56px;
  padding: 0;
  box-shadow: var(--shadow-fab);
}
.nav-btn.fab::after { display: none; }
.nav-btn.fab:hover { background: var(--green-400); }
.nav-btn.fab:active { transform: scale(.96); }

body { padding-bottom: 110px; }

/* ---------- Modal ---------- */
.modal {
  position: fixed; inset: 0;
  background: rgba(20,30,40,.4);
  display: grid; align-items: end;
  z-index: 50;
}
.modal-sheet {
  background: #fff; width: 100%; max-width: 480px;
  margin: 0 auto;
  border-radius: 22px 22px 0 0;
  padding: 18px 16px 22px;
  max-height: 90vh; overflow-y: auto;
  animation: slideUp .25s ease;
}
.modal-sheet.small-sheet { max-height: 70vh; }
@keyframes slideUp {
  from { transform: translateY(20%); opacity: .8; }
  to   { transform: translateY(0); opacity: 1; }
}
.modal-head {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px;
}
.meal-picker { margin-bottom: 10px; }
.foodtab { display: flex; flex-direction: column; gap: 10px; }
.search-row input { width: 100%; padding: 12px 14px; }
.results { display: flex; flex-direction: column; gap: 8px; max-height: 50vh; overflow-y: auto; }
.result-item {
  background: var(--gray-50); border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm); padding: 10px 12px; cursor: pointer;
}
.result-item:hover { background: var(--teal-50); border-color: var(--teal-300); }
.result-name { font-weight: 600; font-size: .95rem; }
.result-meta { color: var(--gray-500); font-size: .8rem; margin-top: 2px; }

.bullet { padding-left: 18px; }
.bullet li { margin-bottom: 4px; }

/* AI */
.ai-preview { display: grid; place-items: center; }
.ai-preview img { max-width: 100%; max-height: 240px; border-radius: var(--radius-sm); }
.ai-result {
  background: var(--teal-50); border: 1px solid var(--teal-200);
  border-radius: var(--radius-sm); padding: 12px;
}
.ai-result h4 { margin: 0 0 6px; }

/* ---------- Onboarding loader ---------- */
.onboard-loader {
  min-height: 100dvh;
  display: grid; place-items: center;
  background: linear-gradient(180deg, var(--teal-50), var(--gray-50) 60%);
}
.loader-card {
  width: min(420px, 92vw); padding: 28px;
  text-align: center;
}
.loader-ring { position: relative; display: grid; place-items: center; margin: 0 auto 18px; }
.loader-pct {
  position: absolute; inset: 0; display: grid; place-content: center;
  font-size: 1.6rem; font-weight: 700;
}
.loader-steps { list-style: none; padding: 0; margin: 18px 0 0; text-align: left; }
.loader-steps li {
  padding: 10px 0;
  color: var(--gray-500);
  font-weight: 500;
  display: flex; align-items: center; gap: 10px;
  transition: color .3s;
}
.loader-steps li::before {
  content: '○';
  color: var(--gray-300);
  font-size: 1.2rem;
}
.loader-steps li.done { color: var(--gray-900); }
.loader-steps li.done::before { content: '✓'; color: var(--teal-500); }

/* ---------- Milestone celebration ---------- */
.milestone-sheet {
  text-align: center;
  border-radius: 22px;
  position: relative;
  padding-top: 32px;
}
.milestone-close { position: absolute; top: 10px; right: 10px; }
.milestone-flame {
  font-size: 5rem;
  animation: flameBounce .8s ease infinite alternate;
}
@keyframes flameBounce {
  from { transform: translateY(0) scale(1); }
  to   { transform: translateY(-6px) scale(1.05); }
}
.milestone-number {
  font-size: 3rem; font-weight: 800;
  margin: 4px 0; color: var(--gray-900);
}
.weekdays {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 4px; margin: 18px 0;
}
.weekday {
  font-size: .8rem; color: var(--gray-500); font-weight: 600;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.weekday .day-dot {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--gray-200);
  display: grid; place-items: center;
  font-size: .9rem;
}
.weekday.logged .day-dot { background: var(--teal-400); color: #fff; }
.weekday.today .day-dot {
  outline: 2px solid var(--teal-600); outline-offset: 2px;
}
.milestone-msg { margin: 8px 0 18px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%);
  background: var(--gray-900); color: #fff;
  padding: 10px 16px; border-radius: 999px;
  box-shadow: var(--shadow-md); font-size: .9rem;
  z-index: 100; animation: toastIn .2s ease;
}
@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* small screens */
@media (max-width: 360px) {
  .row3 { grid-template-columns: 1fr; }
  .presets { grid-template-columns: repeat(2, 1fr); }
}
