:root {
  color-scheme: dark;
  --ink: #f8fafc;
  --muted: #94a3b8;
  --background: #0b1019;
  --panel: #121824;
  --panel-soft: #182131;
  --line: #263245;
  --accent: #10b981;
  --accent-bright: #45e6ae;
  --accent-soft: rgba(16, 185, 129, 0.12);
  --error: #fb7185;
  --warning: #fbbf24;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { min-height: 100vh; margin: 0; background: radial-gradient(circle at 80% 0%, #14263a 0, transparent 32rem), var(--background); color: var(--ink); }
button, input, select { font: inherit; }
button, label, input, select { -webkit-tap-highlight-color: transparent; }
button { color: inherit; touch-action: manipulation; }
a { color: inherit; }
[hidden] { display: none !important; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 20; top: 10px; left: 10px; padding: 10px 14px; transform: translateY(-160%); border-radius: 6px; background: var(--accent); color: #04120d; font-weight: 900; }
.skip-link:focus { transform: translateY(0); }
:focus-visible { outline: 3px solid rgba(69, 230, 174, 0.65); outline-offset: 3px; }

.site-header,
main,
footer { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }

.site-header { display: flex; min-height: 76px; align-items: center; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--line); }
.site-header > p { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--muted); font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 16px var(--accent); }
.brand { display: inline-flex; align-items: center; gap: 11px; font-size: 1.05rem; font-weight: 850; text-decoration: none; }
.brand small { color: var(--muted); font-size: 0.76em; font-weight: 650; }
.brand-mark { display: grid; width: 34px; height: 34px; place-items: center; border: 1px solid rgba(69, 230, 174, 0.45); border-radius: 9px; background: var(--accent-soft); color: var(--accent-bright); font-size: 0.9rem; }

