/* features.shopFlow (docs/order-flow.md; header spec vault/sites/healthhut2/Plans/2026-10-21-hh2-header-menu-spec.md): the new header, the ☰ panel, the basket drawer, the shop cards and the four-stage checkout.
   Shipped only in a build with the flag on. Tokens come from site.css. The shop view exists only while html[data-shop-live] is set by js/order-flow.js (settings/public.cashOrdersEnabled === true);
   until then /order/ is the existing WhatsApp form and every .shop-only element stays hidden. */

html { scroll-padding-top: 104px; }
@media (min-width: 768px) { html { scroll-padding-top: 116px; } }
html.dialog-open, html:has(dialog[open]) { overflow: hidden; }

/* ---------- header bar: logo · (Back office) · ☰ · Basket ---------- */
.site-header { position: sticky; top: 0; z-index: 40; }
.site-header .header-inner { min-height: 80px; gap: 10px; flex-wrap: wrap; justify-content: flex-end; padding-block: 12px; }
.site-header .brand { margin-right: auto; min-width: 0; gap: 10px; }
.site-header .brand img { width: 52px; height: 52px; }
.site-header .brand-name { display: none; }
#menu-toggle { position: relative; order: 2; flex: none; display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; padding: 0; border: 1px solid rgba(255, 255, 255, 0.72); border-radius: var(--radius); background: transparent; color: var(--white); }
#menu-toggle:hover { border-color: var(--white); }
.menu-lines { display: grid; gap: 4px; }
.menu-lines i { display: block; width: 20px; height: 2px; background: var(--white); }
html.is-signed-in #menu-toggle::after { content: ''; position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--mint); }
#basket-open { order: 3; flex: none; display: inline-flex; align-items: center; gap: 6px; height: 48px; min-height: 44px; padding: 8px 10px; border-radius: var(--radius); background: var(--white); color: var(--green-deep); font-size: 16px; font-weight: 700; text-decoration: none; white-space: nowrap; }
#basket-open:hover { background: var(--mint-text); color: var(--green-deep); }
#basket-open svg { width: 20px; height: 20px; flex: none; }
.basket-label { display: none; }
.basket-count { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 999px; background: var(--green-deep); color: var(--white); font-size: 16px; font-weight: 700; }
.basket-price { white-space: nowrap; font-variant-numeric: tabular-nums; }
#staff-chip { order: 10; flex: 1 0 100%; margin-right: auto; justify-content: flex-start; max-width: max-content; align-items: center; gap: 8px; height: 48px; min-height: 44px; margin-top: 2px; padding: 0 14px; border-radius: 999px; background: var(--white); color: var(--green-deep); font-size: 16px; font-weight: 700; text-decoration: none; }
#staff-chip:hover { background: var(--mint-text); color: var(--green-deep); }
@media (min-width: 480px) { .site-header .brand-name { display: block; } }
@media (min-width: 768px) {
  .site-header .header-inner { min-height: 92px; gap: 16px; flex-wrap: nowrap; }
  .site-header .brand img { width: 60px; height: 60px; }
  #menu-toggle { width: 48px; height: 48px; }
  #basket-open { height: 48px; min-height: 48px; padding: 12px 16px; font-size: 16px; gap: 8px; }
  .basket-label { display: inline; }
  #staff-chip { order: 1; flex: none; margin: 0; height: 48px; min-height: 40px; }
}
/* D1 T16: on the two-row phone header the chip sits balanced between the brand row and the masthead rule. */
@media (max-width: 767px) { #staff-chip { margin-top: 10px; margin-bottom: 4px; } }

/* ---------- dialogs: the ☰ panel and the basket drawer ---------- */
dialog.drawer { position: fixed; inset: 0 0 0 auto; margin: 0; width: 100%; max-width: none; height: 100dvh; max-height: none; padding: 0; border: 0; border-left: 1px solid var(--line); border-radius: 0; background: var(--cream); color: var(--ink); overscroll-behavior: contain; overflow: hidden; }
dialog.drawer::backdrop { background: rgba(7, 26, 16, 0.48); }
@media (min-width: 480px) { #site-menu { width: 360px; } #basket-dialog { width: 460px; } }
@media (prefers-reduced-motion: no-preference) {
  dialog.drawer[open] { animation: drawer-in 0.2s ease-out; }
  dialog.drawer[open]::backdrop { animation: scrim-in 0.15s ease-out; }
}
@keyframes drawer-in { from { transform: translateX(100%); } }
@keyframes scrim-in { from { opacity: 0; } }
.drawer-layout { display: flex; flex-direction: column; height: 100%; }
.dialog-head { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 12px 12px 24px; background: var(--cream); border-bottom: 1px solid var(--line); }
.dialog-head h2 { margin: 0; font-family: var(--display); font-size: 20px; font-weight: 600; line-height: 1.2; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 4px; background: transparent; font-size: 18px; color: var(--ink); }
.icon-btn:hover { background: var(--tint); }
#site-menu :focus-visible, #basket-dialog :focus-visible { outline-color: var(--green-deep); }

/* ☰ panel */
#site-menu .drawer-layout { overflow-y: auto; }
#site-menu .menu-list { display: flex; flex-direction: column; padding-block: 8px; }
#site-menu .menu-list a[href], #site-menu .menu-rows a[href], #site-menu .menu-rows button { display: flex; align-items: center; width: 100%; min-height: 48px; padding: 0 24px; border: 0; border-left: 0; border-radius: 0; background: none; color: var(--ink); font-size: 16px; font-weight: 600; text-align: left; text-decoration: none; }
#site-menu .menu-list a[href]:hover, #site-menu .menu-rows a[href]:hover, #site-menu .menu-rows button:hover { background: var(--tint); color: var(--ink); }
#site-menu .menu-list a[aria-current="page"] { background: var(--mint-light); color: var(--green-deep); font-weight: 700; }
.menu-account { min-height: 112px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.menu-account [data-auth-show] { display: none; }
html[data-auth-state="unknown"] .menu-account [data-auth-show~="unknown"],
html[data-auth-state="out"] .menu-account [data-auth-show~="out"],
html[data-auth-state="customer"] .menu-account [data-auth-show~="customer"],
html[data-auth-state="staff"] .menu-account [data-auth-show~="staff"],
html[data-auth-state="staff"] .menu-account [data-auth-show~="customer"] { display: block; }
.menu-skeleton span { display: block; height: 48px; margin: 0 24px 8px; border-radius: 4px; background: var(--tint); }
.menu-eyebrow { margin: 22px 0 6px; padding: 0 24px 0; font-size: 16px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--green-text); }
#site-menu .menu-staff-row { padding: 0 24px 8px; }
#site-menu a.menu-back-office[href] { width: auto; max-width: max-content; min-height: 44px; margin: 18px 0 0; padding: 0 20px; border-left: 0; border-radius: 999px; background: var(--green-deep); color: var(--white); }
#site-menu a.menu-back-office[href]:hover { background: var(--green-bright); color: var(--white); }

/* basket drawer */
#basket-dialog .dialog-body { flex: 1; overflow-y: auto; padding: 16px 24px; }
#basket-dialog .drawer-foot { flex: none; padding: 16px 24px calc(16px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); background: var(--cream); }
.basket-meta { margin: 0 0 12px; font-size: 16px; color: var(--muted); }
.basket-line { display: flex; gap: 14px; padding-block: 14px; border-top: 1px solid var(--line); }
.basket-line img { width: 64px; height: 64px; flex: none; object-fit: cover; border-radius: var(--radius); }
.basket-line-info { flex: 1; min-width: 0; }
.basket-line-info h3 { margin: 0 0 8px; font-family: var(--body); font-size: 16px; font-weight: 700; line-height: 1.3; }
.basket-line-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stepper-num { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; height: 44px; border-inline: 1px solid var(--line); background: var(--card); font-size: 16px; font-weight: 600; }
.basket-empty { display: grid; justify-items: center; gap: 10px; padding: 56px 8px; text-align: center; color: var(--green-text); }
.basket-empty h3 { margin: 0; font-family: var(--display); font-size: 24px; color: var(--ink); }
.basket-empty p { margin: 0 0 8px; }
.basket-totals { margin: 0 0 12px; font-size: 16px; }
.basket-totals > div { display: flex; justify-content: space-between; gap: 16px; padding-block: 6px; }
.basket-totals dt { color: var(--muted); }
.basket-totals dd { margin: 0; font-weight: 600; }
.basket-totals .basket-total { margin-top: 4px; border-top: 1px solid var(--line); padding-top: 10px; font-size: 18px; font-weight: 700; }
.basket-totals .basket-total dt { color: var(--ink); }
.basket-note { margin: 0 0 12px; font-size: 16px; color: var(--muted); }
.basket-note.is-error { color: #a22934; font-weight: 600; }
#basket-dialog .full { width: 100%; }
#basket-dialog .text-button.full { margin-top: 8px; background: none; border: 0; text-decoration: underline; }

/* toast */
.shop-toast { position: fixed; left: 50%; bottom: 24px; z-index: 60; transform: translateX(-50%); max-width: calc(100% - 32px); padding: 12px 22px; border-radius: 999px; background: var(--green-deep); color: var(--white); font-size: 16px; font-weight: 600; box-shadow: 0 8px 24px rgba(7, 26, 16, 0.3); pointer-events: none; }
.shop-toast:empty { display: none; }

/* ---------- /order/: hidden until the shop is live, then one view at a time ---------- */
html:not([data-shop-live]) .shop-only { display: none !important; }
html[data-shop-pending] #order-form { visibility: hidden; }
html[data-shop-live] .order-bar { display: none !important; }
html[data-shop-live][data-shop-view="shop"] :is(.checkout-steps, .back-shop, .stage-panel, .order-summary) { display: none !important; }
html[data-shop-live][data-shop-view="checkout"] :is(#meal-picker, .shop-tools) { display: none !important; }
html[data-shop-live] .stage-panel:not([data-active]) { display: none !important; }
html[data-shop-live][data-shop-view="shop"] .order-layout { grid-template-columns: 1fr; margin-top: 16px; }

.shop-tools { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 20px; }
.shop-tools p { margin: 0; font-size: 18px; }
.shop-count { color: var(--muted); font-size: 16px; }

/* shop cards: the existing pick rows, restyled */
html[data-shop-live][data-shop-view="shop"] #meal-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 24px; padding: 0; border: 0; background: none; }
html[data-shop-live][data-shop-view="shop"] #meal-picker legend { grid-column: 1 / -1; padding: 0; margin-bottom: 4px; }
html[data-shop-live] .pick-row { flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 0; min-height: 0; padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--r-photo); background: var(--card); }
html[data-shop-live] .pick-row:last-child { border-bottom: 1px solid var(--line); }
html[data-shop-live] .pick-row[hidden] { display: none !important; }
.pick-photo { position: relative; aspect-ratio: 8 / 5; background: var(--tint); }
.pick-photo img { width: 100%; height: 100%; object-fit: cover; }
.pick-pill, .shop-tools .pill { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 999px; background: var(--mint-light); color: var(--green-deep); font-size: 16px; font-weight: 700; }
.pick-pill { position: absolute; left: 12px; bottom: 12px; }
html[data-shop-live] .pick-row .pick-name { padding: 16px 18px 0; flex: 1; }
html[data-shop-live] .pick-row .pick-line { padding: 14px 18px 18px; justify-content: space-between; align-items: center; gap: 12px; }
html[data-shop-live] .pick-row .add-btn { min-height: 44px; padding: 8px 16px; font-size: 16px; gap: 10px; }
html[data-shop-live] .pick-row[data-qty="0"] .stepper { display: none; }
html[data-shop-live] .pick-row[data-qty]:not([data-qty="0"]) .add-btn { display: none; }

/* ---------- checkout: steps, panels, receipt ---------- */
.back-shop { min-height: 44px; margin-bottom: 8px; font-size: 16px; }
.checkout-steps { list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 0 0 24px; padding: 0; }
.checkout-steps li { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding-top: 10px; border-top: 4px solid var(--line); font-size: 16px; font-weight: 600; line-height: 1.25; color: var(--muted); }
.checkout-steps .step-mark { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--card); font-size: 16px; font-weight: 700; }
.checkout-steps li[data-state="current"] { border-top-color: var(--green-deep); color: var(--ink); }
.checkout-steps li[data-state="current"] .step-mark { background: var(--green-deep); border-color: var(--green-deep); color: var(--white); }
.checkout-steps li[data-state="done"] { border-top-color: var(--green-bright); }
.checkout-steps li[data-state="done"] .step-mark { background: var(--mint); border-color: var(--green-text); }
@media (min-width: 768px) { .checkout-steps li { flex-direction: row; align-items: center; gap: 8px; font-size: 16px; } }
/* D1 T27: equal-height steps on the phone strip. */
@media (max-width: 767px) { .checkout-steps li { min-height: 64px; } .checkout-steps li span:not(.step-mark) { line-height: 1.2; } }
.stage-panel { padding: 28px; border: 1px solid var(--line); border-radius: var(--r-photo); background: var(--card); }
.stage-panel h2 { margin: 0 0 6px; font-family: var(--display); font-size: 30px; font-weight: 600; line-height: 1.15; }
.stage-panel h2:focus { outline: none; }
.stage-intro { margin: 0 0 20px; color: var(--muted); }
.stage-panel fieldset { margin: 0 0 20px; padding: 0; border: 0; background: none; border-radius: 0; }
.stage-panel legend { margin-bottom: 10px; font-family: var(--body); font-size: 16px; font-weight: 700; }
.stage-panel .stage-body > input, .stage-panel .stage-body > textarea { width: 100%; }
.stage-error { margin: 14px 0 0; color: #a22934; font-weight: 600; font-size: 16px; }
.stage-error:empty { display: none; }
.stage-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 24px; }
.stage-actions .text-button { background: none; border-color: transparent; }
.stage-actions .text-button:hover { border-color: var(--accent); }
.allergen-item { margin-bottom: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--ground); font-size: 16px; }
.allergen-item p { margin: 4px 0 0; color: var(--muted); }
.stage-declarations { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.stage-declarations .check { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px; font-size: 16px; font-weight: 600; }
.stage-declarations .check input { flex: none; width: 22px; height: 22px; margin-top: 2px; }
.review-items { margin-bottom: 12px; }
.review-facts > div { display: flex; justify-content: space-between; gap: 18px; padding-block: 8px; border-top: 1px solid var(--line); font-size: 16px; }
.review-facts dt { flex: none; color: var(--muted); }
.review-facts dd { margin: 0; text-align: right; font-weight: 600; overflow-wrap: anywhere; }
.stage-panel #pay-card, .stage-panel .pay-cash-button, .stage-panel #send-order { width: 100%; }
/* R5/R10: shop live = no WhatsApp send/preview on /order/ (the .button rule would otherwise beat the hidden attribute). */
html[data-shop-live] #send-order, html[data-shop-live] .message-preview, html[data-shop-live] .message-preview + .field-help { display: none !important; }
.stage-panel .cash-panel { margin-top: 16px; }
.receipt-edit { margin: -8px 0 12px; }
@media (min-width: 901px) { html[data-shop-live][data-shop-view="checkout"] .order-summary { position: sticky; top: 124px; } }
@media (max-width: 900px) { html[data-shop-live] .order-layout { grid-template-columns: 1fr; gap: 28px; } }
@media (max-width: 767px) {
  .stage-panel { padding: 20px 16px; }
  .stage-panel h2 { font-size: 26px; }
  .stage-actions .button { flex: 1; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }

/* ---------- features.customerAccounts: saved details / saved notes at checkout, and the account prompt on the confirmation page (leg L3) ---------- */
.account-prompt { margin: 0 0 20px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-photo); background: var(--tint); font-size: 16px; }
/* D1 T20: no empty tinted box while every child is hidden; it shows the moment the auth script reveals one. */
.account-prompt:not(:has(> :not([hidden]))) { display: none; }
.account-prompt p { margin: 0; line-height: 1.55; }
.account-prompt p + .field-help { margin-top: 6px; }
.account-prompt .text-button { margin-left: 4px; min-height: 40px; }
.saved-notes-row { margin: 0 0 18px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-photo); background: var(--tint); }
.saved-notes-row .check { display: flex; gap: 12px; align-items: flex-start; font-size: 16px; font-weight: 600; }
.saved-notes-row .check input { flex: none; width: 22px; height: 22px; margin-top: 2px; }
.saved-notes-row .field-help { margin: 8px 0 0; }
.placed-account { margin-top: 28px; padding: 22px; }
.placed-account h2 { margin: 0 0 6px; font-family: var(--display); font-size: 26px; font-weight: 600; line-height: 1.15; }
.placed-account p { margin: 0 0 14px; }
