:root {
    --bg: #eef6fb;
    --surface: rgba(255,255,255,0.95);
    --line: #d9e7f1;
    --text: #17344c;
    --muted: #64829a;
    --primary: #0f5fa8;
    --primary-2: #0284c7;
    --success: #16a34a;
    --shadow: 0 18px 40px rgba(15, 95, 168, 0.12);
}

*,
*::before,
*::after { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(2, 132, 199, 0.18), transparent 24%),
        radial-gradient(circle at bottom right, rgba(15, 118, 110, 0.14), transparent 24%),
        linear-gradient(180deg, #fbfdff, #eef6fb, #dbeefe);
}

.container { max-width: 1380px; margin: 0 auto; padding: 24px 18px 40px; }

.live-notice {
    position: sticky;
    top: 0;
    z-index: 30;
    padding: 12px 16px;
    background: #fff4ce;
    color: #8a5b05;
    border-bottom: 1px solid #f6d77b;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    font-weight: 700;
}

.page-header,
.panel {
    background: var(--surface);
    border: 1px solid rgba(15, 95, 168, 0.12);
    box-shadow: var(--shadow);
    border-radius: 28px;
}

.page-header {
    padding: 24px;
    margin-bottom: 22px;
    background: linear-gradient(135deg, rgba(15, 95, 168, 0.95), rgba(2, 132, 199, 0.92));
    color: #f4fbff;
}

.page-header h1 { margin: 0 0 8px; font-size: clamp(2rem, 4vw, 3rem); }
.page-header p { margin: 0; max-width: 620px; line-height: 1.6; }

.nav-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.nav-links a {
    text-decoration: none;
    color: #fff;
    padding: 11px 14px;
    border-radius: 14px;
    background: rgba(255,255,255,0.14);
    border: 1px solid rgba(255,255,255,0.2);
    font-weight: 700;
}

.panel { padding: 22px; margin-bottom: 20px; }
.panel h2, .panel h3 { margin-top: 0; margin-bottom: 16px; }

.panel-intro,
.draft-head,
.service-board-top,
.pedido-card-top,
.modal-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
}

.muted,
.draft-head p,
.service-board-top p,
.board-item p,
.pedido-card p,
.product-summary-card p { color: var(--muted); }

.draft-badge {
    padding: 10px 14px;
    border-radius: 999px;
    background: #ebf7ff;
    color: var(--primary);
    font-weight: 700;
}