.hero { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 70px; align-items: end; padding: clamp(76px, 11vw, 150px) 0 90px; }
.eyebrow, .section-number { margin: 0 0 15px; color: var(--accent-bright); font-size: 0.7rem; font-weight: 850; letter-spacing: 0.14em; text-transform: uppercase; }
h1, h2, h3 { margin-top: 0; letter-spacing: -0.045em; }
h1 { max-width: 850px; margin-bottom: 28px; font-size: clamp(3.3rem, 7.4vw, 7rem); line-height: 0.93; }
h1 em { color: var(--accent-bright); font-style: normal; }
.hero-copy { max-width: 650px; margin: 0; color: var(--muted); font-size: 1.05rem; line-height: 1.75; }
.hero-readout { display: grid; grid-template-columns: 34px 1fr; gap: 0 14px; padding: 22px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.hero-readout span { color: var(--accent-bright); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.72rem; font-weight: 800; }
.hero-readout p { margin: 0 0 14px; color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; }
.hero-readout p:last-child { margin-bottom: 0; }

.app-status { margin-bottom: 24px; padding: 13px 16px; border: 1px solid var(--line); border-left: 3px solid var(--warning); border-radius: 7px; background: var(--panel); color: var(--muted); font-size: 0.86rem; }
.app-status.success { border-left-color: var(--accent); color: #b8ead9; }
.app-status.error { border-left-color: var(--error); color: #fecdd3; }

.preset-section { margin: 44px 0 24px; }
.preset-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.preset-card { display: grid; gap: 8px; min-height: 150px; padding: 22px; border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(145deg, var(--panel-soft), var(--panel)); cursor: pointer; text-align: left; transition: border-color 130ms ease, transform 130ms ease; }
.preset-card:hover { transform: translateY(-2px); border-color: rgba(69, 230, 174, 0.55); }
.preset-card[data-active="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.25); }
.preset-card span { color: var(--accent-bright); font-size: 0.7rem; font-weight: 850; letter-spacing: 0.09em; text-transform: uppercase; }
.preset-card strong { align-self: end; font-size: 1.35rem; }
.preset-card small { color: var(--muted); font: 0.69rem ui-monospace, SFMono-Regular, Menlo, monospace; }

.panel { margin-bottom: 24px; padding: clamp(24px, 4vw, 42px); border: 1px solid var(--line); border-radius: 16px; background: rgba(18, 24, 36, 0.9); box-shadow: 0 24px 80px rgba(0, 0, 0, 0.18); }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.section-heading h2 { margin: 0; font-size: clamp(1.8rem, 3.6vw, 3rem); }
.section-heading > p { margin: 0 0 4px; color: var(--muted); font: 700 0.76rem ui-monospace, SFMono-Regular, Menlo, monospace; text-transform: uppercase; }
.section-intro { max-width: 690px; margin: 22px 0 26px; color: var(--muted); line-height: 1.7; }

.flow-switch { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 26px 0; }
.flow-switch label, .choice-group label { cursor: pointer; }
.flow-switch input, .choice-group input { position: absolute; opacity: 0; pointer-events: none; }
.flow-switch span, .choice-group span { display: grid; min-height: 52px; place-items: center; padding: 10px 15px; border: 1px solid var(--line); border-radius: 8px; background: var(--background); color: var(--muted); font-size: 0.82rem; font-weight: 800; text-align: center; }
.flow-switch input:checked + span, .choice-group input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-bright); box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.18); }
.flow-switch input:focus-visible + span, .choice-group input:focus-visible + span { outline: 3px solid rgba(69, 230, 174, 0.65); outline-offset: 3px; }

.calculator-shell { width: min(720px, 100%); margin: 30px auto 4px; padding: clamp(22px, 4vw, 36px); border: 1px solid rgba(69, 230, 174, 0.3); border-radius: 18px; background: linear-gradient(145deg, #172333, #0d141f); box-shadow: 0 28px 70px rgba(0, 0, 0, 0.28); }
.calculator-progress { display: grid; grid-template-columns: auto minmax(120px, 1fr); gap: 18px; align-items: center; color: var(--muted); font: 750 0.68rem ui-monospace, SFMono-Regular, Menlo, monospace; text-transform: uppercase; }
.calculator-chat { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px; align-items: start; margin: 28px 0 22px; }
.calculator-avatar { display: grid; width: 40px; height: 40px; place-items: center; border: 1px solid rgba(69, 230, 174, 0.5); border-radius: 12px; background: var(--accent-soft); color: var(--accent-bright); font-weight: 900; }
.calculator-message { padding: 16px 18px; border-radius: 4px 16px 16px; background: var(--panel-soft); }
.calculator-message p { margin: 0; font-size: clamp(1.05rem, 2vw, 1.35rem); font-weight: 850; letter-spacing: -0.025em; }
.calculator-message small { display: block; margin-top: 7px; color: var(--muted); font-size: 0.72rem; line-height: 1.55; }
.calculator-answer { display: grid; gap: 9px; }
.calculator-choice { cursor: pointer; }
.calculator-choice input { position: absolute; opacity: 0; pointer-events: none; }
.calculator-choice > span { display: grid; gap: 3px; min-height: 62px; padding: 13px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--background); transition: border-color 130ms ease, background 130ms ease; }
.calculator-choice strong { font-size: 0.82rem; }
.calculator-choice small { color: var(--muted); font-size: 0.68rem; line-height: 1.45; }
.calculator-choice input:checked + span { border-color: var(--accent); background: var(--accent-soft); }
.calculator-choice input:focus-visible + span { outline: 3px solid rgba(69, 230, 174, 0.65); outline-offset: 3px; }
.calculator-number { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; color: var(--muted); font-size: 0.8rem; font-weight: 800; }
.calculator-number input { margin: 0; font-size: 1.05rem; }
.calculator-error { min-height: 20px; margin: 10px 0 0; color: var(--error); font-size: 0.72rem; }
.calculator-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 10px; }
.calculator-actions .text-button { min-height: 44px; padding: 0 10px; }
.calculator-actions .text-button:disabled { cursor: not-allowed; opacity: 0.35; }
.calculator-result { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.calculator-result div { min-width: 0; padding: 14px 8px; border-radius: 9px; background: var(--background); text-align: center; }
.calculator-result span, .calculator-result small { display: block; color: var(--muted); font-size: 0.58rem; text-transform: uppercase; }
.calculator-result strong { display: block; margin: 5px 0 2px; font: 850 1.05rem ui-monospace, SFMono-Regular, Menlo, monospace; }

fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.field-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.field-grid label, .custom-preference { color: var(--ink); font-size: 0.78rem; font-weight: 800; }
.field-grid label > span { float: right; color: var(--muted); font-size: 0.68rem; font-weight: 650; text-transform: uppercase; }
input[type="number"], input[type="text"], input[type="url"], input[type="search"], select { width: 100%; min-height: 50px; margin-top: 8px; padding: 0 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--background); color: var(--ink); outline: none; }
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.form-action-row { display: flex; align-items: center; gap: 20px; margin-top: 20px; }
.form-action-row p { margin: 0; color: var(--muted); font-size: 0.76rem; line-height: 1.5; }
.primary-button, .secondary-button { min-height: 50px; padding: 0 20px; border-radius: 8px; cursor: pointer; font-weight: 850; transition: transform 130ms ease, filter 130ms ease, background 130ms ease; }
.primary-button { border: 0; background: var(--accent); color: #04140e; }
.secondary-button { border: 1px solid var(--accent); background: transparent; color: var(--accent-bright); }
.primary-button:hover, .secondary-button:hover { transform: translateY(-1px); filter: brightness(1.08); }
.primary-button:disabled { cursor: not-allowed; opacity: 0.45; transform: none; }

.compact-heading { margin-bottom: 24px; }
.choice-group { display: grid; grid-template-columns: 130px repeat(4, minmax(0, 1fr)); gap: 10px; align-items: center; margin-top: 14px; }
.choice-group legend { float: left; width: 130px; color: var(--muted); font-size: 0.76rem; font-weight: 800; text-transform: uppercase; }
.choice-group legend + label { clear: none; }
.filter-group { margin-top: 12px; }
.custom-preference { display: block; max-width: 680px; margin-top: 22px; }

.builder-layout { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(340px, 0.75fr); gap: 24px; margin: 70px 0; }
.ingredient-browser { min-width: 0; }
.food-search { margin: 0 0 22px; padding: 20px; border: 1px solid rgba(69, 230, 174, 0.3); border-radius: 14px; background: linear-gradient(145deg, #172333, var(--panel)); }
.food-search-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; }
.food-search-heading .section-number { margin-bottom: 5px; }
.food-search-heading h3 { margin: 0; font-size: 1.35rem; }
.food-search-heading > span { color: var(--accent-bright); font: 750 0.66rem ui-monospace, SFMono-Regular, Menlo, monospace; text-transform: uppercase; }
.food-search-label { display: block; margin-top: 18px; color: var(--muted); font-size: 0.7rem; font-weight: 800; text-transform: uppercase; }
.food-search-control { position: relative; }
.food-search-control input { padding-right: 46px; }
.food-search-loader { position: absolute; top: 24px; right: 16px; width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--accent-bright); border-radius: 50%; animation: search-spin 700ms linear infinite; }
.food-search-status, .food-source { color: var(--muted); font-size: 0.68rem; line-height: 1.5; }
.food-search-status { min-height: 20px; margin: 9px 0; }
.food-source { margin: 12px 0 0; }
.food-search-results { display: grid; gap: 8px; }
.food-search-result { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(170px, 0.8fr) auto; gap: 12px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--background); }
.food-search-identity { display: grid; gap: 3px; min-width: 0; }
.food-search-identity strong { overflow: hidden; font-size: 0.78rem; text-overflow: ellipsis; white-space: nowrap; }
.food-search-identity small, .food-search-macros { color: var(--muted); font-size: 0.62rem; }
.food-search-macros { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.food-search-result .secondary-button { min-height: 38px; padding: 0 14px; font-size: 0.7rem; }
@keyframes search-spin { to { transform: rotate(360deg); } }
.ingredient-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.ingredient-card { min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); content-visibility: auto; contain-intrinsic-size: auto 210px; }
.ingredient-category { margin: 0 0 10px; color: var(--accent-bright); font-size: 0.65rem; font-weight: 850; text-transform: uppercase; letter-spacing: 0.12em; }
.ingredient-card h3 { margin: 0 0 4px; font-size: 1.1rem; letter-spacing: -0.02em; }
.serving-label { margin: 0; color: var(--muted); font-size: 0.72rem; }
.ingredient-macros { display: flex; gap: 14px; margin: 20px 0; color: var(--muted); font: 0.7rem ui-monospace, SFMono-Regular, Menlo, monospace; }
.ingredient-macros strong { color: var(--ink); }
.ingredient-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 14px; border-top: 1px solid var(--line); font: 0.78rem ui-monospace, SFMono-Regular, Menlo, monospace; }
.add-button, .text-button { border: 0; background: transparent; color: var(--accent-bright); cursor: pointer; font-size: 0.76rem; font-weight: 850; }
.add-button:hover, .text-button:hover { text-decoration: underline; text-underline-offset: 3px; }

