/* =====================================================================
   Project Food — customer menu
   Mobile-first, hairline borders, bottom-sheet item detail, sticky
   basket bar. Reskinned onto the shared design tokens (tokens.css/
   components.css) — --brand-color is the single accent source of
   truth throughout (see tokens.css).
   ===================================================================== */

:root {
    --brand: var(--brand-color);   /* local alias so this file need not change everywhere */
    --muted: var(--ink-muted);
    --line: var(--border);
    --surface-2: var(--canvas);
    --radius: var(--radius-card);
    --maxw: 720px;
    --pad: var(--space-6);
    --sticky-h: 0px;           /* set by JS to the sticky header height */
}

* { box-sizing: border-box; }

body.page-menu {
    margin: 0;
    background: var(--canvas);
    color: var(--ink);
    font-family: var(--font-body);
    font-weight: 400;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.page-menu .icon { width: 1.25em; height: 1.25em; display: inline-block; vertical-align: middle; }

/* Centre everything in a comfortable column on desktop. */
.menu-top,
.menu-main,
.empty-menu,
.menu-footer {
    width: 100%;
    max-width: var(--maxw);
    margin-inline: auto;
}

/* ---- Sticky top region: one container holding header + status + chips ---- */
.menu-top {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--surface);
}

.menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px var(--pad);
    border-bottom: 0.5px solid var(--line);
}

.brand {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}
.wordmark {
    color: var(--brand);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 24px;
    letter-spacing: 0.01em;
    text-decoration: none;
}
.tagline {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.2;
}
.tagline:empty {
    display: none;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
.phone-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--ink);
    text-decoration: none;
    font-size: 13px;
    white-space: nowrap;
}
.phone-link .icon { width: 18px; height: 18px; color: var(--brand); }
.phone-link:hover { text-decoration: underline; }

.basket-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: 0;
    padding: 6px;
    color: var(--ink);
    cursor: pointer;
    font: inherit;
}
.basket-button .icon { width: 24px; height: 24px; }
.basket-count {
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: var(--radius-pill);
    background: var(--brand);
    color: var(--brand-color-contrast);
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    line-height: 18px;
    text-align: center;
}

.status-strip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px var(--pad);
    font-size: 13px;
    color: var(--muted);
    border-bottom: 0.5px solid var(--line);
}
.status-dot {
    width: 8px; height: 8px; border-radius: var(--radius-pill);
    background: var(--brand);        /* open */
    display: inline-block;
}
.status-dot.is-closed { background: var(--rust); }

/* Closed: dot + text bold and in the closed colour. */
.status-strip.is-closed {
    color: var(--rust);
    font-weight: 700;
}
.status-strip.is-closed .status-dot.is-closed {
    width: 10px; height: 10px;
    box-shadow: 0 0 0 3px var(--rust-soft);
}

/* Closed banner under the status strip on the menu. */
.closed-banner {
    margin: 10px var(--pad) 0;
    padding: 10px 14px;
    border-radius: var(--radius-control);
    background: var(--rust-soft);
    border: 1px solid var(--rust);
    color: var(--rust);
    font-size: 14px;
    line-height: 1.4;
}
.closed-banner strong { font-weight: 700; }

/* Closed message inside the item detail sheet (replaces the add controls). */
.sheet-closed {
    margin-top: 16px;
    padding: 12px 14px;
    border-radius: var(--radius-control);
    background: var(--rust-soft);
    border: 1px solid var(--rust);
    color: var(--rust);
    font-size: 14px;
    line-height: 1.45;
}
.sheet-closed strong { font-weight: 700; }

.chips {
    display: flex;
    flex-wrap: nowrap;          /* single line */
    gap: 6px;
    padding: 6px var(--pad);    /* minimal vertical space */
    padding-left: calc(var(--pad) + 4px);  /* extra inset so the first pill isn't tight to the screen edge */
    scroll-padding-left: calc(var(--pad) + 4px);
    border-bottom: 0.5px solid var(--line);
    width: 100%;                /* never wider than its column */
    max-width: 100%;
    overflow-x: auto;           /* the bar scrolls INSIDE its own box */
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;      /* Firefox */
    scroll-snap-type: x proximity;
}
.chips::-webkit-scrollbar { display: none; } /* WebKit */

