@font-face {
  font-family: Manrope;
  src: url('/fonts/manrope.ttf') format('truetype');
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

:root {
  font-family: Manrope, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.5;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  color: #28352e;
  background: #f7f6f2;
  --ink: #28352e;
  --accent: #344f40;
  --accent-dark: #253b2e;
  --border: #e4e4dc;
  --panel: #fff;
  --muted: #68735f;
  --light: #edf0e7;
  --paper: #f7f6f2;
  --danger: #af4037;
}

* { box-sizing: border-box; }
body { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button, a, input, select, textarea { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid #dfe2d7;
  border-radius: 10px;
  background: var(--panel);
  font-size: .82rem;
  font-weight: 550;
  line-height: 1.4;
  cursor: pointer;
  transition: background 160ms, border-color 160ms, box-shadow 160ms;
}
button:hover, .button:hover { background: #f0f3eb; border-color: #bcc7b1; text-decoration: none; }
button:disabled { opacity: .45; cursor: default; }
button.primary, .button.primary { color: #fff; background: var(--accent); border-color: var(--accent); }
button.primary:hover, .button.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
button.selected { color: var(--accent); background: #e5eadd; border-color: #d4dec8; }
button.danger { color: var(--danger); }
button.danger:hover { background: #fff2ee; border-color: #e7b9b0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.icon { flex-shrink: 0; vertical-align: middle; }
.icon-button { width: 40px; min-width: 40px; min-height: 40px; padding: 9px; border-color: transparent; background: transparent; }
.icon-button.bordered { border-color: #dfe2d7; background: var(--panel); }
.text-button { background: transparent; border-color: transparent; color: var(--muted); }
.text-button:hover { border-color: transparent; }
input, textarea, select {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  padding: 11px 13px;
  border: 1px solid #d9ded2;
  border-radius: 10px;
  background: var(--panel);
  font-size: .9rem;
  transition: border-color 150ms, box-shadow 150ms;
}
input::placeholder, textarea::placeholder { color: #858e7b; opacity: 1; }
select {
  appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2374786e' stroke-width='1.5' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  text-overflow: ellipsis;
}
input[type=checkbox] { width: 17px; min-height: 17px; height: 17px; margin: 0; accent-color: var(--accent); flex-shrink: 0; }
input:focus, textarea:focus, select:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px #344f4012; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
textarea { resize: vertical; min-height: 120px; line-height: 1.65; }
label { display: grid; gap: 7px; font-size: .76rem; font-weight: 550; color: var(--muted); }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { color: var(--ink); font-weight: 550; line-height: 1.25; letter-spacing: -.045em; text-wrap: balance; }
h1 { font-size: clamp(2rem, 3.6vw, 3.15rem); }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.05rem; }
p { line-height: 1.65; }
small { font-size: .75rem; line-height: 1.5; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { color: var(--muted); font-size: .76rem; font-weight: 550; margin-bottom: 10px; }
.muted { color: var(--muted); }

/* Workspace */
.app-shell { display: flex; flex-direction: column; min-height: 100svh; }
.app-shell[hidden] { display: none; }
.skip-link { position: fixed; top: -80px; left: 20px; z-index: 100; padding: 12px 18px; background: var(--accent); color: white; border-radius: 8px; }
.skip-link:focus { top: 12px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.app-header { position: sticky; top: 0; z-index: 8; background: #f7f6f2f2; border-bottom: 1px solid var(--border); backdrop-filter: blur(16px); }
.header-inner { max-width: 1320px; height: 86px; margin: auto; padding: 0 44px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 28px; }
.logo:hover { text-decoration: none; }
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); font-size: 1.85rem; font-weight: 650; letter-spacing: -.08em; white-space: nowrap; }
.brand-mark { display: grid; place-items: center; width: 33px; height: 36px; color: var(--accent); }
.brand-period { color: #c56543; }
.main-nav { display: flex; align-items: center; gap: 4px; padding: 5px; border-radius: 13px; background: #eceee6; }
.main-nav a { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 0 17px; border-radius: 9px; color: var(--muted); font-size: .8rem; font-weight: 550; white-space: nowrap; }
.main-nav a:hover { text-decoration: none; color: var(--accent); }
.main-nav a[aria-current=page] { color: var(--accent); background: var(--panel); box-shadow: 0 1px 4px #28352e0a; font-weight: 650; }
.account-link { display: flex; align-items: center; justify-self: end; gap: 10px; padding: 6px; border-radius: 10px; color: var(--ink); }
.account-link:hover, .account-link[aria-current=page] { background: #eceee6; text-decoration: none; }
.account-link strong { max-width: 125px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .78rem; font-weight: 550; }
.account-link > .icon { color: var(--muted); }
.avatar { display: inline-grid; place-items: center; width: 33px; height: 33px; flex-shrink: 0; border-radius: 50%; background: #e4e9dc; color: var(--accent); border: 1px solid #dbe2d3; font-size: .82rem; font-weight: 650; }
.workspace { flex: 1; width: 100%; max-width: 1320px; margin: auto; padding: 52px 44px 48px; outline: 0; }
.title-row, .toolbar, .actions, .inline { display: flex; align-items: center; gap: 12px; }
.title-row { justify-content: space-between; margin-bottom: 24px; }
.title-row > * { min-width: 0; }
.page-heading { margin-bottom: 32px; gap: 24px; }
.page-heading h1 { display: flex; align-items: center; gap: 16px; }
.eyebrow { display: block; color: var(--muted); font-size: .65rem; font-weight: 650; letter-spacing: .17em; text-transform: uppercase; margin-bottom: 12px; }
.count-pill { display: inline-grid; place-items: center; min-width: 30px; min-height: 28px; padding: 3px 8px; background: #ebece3; border: 1px solid #e1e5d8; border-radius: 8px; color: var(--muted); font-size: .73rem; font-weight: 550; letter-spacing: 0; }
.heading-actions { flex-shrink: 0; }
.toolbar { flex-wrap: wrap; margin-bottom: 22px; }
.toolbar > input { flex: 1; min-width: 180px; }
.toolbar select { width: auto; }
.actions, .inline { flex-wrap: wrap; }
.inline select { width: auto; flex: 1; }
.toolbar label { min-width: 120px; }
.back-link { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: .8rem; margin-bottom: 22px; }

/* Collection controls */
.library-toolbar { gap: 16px; }
.search-field { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 220px; padding: 0 15px; border: 1px solid #dfe1d8; border-radius: 11px; background: #ffffffb3; color: #7c8572; }
.search-field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px #344f4010; }
.search-field input { border: 0; background: transparent; padding: 13px 0; min-height: 49px; font-size: .85rem; }
.search-field input:focus { outline: 0; box-shadow: none; }
.search-field .icon-button { min-width: 32px; width: 32px; min-height: 32px; margin-right: -8px; padding: 6px; }
.sort-control { display: flex; align-items: center; gap: 5px; color: var(--muted); }
.sort-control select { border-color: transparent; background-color: transparent; width: 172px; font-size: .76rem; color: var(--muted); padding-left: 4px; }
.segmented { display: inline-flex; padding: 4px; background: #eeefe8; border-radius: 10px; gap: 3px; }
.segmented button { border: 0; background: transparent; border-radius: 7px; color: var(--muted); }
.segmented button.selected { background: var(--panel); color: var(--accent); box-shadow: 0 1px 3px #28352e0a; }
.view-switch button { min-height: 34px; width: 36px; padding: 8px; }
.collection-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 26px; }
.category-tabs { display: flex; flex-wrap: wrap; gap: 5px; }
.category-tabs button { min-height: 40px; padding: 9px 14px; border-color: transparent; background: transparent; color: var(--muted); font-size: .78rem; }
.category-tabs button.selected { background: #e5eadd; color: var(--accent); font-weight: 650; }
.category-tabs button:hover { color: var(--accent); background: #edf0e7; }
.recipe-library-heading { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; margin-bottom: 22px; }
.recipe-library-heading .library-toolbar { grid-column: 1; grid-row: 1; flex-wrap: nowrap; margin: 0; }
.recipe-library-heading .search-field { flex: 1 1 auto; min-width: 0; }
.recipe-library-heading .sort-control { flex: none; }
.recipe-add { width: 44px; min-width: 44px; min-height: 44px; padding: 0; border-radius: 12px; }

/* Recipe cards */
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 24px; }
.recipe-card { --dish-bg: #edf1e7; --dish-ink: #6b8055; display: flex; flex-direction: column; min-width: 0; overflow-wrap: anywhere; gap: 0; padding: 23px 23px 15px; border: 1px solid var(--border); border-radius: 16px; background: var(--panel); color: var(--ink); transition: box-shadow 180ms, border-color 180ms, transform 180ms; }
.recipe-card.tone-blue { --dish-bg: #edf1f3; --dish-ink: #617c89; }
.recipe-card.tone-orange { --dish-bg: #f6ede4; --dish-ink: #b0774a; }
.recipe-card:hover { text-decoration: none; border-color: #b9c3ae; box-shadow: 0 8px 26px #28352e0a; transform: translateY(-3px); }
.recipe-card-heading { display: flex; align-items: flex-start; gap: 14px; }
.recipe-card-heading h2 { flex: 1; min-width: 0; min-height: 2.64em; font-size: 1.25rem; line-height: 1.32; font-weight: 550; text-wrap: pretty; }
.recipe-card-heading > .icon { margin-top: 4px; color: #aab3a0; }
.recipe-card-labels { display: flex; align-items: center; gap: 12px; margin-top: 15px; }
.recipe-card-labels > div { min-width: 0; }
.dish-icon { display: inline-grid; place-items: center; flex-shrink: 0; width: 44px; height: 44px; border-radius: 13px; background: var(--dish-bg); color: var(--dish-ink); }
.recipe-category { font-size: .73rem; color: var(--muted); letter-spacing: .03em; }
.tags { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-top: 4px; }
.tag, .pill { display: inline-block; padding: 3px 8px; border-radius: 6px; background: #edf1e6; color: #58684c; font-size: .68rem; font-weight: 500; }
.recipe-card .tags .tag { padding: 0; background: transparent; color: var(--muted); }
.recipe-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; color: var(--muted); font-size: .72rem; margin: 17px 0 20px; }
.recipe-meta > span { display: inline-flex; align-items: center; gap: 5px; }
.metrics { display: flex; flex-wrap: wrap; gap: 12px; color: var(--muted); font-size: .8rem; }
.nutrition { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; font-variant-numeric: tabular-nums; }
.nutrition strong { display: block; font-size: 1.3rem; font-weight: 550; color: var(--ink); }
.nutrition span { font-size: .74rem; color: var(--muted); }
.nutrient-unit { display: block; color: var(--muted); font-size: .68rem; margin: 2px 0 4px; }
.nutrition-basis { display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: .75rem; margin: 8px 0 16px; }
.list-end { height: 1px; }
.nutrition-causes { margin-top: 18px; font-size: .7rem; overflow-wrap: anywhere; }
.nutrition-causes summary, .nutrition-details > summary { cursor: pointer; color: var(--muted); font-size: .72rem; }
.nutrition-causes ul { padding-left: 16px; margin: 8px 0; }
.nutrition-details .nutrition { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.nutrition [data-nutrient] { min-width: 0; overflow-wrap: anywhere; }
.nutrition-summary { display: block; margin-top: auto; padding: 15px 16px; border-radius: 11px; background: #f6f7f2; }
.nutrition-caption { margin-bottom: 10px; }
.nutrition-caption span { font-size: .69rem; }
.nutrition-primary { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 14px; margin: 0; }
.nutrition-primary dt { color: var(--muted); font-size: .69rem; margin-bottom: 4px; }
.nutrition-primary dd { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 5px; margin: 0; }
.nutrition-primary strong { font-size: 1.35rem; letter-spacing: -.035em; line-height: 1.25; }
.nutrition-primary strong.wide-value { font-size: 1.08rem; }
.nutrition-primary dd > span { font-size: .65rem; }
.nutrition-primary .protein strong { color: #59734c; }
.nutrition-secondary { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; }
.nutrition-secondary > span { display: inline-flex; align-items: center; gap: 5px; font-size: .68rem; }
.nutrition-dot { width: 6px; height: 6px; border-radius: 50%; background: #88a176; }
.nutrition-dot.carbs { background: #d2ad77; }
.nutrition-dot.fat { background: #bac7d0; }
.recipe-rows { background: var(--panel); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; }
.recipe-rows:empty { display: none; }
.recipe-row { display: flex; align-items: center; gap: 4px 24px; padding: 13px 20px; border-bottom: 1px solid #edf0e7; color: var(--ink); }
.recipe-row:last-child { border-bottom: 0; }
.recipe-row:hover { background: #f6f8f2; text-decoration: none; }
.recipe-row > strong { flex: 1; min-width: 0; font-size: .9rem; font-weight: 550; line-height: 1.4; overflow-wrap: anywhere; }
.recipe-row-facts { display: grid; grid-template-columns: 4.5rem 6rem 8rem; gap: 16px; color: var(--muted); font-size: .76rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.recipe-row-facts > span { display: inline-flex; align-items: center; justify-content: flex-end; gap: 5px; }
.recipe-row-facts .protein, .recipe-per-portion .protein { color: #59734c; }

/* Recipe details and forms */
.grid-two { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.15fr); gap: 24px; align-items: start; }
.stack { display: grid; gap: 22px; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 16px; }
.wide { grid-column: 1 / -1; }
.panel { border: 1px solid var(--border); border-radius: 16px; padding: 26px; background: var(--panel); min-width: 0; }
.panel h2 { margin-bottom: 22px; }
.panel .title-row { margin-bottom: 18px; }
.panel .title-row h2 { margin: 0; }
.panel p + p { margin-top: 12px; }
.subpanel { border: 1px solid #e6e8dd; border-radius: 11px; padding: 18px; margin: 15px 0; }
.subpanel h3 { margin-bottom: 14px; }
.recipe-controls { background: #eeefe6; border-radius: 12px; padding: 16px 20px; margin-bottom: 24px; align-items: flex-end; }
.recipe-controls label { min-width: 110px; }
.recipe-controls label:first-child { width: 115px; }
.recipe-topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.recipe-topbar .back-link { min-height: 44px; margin-bottom: 0; }
.recipe-topbar .icon-button { width: 44px; min-width: 44px; min-height: 44px; }
.action-menu { min-width: 200px; padding: 6px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel); color: var(--ink); box-shadow: 0 12px 40px #14231d1f; }
/* Without anchor positioning the menu stays centered as a plain popover. */
@supports (anchor-name: --a) {
  .recipe-actions-button { anchor-name: --recipe-actions; }
  .action-menu { position-anchor: --recipe-actions; inset: auto; top: anchor(bottom); right: anchor(right); margin: 6px 0 0; }
}
.action-menu:popover-open { display: grid; gap: 2px; }
.action-menu > :is(.button, button) { justify-content: flex-start; width: 100%; border-color: transparent; background: transparent; color: var(--ink); }
.action-menu > :is(.button, button):hover { border-color: transparent; background: #f0f3eb; }
.action-menu > :focus-visible { outline-offset: -2px; }
.action-menu > button.danger { color: var(--danger); }
.action-menu > button.danger:hover { background: #fff2ee; }
.plan-recipe-button { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; margin-left: auto; border-color: #dfe2d7; }
.recipe-title { max-width: 850px; margin-bottom: 10px; }
.recipe-title, .ingredient-display > span:last-child, .collection-name strong { overflow-wrap: anywhere; }
.recipe-per-portion { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 14px; margin-bottom: 18px; font-variant-numeric: tabular-nums; }
.recipe-per-portion strong { font-size: 1.05rem; font-weight: 600; }
.recipe-per-portion span { color: var(--muted); font-size: .78rem; }
.recipe-selections { align-items: flex-end; }
.recipe-selections label { flex: 1; max-width: 280px; }
.servings-stepper { display: inline-flex; align-items: center; flex-shrink: 0; border: 1px solid #d9ded2; border-radius: 12px; background: var(--panel); color: var(--muted); }
.servings-stepper:focus-within { border-color: var(--accent); }
.servings-stepper > .icon { margin-left: 11px; }
.servings-stepper .icon-button { color: var(--accent); border-radius: 11px; }
.servings-stepper input { width: 3.2em; min-height: 40px; padding: 0; border: 0; background: transparent; color: var(--ink); text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.servings-stepper input:focus { box-shadow: none; }
.ingredient-group { margin: 22px 0 2px; color: var(--muted); font-size: .68rem; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; }
.recipe-steps > p { font-size: .88rem; }
/* Keep the top offset plus bottom gap in sync with STICKY_INGREDIENTS_SPACE in recipes.rs. */
@media (min-width: 961px) {
  .recipe-ingredients.sticky { position: sticky; top: 104px; }
}
html:has(dialog.cook-mode[open]) { overflow: hidden; }
dialog.cook-mode { --cook-peek: calc(64px + env(safe-area-inset-bottom)); --cook-side: max(20px, 4vw); position: fixed; inset: 0; width: 100vw; max-width: none; height: 100dvh; max-height: none; margin: 0; padding: 0 0 var(--cook-peek); border: 0; background: var(--paper); color: var(--ink); overflow: hidden; overscroll-behavior: contain; }
dialog.cook-mode[open] { display: flex; flex-direction: column; }
dialog.cook-mode::backdrop { background: var(--paper); backdrop-filter: none; }
.cook-header { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; align-items: center; gap: 14px; padding: calc(10px + env(safe-area-inset-top)) max(var(--cook-side), env(safe-area-inset-right)) 6px max(var(--cook-side), env(safe-area-inset-left)); }
.cook-header .icon-button { width: 44px; min-height: 44px; border-radius: 50%; background: #eceee6; }
.cook-header h2 { font-size: 1rem; letter-spacing: -.02em; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cook-position { color: var(--muted); font-size: .85rem; font-weight: 600; font-variant-numeric: tabular-nums; text-align: center; white-space: nowrap; }
.cook-progress { display: flex; gap: 4px; padding: 6px max(var(--cook-side), env(safe-area-inset-right)) 0 max(var(--cook-side), env(safe-area-inset-left)); }
.cook-progress > span { flex: 1; height: 5px; border-radius: 3px; background: #e2e5da; transition: background 200ms; }
.cook-progress > span.done { background: var(--accent); }
.cook-step { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; padding: clamp(22px, 5dvh, 56px) max(var(--cook-side), env(safe-area-inset-right)) 24px max(var(--cook-side), env(safe-area-inset-left)); animation: cook-step-in 220ms ease-out; }
.cook-step small { display: block; margin-bottom: 14px; color: var(--muted); font-size: .78rem; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; }
.cook-step p { font-size: clamp(1.5rem, 2.2vw + 1rem, 2.6rem); line-height: 1.45; letter-spacing: -.02em; white-space: pre-line; overflow-wrap: anywhere; text-wrap: pretty; }
@keyframes cook-step-in { from { opacity: 0; transform: translateY(8px); } }
.cook-nav { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 10px; padding: 10px max(12px, env(safe-area-inset-right)) 12px max(12px, env(safe-area-inset-left)); }
.cook-nav button { min-height: 68px; border-radius: 16px; font-size: 1.05rem; }
.cook-scrim { position: absolute; inset: 0; background: #1d2a2245; opacity: 0; pointer-events: none; transition: opacity 220ms; }
.cook-scrim.open { opacity: 1; pointer-events: auto; }
.cook-sheet { --sheet-drag: 0px; position: absolute; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; max-width: 760px; max-height: 86%; margin: 0 auto; border: 1px solid var(--border); border-bottom: 0; border-radius: 22px 22px 0 0; background: var(--panel); box-shadow: 0 -10px 34px #28352e14; transform: translateY(clamp(0px, calc(100% - var(--cook-peek) + var(--sheet-drag)), calc(100% - var(--cook-peek)))); transition: transform 280ms cubic-bezier(.2, .8, .2, 1); }
.cook-sheet.open { transform: translateY(max(0px, var(--sheet-drag))); }
.cook-sheet.dragging { transition: none; }
.cook-sheet-handle { position: relative; display: flex; flex-shrink: 0; justify-content: flex-start; gap: 10px; width: 100%; min-height: 64px; padding: 18px 22px 12px; border: 0; border-radius: 22px 22px 0 0; background: transparent; font-size: 1rem; touch-action: none; }
.cook-sheet-handle:hover { background: transparent; }
.cook-sheet-handle::before { content: ""; position: absolute; top: 7px; left: 50%; width: 40px; height: 5px; margin-left: -20px; border-radius: 3px; background: #d5d9cd; }
.cook-sheet-handle strong { font-weight: 650; }
.cook-servings { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; color: var(--muted); font-size: .9rem; font-variant-numeric: tabular-nums; }
/* Amount columns fit the widest amount of the list up to a cap. Rows share them as subgrids. */
.cook-sheet-list { display: grid; grid-template-columns: 24px fit-content(6.5rem) minmax(0, 1fr); align-content: start; column-gap: 14px; overflow-y: auto; overscroll-behavior: contain; padding: 0 22px calc(18px + env(safe-area-inset-bottom)); transition: opacity 220ms; }
.cook-sheet-list > * { grid-column: 1 / -1; }
.cook-sheet:not(.open, .dragging) .cook-sheet-list { opacity: 0; }
.cook-sheet-list .ingredient-group { margin-top: 18px; }
.cook-ingredient { display: grid; grid-template-columns: subgrid; align-items: start; padding: 14px 0; border-bottom: 1px solid #eeefe7; color: var(--ink); font-size: 1.05rem; font-weight: 400; line-height: 1.45; cursor: pointer; transition: opacity 160ms; }
.cook-ingredient input { width: 22px; height: 22px; min-height: 22px; margin-top: 1px; }
.cook-ingredient > span:last-child { overflow-wrap: anywhere; }
.cook-ingredient small { display: block; margin-top: 2px; color: var(--muted); font-size: .88rem; }
.cook-ingredient small.to-taste { display: inline; }
.cook-ingredient.done { opacity: .45; }
@media (max-height: 500px) {
  dialog.cook-mode { --cook-peek: calc(56px + env(safe-area-inset-bottom)); }
  .cook-step { padding-top: 14px; }
  .cook-step p { font-size: 1.4rem; }
  .cook-nav { padding-top: 6px; padding-bottom: 8px; }
  .cook-nav button { min-height: 52px; }
  .cook-sheet-handle { min-height: 56px; padding-top: 16px; padding-bottom: 8px; }
}
.recipe-editor { max-width: 980px; margin: auto; }
.recipe-editor-heading, .recipe-editor-back-link { width: 100%; max-width: 980px; margin-left: auto; margin-right: auto; }
.recipe-editor .panel { padding: 26px; }
.recipe-editor input#recipe-title { font-size: 1.1rem; font-weight: 550; }
.drag-list { position: relative; }
.drag-handle { width: 32px; min-width: 32px; min-height: 40px; padding: 0; border-color: transparent; background: transparent; color: #a3ab98; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.drag-handle:hover { color: var(--accent); background: transparent; border-color: transparent; }
.drag-handle .icon { pointer-events: none; }
.drag-list .dragging { position: relative; z-index: 4; border-radius: 10px; box-shadow: 0 10px 28px #28352e24; cursor: grabbing; }
.drop-indicator { position: absolute; left: 0; right: 0; height: 2px; margin-top: -1px; border-radius: 1px; background: var(--accent); pointer-events: none; z-index: 3; }
.list-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.list-actions button { min-height: 40px; padding: 8px 14px; border-color: transparent; background: #f2f4ed; color: var(--accent); }
.ingredient-row { display: grid; grid-template-columns: 32px minmax(0, 1fr) 84px 108px; gap: 8px; align-items: center; padding: 5px 0; border-bottom: 1px solid #eeefe7; background: var(--panel); }
.ingredient-row input { min-height: 40px; padding: 8px 10px; }
.ingredient-row.to-taste .ingredient-amount { display: none; }
.ingredient-row.to-taste .ingredient-unit { grid-column: span 2; }
.ingredient-name { justify-content: flex-start; min-width: 0; min-height: 40px; padding: 4px 10px; border-color: transparent; background: transparent; font-size: .86rem; font-weight: 500; line-height: 1.3; text-align: left; }
.ingredient-name > span:first-child { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: break-word; hyphens: auto; }
.ingredient-row.invalid .ingredient-name { color: var(--danger); }
.ingredient-flag { display: inline-flex; flex: none; margin-left: 6px; color: var(--muted); }
.group-heading { padding: 16px 0 2px 40px; }
.group-heading input { min-height: 36px; padding: 6px 10px; border-color: transparent; background: transparent; color: var(--muted); font-size: .78rem; font-weight: 650; letter-spacing: .02em; }
.group-heading input:hover { border-color: #e4e4dc; }
.group-heading input::placeholder { color: #a3ab98; font-weight: 550; }
.drag-list > .group-heading:first-child { padding-top: 0; }
.ingredient-choice { justify-content: space-between; width: 100%; min-height: 48px; text-align: left; font-size: .9rem; }
.ingredient-choice > span { min-width: 0; overflow-wrap: anywhere; }
.ingredient-note-input { min-height: 46px; field-sizing: content; resize: none; }
.step-row { display: grid; grid-template-columns: 32px 28px minmax(0, 1fr) 40px; gap: 8px; align-items: start; padding: 5px 0; background: var(--panel); }
.step-row .drag-handle { min-height: 46px; }
.step-row .step-number { margin-top: 9px; }
.step-row textarea { min-height: 46px; field-sizing: content; resize: none; }
/* Unfocused steps show their first lines. The reduced bottom padding hides the next line. */
.step-row textarea:not(:focus) { max-height: calc(3lh + 17px); padding-bottom: 4px; overflow: hidden; }
.step-row .icon-button { min-height: 46px; color: var(--muted); }
.ingredient-list { display: grid; grid-template-columns: fit-content(7rem) minmax(0, 1fr); column-gap: 16px; }
.ingredient-list > * { grid-column: 1 / -1; }
.ingredient-display { display: grid; grid-template-columns: subgrid; border-bottom: 1px solid #eeefe7; padding: 11px 0; line-height: 1.55; font-size: .85rem; }
.line-amount { display: grid; align-content: start; font-variant-numeric: tabular-nums; }
.line-amount strong { font-weight: 600; }
.ingredient-display small { color: var(--muted); font-size: .74rem; }
.ingredient-note { display: block; width: 100%; min-height: 0; margin-top: 1px; padding: 0; border: 0; border-radius: 0; background: none; color: var(--muted); font-size: .74rem; font-weight: 400; line-height: 1.5; text-align: left; }
.ingredient-note:hover { background: none; }
.ingredient-note > span { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 1; overflow: hidden; }
.ingredient-note.open > span { display: block; }
.step { display: flex; gap: 16px; margin: 22px 0; line-height: 1.7; white-space: pre-line; font-size: .88rem; }
.step-number { display: inline-grid; place-items: center; width: 28px; height: 28px; flex-shrink: 0; border-radius: 50%; color: var(--accent); background: #edf1e7; font-size: .75rem; font-weight: 650; }
.categories { display: flex; gap: 8px; flex-wrap: wrap; }
.categories label { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid #e8eadf; border-radius: 9px; background: #f4f5ef; cursor: pointer; font-size: .76rem; }
.categories label:has(input:checked) { background: #e8eedf; border-color: #cddbc0; color: var(--accent); }
details > summary { cursor: pointer; color: var(--accent); padding: 7px 0; font-size: .83rem; font-weight: 550; }
details[open] > summary { margin-bottom: 15px; }
.reorder { display: flex; gap: 6px; }
.reorder button { width: 44px; padding: 0; }
.form-nutrition { display: grid; grid-template-columns: repeat(auto-fit, minmax(125px, 1fr)); gap: 16px; }
.attachment-list { display: grid; gap: 8px; }
.editor-actions { position: sticky; bottom: 0; background: var(--paper); padding: 16px 0; border-top: 1px solid var(--border); justify-content: flex-end; z-index: 3; }
.editor-actions .primary { min-width: 160px; }

/* Product and ingredient rows */
.collection-list { background: var(--panel); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; }
.collection-list:empty { display: none; }
.collection-item { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto 150px 18px; align-items: center; gap: 18px; width: 100%; padding: 20px 24px; text-align: left; border: 0; border-bottom: 1px solid #edf0e7; border-radius: 0; background: transparent; }
.collection-item:last-child { border-bottom: 0; }
.collection-item:hover { background: #f6f8f2; }
.collection-icon { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; color: #6b8055; background: #edf1e7; }
.collection-name { display: grid; gap: 6px; min-width: 0; }
.collection-name strong { color: var(--ink); font-size: .92rem; font-weight: 550; line-height: 1.5; }
.collection-name small { color: var(--muted); font-size: .73rem; font-weight: 400; }
.source-badge { justify-self: start; padding: 4px 8px; border: 1px solid #e1e6d8; border-radius: 6px; color: var(--muted); font-size: .65rem; font-weight: 550; background: #f5f7ef; white-space: nowrap; }
.collection-nutrition { display: grid; gap: 3px; color: var(--muted); font-size: .73rem; font-weight: 400; font-variant-numeric: tabular-nums; }
.collection-nutrition strong { color: var(--ink); font-size: .95rem; font-weight: 550; }
.collection-nutrition small { font-size: .65rem; font-weight: 400; color: var(--muted); }
.collection-item > .icon { color: #adb6a3; }

/* Dialogs and source selection */
dialog.modal { margin: auto; padding: 0; width: min(660px, calc(100vw - 48px)); max-width: none; max-height: calc(100dvh - 64px); border: 1px solid #e1e4d9; border-radius: 20px; box-shadow: 0 24px 100px #14231d25; color: var(--ink); background: var(--panel); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
dialog::backdrop { background: #1d2a2245; backdrop-filter: blur(4px); }
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; position: sticky; top: 0; padding: 22px 26px; border-bottom: 1px solid #eeefe7; background: #fffffff7; backdrop-filter: blur(12px); z-index: 2; }
.modal-header h2 { font-size: 1.35rem; }
.modal-header .icon-button { width: 44px; min-width: 44px; min-height: 44px; background: #f2f3ed; border-radius: 50%; }
.details-toggle .icon { stroke-width: 3; }
.modal-body { padding: 26px; }
.modal-body > .title-row { margin-top: 18px; }
.modal-body .panel { padding: 18px; }
.modal-body .grid-two { gap: 16px; }
.sheet-footer { position: sticky; bottom: 0; z-index: 2; display: grid; gap: 10px; margin: 22px -26px -26px; padding: 14px 26px; border-top: 1px solid #eeefe7; background: #fffffff7; backdrop-filter: blur(12px); }
.stack > .sheet-footer { margin-top: 0; }
.sheet-footer .error { margin: 0; }
.sheet-footer .actions { justify-content: flex-end; }
.sheet-footer .actions .danger { margin-right: auto; }
.sheet.stack { align-content: start; }
.results { display: grid; gap: 0; margin-top: 20px; }
.result { display: flex; width: 100%; text-align: left; align-items: center; justify-content: space-between; gap: 16px; padding: 15px 12px; border: 0; border-bottom: 1px solid #edf0e7; border-radius: 0; font-size: .85rem; font-weight: 550; }
.result small { color: var(--muted); display: block; margin-top: 5px; font-size: .71rem; font-weight: 400; }
.result > span:first-child { min-width: 0; }
.picker-toolbar { display: flex; flex-wrap: wrap; gap: 10px; }
.picker-toolbar select { width: auto; flex: 1; }
.result-section { color: var(--muted); font-size: .66rem; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; padding: 18px 12px 8px; }
.result-empty { padding: 18px 12px; color: var(--muted); font-size: .83rem; }
.error { color: #9c3a31; background: #fff0ea; border: 1px solid #f0d7cd; padding: 13px 15px; border-radius: 10px; margin: 16px 0; font-size: .82rem; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.loading { padding: 70px 20px; text-align: center; color: var(--muted); font-size: .85rem; }
.empty, .empty-state { padding: 70px 24px; text-align: center; color: var(--muted); }
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 20px; }
.empty-state h2 { color: var(--muted); font-size: 1.25rem; }

/* Weekly planning */
.planner-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin: 0 0 24px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.planner-heading > .error { flex-basis: 100%; margin: 0; }
.plan-range { display: flex; align-items: center; gap: 12px; }
.range-navigation { display: flex; align-items: center; gap: 4px; }
.range-picker { background: transparent; border-color: transparent; color: var(--ink); font-size: .85rem; font-weight: 600; padding: 8px 10px; }
.range-picker:hover { border-color: transparent; }
.plan-totals { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 24px; }
.plan-total { display: grid; flex: 1; max-width: 620px; min-width: 245px; gap: 4px; padding: 10px 16px 4px; border: 1px solid var(--border); border-radius: 13px; background: var(--panel); text-align: left; }
.plan-total-heading { display: grid; grid-template-columns: minmax(130px, 1fr) minmax(0, 2fr); align-items: center; justify-content: stretch; gap: 10px 16px; min-width: 0; width: 100%; padding: 0; border: 0; text-align: left; background: transparent; }
.plan-person-heading { display: grid; grid-template-columns: 28px minmax(0, 1fr); align-items: center; gap: 0 9px; min-width: 0; width: 100%; }
.plan-person-heading > .person-dot { grid-row: 1 / 3; width: 28px; height: 28px; font-size: .72rem; }
.plan-person-heading > .icon { position: absolute; top: 12px; right: 14px; }
.plan-total { position: relative; }
.plan-person-heading strong { min-width: 0; overflow-wrap: anywhere; color: var(--ink); font-weight: 600; font-size: .82rem; }
.plan-person-heading small { grid-column: 2; color: var(--muted); font-size: .78rem; font-weight: 400; }
.plan-person-heading > .icon { color: #919c84; }
.plan-person-nutrients { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 16px; min-width: 0; padding-right: 22px; color: var(--muted); font-size: .72rem; font-variant-numeric: tabular-nums; }
.plan-person-nutrients strong { color: var(--ink); font-size: 1.1rem; font-weight: 550; letter-spacing: -.025em; }
.person-nutrient { display: grid; grid-row: span 2; grid-template-rows: subgrid; gap: 6px; min-width: 0; }
.person-nutrient-value { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 3px; }
.person-nutrient-value > * { white-space: nowrap; }
.person-nutrient-value > small { font-size: .78rem; }
.plan-person-nutrients .person-nutrient-unit { order: -1; flex-basis: 100%; }
.meter-track { display: block; height: 4px; background: #e4e8dc; border-radius: 3px; overflow: hidden; }
.meter-track.unknown { background: transparent; border: 1px dashed #b0bda6; }
.meter-track > span { display: block; height: 100%; background: #7a916b; border-radius: inherit; }
.meter-track > span.incomplete { background: repeating-linear-gradient(110deg, #74886a, #74886a 4px, #b0bda6 4px, #b0bda6 6px); }
.planner-body { display: flex; flex-direction: column; }
.plan-week-header { position: sticky; top: 87px; z-index: 4; display: grid; grid-template-columns: repeat(var(--plan-columns, 7), minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; padding: 6px 0; border-bottom: 1px solid var(--border); background: var(--paper); }
.week-day { justify-content: flex-start; align-items: baseline; gap: 6px; min-width: 0; padding: 6px 8px; border-color: transparent; background: transparent; text-align: left; }
.week-day > span { color: var(--muted); font-size: .75rem; font-weight: 400; }
.week-day > strong { font-size: .96rem; font-weight: 600; }
.week-day > .icon { margin-left: auto; align-self: center; color: var(--muted); }
.week-day.today { background: #e5ecdc; color: var(--accent); }
.week-day.past, .plan-day.past { opacity: .78; }
.plan-day.past:hover, .plan-day.past:focus-within { opacity: 1; }
.plan-grid { display: grid; grid-template-columns: repeat(var(--plan-columns, 7), minmax(0, 1fr)); grid-template-rows: auto repeat(4, minmax(125px, auto)) auto auto; gap: 12px; align-items: stretch; touch-action: pan-y pinch-zoom; }
.plan-day { display: grid; grid-template-columns: minmax(0, 1fr); grid-row: span 7; grid-template-rows: subgrid; gap: 8px; min-width: 0; }
.plan-day.today { border-radius: 8px; background: #eef2e8; box-shadow: 0 0 0 6px #eef2e8; }
.day-meals { display: contents; }
.day-meals > .meals-heading { display: none; }
.plan-days { display: none; }
.plan-mode, .week-overview, .plan-totals-units { display: none; }
.week-overview { gap: 12px; }
.week-overview-day { display: grid; overflow: hidden; border: 1px solid #dce3d3; border-radius: 12px; background: var(--panel); }
.week-overview-day.today { border-color: #9fb38f; box-shadow: 0 0 0 1px #9fb38f; }
.week-overview-date { display: flex; align-items: baseline; gap: 5px; margin: 0; padding: 9px 12px 3px; color: var(--ink); font-size: .82rem; font-weight: 600; letter-spacing: 0; }
.week-overview-date > span { color: var(--muted); font-weight: 500; }
.week-overview-day.today .week-overview-date, .week-overview-day.today .week-overview-date > span { color: var(--accent); }
.week-overview-meal { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 8px; min-width: 0; padding: 0 12px; border: 0; border-radius: 0; background: transparent; font-size: .84rem; font-weight: 500; text-align: left; }
.week-overview-meal + .week-overview-meal { border-top: 1px solid #eef0e8; }
.week-overview-meal:hover { background: #f4f6f0; }
.week-overview-slot { color: var(--muted); font-size: .72rem; }
.week-overview-food { display: flex; gap: 4px; min-width: 0; color: var(--ink); }
.week-overview-food > span { flex: 0 1 auto; min-width: 2.6em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.week-overview-food > span + span::before { content: "· "; color: var(--muted); }
.week-overview-food.no-food { color: var(--muted); font-weight: 450; }
.week-overview-meal.open .week-overview-food.no-food { color: #b8714a; }
.week-overview-people { display: flex; gap: 3px; }
.week-overview .person-dot { width: 20px; height: 20px; font-size: .6rem; }
.week-overview .person-dot.outside { background: transparent; box-shadow: inset 0 0 0 1.5px currentColor; }
.week-overview .person-dot.skipped { background: transparent; color: #aab2a1; }
.week-overview .person-dot.open { border: 1px dashed currentColor; background: transparent; color: #b8714a; }
.collection-heading { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; border-bottom: 1px solid var(--border); }
.collection-heading > .heading-actions { margin-left: auto; padding-bottom: 6px; }
.collection-tabs { display: flex; gap: 6px; }
.collection-tabs a { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 10px 15px; color: var(--muted); border-bottom: 2px solid transparent; }
.collection-tabs a[aria-current=page] { color: var(--accent); border-color: var(--accent); }
.day-preparations, .daily-foods { align-self: start; display: grid; gap: 4px; min-width: 0; }
.day-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 5px; padding: 0 2px; min-height: 36px; border: 0; border-radius: 4px; background: transparent; color: var(--muted); font-size: .78rem; font-weight: 550; text-align: left; }
.day-section-heading > span, .day-section-heading > h2 { display: flex; align-items: center; gap: 5px; }
.day-section-heading > h2 { color: inherit; font: inherit; letter-spacing: inherit; }
.day-section-heading .icon-button { width: 44px; min-width: 44px; min-height: 40px; padding: 7px; }
.cooking-entry, .daily-food-entry { display: grid; justify-items: start; justify-content: start; align-content: start; gap: 4px; width: 100%; min-height: 44px; padding: 9px; border: 1px solid #e1dfcf; border-radius: 8px; background: #f1eee2; text-align: left; overflow-wrap: anywhere; }
.cooking-entry strong, .daily-food-entry strong { font-size: .85rem; font-weight: 550; }
.cooking-entry strong { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.cooking-entry small, .daily-food-entry small { color: var(--muted); font-size: .78rem; font-weight: 400; }
.cooking-entry small.error { color: var(--danger); }
.cooking-entry .error, .plan-meal > .error { margin: 0; padding: 0; border: 0; background: transparent; font-size: .78rem; }
.daily-foods { border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.daily-food-entry { border-color: transparent; background: transparent; padding: 7px 2px; }
.daily-food-entry:hover { background: var(--light); border-color: transparent; }
.meal-position { display: grid; gap: 5px; min-width: 0; }
.planned-amounts { display: grid; gap: 3px; min-width: 0; color: var(--muted); font-size: .78rem; font-weight: 400; }
.planned-amount { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 2px 8px; }
.planned-amount strong { font-weight: 550; font-variant-numeric: tabular-nums; }
.daily-food-entry > .planned-amounts { width: 100%; grid-column: 1 / -1; }
.preparation-link { position: relative; z-index: 1; pointer-events: auto; justify-content: flex-start; width: fit-content; min-height: 28px; max-width: 100%; gap: 4px; padding: 3px 9px 3px 7px; border: 0; border-radius: 999px; background: #dfe8d6; color: #4d5c45; font-size: .78rem; font-weight: 400; text-align: left; }
.preparation-link::after { content: ""; position: absolute; inset: -8px -4px; }
.preparation-link:hover { background: #d3dfc9; }
.preparation-summary { display: grid; gap: 8px; }
.preparation-summary > .source-badge { justify-self: start; }
.preparation-summary > strong { font-size: 1.5rem; }
.shopping-page { max-width: 880px; margin: 0 auto; }
.shopping-list { min-height: 100px; margin-bottom: 28px; }
.shopping-progress { position: sticky; top: 87px; z-index: 2; display: flex; align-items: center; gap: 12px; min-height: 48px; margin-top: -8px; padding: 2px 0 2px 4px; background: var(--paper); color: var(--muted); font-size: .78rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.shopping-progress-bar { flex: 1; height: 4px; overflow: hidden; border-radius: 2px; background: var(--light); }
.shopping-progress-bar > span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.shopping-item { display: grid; grid-template-columns: 40px minmax(0, 1fr) 44px; border-bottom: 1px solid var(--border); line-height: 1.3; }
.shopping-check { grid-column: 1 / 3; display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 0; min-height: 52px; padding: 7px 0; color: inherit; font-size: inherit; font-weight: inherit; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; -webkit-user-select: none; user-select: none; }
.shopping-check > input { width: 22px; min-height: 22px; height: 22px; margin: 0 0 0 4px; accent-color: var(--accent); cursor: pointer; }
.shopping-details { align-self: center; justify-self: end; width: 44px; min-width: 44px; min-height: 44px; padding: 0; color: var(--muted); }
.shopping-details .icon { transform: rotate(90deg); transition: transform 160ms; }
.shopping-details[aria-expanded=true] .icon { transform: rotate(-90deg); }
.shopping-item-name { display: grid; gap: 2px; min-width: 0; overflow-wrap: anywhere; font-size: .9rem; font-weight: 550; }
.shopping-item small { color: var(--muted); font-size: .72rem; font-weight: 500; }
.shopping-amount { display: grid; gap: 2px; justify-items: end; padding-left: 12px; text-align: right; font-size: .85rem; white-space: nowrap; }
.shopping-amount strong { font-weight: 600; }
.shopping-item.checked .shopping-item-name > span, .shopping-item.checked .shopping-amount strong { text-decoration: line-through; color: var(--muted); }
.shopping-uses { grid-column: 2; display: grid; gap: 6px; margin: -2px 0 0; padding: 0 0 14px; list-style: none; color: var(--muted); font-size: .75rem; }
.shopping-uses > li { display: grid; grid-template-columns: 58px minmax(0, 1fr) auto; gap: 10px; }
.shopping-uses > li > :last-child { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.shopping-uses.error { margin: 0 0 12px; padding: 8px 12px; }
.shopping-stock { grid-column: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 0 0 14px; }
.shopping-stock > label { display: flex; align-items: center; gap: 8px; font-size: .75rem; font-weight: 500; }
.shopping-stock input { width: 88px; min-height: 40px; padding: 8px 10px; text-align: right; font-variant-numeric: tabular-nums; }
.shopping-stock .icon-button { color: var(--muted); }
.shopping-stock > .error { flex-basis: 100%; margin: 0; padding: 8px 12px; }
.shopping-group > summary { display: flex; align-items: center; gap: 8px; min-height: 52px; margin: 0; padding: 0 4px; list-style: none; color: var(--muted); font-size: .85rem; border-bottom: 1px solid var(--border); }
.shopping-group > summary::-webkit-details-marker { display: none; }
.shopping-group > summary .icon { transition: transform 160ms; }
.shopping-group[open] > summary { margin-bottom: 0; }
.shopping-group[open] > summary .icon { transform: rotate(90deg); }
.shopping-group > summary > span { min-width: 24px; padding: 1px 8px; border-radius: 999px; background: var(--light); text-align: center; font-size: .75rem; font-variant-numeric: tabular-nums; }
@media (min-width: 1100px) {
  .shopping-page { max-width: 1180px; }
  .shopping-rows { columns: 2; column-gap: 56px; }
  .shopping-item { break-inside: avoid; }
}
@media (max-width: 760px) {
  .shopping-progress { top: 75px; }
}
@media (max-width: 600px) {
  .shopping-progress { top: env(safe-area-inset-top); margin-top: 0; }
}
.plan-meal { position: relative; display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; min-width: 0; width: 100%; min-height: 125px; gap: 14px; padding: 13px 12px; text-align: left; border: 1px solid #dce3d3; background: #edf2e8; border-radius: 11px; }
.plan-meal-open { min-height: 0; justify-content: flex-start; padding: 0; border: 0; border-radius: inherit; background: transparent; }
.plan-meal-open::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.plan-meal-open:hover { background: transparent; }
.plan-meal > .plan-group { pointer-events: none; }
.plan-recipe-link { display: grid; justify-items: start; gap: 5px; width: fit-content; max-width: 100%; position: relative; pointer-events: auto; text-decoration: none; }
.plan-recipe-link:hover { text-decoration: none; }
.plan-recipe-title { text-decoration: underline; text-underline-offset: 3px; overflow-wrap: anywhere; }
.plan-recipe-variant { max-width: 100%; padding: 2px 6px; border-radius: 5px; background: #dfe9de; color: #39593e; font-size: .7rem; font-weight: 450; line-height: 1.4; overflow-wrap: anywhere; }
.meal-editor-group .plan-recipe-link { margin-top: 8px; font-size: .8rem; }
.plan-meal.empty { background: #eef0e65a; border-style: dashed; border-color: #dce1d5; }
.plan-meal:hover { background: #e6eddf; border-color: #a8ba94; }
.meal-slot-label { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: .78rem; font-weight: 500; }
.meal-edit-icon { position: absolute; top: 13px; right: 12px; display: inline-flex; color: var(--muted); pointer-events: none; }
.plan-group { display: grid; gap: 8px; min-width: 0; }
.plan-group + .plan-group { padding-top: 10px; border-top: 1px solid #dce4d3; }
.meal-people { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; min-height: 22px; }
.meal-person { display: inline-flex; align-items: center; gap: 5px; }
.meal-energy { color: var(--muted); font-size: .75rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.person-dot { display: inline-grid; place-items: center; width: 22px; height: 22px; flex-shrink: 0; border-radius: 50%; background: #dfe9de; color: #39593e; font-size: .66rem; font-weight: 650; }
.person-dot.person-1 { color: #805233; background: #f2e0d3; }
.plan-meal.empty .person-dot { opacity: .75; }
.meal-guests { display: inline-flex; align-items: center; gap: 3px; font-size: .75rem; color: var(--muted); margin-left: 3px; }
.meal-lock { margin-left: auto; color: #738564; }
.meal-name { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: .88rem; font-weight: 550; line-height: 1.45; overflow-wrap: anywhere; }
.plan-grid.multi .plan-recipe-title, .plan-grid.multi .meal-food-name { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.meal-name:has(.meal-position) { display: grid; gap: 10px; }
.plan-meal.empty .meal-name, .plan-group.no-food .meal-name { color: #7d8a70; font-weight: 400; }
.plan-group.no-food { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.plan-group.no-food .meal-name { overflow-wrap: normal; }
.plan-meal.quiet { align-self: start; flex-direction: row; flex-wrap: wrap; align-items: center; min-height: 0; gap: 6px 14px; padding-right: 40px; border-style: dashed; }
.plan-meal.quiet:not(.empty) { background: transparent; }
.plan-meal.quiet .plan-group + .plan-group { padding-top: 0; border-top: 0; }
.plan-meal.quiet .meal-edit-icon { top: 50%; transform: translateY(-50%); }
/* Narrow day columns leave the targets to the meters. */
.day-totals { container-type: inline-size; display: grid; grid-template-columns: 22px repeat(2, minmax(0, 1fr)); align-items: center; align-content: start; gap: 4px 10px; padding: 0 2px 8px; border-bottom: 1px solid var(--border); color: var(--muted); font-size: .78rem; font-variant-numeric: tabular-nums; }
.day-totals-unit { font-size: .7rem; }
.day-totals-unit:first-child { grid-column: 2; }
.day-totals .person-nutrient { grid-row: auto; grid-template-rows: auto auto; gap: 4px; }
.day-totals .person-nutrient-unit { display: none; }
.day-totals strong { color: var(--ink); font-size: .82rem; font-weight: 600; }
.day-totals > .nutrition-details { grid-column: 2 / -1; }
@container (max-width: 250px) {
  .day-totals .person-nutrient-target { display: none; }
}
.meal-editor-group { gap: 12px; border-top: 1px solid var(--border); padding: 18px 0; }
.meal-editor-group .title-row { margin-bottom: 12px; }
.meal-editor-group:first-child { padding-top: 10px; border-top: 0; }
.group-header { display: flex; align-items: center; gap: 4px; min-height: 44px; }
.person-toggles { display: flex; gap: 2px; margin-left: -5px; }
.person-toggle { width: 44px; min-width: 44px; padding: 0; border: 0; border-radius: 50%; background: transparent; }
.person-toggle:hover, .person-toggle.selected { background: transparent; }
.person-toggle .person-dot { width: 34px; height: 34px; border: 2px solid currentColor; font-size: .85rem; }
.person-toggle:not(.selected) .person-dot { border: 1.5px dashed #b9c0ae; background: transparent; color: #98a18d; }
.person-toggle:disabled { opacity: 1; }
.lock-toggle { width: 44px; min-width: 44px; min-height: 44px; margin: 0 -6px 0 auto; padding: 0; border-radius: 50%; color: #98a18d; }
.lock-toggle.selected { border-color: transparent; }
.meal-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.meal-actions > .add-entry { grid-column: 1 / -1; min-height: 52px; }
.meal-editor-group .meal-decision { margin: 0; }
.reopen { gap: 6px; padding-right: 4px; color: var(--accent); }
.meal-when { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.meal-when > .text-button { gap: 6px; margin-right: -12px; padding: 10px 12px; color: var(--accent); }
.discard-actions > button { flex: 1; }
.day-patterns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 16px 0 22px; }
.day-preparation { display: flex; margin: 16px 0 22px; }
.day-pattern { flex-direction: column; gap: 8px; padding: 12px 6px; }
.pattern-preview { display: flex; gap: 3px; }
.pattern-meal { display: flex; gap: 2px; padding: 2px; border-radius: 6px; }
.pattern-meal.shared { gap: 0; background: #dbe3d1; }
.pattern-meal > span { width: 6px; height: 6px; border-radius: 50%; background: #7b9468; }
.pattern-meal > span + span { background: #c99a78; }
.meal-footer { display: flex; align-items: center; gap: 10px; }
.meal-footer > .primary { flex-shrink: 0; }
.meal-day-totals { display: grid; flex: 1; grid-template-columns: 22px repeat(2, minmax(0, 1fr)); gap: 4px 8px; align-items: center; min-width: 0; color: var(--muted); font-size: .7rem; font-variant-numeric: tabular-nums; }
.meal-day-unit { font-size: .64rem; line-height: 1.2; }
.meal-day-unit:first-child { grid-column: 2; }
.meal-day-total { display: grid; grid-column: 1 / -1; grid-template-columns: subgrid; align-items: center; }
.meal-day-total .person-nutrient { grid-row: auto; grid-template-rows: auto auto; gap: 3px; }
.meal-day-total .person-nutrient-value { flex-wrap: nowrap; white-space: nowrap; overflow: hidden; }
.meal-day-total .person-nutrient-value strong { color: var(--ink); font-size: .78rem; font-weight: 600; }
.meal-day-total .person-nutrient-value > small { font-size: .7rem; }
.meal-day-total .person-nutrient-value > small:not(.person-nutrient-target) { display: none; }
.meal-day-error { grid-column: 1 / -1; color: var(--danger); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 16px 0; }
.outside-estimate { margin: 16px 0; }
.outside-estimate > legend { margin: 0; padding: 0; color: var(--ink); font-size: .85rem; font-weight: 650; }
.outside-estimate > .form-grid { margin: 10px 0 0; }
.position-title .plan-recipe-link { font-size: .9rem; font-weight: 650; }
.position-title .icon-button { width: 40px; min-width: 40px; min-height: 40px; padding: 0; color: var(--muted); }
.position-title .icon-button.selected { color: var(--accent); }
.position-actions { display: flex; flex-shrink: 0; align-items: center; align-self: start; margin: -6px -8px 0 0; }
.position-course { margin-right: 4px; white-space: nowrap; }
.modal-body .position { gap: 10px; padding: 12px 14px 14px; }
.position > .title-row { margin: 0; }
.position-amounts { display: flex; flex-wrap: wrap; gap: 8px; }
.position-amounts > .amount-field { flex: 1 1 0; }
/* Steppers need room for their buttons, so shared portions stack on phones. */
.position-amounts > .portion-amount { flex-basis: 11.5rem; }
.position-amounts > .unit-input { flex: 0 0 72px; }
.position-details { display: grid; gap: 10px; }
.position-details[hidden] { display: none; }
.position-details > .form-grid { margin: 0; align-items: start; }
.position-details .unit-field { grid-column: 1 / -1; }
.amount-field { min-width: 0; }
.person-amount { display: flex; align-items: center; border: 1px solid #d9ded2; border-radius: 10px; background: var(--panel); transition: border-color 150ms, box-shadow 150ms; }
.person-amount:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px #344f4012; }
.person-amount > .amount-input { display: flex; flex: 1; align-items: center; gap: 0; min-width: 0; padding-left: 9px; }
.person-amount input, .person-amount input:focus { min-height: 44px; padding: 10px 6px 10px 8px; border: 0; background: transparent; box-shadow: none; }
.amount-step, .amount-step:hover { flex: 0 0 44px; width: 44px; min-height: 44px; padding: 0; border: 0; border-left: 1px solid #eceee6; border-radius: 0; background: transparent; color: var(--accent); }
.amount-step:last-child { border-radius: 0 10px 10px 0; }
.amount-step:active:not(:disabled) { background: #e5eadd; }
.add-entry { width: 100%; border-style: dashed; background: transparent; color: var(--accent); }
.recipe-picker { display: grid; gap: 14px; min-width: 0; }
.recipe-picker .results { margin-top: 0; }
.recipe-picker .result-section { display: flex; justify-content: space-between; gap: 12px; }
.recipe-picker .category-tabs button { min-height: 44px; }
.leftovers { margin-top: 0; }
.leftovers .result-section { padding-top: 4px; }
.result .leftover-origin { display: flex; align-items: center; gap: 5px; }
.leftover-origin > svg { flex: none; }
.recipe-choice { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; overflow-wrap: anywhere; }
.recipe-choice > small { flex-basis: 100%; }
.result .recipe-choice > small { margin-top: 0; }
.recipe-field > legend { margin-bottom: 7px; padding: 0; }
.chosen-recipe { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: #f6f7f2; font-size: .85rem; font-weight: 550; }
.chosen-recipe small { color: var(--muted); font-size: .71rem; font-weight: 400; }
.slot-week { display: grid; gap: 10px; }
.slot-week-navigation { display: flex; align-items: center; justify-content: space-between; }
.slot-week-navigation .icon-button { width: 44px; min-width: 44px; min-height: 44px; }
.slot-week-navigation strong { font-size: .9rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.slot-grid { display: grid; grid-template-columns: 38px repeat(4, minmax(0, 1fr)); gap: 4px; align-items: center; }
.slot-meal { color: var(--muted); font-size: .7rem; font-weight: 550; text-align: center; }
.slot-meal.suggested { color: var(--accent); font-weight: 750; }
.slot-day { display: grid; color: var(--muted); font-size: .68rem; line-height: 1.25; }
.slot-day strong { color: var(--ink); font-size: .85rem; font-weight: 600; }
.slot-day.today strong { color: #c56543; }
.slot-day.past { opacity: .6; }
.slot-cell { gap: 3px; min-width: 0; min-height: 44px; padding: 4px; border-color: #e4e8dc; background: var(--panel); }
.slot-cell.past { border-color: transparent; background: #f2f3ed; }
.slot-cell.selected, .slot-cell.selected:hover { border-color: var(--accent); background: #e5eadd; box-shadow: inset 0 0 0 1px var(--accent); }
.slot-cell .person-dot { width: 20px; height: 20px; font-size: .6rem; }
.slot-cell .person-dot.no-food { background: transparent; box-shadow: inset 0 0 0 1px currentColor; opacity: .5; }
.slot-cell.current:disabled { border: 1.5px dashed var(--accent); opacity: 1; }
.slot-choice { gap: 6px; }
.slot-choice > strong { font-size: .9rem; font-weight: 600; }
.slot-content { display: grid; gap: 4px; margin: 0; padding: 0; color: var(--muted); font-size: .78rem; list-style: none; }
.slot-content > li { display: flex; align-items: flex-start; gap: 8px; overflow-wrap: anywhere; }
.slot-people { display: flex; flex: none; gap: 2px; }
.slot-content .person-dot { width: 20px; height: 20px; font-size: .6rem; }
.slot-actions { flex-wrap: nowrap; margin-top: 4px; }
.slot-actions > button { flex: 1; }



/* Access */
.login-page { display: flex; flex-direction: column; align-items: center; min-height: 100svh; padding: 32px 44px; }
.login-top { display: flex; justify-content: space-between; align-items: center; width: 100%; max-width: 1232px; }
.privacy-label { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: .75rem; }
.login-card { width: 100%; max-width: 430px; margin: auto; padding: 48px 40px 40px; border: 1px solid var(--border); border-radius: 24px; background: var(--panel); text-align: center; box-shadow: 0 12px 60px #28352e05; }
.login-symbol { display: grid; place-items: center; width: 82px; height: 82px; margin: 0 auto 30px; border-radius: 50%; background: #edf1e7; color: var(--accent); }
.login-card h1 { font-size: 2rem; margin-bottom: 32px; }
.login-card > button { width: 100%; }
.login-card .text-button { margin-top: 10px; }
.account-panel { max-width: 760px; }
.account-panel form label { flex: 1; min-width: 170px; }
.account-panel .title-row { margin: 0; }
.account-panel h2 { margin: 0; }
.agent-connections { padding-top: 24px; border-top: 1px solid var(--border); }
.agent-address { display: flex; align-items: center; gap: 10px; min-width: 0; }
.agent-address code { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: .72rem; color: var(--muted); }
.agent-connection { display: flex; align-items: center; gap: 16px; justify-content: space-between; }
.agent-connection > div { display: grid; gap: 5px; }
.agent-connection small { color: var(--muted); }
.consent-panel { max-width: 460px; margin: 24px auto; }

@media (max-width: 1100px) {
  .header-inner { padding: 0 30px; gap: 20px; }
  .main-nav a { padding: 0 12px; }
  .account-link strong { display: none; }
  .workspace { padding: 42px 30px; }
  .plan-grid { gap: 8px; }
  .plan-meal { padding: 12px 9px; }
  .meal-slot-label { gap: 4px; }
  .recipe-card { padding: 21px 20px 15px; }
  .collection-item { grid-template-columns: 40px minmax(0, 1fr) auto 130px 16px; gap: 14px; padding: 18px 20px; }
}
@media (max-width: 960px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-two { grid-template-columns: minmax(0, 1fr); }
  .collection-item { grid-template-columns: 40px minmax(0, 1fr) 120px 16px; }
  .collection-item .source-badge { grid-column: 2; }
  .collection-name { grid-column: 2; }
  .collection-icon { grid-column: 1; grid-row: 1 / 3; }
  .collection-nutrition { grid-column: 3; grid-row: 1 / 3; }
  .collection-item > .icon { grid-column: 4; grid-row: 1 / 3; }
}
@media (max-width: 1199px) {
  .plan-days { display: flex; gap: 4px; overflow-x: auto; margin: 0 0 16px; padding: 12px 0; border-block: 1px solid var(--border); scrollbar-width: thin; }
  .plan-days button { display: grid; flex: 1 0 36px; gap: 4px; min-width: 36px; min-height: 62px; padding: 8px 4px; border-color: transparent; background: transparent; }
  .plan-days button { position: relative; }
  .plan-total-heading { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .plan-days button > span { font-size: .72rem; color: var(--muted); }
  .plan-days button > strong { font-size: 1rem; }
  .plan-days button.today:not([aria-pressed=true]) { border-color: #9fb38f; }
  .plan-days button.open::after { content: ""; position: absolute; bottom: 6px; left: 50%; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: #c0794f; }
  .plan-days button.in-window:not([aria-pressed=true]) { background: #e5ecdc; }
  .plan-days button[aria-pressed=true] { border-color: #344f40; background: var(--accent); color: white; }
  .plan-days button[aria-pressed=true] > span { color: #e1e9d8; }
}
@media (max-width: 760px) {
  .header-inner { height: 74px; padding: 0 24px; gap: 12px; }
  .brand { font-size: 1.7rem; }
  .main-nav a { padding: 0 10px; }
  .main-nav a > .icon { display: none; }
  .account-link > .icon { display: none; }
  .workspace { padding: 36px 24px; }
  .library-toolbar { gap: 10px; }
  .search-field { flex-basis: 100%; }
  .collection-bar { align-items: flex-start; flex-direction: column; gap: 10px; }
  .plan-week-header { display: none; }
  .planner-body > .plan-days { order: 1; position: sticky; top: 75px; z-index: 4; margin: 0; padding: 6px 0; background: var(--paper); box-shadow: 0 8px 10px -10px #2b3a2c66; }
  .planner-body > .plan-days button { min-height: 52px; gap: 2px; padding: 6px 4px; }
  .planner-body > .plan-grid { order: 2; }
  .plan-toolbar > .plan-range { flex: 1 1 0; }
  /* The transparent border keeps the whole 44px segment tappable around the visible pill. */
  .plan-mode { display: flex; gap: 0; padding: 0; }
  .plan-mode > button { min-width: 44px; padding: 0 10px; border: 3px solid transparent; border-radius: 10px; background-clip: padding-box; }
  .plan-mode > button.selected { background-clip: padding-box; box-shadow: none; }
  .planner-body:not(.week) > .plan-totals, .planner-body.week > .plan-days, .planner-body.week > .plan-grid { display: none; }
  .planner-body.week > .plan-totals { display: grid; gap: 4px; margin: 12px 0 16px; }
  .planner-body.week .plan-totals-units { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 0 86px 0 32px; color: var(--muted); }
  .planner-body.week .plan-total { display: flex; flex-wrap: wrap; align-items: center; gap: 0 10px; max-width: none; min-width: 0; padding: 0; border: 0; border-radius: 0; background: transparent; }
  .planner-body.week .plan-total-heading { display: grid; flex: 1 1 0; grid-template-columns: 22px repeat(2, minmax(0, 1fr)); align-items: center; gap: 4px 10px; min-height: 44px; }
  .planner-body.week .plan-person-heading, .planner-body.week .plan-person-nutrients { display: contents; }
  .planner-body.week .plan-person-heading > .person-dot { grid-row: auto; width: 22px; height: 22px; font-size: .66rem; }
  .planner-body.week .plan-person-heading > :not(.person-dot) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .planner-body.week .person-nutrient { grid-row: auto; grid-template-rows: auto auto; gap: 4px; }
  .planner-body.week .person-nutrient-unit { display: none; }
  .planner-body.week .plan-person-nutrients strong { font-size: .82rem; font-weight: 600; letter-spacing: 0; }
  .planner-body.week .person-nutrient-value > small { font-size: .72rem; }
  .planner-body.week .plan-total > .nutrition-details:not([open]) { flex: 0 0 76px; text-align: right; }
  .planner-body.week .plan-total > .nutrition-details[open] { flex-basis: 100%; }
  .week-overview { display: grid; }
  .plan-meal { scroll-margin-top: 175px; }
  .plan-days button.in-window:not([aria-pressed=true]) { background: transparent; }
  .planner-heading { margin-bottom: 0; padding-bottom: 4px; border-bottom: 0; }
  .plan-grid { grid-template-columns: 1fr; grid-template-rows: auto; gap: 0; }
  .plan-day { grid-column: 1; grid-row: auto; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; gap: 24px; }
  .plan-day.today { background: transparent; box-shadow: none; }
  .plan-day.past { opacity: 1; }
  .plan-day:not(.selected) { display: none; }
  .day-preparations, .daily-foods { grid-column: 1 / -1; }
  .day-preparations { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .day-meals { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .day-section-heading { grid-column: 1 / -1; min-height: 36px; color: var(--ink); font-size: .9rem; letter-spacing: -.02em; }
  .day-meals > .meals-heading { display: flex; }
  .day-section-heading .icon-button { min-height: 44px; }
  .daily-foods { padding: 12px 0 0; border: 0; }
  .daily-foods .day-section-heading { color: var(--muted); font-size: .78rem; }
  .daily-food-entry { grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 5px 12px; }
  .daily-food-entry strong { grid-column: 1 / -1; }
  .daily-food-entry strong, .cooking-entry strong { font-size: .8rem; }
  .daily-food-entry small, .cooking-entry small { font-size: .75rem; }
  .preparation-link { font-size: .8rem; }
  .plan-meal { min-height: 0; padding: 14px 15px; gap: 12px; }
  .meal-edit-icon { top: 15px; right: 15px; }
  .plan-meal.quiet { padding: 10px 44px 10px 15px; }
  .meal-slot-label { font-size: .8rem; gap: 6px; }
  .meal-name { font-size: .94rem; }
  .planned-amounts { font-size: .8rem; }
  .day-totals { gap: 6px 12px; padding: 12px 0 0; border: 0; }
  .plan-person-nutrients { gap: 10px; }
}
@media (max-width: 600px) {
  .app-header { position: static; background: var(--paper); backdrop-filter: none; }
  .planner-body > .plan-days { top: 0; }
  .plan-meal { scroll-margin-top: 100px; }
  .header-inner { display: flex; justify-content: space-between; padding: 0 22px; height: 56px; }
  .brand { font-size: 1.4rem; }
  .brand-mark { width: 26px; height: 28px; }
  .account-link .avatar { width: 30px; height: 30px; }
  .main-nav { position: fixed; top: auto; bottom: 0; left: 0; right: 0; justify-content: space-around; gap: 0; padding: 7px 10px calc(7px + env(safe-area-inset-bottom)); border-radius: 0; background: #fffffff5; border-top: 1px solid var(--border); box-shadow: 0 -4px 24px #28352e06; backdrop-filter: blur(16px); }
  .main-nav a { flex: 1; flex-direction: column; gap: 4px; min-height: 49px; padding: 5px 4px; border-radius: 10px; font-size: .7rem; }
  .main-nav a > .icon { display: block; width: 20px; height: 20px; }
  .main-nav a[aria-current=page] { background: #edf2e7; box-shadow: none; }
  .account-link > .icon { display: block; }
  .account-link { gap: 8px; }
  .workspace { padding: 18px 22px calc(100px + env(safe-area-inset-bottom)); }
  h1 { font-size: 2.15rem; }
  h2 { font-size: 1.3rem; }
  .page-heading { align-items: flex-start; flex-direction: column; gap: 22px; margin-bottom: 25px; }
  .page-heading h1 { gap: 13px; }
  .eyebrow { margin-bottom: 10px; }
  .page-heading > .button { width: 100%; }
  .heading-actions { width: 100%; flex-wrap: wrap; gap: 9px; }
  .heading-actions > button { flex: 1; }
  .library-toolbar { margin-bottom: 18px; }
  .recipe-library-heading { gap: 8px; margin-bottom: 12px; }
  .recipe-library-heading .library-toolbar { gap: 8px; }
  .recipe-library-heading .search-field { gap: 10px; padding: 0 12px; }
  .recipe-library-heading .search-field input { min-height: 44px; padding: 10px 0; text-overflow: ellipsis; }
  /* The transparent native select covers the icon, so a tap opens the system picker. */
  .sort-control { position: relative; flex: none; justify-content: center; width: 46px; height: 46px; border: 1px solid #dfe1d8; border-radius: 11px; background: #ffffffb3; }
  .sort-control:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px #344f4010; }
  .sort-control.active { color: var(--accent); border-color: #b9c7ad; background: #e5eadd; }
  .sort-control select { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; opacity: 0; cursor: pointer; }
  .recipe-add { width: 46px; min-width: 46px; min-height: 46px; }
  .category-tabs { flex-wrap: nowrap; gap: 6px; overflow-x: auto; scrollbar-width: none; }
  .category-tabs::-webkit-scrollbar { display: none; }
  .category-tabs button { flex: none; padding: 7px 12px; border-color: var(--border); border-radius: 999px; background: var(--panel); font-size: .74rem; min-height: 36px; }
  .category-tabs button.selected { border-color: #d4dec8; }
  .collection-bar { margin-bottom: 18px; }
  .cards { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .recipe-card { padding: 23px 23px 15px; }
  .recipe-card-heading h2 { min-height: 0; font-size: 1.3rem; }
  .recipe-meta { font-size: .73rem; }
  .recipe-card .nutrition-summary { margin-top: 0; }
  .recipe-row { flex-direction: column; align-items: stretch; padding: 12px 16px; }
  .recipe-row > strong { font-size: .86rem; }
  .recipe-row-facts { display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: .72rem; }
  .recipe-topbar { gap: 6px; }
  .recipe-topbar .back-link { min-width: 44px; }
  .recipe-topbar .button-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .recipe-topbar .cook-toggle { width: 44px; min-width: 44px; padding: 0; }
  .recipe-title { font-size: 1.65rem; letter-spacing: -.035em; }
  .nutrition { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel, .recipe-editor .panel { padding: 20px; border-radius: 14px; }
  .recipe-ingredients.panel, .recipe-steps.panel, .recipe-nutrition.panel { padding: 0; border: 0; border-radius: 0; background: none; }
  .stack { gap: 18px; }
  .grid-two { gap: 18px; }
  .recipe-controls { padding: 16px; gap: 14px; }
  .recipe-controls label { min-width: 0; flex: 1; }
  .ingredient-list { grid-template-columns: fit-content(5.5rem) minmax(0, 1fr); column-gap: 12px; }
  .ingredient-row { grid-template-columns: 26px minmax(0, 1fr) 50px 84px; gap: 5px; }
  .ingredient-row input, .ingredient-name { padding-left: 6px; padding-right: 6px; }
  /* Touch keyboards offer the unit suggestions on focus, so the narrow field keeps its width for text. The browser sets the indicator display inline. */
  .ingredient-unit::-webkit-calendar-picker-indicator, .ingredient-unit::-webkit-list-button { display: none !important; }
  .ingredient-name { font-size: .8rem; }
  .drag-handle { width: 26px; min-width: 26px; }
  .group-heading { padding-left: 24px; }
  .step-row { grid-template-columns: 26px minmax(0, 1fr) 32px; gap: 5px; }
  .step-row .step-number { display: none; }
  .step-row textarea:not(:focus) { max-height: calc(2lh + 17px); }
  .step-row .icon-button { width: 32px; min-width: 32px; padding: 7px; }
  .step { gap: 12px; font-size: .84rem; }
  .categories { gap: 6px; }
  .categories label { padding: 9px 10px; font-size: .71rem; }
  .editor-actions { bottom: calc(66px + env(safe-area-inset-bottom)); }
  .editor-actions .primary { width: 100%; }
  dialog.modal { width: calc(100vw - 24px); max-height: calc(100dvh - 32px); border-radius: 17px; }
  .modal-header { padding: 18px 20px; }
  .modal-header h2 { font-size: 1.25rem; }
  .modal-body { padding: 20px; }
  .modal-body .panel { padding: 16px; }
  .sheet-footer { margin: 18px -20px -20px; padding: 12px 20px; }
  dialog.modal[open]:has(> .modal-body > .sheet) { display: flex; flex-direction: column; width: 100%; max-width: none; height: 100dvh; max-height: 100dvh; margin: 0; border: 0; border-radius: 0; }
  dialog.modal:has(> .modal-body > .sheet) > .modal-header { padding-top: calc(18px + env(safe-area-inset-top)); }
  dialog.modal:has(> .modal-body > .sheet) > .modal-body { display: flex; flex: 1 0 auto; flex-direction: column; }
  .modal-body > .sheet { flex: 1 0 auto; }
  .modal-body > form.sheet { display: flex; flex-direction: column; }
  .modal-body > .sheet > .sheet-footer { margin-top: auto; padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .picker-toolbar select { flex-basis: 100%; }
  .picker-toolbar button { flex: 1; }
  .collection-heading { gap: 6px; }
  .collection-tabs a { padding: 10px 11px; }
  .collection-tabs a > .icon { display: none; }
  .collection-heading .heading-actions { width: auto; flex-wrap: nowrap; }
  .collection-heading .heading-actions > button { flex: 0 0 auto; width: 44px; padding: 10px; }
  .collection-heading .button-label { display: none; }
  .collection-item { grid-template-columns: minmax(0, 1fr) auto 16px; gap: 4px 10px; padding: 12px 16px; }
  .collection-icon { display: none; }
  .collection-name { grid-column: 1 / 3; grid-row: 1; gap: 2px; }
  .collection-name strong { font-size: .86rem; }
  .collection-name small { font-size: .69rem; }
  .collection-item .source-badge { grid-column: 2; grid-row: 2; align-self: center; margin: 0; }
  .collection-nutrition { grid-column: 1; grid-row: 2; display: flex; flex-wrap: wrap; align-items: baseline; gap: 5px 12px; }
  .collection-nutrition strong { font-size: .78rem; }
  .collection-nutrition > span { font-size: .66rem; }
  .collection-item > .icon { grid-column: 3; grid-row: 1 / 3; }
  .planner-heading { gap: 6px; }
  .planner-heading .actions { flex-wrap: nowrap; gap: 6px; }
  .planner-heading .button-label { display: none; }
  .planner-heading .actions > button { width: 44px; padding: 10px; }
  .plan-range { gap: 3px; }
  .range-navigation { gap: 0; }
  .range-navigation .icon-button { width: 32px; min-width: 32px; padding: 7px; }
  .range-picker { padding: 8px 7px; font-size: .74rem; gap: 6px; }
  .range-picker > .icon { display: none; }
  .plan-range > .text-button { padding: 8px; font-size: .74rem; }
  .plan-toolbar { gap: 4px 2px; }
  .plan-toolbar .actions { gap: 2px; }
  .plan-toolbar .range-navigation .icon-button { width: 44px; min-width: 44px; min-height: 44px; padding: 12px; }
  .plan-toolbar .range-picker { padding: 4px 2px; line-height: 1.25; text-align: center; }
  .plan-toolbar .range-year { display: none; }
  .plan-toolbar .plan-range > .text-button { min-width: 44px; padding: 0 5px; }
  /* In the current week the day strip and the agenda already mark today. */
  .plan-toolbar .plan-range > .text-button.current { display: none; }
  .plan-mode > button { padding: 0 4px; font-size: .74rem; }
  .plan-total { max-width: none; min-width: 0; flex-basis: 100%; padding: 12px 14px; gap: 6px; }
  .plan-total-heading { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .plan-totals { margin-bottom: 18px; gap: 8px; }
  .plan-person-nutrients { padding-right: 0; }
  .plan-person-nutrients strong { font-size: 1.05rem; }
  .form-grid { gap: 10px; }
  .form-grid label:has(input[type=date]) { grid-column: 1 / -1; }
  .agent-connection { flex-wrap: wrap; }
  .login-page { padding: 26px 24px; }
  .login-card { padding: 38px 27px 30px; margin: auto; }
  .login-card h1 { font-size: 1.85rem; }
}
/* iOS zooms into focused inputs below 16px, also on phones in landscape. */
@media (pointer: coarse) {
  input, textarea, select, .search-field input, .group-heading input, .sort-control select { font-size: 16px; }
}
@media (max-width: 380px) {
  .header-inner { padding: 0 18px; }
  .workspace { padding-left: 18px; padding-right: 18px; }
  .category-tabs button { padding: 7px 10px; }
  .range-picker { font-size: .69rem; }
  .recipe-card { padding: 20px; }
  .modal-body { padding: 16px; }
  .sheet-footer { margin-left: -16px; margin-right: -16px; margin-bottom: -16px; padding-left: 16px; padding-right: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

.portion-allocation { display: grid; gap: 8px; margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--border); }
.portion-allocation h3 { margin: 0; font-size: .9rem; }
.allocation-whole { position: relative; width: 100%; min-width: 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.allocation-cell { position: absolute; box-sizing: border-box; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 8px; border: 2px solid var(--surface, white); text-align: center; overflow-wrap: anywhere; }
.allocation-cell strong { font-size: .9rem; }
.allocation-cell small { font-size: .72rem; line-height: 1.25; }
.allocation-cell .allocation-servings { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.allocation-total { max-width: 11rem; }
.allocation-weight { font-size: .9rem; font-variant-numeric: tabular-nums; }
.allocation-color-0, .allocation-color-0:hover { background: #e4ece5; }
.allocation-color-1, .allocation-color-1:hover { background: #f4e7d7; }
.allocation-color-2, .allocation-color-2:hover { background: #e8e6f0; }
.allocation-color-3, .allocation-color-3:hover { background: #f1f2ed; }
.allocation-bar { display: flex; height: 36px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.allocation-bar > span { display: grid; place-items: center; flex-basis: 0; min-width: 0; overflow: hidden; border-left: 2px solid var(--panel); color: var(--ink); font-size: .72rem; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.allocation-bar > span:first-child { border-left: 0; }
.allocation-measured { display: grid; gap: 6px; }
.allocation-row { display: flex; flex-wrap: wrap; gap: 6px 12px; justify-content: space-between; padding: 10px; border-radius: 8px; overflow-wrap: anywhere; }
.allocation-row > span { display: grid; gap: 3px; min-width: 0; }
.allocation-row > span:last-child { justify-items: end; text-align: right; }
.allocation-row b, .allocation-row strong { font-size: .85rem; }
.allocation-row small, .allocation-limit { font-size: .75rem; }

.allocation-cell { border-radius: 0; color: var(--ink); white-space: normal; }
.allocation-cell:disabled, .allocation-row:disabled { opacity: 1; color: inherit; cursor: default; }
.allocation-row { text-align: left; }
