a {
    color: var(--color-link);
}

h1,
h2,
h3,
h4 {
    margin: 0;
    line-height: 1.25;
}

/** Keep the header and category bar in one sticky container. */
.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    box-shadow: var(--shadow);
}

.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: .55rem 1rem;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border-light);
}

.brand {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.brand .logo {
    height: 40px;
    width: auto;
}

.brand-name {
    font-weight: 700;
    font-size: 1.1rem;
}

.cat-bar {
    display: flex;
    align-items: center;
    gap: .25rem;
    padding: 0 1rem;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border-light);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.cat-tab {
    padding: .55rem .7rem;
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: .9rem;
    font-weight: 600;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    transition: color .15s ease, border-color .15s ease;
}

.cat-tab:hover {
    color: var(--color-primary-dark);
}

.cat-tab.active {
    color: var(--color-primary-dark);
    border-bottom-color: var(--color-primary);
}

.header-actions {
    display: flex;
    align-items: stretch;
    gap: 1rem;
}

.account-btn,
.cart-btn {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .5rem .9rem;
    border-radius: var(--radius);
    font-weight: 600;
}

.account-btn {
    background: transparent;
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
}

.account-btn:hover:not(:disabled) {
    background: transparent;
    color: var(--color-primary-dark);
    border-color: var(--color-primary);
}

.account-btn .icon {
    font-size: 1.4rem;
}

.account-label {
    display: none;
}

.cart-btn {
    position: relative;
    background: var(--color-primary);
    color: var(--color-on-primary);
}

.cart-btn .icon {
    font-size: 1.2rem;
}

.cart-count {
    position: absolute;
    top: -7px;
    right: -7px;
    min-width: 19px;
    height: 19px;
    padding: 0 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: var(--color-nav-bg);
    color: var(--color-on-primary);
    font-size: .9rem;
    font-weight: 700;
    line-height: 1;
}

/** Keep the hero outside main, as viewport widths include the scrollbar. */
.hero {
    padding: 1rem;
    background: linear-gradient(180deg, var(--color-primary-tint), var(--color-bg));
}

.hero-inner {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    text-align: left;
}

.hero-inner>div {
    flex: 1;
}

.hero h1 {
    font-size: 1.8rem;
    margin-bottom: .5rem;
}

.hero p {
    color: var(--color-text-muted);
    margin-bottom: 0;
}

.hero-logo {
    order: 2;
    height: 84px;
    width: auto;
}

main {
    max-width: 100%;
    margin: 0 auto;
    padding: 0 1rem var(--stack-gap);
}

#list-menu {
    display: grid;
    gap: var(--stack-gap);
}

.menu-cat {
    scroll-margin-top: 7rem;
}

.menu-cat h3 {
    font-size: 1.5rem;
    color: var(--color-primary-dark);
    margin-bottom: .5rem;
}

.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: .75rem;
}

.product-card {
    display: flex;
    flex-direction: column;
    padding: 0;
    margin: 0;
    text-align: left;
    font: inherit;
    color: var(--color-text);
    background: var(--color-surface);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-lg);
    overflow: hidden;
    cursor: pointer;
    position: relative;
    transition: border-color .12s ease, box-shadow .12s ease;
}

.pc-price {
    position: absolute;
    top: .5rem;
    right: .5rem;
    padding: .15rem .5rem;
    border-radius: var(--radius);
    background: var(--color-surface);
    border: 1px solid var(--color-border-light);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--color-primary-dark);
}

.product-card:hover,
.product-card:active,
.product-card:focus-visible {
    background: var(--color-surface);
    border-color: var(--color-primary);
    box-shadow: var(--shadow);
}

.tile-picture {
    position: relative;
    display: grid;
    place-items: center;
    overflow: hidden;
    aspect-ratio: var(--tile-ratio, 1 / 1);
    background: linear-gradient(135deg, var(--color-primary-tint-2), var(--color-primary-tint-3)) center / cover no-repeat;
    color: var(--color-primary-dark);
    font-weight: 800;
    font-size: var(--tile-letter, 2rem);
}

.tile-picture::after {
    content: attr(data-initial);
}

.tile-picture[data-image]::after {
    content: none;
}

.pc-badges {
    position: absolute;
    top: .4rem;
    left: .4rem;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: .3rem;
}

