/* NutriPlanner: calm greens and warm neutrals, rounded cards, no red. */
:root {
  --bg: #f7f5ef;
  --card: #fdfcf8;
  --ink: #1f3a2d;
  --muted: #5d6b62;
  --line: #e4e0d3;
  --green: #2f5d44;
  --green-soft: #e3eddf;
  --sage: #8aae8a;
  --tan: #d8b98b;
  --tan-soft: #f3e6d2;
  --radius: 18px;
  --nav-h: 64px;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { max-width: 100%; overflow-x: hidden; }
body { margin: 0; background: var(--bg); color: var(--ink); min-height: 100vh; }

.app { max-width: 720px; margin: 0 auto; padding: 16px 16px calc(var(--nav-h) + 48px); min-height: 100vh; }
/* Keep primary actions clear of the fixed bottom bar when scrolled into view. */
.stack-actions, .btn-primary, .btn-secondary { scroll-margin-bottom: calc(var(--nav-h) + 20px); }

h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 1.55rem; }
h2 { font-size: 1.25rem; margin-bottom: 4px; }
h3 { font-size: 1.05rem; margin-bottom: 10px; }
.muted { color: var(--muted); }
.tiny { font-size: 0.82rem; }
.hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); border: 0;
}

.brand { display: flex; align-items: center; gap: 12px; padding: 8px 0 16px; }
.brand-compact { padding-bottom: 8px; }
.brand .btn-text { margin-left: auto; }
.plan-settings h3 { margin-bottom: 6px; }
.plan-settings p { margin: 0 0 10px; }
.plan-settings .btn-secondary { width: 100%; min-height: 44px; }
.brand .logo { font-size: 2rem; }
.brand p { margin: 2px 0 0; color: var(--muted); font-size: 0.92rem; }
.brand .back { margin-right: 4px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}

.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.btn-primary, .btn-secondary, .btn-text, .btn-icon {
  font: inherit; cursor: pointer; border-radius: 12px; border: none;
}
.btn-primary {
  background: var(--green); color: #fff; padding: 12px 18px; font-weight: 600;
}
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-secondary {
  background: var(--green-soft); color: var(--green); padding: 10px 16px; font-weight: 600;
}
.btn-small { padding: 8px 12px; font-size: 0.9rem; min-height: 44px; }
.btn-text {
  background: transparent; color: var(--green); padding: 6px 8px; font-weight: 600;
}
.btn-icon {
  background: transparent; color: var(--muted); font-size: 1.2rem; padding: 4px 8px;
}

.stack-actions { display: flex; flex-direction: column; gap: 10px; margin: 8px 0 48px; }
.stack-actions.dual { flex-direction: column; }
.stack-actions .btn-primary, .stack-actions .btn-secondary { width: 100%; }

.profile-grid { display: grid; gap: 10px; margin-top: 12px; }
.profile-card {
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto;
  gap: 2px 12px; text-align: left; padding: 14px; border-radius: var(--radius);
  border: 1px solid var(--line); background: #fff; cursor: pointer; font: inherit; color: inherit;
}
.profile-card:hover { border-color: var(--sage); background: var(--green-soft); }
.profile-icon { grid-row: span 2; font-size: 1.8rem; align-self: center; }
.profile-name { font-weight: 700; }
.profile-blurb { color: var(--muted); font-size: 0.9rem; }

.target-row {
  display: grid; grid-template-columns: 1.4fr 0.7fr 0.8fr auto auto;
  gap: 8px; align-items: center; margin-bottom: 8px;
}
.target-row select, .target-row input, .field input, .logged-item input {
  font: inherit; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); width: 100%;
}
.unit { color: var(--muted); font-size: 0.85rem; }
/* Phone: the nutrient gets its own row so "Min"/"Max" is never cut off. */
@media (max-width: 520px) {
  .target-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto auto; }
  .target-row select:first-of-type { grid-column: 1 / -1; }
}

