:root {
  --ink: #17312b;
  --ink-soft: #50645d;
  --surface: #fffdf8;
  --surface-2: #f5f2e9;
  --surface-3: #e9eee7;
  --line: #d9dfd6;
  --brand: #173c35;
  --brand-2: #2b6456;
  --brand-pale: #dcebe4;
  --accent: #e66d49;
  --accent-dark: #bd4e31;
  --accent-pale: #fae6dd;
  --good: #276847;
  --good-pale: #e0f0e6;
  --warning: #8b5b12;
  --warning-pale: #fff1cf;
  --danger: #a23d35;
  --danger-pale: #fbe4e1;
  --shadow-sm: 0 2px 10px rgb(23 49 43 / 7%);
  --shadow: 0 16px 48px rgb(23 49 43 / 13%);
  --radius-sm: 10px;
  --radius: 18px;
  --radius-lg: 28px;
  --content: 1180px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--surface-2);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--brand-2); }
img { display: block; max-width: 100%; }
svg { display: block; }
[hidden], .is-hidden { display: none !important; }

:focus-visible {
  outline: 3px solid rgb(230 109 73 / 45%);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 1000;
  transform: translateY(-150%);
  padding: 10px 14px;
  border-radius: 8px;
  color: white;
  background: var(--brand);
}
.skip-link:focus { transform: translateY(0); }

.app-body { min-height: 100vh; }
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: minmax(245px, 1fr) auto minmax(245px, 1fr);
  align-items: center;
  min-height: 72px;
  padding: 10px max(20px, calc((100vw - var(--content)) / 2));
  border-bottom: 1px solid rgb(23 60 53 / 10%);
  background: rgb(255 253 248 / 92%);
  backdrop-filter: blur(16px);
}
.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  width: max-content;
  color: var(--ink);
  text-decoration: none;
}
.brand-symbol {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 14px;
  color: white;
  background: var(--brand);
  box-shadow: var(--shadow-sm);
}
.brand-symbol svg { width: 27px; height: 27px; }
.brand-symbol path { fill: none; stroke: currentColor; stroke-width: 2.7; stroke-linecap: round; stroke-linejoin: round; }
.site-brand > span:last-child { display: grid; line-height: 1.15; }
.site-brand strong { letter-spacing: -0.02em; }
.site-brand small { margin-top: 3px; color: var(--ink-soft); font-size: 0.72rem; }
.desktop-nav {
  display: flex;
  gap: 5px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
}
.desktop-nav a {
  padding: 8px 15px;
  border-radius: 999px;
  color: var(--ink-soft);
  font-size: 0.91rem;
  font-weight: 650;
  text-decoration: none;
}
.desktop-nav a:hover { color: var(--ink); background: var(--surface); }
.desktop-nav a.is-active { color: white; background: var(--brand); }
.account-button {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 5px 12px 5px 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: var(--surface);
  cursor: pointer;
}
.account-button:hover { border-color: #b4c0b8; box-shadow: var(--shadow-sm); }
.account-avatar {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: var(--brand-2);
  font-size: 0.8rem;
  font-weight: 800;
}
.account-label { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.88rem; font-weight: 650; }

.app-main { min-height: calc(100vh - 72px); }
#app { width: 100%; }
.page-shell {
  width: min(var(--content), calc(100% - 40px));
  margin: 0 auto;
  padding: 46px 0 88px;
}
.page-shell.narrow { width: min(860px, calc(100% - 40px)); }
.page-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}
.page-heading { max-width: 720px; }
.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-dark);
  font-size: 0.75rem;
  font-weight: 850;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
