/* =====================================================================
   PEDIDO — carrinho, resumo, pagamento PIX, sucesso e acompanhamento
   ===================================================================== */

.order-flow {
    width: 100%;
    max-width: var(--frame);
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0 auto;
    padding: 0 16px calc(150px + env(safe-area-inset-bottom));
    background: var(--bg);
}

/* Header (grid de 3 colunas: ação esquerda | título | ação direita) */
.order-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: 44px 1fr 44px;
    align-items: center;
    gap: 10px;
    margin: 0 -16px 16px;
    padding: max(16px, env(safe-area-inset-top)) 16px 16px;
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
    color: #fff;
    border-radius: 0 0 20px 20px;
    box-shadow: var(--shadow-md);
}
.order-title { text-align: center; min-width: 0; }
.order-title .restaurant-name { font-size: 1.05rem; font-weight: 800; letter-spacing: .02em; }

.order-header-space { width: 44px; height: 44px; }

.order-trash {
    display: grid; place-items: center; justify-self: end;
    width: 44px; height: 44px; border: 0; border-radius: var(--r-pill);
    background: rgba(255, 255, 255, .16); color: #fff; font-size: 1.2rem; cursor: pointer;
    transition: background .12s ease, transform .12s ease;
}
.order-trash:hover { background: rgba(255, 255, 255, .3); }

.order-back {
    display: grid; place-items: center; justify-self: start;
    width: 44px; height: 44px; border: 0; border-radius: var(--r-pill);
    background: #fff; color: var(--brand); font-size: 1.6rem; font-weight: 800; line-height: 1; cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .18);
    transition: background .12s ease, transform .12s ease;
}
.order-back:hover { background: var(--brand-soft); }
.order-back:active, .order-trash:active { transform: scale(.9); }

/* Footer fixo com botão de ação (não colado nas bordas) */
.order-footer {
    position: fixed;
    z-index: 30;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: min(100vw, var(--frame));
    padding: 12px 16px max(16px, calc(12px + env(safe-area-inset-bottom)));
    background: linear-gradient(180deg, rgba(244, 245, 247, 0) 0%, var(--bg) 28%);
}
.footer-btn {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    width: 100%; min-height: 56px; padding: 0 22px;
    border: 0; border-radius: var(--r-md);
    background: var(--brand); color: #fff; font-size: 1rem; font-weight: 800; cursor: pointer;
    box-shadow: 0 10px 26px rgba(134, 31, 43, .22);
    transition: background .12s ease, transform .12s ease;
}
.footer-btn:hover { background: var(--brand-dark); }
.footer-btn:active { transform: scale(.99); }
.footer-btn span { font-size: 1.05rem; font-weight: 800; }

/* Botão de footer com um único texto (centralizado) */
.footer-btn-single { justify-content: center; }

/* Label do botão de carrinho com contador */
.footer-btn-label { display: inline-flex; align-items: center; gap: 10px; }
.footer-btn-count {
    display: inline-grid; place-items: center;
    min-width: 24px; height: 24px; padding: 0 7px;
    border-radius: var(--r-pill); background: #fff; color: var(--brand);
    font-size: .8rem; font-weight: 800; font-style: normal;
}