.day-strip-wrap { padding: 10px 8px; }
.day-strip {
  display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px;
  scrollbar-width: thin;
}
.day-chip {
  flex: 0 0 auto; width: 48px; padding: 8px 4px; border-radius: 14px;
  border: 1px solid transparent; background: transparent; cursor: pointer;
  font: inherit; color: var(--ink); display: flex; flex-direction: column; align-items: center;
}
.day-chip .dow { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; }
.day-chip .dom { font-weight: 700; }
.day-chip.is-today { background: var(--green-soft); }
.day-chip.is-selected { background: var(--green); color: #fff; border-color: var(--green); }
.day-chip.is-selected .dow { color: rgba(255,255,255,0.85); }

.meal-list, .upcoming, .logged-items, .change-list, .effect-list, .kept-list, .shop-group ul {
  list-style: none; margin: 0; padding: 0;
}
.meal-item, .plan-meal-row {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.meal-item:last-child, .plan-meal-row:last-child { border-bottom: none; }
.plan-meal-row.is-skipped { opacity: 0.72; }
.meal-actions {
  display: flex; flex-direction: row; flex-wrap: wrap; gap: 6px; flex-shrink: 0;
  justify-content: flex-end; max-width: 11.5rem;
}
.meal-actions .btn-small { flex: 1 1 auto; min-width: 5.2rem; padding: 8px 10px; }
/* Day screen: status chip and the row actions, kept inline and wrapping on a phone. */
.meal-item { flex-wrap: wrap; }
/* The meal name takes the full row; the buttons sit under it in equal columns, so a
   long recipe name is never squeezed into a narrow column beside them on a phone. */
.meal-item .meal-open { flex: 1 1 100%; flex-wrap: wrap; min-width: 0; }
.meal-status {
  display: inline-block; font-size: 0.72rem; font-weight: 600; line-height: 1.4;
  padding: 2px 8px; border-radius: 99px; background: var(--line); color: var(--muted);
}
.meal-status-eaten { background: var(--green-soft); color: var(--green); }
.meal-status-skipped { background: var(--tan-soft); color: #7a5a2b; }
.meal-status-replaced { background: var(--tan-soft); color: #7a5a2b; }
.meal-row-actions {
  display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end;
  flex: 1 1 100%; max-width: 100%;
}
.meal-row-actions .btn-small { flex: 1 1 0; min-width: 5.2rem; min-height: 44px; padding: 8px 10px; }
.meal-progress { margin: 0 0 6px; }
.meal-log-hint { margin: 8px 0 0; }
.meal-item .replace-picker { flex: 1 1 100%; min-width: 0; }
.meal-slot {
  display: inline-block; font-size: 0.72rem; background: var(--green-soft); color: var(--green);
  padding: 2px 8px; border-radius: 99px; text-transform: capitalize; margin-bottom: 4px;
}

/* A meal planned outside the menu: expected intake, not logged food. */
.planned-extra {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center;
  gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line);
}
.planned-extra:last-child { border-bottom: none; }
.planned-extra-head { display: flex; flex-direction: column; gap: 2px; flex: 1 1 100%; min-width: 0; }
.planned-extra-kind { font-size: 0.72rem; font-weight: 600; color: var(--muted); }
.planned-extra-foods { font-weight: 600; }

.progress-row { margin-bottom: 12px; }
.progress-meta { display: flex; justify-content: space-between; gap: 8px; font-size: 0.92rem; margin-bottom: 4px; }
.bar { height: 10px; background: var(--line); border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 99px; background: var(--sage); }
.bar-fill.bar-ok { background: var(--green); }
.bar-fill.bar-near { background: var(--tan); }
.bar-fill.bar-warn { background: #c4a574; }
.bar-fill.bar-low { background: var(--sage); }

.mode-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.mode-tab {
  flex: 1; font: inherit; padding: 10px; border-radius: 12px; border: 1px solid var(--line);
  background: #fff; cursor: pointer; color: var(--muted); font-weight: 600;
}
.mode-tab.is-active { background: var(--green-soft); color: var(--green); border-color: var(--sage); }

/* When did you eat it: two chips and the past date/time fields. */
.when-chips { display: flex; gap: 6px; margin-bottom: 10px; }
.when-chip {
  flex: 1; font: inherit; padding: 8px 10px; border-radius: 12px; border: 1px solid var(--line);
  background: #fff; cursor: pointer; color: var(--muted); font-weight: 600;
}
.when-chip.is-active { background: var(--green-soft); color: var(--green); border-color: var(--sage); }
.when-panel { margin-bottom: 10px; }
.field { display: block; margin-bottom: 10px; }
.field span { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 4px; }
.field-error { color: #9a6b2f; font-size: 0.82rem; margin: 4px 0 8px; }
.target-row .field-error { grid-column: 1 / -1; margin: 0; }
.search-results { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.search-hit {
  text-align: left; font: inherit; padding: 8px 10px; border-radius: 10px;
  border: 1px solid var(--line); background: #fff; cursor: pointer;
}
.search-hit.is-selected { border-color: var(--green); background: var(--green-soft); }

/* Drinks shortcut: short list, ml presets and the conversion note. */
[data-drinks], [data-replace-drinks] { margin-bottom: 8px; }
.drink-picker { margin-bottom: 10px; }
.drink-options {
  display: flex; flex-direction: column; gap: 4px; max-height: 220px;
  overflow-y: auto; margin-bottom: 8px;
}
.drink-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.drink-presets .btn-small { flex: 1 1 auto; }
.logged-item {
  display: grid; grid-template-columns: 1fr 72px auto auto; gap: 8px; align-items: center;
  padding: 8px 0; border-bottom: 1px solid var(--line);
}

/* A planned meal added as eaten stays one block, with its ingredients indented. */
.logged-group { padding: 8px 0; border-bottom: 1px solid var(--line); }
/* "This meal" title and its Clear all control sit on one line. */
.logged-card-header {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
}
.logged-group-header {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.logged-group-title { font-size: 0.92rem; font-weight: 600; }
.logged-group-title .group-slot { text-transform: capitalize; }
.logged-group-items {
  list-style: none; margin: 4px 0 0; padding: 0 0 0 12px;
  border-left: 2px solid var(--sage);
}
.logged-group-item { border-bottom: none; padding: 4px 0; }
.logged-item.is-skipped { opacity: 0.72; }

/* Correcting a saved log entry from the Plan screen. */
.log-edits { list-style: none; margin: 0; padding: 0; }
.log-edit { padding: 10px 0; border-bottom: 1px solid var(--line); }
.log-edit:last-child { border-bottom: none; }
.log-edit-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.log-edit-kind { font-size: 0.85rem; font-weight: 600; }
.log-edit-note { margin: 4px 0; }
.log-edit-skipped { margin: 6px 0; opacity: 0.8; }
.log-edit-items { list-style: none; margin: 6px 0; padding: 0 0 0 10px; border-left: 2px solid var(--sage); }
.log-edit-item {
  display: grid; grid-template-columns: 1fr 76px auto; gap: 8px; align-items: center;
  padding: 3px 0;
}
.log-edit-item input { min-height: 44px; }
.log-edit-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.log-edit-actions .btn-small { min-height: 44px; }
.notice-card { border-left: 3px solid var(--green); }
.notice-card p { margin: 0; font-size: 0.9rem; }

/* Day screen: a save that changes nothing says so here; a pending update stays
   in the day card with its two buttons instead of opening another screen. */
.meal-status-line {
  margin: 8px 0 0; padding: 8px 10px; border-radius: 10px;
  background: var(--green-soft); color: var(--green); font-size: 0.9rem;
}
.day-banner {
  border: 1px solid var(--tan); background: var(--tan-soft);
  border-radius: 12px; padding: 10px 12px; margin: 0 0 12px;
}
.day-banner p { margin: 0 0 8px; }
.day-banner-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.day-banner-actions .btn-small { min-height: 44px; }
.day-banner-pending { margin: 0 0 10px; font-size: 0.9rem; color: var(--muted); }
.day-banner-pending .btn-text { min-height: 44px; }

/* The plan row of a meal already in "This meal". */
.plan-meal-row.is-in-draft { background: var(--green-soft); border-radius: 12px; padding: 10px 8px; }
.badge-in-draft {
  display: inline-block; margin-left: 6px; font-size: 0.7rem; font-weight: 600;
  padding: 2px 8px; border-radius: 99px; background: var(--green); color: #fff;
}
.plan-meal-row.is-logged { background: var(--tan-soft); border-radius: 12px; padding: 10px 8px; }
.badge-logged {
  display: inline-block; margin-left: 6px; font-size: 0.7rem; font-weight: 600;
  padding: 2px 8px; border-radius: 99px; background: var(--tan); color: #3a2f18;
}

/* Replace picker: other recipes for the same slot. */
.replace-picker { padding: 8px 0 10px; }
.replace-options {
  display: flex; flex-direction: column; gap: 4px; max-height: 240px;
  overflow-y: auto; margin-bottom: 6px;
}
.replace-options .search-hit { min-height: 44px; }

.success-banner { background: var(--green-soft); border-color: var(--sage); }
.success-banner.soft { background: var(--tan-soft); border-color: var(--tan); }
.reason-text { font-size: 1.05rem; line-height: 1.45; margin: 0; }
.change-item { padding: 10px 0; border-bottom: 1px solid var(--line); }
.change-date { font-size: 0.82rem; color: var(--muted); margin-bottom: 4px; text-transform: capitalize; }
.pill {
  display: inline-block; font-size: 0.75rem; font-weight: 600; padding: 3px 8px;
  border-radius: 99px; background: var(--green-soft); color: var(--green);
}
.effect-item { padding: 8px 0; border-bottom: 1px solid var(--line); }
/* D29 "If you save this": a small dry-run card under "To add". It stays inside
   a 375 px phone: the text breaks, the row wraps and no fixed width overflows. */
.preview-card { max-width: 100%; overflow-wrap: anywhere; }
.preview-card h3 { margin-bottom: 6px; }
.preview-card .preview-reason { margin: 0 0 8px; line-height: 1.4; }
.preview-card .preview-note { margin: 0 0 8px; }
.preview-card .preview-effect { flex-wrap: wrap; gap: 6px; }
.preview-card .effect-item:last-child { border-bottom: none; }
.note-card { background: #fffdf8; border-color: var(--tan); }
.plan-reach h3 { margin: 0 0 6px; font-size: 1rem; }
.plan-reach-list { margin: 0 0 8px; padding-left: 18px; font-size: 0.9rem; }
.plan-reach-list li { margin: 2px 0; }
.plan-reach-hint { margin: 0 0 10px; }
.plan-reach-compact { padding: 12px 14px; }
.plan-reach-compact .plan-reach-hint { margin-bottom: 0; }

.shop-window .shop-dates { font-weight: 700; margin: 4px 0 12px; }
.field-label { color: var(--muted); font-size: 0.85rem; margin: 0 0 6px; }
.freq-options { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.freq-option {
  font: inherit; font-weight: 600; color: var(--green); background: #fff;
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; cursor: pointer;
  min-height: 44px; min-width: 44px;
}
.freq-option.is-active { background: var(--green); border-color: var(--green); color: #fff; }
.summary-cta .row { align-items: flex-start; }

.summary-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 0.9rem; }
.summary-table th, .summary-table td {
  text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line);
  vertical-align: top; overflow-wrap: anywhere;
}
.summary-table th { color: var(--muted); font-size: 0.78rem; font-weight: 600; }
.summary-table th:first-child, .summary-table td:first-child { width: 50%; }
.summary-table th:nth-child(2), .summary-table td:nth-child(2) { width: 24%; }
.summary-table th:nth-child(3), .summary-table td:nth-child(3) { width: 26%; }
/* Phone: the status labels ("Incomplete data" etc.) must stay fully readable. */
@media (max-width: 520px) {
  .summary-table { font-size: 0.82rem; }
  .summary-table th, .summary-table td { padding: 8px 4px; }
  .summary-table th:first-child, .summary-table td:first-child { width: 44%; }
  .summary-table th:nth-child(2), .summary-table td:nth-child(2) { width: 26%; }
  .summary-table th:nth-child(3), .summary-table td:nth-child(3) { width: 30%; }
}
.summary-status { font-weight: 600; color: var(--green); }
.summary-meta p { margin: 4px 0; }
.summary-meals, .summary-meal-items { list-style: none; margin: 0; padding: 0; }
.summary-meal { padding: 10px 0; border-bottom: 1px solid var(--line); }
.summary-meal:last-child { border-bottom: none; }
.summary-meal-date { font-weight: 700; margin-bottom: 4px; }
.summary-meal-items li { padding: 2px 0; }

.shop-group { margin-bottom: 14px; }
.shop-group h3 { font-size: 0.95rem; color: var(--muted); margin-bottom: 6px; }
.shop-item {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center;
  gap: 6px 10px; padding: 8px 0; border-bottom: 1px solid var(--line);
}
.shop-item label {
  display: flex; flex: 1 1 auto; align-items: center; gap: 10px; cursor: pointer;
  min-height: 44px; min-width: 44px;
}
.shop-item label span, .shop-item-main > span, .shop-swap-row > span { overflow-wrap: anywhere; }
.shop-swap-row > span { flex: 1 1 160px; }
.shop-item.is-bought label span { text-decoration: line-through; color: var(--muted); }
.shop-item input[type="checkbox"] { width: 44px; height: 44px; accent-color: var(--green); }
.shop-item-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.shop-item .btn-small, .shop-item-actions .btn-small, .shop-swap-row .btn-small { min-height: 44px; }
.shop-progress { font-weight: 700; margin: 4px 0 10px; }
.badge-in-cart, .badge-not-found {
  display: inline-block; font-size: 0.7rem; font-weight: 600;
  padding: 2px 8px; border-radius: 99px;
}
.badge-in-cart { background: var(--green); color: #fff; }
.badge-not-found { background: var(--tan); color: #3a2f18; }
.shop-item.is-not-found { display: block; }
.shop-item-main { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.shop-swap-hint { margin: 4px 0; }
.shop-swaps { list-style: none; margin: 0; padding: 0; }
.shop-swap-row {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center;
  gap: 6px 10px; padding: 4px 0;
}

.footer-note { text-align: center; color: var(--muted); font-size: 0.82rem; margin: 16px 0 8px; }
.error { background: #fbf1e3; border: 1px solid var(--tan); border-radius: var(--radius); padding: 16px; }
.empty-state { text-align: center; padding: 28px 16px; }
.empty-state .btn-primary { margin-top: 12px; }
.storage-notice {
  background: var(--tan-soft); border: 1px solid var(--tan); border-radius: 12px;
  padding: 8px 12px; margin-bottom: 10px; font-size: 0.88rem;
}

.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; height: var(--nav-h);
  background: #fff; border-top: 1px solid var(--line);
  display: flex; justify-content: center; gap: 0; z-index: 20;
  max-width: 720px; margin: 0 auto;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.nav-item {
  flex: 1; max-width: 160px; border: none; background: transparent; font: inherit;
  color: var(--muted); display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 2px; cursor: pointer; font-size: 0.78rem;
}
.nav-item.is-active { color: var(--green); font-weight: 700; }

@media (min-width: 800px) {
  .app { max-width: 880px; padding: 24px 24px calc(var(--nav-h) + 32px); }
  .profile-grid { grid-template-columns: repeat(4, 1fr); }
  .stack-actions.dual { flex-direction: row; }
  .stack-actions.dual > * { flex: 1; }
  h1 { font-size: 1.75rem; }
  .bottom-nav { left: 50%; transform: translateX(-50%); width: 880px; border-radius: 16px 16px 0 0; }
}

.upcoming-day { padding: 6px 0; border-bottom: 1px solid var(--line); }
.upcoming-day ul { list-style: none; margin: 4px 0 0; padding: 0; font-size: 0.92rem; }

/* Touch targets: at least 44 by 44 px, including every tick and x control. */
.btn-icon { min-width: 44px; min-height: 44px; }
/* Text-style buttons and small controls (Cancel, How it works, Clear all, Start
   over, Change profile, Undo, Clear) are full touch targets too. Padding keeps
   the look calm and stays inside a 375 px phone without horizontal scrolling. */
.btn-text {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 44px; min-height: 44px; padding: 10px 12px;
}
.btn-small { min-width: 44px; }
.target-row select, .target-row input, .logged-item input { min-height: 44px; }
/* Text, number and search fields and selects are full-height touch targets too. */
input[type="text"], input[type="number"], input[type="search"], select { min-height: 44px; }
input[type="checkbox"], input[type="radio"] { min-width: 28px; min-height: 28px; }
/* The shopping list and My meals ticks are full 44 px targets. */
.shop-item input[type="checkbox"], .my-meals input[type="checkbox"] { width: 44px; height: 44px; }
.my-meals .meal-pref {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; min-width: 44px; cursor: pointer;
}

/* Print: a clean sheet with no navigation or buttons. */
@media print {
  body { background: #fff; }
  .app { max-width: none; padding: 0; }
  .bottom-nav, .no-print, button { display: none !important; }
  .card { border-color: #ccc; break-inside: avoid; page-break-inside: avoid; }
  .summary-table { font-size: 11pt; }
  .footer-note { color: #333; }
}

/* Recipe detail: a calm sheet over the screen with ingredients, targets and search links. */
.recipe-overlay {
  position: fixed; inset: 0; z-index: 40; background: rgba(31, 58, 45, 0.35);
  display: flex; align-items: flex-end; justify-content: center;
}
.recipe-panel {
  width: 100%; max-width: 720px; max-height: 88vh; overflow-y: auto;
  background: var(--card); border: 1px solid var(--line); border-radius: 20px 20px 0 0;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom, 0));
  box-shadow: 0 -8px 30px rgba(31, 58, 45, 0.18);
}
.recipe-panel-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
  margin-bottom: 12px;
}
.recipe-panel-head h2 { display: flex; align-items: center; gap: 8px; font-size: 1.2rem; margin: 0; }
.recipe-close { min-width: 44px; min-height: 44px; font-size: 1.5rem; line-height: 1; }
.recipe-section { margin: 0 0 14px; }
.recipe-section h3 {
  font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.02em;
  color: var(--muted); margin: 0 0 6px;
}
.recipe-ingredients, .recipe-nutrients { list-style: none; margin: 0; padding: 0; }
.recipe-ingredients li, .recipe-nutrients li {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 0.95rem;
}
.recipe-ingredients li:last-child, .recipe-nutrients li:last-child { border-bottom: none; }
.recipe-ingredients li span:first-child { overflow-wrap: anywhere; }
.recipe-grams { color: var(--muted); white-space: nowrap; }
.recipe-links { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 10px; }
.recipe-link {
  display: flex; align-items: center; justify-content: center;
  min-height: 44px; text-decoration: none;
}
.recipe-note { margin: 0; }

/* A meal name / row that opens the detail panel. */
.meal-open {
  font: inherit; color: inherit; background: transparent; border: none;
  display: flex; align-items: center; gap: 10px; text-align: left;
  flex: 1; min-height: 44px; padding: 6px 0; border-radius: 10px;
  cursor: pointer;
}
.meal-open:hover { color: var(--green); }
.logged-group-title.meal-open { font-size: 0.92rem; font-weight: 600; }
.meal-name-line { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }

@media (min-width: 800px) {
  .recipe-overlay { align-items: center; padding: 24px; }
  .recipe-panel { border-radius: 20px; max-height: 80vh; }
}

/* Doctor summary: each status has its own look, with no good/bad judgement. */
.summary-status { font-weight: 600; white-space: normal; }
.summary-status.status-within { color: var(--green); }
.summary-status.status-above, .summary-status.status-below { color: #7a5a1e; background: var(--tan-soft); }
.summary-status.status-incomplete,
.summary-status.status-not { color: var(--muted); font-style: italic; }

/* Confirmation panel: what a Start over / Change profile will erase, with Cancel first. */
.confirm-overlay {
  position: fixed; inset: 0; z-index: 50; background: rgba(31, 58, 45, 0.35);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0; overflow-y: auto;
}
.confirm-panel {
  width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto;
  background: var(--card); border: 1px solid var(--line); border-radius: 20px 20px 0 0;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom, 0));
  box-shadow: 0 -8px 30px rgba(31, 58, 45, 0.18);
}
.confirm-panel h2 { margin-bottom: 10px; }
.confirm-body p { margin: 0 0 10px; }
.confirm-list { margin: 0 0 12px; padding-left: 20px; }
.confirm-list li { padding: 3px 0; }
.confirm-check {
  display: flex; align-items: center; gap: 10px; padding: 10px 0;
  font-weight: 600; min-height: 44px; cursor: pointer;
}
.confirm-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.confirm-actions .btn-primary, .confirm-actions .btn-secondary { width: 100%; min-height: 44px; }

@media (min-width: 800px) {
  .confirm-overlay { align-items: center; padding: 24px; }
  .confirm-panel { border-radius: 20px; max-height: 80vh; }
  .confirm-actions { flex-direction: row; justify-content: flex-end; }
  .confirm-actions .btn-primary, .confirm-actions .btn-secondary { width: auto; }
}

/* First-run guide: three numbered steps over the screen, reopenable from "How it works". */
.guide-overlay {
  position: fixed; inset: 0; z-index: 60; background: rgba(31, 58, 45, 0.35);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0; overflow-y: auto;
}
.guide-panel {
  width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto;
  background: var(--card); border: 1px solid var(--line); border-radius: 20px 20px 0 0;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom, 0));
  box-shadow: 0 -8px 30px rgba(31, 58, 45, 0.18);
}
.guide-panel h2 { margin-bottom: 10px; }
.guide-steps { list-style: none; margin: 0 0 6px; padding: 0; }
.guide-step { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.guide-step:last-child { border-bottom: none; }
.guide-step-num {
  flex: 0 0 30px; width: 30px; height: 30px; border-radius: 50%;
  background: var(--green-soft); color: var(--green);
  display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.guide-step-text { display: flex; flex-direction: column; gap: 3px; }
.guide-step-title { font-weight: 700; }
.guide-step-body { color: var(--muted); font-size: 0.92rem; }
.guide-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.guide-actions .btn-primary { width: 100%; min-height: 44px; }

@media (min-width: 800px) {
  .guide-overlay { align-items: center; padding: 24px; }
  .guide-panel { border-radius: 20px; max-height: 80vh; }
  .guide-actions { flex-direction: row; justify-content: flex-end; }
  .guide-actions .btn-primary { width: auto; }
}

/* The Targets footer link and the disclaimer share one line. */
.footer-with-guide { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px; }
.footer-with-guide .btn-text { text-decoration: underline; }


