.meal-planner {
    --meal-paper: #fffdf8;
    --meal-cream: #f5ebdd;
    --meal-muted: #6c584a;
    margin: 12px 0 24px;
    padding: clamp(14px, 2.4vw, 28px);
    background: var(--meal-cream);
    border: 1px solid var(--menu-line);
    border-radius: 14px;
    color: #362920;
}
.meal-plan-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--menu-line);
}
.meal-plan-header h1 {
    font: 700 clamp(26px, 3vw, 36px)/1.35 "PMingLiU", "Songti TC", serif;
    color: var(--menu-red);
    margin: 0 0 4px;
}
#content .meal-plan-header p { color: var(--meal-muted); margin: 0; font-size: 14px; line-height: 1.5; }
.meal-plan-links, .meal-plan-options, .meal-plan-starters { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.meal-plan-links, .meal-plan-options { justify-content: space-between; }
.meal-plan-links a { display: inline-flex; gap: 5px; align-items: center; min-height: 44px; color: var(--menu-red); font-weight: 700; }
.meal-plan-options { margin-top: 12px; }
.meal-plan-starters .meal-use-suggestion { margin: 0; }
.meal-challenge-toggle { min-height: 44px; padding: 6px 12px; border: 1px solid var(--menu-line); border-radius: 7px; background: var(--meal-paper); color: var(--menu-red); font-weight: 700; }
.meal-challenge-toggle[aria-pressed="true"] { border-color: var(--menu-red); background: #f0ded0; }
.meal-challenge { margin-top: 8px; }
.meal-challenge progress { display: block; width: 100%; height: 10px; accent-color: var(--menu-red); }
#content .meal-challenge p { margin: 3px 0 0; color: var(--meal-muted); font-size: 13px; }
.meal-people { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; }
.meal-people label { margin: 0; color: var(--menu-red); font-weight: 700; }
.meal-people-input, .meal-dish-stepper, .meal-estimate-stepper {
    display: grid;
    grid-template-columns: minmax(44px, 1fr) minmax(24px, auto) minmax(44px, 1fr);
    align-items: center;
    text-align: center;
    font-variant-numeric: tabular-nums;
}
.meal-people-input { border: 1px solid var(--menu-line); border-radius: 8px; background: var(--meal-paper); }
.meal-people-input input {
    width: 52px;
    height: 44px;
    padding: 0;
    border: 0;
    background: transparent;
    font: 700 16px/1 sans-serif;
    color: var(--menu-red);
    text-align: center;
    appearance: textfield;
}
.meal-people-input input::-webkit-inner-spin-button,
.meal-people-input input::-webkit-outer-spin-button { appearance: none; margin: 0; }
.meal-people-error { flex-basis: 100%; color: var(--menu-red); }
.meal-people-input button, .meal-dish-stepper button, .meal-estimate-stepper button {
    min-height: 44px;
    border: 0;
    background: transparent;
    color: var(--menu-red);
    font: 700 22px/1 sans-serif;
}
.meal-people-input button:hover:not(:disabled), .meal-dish-stepper button:hover:not(:disabled), .meal-estimate-stepper button:hover:not(:disabled) { background: #ead5bb; }
.meal-people-input button:disabled, .meal-dish-stepper button:disabled, .meal-estimate-stepper button:disabled { color: #8e7c68; opacity: .55; cursor: default; }
.meal-plan-layout { display: grid; gap: 18px; margin-top: 14px; }
.meal-picker { min-width: 0; }
.meal-picker-toolbar { background: var(--meal-cream); }
.meal-steps { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; }
.meal-steps button {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
    min-height: 44px;
    padding: 4px 3px;
    border: 1px solid var(--menu-line);
    border-radius: 7px;
    background: var(--meal-paper);
    color: var(--menu-red);
    font-size: 14px;
    font-weight: 700;
}
.meal-step-number {
    display: grid;
    place-items: center;
    flex: 0 0 18px;
    height: 18px;
    border-radius: 50%;
    background: #efdfcd;
    color: var(--menu-red);
    font-size: 11px;
}
.meal-steps button[aria-current] { background: var(--menu-red); border-color: var(--menu-red); color: #fffdf8; }
.meal-steps button:not([aria-current]):hover { border-color: var(--menu-red); }
.meal-picker-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 12px 0; }
.meal-picker-heading h3 { margin: 0; color: var(--menu-red); font-size: 19px; scroll-margin-top: 14px; }
.meal-picker-search { margin: 0; min-width: 0; flex: 0 1 180px; }
.meal-picker-search input {
    width: 100%;
    min-height: 44px;
    padding: 7px 10px;
    border: 1px solid var(--menu-line);
    border-radius: 6px;
    background: var(--meal-paper);
    font: inherit;
}
.meal-no-results { padding: 14px 0; color: var(--meal-muted); }
.meal-dishes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.meal-dish {
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--menu-line);
    border-radius: 9px;
    background: var(--meal-paper);
}
.meal-dish.is-picked { border-color: var(--menu-red); box-shadow: 0 0 0 1px var(--menu-red); }
.meal-dish-media { position: relative; flex: none; aspect-ratio: 4 / 3; overflow: hidden; background: #f1e2d0; }
/* The frame sets the height, even when the uploaded photo is taller. */
.meal-dish-media img, .meal-dish-placeholder { position: absolute; inset: 0; }
.meal-dish-media img { display: block; width: 100%; height: 100%; object-fit: cover; }
.meal-dish-placeholder { display: grid; align-content: center; justify-items: center; gap: 6px; color: var(--meal-muted); font-size: 12px; }
.meal-dish-info { flex: 1; display: grid; grid-template-rows: 1fr auto; gap: 3px; padding: 9px 10px; }
.meal-dish h4 { margin: 0; line-height: 1.4; font-size: 15px; font-weight: 700; overflow-wrap: anywhere; }
.meal-dish-info > span { color: var(--menu-red); font-size: 14px; font-weight: 700; }
.meal-dish-stepper { border-top: 1px solid #ecdfcf; font-weight: 700; }
.meal-dish-stepper button[data-dish-step="1"] { background: #f0ded0; }
.meal-dish.is-picked button[data-dish-step="1"] { background: var(--menu-red); color: white; }
.meal-dish-stepper button:focus-visible { outline-offset: -4px !important; }
.meal-step-actions { display: flex; gap: 10px; justify-content: space-between; margin-top: 12px; }
.meal-step-actions button, .meal-step-actions a, .meal-use-suggestion {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 44px;
    padding: 6px 12px;
    border: 1px solid var(--menu-red);
    border-radius: 7px;
    background: var(--menu-red);
    color: white;
    font-weight: 700;
    text-decoration: none;
}
.meal-step-actions button[data-plan-back], .meal-use-suggestion { background: transparent; color: var(--menu-red); }
.meal-step-actions :is(button, a):hover { filter: brightness(.92); }
.meal-step-actions :is(button[data-plan-next], a) { margin-inline-start: auto; }
.meal-use-suggestion { align-self: flex-start; margin-top: 8px; }
.meal-use-suggestion:hover { background: #f5ebdd; }
.meal-quick-total { display: none; }
.meal-estimate {
    min-width: 0;
    align-self: start;
    border: 1px solid var(--menu-line);
    border-radius: 10px;
    background: var(--meal-paper);
    box-shadow: 0 5px 16px rgb(103 66 43 / 7%);
    scroll-margin-top: 12px;
}
.meal-estimate-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 3px 12px;
    border-radius: 9px 9px 0 0;
    padding: 12px 14px;
    color: #fff8ed;
    background: var(--menu-red);
}
.meal-estimate-top h3 { margin: 0; color: inherit; font-size: 17px; }
#content .meal-estimate-top p { margin: 0; font-size: 12px; }
.meal-estimate-body { padding: 12px 14px; }
#content .meal-estimate-empty { margin: 0 0 8px; color: var(--meal-muted); font-size: 14px; line-height: 1.5; }
.meal-estimate-list { list-style: none; margin: 0 0 8px; padding: 0; }
.meal-estimate-list li {
    display: grid;
    grid-template-columns: minmax(114px, 1fr) minmax(0, auto) 44px;
    grid-template-areas: "dish dish dish" "quantity total remove";
    align-items: center;
    gap: 3px 6px;
    padding: 5px 0;
    border-bottom: 1px solid #eee1d1;
    font-size: 14px;
    line-height: 1.4;
}
.meal-estimate-list li:last-child { border-bottom: 0; }
.meal-estimate-dish { grid-area: dish; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; overflow-wrap: anywhere; }
.meal-estimate-dish small { color: var(--meal-muted); white-space: nowrap; }
.meal-estimate-stepper {
    grid-area: quantity;
    justify-self: start;
    border: 1px solid var(--menu-line);
    border-radius: 7px;
    background: var(--meal-cream);
    font-weight: 700;
}
.meal-estimate-stepper button { padding: 0; border-radius: 6px; }
.meal-estimate-stepper button:focus-visible { outline-offset: -4px !important; }
.meal-estimate-list [data-line-total] { grid-area: total; text-align: end; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.meal-estimate-list [data-line-remove], .meal-estimate-actions button {
    min-height: 44px;
    border: 0;
    background: transparent;
    color: var(--menu-red);
}
.meal-estimate-list [data-line-remove] { grid-area: remove; padding: 0; font-size: 22px; }
.meal-estimate-prices { margin: 0; padding-top: 6px; border-top: 1px dashed var(--menu-line); }
.meal-estimate-prices div { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.meal-estimate-prices dt { font-size: 14px; }
.meal-estimate-prices dd { margin: 0; text-align: end; color: var(--menu-red); font-weight: 700; font-variant-numeric: tabular-nums; }
.meal-estimate-prices div:first-child dd { font-size: 25px; }
.meal-reaction { margin-top: 8px; padding: 9px 10px; border-radius: 7px; background: #f4e6d4; }
.meal-reaction strong { color: var(--menu-red); }
#content .meal-reaction p { margin: 3px 0 0; color: #574336; font-size: 14px; line-height: 1.5; }
#content .meal-shared-note { margin: 0 0 8px; color: var(--meal-muted); font-size: 13px; line-height: 1.5; }
.meal-share { margin-top: 10px; }
.meal-share button {
    width: 100%;
    min-height: 44px;
    padding: 6px 12px;
    border: 1px solid var(--menu-red);
    border-radius: 7px;
    background: var(--menu-red);
    color: white;
    font-weight: 700;
}
.meal-share button:hover { background: #602129; }
.meal-share .meal-share-draft { margin-top: 6px; background: transparent; color: var(--menu-red); }
.meal-share .meal-share-draft:hover { background: var(--meal-cream); }
#content .meal-share p, .meal-share label { margin: 6px 0 0; font-size: 13px; color: var(--meal-muted); line-height: 1.5; }
.meal-share p:empty { display: none; }
.meal-share label { display: block; }
.meal-share input { display: block; width: 100%; min-height: 44px; padding: 5px 8px; border: 1px solid var(--menu-line); border-radius: 6px; }
.meal-estimate-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 14px; }
.meal-estimate-actions a, .meal-estimate-actions button { display: inline-flex; align-items: center; min-height: 44px; padding: 0; color: var(--menu-red); text-decoration: underline; text-underline-offset: 3px; }
.meal-formula { border-top: 1px solid #eee1d1; font-size: 13px; }
.meal-formula summary { padding: 9px 0 3px; color: var(--meal-muted); cursor: pointer; }
#content .meal-formula p { margin: 6px 0 2px; color: var(--meal-muted); font-size: 13px; line-height: 1.55; }

@media (min-width: 992px) {
    .meal-plan-layout { grid-template-columns: minmax(0, 2fr) minmax(270px, 1fr); }
    .meal-estimate { position: sticky; top: 12px; }
    .meal-estimate-list { max-height: min(32vh, 290px); overflow: auto; }
}
@media (min-width: 600px) { .meal-dishes { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .meal-dishes { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 991px) {
    .menu-redesign #content { overflow: clip; }
    .meal-picker-toolbar { position: sticky; top: 0; z-index: 2; padding: 6px 0; border-bottom: 1px solid var(--menu-line); }
    .meal-quick-total { display: flex; align-items: center; justify-content: flex-end; gap: 6px; min-height: 32px; padding-top: 4px; color: var(--menu-red); font-size: 13px; }
    .meal-picker-heading h3 { scroll-margin-top: 104px; }
}
@media (max-width: 390px) {
    .meal-steps button { font-size: 13px; }
    .meal-planner { padding: 11px; }
    .meal-picker-heading h3 { font-size: 17px; }
}
