:root {
  font-family: var(--font-body);
  color: #25283b;
  background: #f4f1eb;
  font-synthesis: none;
  --ink: #25283b;
  --muted: #737583;
  --primary: #29324c;
  --iris: #56658c;
  --primary-soft: #e9eaf2;
  --cream: #f4f1eb;
  --paper: #fffcf7;
  --copper: #b6674e;
  --copper-soft: #f5e7df;
  --line: #dfdcd5;
  --shadow: 0 18px 45px rgba(39, 37, 46, .10);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--cream); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { color: var(--ink); }
.shell { min-height: 100vh; display: grid; grid-template-columns: 236px minmax(0,1fr); transition: grid-template-columns .2s ease; }
.shell.sidebar-collapsed { grid-template-columns: 76px minmax(0,1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 25px 18px 22px; border-right: 1px solid #343951; background: #252a40; }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 2px 39px; }
.brand { display: flex; align-items: center; gap: 9px; min-width: 0; color: #fff9f1; font-family: var(--font-display); font-size: 1.18rem; font-weight: 800; letter-spacing: -.05em; text-decoration: none; white-space: nowrap; }
.brand-logo-frame { flex: 0 0 auto; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 9px; background: #252a40; }
.brand-logo { display: block; width: 42px; height: 42px; }
.sidebar-toggle { flex: 0 0 auto; display: grid; place-items: center; width: 31px; height: 31px; border: 1px solid #555c74; border-radius: 6px; background: transparent; color: #d8d9e2; font-family: var(--font-body); font-size: 1.05rem; }
.sidebar-toggle:hover, .sidebar-toggle:focus-visible { border-color: #e6b197; color: #fff9f1; }
.sidebar-toggle:focus-visible, .nav-item:focus-visible { outline: 2px solid #e6b197; outline-offset: 2px; }
.sidebar-collapsed .sidebar { padding-inline: 10px; }
.sidebar-collapsed .sidebar-head { flex-direction: column; gap: 17px; margin-inline: 0; }
.sidebar-collapsed .brand-name, .sidebar-collapsed .nav-label { display: none; }
.sidebar-collapsed .nav-item { justify-content: center; padding-inline: 0; }
#primary-nav { display: grid; gap: 5px; }
.nav-item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 45px; padding: 0 13px; border: 0; border-radius: 8px; background: transparent; color: #c2c5d1; font-weight: 600; text-align: left; }
.nav-icon { flex: 0 0 auto; display: grid; place-items: center; width: 23px; color: #979db1; }
.nav-svg { display: block; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.nav-item:hover { background: #333950; color: #fff9f1; }
.nav-item.active { background: #424963; color: #fff9f1; box-shadow: inset 3px 0 0 var(--copper); }
.nav-item.active .nav-icon { color: #e6b197; }
.sidebar-foot { display: grid; gap: 14px; margin-top: auto; }
.main { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; min-height: 92px; padding: 18px clamp(24px,4vw,58px); border-bottom: 1px solid var(--line); background: rgba(244,241,235,.94); backdrop-filter: blur(14px); }
.eyebrow { margin-bottom: 7px; color: var(--copper); font-family: var(--font-label); font-size: .62rem; font-weight: 500; letter-spacing: .09em; text-transform: uppercase; }
.topbar h1 { font-family: var(--font-display); font-size: 1.85rem; font-weight: 780; letter-spacing: -.055em; line-height: 1; }
.top-actions { display: flex; align-items: center; gap: 9px; }
.household-picker { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; color: var(--muted); font-size: .6rem; font-weight: 700; }
.household-picker[hidden] { display: none; }
.household-picker { max-width: 220px; min-width: 0; }
.household-picker .choice-trigger { min-height: 42px; }
.icon-button { display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); color: var(--primary); font-size: 1.15rem; }
.icon-button:hover { border-color: #a7aec5; }
.notification-button { position: relative; }
.notification-count { position: absolute; top: -7px; right: -7px; min-width: 19px; padding: 1px 4px; border-radius: 10px; background: var(--copper); color: white; font-size: .65rem; font-weight: 800; }
.notification-item.unread { border-color: var(--copper); }
.notification-new { color: var(--copper); font-size: .72rem; font-weight: 800; }
.account-button { display: flex; align-items: center; gap: 9px; min-height: 42px; padding: 5px 12px 5px 5px; border: 1px solid var(--line); border-radius: 13px; background: var(--paper); color: var(--ink); font-size: .78rem; font-weight: 700; }
.account-button > span:first-child { display: grid; place-items: center; width: 31px; height: 31px; border-radius: 10px; background: var(--primary); color: white; font-size: .68rem; }
.mode-badge, .pill { display: inline-flex; align-items: center; min-height: 25px; padding: 0 9px; border-radius: 999px; background: var(--copper-soft); color: #8d4a36; font-size: .66rem; font-weight: 700; }
.content { max-width: 1440px; margin: 0 auto; padding: 34px clamp(24px,4vw,58px) 70px; }
.loading { display: grid; place-items: center; gap: 14px; min-height: 55vh; color: var(--muted); font-size: .85rem; }
.loader { width: 34px; height: 34px; border: 3px solid var(--primary-soft); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.hero { position: relative; overflow: hidden; display: grid; grid-template-columns: minmax(0,1.3fr) minmax(250px,.7fr); gap: 36px; min-height: 255px; padding: clamp(28px,5vw,56px); border: 1px solid #cbbcac; border-radius: 10px; background: #eae0d3; color: var(--ink); }
.hero-copy { position: relative; z-index: 1; align-self: center; }
.hero .eyebrow { color: #8f4b37; }
.hero h2 { max-width: 650px; color: var(--ink); font-family: var(--font-display); font-size: clamp(2.25rem,4.2vw,4.05rem); font-weight: 790; line-height: .95; letter-spacing: -.065em; }
.hero p:not(.eyebrow) { max-width: 570px; margin-top: 18px; color: #505366; line-height: 1.55; }
.hero-stat { position: relative; z-index: 1; align-self: stretch; display: grid; align-content: end; gap: 6px; padding: 20px 0 0 28px; border-left: 1px solid #c2b3a3; }
.hero-stat strong { color: var(--ink); font-family: var(--font-display); font-size: 4.5rem; font-weight: 750; letter-spacing: -.07em; line-height: .9; }
.hero-stat span { color: #505366; font-size: .78rem; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin: 38px 0 16px; }
.section-head h2 { font-family: var(--font-display); font-size: 1.55rem; font-weight: 740; letter-spacing: -.05em; }
.section-head p { margin-top: 5px; color: var(--muted); font-size: .78rem; }
.button { min-height: 42px; padding: 0 16px; border: 0; border-radius: 9px; font-weight: 700; }
.button.primary { background: var(--primary); color: white; }
.button.primary:hover { background: #3d486b; }
.button.secondary { background: var(--copper); color: white; }
.button.ghost { border: 1px solid var(--line); background: var(--paper); color: var(--primary); }
.button.danger { background: #fbe8e5; color: #a23c30; }
.button.small { min-height: 33px; padding: 0 11px; font-size: .7rem; }
.card-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px; }
.planning-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .8rem; line-height: 1.6; }
.planning-tabs { display: flex; gap: 24px; margin-bottom: 26px; border-bottom: 1px solid var(--line); }
.planning-tabs button { min-height: 44px; padding: 0 2px 11px; border: 0; border-bottom: 3px solid transparent; background: transparent; color: var(--muted); font-size: .82rem; font-weight: 700; }
.planning-tabs button[aria-selected="true"] { border-bottom-color: var(--copper); color: var(--primary); }
.planning-tabs button:focus-visible, .text-button:focus-visible { outline: 2px solid var(--iris); outline-offset: 3px; }
.plan-toolbar { align-items: end; margin-bottom: 13px; }
.plan-actions, .rule-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.plan-summary { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; color: var(--muted); font-size: .72rem; }
.text-button { padding: 0; border: 0; background: transparent; color: var(--iris); font-size: .72rem; text-decoration: underline; text-underline-offset: 3px; }
.week-notes-row { display: flex; align-items: start; gap: 16px; margin-bottom: 22px; padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.week-notes-row details { flex: 1; min-width: 0; }
.week-notes-row summary { padding-block: 8px; cursor: pointer; font-size: .76rem; font-weight: 700; }
.week-notes-row .planning-text { margin-top: 8px; color: var(--muted); }
.week-notes-row > button { flex: 0 0 auto; }
.notes-indicator { margin-left: 9px; color: var(--muted); font-size: .66rem; font-weight: 400; }
.open-week { margin-bottom: 18px; }
.planning-rules-page { max-width: 780px; }
.planning-rules-page > .section-head { align-items: start; margin: 0 0 22px; }
.planning-rules-page .section-head p { line-height: 1.5; }
.planning-rules-page .section-head > button { flex-shrink: 0; }
.rule-version { margin-bottom: 12px; }
.rule-actions { margin-top: 24px; }
#planning-rule-history { margin-top: 28px; }
#planning-rule-history h3 { margin-bottom: 14px; font-size: .9rem; }
#planning-rule-history .row-copy strong { white-space: normal; }
#planning-rule-history button { flex-shrink: 0; }
.dashboard-grid > [data-dashboard-card] > .card { height: 100%; }
.today-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin: 0 0 24px; }
.today-heading h2 { font-family: var(--font-display); font-size: clamp(2rem,4vw,3.2rem); font-weight: 780; letter-spacing: -.055em; }
.card.today-plan { border-color: #cbbcac; background: #eae0d3; }
.today-plan > .card-head h3 { font-size: 1.1rem; }
.today-meals { display: grid; gap: 14px; }
.today-meal { display: flex; align-items: center; gap: 16px; padding: 16px 0; border-top: 1px solid #cbbcac; }
.today-meal > div:first-of-type { flex: 1; min-width: 0; }
.today-meal h3 { font-family: var(--font-display); font-size: 1.2rem; }
.today-meal p { margin-top: 6px; line-height: 1.5; }
.today-meal-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.home-attention-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; margin-top: 18px; }
.home-shortcuts { display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0; }
.section-loading { display: flex; align-items: center; gap: 12px; min-height: 100px; color: var(--muted); font-size: .85rem; }
.section-loading .loader { flex: 0 0 auto; width: 22px; height: 22px; }
.section-error { display: grid; justify-items: start; gap: 14px; padding: 18px 0; color: var(--muted); }
.household-dashboard { margin-top: 32px; border-top: 1px solid var(--line); }
.household-dashboard summary { padding: 22px 0; cursor: pointer; font-weight: 700; }
.household-dashboard summary span { margin-left: 10px; color: var(--muted); font-size: .75rem; font-weight: 400; }
@media (max-width: 650px) {
  .today-heading { align-items: start; flex-direction: column; }
  .home-attention-grid { grid-template-columns: 1fr; }
  .today-meal { align-items: start; flex-wrap: wrap; }
  .today-meal > div:first-of-type { flex-basis: calc(100% - 110px); }
  .today-plan > .card-head { align-items: start; flex-wrap: wrap; }
  .household-dashboard summary span { display: block; margin: 6px 0 0; }
}
.card { min-width: 0; padding: 21px; border: 1px solid var(--line); border-radius: 13px; background: var(--paper); box-shadow: 0 5px 18px rgba(39,37,46,.035); }
.card.clickable { transition: transform .18s ease, box-shadow .18s ease; }
.card.clickable:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 17px; }
.card-head h3 { font-family: var(--font-display); font-size: .93rem; font-weight: 720; letter-spacing: -.025em; }
.card-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; background: var(--primary-soft); color: var(--primary); font-weight: 800; }
.metric { font-family: var(--font-display); font-size: 2.35rem; font-weight: 720; letter-spacing: -.06em; line-height: 1; }
.muted { color: var(--muted); }
.tiny { font-size: .7rem; }
.stack { display: grid; gap: 9px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-width: 0; padding: 11px 0; border-bottom: 1px solid var(--line); }
.row:last-child { padding-bottom: 0; border-bottom: 0; }
.row:first-child { padding-top: 0; }
.row-copy { min-width: 0; }
.row-copy strong, .row-copy small { display: block; }
.row-copy strong { overflow: hidden; font-size: .78rem; text-overflow: ellipsis; white-space: nowrap; }
.row-copy small { margin-top: 3px; color: var(--muted); font-size: .68rem; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { padding: 5px 8px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-size: .63rem; font-weight: 700; }
.tag.orange { background: var(--copper-soft); color: #8d4a36; }
.recipe-tag-button { border: 0; cursor: pointer; font: inherit; }
.recipe-tag-button:hover, .recipe-tag-button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.recipe-tag-button.active { background: var(--primary); color: white; }
.recipe-tag-button span { opacity: .68; margin-left: 3px; }
.recipe-tags { margin-top: 12px; }
.recipe-filter { display: flex; align-items: center; gap: 8px; margin: 0 0 16px; font-size: .75rem; }
.recipe-tag-filter { padding: 14px; margin: -4px 0 18px; border: 1px solid var(--line); border-radius: 13px; background: var(--paper); }
.recipe-tag-filter-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 11px; }
.recipe-tag-filter-head strong { font-size: .78rem; }
.recipe-tag-filter-head p { margin-top: 3px; color: var(--muted); font-size: .68rem; }
.recipe-tag-filter-head input { width: min(220px, 50%); min-height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--paper); color: var(--ink); }
.recipe-tag-filter > p { margin-top: 8px; }
.recipe-tag-suggestions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin: -9px 0 16px; }
.recipe-tag-suggestions > span { margin-right: 4px; color: var(--muted); font-size: .68rem; }
.empty { display: grid; place-items: center; min-height: 170px; padding: 28px; border: 1px dashed #bfc1ca; border-radius: 12px; color: var(--muted); text-align: center; }
.empty b { margin-bottom: 6px; color: var(--ink); }
.week-grid { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); gap: 10px; align-items: start; }
.day-card { min-width: 0; padding: 15px; border: 1px solid var(--line); border-radius: 11px; background: var(--paper); }
.day-card > b { display: block; color: var(--copper); font-family: var(--font-label); font-size: .64rem; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; }
.day-card .mode { display: inline-block; margin: 6px 0 13px; color: var(--muted); font-size: .66rem; text-transform: capitalize; }
.meal { padding: 9px 0; border-top: 1px solid var(--line); }
.meal small, .meal strong { display: block; }
.meal small { color: var(--muted); font-family: var(--font-label); font-size: .58rem; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; }
.meal strong { margin-top: 3px; font-size: .72rem; line-height: 1.4; overflow-wrap: anywhere; }
.planned-meal-label { display: block; line-height: 1.4; overflow-wrap: anywhere; }
.meal-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 4px; }
.meal-actions .button { min-height: 30px; padding: 0; border: 0; background: transparent; font-weight: 500; }
.meal-actions .button:hover { text-decoration: underline; }
.meal-actions [data-action="remove-meal"] { color: var(--muted); }
.day-add { width: 100%; margin-top: 12px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.search { width: min(380px,100%); min-height: 44px; padding: 0 14px; border: 1px solid var(--line); border-radius: 13px; background: var(--paper); color: var(--ink); outline: none; }
.search:focus, input:focus, select:focus, textarea:focus { border-color: var(--iris); box-shadow: 0 0 0 3px rgba(86,101,140,.13); }
.pantry-toolbar-actions { display: flex; align-items: center; gap: 14px; }
.pantry-photo-trigger { border: 0; background: transparent; color: var(--muted); font-size: .72rem; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.pantry-photo-trigger:hover { color: var(--primary); }
.pantry-photo-trigger:focus-visible { outline: 2px solid var(--iris); outline-offset: 3px; }
.pantry-photo-panel { margin: -2px 0 20px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.pantry-photo-panel h2 { margin-bottom: 6px; font-family: var(--font-display); font-size: 1rem; }
.pantry-filters { display: flex; gap: 7px; overflow-x: auto; padding: 2px 0 10px; margin-bottom: 5px; }
.pantry-filter { flex: 0 0 auto; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); color: var(--ink); padding: 8px 12px; font: inherit; font-size: .72rem; cursor: pointer; }
.pantry-filter.active { background: var(--primary); border-color: var(--primary); color: white; }
.pantry-filter span { opacity: .7; margin-left: 4px; }
.pantry-result-count { margin: 0 0 12px; }
.pantry-item-category { display: block; margin-top: 3px; color: var(--muted); font-weight: 400; }
.pantry-photo-intro { margin-bottom: 16px; }
.pantry-photo-empty { padding: 11px 0 2px; }
.pantry-photo-list { display: grid; gap: 16px; }
.pantry-photo-card { display: grid; grid-template-columns: minmax(180px, 260px) minmax(0, 1fr); gap: 20px; }
.pantry-photo-preview { display: grid; place-items: center; min-height: 175px; border-radius: 9px; background: var(--cream); color: var(--muted); font-size: .75rem; text-align: center; }
.pantry-photo-preview img { display: block; width: 100%; max-height: 280px; border-radius: 9px; object-fit: contain; }
.pantry-photo-details { min-width: 0; }
.pantry-photo-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 5px; }
.pantry-photo-heading h3 { font-family: var(--font-display); font-size: 1.04rem; }
.pantry-photo-details p:not(.muted) { margin-top: 12px; font-size: .82rem; }
.pantry-photo-details h4 { margin: 18px 0 5px; font-size: .76rem; }
.pantry-photo-details ul { margin: 0; padding-left: 20px; font-size: .78rem; line-height: 1.6; }
.pantry-photo-more { margin-top: 18px; }
.pantry-photo-loading { min-height: 180px; }
.recipe-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px; }
.recipe-card { overflow: hidden; padding: 0; }
.recipe-art { display: grid; place-items: center; height: 120px; background: linear-gradient(145deg,#e7c2ad,var(--copper-soft)); color: #43435d; font-family: var(--font-display); font-size: 2.6rem; font-weight: 700; }
.recipe-card:nth-child(3n+2) .recipe-art { background: linear-gradient(145deg,#cbd0e2,#e9eaf2); }
.recipe-card:nth-child(3n+3) .recipe-art { background: linear-gradient(145deg,#e8d5c9,#d8dbea); }
.recipe-body { padding: 19px; }
.recipe-body h3 { font-family: var(--font-display); font-size: 1.2rem; font-weight: 720; letter-spacing: -.04em; }
.recipe-body p { display: -webkit-box; min-height: 2.6em; margin: 6px 0 13px; overflow: hidden; color: var(--muted); font-size: .72rem; line-height: 1.35; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.recipe-meta { display: flex; gap: 13px; color: var(--muted); font-size: .65rem; }
.share-url { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.share-url input { flex: 1 1 320px; min-width: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--paper); color: var(--ink); font: inherit; font-size: .72rem; }
.share-list { margin-top: 16px; }
.table-card { overflow: hidden; padding: 0; }
.table-row { display: grid; grid-template-columns: minmax(180px,1.3fr) repeat(3,minmax(90px,.6fr)) auto; gap: 14px; align-items: center; padding: 15px 20px; border-bottom: 1px solid var(--line); }
.table-row:last-child { border-bottom: 0; }
.table-row.header { background: #efede8; color: var(--muted); font-family: var(--font-label); font-size: .6rem; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; }
.table-row strong { font-size: .78rem; }
.pantry-quantity { min-width: 0; }
.pantry-stock { width: min(140px,100%); height: 8px; margin-top: 6px; overflow: hidden; border-radius: 99px; background: var(--line); }
.pantry-stock span { display: block; height: 100%; background: var(--primary); }
.pantry-actions { display: flex; flex-wrap: wrap; gap: 5px; }
.pantry-actions .button { white-space: nowrap; }
.check-row { display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: 12px; align-items: center; padding: 13px 0; border-bottom: 1px solid var(--line); }
.check-row:last-child { border-bottom: 0; }
.check-row input { width: 19px; height: 19px; accent-color: var(--primary); }
.check-row.done .row-copy strong, .check-row.done .row-copy small { opacity: .5; text-decoration: line-through; }
.store-tag { margin-top: 6px; min-height: 22px; padding-inline: 7px; }
.store-groups { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; }
.review-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 16px; align-items: start; }
.feedback { padding: 15px 0; border-bottom: 1px solid var(--line); }
.feedback:last-child { border-bottom: 0; }
.feedback-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.feedback strong { font-size: .78rem; }
.feedback p { margin-top: 6px; color: var(--muted); font-size: .72rem; line-height: 1.45; }
.feedback .next { color: var(--iris); font-weight: 600; }
.review-toolbar { flex-wrap: wrap; }
.review-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.review-actions .button { white-space: nowrap; }
.settings-grid { display: grid; grid-template-columns: minmax(0,1fr) 300px; gap: 18px; align-items: start; }
.invite-form { display: grid; gap: 9px; margin-top: 20px; }
.invite-form label { color: var(--muted); font-size: .72rem; font-weight: 700; }
.invite-form input { width: 100%; min-height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: white; }
.settings-grid .row-copy { overflow-wrap: anywhere; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 15px; }
.field { display: grid; align-content: start; gap: 7px; color: #55596d; font-size: .72rem; font-weight: 700; }
.field.wide { grid-column: 1 / -1; }
.field input:not([type="checkbox"]), .field select, .field textarea { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 11px; background: white; color: var(--ink); outline: none; }
.field textarea { min-height: 92px; resize: vertical; }
.planning-field { min-width: 0; margin: 0; padding: 0; border: 0; }
.planning-field legend { margin-bottom: 8px; }
.planning-areas { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.planning-choice { display: flex; align-items: center; gap: 9px; min-height: 42px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 11px; background: white; color: var(--ink); font-size: .72rem; font-weight: 600; cursor: pointer; }
.planning-choice:has(input:checked) { border-color: #9ba5c2; background: #eff0f7; }
.planning-choice input { flex: 0 0 auto; width: 16px; height: 16px; margin: 0; accent-color: var(--primary); }
.planning-choice:focus-within { outline: 2px solid var(--iris); outline-offset: 2px; }
.toggle-field { display: flex; align-items: center; justify-content: space-between; gap: 15px; min-height: 50px; padding: 0 13px; border: 1px solid var(--line); border-radius: 11px; background: white; color: var(--ink); }
.toggle-field input { flex: 0 0 auto; width: 19px; height: 19px; margin: 0; accent-color: var(--primary); }
.card-order-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; align-items: center; }
.card-order-row .toggle-field { font-size: .72rem; font-weight: 700; }
.card-order-buttons { display: flex; gap: 5px; }
.card-order-buttons .icon-button { width: 34px; height: 34px; font-size: .9rem; }
.icon-button:disabled { cursor: not-allowed; opacity: .4; }
.callout { padding: 19px; border-radius: 12px; background: var(--primary-soft); color: #555a75; font-size: .73rem; line-height: 1.55; }
.callout b { display: block; margin-bottom: 5px; color: var(--primary); }
dialog { width: min(650px,calc(100% - 32px)); max-height: calc(100vh - 40px); padding: 0; border: 0; border-radius: 23px; background: var(--paper); box-shadow: 0 25px 90px rgba(19,45,37,.24); }
dialog::backdrop { background: rgba(20,42,35,.45); backdrop-filter: blur(4px); }
#planned-meal-dialog { width: min(620px,calc(100% - 32px)); }
.planned-meal-card { display: grid; gap: 16px; }
.planned-meal-components ul { display: grid; gap: 12px; padding-left: 20px; }
.planned-meal-components li .text-button { display: block; margin-top: 4px; }
.planned-meal-reuse { padding-top: 16px; border-top: 1px solid var(--line); }
.planned-meal-reuse p { margin: 0 0 8px; color: var(--muted); font-size: .75rem; }
.planned-meal-reuse .button { margin-right: 8px; }
.plan-food-picker { display: grid; gap: 8px; }
.plan-food-results { max-height: 220px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
.plan-food-result { display: flex; justify-content: space-between; gap: 10px; width: 100%; padding: 10px 12px; border: 0; border-bottom: 1px solid var(--line); background: var(--paper); color: var(--ink); text-align: left; cursor: pointer; }
.plan-food-result:last-child { border-bottom: 0; }
.plan-food-result:hover, .plan-food-result:focus-visible { background: var(--cream); }
.plan-food-result small { color: var(--muted); white-space: nowrap; }
.plan-food-selection { margin: 0; color: var(--primary); font-size: .75rem; font-weight: 700; }
.plan-food-selected-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.plan-food-selected-row span { min-width: 0; overflow-wrap: anywhere; }
.plan-food-selected-row small { color: var(--muted); }
.planned-food-section { min-width: 0; }
.planned-food-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.planned-food-heading h3 { margin: 0; font-size: .98rem; }
.planned-recipe-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 8px 12px; margin-bottom: 12px; }
.planned-recipe-row .field { min-width: 0; }
.planned-recipe-actions { display: flex; flex-wrap: wrap; gap: 12px; padding-bottom: 12px; }
.planned-recipe-actions .text-button { font-size: .78rem; }
@media (max-width: 680px) { .planned-recipe-row { grid-template-columns: 1fr; } .planned-recipe-actions { padding-bottom: 0; } }
.dialog-card { padding: 26px; }
.dialog-head { display: flex; align-items: start; justify-content: space-between; gap: 18px; padding-bottom: 19px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { font-family: var(--font-display); font-size: 1.7rem; font-weight: 740; letter-spacing: -.05em; }
.dialog-fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 15px; max-height: 58vh; padding: 22px 2px; overflow: auto; }
.dialog-actions { display: flex; justify-content: end; gap: 9px; padding-top: 17px; border-top: 1px solid var(--line); }
.form-error { margin-bottom: 12px; color: #a23c30; font-size: .72rem; }
.toast { position: fixed; right: 26px; bottom: 26px; z-index: 50; max-width: 360px; padding: 13px 17px; border-radius: 9px; background: var(--primary); color: white; font-size: .75rem; font-weight: 600; box-shadow: var(--shadow); opacity: 0; transform: translateY(16px); pointer-events: none; transition: .22s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.mobile-nav { display: none; }
@media (max-width: 600px) {
  .topbar:has(.household-picker:not([hidden])) { flex-wrap: wrap; gap: 12px; }
  .topbar:has(.household-picker:not([hidden])) .top-actions { width: 100%; }
  .topbar .household-picker { flex: 1; max-width: none; }
  .top-actions > button { flex-shrink: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .shell { transition: none; }
}

@media (max-width: 1080px) {
  .card-grid, .recipe-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .store-groups { grid-template-columns: 1fr; }
  .hero { grid-template-columns: 1fr; }
  .hero-stat { display: none; }
}

@media (min-width: 781px) and (max-width: 1280px) {
  .week-grid { grid-template-columns: repeat(4,minmax(0,1fr)); }
}

@media (max-width: 780px) {
  .shell { display: block; }
  .sidebar { display: none; }
  .topbar { min-height: 76px; padding: 15px 18px; }
  .topbar h1 { font-size: 1.55rem; }
  .account-button { padding-right: 5px; }
  .household-picker { max-width: 135px; }
  #account-label, .mode-badge { display: none; }
  .content { padding: 22px 16px 100px; }
  .hero { min-height: auto; padding: 30px 24px; border-radius: 21px; }
  .hero h2 { font-size: 2.25rem; }
  .card-grid, .recipe-grid, .review-grid, .settings-grid { grid-template-columns: 1fr; }
  .week-grid { grid-template-columns: 1fr; }
  .plan-toolbar { align-items: start; flex-wrap: wrap; gap: 14px; }
  .plan-actions { width: 100%; }
  .plan-actions .button { flex: 1; }
  .planning-rules-page > .section-head { flex-wrap: wrap; gap: 12px; }
  .table-row { grid-template-columns: 1fr auto; }
  .pantry-toolbar { align-items: stretch; flex-direction: column; }
  .pantry-toolbar-actions { justify-content: space-between; }
  .pantry-photo-card { grid-template-columns: 1fr; }
  .pantry-actions { justify-content: flex-end; }
  .table-row > :nth-child(3), .table-row > :nth-child(4), .table-row.header { display: none; }
  .form-grid, .dialog-fields { grid-template-columns: 1fr; }
  .field.wide { grid-column: auto; }
  .planning-areas { grid-template-columns: 1fr; }
  .mobile-nav { position: fixed; left: 10px; right: 10px; bottom: 10px; z-index: 20; display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); padding: 6px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,252,247,.95); box-shadow: 0 12px 40px rgba(39,37,46,.14); backdrop-filter: blur(15px); }
  .mobile-nav button { display: grid; place-items: center; gap: 1px; min-height: 48px; border: 0; border-radius: 12px; background: transparent; color: var(--muted); font-size: .57rem; font-weight: 700; }
  .mobile-nav .nav-svg { width: 19px; height: 19px; }
  .mobile-nav button.active { background: var(--primary); color: white; }
  .toast { right: 16px; bottom: 82px; left: 16px; }
}

/* Every pantry row uses the same tracks, including rows with only Edit. */
.pantry-table .table-row { grid-template-columns: minmax(150px,1.4fr) minmax(180px,1fr) minmax(75px,.5fr) minmax(150px,1fr) 112px; }
.pantry-table .table-row > * { min-width: 0; }
.pantry-freshness small { display: block; color: var(--muted); margin-top: 5px; font-size: .68rem; }
.pantry-freshness.needs-review strong { color: #8b421b; }
.pantry-amount-button, .pantry-date-link { border: 0; background: transparent; color: var(--ink); padding: 0; font: inherit; font-size: .75rem; cursor: pointer; text-align: left; }
.pantry-amount-button span { color: var(--muted); margin-left: 4px; }
.pantry-date-link { color: var(--muted); text-decoration: underline; font-size: .68rem; margin-top: 5px; }
.pantry-quick-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.pantry-quick-actions .button { padding: 4px 8px; font-size: .65rem; }
.pantry-inline-form { display: grid; gap: 6px; }
.pantry-inline-form label { display: grid; grid-template-columns: 65px minmax(0,1fr); gap: 4px; align-items: center; font-size: .7rem; }
.pantry-inline-form input { width: 100%; min-width: 0; padding: 5px; }
.pantry-inline-form .button { padding: 5px 8px; font-size: .68rem; }
@media (max-width: 1100px) and (min-width: 901px) {
  .pantry-table .table-row { grid-template-columns: minmax(120px,1fr) minmax(150px,1fr) minmax(65px,.4fr) minmax(120px,1fr) 65px; padding: 12px; gap: 8px; }
}
@media (max-width: 900px) {
  .pantry-table .table-row { grid-template-columns: minmax(0,1fr) minmax(145px,1fr); align-items: start; }
  .pantry-table .table-row > :nth-child(3), .pantry-table .table-row > :nth-child(4) { display: block; }
  .pantry-table .table-row.header { display: none; }
  .pantry-table .pantry-actions { grid-column: 1 / -1; }
}
.meal-components { padding-left: 16px; margin: 8px 0; font-size: 12px; }
.day-tasks { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.day-tasks h4, .editor-components h3 { margin-bottom: 8px; }
.plan-task { padding: 10px 0; }
.plan-task .check-row { align-items: start; padding: 0; }
.plan-task .check-row strong { overflow-wrap: anywhere; }
.completed { opacity: .72; }
.component-row, .stock-editor-row { padding: 14px 0; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.component-reference[hidden] { display: none; }
.slot-editor-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; padding: 8px 0; }
.slot-editor-row .field { flex: 1; min-width: 140px; }
.task-meal-links { border: 0; padding: 0; }
.other-tasks { margin-top: 20px; }
.shopping-needs .row { flex-wrap: wrap; gap: 6px; }
.shopping-needs .row small { flex-basis: 100%; }

.saved-meal { min-width: 0; overflow-wrap: anywhere; }
.saved-meal .meal-actions { flex-wrap: wrap; margin-top: 20px; }

.saved-meal .meal-actions .button.primary { padding: 0 11px; background: var(--primary); color: white; font-weight: 700; }
.saved-meal .meal-actions .button.primary:hover { background: #3d486b; text-decoration: none; }
.library-plan-summary { grid-column: 1 / -1; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.preferences-grid {display: grid; gap: 20px; margin-bottom: 20px;}

.planned-recipe-link {color: inherit; text-decoration: underline; text-underline-offset: 3px;}

/* Phone layouts apply to every editor and action, including short landscapes. */
.circle-mobile-week { display: none; }
@media (max-width: 780px) {
  .circle-mode-activity .circle-rail { display: none; }
  .circle-hub-groups { grid-template-columns: minmax(0,1fr); }
  .circle-mobile-week { display: inline-flex; align-items: center; margin-top: 8px; }
  .topbar { gap: 12px; flex-wrap: wrap; padding-inline: max(16px, env(safe-area-inset-left)); }
  .topbar > div:first-child { min-width: 0; }
  .top-actions { margin-left: auto; }
  .icon-button { flex-shrink: 0; width: 44px; height: 44px; }
  .content { padding-bottom: calc(104px + env(safe-area-inset-bottom)); }
  .mobile-nav { left: max(8px, env(safe-area-inset-left)); right: max(8px, env(safe-area-inset-right)); bottom: max(8px, env(safe-area-inset-bottom)); grid-template-columns: repeat(6,minmax(0,1fr)); padding: 4px; }
  .mobile-nav button { min-width: 0; min-height: 52px !important; font-size: .65rem; }
  #mobile-more > span { font-size: 1.05rem; line-height: 20px; }
  #mobile-menu-dialog { width: min(440px,calc(100% - 16px)); }
  .mobile-menu-links { display: grid; gap: 8px; padding-top: 16px; }
  .mobile-menu-links button { padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--paper); color: var(--ink); text-align: left; }
  .mobile-menu-links button.active { background: var(--primary); color: white; }
  .section-head, .today-heading, .toolbar, .card-head, .feedback-head, .planned-food-heading { flex-wrap: wrap; }
  .section-head > *, .toolbar > *, .today-heading > * { min-width: 0; max-width: 100%; }
  .toolbar > div, .row > div:last-child, .check-row > div:last-child { flex-wrap: wrap; }
  .row { flex-wrap: wrap; }
  .row-copy { min-width: 0; }
  .row-copy strong, .row-copy small { white-space: normal; overflow-wrap: anywhere; }
  .meal-actions { gap: 8px; }
  .meal-actions .button, .text-button { padding-inline: 8px; }
  .check-row > div:last-child { grid-column: 2 / -1; }
  .pantry-table .table-row { grid-template-columns: repeat(2,minmax(0,1fr)); padding: 14px; gap: 12px; }
  .pantry-actions { justify-content: start; }
  .pantry-toolbar-actions { flex-wrap: wrap; gap: 8px; }
  .pantry-amount-button, .pantry-date-link { display: inline-block; }
  .pantry-amount-button span { margin-left: 0; }
  .pantry-inline-form label { grid-template-columns: minmax(0,1fr); }
  .share-url input { flex-basis: 100%; }
  .card-order-buttons .icon-button { width: 44px; height: 44px; }
  .circle-page { margin: 0; }
  .circle-layout, .circle-layout:has(.circle-thread-panel) { grid-template-columns: minmax(0,1fr); }
  .circle-pane-head { flex-wrap: wrap; padding: 16px; gap: 12px; }
  .circle-hub { max-height: none; padding-inline: 16px; }
  .circle-hub > .circle-pane-head { margin-inline: -16px; }
  .circle-food-review { margin: 12px; padding: 12px; }
  .circle-thread-panel { max-height: none; }
  .circle-public-row input { width: 100%; min-width: 0; }
  .circle-composer-footer { flex-wrap: wrap; }
  dialog, #planned-meal-dialog { max-height: calc(var(--visible-height, 100dvh) - 16px); overscroll-behavior: contain; }
  #editor-dialog { top: calc(var(--visible-top, 0px) + 8px); bottom: auto; margin-block: 0; width: min(650px,calc(100% - 16px)); height: min(760px,calc(var(--visible-height, 100dvh) - 16px)); border-radius: 14px; overflow: hidden; }
  #editor-form { display: flex; flex-direction: column; height: 100%; padding: 16px; }
  .dialog-head { flex-shrink: 0; gap: 12px; padding-bottom: 12px; }
  .dialog-head h2 { font-size: 1.4rem; overflow-wrap: anywhere; }
  .dialog-fields { flex: 1; min-height: 0; max-height: none; padding-block: 16px; overscroll-behavior: contain; }
  .dialog-actions { flex-shrink: 0; padding-top: 12px; padding-bottom: env(safe-area-inset-bottom); }
  .dialog-actions .button { flex: 1; }
  #dialog-error { flex-shrink: 0; margin-top: 8px; }
  .toast { bottom: calc(82px + env(safe-area-inset-bottom)); }
}