/* Cart item list */
.order-items {
    display: flex; flex-direction: column;
    padding: 6px 14px; margin-top: 4px;
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--r-md); box-shadow: var(--shadow-sm);
    max-height: calc(100dvh - 245px); overflow-y: auto;
    overscroll-behavior: contain;
}
.order-item {
    display: grid; grid-template-columns: 52px 1fr auto; align-items: center; gap: 12px;
    min-height: 76px; padding: 12px 0; border-bottom: 1px solid var(--line);
}
.order-item:last-child { border-bottom: 0; }
.order-item-thumb {
    display: grid; place-items: center; width: 52px; height: 52px;
    border-radius: var(--r-sm); background: var(--brand-soft); color: var(--brand); font-size: 1.4rem;
    overflow: hidden;
}
.order-item-thumb img {
    width: 100%; height: 100%; object-fit: cover; display: block;
}
.order-item-info { min-width: 0; }
.order-item .produto-nome { font-size: .92rem; font-weight: 800; color: var(--ink); }
.order-item small { color: var(--muted); font-size: .74rem; }
.order-item-actions { display: flex; align-items: center; }
.order-quantity {
    display: flex; align-items: center; gap: 10px;
    padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--r-pill); background: var(--surface-2);
}
.order-quantity button {
    display: grid; place-items: center;
    width: 26px; height: 26px; border: 0; border-radius: 50%;
    background: var(--brand-soft); color: var(--brand); font-size: 1.1rem; line-height: 1; cursor: pointer;
}
.order-quantity button:hover { background: var(--brand); color: #fff; }
.order-quantity strong { min-width: 18px; text-align: center; font-size: .9rem; }

/* Totals */
.order-summary {
    margin-top: 12px; padding: 16px;
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--r-md); box-shadow: var(--shadow-sm);
}
.order-summary > div { display: flex; justify-content: space-between; align-items: center; font-size: .9rem; color: var(--ink-2); }
.order-summary > div:not(:last-child) { margin-bottom: 10px; }
.order-total { padding-top: 12px; border-top: 1px dashed var(--line); font-size: 1.1rem; font-weight: 800; color: var(--ink); }
.order-total strong { color: var(--brand); font-size: 1.25rem; }

.wide {
    width: 100%; min-height: 56px; margin-top: 16px;
    border: 0; border-radius: var(--r-md); background: var(--brand); color: #fff;
    font-size: 1rem; font-weight: 800; cursor: pointer; box-shadow: 0 8px 20px rgba(134, 31, 43, .22);
    transition: background .12s ease;
}
.wide:hover { background: var(--brand-dark); }

.state-card {
    max-width: var(--frame); margin: 40px auto; padding: 32px 24px; text-align: center;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-md);
}
.state-card h2 { margin-bottom: 10px; font-size: 1.3rem; }
.state-card p { color: var(--muted); line-height: 1.6; margin-bottom: 8px; }
.state-card .btn-adicionar {
    margin-top: 12px; min-height: 50px; padding: 0 24px; border: 0; border-radius: var(--r-md);
    background: var(--brand); color: #fff; font-weight: 700; cursor: pointer;
}

/* Tela de carrinho vazio com redirecionamento automático */
.empty-cart { padding: 40px 24px; }
.empty-cart-icon {
    display: grid; place-items: center; width: 82px; height: 82px; margin: 0 auto 18px;
    border-radius: 50%; background: var(--brand-soft); font-size: 2.2rem;
}
.empty-cart h2 { font-size: 1.35rem; margin-bottom: 8px; }
.empty-cart p { color: var(--muted); line-height: 1.6; }
.empty-cart-redirect {
    display: inline-flex; align-items: center; gap: 10px;
    margin-top: 20px; padding: 12px 18px; border-radius: var(--r-pill);
    background: var(--surface-2); border: 1px solid var(--line);
    color: var(--ink-2); font-size: .9rem; font-weight: 600;
}
.empty-cart-redirect .spinner { width: 22px; height: 22px; border-width: 3px; margin: 0; }
.empty-cart-redirect strong { color: var(--brand); font-size: 1.05rem; }

/* Inline notices inside the order flow */
.order-flow .produto-card {
    margin: 16px auto; padding: 20px; text-align: center;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-sm);
}
.order-flow .produto-card .produto-nome { font-weight: 800; }
.order-flow .produto-card .produto-preco { color: var(--brand); font-weight: 800; margin-top: 6px; }