.chip {
    flex: 0 0 auto;             /* don't shrink; keep on one line */
    scroll-snap-align: start;
    border: 0.5px solid var(--line);
    border-radius: var(--radius-pill);
    padding: 5px 11px;
    font-size: 13px;
    line-height: 1.2;
    color: var(--ink);
    background: var(--surface);
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}
.chip.is-active {
    background: var(--brand);
    border-color: var(--brand);
    color: var(--brand-color-contrast);
}

/* ---- Sections & cards ---- */
.menu-main { padding-bottom: 96px; }       /* room above any future bar */

.menu-section {
    margin: 16px var(--pad) 0;
    padding: var(--space-6, 16px) var(--space-6, 16px) 4px;
    background: var(--surface);
    border: var(--border-hairline, 1px) solid var(--border);
    border-radius: var(--radius-lg, 14px);
    box-shadow: var(--shadow-card);
    /* offset for the sticky header when chip-scrolling / anchor jumps */
    scroll-margin-top: calc(var(--sticky-h) + 8px);
}
.menu-main > .menu-section:last-child { margin-bottom: 16px; }
.menu-section h2 {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 4px;
}

.item-list { list-style: none; margin: 0; padding: 0; }

.item-card {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    width: 100%;
    text-align: left;
    background: var(--surface);
    border: 0;
    border-bottom: 0.5px solid var(--line);
    padding: 14px 0;
    cursor: pointer;
    color: inherit;
    font: inherit;
}
.item-card:hover { background: var(--surface-2); }
.item-list > li:last-child .item-card { border-bottom: 0; }
.item-card:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }

/* Sold out (item-level, or every protein out): not orderable. */
.item-card.is-soldout { cursor: not-allowed; }
.item-card.is-soldout:hover { background: var(--surface); }
.item-card.is-soldout .thumb,
.item-card.is-soldout .card-body { opacity: 0.5; }
.item-card.is-soldout .soldout-label {
    opacity: 1; font-weight: 600; color: var(--rust);
    text-transform: uppercase; letter-spacing: 0.02em; font-size: 13px;
}
/* Scheduled off (Phase 43D): out of its recurring window, not out of
   stock — same treatment as .soldout-label but a calmer amber, so it
   reads as "not yet" rather than "gone". */
.item-card.is-soldout .schedule-label {
    opacity: 1; font-weight: 600; color: var(--amber);
    text-transform: uppercase; letter-spacing: 0.02em; font-size: 13px;
}

.thumb {
    width: 64px; height: 64px;
    border-radius: var(--radius-control);
    object-fit: cover;
    background: var(--surface-2);
    border: 0.5px solid var(--line);
    flex: 0 0 auto;
}

.card-body { flex: 1 1 auto; min-width: 0; display: block; }
.meta-row { display: block; }
.code { color: var(--muted); font-family: var(--font-mono); font-size: 12px; margin-right: 6px; }
.name { font-weight: 500; }
.name-thai { color: var(--muted); font-size: 13px; margin-left: 6px; }

.flags { display: inline-flex; align-items: center; gap: 8px; margin-top: 2px; }
.badge-v {
    display: inline-flex; align-items: center; justify-content: center;
    width: 18px; height: 18px; border-radius: 4px;
    background: var(--brand); color: var(--brand-color-contrast);
    font-size: 11px; font-weight: 600;
}
.flames { display: inline-flex; align-items: center; gap: 1px; color: var(--amber); }
.flames .icon-flame { width: 13px; height: 13px; }

.desc {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--muted);
    font-size: 13px;
    margin-top: 4px;
}
.price { display: block; font-family: var(--font-mono); font-weight: 600; margin-top: 6px; }

.chev { color: var(--muted); align-self: center; flex: 0 0 auto; }
.chev .icon { width: 20px; height: 20px; }

.empty-menu { padding: 32px var(--pad); color: var(--muted); }

.menu-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
    padding: 24px var(--pad) 40px;
    border-top: 0.5px solid var(--line);
    font-size: 13px;
}
.footer-address { font-style: normal; color: var(--muted); }
.footer-links { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; }
.menu-footer a { color: var(--muted); }
.footer-powered { margin: 8px 0 0; font-size: 11px; color: var(--ink-faint); }
.footer-powered-brand { color: var(--brand); font-weight: 600; text-decoration: none; }
.footer-powered-brand:hover { text-decoration: underline; }