.pc-badge {
    text-box: trim-both cap alphabetic;
    padding: .35rem .45rem;
    border-radius: 999px;
    font-size: .8rem;
    font-weight: 800;
    letter-spacing: .05em;
    color: var(--color-on-primary);
}

.pc-badge.veg {
    background: var(--color-success-text);
}

.pc-badge.spicy {
    background: var(--color-error-text);
}

.pc-badge.seafood {
    background: var(--color-info-text);
}

.pc-body {
    display: flex;
    flex-direction: column;
    gap: .15rem;
    padding: .5rem .6rem .65rem;
}

.pc-name {
    font-weight: 700;
    font-size: .95rem;
    line-height: 1.2;
}

.pc-sub {
    color: var(--color-text-muted);
    font-size: .9rem;
    line-height: 1.35;
}

.stores {
    padding-bottom: var(--stack-gap);
}

.stores-title {
    margin: 0 0 .5rem;
    font-size: .8rem;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    font-weight: 700;
}

.stores-grid {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    gap: .75rem;
}

.stores-grid::-webkit-scrollbar {
    display: none;
}

.store-card {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
        'name call'
        'addr addr'
        'status status';
    align-items: center;
    gap: .5rem;
    flex: 0 0 84%;
    scroll-snap-align: start;
    background: var(--color-surface);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-lg);
    padding: .85rem;
    text-align: left;
}

.store-name {
    grid-area: name;
    font-weight: 700;
}

.store-status {
    grid-area: status;
    justify-self: start;
    font-size: .9rem;
    font-weight: 600;
    text-box: trim-both cap alphabetic;
    padding: .5rem .6rem;
    border-radius: 999px;
}

.store-status.open {
    background: var(--color-success-bg);
    color: var(--color-success-text);
}

.store-status.closed {
    background: var(--color-border-light);
    color: var(--color-text-muted);
}

.store-addr {
    grid-area: addr;
    color: var(--color-text-muted);
    font-size: .9rem;
}

.store-call {
    grid-area: call;
    white-space: nowrap;
    padding: .4rem .6rem;
    border-radius: var(--radius);
    background: var(--color-primary);
    color: var(--color-on-primary);
    font-weight: 600;
    font-size: .85rem;
    text-decoration: none;
}

.store-call:hover {
    background: var(--color-primary-dark);
}

.site-footer {
    text-align: center;
    padding: 1.5rem 1rem;
    background: var(--color-nav-bg);
    color: var(--color-nav-text);
}

.site-footer p {
    margin: .25rem 0;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 1.25rem;
    margin-bottom: .6rem;
}

.footer-links a {
    color: var(--color-nav-text);
    text-decoration: none;
    font-size: .9rem;
}

.footer-links a:hover {
    color: var(--color-primary);
    text-decoration: underline;
}

.site-footer .muted {
    color: var(--color-nav-text-dim);
}

.modal {
    width: 100%;
    max-width: 100%;
    border-radius: 0;
}

/** Preserve DOM and tab order when reversing footer controls visually. */
.modal-foot {
    flex-direction: column-reverse;
    align-items: stretch;
}

.modal-foot>.foot-left,
.modal-foot>.foot-right {
    flex-direction: column;
    align-items: stretch;
}

.modal-foot>.foot-right {
    margin-left: 0;
}

#modal-config .modal-foot {
    flex-direction: column;
    gap: 1rem;
}

#modal-config .modal-foot .qty {
    justify-content: center;
}

.modal-body {
    gap: var(--stack-gap);
}

.modal-section {
    padding-bottom: 0;
    border-bottom: 0;
}

.modal-section>h4,
.modal-section>.section-label,
.editor-head {
    margin: 0;
    font-size: .95rem;
    font-weight: 700;
    color: var(--color-text);
}

/** Keep quantity and add controls outside the scrolling modal body. */
.qty {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.qty-down,
.qty-up {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: var(--color-primary);
    font-size: 1.5rem;
}

.qty-down:hover:not(:disabled),
.qty-up:hover:not(:disabled) {
    background: var(--color-primary-dark);
}

.qty-number {
    min-width: 1.5rem;
    text-align: center;
    font-weight: 700;
    font-size: 1.5rem;
}

.qty-down:disabled,
.qty-up:disabled {
    opacity: .4;
    cursor: default;
}

.config-add {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .6rem;
    font-weight: 700;
    letter-spacing: .04em;
}

.config-add-total {
    font-variant-numeric: tabular-nums;
    opacity: .95;
}

.config-simple {
    text-align: center;
}

.config-simple-img {
    --tile-ratio: 16 / 9;
    --tile-letter: 2.6rem;
    border-radius: var(--radius-lg);
}

.config-simple-img:has(img:not([hidden]))::after {
    content: none;
}

/** Exclude the image from grid sizing to preserve the aspect ratio. */
.config-simple-img img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-lg);
}