/* ---------------- Resumo do pedido ---------------- */
.summary-screen {
    width: min(100%, 760px);
    margin: 0 auto;
    padding-top: 4px;
}
.summary-order-items { max-height: calc(100dvh - 245px); }
.summary-order-item { grid-template-columns: 52px 1fr auto; }
.summary-order-subtotal { color: var(--brand); white-space: nowrap; font-size: .92rem; }
.cart-footer, .summary-footer, .receipt-footer { display: flex; flex-direction: column; gap: 8px; }
.cart-footer-total, .summary-footer-total, .receipt-footer-total {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 0 4px; color: var(--ink-2); font-size: .9rem; font-weight: 700;
}
.cart-footer-total strong, .summary-footer-total strong, .receipt-footer-total strong { color: var(--brand); font-size: 1.15rem; }
.summary-confirm, .summary-back {
    width: 100%; min-height: 54px; border: 0; border-radius: var(--r-md); font-size: .95rem; font-weight: 800; cursor: pointer;
    transition: background .12s ease;
}
.summary-confirm { background: var(--brand); color: #fff; box-shadow: 0 8px 20px rgba(134,31,43,.22); }
.summary-confirm:hover { background: var(--brand-dark); }
.summary-back { margin-top: 10px; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }

/* ---------------- Pagamento PIX ---------------- */
.payment-screen {
    width: min(100%, 760px);
    margin: 0 auto;
    padding-top: 18px;
    text-align: center;
}
.payment-title { margin-bottom: 8px; }
.payment-title .step-label { color: var(--muted); font-size: .72rem; font-weight: 800; letter-spacing: .1em; }
.payment-title h2 { margin: 8px 0 4px; font-size: 1.3rem; font-weight: 800; }
.payment-title p { color: var(--muted); font-size: .84rem; }

.payment-box {
    display: flex; flex-direction: column; align-items: stretch; gap: 16px;
    max-width: 540px; margin: 22px auto 0; padding: 24px;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-md);
}
.pix-qr { display: flex; justify-content: center; align-items: center; }
.pix-qr img {
    width: 200px; height: 200px; object-fit: contain; padding: 12px;
    background: #fff; border: 1px solid var(--line); border-radius: var(--r-md);
}
.pix-key {
    text-align: left; padding: 14px 16px; border-radius: var(--r-md);
    background: var(--surface-2); border: 1px solid var(--line); word-break: break-all; overflow-wrap: anywhere;
}
.pix-key strong { display: block; margin-bottom: 6px; font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.pix-key div { font-size: .85rem; font-weight: 600; }

.pix-footer { display: flex; flex-direction: column; gap: 14px; }
.pix-timer { display: flex; justify-content: space-between; align-items: center; font-size: .88rem; font-weight: 700; color: var(--ink-2); }
.pix-timer strong { color: var(--brand); font-size: 1.05rem; }
.pix-actions { display: flex; flex-direction: column; gap: 10px; }
.pix-actions .btn-adicionar {
    width: 100%; min-height: 52px; border: 0; border-radius: var(--r-md);
    background: var(--brand); color: #fff; font-weight: 800; cursor: pointer; box-shadow: 0 8px 20px rgba(134,31,43,.22);
}
.pix-actions .btn-adicionar:hover { background: var(--brand-dark); }
.pix-cancelar {
    width: 100%; min-height: 48px; border: 1px solid var(--line); border-radius: var(--r-md);
    background: var(--surface-2); color: var(--ink-2); font-weight: 700; cursor: pointer;
}
.payment-status { font-size: .85rem; color: var(--ink-2); }
.payment-status strong { color: var(--brand); }
.payment-note {
    padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-md);
    background: var(--surface-2); text-align: left; font-size: .78rem; color: var(--muted); line-height: 1.5;
}

/* ---------------- Sucesso ---------------- */
.success-screen {
    width: min(100%, 760px);
    min-height: calc(100dvh - 120px);
    margin: 0 auto;
    padding: 42px 16px 110px;
    text-align: center;
}
.balcao-success-screen {
    min-height: calc(100dvh - 120px);
    display: flex;
    flex-direction: column;
    overflow: visible;
    padding-bottom: 116px;
}
.balcao-success-screen .success-confetti,
.balcao-success-screen .success-icon,
.balcao-success-screen h2,
.balcao-success-screen > p,
.balcao-success-screen .order-details { flex: 0 0 auto; }
.balcao-success-screen .order-details {
    margin: 18px 0 18px;
}
.success-confetti { height: 28px; color: var(--accent); font-size: 1.3rem; letter-spacing: .16em; }
.success-icon {
    width: 82px; height: 82px; margin: 8px auto 22px; display: grid; place-items: center;
    border-radius: 50%; background: var(--success); color: #fff; font-size: 2.6rem;
    box-shadow: 0 12px 30px rgba(27, 166, 114, .35);
}
.success-screen h2 { margin: 8px 0; font-size: 1.5rem; font-weight: 800; }
.success-screen > p:not(.welcome-kicker) { color: var(--muted); font-size: .9rem; line-height: 1.6; }
.order-details {
    display: grid; gap: 14px; margin: 22px 0 24px; padding: 18px 16px;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-sm);
    text-align: left; font-size: .85rem; color: var(--muted);
}
.order-details span { display: flex; justify-content: space-between; }
.order-details strong { color: var(--ink); }