/* =====================================================================
   Sticky basket bar — appears once the basket has items, giving a clear
   route to review + checkout. Toggled (hidden attr) by menu.js.
   ===================================================================== */
.basket-bar {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 40;
    width: 100%;
    max-width: var(--maxw);
    margin-inline: auto;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px var(--pad);
    padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    border: 0;
    background: var(--brand);
    color: var(--brand-color-contrast);
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.18);
}
.basket-bar[hidden] { display: none; }
.basket-bar:hover { background: color-mix(in srgb, var(--brand) 85%, black); }
.basket-bar .icon { width: 20px; height: 20px; }
.basket-bar-left { display: inline-flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.basket-bar-cta { flex: 1 1 auto; text-align: center; font-weight: 600; }
.basket-bar-total { flex: 0 0 auto; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* Reserve space so the fixed bar never hides the footer / last items. */
body.page-menu.has-basket-bar { padding-bottom: 76px; }

/* =====================================================================
   Dialog: detail sheet & basket (bottom sheet on mobile, modal on desktop)
   The dialog fills the viewport in the top layer; a flex wrapper positions
   the white panel. This avoids fighting the UA's own dialog positioning.
   ===================================================================== */
dialog.sheet {
    position: fixed;
    inset: 0;                    /* fills the viewport; width/height follow */
    width: 100%;
    height: 100dvh;
    max-width: 100%;
    max-height: 100dvh;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    overflow: hidden;
}
dialog.sheet::backdrop { background: rgba(0, 0, 0, 0.45); }

.sheet-wrap {
    height: 100%;
    display: flex;
    align-items: flex-end;       /* bottom sheet on mobile */
    justify-content: center;
}
.sheet-panel {
    width: 100%;
    max-width: var(--maxw);
    max-height: 90dvh;
    overflow-y: auto;
    background: var(--surface);
    border-radius: 16px 16px 0 0;
    padding: 16px var(--pad) calc(16px + env(safe-area-inset-bottom));
    -webkit-overflow-scrolling: touch;
}

@media (min-width: 721px) {
    .sheet-wrap { align-items: center; }
    .sheet-panel { border-radius: 16px; max-height: 85vh; }
    .fulfilment-choice { flex-direction: row; }
    .fulfilment-option { flex: 1 1 0; }
}

/* Sheet contents */
.sheet-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}
.sheet-title { font-family: var(--font-display); font-size: 18px; font-weight: 700; margin: 0; }
.sheet-sub { color: var(--muted); font-size: 13px; margin: 2px 0 0; }
.sheet-desc { color: var(--muted); font-size: 14px; margin: 8px 0 12px; }
.sheet-kcal { color: var(--ink-faint); font-size: 12px; margin: 4px 0 0; }
.sheet-close {
    background: none; border: 0; cursor: pointer; color: var(--muted);
    padding: 4px; margin: -4px -4px 0 0;
}
.sheet-close .icon { width: 22px; height: 22px; }

.sheet-section-label {
    font-size: 13px; font-weight: 600; margin: 12px 0 6px;
}
.qty-help {
    color: var(--muted);
    font-size: 13px;
    margin: 0 0 12px;
}

/* Option list (single select, native radios visually replaced) */
.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;
}

.option {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    border: 0.5px solid var(--line);
    border-radius: var(--radius-control);
    margin-bottom: 8px;
    cursor: pointer;
}
.option input {
    position: absolute;
    width: 1px; height: 1px;
    opacity: 0;            /* hidden but focusable for keyboard users */
}
.option .opt-label { display: inline-flex; align-items: center; gap: 8px; }
.option .check { width: 18px; height: 18px; color: var(--brand); visibility: hidden; }
.option .opt-price { font-family: var(--font-mono); font-weight: 600; }
.option:has(input:checked) {
    border-color: var(--brand);
    box-shadow: inset 0 0 0 1.5px var(--brand);
}
.option:has(input:checked) .check { visibility: visible; }
.option:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }

/* Notes textarea */
/* Dietary modifiers (item modal) — full tappable rows, real checkbox hidden
   inside the label, :checked/:disabled/:focus-visible states driven via
   :has() (already used elsewhere in this sheet for .option). */
.diet-mods { display: flex; flex-direction: column; gap: 8px; margin: 12px 0 0; }
.diet-mod {
    display: flex; align-items: center; gap: 12px;
    padding: 13px 16px; border: 1px solid var(--line); border-radius: var(--radius-card);
    cursor: pointer; user-select: none; background: var(--surface); transition: all .15s ease;
}
.diet-mod .box {
    width: 22px; height: 22px; border-radius: 6px; border: 1.5px solid var(--border);
    background: var(--surface); flex: none; display: grid; place-items: center; transition: all .15s ease;
}
.diet-mod .box svg { width: 13px; height: 13px; color: var(--brand-color-contrast); opacity: 0; transform: scale(.6); transition: all .15s ease; }
.diet-mod .txt { font-size: 15.5px; font-weight: 500; color: var(--ink); }
.diet-mod .sub { font-size: 13px; color: var(--ink-faint); margin-left: auto; }
.diet-mod:hover { border-color: var(--ink-faint); }
.diet-mod:has(input:checked) { background: var(--brand-color-soft); border-color: var(--brand); }
.diet-mod:has(input:checked) .box { background: var(--brand); border-color: var(--brand); }
.diet-mod:has(input:checked) .box svg { opacity: 1; transform: scale(1); }
.diet-mod:has(input:checked) .txt { font-weight: 600; color: var(--brand); }
.diet-mod:has(input:disabled) { opacity: .45; cursor: not-allowed; }
.diet-mod:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }

/* Dietary modifier badges (basket / checkout / confirmation lines) */
.diet-badge {
    display: inline-block; font-size: 11px; font-weight: 600; line-height: 1.5;
    padding: 0 7px; margin: 0 4px 0 0; border-radius: var(--radius-pill);
    background: var(--brand-color-soft); color: var(--brand); border: 1px solid var(--brand);
}
.line-diet { margin: 3px 0; }
.sum-diet { grid-column: 1 / -1; margin: 2px 0 0; }

/* Allergens */
.alg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.alg-controls { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 6px var(--pad) 10px; font-size: 13px; }
.alg-legend { display: inline-flex; align-items: center; gap: 5px; color: var(--ink-faint); }
.alg-disclaimer { margin: 6px var(--pad) 0; font-size: 12px; color: var(--ink-faint); line-height: 1.4; }

/* "Show allergen info" — switch. Real checkbox stays in the DOM (sr-only),
   :checked drives the visual via :has(). */
.switch-row { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch-row .txt { font-size: 15px; font-weight: 500; color: var(--ink); }
.switch {
    width: 40px; height: 24px; border-radius: var(--radius-pill); background: var(--border);
    position: relative; transition: background .15s ease; flex: none;
}
.switch::after {
    content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
    border-radius: 50%; background: var(--surface); box-shadow: 0 1px 3px rgba(0,0,0,.2);
    transition: left .15s ease;
}
.switch-row:has(input:checked) .switch { background: var(--brand); }
.switch-row:has(input:checked) .switch::after { left: 19px; }
.switch-row:has(input:checked) .txt { color: var(--ink); font-weight: 600; }
.switch-row:has(input:focus-visible) .switch { outline: 2px solid var(--brand); outline-offset: 2px; }

/* Card allergen icons — icon + visible name (a hover title is unreachable on
   touch), small radius on purpose: fully-rounded pills are reserved for
   tappable controls. */
.alg-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.alg {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 8px 3px 6px; background: var(--canvas); border-radius: 6px;
    font-size: 11px; font-weight: 500; line-height: 1.3; color: var(--ink-faint);
}
.alg-icon { width: 13px; height: 13px; color: var(--brand); flex: 0 0 auto; }
.alg-may { background: transparent; border: 1px dashed var(--border); }
.alg-may .alg-icon { color: var(--ink-faint); }
.alg-star { font-size: 10px; line-height: 1; margin-left: 1px; color: var(--ink-faint); }

/* Card toggle hides the card icons + surrounding notes (modal detail stays). */
body.alg-hidden .alg-row,
body.alg-hidden .alg-disclaimer,
body.alg-hidden .alg-legend { display: none; }

/* Modal allergen list (always shown in the item detail) — icon + label chips. */
.sheet-alg-h { margin-top: 16px; }
.sheet-alg-list { display: flex; flex-wrap: wrap; gap: 6px; }
.alg-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 10px 5px 8px; background: var(--canvas); border-radius: 6px;
    font-size: 13px; font-weight: 500; line-height: 1; color: var(--ink);
}
.alg-chip .alg-icon { width: 14px; height: 14px; color: var(--brand); }
.alg-chip.alg-may { background: transparent; border: 1px dashed var(--border); color: var(--ink-faint); }
.alg-chip.alg-may .alg-icon { color: var(--ink-faint); }
.sheet-alg-empty { font-size: 14px; color: var(--ink-faint); }
.sheet-alg-note { font-size: 12px; color: var(--ink-faint); margin: 8px 0 0; line-height: 1.4; }

