:root {
    --bg-cream: #f6efe2;
    --bg-card: #fffdf9;
    --brown-dark: #432010;
    --brown-med: #6e3b1e;
    --border-gold: #8c6239;
    --amber-accent: #e07a1b;
    --green-pay: #216e39;
    --red-danger: #b91c1c;
    --gray-delivered: #e2e0dc;
    --text-delivered: #96928b;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-cream);
    color: var(--brown-dark);
    font-family: 'Montserrat', sans-serif;
    padding-top: 74px;
    padding-bottom: 110px;
    overflow-x: hidden;
}

/* TOPO COM MENU 3 LINHAS E LOGO PEQUENA CENTRALIZADA */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 68px;
    background: var(--bg-cream);
    border-bottom: 3px double var(--border-gold);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(67, 32, 16, 0.12);
}

.menu-btn {
    width: 44px;
    height: 44px;
    background: #fff8ec;
    border: 2px solid var(--brown-dark);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    cursor: pointer;
}

.menu-btn span {
    display: block;
    width: 22px;
    height: 3px;
    background-color: var(--brown-dark);
    border-radius: 2px;
}

.header-logo-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.header-logo {
    max-height: 54px;
    width: auto;
    object-fit: contain;
}

.fallback-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 26px;
    color: var(--brown-dark);
    letter-spacing: 1.5px;
}

.header-spacer {
    width: 44px;
}

/* MENU LATERAL EXPANDÍVEL DA ESQUERDA PARA O CENTRO */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.48);
    z-index: 1100;
    display: none;
}

.sidebar-overlay.show {
    display: block;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 76%;
    max-width: 290px;
    background: var(--bg-cream);
    border-right: 4px solid var(--border-gold);
    z-index: 1200;
    transform: translateX(-105%);
    transition: transform 0.25s ease-in-out;
    display: flex;
    flex-direction: column;
    box-shadow: 6px 0 20px rgba(0,0,0,0.3);
}

.sidebar.open {
    transform: translateX(0);
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px;
    border-bottom: 2px solid var(--border-gold);
    background: #ede1cd;
}

.sidebar-header h3 {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 26px;
    letter-spacing: 1px;
}

.close-sidebar {
    background: none;
    border: none;
    font-size: 22px;
    font-weight: bold;
    color: var(--brown-dark);
    cursor: pointer;
}

.sidebar-links {
    list-style: none;
    padding: 8px 0;
}

.sidebar-links li {
    padding: 16px 20px;
    font-size: 16px;
    font-weight: 700;
    border-bottom: 1px dashed rgba(140, 98, 57, 0.35);
    cursor: pointer;
}

.sidebar-links li:active {
    background: #e5d5bc;
}

.gestao-highlight {
    background: rgba(224, 122, 27, 0.16);
    color: var(--brown-dark);
}

/* MOLDURA E ESTRUTURA DE TELAS */
.app-content {
    max-width: 760px;
    margin: 0 auto;
    padding: 10px 12px;
}

.view {
    display: none;
}

.view.active {
    display: block;
}

.rustic-frame {
    background: var(--bg-card);
    border: 2px solid var(--border-gold);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 4px 12px rgba(67, 32, 16, 0.06);
}

.section-main-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 28px;
    color: var(--brown-dark);
    text-align: center;
    letter-spacing: 1.5px;
    margin-bottom: 6px;
}

.subtitle-hint {
    font-size: 12.5px;
    color: var(--brown-med);
    text-align: center;
    margin-bottom: 14px;
    line-height: 1.4;
}

.sub-heading {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 22px;
    color: var(--brown-dark);
    border-bottom: 2px solid var(--border-gold);
    padding-bottom: 4px;
    margin: 14px 0 10px;
    letter-spacing: 1px;
}