h1, h2, h3, p { margin-top: 0; }
h1 {
  margin-bottom: 10px;
  font-size: clamp(2rem, 4.2vw, 4.2rem);
  line-height: 1.02;
  letter-spacing: -0.055em;
}
h2 { margin-bottom: 10px; font-size: clamp(1.35rem, 2.3vw, 2rem); line-height: 1.15; letter-spacing: -0.035em; }
h3 { margin-bottom: 7px; font-size: 1.05rem; line-height: 1.25; }
.lead { max-width: 680px; margin-bottom: 0; color: var(--ink-soft); font-size: clamp(1rem, 1.7vw, 1.18rem); }
.muted { color: var(--ink-soft); }
.microcopy { margin: 9px 0 0; color: var(--ink-soft); font-size: 0.82rem; }
.text-center { text-align: center; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-weight: 760;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease;
}
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:active:not(:disabled) { transform: translateY(0); }
.button:disabled { opacity: .58; cursor: not-allowed; }
.button-primary { color: white; background: var(--accent); box-shadow: 0 8px 20px rgb(230 109 73 / 20%); }
.button-primary:hover:not(:disabled) { background: var(--accent-dark); box-shadow: 0 10px 26px rgb(189 78 49 / 25%); }
.button-brand { color: white; background: var(--brand); }
.button-brand:hover:not(:disabled) { background: var(--brand-2); }
.button-secondary { border-color: var(--line); color: var(--ink); background: var(--surface); }
.button-secondary:hover:not(:disabled), .button-ghost:hover:not(:disabled) { border-color: #aab9b0; background: #fff; }
.button-ghost { border-color: transparent; color: var(--brand); background: transparent; }
.button-danger { border-color: #e7b4ae; color: var(--danger); background: var(--danger-pale); }
.button-small { min-height: 36px; padding: 7px 11px; border-radius: 10px; font-size: 0.83rem; }
.button-wide { width: 100%; }
.button-icon { width: 42px; padding: 0; }
.button-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.justify-center { justify-content: center; }
.modal-open { overflow: hidden; }
.text-button {
  padding: 0;
  border: 0;
  color: var(--brand-2);
  background: transparent;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

label { display: grid; gap: 7px; color: var(--ink); font-size: 0.87rem; font-weight: 720; }
input, select, textarea {
  width: 100%;
  min-height: 45px;
  padding: 10px 12px;
  border: 1px solid #c8d1ca;
  border-radius: 11px;
  color: var(--ink);
  background: var(--surface);
  outline: none;
}
textarea { min-height: 95px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px rgb(43 100 86 / 12%); }
label small { color: var(--ink-soft); font-size: .75rem; font-weight: 500; }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
legend { margin-bottom: 12px; font-weight: 800; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.span-2 { grid-column: span 2; }
.inline-form { display: flex; align-items: end; gap: 10px; }
.inline-form label { flex: 1; }

.alert { margin: 16px 0; padding: 12px 14px; border-radius: 12px; font-size: 0.9rem; }
.alert-error { border: 1px solid #e7b4ae; color: var(--danger); background: var(--danger-pale); }
.alert-success { border: 1px solid #b9d9c6; color: var(--good); background: var(--good-pale); }
.alert-warning { border: 1px solid #e6cb8d; color: var(--warning); background: var(--warning-pale); }

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.soft-card { border-radius: var(--radius); background: var(--surface-3); }

.loading-screen {
  display: grid;
  min-height: 65vh;
  place-content: center;
  justify-items: center;
  color: var(--ink-soft);
}
.loading-mark {
  width: 46px;
  height: 46px;
  margin-bottom: 14px;
  border: 4px solid var(--brand-pale);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { position: relative; overflow: hidden; background: #e8ece6; }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgb(255 255 255 / 65%), transparent); animation: shimmer 1.35s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }

/* Decision funnel */
.decision-hero {
  position: relative;
  overflow: hidden;
  min-height: calc(100vh - 72px);
  background:
    radial-gradient(circle at 90% 5%, rgb(230 109 73 / 13%), transparent 28%),
    radial-gradient(circle at 3% 80%, rgb(43 100 86 / 13%), transparent 30%),
    var(--surface-2);
}
.decision-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 520px);
  gap: clamp(34px, 7vw, 96px);
  align-items: center;
  width: min(1120px, calc(100% - 40px));
  min-height: calc(100vh - 72px);
  margin: 0 auto;
  padding: 50px 0 80px;
}
.decision-copy { align-self: center; }
.decision-copy h1 { max-width: 660px; }
.decision-copy .lead { max-width: 590px; }
.trust-strip { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 25px; }
.trust-chip { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink-soft); background: rgb(255 253 248 / 72%); font-size: .78rem; font-weight: 650; }
.trust-chip::before { content: "✓"; color: var(--good); font-weight: 900; }
.decision-panel { padding: 26px; border: 1px solid rgb(23 60 53 / 13%); border-radius: var(--radius-lg); background: rgb(255 253 248 / 95%); box-shadow: var(--shadow); }
.decision-progress { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 22px; }
.decision-progress span { color: var(--ink-soft); font-size: .8rem; font-weight: 700; }
.step-dots { display: flex; gap: 6px; }
.step-dot { width: 22px; height: 5px; border-radius: 999px; background: var(--line); }
.step-dot.is-active, .step-dot.is-done { background: var(--accent); }
.decision-step h2 { margin-bottom: 6px; }
.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 20px 0; }
.choice-grid.choice-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.choice-button {
  display: grid;
  min-height: 88px;
  align-content: center;
  gap: 4px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  text-align: left;
  background: var(--surface);
  cursor: pointer;
}
.choice-button strong { font-size: .95rem; }
.choice-button small { color: var(--ink-soft); font-size: .75rem; font-weight: 500; }
.choice-button:hover { border-color: #9bafa4; background: #fff; }
.choice-button.is-selected { border: 2px solid var(--brand-2); padding: 12px; background: var(--brand-pale); box-shadow: 0 0 0 3px rgb(43 100 86 / 9%); }
.choice-button .choice-icon { font-size: 1.35rem; line-height: 1; }
.decision-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 18px; }
.decision-footer .button-primary { min-width: 155px; }
.people-control { display: flex; align-items: center; justify-content: center; gap: 20px; margin: 25px 0 14px; padding: 18px; border-radius: 16px; background: var(--surface-3); }
.people-control button { display: grid; width: 46px; height: 46px; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--ink); background: var(--surface); font-size: 1.5rem; cursor: pointer; }
.people-value { min-width: 100px; text-align: center; }
.people-value strong { display: block; font-size: 2.2rem; line-height: 1; }
.people-value small { color: var(--ink-soft); }
.quick-pref-link { display: inline-flex; margin-top: 18px; color: var(--ink-soft); font-size: .82rem; }

/* Recommendation */
.recommendation-shell { width: min(1080px, calc(100% - 40px)); margin: 0 auto; padding: 38px 0 90px; }
.result-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.result-heading h1 { margin: 0; font-size: clamp(1.8rem, 3.4vw, 3rem); }
.hero-recipe { display: grid; grid-template-columns: minmax(330px, .95fr) minmax(0, 1.05fr); overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow); }
.hero-recipe-image { position: relative; min-height: 500px; background: var(--surface-3); }
.hero-recipe-image img { width: 100%; height: 100%; object-fit: cover; }
.image-badge { position: absolute; top: 16px; left: 16px; padding: 7px 10px; border-radius: 999px; color: white; background: rgb(23 49 43 / 82%); backdrop-filter: blur(8px); font-size: .75rem; font-weight: 750; }
.hero-recipe-content { display: flex; flex-direction: column; padding: clamp(25px, 4vw, 46px); }
.hero-recipe-content h2 { max-width: 620px; margin-bottom: 11px; font-size: clamp(2rem, 4vw, 3.75rem); line-height: 1; }
.recipe-meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 18px; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 6px 9px; border-radius: 999px; color: var(--ink-soft); background: var(--surface-3); font-size: .75rem; font-weight: 720; }
.pill.brand { color: var(--brand); background: var(--brand-pale); }
.pill.accent { color: var(--accent-dark); background: var(--accent-pale); }
.pill.good { color: var(--good); background: var(--good-pale); }
.why-box { margin: 8px 0 24px; padding: 15px; border-radius: 14px; background: var(--surface-2); }
.why-box strong { display: block; margin-bottom: 7px; font-size: .84rem; }
.why-list { display: flex; flex-wrap: wrap; gap: 6px 12px; margin: 0; padding: 0; list-style: none; color: var(--ink-soft); font-size: .83rem; }
.why-list li::before { content: "✓"; margin-right: 6px; color: var(--good); font-weight: 900; }
.recipe-summary { color: var(--ink-soft); }
.commit-actions { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin-top: auto; }
.commit-actions .button-primary { min-height: 52px; }
.reject-row { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 13px; color: var(--ink-soft); font-size: .8rem; }
.alternatives { margin-top: 40px; }
.alternatives-header { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 15px; }
.alternative-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }

/* Recipe cards */
.recipe-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.recipe-card { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); transition: transform .16s ease, box-shadow .16s ease; }
.recipe-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.recipe-card-image { position: relative; width: 100%; aspect-ratio: 4 / 3; overflow: hidden; padding: 0; border: 0; background: var(--surface-3); cursor: pointer; }
.recipe-card-image img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s ease; }
.recipe-card:hover .recipe-card-image img { transform: scale(1.025); }
.recipe-card-body { padding: 16px; }
.recipe-card h3 { min-height: 2.5em; margin-bottom: 9px; font-size: 1.05rem; }
.recipe-card-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.recipe-card-actions { display: flex; gap: 8px; margin-top: 14px; }
.recipe-card-actions .button:first-child { flex: 1; }
.recipe-card.compact { display: grid; grid-template-columns: 150px 1fr; }
.recipe-card.compact .recipe-card-image { aspect-ratio: auto; min-height: 190px; }
.recipe-card.compact .recipe-card-body { display: flex; flex-direction: column; }