.balcao-receipt-wrap {
    display: flex;
    justify-content: center;
    margin: 8px 0 18px;
    overflow: visible;
}
.receipt-items-scroll {
    flex: 1 1 auto; min-height: 80px; max-height: none;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.balcao-success-screen .receipt-items-scroll {
    max-height: min(28dvh, 260px);
}
.receipt-footer { gap: 8px; }
.balcao-success-screen > .receipt-footer {
    position: fixed;
    left: 50%;
    right: auto;
    bottom: 0;
    z-index: 30;
    width: min(100vw, var(--frame));
    transform: translateX(-50%);
    box-sizing: border-box;
}

.balcao-receipt {
    position: relative;
    width: min(100%, 420px);
    max-height: 100%; min-height: 0;
    display: flex; flex-direction: column;
    padding: 18px 22px 20px;
    background: #f2f2f2;
    border-radius: 2px;
    box-shadow: 0 10px 18px rgba(0,0,0,.12);
    color: #111;
    border: 1px solid rgba(17,17,17,.08);
}

@media (max-height: 860px) {
    .balcao-success-screen {
        padding-top: 28px;
        padding-bottom: 104px;
    }

    .balcao-success-screen .success-icon {
        width: 72px;
        height: 72px;
        margin-bottom: 16px;
        font-size: 2.2rem;
    }

    .balcao-success-screen h2 {
        margin: 6px 0;
        font-size: 1.3rem;
    }

    .balcao-success-screen > p:not(.welcome-kicker) {
        font-size: .85rem;
        line-height: 1.45;
    }

    .balcao-success-screen .order-details {
        margin: 14px 0 14px;
        padding: 14px 14px;
    }

    .balcao-success-screen .receipt-items-scroll {
        max-height: min(24dvh, 220px);
    }
}

.balcao-receipt::before,
.balcao-receipt::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    height: 16px;
    background: repeating-linear-gradient(
        90deg,
        #f2f2f2 0,
        #f2f2f2 6px,
        transparent 6px,
        transparent 12px
    );
    opacity: 1;
}

.balcao-receipt::before { top: -8px; }
.balcao-receipt::after { bottom: -8px; }

.receipt-perforation {
    width: 100%;
    height: 10px;
    background: repeating-linear-gradient(
        90deg,
        transparent 0,
        transparent 8px,
        #f2f2f2 8px,
        #f2f2f2 12px
    );
    margin: 0 -22px 8px;
    position: relative;
}

.receipt-perforation.top,
.receipt-perforation.bottom {
    margin: 0 -22px 12px;
}

.receipt-title {
    text-align: center;
    font-size: 1.1rem;
    font-weight: 900;
    letter-spacing: .04em;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.receipt-perforation.middle {
    margin: 10px -22px 14px;
}

.receipt-subtitle {
    text-align: center;
    font-weight: 900;
    font-size: 1.1rem;
    letter-spacing: .06em;
    margin: 0 0 12px;
}

.receipt-meta {
    display: flex; justify-content: space-between; align-items: center;
    margin: 8px 0 14px;
    font-size: 0.9rem;
}

.receipt-head-row,
.receipt-item-row,
.receipt-total-line,
.receipt-total-row {
    display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px;
}

.receipt-head-row {
    margin-top: 10px;
    font-weight: 900;
    font-size: 1rem;
    border-bottom: 1px solid rgba(17,17,17,.5);
    padding-bottom: 4px;
}

.receipt-item-row {
    margin-top: 8px;
    font-size: 0.95rem;
}

.receipt-item-row strong,
.receipt-total-row strong {
    font-weight: 800;
}

.receipt-divider {
    height: 2px; margin: 12px 0 10px; border-top: 2px solid rgba(17,17,17,.7);
}

.receipt-total-line {
    margin-top: 8px;
    font-size: 0.9rem;
}

.receipt-total-row {
    margin-top: 6px;
    font-size: 1.05rem;
    font-weight: 900;
}

.receipt-total-row strong {
    font-size: 1.35rem;
}

.finishing-screen {
    min-height: calc(100dvh - 220px);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 12px; padding: 32px 20px; text-align: center;
}
.finishing-screen .spinner { width: 48px; height: 48px; border-width: 4px; }
.finishing-screen h2 { margin: 0; font-size: 1.35rem; }
.finishing-screen p { max-width: 280px; color: var(--muted); line-height: 1.5; }

/* ---------------- Acompanhamento ---------------- */
.tracking-screen { min-height: calc(100dvh - 120px); padding-top: 24px; padding-bottom: 128px; }
.tracking-heading { margin-bottom: 22px; text-align: center; }
.tracking-footer {
    position: fixed !important;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: min(100%, var(--frame));
    padding: 12px 16px max(16px, calc(12px + env(safe-area-inset-bottom)));
    background: linear-gradient(180deg, rgba(244, 245, 247, 0) 0%, var(--bg) 28%);
    z-index: 100;
}
.tracking-footer .footer-btn:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }
.tracking-heading .step-label { color: var(--muted); font-size: .72rem; font-weight: 800; letter-spacing: .1em; }
.tracking-heading h2 { margin: 8px 0; font-size: 1.4rem; font-weight: 800; }
.tracking-heading p { color: var(--muted); font-size: .85rem; }