.notes-field { display: block; margin-top: 12px; }
.notes-field textarea {
    width: 100%;
    min-height: 64px;
    resize: vertical;
    padding: 10px 12px;
    border: 0.5px solid var(--line);
    border-radius: var(--radius-control);
    font: inherit;
    color: var(--ink);
    background: var(--surface);
}
.notes-field textarea:focus-visible { outline: 2px solid var(--brand); outline-offset: 0; }

/* Quantity stepper */
.qty-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 16px 0;
}
.qty-row .qty-label { font-weight: 500; }
.stepper {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border: 0.5px solid var(--line);
    border-radius: var(--radius-pill);
    padding: 2px;
    margin-left: auto;
}
.stepper button {
    width: 36px; height: 36px;
    border: 0; border-radius: var(--radius-pill);
    background: var(--surface-2);
    color: var(--ink);
    cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
}
.stepper button:disabled { opacity: 0.4; cursor: not-allowed; }
.stepper button:focus-visible { outline: 2px solid var(--brand); }
.stepper .qty-value { min-width: 28px; text-align: center; font-family: var(--font-mono); font-weight: 600; }

/* Primary full-width button */
.btn-primary {
    display: block;
    width: 100%;
    padding: 14px 16px;
    border: 0;
    border-radius: var(--radius-card);
    background: var(--brand);
    color: var(--brand-color-contrast);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
}
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* Basket */
.basket-empty { color: var(--muted); padding: 16px 0; }
.basket-line {
    display: flex;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 0.5px solid var(--line);
}
.basket-line .thumb { width: 56px; height: 56px; }
.basket-line .line-body { flex: 1 1 auto; min-width: 0; }
.basket-line .line-top { display: flex; justify-content: space-between; gap: 12px; }
.basket-line .line-name { font-weight: 500; }
.basket-line .line-opt { color: var(--muted); font-size: 13px; }
.basket-line .line-total { font-family: var(--font-mono); font-weight: 600; white-space: nowrap; }
.basket-line .line-note {
    width: 100%;
    margin-top: 8px;
    padding: 8px 10px;
    border: 0.5px solid var(--line);
    border-radius: var(--radius-control);
    font: inherit;
    font-size: 13px;
}
.basket-line .line-controls {
    display: flex; align-items: center; gap: 12px; margin-top: 8px;
}
.basket-line .qty-unit { color: var(--muted); font-size: 13px; margin-left: -6px; }
.line-remove {
    background: none; border: 0; color: var(--brand);
    cursor: pointer; font: inherit; font-size: 13px; padding: 0;
    text-decoration: underline;
}
.basket-subtotal {
    display: flex; justify-content: space-between;
    font-family: var(--font-mono); font-weight: 600; margin: 16px 0;
}

@media (prefers-reduced-motion: no-preference) {
    html { scroll-behavior: smooth; }
}

/* =====================================================================
   Checkout & confirmation
   ===================================================================== */