.config-desc {
    color: var(--color-text-muted);
}

#list-cart-lines {
    list-style: none;
    margin: 0;
    padding: 0;
}

#list-cart-lines>li {
    padding-bottom: 0.5rem;
}

#list-cart-lines>li~li {
    padding-top: 1rem;
}

#list-cart-lines>li:not(:last-child) {
    border-bottom: 1px solid var(--color-border-light);
}

#list-cart-lines>li:last-child {
    padding-bottom: 0rem;
}

.cart-line-main {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    font-weight: 600;
}

.change-list {
    list-style: disc;
    margin: 0rem;
    margin-bottom: 0.25rem;
    padding: 0;
    padding-left: 2rem;
    color: var(--color-text-muted);
    font-size: .9rem;
    line-height: 1.4;
}

.change-item {
    color: var(--color-text);
    font-weight: 600;
}

.change-sublist {
    list-style: disc;
    margin: 0;
    padding-left: 1rem;
    color: var(--color-text-muted);
    font-weight: 400;
}

/** Apply flex layout inside the list item to preserve its marker. */
.change-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.change-charge {
    flex: none;
}

.cart-line-actions {
    display: flex;
    gap: 1rem;
    margin-top: .5rem;
}

.cart-remove,
.cart-edit {
    margin: 0;
    padding: 0;
    background: transparent;
    font-size: .9rem;
}

.cart-remove {
    color: var(--color-error-text);
    font-weight: bold;
}

.cart-edit {
    color: var(--color-link);
    font-weight: bold;
}

.cart-remove:hover:not(:disabled),
.cart-edit:hover:not(:disabled) {
    background: transparent;
    text-decoration: underline;
}

.checkout {
    position: relative;
}

.checkout-choices .choice {
    padding: .7rem .8rem;
    font-weight: 600;
}

.checkout-details {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.edit-link {
    padding: 0;
    background: transparent;
    color: var(--color-link);
    font-size: .9rem;
    font-weight: 600;
}

.edit-link:hover:not(:disabled) {
    background: transparent;
    color: var(--color-link-hover);
    text-decoration: underline;
}

#lbl-checkout-who {
    font-weight: 700;
}

#lbl-checkout-address {
    margin-bottom: 0;
}

/** Show delivery instructions only for delivery orders. */
#checkout-form:not(.delivery) #notes-section {
    display: none;
}

.voucher-entry,
.phone-code-entry {
    display: flex;
    gap: .5rem;
    align-items: stretch;
}

.voucher-entry .field,
.phone-code-entry .field {
    flex: 1;
    margin: 0;
}

#checkout-done {
    text-align: center;
}

.checkout-check {
    width: 3rem;
    height: 3rem;
    margin: 0 auto;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--color-success-bg);
    color: var(--color-success-text);
    margin-bottom: 10px;
}

#lbl-account-name {
    margin: 0;
    font-weight: 600;
    font-size: 1rem;
}

.account-sub {
    margin: 0;
    color: var(--color-text-muted);
    font-size: 1rem;
}

.account-confirm {
    border-top: 1px solid var(--color-border-light);
    padding-top: 1rem;
}

.account-confirm>.account-sub {
    margin-bottom: .5rem;
}

.order-card {
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius);
    padding: .6rem;
    margin-bottom: .5rem;
}

