:root {
    --coffee: #6f4e37;
    --coffee-dark: #3f2d23;
    --coffee-soft: #f3e8df;
    --cream: #f8f5f1;
    --card: #ffffff;
    --text: #2d2825;
    --muted: #7c716a;
    --line: #e8dfd8;
    --success: #2f7d57;
    --shadow: 0 14px 36px rgba(66, 46, 34, 0.09);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background: var(--cream);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

.topbar {
    color: white;
    background: linear-gradient(135deg, #3d2a20, #6f4e37 62%, #8c6348);
    box-shadow: 0 5px 18px rgba(63, 45, 35, .12);
}

.topbar-inner {
    width: min(1160px, calc(100% - 32px));
    min-height: 64px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 10px 0;
}

.brand-block {
    min-width: 0;
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.brand {
    margin: 0;
    white-space: nowrap;
    font-size: 19px;
    font-weight: 800;
    letter-spacing: .1px;
}

.tagline {
    color: rgba(255,255,255,.76);
    font-size: 13px;
    white-space: nowrap;
}

.topbar-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

.board-link {
    padding: 8px 10px;
    border-radius: 9px;
    color: rgba(255,255,255,.9);
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
}

.board-link:hover { background: rgba(255,255,255,.1); }

.page {
    width: min(1160px, calc(100% - 32px));
    margin: 14px auto 36px;
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(330px, .72fr);
    grid-template-areas:
        "menu order"
        "track order";
    gap: 18px;
    align-items: start;
}

.card {
    padding: 19px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--card);
    box-shadow: var(--shadow);
}

.order-column { display: grid; gap: 14px; }
.order-card { position: sticky; top: 14px; }

.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    margin-bottom: 10px;
}
.section-heading.compact { margin-bottom: 6px; }
.section-heading h2,
.success-card h2 {
    margin: 4px 0 0;
    color: var(--coffee-dark);
    font-size: 23px;
    letter-spacing: -.35px;
}
.eyebrow {
    color: #a06f4d;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.2px;
}
.small-note { color: var(--muted); font-size: 13px; }

.menu-list { display: grid; }
.menu-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 14px 4px;
    border-bottom: 1px solid var(--line);
}
.menu-item:last-child { border-bottom: 0; }
.menu-info { min-width: 0; }
.menu-info h3 { margin: 0 0 6px; color: #38291f; font-size: 17px; }
.menu-info p { margin: 0; color: var(--muted); line-height: 1.5; font-size: 14px; }
.menu-action { min-width: 118px; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.menu-price { color: var(--coffee-dark); font-size: 18px; font-weight: 760; }

button {
    border: 0;
    border-radius: 10px;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    transition: transform .15s ease, background .15s ease, box-shadow .15s ease, opacity .15s ease;
}
button:hover { transform: translateY(-1px); }
button:active { transform: translateY(0); }
button:disabled { cursor: not-allowed; opacity: .58; transform: none; }

.add-button {
    padding: 9px 14px;
    color: white;
    background: var(--coffee);
}
.add-button:hover { background: var(--coffee-dark); box-shadow: 0 7px 16px rgba(63,45,35,.16); }

.cart-list { margin-top: 6px; }
.cart-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 14px;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
}
.cart-item:last-child { border-bottom: 0; }
.cart-item h3 { margin: 0 0 4px; font-size: 15px; }
.cart-item p { margin: 0; color: var(--muted); font-size: 13px; }
.quantity-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fbf8f5;
}
.quantity-controls button {
    width: 29px;
    height: 29px;
    padding: 0;
    color: var(--coffee-dark);
    background: var(--coffee-soft);
    font-size: 18px;
}
.quantity-controls span { min-width: 20px; text-align: center; font-weight: 750; }

.total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 14px 0 20px;
    padding-top: 16px;
    border-top: 1px dashed #d8cbc1;
    color: var(--coffee-dark);
    font-size: 18px;
}
.total-row strong { font-size: 22px; }