.plan-sidebar { min-width: 0; }
.sticky-plan { position: sticky; top: 16px; padding: 26px; border: 1px solid rgba(69, 230, 174, 0.28); border-radius: 16px; background: linear-gradient(150deg, #152334, var(--panel)); box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28); }
.plan-heading { padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.plan-heading h2 { margin: 0; font-size: 1.8rem; }
.selected-items { display: grid; gap: 8px; margin-top: 16px; }
.selected-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.selected-row > div:first-child { display: grid; gap: 3px; min-width: 0; }
.selected-row strong { overflow: hidden; font-size: 0.78rem; text-overflow: ellipsis; white-space: nowrap; }
.selected-row span { color: var(--muted); font-size: 0.65rem; }
.quantity-controls { display: flex; align-items: center; gap: 7px; }
.quantity-controls button { display: grid; min-width: 28px; height: 28px; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: var(--background); cursor: pointer; }
.quantity-controls output { min-width: 30px; font: 700 0.7rem ui-monospace, SFMono-Regular, Menlo, monospace; text-align: center; }
.quantity-controls .remove-button { width: auto; padding: 0 5px; border: 0; background: transparent; color: var(--error); font-size: 0.63rem; }
.empty-message { margin: 18px 0 0; padding: 16px; border: 1px dashed var(--line); border-radius: 8px; color: var(--muted); font-size: 0.8rem; text-align: center; }

.macro-totals { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 22px 0; }
.macro-totals div { min-width: 0; padding: 12px 8px; border-radius: 8px; background: var(--background); text-align: center; }
.macro-totals span, .macro-totals small { display: block; overflow: hidden; color: var(--muted); font-size: 0.58rem; text-overflow: ellipsis; text-transform: uppercase; }
.macro-totals strong { display: block; margin: 4px 0 2px; overflow: hidden; font: 800 1rem ui-monospace, SFMono-Regular, Menlo, monospace; text-overflow: ellipsis; }
.goal-block { padding-top: 20px; border-top: 1px solid var(--line); }
.goal-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.goal-heading h3 { margin: 0; font-size: 1rem; letter-spacing: -0.02em; }
.goal-heading p { margin: 0; color: var(--muted); font-size: 0.65rem; text-transform: uppercase; }
.goal-row { margin-top: 15px; }
.goal-row > div { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 7px; font-size: 0.68rem; }
.goal-row output { color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
progress { display: block; width: 100%; height: 8px; overflow: hidden; border: 0; border-radius: 999px; background: var(--background); }
progress::-webkit-progress-bar { background: var(--background); }
progress::-webkit-progress-value { border-radius: 999px; background: var(--accent); }
progress::-moz-progress-bar { border-radius: 999px; background: var(--accent); }
progress[data-over="true"]::-webkit-progress-value { background: var(--warning); }
progress[data-over="true"]::-moz-progress-bar { background: var(--warning); }

.results-section { margin: 70px 0; }
.results-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-top: 24px; }
.shopping-card, .saved-card, .checkout-card { min-width: 0; padding: clamp(22px, 3vw, 32px); border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.saved-card { grid-column: 1 / -1; }
.card-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 15px; }
.card-heading h3 { margin: 0; font-size: 1.5rem; }
.card-heading span { color: var(--accent-bright); font-size: 0.7rem; font-weight: 800; text-transform: uppercase; }
#shopping-list, .page-excerpt { max-width: 100%; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
#shopping-list { min-height: 190px; margin: 20px 0; padding: 18px; border: 1px solid var(--line); border-radius: 8px; background: var(--background); color: #d7e2ed; font: 0.75rem/1.7 ui-monospace, SFMono-Regular, Menlo, monospace; }
.plain-list { margin: 18px 0; color: var(--muted); font-size: 0.75rem; }
.plain-list summary { cursor: pointer; font-weight: 800; }
.plain-list #shopping-list { min-height: 90px; margin-bottom: 0; }
.basket-items { display: grid; gap: 8px; margin-top: 20px; }
.basket-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 13px; border: 1px solid var(--line); border-radius: 9px; background: var(--background); cursor: pointer; }
.basket-row input { width: 18px; height: 18px; accent-color: var(--accent); }
.basket-row span { display: grid; gap: 2px; min-width: 0; }
.basket-row strong { font-size: 0.82rem; }
.basket-row small { overflow: hidden; color: var(--muted); font-size: 0.65rem; text-overflow: ellipsis; white-space: nowrap; }
.basket-row output { color: var(--accent-bright); font: 750 0.72rem ui-monospace, SFMono-Regular, Menlo, monospace; }
.basket-row:has(input:checked) { opacity: 0.58; }
.basket-row:has(input:checked) strong { text-decoration: line-through; }
.retailer-lock { display: grid; grid-template-columns: auto 1fr; gap: 16px; margin: 26px 0; padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--background); }
.retailer-logo { display: grid; width: 46px; height: 46px; place-items: center; border-radius: 12px; background: #38bdf8; color: #06131b; font-weight: 950; }
.retailer-lock strong { font-size: 0.92rem; }
.retailer-lock p { margin: 6px 0 0; color: var(--muted); font-size: 0.74rem; line-height: 1.55; }
.action-status { min-height: 20px; margin: 10px 0 0; color: var(--muted); font-size: 0.72rem; }
.save-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; margin-top: 20px; }
.save-form input { margin-top: 0; }
.saved-meals { display: grid; gap: 8px; margin-top: 10px; }
.saved-meal { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--background); }
.saved-meal > div { display: grid; gap: 3px; min-width: 0; }
.saved-meal strong { overflow: hidden; font-size: 0.78rem; text-overflow: ellipsis; white-space: nowrap; }
.saved-meal span { color: var(--muted); font-size: 0.65rem; }