.order-top {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.order-date,
.order-scheduled {
    color: var(--color-text-muted);
    font-size: .9rem;
}

.order-pill {
    margin-left: auto;
    font-size: .9rem;
    text-box: trim-both cap alphabetic;
    padding: .45rem .55rem;
    border-radius: 999px;
    background: var(--color-border-light);
    color: var(--color-text-muted);
    text-transform: capitalize;
}

.order-pill.pay-paid {
    background: var(--color-success-bg);
    color: var(--color-success-text);
}

.order-pill.pay-unpaid {
    background: var(--color-warn-bg);
    color: var(--color-warn-text);
}

.order-pill.pay-refunding,
.order-pill.pay-refunded {
    background: var(--color-error-bg);
    color: var(--color-error-text);
}

.order-items {
    margin: .35rem 0;
    font-size: .9rem;
    font-weight: 600;
}

.order-foot {
    display: flex;
    justify-content: space-between;
    font-size: .9rem;
    color: var(--color-text-muted);
}

.order-actions {
    display: flex;
    gap: .5rem;
    margin-top: .5rem;
}

.order-action {
    width: auto;
    padding: .25rem .7rem;
    font-size: .9rem;
}

.receipt-lines {
    display: flex;
    flex-direction: column;
    gap: var(--stack-gap);
}

.receipt-money {
    display: flex;
    justify-content: space-between;
}

.receipt-money.receipt-emphasis,
.receipt-money.receipt-total {
    font-weight: 700;
}

.receipt-depth-1 {
    margin-left: 1rem;
}

.receipt-text.receipt-centred {
    text-align: center;
}

.receipt-banner {
    text-align: center;
    color: var(--color-primary);
    font-weight: 700;
}

.receipt-text.receipt-emphasis {
    color: var(--color-error-text);
    font-weight: 700;
}

.receipt-rule {
    border: 0;
    border-top: 1px solid var(--color-border);
    margin: 0;
}

.receipt-blank {
    height: var(--stack-gap);
}

@media print {
    body.print-receipt> :not(#modal-receipt) {
        display: none !important;
    }

    body.print-receipt #modal-receipt {
        position: static;
        margin: 0;
        border: 0;
        box-shadow: none;
        max-width: none;
        max-height: none;
    }

    body.print-receipt #modal-receipt .modal-head,
    body.print-receipt #modal-receipt .modal-foot {
        display: none;
    }
}

.order-total {
    font-weight: 600;
    color: var(--color-text);
}

@media (min-width: 600px) {
    .modal {
        width: revert-layer;
        max-width: revert-layer;
        border-radius: revert-layer;
    }

    .modal-foot,
    .modal-foot>.foot-left,
    .modal-foot>.foot-right {
        flex-direction: revert-layer;
        align-items: revert-layer;
    }

    .modal-foot>.foot-right {
        margin-left: revert-layer;
    }

    #modal-config .modal-foot {
        flex-direction: revert-layer;
        gap: revert-layer;
    }

    #modal-config .modal-foot .qty {
        justify-content: revert-layer;
    }

    .site-header {
        padding: .75rem 1.5rem;
    }

    .account-label {
        display: inline;
    }

    main {
        max-width: 80vw;
    }

    .cat-bar {
        justify-content: center;
        padding: 0 1.5rem;
    }

    .hero {
        padding: 2.5rem 1.5rem;
    }

    .hero-inner {
        flex-wrap: wrap;
        gap: .5rem 2rem;
        text-align: center;
    }

    .hero-inner>div {
        flex: none;
    }

    .hero h1 {
        font-size: 2.4rem;
    }

    .stores-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(320px, 400px));
    }

    .store-call {
        padding: .4rem .8rem;
        font-size: .9rem;
    }

    main {
        padding: 0 1.5rem 2rem;
    }

    #list-menu {
        display: flex;
        flex-wrap: wrap;
        align-items: flex-start;
        gap: 2rem;
    }

    .menu-cat {
        flex: 0 1 auto;
        min-width: 0;
    }

    .stores {
        padding-bottom: 2rem;
    }

    .menu-grid {
        display: flex;
        flex-wrap: wrap;
        gap: 1rem;
    }

    .menu-grid>.product-card {
        flex: 0 0 200px;
    }
}

#modal-wizard .modal-body {
    flex: 1;
    max-height: none;
}

.wizard-head-r {
    display: flex;
    align-items: center;
    gap: .75rem;
}

.wizard-step {
    color: var(--color-text-muted);
    font-size: .9rem;
    font-weight: 600;
    white-space: nowrap;
    text-align: center;
    margin-top: 0.5rem;
}

#wizard-pips {
    display: flex;
    justify-content: center;
    gap: .4rem;
    padding: .5rem;
}

.wizard-pip {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--color-border);
    transition: background .15s ease, transform .15s ease;
}