.field { margin-bottom: 12px; }
.field label { display: block; margin-bottom: 7px; color: #55483f; font-size: 14px; font-weight: 700; }
.field input,
.field select {
    width: 100%;
    min-height: 43px;
    padding: 9px 11px;
    border: 1px solid #d9ccc2;
    border-radius: 10px;
    color: var(--text);
    background: white;
    font: inherit;
}
.field input:focus,
.field select:focus {
    outline: none;
    border-color: #a97855;
    box-shadow: 0 0 0 3px rgba(169,120,85,.12);
}
.field small { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; }

.primary-button,
.secondary-button { width: 100%; min-height: 43px; padding: 9px 14px; }
.primary-button { color: white; background: var(--coffee); }
.primary-button:hover { background: var(--coffee-dark); box-shadow: 0 8px 18px rgba(63,45,35,.16); }
.secondary-button { color: var(--coffee-dark); background: var(--coffee-soft); }
.secondary-button:hover { background: #e9d8cb; }
.privacy-note { margin: 11px 2px 0; color: var(--muted); font-size: 11px; line-height: 1.45; text-align: center; }

.empty-message {
    margin: 8px 0;
    padding: 18px;
    border-radius: 12px;
    color: var(--muted);
    background: #faf7f4;
    text-align: center;
    font-size: 14px;
}

.tracking-panel {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: rgba(255,255,255,.88);
    box-shadow: 0 6px 18px rgba(66, 46, 34, .05);
}

.tracking-panel > summary {
    min-height: 46px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 15px;
    cursor: pointer;
    list-style: none;
    color: var(--coffee-dark);
}

.tracking-panel > summary::-webkit-details-marker { display: none; }
.tracking-panel > summary::after {
    content: "+";
    flex: 0 0 auto;
    color: var(--coffee);
    font-size: 20px;
    font-weight: 500;
    line-height: 1;
}
.tracking-panel[open] > summary::after { content: "−"; }
.tracking-panel > summary:hover { background: #fbf7f3; }
.tracking-panel > summary strong { font-size: 15px; }
.tracking-panel > summary .eyebrow { margin-right: 8px; }
.tracking-summary-hint { margin-left: auto; color: var(--muted); font-size: 12px; }

.tracking-content {
    padding: 0 15px 14px;
    border-top: 1px solid #f0e8e2;
}

.tracking-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 150px;
    gap: 10px;
    align-items: end;
    padding-top: 12px;
}
.tracking-form .field { margin-bottom: 0; }
.tracking-form .primary-button { min-height: 43px; }
.tracking-message { margin: 9px 0 0; color: #983c32; line-height: 1.4; }
.tracking-message:empty { display: none; }
.tracking-result {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 24px;
    align-items: end;
    margin-top: 11px;
    padding: 11px 13px;
    border: 1px solid #cfe6d6;
    border-radius: 10px;
    background: #f5fbf7;
}
.tracking-result div { display: flex; flex-direction: column; gap: 2px; }
.tracking-result span { color: var(--muted); font-size: 12px; }
.tracking-result strong { color: #274938; font-size: 19px; }
.tracking-result .secondary-button { width: auto; min-height: 38px; margin-left: auto; }

.order-note-details {
    margin: 0 0 12px;
    border: 1px solid #e4d8cf;
    border-radius: 10px;
    background: #fbf8f5;
}
.order-note-details > summary {
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 11px;
    cursor: pointer;
    list-style: none;
    color: #55483f;
    font-size: 13px;
    font-weight: 700;
}
.order-note-details > summary::-webkit-details-marker { display: none; }
.order-note-details > summary::after {
    content: "+";
    color: var(--coffee);
    font-size: 18px;
    font-weight: 500;
}
.order-note-details[open] > summary::after { content: "−"; }
.optional-label {
    margin-left: auto;
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
}
.order-note-field { margin: 0; padding: 0 10px 10px; }
.order-note-field textarea {
    min-height: 62px;
    padding: 9px 10px;
    border: 1px solid #d9ccc2;
    border-radius: 9px;
    color: var(--text);
    background: white;
    font: inherit;
}
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.success-card {
    border-color: rgba(47,125,87,.28);
    background: linear-gradient(145deg, #f5fbf7, #fff);
}
.success-icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    margin-bottom: 14px;
    border-radius: 50%;
    color: white;
    background: var(--success);
    font-size: 22px;
    font-weight: 800;
}
.success-card .eyebrow { color: var(--success); }
.order-details { margin: 18px 0; }
.order-details div {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 9px 0;
    border-bottom: 1px solid #e5eee8;
}
.order-details dt { color: var(--muted); }
.order-details dd { margin: 0; color: #274938; font-weight: 700; text-align: right; }
.order-details .success-order-number { font-size: 23px; }
.receipt-note { margin: 8px 0 0; color: #476352; line-height: 1.5; }

.hidden { display: none !important; }
footer { padding: 0 20px 28px; color: #988b83; text-align: center; font-size: 12px; }

@media (max-width: 780px) {
    .topbar-inner {
        width: min(100% - 24px, 620px);
        min-height: 0;
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
        padding: 10px 0;
    }
    .brand-block { width: 100%; justify-content: space-between; gap: 10px; }
    .tagline { white-space: normal; text-align: right; }
    .topbar-actions { width: 100%; justify-content: space-between; gap: 8px; }
    .page { width: min(100% - 24px, 620px); grid-template-columns: 1fr; margin-top: 12px; }
    .card { padding: 17px 15px; border-radius: 14px; }
    .order-card { position: static; }
}

@media (max-width: 480px) {
    .brand-block { align-items: flex-start; flex-direction: column; gap: 2px; }
    .tagline { text-align: left; }
    .topbar-actions { align-items: stretch; flex-direction: column; }
    .board-link { padding-left: 0; }
    .menu-item { align-items: flex-start; }
    .menu-action { min-width: 98px; }
    .section-heading { align-items: flex-start; }
    .small-note { display: none; }
    .tracking-panel > summary { align-items: flex-start; }
    .tracking-summary-hint { display: none; }
    .tracking-form { grid-template-columns: 1fr; }
    .tracking-result .secondary-button { width: 100%; margin-left: 0; }
}

.cart-item-options {
    margin: 5px 0 !important;
    color: var(--coffee) !important;
    font-weight: 650;
}

.product-options-dialog {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(32, 24, 19, .56);
}

.product-options-panel {
    width: min(100%, 560px);
    max-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 22px 24px 18px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--card);
    box-shadow: 0 24px 70px rgba(32, 24, 19, .28);
}

.product-options-panel h2 {
    flex: 0 0 auto;
    margin: 0 0 14px;
    color: var(--coffee-dark);
    font-size: 23px;
}

#product-options-list {
    min-height: 0;
    overflow-y: auto;
    padding: 2px 4px 2px 0;
}

.product-option-group {
    margin: 0 0 12px;
    padding: 0;
    border: 0;
}

.product-option-group:last-child {
    margin-bottom: 4px;
}

.product-option-group legend {
    margin-bottom: 7px;
    color: #55483f;
    font-size: 14px;
    font-weight: 750;
}

.product-option-choice {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin: 0 6px 6px 0;
    padding: 7px 10px;
    border: 1px solid #dfd1c7;
    border-radius: 999px;
    background: #fff;
    cursor: pointer;
    line-height: 1.2;
    transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.product-option-choice:hover {
    border-color: #b99377;
    background: #faf6f2;
}

.product-option-choice:has(input:checked) {
    border-color: var(--coffee);
    background: var(--coffee-soft);
    box-shadow: inset 0 0 0 1px rgba(111, 78, 55, .12);
}

.product-option-choice input {
    margin: 0;
    accent-color: var(--coffee);
}

.product-options-error {
    flex: 0 0 auto;
    min-height: 18px;
    margin: 4px 0 8px;
    color: #9b3d32;
    font-size: 13px;
}

.product-options-actions {
    flex: 0 0 auto;
    display: flex;
    gap: 10px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
    background: var(--card);
}

.product-options-actions button {
    flex: 1;
}

@media (max-width: 600px) {
    .product-options-dialog {
        align-items: flex-end;
        padding: 10px;
    }

    .product-options-panel {
        width: 100%;
        max-height: 88vh;
        padding: 18px 14px 14px;
        border-radius: 16px 16px 12px 12px;
    }

    .product-options-panel h2 {
        margin-bottom: 12px;
        font-size: 21px;
    }

    .product-option-group {
        margin-bottom: 10px;
    }

    .product-option-choice {
        margin: 0 5px 5px 0;
        padding: 7px 9px;
        font-size: 14px;
    }
}
.menu-unavailable-reason, .cart-stale-warning, .checkout-feedback { color: #9b3d32; overflow-wrap: anywhere; }
.cart-stale-warning { margin: 6px 0; font-weight: 600; }
#order-notes { width: 100%; box-sizing: border-box; resize: vertical; }
.checkout-feedback:empty { display: none; }


/* v2.2.3: ordering stays primary; existing-order tracking sits below Menu. */
.menu-card {
    grid-area: menu;
}

.order-column {
    grid-area: order;
}

.tracking-panel {
    grid-area: track;
    box-shadow: none;
    background: rgba(255,255,255,.72);
}

.tracking-panel > summary {
    min-height: 42px;
    padding-top: 8px;
    padding-bottom: 8px;
}

@media (max-width: 780px) {
    .page {
        grid-template-areas:
            "menu"
            "order"
            "track";
    }
}
