:root {
  color-scheme: light;
  font-family: "Noto Sans SC", "Noto Sans CJK SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: #22372b;
  background: #f6f5ef;
  --ink: #22372b;
  --muted: #5e695f;
  --green: #284b38;
  --line: #e8e8dc;
  --surface: #fffefa;
  --shell: 1264px;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 300px; font-size: 14px; }
a { color: inherit; text-decoration: none; }
button, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid #567d50; outline-offset: 3px; }
svg { display: block; flex: none; }
h1, h2, h3, h4, p, ul, dl, dd { margin: 0; }
[hidden] { display: none !important; }
.shell { width: min(var(--shell), calc(100% - 88px)); margin-inline: auto; }
.sr-only, .skip-link:not(:focus) {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
.skip-link:focus { position: fixed; top: 8px; left: 8px; z-index: 3; padding: 10px 14px; background: white; }

.site-header { background: #fffefa; border-bottom: 1px solid var(--line); }
.header-inner { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 11px; font-size: 17px; font-weight: 750; letter-spacing: .04em; white-space: nowrap; }
.brand-mark {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px;
  background: var(--green); color: #f2f2dc;
}
.brand-mark svg { width: 23px; height: 23px; }
.header-inner nav { display: flex; align-items: center; gap: 11px; }
.nav-link { display: inline-flex; align-items: center; gap: 7px; padding: 9px 13px; border-radius: 8px; font-size: 13px; font-weight: 650; white-space: nowrap; }
.nav-link svg { width: 16px; height: 16px; }
.nav-main { background: #eaf0e5; color: #31533e; }
.nav-shopping { color: #536054; }
.nav-link:hover { background: #e4ecdd; color: #294a36; }

.hero {
  position: relative; isolation: isolate; min-height: 252px; display: flex; align-items: center; margin-top: 30px;
  overflow: hidden; border-radius: 24px; background: #234734; color: #fffdf0;
}
.hero-copy { width: 53%; padding: 39px 44px 42px; }
.hero-kicker {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px;
  color: #e7efdb; background: #365944; border: 1px solid #53725b;
  border-radius: 99px; font-size: 12px; font-weight: 600; letter-spacing: .08em;
}
.hero-kicker svg { width: 14px; height: 14px; }
.hero h1 {
  margin: 14px 0 12px; font-size: clamp(31px, 3.4vw, 52px); line-height: 1.22;
  font-weight: 780; letter-spacing: .015em;
}
.hero p { color: #e0e8d9; font-size: 15px; line-height: 1.6; letter-spacing: .05em; }
.hero-photo {
  position: absolute; z-index: -1; inset: 0 0 0 49%; background: #d7d3b9 url("./menu-hero.webp") center 49% / cover no-repeat;
}

.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 314px; gap: 24px; align-items: start; margin-top: 36px; }
.menu, .shopping { min-width: 0; scroll-margin-top: 20px; }
.section-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; }
h2 { font-size: 25px; font-weight: 750; line-height: 1.3; letter-spacing: .025em; }
.section-caption { margin-top: 5px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.population-label {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center;
  position: relative; flex: 0 1 236px; gap: 10px; padding: 0 13px; min-width: 0;
  border: 1px solid #dadfd1; border-radius: 10px; background: var(--surface); min-height: 44px;
}
.population-label svg { width: 16px; height: 16px; color: #527058; pointer-events: none; }
.population-label:focus-within { outline: 2px solid #567d50; outline-offset: 2px; }
.population-label select {
  appearance: none; border: 0; background: transparent; width: calc(100% + 78px); margin-left: -39px; margin-right: -39px;
  padding: 11px 36px 11px 39px; cursor: pointer; font-size: 13px; font-weight: 650; text-overflow: ellipsis;
}
.population-label select:focus-visible { outline: 0; }
.select-chevron { pointer-events: none; }
.day-controls {
  display: grid; grid-template-columns: 38px minmax(0, 1fr) 38px; gap: 8px; align-items: center;
  margin-bottom: 18px; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
}
.day-buttons { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.day-button, .arrow-button {
  display: grid; place-items: center; min-height: 37px; padding: 4px 0;
  border: 0; border-radius: 8px; background: transparent; color: #566356; font-size: 13px; font-weight: 650; white-space: nowrap;
}
.arrow-button svg { width: 16px; height: 16px; }
.day-button:hover, .arrow-button:hover { background: #edf0e5; color: var(--green); }
.day-button[aria-pressed="true"] { background: var(--green); color: #fffdf3; }

.meal-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: stretch; }
.meal-card {
  display: grid; grid-template-rows: auto auto auto 1fr auto; align-content: start; min-width: 0; overflow: hidden;
  border: 1px solid var(--line); border-radius: 15px; background: var(--surface); box-shadow: 0 2px 5px #2d3d2410;
}
.meal-heading {
  display: flex; align-items: center; gap: 9px; padding: 12px 15px;
  background: #fbf1df; color: #80511d; font-weight: 750; font-size: 14px; letter-spacing: .08em;
}
.lunch .meal-heading { background: #e8efe1; color: #375840; }
.dinner .meal-heading { background: #efecf3; color: #5b506d; }
.meal-icon { display: grid; place-items: center; border-radius: 7px; width: 31px; height: 31px; background: #fff9ed; }
.lunch .meal-icon { background: #f8fbf3; }
.dinner .meal-icon { background: #faf8fc; }
.meal-icon svg { width: 17px; height: 17px; }
.dish-heading { padding: 15px 15px 10px; min-height: 85px; }
.dish-heading h3 { font-size: 18px; font-weight: 760; line-height: 1.42; overflow-wrap: anywhere; }
.dish-heading p { margin-top: 5px; color: var(--muted); font-size: 12.5px; line-height: 1.55; }
.dish-heading p span { color: #7b877a; }
.ingredients { margin: 0 15px; padding: 10px 0 12px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.ingredient-row { display: grid; grid-template-columns: 49px minmax(0, 1fr); gap: 7px; align-items: start; padding: 4px 0; }
.ingredient-label { font-size: 11px; font-weight: 700; text-align: center; border-radius: 5px; padding: 3px 2px; line-height: 1.35; }
.vegetables { color: #345b40; background: #e9f0e5; }
.protein { color: #754e3b; background: #f5ebe3; }
.staple { color: #6b542c; background: #f5eedc; }
.ingredient-row dd { font-size: 12.5px; line-height: 1.58; padding-top: 1px; overflow-wrap: anywhere; }
.method { padding: 13px 15px 14px; }
.method h4, .meal-shopping h4 { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 750; }
.method h4 svg, .meal-shopping h4 svg { width: 15px; height: 15px; color: #5a785e; }
.method ul { padding-left: 15px; margin-top: 7px; color: #515d53; font-size: 12px; line-height: 1.62; }
.method li + li { margin-top: 4px; }
.method li::marker { color: #6c8b70; }
.meal-shopping { padding: 11px 15px 14px; background: #f7f8f2; border-top: 1px solid #ebeee4; }
.meal-shopping p { margin-top: 6px; color: #505e50; font-size: 11.5px; line-height: 1.6; }

.shopping {
  padding: 18px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: 0 2px 5px #2d3d2410;
}
.shopping-heading { display: flex; align-items: center; gap: 10px; }
.shopping-icon {
  display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 10px;
  background: #e8efe4; color: #3c654b;
}
.shopping h2 { font-size: 19px; }
.shopping .section-caption { font-size: 12px; margin-top: 3px; }
.scope { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin: 17px 0 14px; border-radius: 9px; background: #efefe7; }
.scope button { border: 0; border-radius: 6px; background: transparent; font-weight: 700; font-size: 12px; min-height: 33px; color: #596456; }
.scope button[aria-pressed="true"] { background: #fffefa; color: #284d38; box-shadow: 0 1px 3px #34442e18; }
.scope button:hover { color: var(--green); }
.shopping-progress-text { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 12px; }
.shopping-progress-text strong { font-weight: 750; }
.shopping-progress-text span { color: var(--muted); font-variant-numeric: tabular-nums; }
progress { appearance: none; display: block; width: 100%; height: 5px; margin-top: 8px; border: none; border-radius: 8px; overflow: hidden; background: #e7ecdf; }
progress::-webkit-progress-bar { background: #e7ecdf; }
progress::-webkit-progress-value { background: #668e5e; }
progress::-moz-progress-bar { background: #668e5e; }
.shopping-items {
  margin: 14px 0 12px; max-height: 322px; overflow-y: auto; overscroll-behavior: contain;
  padding: 1px 7px 0 1px; scrollbar-color: #ccd6c5 transparent; scrollbar-width: thin;
}
.shopping-group { padding: 9px 0 8px; border-top: 1px solid var(--line); }
.shopping-group h3 { margin-bottom: 4px; color: #49634f; font-size: 12px; font-weight: 750; }
.shopping-group ul { list-style: none; padding: 0; }
.check-item { display: flex; align-items: center; gap: 8px; padding: 4px 3px; min-height: 29px; border-radius: 5px; cursor: pointer; font-size: 13px; }
.check-item:hover { background: #f0f3eb; }
.check-item input { width: 15px; height: 15px; flex: none; margin: 0; cursor: pointer; accent-color: #426b4b; }
.check-item input:checked + span { color: #606e60; text-decoration: line-through; }
.shopping-actions { display: flex; gap: 8px; align-items: stretch; }
.copy-button, .reset-button {
  border-radius: 8px; min-height: 39px; font-weight: 700; font-size: 12px; white-space: nowrap;
}
.copy-button {
  display: inline-flex; justify-content: center; align-items: center; gap: 7px; flex: 1;
  padding: 6px 9px; color: #fffdf3; background: var(--green); border: 1px solid var(--green);
}
.copy-button svg { width: 15px; height: 15px; }
.copy-button:hover { background: #375d47; }
.reset-button { border: 1px solid #dfe5d9; padding: 6px 9px; background: transparent; }
.reset-button:hover:not(:disabled) { background: #eff4eb; }
.reset-button:disabled { color: #757d73; background: #f8f8f3; }
.notice { margin-top: 8px; color: #355f42; font-size: 12px; line-height: 1.5; }
.notice:empty { display: none; }
dialog { width: min(460px, calc(100% - 32px)); border: 1px solid var(--line); border-radius: 14px; padding: 23px; background: var(--surface); color: var(--ink); }
dialog::backdrop { background: #1a2a20a0; }
dialog p { margin: 7px 0 12px; color: var(--muted); }
dialog textarea { display: block; width: 100%; min-height: 230px; border: 1px solid #d6dfd1; border-radius: 7px; padding: 10px; resize: vertical; }
.dialog-close { position: absolute; top: 12px; right: 12px; border: 0; border-radius: 5px; background: #edf2e8; padding: 5px; }

.person-dialog h2 { margin-bottom: 16px; font-size: 21px; }
.person-dialog label { display: block; margin: 12px 0 6px; font-weight: 700; }
.person-dialog input, .person-dialog select {
  display: block; width: 100%; min-height: 42px; padding: 8px 10px;
  border: 1px solid #d6dfd1; border-radius: 8px; background: var(--surface);
}
.person-dialog input { font: inherit; color: inherit; }
.person-dialog p { margin-top: 10px; font-size: 13px; line-height: 1.55; }
.dialog-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.primary-button, .secondary-button, .danger-button {
  min-height: 40px; padding: 8px 14px; border: 1px solid transparent; border-radius: 8px; font-weight: 700;
}
.primary-button { background: var(--green); color: #fffdf3; }
.primary-button:hover { background: #375d47; }
.secondary-button { background: var(--surface); border-color: #d6dfd1; }
.secondary-button:hover { background: #edf2e8; }
.danger-button { background: #943e35; color: #fffefa; }
.danger-button:hover { background: #7b3029; }
.empty-state { padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: 15px; }
.empty-state p { margin: 7px 0 14px; color: var(--muted); line-height: 1.55; }
#shopping-empty { margin-top: 14px; }

.footer {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 30px 0 0;
  padding: 16px 0 23px; border-top: 1px solid #e1e4d8; color: #5b675a; font-size: 12px;
}
.footer > span { display: flex; align-items: center; gap: 6px; font-weight: 700; }
.footer svg { width: 15px; height: 15px; }

@media (max-width: 1200px) {
  .shell { width: calc(100% - 64px); }
  .workspace { grid-template-columns: minmax(0, 1fr) 285px; gap: 18px; }
  .meal-grid { gap: 10px; }
  .dish-heading, .method, .meal-shopping { padding-left: 12px; padding-right: 12px; }
  .ingredients { margin-inline: 12px; }
}
@media (max-width: 980px) {
  .shell { width: calc(100% - 48px); }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .shopping { max-width: 100%; }
  .shopping-items { max-height: 360px; }
  .shopping-group ul { display: grid; grid-template-columns: repeat(auto-fit, minmax(124px, 1fr)); }
  .hero-copy { width: 58%; padding-left: 28px; }
  .hero-photo { left: 54%; }
}
@media (max-width: 600px) {
  .shell { width: calc(100% - 32px); }
  .header-inner { min-height: 58px; }
  .brand { font-size: 15px; gap: 7px; }
  .brand-mark { width: 32px; height: 32px; border-radius: 8px; }
  .brand-mark svg { width: 20px; height: 20px; }
  .header-inner nav { gap: 2px; }
  .nav-link { font-size: 12px; padding: 7px 6px; gap: 4px; }
  .nav-link svg { width: 13px; height: 13px; }
  .hero { display: block; min-height: 0; margin-top: 16px; border-radius: 16px; }
  .hero-copy { width: 100%; padding: 22px 19px 21px; }
  .hero h1 { margin: 10px 0 7px; font-size: clamp(25px, 7vw, 36px); }
  .hero p { font-size: 13px; }
  .hero-photo { position: relative; inset: auto; height: 116px; }
  .workspace { margin-top: 24px; }
  .section-top { flex-wrap: wrap; align-items: end; gap: 10px; margin-bottom: 12px; }
  h2 { font-size: 21px; }
  .section-caption { font-size: 12px; }
  .population-label { flex-basis: 100%; }
  .day-controls { grid-template-columns: 25px minmax(0, 1fr) 25px; gap: 4px; margin-bottom: 12px; padding: 4px; }
  .day-buttons { gap: 1px; }
  .day-button, .arrow-button { min-height: 38px; font-size: 12px; }
  .meal-grid { grid-template-columns: 1fr; gap: 12px; }
  .dish-heading { min-height: 0; }
  .meal-card { grid-template-rows: auto; }
  .method ul, .ingredient-row dd { font-size: 13px; }
  .meal-shopping p { font-size: 12px; }
  .shopping { padding: 15px; }
  .footer { font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