.order-layout { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 18px; }
.order-layout.single-column { grid-template-columns: 1fr; }
.selector-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.category-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}
.category-chip {
    min-height: 58px;
    border-radius: 18px;
    border: 1px solid var(--line);
    padding: 12px 14px;
    background: linear-gradient(180deg, #fff, #f5faff);
    color: var(--text);
    cursor: pointer;
    font-weight: 800;
    text-align: left;
}
.category-chip.active {
    color: #fff;
    border-color: transparent;
    box-shadow: 0 14px 24px rgba(15, 95, 168, 0.16);
}
.category-chip.tone-platos.active { background: linear-gradient(135deg, #ea580c, #fb923c); }
.category-chip.tone-combos.active { background: linear-gradient(135deg, #4f46e5, #818cf8); }
.category-chip.tone-refrescos.active { background: linear-gradient(135deg, #0891b2, #22d3ee); }
.category-chip.tone-gaseosas.active { background: linear-gradient(135deg, #16a34a, #4ade80); }
.category-chip.tone-infusiones.active { background: linear-gradient(135deg, #c026d3, #f0abfc); }
.category-chip.tone-snacks.active { background: linear-gradient(135deg, #ca8a04, #fde047); color: #4a3300; }
.category-chip.tone-porciones.active { background: linear-gradient(135deg, #e11d48, #fda4af); }
.product-preview {
    min-height: 72px;
    padding: 14px 16px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: linear-gradient(180deg, #fff, #f8fbff);
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
}
.product-preview strong {
    font-size: 1.02rem;
}
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 700; }

select,
input[type="number"],
.picker-trigger,
button { font: inherit; }

select,
input[type="number"],
.picker-trigger {
    width: 100%;
    min-height: 54px;
    border-radius: 16px;
    border: 1px solid var(--line);
    padding: 0 16px;
    background: #fff;
    color: var(--text);
}

.picker-trigger {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.picker-label { color: var(--muted); font-weight: 700; }

.product-summary-card,
.draft-item,
.board-item,
.pedido-card,
.service-board {
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 22px;
}

.product-summary-card {
    padding: 16px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.product-summary-card.sin-stock {
    background: #fff1f2;
    border-color: #fecdd3;
}

.tone-default {
    background: linear-gradient(180deg, #ffffff, #f8fbff);
}

.tone-platos {
    background: linear-gradient(180deg, #fff7ed, #ffedd5);
    border-color: #fdba74;
}

.tone-combos {
    background: linear-gradient(180deg, #eef2ff, #e0e7ff);
    border-color: #a5b4fc;
}

.tone-refrescos {
    background: linear-gradient(180deg, #ecfeff, #cffafe);
    border-color: #67e8f9;
}

.tone-gaseosas {
    background: linear-gradient(180deg, #f0fdf4, #dcfce7);
    border-color: #86efac;
}

.tone-infusiones {
    background: linear-gradient(180deg, #fdf4ff, #fae8ff);
    border-color: #f0abfc;
}

.tone-snacks {
    background: linear-gradient(180deg, #fefce8, #fef9c3);
    border-color: #fde047;
}

.tone-porciones {
    background: linear-gradient(180deg, #fff1f2, #ffe4e6);
    border-color: #fda4af;
}

.product-summary-side { text-align: right; }
.qty-stepper { display: grid; grid-template-columns: 52px 1fr 52px; gap: 8px; }

.qty-btn,
#btnAgregar,
#btnLimpiar,
#btnEnviar,
.btn-servido,
.btn-delete,
.icon-btn,
.secondary {
    min-height: 52px;
    border-radius: 16px;
    border: none;
    cursor: pointer;
    font-weight: 800;
}

#btnAgregar,
#btnEnviar,
.btn-servido {
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    color: #fff;
}

#btnLimpiar,
.secondary,
.qty-btn,
.icon-btn {
    background: #ecf7ff;
    color: var(--primary);
    border: 1px solid #cfe7f8;
}

.actions-row { display: flex; flex-wrap: wrap; gap: 12px; }

.draft-panel {
    border-radius: 24px;
    padding: 18px;
    background: linear-gradient(180deg, #f6fbff, #ffffff);
    border: 1px solid var(--line);
}

.draft-total {
    padding: 10px 14px;
    border-radius: 16px;
    background: #eef7ff;
    color: var(--primary);
}

.draft-list { display: grid; gap: 12px; margin: 16px 0; }
.draft-item, .board-item {
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.draft-item p,
.draft-item small {
    display: none;
}

.draft-item-side,
.board-item-side {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.empty-state,
.empty-text {
    padding: 18px;
    border-radius: 18px;
    border: 1px dashed var(--line);
    background: #f9fcff;
    color: var(--muted);
    font-weight: 700;
}

.toggle-card {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 82px;
    padding: 14px 16px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: #fff;
    cursor: pointer;
}

.toggle-card.disabled { opacity: 0.55; }
.toggle-card input { width: 22px; height: 22px; }
.toggle-card small { display: block; color: var(--muted); margin-top: 4px; }

.mesa-takeout-card {
    border-color: rgba(245, 158, 11, 0.32);
    background: linear-gradient(135deg, #fff7ed, #fff);
}

.cards-grid,
.service-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.service-board,
.pedido-card { padding: 18px; }
.board-items { display: grid; gap: 10px; margin-top: 14px; }
.board-stats { display: flex; flex-wrap: wrap; gap: 8px; }

.status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    font-size: 0.88rem;
    font-weight: 700;
}

.status-pill.pendiente { background: #eff6ff; color: #1d4ed8; }
.status-pill.listo { background: #ecfccb; color: #3f6212; }
.status-pill.servido { background: #dcfce7; color: #166534; }
.status-pill.preparando { background: #fef3c7; color: #92400e; }

.modal { position: fixed; inset: 0; z-index: 40; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, 0.42); }
.modal-sheet {
    position: relative;
    max-width: 760px;
    margin: 5vh auto;
    padding: 20px;
    background: #fff;
    border-radius: 28px;
    box-shadow: 0 24px 50px rgba(15, 23, 42, 0.22);
}

.destino-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.destino-tab {
    min-height: 48px;
    border-radius: 16px;
    border: 1px solid #cfe7f8;
    background: #eef7ff;
    color: var(--primary);
    font-weight: 800;
    cursor: pointer;
}

.destino-tab.active,
.mesa-option.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    color: #fff;
    border-color: transparent;
}

.destino-panel-title {
    margin: 0 0 12px;
    color: var(--muted);
    font-weight: 700;
}

.mesa-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 12px;
}

.mesa-option {
    min-height: 64px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: linear-gradient(180deg, #fff, #f3faff);
    color: var(--text);
    cursor: pointer;
    font-weight: 800;
}

.mesa-option.takeout {
    background: linear-gradient(135deg, #fff7ed, #ffedd5);
    color: #9a3412;
}

.takeout-grid .mesa-option {
    min-height: 64px;
}

.product-modal-sheet {
    max-width: 840px;
    max-height: 84vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.product-picker-list {
    display: grid;
    gap: 18px;
    overflow-y: auto;
    padding-right: 6px;
    margin-top: 6px;
}

.product-family {
    display: grid;
    gap: 10px;
}

.product-family-title {
    margin: 0;
    color: var(--muted);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.85rem;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.product-option {
    min-height: 88px;
    padding: 14px 16px;
    border-radius: 20px;
    border: 1px solid var(--line);
    background: #fff;
    text-align: left;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.product-option strong {
    font-size: 1rem;
}

.product-option small {
    color: var(--muted);
    font-weight: 700;
}

.product-option.sin-stock {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(0.1);
}

.product-option.selected {
    box-shadow: 0 16px 26px rgba(15, 95, 168, 0.16);
    border-color: transparent;
}

.timer {
    display: inline-flex;
    padding: 6px 10px;
    border-radius: 999px;
    background: #ecf7ff;
    color: var(--primary);
    font-weight: 800;
}

@media (max-width: 900px) {
    .order-layout,
    .selector-grid { grid-template-columns: 1fr; }

    .category-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .cards-grid,
    .service-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .container { padding: 16px 12px 30px; }
    .page-header,
    .panel,
    .modal-sheet { padding: 16px; border-radius: 22px; }
    .panel-intro,
    .draft-head,
    .service-board-top,
    .pedido-card-top,
    .modal-head,
    .draft-item,
    .board-item { flex-direction: column; }
    .board-item-side,
    .draft-item-side { align-items: flex-start; }
    .actions-row { flex-direction: column; }
    .nav-links a { flex: 1 1 100%; text-align: center; }

    .page-header {
        position: sticky;
        top: 0;
        z-index: 20;
        backdrop-filter: blur(10px);
    }

    .nav-links {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 4px;
        margin-right: -4px;
    }

    .nav-links a {
        flex: 0 0 auto;
        min-width: max-content;
    }

    .picker-trigger,
    select,
    input[type="number"],
    #btnAgregar,
    #btnLimpiar,
    #btnEnviar,
    .btn-servido,
    .qty-btn,
    .mesa-option {
        min-height: 58px;
        font-size: 1rem;
    }

    .category-grid,
    .product-grid,
    .mesa-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .draft-panel {
        position: sticky;
        bottom: 12px;
        z-index: 15;
        box-shadow: 0 18px 32px rgba(15, 95, 168, 0.2);
    }

    .draft-head {
        position: sticky;
        top: 0;
        background: linear-gradient(180deg, #f6fbff, #ffffff);
        padding-bottom: 10px;
        margin-bottom: 8px;
        z-index: 2;
    }

    .draft-list {
        max-height: 36vh;
        overflow-y: auto;
        padding-right: 4px;
    }

    .service-board,
    .pedido-card,
    .draft-item,
    .board-item {
        border-radius: 20px;
    }

    .service-board-top p,
    .pedido-card p,
    .board-item p,
    .draft-item p,
    .draft-item small {
        font-size: 0.95rem;
    }

    .board-stats {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 4px;
    }

    .status-pill {
        flex: 0 0 auto;
    }

    .modal {
        display: flex;
        align-items: flex-end;
        justify-content: center;
    }

    .modal-sheet {
        width: 100%;
        margin: 0;
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
        max-height: 78vh;
        overflow-y: auto;
    }

    .mesa-option.takeout {
        grid-column: 1 / -1;
    }
}