.tracking-summary {
    display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; margin-bottom: 16px; padding: 18px 16px;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-sm);
    color: var(--muted); font-size: .85rem;
}
.tracking-summary strong, .tracking-summary b { color: var(--brand); }

.nfce-receipt {
    margin-top: 16px; padding: 18px 16px 14px; border: 1px solid #e6d9c7; border-radius: 14px;
    background: linear-gradient(180deg, #fffdf8 0%, #fffaf0 100%); box-shadow: 0 8px 18px rgba(20, 20, 24, .06);
    color: var(--ink);
}
.nfce-header {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px dashed #d9c9a5;
    font-size: .74rem; font-weight: 800; letter-spacing: .08em;
}
.nfce-header span { color: var(--ink); }
.nfce-header strong {
    padding: 4px 8px; border-radius: 999px; background: #f5e4b6; color: #6b4b11; font-size: .64rem;
}
.nfce-meta {
    display: grid; gap: 8px; font-size: .78rem; color: var(--muted);
}
.nfce-meta div {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.nfce-meta strong { color: var(--ink); }
.nfce-divider { height: 1px; margin: 12px 0; background: #e9dcc0; }
.nfce-body {
    margin: 0; white-space: pre-wrap; word-break: break-word; font-family: "Segoe UI", Tahoma, sans-serif;
    font-size: .76rem; line-height: 1.7; color: var(--ink);
}
.nfce-footer {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    margin-top: 8px; font-size: .76rem; color: var(--muted);
}
.nfce-footer strong { color: var(--brand); }

.tracking-timeline {
    margin-bottom: 20px; padding: 20px 18px;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-sm);
}
.tracking-step { position: relative; display: flex; gap: 14px; min-height: 60px; color: var(--muted); }
.tracking-step:not(:last-child)::after {
    content: ''; position: absolute; top: 26px; left: 11px; width: 2px; height: 42px; background: var(--line);
}
.tracking-step > span {
    position: relative; z-index: 1; display: grid; place-items: center;
    width: 24px; height: 24px; border-radius: 50%; background: var(--line); color: var(--muted); font-size: .7rem;
}
.tracking-step.done, .tracking-step.current { color: var(--ink); }
.tracking-step.done > span { background: var(--success); color: #fff; }
.tracking-step.current > span { background: var(--brand); color: #fff; }
.tracking-step div { display: flex; flex-direction: column; gap: 3px; }
.tracking-step strong { font-size: .92rem; }
.tracking-step small { color: var(--muted); font-size: .76rem; }

/* ==============================
   Modal de confirmação de saída
================================*/
.confirm-overlay,
.confirm-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1300;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(15, 15, 20, .64);
    backdrop-filter: blur(5px);
    animation: fade-in .2s ease both;
}
.confirm-dialog {
    width: min(100%, 380px);
    padding: 30px 24px 24px;
    background: var(--surface);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
    text-align: center;
    animation: pop-in .28s cubic-bezier(.34, 1.56, .64, 1) both;
}
.confirm-icon {
    width: 62px; height: 62px; margin: 0 auto 14px;
    display: grid; place-items: center;
    border-radius: 50%; background: #fff4d6; font-size: 1.8rem;
}
.confirm-dialog h3 { font-size: 1.25rem; font-weight: 800; margin-bottom: 12px; color: var(--ink); }
.confirm-dialog p { color: var(--ink-2); font-size: .9rem; line-height: 1.55; margin-bottom: 10px; }
.confirm-dialog p strong { color: var(--brand); }
.confirm-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.confirm-no, .confirm-yes {
    width: 100%; min-height: 50px; border: 0; border-radius: var(--r-md);
    font-size: .95rem; font-weight: 800; cursor: pointer; transition: background .12s ease, transform .1s ease;
}
.confirm-no { background: var(--brand); color: #fff; box-shadow: 0 8px 20px rgba(134, 31, 43, .22); }
.confirm-no:hover { background: var(--brand-dark); }
.confirm-yes { background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
.confirm-yes:hover { background: #eaeaee; }
.confirm-no:active, .confirm-yes:active { transform: scale(.98); }

@media (min-width: 768px) {
    .order-flow { padding-left: 28px; padding-right: 28px; }
    .order-header { margin-left: -28px; margin-right: -28px; padding-left: 28px; padding-right: 28px; }
    .order-items { width: min(100%, 760px); margin-left: auto; margin-right: auto; }
    .payment-box {
        max-width: 680px;
        display: grid;
        grid-template-columns: 250px 1fr;
        align-items: center;
        gap: 22px 30px;
    }
    .payment-box .pix-qr { grid-row: span 3; }
    .payment-box .pix-footer,
    .payment-box .payment-status,
    .payment-box .payment-note { grid-column: 2; }
    .success-screen:not(.balcao-success-screen) { padding-top: 68px; }
}

@media (max-width: 420px) {
    .order-item { grid-template-columns: 44px 1fr auto; gap: 9px; }
    .order-item-thumb { width: 44px; height: 44px; }
    .order-quantity { gap: 5px; padding: 5px; }
    .order-quantity button { width: 24px; height: 24px; }
    .payment-box { padding: 18px; }
    .pix-qr img { width: 180px; height: 180px; }
}

@media (min-width: 768px) {
    .order-flow { max-width: 1120px; }
    .order-footer { width: min(100vw, 1120px); }
}

/* =====================================================================
   QR SCANNER — overlay de confirmação de mesa
   ===================================================================== */
.qr-scanner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99999;
    display: grid;
    place-items: center;
    background: rgba(0, 0, 0, .92);
    padding: 16px;
}
.qr-scanner-container {
    width: 100%;
    max-width: 380px;
    background: var(--bg, #f4f5f7);
    border-radius: var(--r-md, 16px);
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}
.qr-scanner-header {
    text-align: center;
}
.qr-scanner-header h2 {
    margin: 0 0 6px;
    font-size: 1.3rem;
}
.qr-scanner-header p {
    margin: 0;
    color: var(--muted, #6b7280);
    font-size: .9rem;
    line-height: 1.4;
}
.qr-scanner-view {
    width: 100%;
    min-height: 280px;
    border-radius: 12px;
    overflow: hidden;
}
.qr-scanner-error {
    text-align: center;
    padding: 20px;
}
.qr-scanner-error p {
    color: var(--brand, #e11b22);
    font-weight: 600;
    margin-bottom: 12px;
}

/* A confirmação do pedido independe da impressão do recibo. */
.receipt-print-status {
    flex: 0 0 auto;
    margin: 16px 0 12px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    background: var(--surface);
    text-align: left;
}
.receipt-print-status strong { display: block; color: var(--ink-2); font-size: .95rem; }
.receipt-print-status p { margin: 8px 0 0; color: var(--muted); font-size: .88rem; line-height: 1.5; }
.receipt-print-retry {
    min-height: 44px;
    margin-top: 12px;
    padding: 10px 14px;
    border: 1px solid var(--brand);
    border-radius: var(--r-md);
    background: var(--surface);
    color: var(--brand);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}
.receipt-print-retry:disabled { opacity: .6; cursor: wait; }