/* PAINEL CENTRAL DE GESTÃO */
.centered-hub {
    min-height: 68vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.hub-buttons {
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 15px;
}

.hub-big-btn {
    background: linear-gradient(135deg, #fffdf9, #f3e6d0);
    border: 2px solid var(--brown-dark);
    border-radius: 12px;
    padding: 20px 16px;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 24px;
    color: var(--brown-dark);
    letter-spacing: 1px;
    cursor: pointer;
    box-shadow: 0 4px 0 var(--brown-dark);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.hub-big-btn small {
    font-family: 'Montserrat', sans-serif;
    font-size: 12px;
    font-weight: 600;
    color: var(--brown-med);
}

/* FORMULÁRIOS E BOTÕES */
.form-card {
    background: #f9f3e8;
    border: 1.5px solid var(--border-gold);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 14px;
}

.input-group {
    margin-bottom: 10px;
}

.input-group label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--brown-dark);
}

input[type="text"],
input[type="tel"],
input[type="number"],
input[type="date"] {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid var(--border-gold);
    border-radius: 8px;
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    background: #fff;
    color: var(--brown-dark);
    font-weight: 600;
}

.input-with-mic {
    display: flex;
    gap: 6px;
}

.mic-btn {
    min-width: 44px;
    border: 1.5px solid var(--brown-dark);
    background: #f5d7b0;
    border-radius: 8px;
    font-size: 18px;
    cursor: pointer;
}

.mic-btn.listening {
    background: var(--red-danger);
    color: #fff;
}

.form-row-2 {
    display: flex;
    gap: 10px;
}

.form-row-2 > .input-group {
    flex: 1;
}

.mesa-num-group {
    max-width: 110px;
}

.register-prompt {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--border-gold);
    display: flex;
    align-items: center;
    gap: 10px;
}

.badge-ok {
    font-size: 12.5px;
    font-weight: 800;
    color: var(--green-pay);
}

.btn-primary, .btn-secondary, .btn-gold, .btn-success {
    border: none;
    border-radius: 8px;
    padding: 11px 16px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 800;
    font-size: 13.5px;
    cursor: pointer;
    text-transform: uppercase;
}

.btn-primary { background: var(--brown-dark); color: #fff; }
.btn-gold { background: var(--amber-accent); color: #fff; }
.btn-secondary { background: #e5d7c3; color: var(--brown-dark); border: 1px solid var(--border-gold); }
.btn-success { background: var(--green-pay); color: #fff; }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 12px; font-size: 12px; }
.btn-row { display: flex; gap: 8px; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }

/* CARDÁPIO ESCRITO E QR CODE */
.menu-cat-block { margin-bottom: 18px; }
.menu-cat-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 24px;
    color: var(--brown-dark);
    text-align: center;
    letter-spacing: 1.5px;
    border-bottom: 2px solid var(--border-gold);
    margin-bottom: 8px;
}
.menu-line-item { margin-bottom: 10px; }
.menu-line-top { display: flex; align-items: baseline; font-weight: 800; font-size: 15px; }
.menu-dots { flex: 1; border-bottom: 2px dotted var(--border-gold); margin: 0 6px; }
.menu-line-desc { font-size: 12px; color: var(--brown-med); margin-top: 2px; }

.qrcode-box {
    margin-top: 24px;
    border: 2px dashed var(--border-gold);
    border-radius: 10px;
    padding: 16px;
    text-align: center;
    background: #faf3e6;
}
.qrcode-placeholder {
    width: 160px;
    height: 160px;
    margin: 10px auto;
    border: 2px solid var(--brown-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    padding: 10px;
    background: #fff;
}

/* SELETOR DE PRODUTOS NA MESA (+ e -) */
.mesa-prod-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 9px 10px;
    background: #fff;
    border: 1px solid #e2d2b8;
    border-radius: 8px;
    margin-bottom: 7px;
}
.mesa-prod-info strong { display: block; font-size: 14px; }
.mesa-prod-info span { font-size: 12.5px; color: var(--brown-med); font-weight: 700; }

.qty-controls { display: flex; align-items: center; gap: 8px; }
.qty-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1.5px solid var(--brown-dark);
    background: #f5e6cf;
    font-size: 19px;
    font-weight: 800;
    color: var(--brown-dark);
    cursor: pointer;
}
.qty-val { min-width: 24px; text-align: center; font-weight: 800; font-size: 15px; }

.confirm-order-bar {
    position: sticky;
    bottom: 8px;
    background: #fff8ec;
    border: 2px solid var(--brown-dark);
    border-radius: 10px;
    padding: 10px;
    margin-top: 14px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.18);
}
.draft-summary { font-size: 13px; font-weight: 700; margin-bottom: 8px; text-align: center; }

/* PEDIDO 1, PEDIDO 2 E DESCONTOS */
.order-accordion {
    border: 2px solid var(--border-gold);
    border-radius: 9px;
    margin-bottom: 10px;
    overflow: hidden;
    background: #fff;
}
.order-acc-header {
    width: 100%;
    background: #f3e5ce;
    padding: 12px 14px;
    font-weight: 800;
    font-size: 14.5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    border: none;
    color: var(--brown-dark);
}
.order-acc-body { padding: 12px; border-top: 1px solid var(--border-gold); display: none; }
.order-acc-body.open { display: block; }
.pay-box { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border-gold); }
.discount-check-label { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 700; margin: 8px 0; cursor: pointer; }
.realtime-discount-preview { font-size: 14px; font-weight: 800; color: var(--green-pay); margin: 6px 0; }
.pay-all-card { margin-top: 18px; background: #f9edd8; border: 2.5px solid var(--brown-dark); border-radius: 10px; padding: 14px; }

/* FILA DE PEDIDOS (TACHAR UNIDADES E FICAR CINZA CLARO) */
.kitchen-ticket {
    background: #fff;
    border: 2px solid var(--brown-dark);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 12px;
}
.kitchen-ticket.all-delivered {
    background: var(--gray-delivered);
    border-color: #c2bfb8;
    color: var(--text-delivered);
    opacity: 0.72;
}
.ticket-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 800;
    font-size: 15.5px;
    border-bottom: 1px dashed var(--border-gold);
    padding-bottom: 6px;
    margin-bottom: 8px;
}
.unit-items-list { display: flex; flex-wrap: wrap; gap: 8px; }
.unit-pill {
    padding: 8px 13px;
    border-radius: 20px;
    border: 1.5px solid var(--brown-dark);
    background: #fdf5e6;
    font-weight: 700;
    font-size: 13.5px;
    cursor: pointer;
    user-select: none;
}
.unit-pill.delivered {
    text-decoration: line-through;
    opacity: 0.55;
    background: #dcd9d2;
    border-color: #888;
}