footer { display: flex; justify-content: space-between; gap: 20px; padding: 30px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.75rem; }

@media (max-width: 1040px) {
  .hero { grid-template-columns: 1fr; gap: 44px; }
  .hero-readout { max-width: 420px; }
  .field-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .choice-group { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .choice-group legend { float: none; grid-column: 1 / -1; width: auto; margin-bottom: 2px; }
  .builder-layout { grid-template-columns: 1fr; }
  .sticky-plan { position: static; }
  .results-grid { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .site-header, main, footer { width: min(1180px, calc(100% - 28px)); }
  .site-header { min-height: 68px; }
  .site-header > p { display: none; }
  .hero { padding: 68px 0 62px; }
  h1 { font-size: clamp(3rem, 15vw, 5rem); }
  .section-heading { align-items: flex-start; flex-direction: column; gap: 8px; }
  .field-grid, .ingredient-grid, .results-grid { grid-template-columns: 1fr; }
  .food-search-result { grid-template-columns: minmax(0, 1fr) auto; }
  .food-search-macros { grid-column: 1 / -1; grid-row: 2; }
  .preset-grid { grid-template-columns: 1fr; }
  .preset-card { min-height: 125px; }
  .saved-card { grid-column: auto; }
  .form-action-row { align-items: stretch; flex-direction: column; }
  .form-action-row .primary-button { width: 100%; }
  .choice-group { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .calculator-shell { border-radius: 14px; }
  .calculator-result { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .builder-layout, .results-section { margin: 52px 0; }
  .save-form { grid-template-columns: 1fr; }
  .save-form .secondary-button { width: 100%; }
  input[type="number"], input[type="text"], input[type="search"], select { font-size: 1rem; }
  .quantity-controls button { min-width: 44px; height: 44px; }
  footer { flex-direction: column; }
}

@media (max-width: 400px) {
  .panel, .sticky-plan, .shopping-card, .saved-card, .checkout-card { padding: 20px; border-radius: 12px; }
  .flow-switch { grid-template-columns: 1fr; }
  .macro-totals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .selected-row { align-items: flex-start; flex-direction: column; }
  .quantity-controls { width: 100%; }
  .quantity-controls .remove-button { margin-left: auto; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}