/* Planner */
.planner-layout { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 24px; align-items: start; }
.planner-form { position: sticky; top: 96px; padding: 20px; }
.control-group { margin-bottom: 20px; }
.control-group > label:first-child, .control-label { display: block; margin-bottom: 9px; font-size: .83rem; font-weight: 790; }
.segmented { display: flex; gap: 5px; padding: 4px; border-radius: 12px; background: var(--surface-3); }
.segmented button { flex: 1; min-width: 0; padding: 8px 7px; border: 0; border-radius: 9px; color: var(--ink-soft); background: transparent; font-size: .79rem; font-weight: 720; cursor: pointer; }
.segmented button.is-selected { color: var(--ink); background: var(--surface); box-shadow: var(--shadow-sm); }
.toggle-list { display: grid; gap: 8px; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 11px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); cursor: pointer; }
.toggle-row input { width: 18px; min-height: 18px; accent-color: var(--brand); }
.plan-workspace { min-width: 0; }
.plan-empty { display: grid; min-height: 480px; place-content: center; justify-items: center; padding: 35px; border: 1px dashed #b9c5bd; border-radius: var(--radius-lg); color: var(--ink-soft); text-align: center; background: rgb(255 253 248 / 55%); }
.plan-empty svg { width: 72px; margin-bottom: 14px; color: var(--brand-2); }
.plan-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 16px; }
.plan-toolbar h2 { margin: 0; }
.plan-status { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 7px; }
.week-grid { display: grid; gap: 14px; }
.day-row { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.day-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); background: #f8f7f1; }
.day-header strong { font-size: .95rem; }
.day-meals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.meal-slot { display: grid; grid-template-columns: 78px minmax(0, 1fr); gap: 12px; min-height: 112px; padding: 13px; border-right: 1px solid var(--line); }
.meal-slot:last-child { border-right: 0; }
.meal-thumb { width: 78px; height: 78px; overflow: hidden; padding: 0; border: 0; border-radius: 12px; background: var(--surface-3); cursor: pointer; }
.meal-thumb img { width: 100%; height: 100%; object-fit: cover; }
.meal-slot-content { min-width: 0; }
.meal-label { color: var(--accent-dark); font-size: .67rem; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.meal-slot h3 { display: -webkit-box; overflow: hidden; margin: 3px 0 7px; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.slot-meta { color: var(--ink-soft); font-size: .74rem; }
.slot-actions { display: flex; gap: 5px; margin-top: 9px; }
.slot-action { padding: 3px 0; border: 0; color: var(--brand-2); background: transparent; font-size: .72rem; font-weight: 720; cursor: pointer; }
.slot-action + .slot-action::before { content: "·"; margin-right: 6px; color: #9aa7a0; }
.saved-plan-list { display: grid; gap: 8px; margin-top: 18px; }
.saved-plan { display: grid; gap: 2px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); text-align: left; background: var(--surface); cursor: pointer; }
.saved-plan:hover { border-color: #aab9b0; }
.saved-plan small { color: var(--ink-soft); }

/* Grocery */
.grocery-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 20px; }
.grocery-progress { min-width: 210px; color: var(--ink-soft); font-size: .82rem; }
.grocery-progress progress { width: 100%; }
.grocery-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.aisle-card { overflow: hidden; }
.aisle-header { display: flex; align-items: center; justify-content: space-between; padding: 13px 16px; border-bottom: 1px solid var(--line); background: #f8f7f1; }
.aisle-header h2 { margin: 0; font-size: 1rem; }
.aisle-header span { color: var(--ink-soft); font-size: .75rem; }
.grocery-items { margin: 0; padding: 0; list-style: none; }
.grocery-item { border-bottom: 1px solid #edf0eb; }
.grocery-item:last-child { border-bottom: 0; }
.grocery-check { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 10px; align-items: start; width: 100%; padding: 12px 15px; cursor: pointer; }
.grocery-check input { width: 19px; min-height: 19px; margin-top: 2px; accent-color: var(--brand); }
.grocery-check strong { display: block; font-size: .9rem; }
.grocery-check small { color: var(--ink-soft); font-size: .7rem; }
.grocery-amount { color: var(--ink); font-size: .83rem; font-weight: 760; text-align: right; }
.grocery-check:has(input:checked) { opacity: .52; }
.grocery-check:has(input:checked) strong, .grocery-check:has(input:checked) .grocery-amount { text-decoration: line-through; }
.grocery-note { margin-top: 18px; padding: 13px 15px; border-radius: 12px; color: var(--ink-soft); background: var(--surface-3); font-size: .82rem; }

/* Recipe library */
.recipe-toolbar { display: grid; grid-template-columns: minmax(250px, 1fr) auto; gap: 12px; margin-bottom: 17px; }
.search-box { position: relative; }
.search-box input { padding-left: 41px; }
.search-box::before { content: "⌕"; position: absolute; left: 14px; top: 8px; z-index: 1; color: var(--ink-soft); font-size: 1.25rem; }
.filter-toggle { white-space: nowrap; }
.filter-panel { margin-bottom: 20px; padding: 17px; }
.filter-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.library-count { margin: 0 0 13px; color: var(--ink-soft); font-size: .83rem; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 28px; }

/* Preferences */
.preferences-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
.preference-card { margin-bottom: 15px; padding: 21px; }
.preference-card h2 { font-size: 1.1rem; }
.chip-list { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-chip { padding: 8px 11px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink-soft); background: var(--surface); font-size: .78rem; font-weight: 700; cursor: pointer; }
.filter-chip:hover { border-color: #a8b7ae; }
.filter-chip.is-selected { border-color: var(--brand-2); color: var(--brand); background: var(--brand-pale); }
.tag-editor { display: flex; gap: 8px; margin-bottom: 9px; }
.tag-editor input { flex: 1; }
.tag-list { display: flex; flex-wrap: wrap; gap: 7px; }
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 999px; color: var(--ink); background: var(--surface-3); font-size: .76rem; }
.tag button { display: grid; width: 18px; height: 18px; place-items: center; padding: 0; border: 0; border-radius: 50%; color: var(--ink-soft); background: #d6ded7; cursor: pointer; }
.preference-summary { position: sticky; top: 96px; padding: 20px; }
.preference-summary ul { margin: 13px 0 18px; padding-left: 20px; color: var(--ink-soft); font-size: .85rem; }

/* Research */
.research-hero { padding: 34px; border-radius: var(--radius-lg); color: white; background: var(--brand); }
.research-hero h1 { max-width: 820px; }
.research-hero .lead { color: rgb(255 255 255 / 76%); }
.research-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px; margin-top: 22px; }
.research-card { padding: 22px; }
.research-card .number { display: grid; width: 35px; height: 35px; margin-bottom: 14px; place-items: center; border-radius: 11px; color: var(--accent-dark); background: var(--accent-pale); font-weight: 900; }
.research-card p { margin-bottom: 0; color: var(--ink-soft); }
.evidence-note { margin-top: 22px; padding: 20px; border-left: 4px solid var(--accent); border-radius: 0 var(--radius) var(--radius) 0; background: var(--surface); }

/* Recipe detail modal */
.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgb(13 30 26 / 70%); backdrop-filter: blur(6px); }
.modal { position: relative; width: min(920px, 100%); max-height: min(900px, calc(100vh - 30px)); overflow: auto; border-radius: var(--radius-lg); background: var(--surface); box-shadow: 0 24px 80px rgb(0 0 0 / 30%); }
.modal-small { width: min(500px, 100%); }
.modal-close { position: sticky; top: 14px; z-index: 2; float: right; display: grid; width: 42px; height: 42px; margin: 14px 14px -56px 0; place-items: center; border: 1px solid rgb(255 255 255 / 65%); border-radius: 50%; color: white; background: rgb(23 49 43 / 70%); backdrop-filter: blur(8px); cursor: pointer; }
.modal-content { clear: both; }
.recipe-detail-image { width: 100%; max-height: 430px; object-fit: cover; background: var(--surface-3); }
.recipe-detail-body { padding: clamp(22px, 4vw, 42px); }
.recipe-detail-title-row { display: flex; align-items: start; justify-content: space-between; gap: 16px; }
.recipe-detail-title-row h1 { margin-bottom: 4px; font-size: clamp(2rem, 4vw, 3.4rem); }
.servings-control { display: flex; flex: 0 0 auto; align-items: center; gap: 9px; padding: 5px; border-radius: 999px; background: var(--surface-3); }
.servings-control button { display: grid; width: 32px; height: 32px; place-items: center; border: 0; border-radius: 50%; color: var(--ink); background: var(--surface); cursor: pointer; }
.servings-control strong { min-width: 60px; text-align: center; font-size: .8rem; }
.recipe-detail-grid { display: grid; grid-template-columns: minmax(0, .82fr) minmax(0, 1.18fr); gap: clamp(25px, 5vw, 56px); margin-top: 28px; }
.ingredient-list, .instruction-list { margin: 0; padding: 0; list-style: none; }
.ingredient-list li { display: grid; grid-template-columns: minmax(80px, .45fr) 1fr; gap: 12px; padding: 9px 0; border-bottom: 1px solid #e7ebe5; font-size: .88rem; }
.ingredient-list .measure { color: var(--brand-2); font-weight: 760; }
.instruction-list { counter-reset: step; }
.instruction-list li { position: relative; min-height: 36px; padding: 0 0 20px 45px; color: #344942; }
.instruction-list li::before { counter-increment: step; content: counter(step); position: absolute; top: -2px; left: 0; display: grid; width: 29px; height: 29px; place-items: center; border-radius: 10px; color: white; background: var(--brand); font-size: .76rem; font-weight: 850; }
.accuracy-panel { margin-top: 28px; padding: 15px; border-radius: 13px; background: var(--surface-3); }
.accuracy-panel summary { font-weight: 760; cursor: pointer; }
.accuracy-panel p { margin: 10px 0 0; color: var(--ink-soft); font-size: .81rem; }
.modal-form { padding: 28px; }
.modal-form h2 { margin-bottom: 7px; }
.modal-form .lead { margin-bottom: 20px; font-size: .95rem; }
.auth-switch { margin-top: 15px; text-align: center; color: var(--ink-soft); font-size: .82rem; }
.reason-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin: 18px 0; }

/* Account menu */
.account-panel { padding: 26px; }
.account-panel-header { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.account-panel-header .account-avatar { width: 48px; height: 48px; font-size: 1rem; }
.account-links { display: grid; gap: 8px; }
.account-links a, .account-links button { display: flex; width: 100%; justify-content: space-between; padding: 11px 12px; border: 1px solid var(--line); border-radius: 11px; color: var(--ink); text-align: left; text-decoration: none; background: var(--surface); cursor: pointer; }

/* Empty/import states */
.empty-state { display: grid; min-height: 400px; place-content: center; justify-items: center; padding: 30px; text-align: center; }
.empty-state img { width: min(320px, 80%); margin-bottom: 15px; }
.empty-state p { max-width: 520px; color: var(--ink-soft); }
.import-required { width: min(700px, calc(100% - 40px)); margin: 70px auto; padding: 30px; }

/* Toast */
.toast-root { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: grid; width: min(380px, calc(100% - 36px)); gap: 8px; }
.toast { padding: 12px 14px; border: 1px solid var(--line); border-radius: 13px; color: var(--ink); background: var(--surface); box-shadow: var(--shadow); animation: toast-in .18s ease-out; }
.toast.error { border-color: #e2aaa4; color: var(--danger); background: var(--danger-pale); }
.toast.success { border-color: #b2d2bf; color: var(--good); background: var(--good-pale); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* Setup */
.setup-body { min-height: 100vh; background: radial-gradient(circle at 75% 5%, rgb(230 109 73 / 14%), transparent 30%), var(--surface-2); }
.setup-shell { width: min(850px, calc(100% - 32px)); margin: 0 auto; padding: 48px 0; }
.setup-card { padding: clamp(22px, 5vw, 46px); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow); }
.setup-card-small { width: min(500px, 100%); margin: 8vh auto 0; }
.brand-lockup { display: flex; align-items: center; gap: 10px; margin-bottom: 35px; }
.brand-mark { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 13px; color: white; background: var(--brand); font-weight: 900; }
.brand-lockup > div { display: grid; line-height: 1.15; }
.brand-lockup span:last-child { color: var(--ink-soft); font-size: .74rem; }
.setup-intro { max-width: 700px; color: var(--ink-soft); }
.requirement-grid { display: flex; flex-wrap: wrap; gap: 7px; margin: 20px 0 26px; }
.requirement { display: inline-flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 999px; font-size: .7rem; font-weight: 720; }
.requirement.is-good { color: var(--good); background: var(--good-pale); }
.requirement.is-bad { color: var(--danger); background: var(--danger-pale); }
.setup-form { display: grid; gap: 22px; }
.setup-form fieldset { padding: 19px; border: 1px solid var(--line); border-radius: 15px; }
.setup-topbar { display: flex; align-items: start; justify-content: space-between; gap: 15px; }
.import-meter { margin: 25px 0 16px; padding: 18px; border-radius: 15px; background: var(--surface-3); }
.import-meter-head { display: flex; justify-content: space-between; margin-bottom: 9px; font-size: .87rem; }
.progress-track, progress { width: 100%; height: 10px; overflow: hidden; border: 0; border-radius: 999px; background: #d0d9d2; }
progress::-webkit-progress-bar { border-radius: 999px; background: #d0d9d2; }
progress::-webkit-progress-value { border-radius: 999px; background: var(--accent); }
progress::-moz-progress-bar { border-radius: 999px; background: var(--accent); }
.import-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.import-stats div { padding: 14px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); }
.import-stats span { display: block; color: var(--ink-soft); font-size: .72rem; }
.import-stats strong { font-size: 1.25rem; }
.import-message { min-height: 24px; color: var(--ink-soft); font-size: .85rem; }
.setup-details { margin-top: 15px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 12px; }
.setup-details summary { font-weight: 750; cursor: pointer; }
.setup-details p { margin: 10px 0 0; color: var(--ink-soft); font-size: .82rem; }
.setup-footer { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line); font-size: .8rem; }

.mobile-nav { display: none; }
.noscript { position: fixed; inset: auto 20px 20px; z-index: 300; padding: 14px; border-radius: 12px; color: white; background: var(--danger); }

@media (max-width: 980px) {
  .site-header { grid-template-columns: 1fr auto; padding-inline: 20px; }
  .desktop-nav { display: none; }
  .decision-shell { grid-template-columns: 1fr; min-height: auto; padding-top: 42px; }
  .decision-copy { text-align: center; }
  .decision-copy .lead { margin-inline: auto; }
  .trust-strip { justify-content: center; }
  .decision-panel { width: min(600px, 100%); margin: 0 auto; }
  .hero-recipe { grid-template-columns: 1fr; }
  .hero-recipe-image { min-height: 380px; max-height: 500px; }
  .planner-layout { grid-template-columns: 1fr; }
  .planner-form, .preference-summary { position: static; }
  .planner-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .planner-form .button-wide, .planner-form .saved-plan-list, .planner-form > h2, .planner-form > p { grid-column: 1 / -1; }
  .recipe-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .preferences-layout { grid-template-columns: 1fr; }
  .day-meals { grid-template-columns: 1fr; }
  .meal-slot { border-right: 0; border-bottom: 1px solid var(--line); }
  .meal-slot:last-child { border-bottom: 0; }
}

@media (max-width: 700px) {
  body { padding-bottom: calc(67px + env(safe-area-inset-bottom)); }
  .site-header { min-height: 62px; padding: 8px 14px; }
  .brand-symbol { width: 38px; height: 38px; }
  .site-brand small { display: none; }
  .site-brand strong { font-size: .92rem; }
  .account-button { padding-right: 6px; }
  .account-label { display: none; }
  .mobile-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 60;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    min-height: calc(62px + env(safe-area-inset-bottom));
    padding: 5px 7px env(safe-area-inset-bottom);
    border-top: 1px solid var(--line);
    background: rgb(255 253 248 / 96%);
    backdrop-filter: blur(15px);
  }
  .mobile-nav a { display: grid; place-content: center; justify-items: center; gap: 2px; border-radius: 10px; color: var(--ink-soft); text-decoration: none; }
  .mobile-nav a > span { font-size: 1.25rem; line-height: 1; }
  .mobile-nav small { font-size: .64rem; font-weight: 700; }
  .mobile-nav a.is-active { color: var(--brand); background: var(--brand-pale); }
  .page-shell, .recommendation-shell { width: min(100% - 24px, var(--content)); padding-top: 28px; }
  .page-header, .result-heading, .plan-toolbar { align-items: start; flex-direction: column; }
  h1 { font-size: clamp(2.2rem, 12vw, 3.4rem); }
  .decision-shell { width: min(100% - 24px, 1120px); gap: 28px; padding: 30px 0 42px; }
  .decision-copy h1 { font-size: clamp(2.45rem, 13vw, 4rem); }
  .decision-copy .lead { font-size: .98rem; }
  .trust-strip { display: none; }
  .decision-panel { padding: 20px; border-radius: 22px; }
  .choice-grid.choice-grid-3 { grid-template-columns: 1fr; }
  .choice-grid.choice-grid-3 .choice-button { min-height: 70px; }
  .decision-footer { align-items: stretch; flex-direction: column-reverse; }
  .decision-footer .button { width: 100%; }
  .hero-recipe-image { min-height: 290px; }
  .hero-recipe-content { padding: 22px; }
  .hero-recipe-content h2 { font-size: 2.2rem; }
  .commit-actions { grid-template-columns: 1fr; }
  .alternative-grid, .recipe-grid, .grocery-grid, .research-grid { grid-template-columns: 1fr; }
  .recipe-card.compact { grid-template-columns: 115px 1fr; }
  .recipe-card.compact .recipe-card-image { min-height: 170px; }
  .planner-form { display: block; }
  .planner-form > * { margin-bottom: 16px; }
  .form-grid, .filter-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .recipe-toolbar { grid-template-columns: 1fr; }
  .filter-toggle { width: 100%; }
  .recipe-detail-title-row { display: block; }
  .servings-control { width: max-content; margin-top: 14px; }
  .recipe-detail-grid { grid-template-columns: 1fr; }
  .ingredient-list li { grid-template-columns: 100px 1fr; }
  .modal-backdrop { padding: 0; place-items: end center; }
  .modal { width: 100%; max-height: calc(100vh - 15px); border-radius: 24px 24px 0 0; }
  .modal-small { width: 100%; }
  .reason-grid { grid-template-columns: 1fr; }
  .inline-form { align-items: stretch; flex-direction: column; }
  .setup-shell { width: min(100% - 20px, 850px); padding: 18px 0; }
  .setup-card { padding: 20px; border-radius: 20px; }
  .import-stats { grid-template-columns: 1fr; }
  .setup-footer { align-items: start; flex-direction: column; }
  .toast-root { right: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); width: calc(100% - 24px); }
}

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

@media print {
  .site-header, .mobile-nav, .grocery-toolbar .button-row, .toast-root, .grocery-note, .page-header .button-row { display: none !important; }
  body { padding: 0; background: white; }
  .page-shell { width: 100%; padding: 0; }
  .grocery-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .aisle-card { break-inside: avoid; box-shadow: none; }
  .grocery-check { padding: 7px 10px; }
}

.meal-slot-labels {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}

.pill.warning {
  background: var(--warning-pale);
  color: var(--warning);
}