/* ORGANIZAR CARDÁPIO (BOTÃO + NA FRENTE E ARRASTAR) */
.cat-card {
    background: #fcf6eb;
    border: 2px solid var(--border-gold);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 12px;
}
.cat-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.cat-plus-btn {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    border: 1.5px solid var(--brown-dark);
    background: var(--amber-accent);
    color: #fff;
    font-weight: 800;
    font-size: 18px;
    cursor: pointer;
    margin-right: 6px;
}
.drag-handle { cursor: grab; font-size: 20px; padding: 2px 8px; color: var(--brown-med); touch-action: none; }
.cat-prods-sortable { min-height: 24px; }
.sortable-prod-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    border: 1px solid #dcc7a6;
    border-radius: 6px;
    padding: 8px 10px;
    margin-bottom: 6px;
    font-weight: 700;
    font-size: 13.5px;
}

/* CARDS E MODAL */
.item-card { background: #fff; border: 1.5px solid var(--border-gold); border-radius: 9px; padding: 12px; margin-bottom: 10px; }
.stats-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat-box { background: #fff; border: 1.5px solid var(--border-gold); border-radius: 8px; padding: 10px; text-align: center; }
.stat-box span { display: block; font-size: 11.5px; color: var(--brown-med); }
.stat-box strong { font-size: 18px; color: var(--brown-dark); }

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 1500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.modal-box { width: 100%; max-width: 440px; max-height: 82vh; overflow-y: auto; }
.checklist-item { display: flex; align-items: center; gap: 10px; padding: 9px; border-bottom: 1px solid #eee; font-weight: 700; font-size: 14px; }

/* BOTÕES FLUTUANTES FIXOS */
.fab-left, .fab-right {
    position: fixed;
    bottom: 16px;
    width: 68px;
    height: 68px;
    border-radius: 50%;
    border: 2.5px solid #fff;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1050;
    color: #fff;
}
.fab-left { left: 16px; background: linear-gradient(135deg, var(--amber-accent), var(--brown-dark)); }
.fab-right { right: 16px; background: linear-gradient(135deg, var(--brown-med), var(--brown-dark)); }
.fab-top-label { font-size: 10px; font-weight: 800; text-transform: uppercase; line-height: 1; margin-bottom: 2px; }
.fab-plus { font-size: 28px; font-weight: 800; line-height: 1; }
.fab-icon { font-size: 22px; line-height: 1; }
.fab-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--red-danger);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    min-width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
}