.checkout {
    width: 100%;
    max-width: var(--maxw);
    margin-inline: auto;
    padding: 8px var(--pad) 40px;
}
.checkout h1 { font-family: var(--font-display); font-size: 22px; font-weight: 700; margin: 16px 0 8px; }
.co-h { font-family: var(--font-display); font-size: 16px; font-weight: 700; margin: 0 0 8px; }
.co-h:not(:first-child) { margin-top: 22px; }

/* Groups the form/confirmation content into surface cards (matches the
   order-status page's card pattern) instead of sitting flat on the page. */
.co-card {
    margin-top: 16px;
    padding: var(--space-6, 16px);
    background: var(--surface);
    border: var(--border-hairline, 1px) solid var(--border);
    border-radius: var(--radius-lg, 14px);
    box-shadow: var(--shadow-card);
}
.co-card:first-child { margin-top: 8px; }
.co-card > .co-h:first-child { margin-top: 0; }

.field { display: block; margin-bottom: 16px; }
.field[hidden] { display: none; }
.field-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 6px;
}
.req { color: var(--rust); font-weight: 700; }
.form-hint { font-size: 13px; color: var(--muted); margin: 0 0 14px; }

.field input,
.field select,
#order-note {
    width: 100%;
    max-width: 100%;            /* never exceed the wrapper */
    padding: 13px 14px;
    border: 2px solid var(--field-border, var(--border));
    border-radius: var(--radius-control);
    font: inherit;
    font-size: 16px;            /* >=16px prevents iOS auto-zoom on focus */
    line-height: 1.3;
    color: var(--ink);
    background: var(--surface);
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
#order-note { resize: vertical; }
.field input::placeholder,
#order-note::placeholder { color: var(--ink-faint); opacity: 1; }

/* Native select: replace the default control with a consistent chevron so the
   2px border / padding render the same across iOS, Android and desktop. */
.field select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding-right: 40px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B7268' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
}

/* Clear focus state — works on tap (mobile) and keyboard. */
.field input:focus,
.field select:focus,
#order-note:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-color-soft);
}

/* Error state: distinct red border + ring, plus the inline message below. */
.field.is-invalid input,
.field.is-invalid select,
.field.is-invalid #order-note {
    border-color: var(--rust);
}
.field.is-invalid input:focus,
.field.is-invalid select:focus,
.field.is-invalid #order-note:focus {
    box-shadow: 0 0 0 3px var(--rust-soft);
}
.field-error {
    display: block;
    margin-top: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--rust);
}
.field-error[hidden] { display: none; }

/* Honeypot — visually removed but present in the DOM. Uses the clip pattern
   (NOT left:-9999px, which widened the page and caused horizontal overflow). */
