/* Kitchen notebook: quiet paper, clear ink, a menu beside its prep note. */
:root {
  --paper: #f4f7f4;
  --paper-warm: #ffffff;
  --paper-card: #fcfdfb;
  --ink: #203c30;
  --ink-soft: #4c6356;
  --ink-muted: #66796d;
  --stone: #dfe7df;
  --clay: #356c50;
  --clay-deep: #26523b;
  --gold: #95601c;
}
.grain-overlay { opacity: .014; }
.header-inner, .tab-bar-inner, .content { max-width: 1180px; }
.header-inner { padding-block: 21px; }
.brand-text h1 { font-size: 1.45rem; letter-spacing: .025em; }
.brand-text .subtitle { margin-top: 5px; display: block; font-size: .72rem; }
.tab-bar { background: rgba(255, 255, 255, .96); }
.tab { padding-block: 16px; }
.tab:hover .tab-icon { opacity: 1; transform: none; }
.content { padding-top: 38px; }
.page-heading h2 { font-size: 1.8rem; }
.btn { border-radius: 9px; box-shadow: none; }
button:focus-visible, summary:focus-visible, a:focus-visible { outline: 2px solid var(--clay); outline-offset: 4px; }
.meal-page-header { align-items: flex-end; margin-bottom: 28px; }
.meal-page-header .page-heading h2 { font-size: 2.35rem; letter-spacing: .04em; line-height: 1.3; }
.meal-page-header .page-heading > p:last-child { font-size: .86rem; margin-top: 9px; }
.meal-page-header .meal-date { color: var(--clay); font-size: .76rem; letter-spacing: .07em; margin-bottom: 8px; }
.meal-page-header .page-actions { gap: 12px; flex-wrap: wrap; }
.meal-clear { background: transparent; border-color: transparent; color: var(--text-muted); padding-inline: 4px; font-size: .8rem; }
.meal-clear:hover { color: var(--chili); border-color: transparent; background: transparent; }
.meal-layout { display: grid; grid-template-columns: minmax(0, 1fr) 350px; align-items: start; gap: 28px; }
.meal-board { min-width: 0; }
.meal-board-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 22px 24px; background: #fff; border: 1px solid var(--border); border-radius: 16px 16px 0 0; }
.meal-eyebrow { display: block; font-size: .65rem; letter-spacing: .13em; color: var(--text-muted); margin-bottom: 5px; }
.meal-board-heading h3, .prep-heading h3 { font-family: var(--font-display); font-size: 1.12rem; font-weight: 600; }
.meal-board-heading .btn { background: #f7faf7; font-size: .75rem; }
.meal-dishes { background: #fff; border-inline: 1px solid var(--border); }
.meal-dish.recipe-card { position: relative; display: flex; align-items: center; gap: 17px; padding: 26px 23px; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; background: #fff; box-shadow: none; animation: none; cursor: default; }
.meal-dish.recipe-card::before { display: none; }
.meal-dish.recipe-card:hover { transform: none; background: #fcfdfb; box-shadow: none; }
.dish-mark { display: grid; place-items: center; flex: 0 0 48px; width: 48px; height: 54px; color: hsl(var(--dish-hue) 20% 32%); background: hsl(var(--dish-hue) 24% 94%); border-radius: 24px 24px 10px 10px; }
.dish-mark svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.35; stroke-linecap: round; stroke-linejoin: round; }
.dish-copy { flex: 1; min-width: 0; }
.dish-title { display: block; border: 0; padding: 0; background: none; color: var(--ink); font: 600 1.13rem var(--font-display); text-align: left; cursor: pointer; line-height: 1.5; overflow-wrap: anywhere; }
.dish-title:hover { color: var(--clay); }
.dish-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 7px; }
.dish-tags:empty { display: none; }
.dish-tags span { font-size: .66rem; color: var(--text-secondary); background: #f0f4ef; border-radius: 4px; padding: 1px 6px; }
.dish-meta { color: var(--text-muted); font-size: .72rem; line-height: 1.6; margin-top: 9px; }
.dish-meta > span { margin-inline: 5px; color: #a2b0a4; }
.dish-actions { display: flex; align-items: center; gap: 7px; flex: 0 0 auto; }
.dish-cook { color: var(--clay); border-color: #d4e1d5; background: #f6faf5; font-size: .74rem; }
.dish-remove { display: grid; place-items: center; width: 30px; height: 36px; border: 0; background: none; color: #829186; cursor: pointer; border-radius: 7px; }
.dish-remove:hover { color: var(--chili); background: var(--chili-ghost); }
.meal-add-row { display: flex; justify-content: center; align-items: center; gap: 8px; width: 100%; min-height: 57px; border: 1px solid var(--border); border-top: 0; border-radius: 0 0 16px 16px; color: var(--clay); background: #fff; font: 500 .8rem var(--font-body); cursor: pointer; }
.meal-add-row:hover { background: #edf4ed; }
.meal-empty { padding: 42px 24px 52px; border: 1px solid var(--border); border-top: 0; border-radius: 0 0 16px 16px; background: #fff; }
.meal-empty-art { display: block; width: 145px; height: 110px; color: var(--clay); margin: 0 auto 22px; }
.meal-empty h3 { font: 600 1.25rem var(--font-display); margin-bottom: 10px; }
.meal-empty p { font-size: .82rem; color: var(--text-muted); }
.meal-empty-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 25px; }
.meal-empty-actions .btn { font-size: .8rem; }
#menuShoppingList { min-width: 0; position: sticky; top: 86px; }
.prep-note { background: #fbfcf5; padding: 25px 23px 20px; border: 1px solid #dce3d2; border-top: 3px solid #8b9b70; border-radius: 3px 3px 13px 13px; box-shadow: 0 6px 20px #27412b05; }
.prep-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.prep-total { color: var(--text-muted); font-size: .7rem; }
.prep-summary { font-size: .79rem; color: var(--ink-soft); margin-top: 16px; padding-bottom: 17px; border-bottom: 1px solid #e0e6d7; line-height: 1.7; }
.prep-item { padding: 17px 0 14px; border-bottom: 1px solid #e5e9df; }
.prep-item:last-child { border-bottom: 0; }
.prep-item-heading { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.prep-item-heading strong { font-size: .89rem; font-weight: 600; overflow-wrap: anywhere; }
.prep-status { font-size: .65rem; white-space: nowrap; padding: 2px 7px; border-radius: 4px; background: #edf2e6; color: #52693d; }
.prep-status--missing, .prep-status--short { background: #f7ebd7; color: #855717; }
.prep-status--review { background: #edf0f5; color: #4e617a; }
.prep-status--checking { background: #eff1ea; color: var(--text-muted); }
.prep-item-detail { font-size: .76rem; color: var(--text-secondary); margin-top: 6px; }
.prep-item--short .prep-item-detail { color: #855717; }
.prep-item-bottom { display: flex; justify-content: space-between; align-items: center; gap: 10px; color: var(--text-muted); font-size: .7rem; margin-top: 5px; }
.prep-inline-action { display: inline-flex; align-items: center; gap: 3px; border: 0; background: transparent; padding: 4px 0; color: var(--clay); font: 500 .71rem var(--font-body); cursor: pointer; }
.prep-inline-action:hover { text-decoration: underline; }
.prep-sources { color: var(--text-muted); font-size: .66rem; margin-top: 6px; }
.prep-sources summary { cursor: pointer; overflow-wrap: anywhere; }
.prep-sources p { padding: 7px 0 0 11px; }
.prepared-list { margin-top: 16px; }
.prepared-list > summary { display: flex; justify-content: space-between; align-items: center; list-style: none; cursor: pointer; color: var(--text-secondary); font-size: .76rem; padding: 12px 0; }
.prepared-list > summary::-webkit-details-marker { display: none; }
.prepared-list > summary > span:first-child { display: flex; align-items: center; gap: 6px; }
.prep-disclosure { font-size: 0; }
.prep-disclosure::after { content: '展开 +'; font-size: .67rem; color: var(--text-muted); }
.prepared-list[open] .prep-disclosure::after { content: '收起 −'; }
.prep-note-rule { border-top: 1px dashed #ccd6bf; margin-top: 20px; }
.prep-footer { padding-top: 15px; }
.prep-footer > span { display: block; font-size: .7rem; color: var(--text-muted); margin-bottom: 10px; }
.prep-footer > div { display: flex; gap: 7px; }
.prep-footer .btn { background: transparent; border-color: #d7dfcc; color: var(--text-secondary); font-size: .7rem; }
.prep-note--empty { padding-top: 30px; }
.prep-note--empty h3 { font: 500 1.12rem var(--font-display); line-height: 1.6; margin: 10px 0; }
.prep-note--empty p { font-size: .8rem; color: var(--text-secondary); line-height: 1.9; }
.prep-note--empty .prep-note-tip { margin-top: 20px; font-size: .73rem; }
.prep-empty-text { font-size: .8rem; color: var(--text-muted); margin-top: 15px; }

/* Cooking confirmation: scan the result first, expand only what needs editing. */
.cook-overlay .cook-dialog { max-width: 650px; width: calc(100% - 32px); display: flex; flex-direction: column; max-height: min(850px, 90dvh); border-radius: 18px; }
.cook-dialog .modal-header { flex: 0 0 auto; padding: 23px 26px 19px; }
.cook-dialog-heading { display: flex; align-items: center; gap: 12px; }
.cook-dialog-heading > .icon { width: 38px; height: 38px; background: var(--primary-ghost); border-radius: 11px; color: var(--clay); }
.cook-dialog-heading h2 { font: 600 1.3rem var(--font-display); }
.cook-dialog .modal-body { min-height: 0; overflow-y: auto; padding: 20px 26px; }
.cook-intro { font-size: .8rem; color: var(--text-secondary); margin-bottom: 20px; line-height: 1.9; }
.cook-dialog .done-list { gap: 0; border: 1px solid var(--border); border-radius: 11px; overflow: hidden; }
.cook-list-labels { display: flex; justify-content: space-between; padding: 0 18px 8px; font-size: .66rem; color: var(--text-muted); }
.cook-dialog .done-item { padding: 0; background: #fff; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; }
.cook-dialog .done-item:last-child { border-bottom: 0; }
.cook-line { display: flex; align-items: center; gap: 12px; padding: 18px; cursor: pointer; list-style: none; }
.cook-line::-webkit-details-marker { display: none; }
.cook-line > strong { font-size: .88rem; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.cook-balance { display: flex; align-items: center; gap: 10px; font-size: .79rem; color: var(--text-muted); }
.cook-balance strong { color: var(--clay); font-weight: 600; }
.cook-edit-caption { color: var(--text-muted); font-size: .68rem; min-width: 28px; }
.cook-edit-caption::after { content: '调整'; }
.done-item[open] .cook-edit-caption::after { content: '收起'; }
.cook-adjust-body { padding: 0 18px 18px; }
.cook-recipe-amount { color: var(--text-muted); font-size: .72rem; margin-bottom: 10px; }
.cook-dialog .done-conversion-note { font-size: .76rem; margin: 0 0 12px; }
.cook-dialog .done-item-edit { align-items: end; display: grid; grid-template-columns: minmax(0, 1fr) minmax(150px, 1.25fr); gap: 12px; }
.cook-dialog .done-field { min-width: 0; }
.cook-dialog .done-field > span { text-transform: none; letter-spacing: 0; font-size: .71rem; }
.cook-adjust-body input[type='text'], .cook-adjust-body select { min-width: 0; min-height: 37px; padding: 7px 9px; border: 1px solid var(--border-strong); border-radius: 7px; color: var(--text); background: #fff; font: .83rem var(--font-body); }
.cook-adjust-body input:disabled { background: #f4f6f2; color: var(--text-muted); }
.cook-adjust-body .done-unit { width: 65px; flex: 0 0 65px; }
.cook-adjust-body .done-remaining { flex: 1; width: 100%; }
.cook-action-field { grid-column: 1 / -1; }
.cook-notes { margin-top: 20px; }
.cook-notes > summary { cursor: pointer; color: var(--text-secondary); font-size: .8rem; }
.cook-notes > summary span { color: var(--text-muted); font-size: .7rem; margin-left: 6px; }
.cook-notes .done-cook-notes { margin-top: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.cook-dialog-footer { flex: 0 0 auto; border-top: 1px solid var(--border); padding: 16px 26px; background: #fafcf8; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-radius: 0 0 18px 18px; }
.cook-dialog-footer > div { display: flex; gap: 8px; flex: 0 0 auto; }
.cook-feedback { color: var(--text-secondary); font-size: .74rem; }
.cook-feedback.needs-review { color: #855717; }
.cook-error { background: #fff0e9; color: #8b3d28; border-radius: 8px; padding: 12px; font-size: .8rem; margin-top: 16px; }
.cook-error button { display: block; margin-top: 8px; }

@media (max-width: 980px) {
  .meal-layout { grid-template-columns: minmax(0, 1fr) 310px; gap: 18px; }
  .meal-dish.recipe-card { gap: 12px; padding: 22px 17px; flex-wrap: wrap; }
  .dish-actions { margin-left: auto; }
  .dish-mark { flex-basis: 42px; width: 42px; height: 48px; }
  .prep-note { padding-inline: 19px; }
}
@media (max-width: 720px) {
  .header-inner { padding: 16px; }
  .content { padding: 25px 16px 70px; }
  .meal-page-header { align-items: flex-start; gap: 16px; flex-direction: column; }
  .meal-page-header .page-heading h2 { font-size: 2rem; }
  .meal-page-header .page-actions { width: 100%; }
  .meal-page-header #menuRecipeCount { margin-right: auto; font-size: .78rem; }
  .meal-layout { grid-template-columns: 1fr; gap: 22px; }
  #menuShoppingList { position: static; }
  .meal-board-heading { padding: 19px; }
  .meal-dish.recipe-card { padding: 21px 18px; }
  .dish-title { font-size: 1.1rem; }
  .dish-meta { font-size: .76rem; }
  .dish-cook { min-height: 44px; }
  .dish-remove { width: 44px; height: 44px; }
  .prep-note { padding: 22px; }
  .prep-inline-action, .prep-sources summary, .prepared-list > summary { min-height: 44px; }
  .prep-footer .btn { min-height: 44px; }
  .prep-item-detail { font-size: .88rem; }
  .prep-sources, .prep-item-bottom { font-size: .78rem; }
  .prep-item-heading strong { font-size: .95rem; }
  .cook-dialog .done-item-edit { grid-template-columns: 1fr 1.2fr; flex-direction: initial; }
}
@media (max-width: 480px) {
  .brand-text h1 { font-size: 1.15rem; }
  .content { padding-inline: 12px; }
  .meal-board-heading { gap: 8px; padding: 17px 15px; }
  .meal-board-heading h3 { font-size: 1.05rem; }
  .meal-dish.recipe-card { gap: 11px; padding: 19px 15px; }
  .dish-copy { flex-basis: calc(100% - 65px); }
  .dish-actions { width: 100%; padding-left: 53px; justify-content: space-between; }
  .dish-cook { flex: 1; justify-content: center; }
  .meal-empty { padding: 28px 15px 35px; }
  .meal-empty-actions { flex-direction: column; }
  .meal-page-header .page-actions { gap: 10px; }
  .meal-clear { min-height: 40px; }
  .cook-overlay { align-items: flex-end; padding: 0; }
  .cook-overlay .cook-dialog { width: 100%; max-height: calc(100dvh - 24px); border-radius: 18px 18px 0 0; }
  .cook-dialog .modal-header { padding: 19px 17px 16px; }
  .cook-dialog .modal-body { padding: 18px 15px; }
  .cook-intro, .cook-dialog .done-conversion-note { font-size: .9rem; }
  .cook-adjust-body input[type='text'], .cook-adjust-body select, .cook-dialog .done-conversion-factor, .cook-notes textarea { font-size: 16px; min-height: 44px; }
  .cook-line { padding: 17px 13px; gap: 8px; }
  .cook-balance { gap: 7px; font-size: .76rem; }
  .cook-line > strong { font-size: .91rem; }
  .cook-adjust-body { padding-inline: 13px; }
  .cook-dialog-footer { flex-direction: column; align-items: stretch; gap: 10px; padding: 13px 15px max(13px, env(safe-area-inset-bottom)); border-radius: 0; }
  .cook-dialog-footer > div .btn-primary { flex: 1; }
  .cook-dialog-footer .btn { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