.wizard-pip.done {
    background: var(--color-primary-dark);
}

.wizard-pip.active {
    background: var(--color-primary);
    transform: scale(1.3);
}

#wizard-stage {
    display: grid;
    align-content: start;
    gap: var(--stack-gap);
}

.wizard-editor {
    display: grid;
    align-content: start;
    gap: var(--stack-gap);
}

/** Keep title margins zero, as unlayered margins override the shared spacing reset. */
.wizard-stage-title,
.cart-review-title {
    margin: 0;
    font-size: 1.1rem;
    color: var(--color-primary-dark);
}

/** Show the empty list while loading and reserve its height so the modal body can shrink. */
#modal-cart .modal-body:has(>.busy-overlay:not([hidden])) #list-cart-lines:empty {
    display: block;
    min-height: 16rem;
}

.wizard-base-acc {
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius);
}

.wizard-base-acc>summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    padding: .6rem .75rem;
    cursor: pointer;
    font-weight: 600;
    list-style: none;
    transition: background .12s ease;
}

.wizard-base-acc>summary:hover {
    background: var(--color-border-light);
}

.wizard-base-acc>summary::-webkit-details-marker {
    display: none;
}

.wizard-base-acc[open]>summary {
    border-bottom: 1px solid var(--color-border-light);
}

.wizard-base-acc[open]>summary .editor-chevron {
    transform: rotate(-90deg);
}

.wizard-base-acc .wizard-bases {
    padding: .75rem;
}

.wizard-split-toggle {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .6rem .75rem;
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius);
    font-weight: 600;
    font-size: .9rem;
    cursor: pointer;
    transition: background .12s ease;
}

.wizard-split-toggle:hover {
    background: var(--color-border-light);
}

.wizard-split-toggle input {
    width: 18px;
    height: 18px;
    accent-color: var(--color-primary);
}

.wizard-bases {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: .5rem;
}

.wizard-base {
    display: flex;
    flex-direction: column;
    gap: .3rem;
    padding: 0 0 .4rem;
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius);
    background: var(--color-surface);
    color: var(--color-text);
    overflow: hidden;
    font-size: .9rem;
    font-weight: 600;
}

.wizard-base.sel {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 1px var(--color-primary);
}

.wizard-base-img {
    --tile-letter: 1.5rem;
}

.wizard-base-name {
    padding: 0 .3rem;
}

.wizard-picks {
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    overflow: hidden;
}

.wizard-pick-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .75rem;
    padding: .5rem .8rem;
}

.wizard-pick-row+.wizard-pick-row {
    border-top: 1px solid var(--color-border-light);
}

.wizard-pick-row.whole-row {
    cursor: pointer;
}

.wizard-pick-row.sel {
    background: var(--color-primary-tint);
}

.wizard-pick-name {
    font-weight: 600;
}

.wizard-pick-opts {
    display: flex;
    gap: .4rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.wizard-pick {
    padding: .35rem .8rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-bg);
    color: var(--color-text);
    font-weight: 600;
}

.wizard-pick.sel {
    border-color: var(--color-primary);
    background: var(--color-primary-tint);
    color: var(--color-primary-dark);
}

.wizard-review-line {
    display: flex;
    justify-content: space-between;
    font-weight: 600;
    padding: .35rem 0;
    border-top: 1px solid var(--color-border-light);
}

.wizard-review> :first-child {
    border-top: 0;
}

.wizard-next {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    font-weight: 700;
    letter-spacing: .04em;
}

.wizard-next:disabled {
    opacity: .5;
}

.wizard-next-total {
    font-variant-numeric: tabular-nums;
}

.wizard-next-total:not(:empty)::before {
    content: "· ";
}

.sso-divider {
    display: flex;
    align-items: center;
    gap: .75rem;
    color: var(--color-text-muted);
    font-size: .9rem;
    margin-bottom: .75rem;
}

.sso-divider::before,
.sso-divider::after {
    content: "";
    flex: 1;
    border-top: 1px solid var(--color-border-light);
}

.sso-google {
    display: flex;
    justify-content: center;
}

.login-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0 1rem;
}

.login-links .linklike {
    width: auto;
    margin-top: 0;
}

.reset-wrap {
    max-width: 26rem;
    margin: 4rem auto;
    padding: 0 1rem;
}

.reset-wrap .links {
    margin-top: 1rem;
}