.hp {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.slots-message { font-size: 13px; color: var(--muted); margin: 4px 0 0; min-height: 1.1em; }
.slots-message.is-closed { color: var(--rust); }

/* ---- Checkout upsell module ---- */
.upsell {
    margin: 12px 0 4px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-card);
    background: var(--surface-2);
}
.upsell-hero {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.upsell-text { font-size: 15px; }
.upsell-price { color: var(--brand); font-family: var(--font-mono); font-weight: 600; white-space: nowrap; }
.upsell-head { font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.upsell-list { display: flex; flex-direction: column; gap: 8px; }
.upsell-card {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-control);
}
.upsell-card .upsell-name { flex: 1 1 auto; min-width: 0; }
.upsell-card .upsell-price { margin-left: auto; }
.upsell-add {
    flex: 0 0 auto;
    font: inherit; font-size: 14px; font-weight: 600;
    padding: 8px 16px;
    border: 0; border-radius: var(--radius-pill);
    background: var(--brand); color: var(--brand-color-contrast);
    cursor: pointer;
}
.upsell-add:hover { background: color-mix(in srgb, var(--brand) 85%, black); }
.upsell-add:disabled { opacity: 0.6; cursor: default; }

/* Order summary lines (checkout + confirmation) */
.summary { margin-bottom: 8px; }
.sum-line {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 2px 12px;
    padding: 10px 0;
    border-bottom: 0.5px solid var(--line);
}
.sum-qty { color: var(--muted); }
.sum-right { font-family: var(--font-mono); font-weight: 600; text-align: right; white-space: nowrap; }
.sum-note { grid-column: 1 / -1; color: var(--muted); font-size: 13px; }
.line-opt { color: var(--muted); font-size: 13px; }

.price-summary { margin: 16px 0; border-top: 0.5px solid var(--line); padding-top: 12px; }
.price-row { display: flex; justify-content: space-between; padding: 4px 0; font-family: var(--font-mono); }
.price-row.discount { color: var(--muted); }
.price-row.total {
    font-weight: 600;
    font-size: 16px;
    border-top: 0.5px solid var(--line);
    margin-top: 6px;
    padding-top: 10px;
}

.fulfilment-choice { display: flex; flex-direction: column; gap: 10px; margin: 10px 0 20px; }
.fulfilment-option {
    display: flex; align-items: center; justify-content: center;
    gap: 8px; padding: 12px; border: 2px solid var(--field-border, var(--border));
    border-radius: var(--radius-control); cursor: pointer; font-weight: 500; text-align: center;
    margin: 0;
}
.fulfilment-option input { width: auto; margin: 0; }
.fulfilment-option:has(input:checked) { border-color: var(--brand); background: var(--brand-color-soft); }
.fulfilment-option .icon { width: 20px; height: 20px; color: var(--brand); flex-shrink: 0; }

.discount-code-block { margin: 10px 0; }
.discount-code-row { display: flex; gap: 8px; }
.discount-code-row input {
    flex: 1 1 auto;
    min-width: 0;
    padding: 11px 12px;
    border: 2px solid var(--field-border, var(--border));
    border-radius: var(--radius-control);
    font: inherit;
    font-size: 16px;
    color: var(--ink);
    background: var(--surface);
    text-transform: uppercase;
}
.discount-code-row input::placeholder { text-transform: none; color: var(--ink-faint); }
.discount-code-row .discount-apply-btn { flex: 0 0 auto; width: auto; padding: 11px 18px; }
.discount-applied-row {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: 8px; font-size: 14px;
}
/* .price-row/.discount-applied-row set their own `display`, which beats the
   UA stylesheet's [hidden] rule at equal specificity (last-in-source wins) —
   without this, toggling the `hidden` attribute in JS silently does nothing. */
#sum-discount-row[hidden],
#conf-discount-row[hidden],
#sum-delivery-fee-row[hidden],
#conf-delivery-fee-row[hidden],
#sum-service-charge-row[hidden],
#conf-service-charge-row[hidden],
#sum-tip-row[hidden],
#conf-tip-row[hidden],
.discount-applied-row[hidden] { display: none; }

.tip-presets { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.tip-preset-btn {
    padding: 10px 16px;
    border: 2px solid var(--field-border, var(--border));
    border-radius: var(--radius-control);
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-weight: 500;
    cursor: pointer;
}
.tip-preset-btn.is-active { border-color: var(--brand); background: var(--brand-color-soft); }

.alert {
    padding: 10px 12px;
    border-radius: var(--radius-control);
    margin: 12px 0;
    font-size: 14px;
}
.alert-error { background: var(--rust-soft); color: var(--rust); border: 0.5px solid var(--rust); }

/* Payment (Stripe Payment Element) */
#payment-element { margin: 12px 0 20px; }
#pay-btn { margin-bottom: 10px; }
.btn-secondary {
    display: block;
    width: 100%;
    padding: 12px 16px;
    border: 0.5px solid var(--line);
    border-radius: var(--radius-card);
    background: none;
    color: var(--ink);
    font: inherit;
    font-weight: 500;
    cursor: pointer;
    text-align: center;
}
.btn-secondary[hidden] { display: none; }
.btn-secondary:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
#confirming-step { padding: 40px 0; text-align: center; color: var(--muted); }

/* Confirmation */
.conf-headline { font-size: 16px; }
.notices {
    margin: 20px 0;
    padding-top: 12px;
    border-top: 0.5px solid var(--line);
}
.notices p { font-size: 13px; color: var(--muted); margin: 0 0 10px; line-height: 1.5; }
.pay-icons {
    display: inline-flex;
    gap: 6px;
    vertical-align: -5px;
    margin-right: 6px;
    color: var(--brand);
}
.pay-icons .icon { width: 20px; height: 20px; }
.conf-actions { margin: 12px 0; }
.conf-actions .phone-link { color: var(--brand); }
