/* ============================================
   SISTEMA POS RINCON ALEMAN
   Diseno moderno, minimalista, mobile-first
   Colores: rojo aleman #CC0000, dorado #FFCE00
   ============================================ */

@charset "UTF-8";

/* ---------- CSS Custom Properties ---------- */
:root {
    /* Paleta principal - colores alemanes */
    --color-primary: #CC0000;
    --color-primary-light: #E83333;
    --color-primary-dark: #990000;
    --color-accent: #FFCE00;

    /* Fondos claros */
    --bg-main: #F8FAFC;
    --bg-card: #FFFFFF;
    --bg-card-hover: #F1F5F9;
    --bg-input: #F1F5F9;
    --bg-surface: #E2E8F0;

    /* Textos */
    --text-primary: #1A1008;
    --text-secondary: #5A5040;
    --text-muted: #8C8070;

    /* Estados de mesa */
    --color-libre: #1A9645;
    --color-libre-bg: rgba(26, 150, 69, 0.10);
    --color-ocupada: #D4820A;
    --color-ocupada-bg: rgba(212, 130, 10, 0.10);
    --color-por-pagar: #CC0000;
    --color-por-pagar-bg: rgba(204, 0, 0, 0.10);
    --color-reservada: #007BFF;
    --color-reservada-bg: rgba(0, 123, 255, 0.10);

    /* Bordes y sombras */
    --border-color: rgba(0, 0, 0, 0.06);
    --border-subtle: rgba(0, 0, 0, 0.03);
    --shadow-sm: 0 4px 10px rgba(0, 0, 0, 0.03);
    --shadow-md: 0 10px 25px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.08);
    --shadow-glow: 0 0 20px rgba(0, 0, 0, 0.05);

    /* Dimensiones */
    --radius-sm: 16px;
    --radius-md: 24px;
    --radius-lg: 32px;
    --radius-full: 50px;
    --navbar-height: 72px;
    --header-height: 64px;

    /* Transiciones */
    --transition-fast: 0.15s ease;
    --transition-base: 0.25s ease;
    --transition-slow: 0.4s cubic-bezier(0.16, 1, 0.3, 1);

    --bg-base: var(--bg-main);
    --accent: var(--color-primary);
    --border: var(--border-color);
    --text: var(--text-primary);
    --r-xl: var(--radius-lg);
    --r-lg: var(--radius-md);
    --r-md: var(--radius-sm);
    --mod-offline: #F59E0B;
    --mod-qr: #8B5CF6;
    --mod-division: #EC4899;
    --mod-propina: #F59E0B;
    --mod-ia: #7C3AED;
    --mod-puntos: #10B981;
    --mod-delivery: #FF441C;
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-tap-highlight-color: transparent;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    padding-bottom: calc(var(--navbar-height) + 16px);
    overflow-x: hidden;
    line-height: 1.5;
}

/* ---------- Ambient Background ---------- */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(ellipse at 30% 20%, rgba(204, 0, 0, 0.04) 0%, transparent 50%),
                radial-gradient(ellipse at 70% 80%, rgba(255, 206, 0, 0.04) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* ---------- Typography ---------- */
h1, h2, h3, h4 {
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }

/* ---------- Page Header ---------- */
.page-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(244, 241, 236, 0.90);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-subtle);
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: var(--header-height);
}

.page-header h1 {
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}

.page-header .logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.header-stats {
    display: flex;
    gap: 16px;
    font-size: 0.8rem;
}

.header-stat {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--text-secondary);
}

.header-stat .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.header-stat .dot.libre { background: var(--color-libre); }
.header-stat .dot.ocupada { background: var(--color-ocupada); }
.header-stat .dot.por-pagar { background: var(--color-por-pagar); }
.header-stat .dot.reservada { background: var(--color-reservada); }

/* ---------- Content Area ---------- */
.content {
    position: relative;
    z-index: 1;
    padding: 16px;
    max-width: 1400px;
    margin: 0 auto;
}

/* ---------- Cards ---------- */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    overflow: hidden;
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ---------- Mesas Stats Bar ---------- */
.mesas-stats-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 2px;
}
.mesas-stats-bar::-webkit-scrollbar { display: none; }

.stat-chip {
    flex: 1;
    min-width: 80px;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    text-align: center;
    border: 1px solid var(--border-subtle);
    background: var(--bg-card);
    transition: transform var(--transition-fast);
}
.stat-chip:active { transform: scale(0.97); }

.stat-chip.libre { 
    background: var(--color-libre-bg); 
    border-color: rgba(26, 150, 69, 0.2);
}
.stat-chip.ocupada { 
    background: var(--color-ocupada-bg); 
    border-color: rgba(212, 130, 10, 0.2);
}
.stat-chip.por-pagar { 
    background: var(--color-por-pagar-bg); 
    border-color: rgba(204, 0, 0, 0.2);
}
.stat-chip.reservada { 
    background: var(--color-reservada-bg); 
    border-color: rgba(0, 123, 255, 0.2);
}

.stat-chip-number {
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 4px;
}
.stat-chip.libre .stat-chip-number { color: var(--color-libre); }
.stat-chip.ocupada .stat-chip-number { color: var(--color-ocupada); }
.stat-chip.por-pagar .stat-chip-number { color: var(--color-por-pagar); }
.stat-chip.reservada .stat-chip-number { color: var(--color-reservada); }

.stat-chip-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

/* ---------- Mesa Grid ---------- */
.mesas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
    gap: 12px;
}

.mesa-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    padding: 0;
    cursor: pointer;
    transition: all var(--transition-base);
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    min-height: 140px;
    position: relative;
    overflow: hidden;
}

.mesa-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.mesa-card.libre::before { background: var(--color-libre); }
.mesa-card.ocupada::before { background: var(--color-ocupada); }
.mesa-card.por_pagar::before { background: var(--color-por-pagar); }
.mesa-card.reservada::before { background: var(--color-reservada); }

.mesa-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-color);
}

.mesa-card:active {
    transform: translateY(-1px);
    transition-duration: 0.05s;
}

.mesa-card.libre { background: var(--color-libre-bg); }
.mesa-card.ocupada { background: var(--color-ocupada-bg); }
.mesa-card.por_pagar { background: var(--color-por-pagar-bg); }
.mesa-card.reservada { background: var(--color-reservada-bg); }

/* Card Top: Number + Status */
.mesa-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 16px 8px 16px;
}

.mesa-numero {
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1;
}

.mesa-card.libre .mesa-numero { color: var(--color-libre); }
.mesa-card.ocupada .mesa-numero { color: var(--color-ocupada); }
.mesa-card.por_pagar .mesa-numero { color: var(--color-por-pagar); }
.mesa-card.reservada .mesa-numero { color: var(--color-reservada); }

.mesa-estado-pill {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    background: rgba(0, 0, 0, 0.06);
}

.mesa-card.libre .mesa-estado-pill { color: var(--color-libre); }
.mesa-card.ocupada .mesa-estado-pill { color: var(--color-ocupada); }
.mesa-card.por_pagar .mesa-estado-pill { color: var(--color-por-pagar); }
.mesa-card.reservada .mesa-estado-pill { color: var(--color-reservada); }

/* Card Body: Timer + Details */
.mesa-card-body {
    padding: 4px 16px 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    justify-content: flex-end;
}

.mesa-card-body-empty {
    display: flex;
    align-items: center;
    justify-content: center;
}

.mesa-timer {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}
.mesa-timer svg { opacity: 0.6; flex-shrink: 0; }
.mesa-timer.timer-caution { color: var(--color-ocupada); }
.mesa-timer.timer-caution svg { opacity: 1; }
.mesa-timer.timer-warning { color: var(--color-por-pagar); }
.mesa-timer.timer-warning svg { opacity: 1; }

.mesa-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.78rem;
}

.mesa-items-count {
    color: var(--text-muted);
    font-weight: 500;
}

.mesa-total {
    font-weight: 800;
    color: var(--text-primary);
    font-size: 0.88rem;
}

/* ---------- Pedido Layout ---------- */
.pedido-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

@media (min-width: 900px) {
    .pedido-layout {
        grid-template-columns: 1fr 380px;
        align-items: start;
    }
}

/* Categorias como tabs horizontales */
.categorias-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 10px 0;
    margin-bottom: 8px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.categorias-tabs::-webkit-scrollbar { display: none; }

.cat-tab {
    flex: 0 0 auto;
    padding: 10px 20px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-subtle);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}

.cat-tab:hover, .cat-tab.active {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
    box-shadow: 0 2px 10px rgba(204, 0, 0, 0.25);
}

/* Grilla de productos */
.productos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
}

.producto-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 16px 12px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.producto-card:hover {
    border-color: var(--color-primary);
    background: var(--bg-card-hover);
    box-shadow: var(--shadow-glow);
}

.producto-card:active {
    transform: scale(0.96);
    transition-duration: 0.05s;
}

.producto-card.added {
    animation: addPulse 0.3s ease;
}

@keyframes addPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); background: rgba(204, 0, 0, 0.10); }
    100% { transform: scale(1); }
}

.producto-nombre {
    font-weight: 600;
    font-size: 0.88rem;
    line-height: 1.3;
}

.producto-precio {
    color: var(--color-primary-dark);
    font-weight: 700;
    font-size: 1rem;
}

/* Resumen del pedido (sidebar) */
.pedido-resumen {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    position: sticky;
    top: calc(var(--header-height) + 16px);
    max-height: calc(100vh - var(--header-height) - var(--navbar-height) - 40px);
    display: flex;
    flex-direction: column;
}

.resumen-header {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.resumen-header h3 {
    display: flex;
    align-items: center;
    gap: 8px;
}

.item-count-badge {
    background: var(--color-primary);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    min-width: 24px;
    text-align: center;
}

.resumen-items {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
}

.resumen-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    transition: background var(--transition-fast);
}

.resumen-item:hover {
    background: var(--bg-card-hover);
}

.resumen-item-info {
    flex: 1;
    min-width: 0;
}

.resumen-item-nombre {
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.resumen-item-nota {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-style: italic;
}

.resumen-item-precio {
    font-weight: 700;
    font-size: 0.88rem;
    color: var(--color-primary-dark);
    white-space: nowrap;
}

/* Controles de cantidad */
.qty-controls {
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
}

.qty-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all var(--transition-fast);
}

.qty-btn:hover {
    background: rgba(204, 0, 0, 0.10);
    color: var(--color-primary);
}

.qty-btn.delete:hover {
    background: rgba(204, 0, 0, 0.15);
    color: var(--color-por-pagar);
}

.qty-value {
    width: 28px;
    text-align: center;
    font-weight: 700;
    font-size: 0.85rem;
}

/* Footer del resumen */
.resumen-footer {
    border-top: 1px solid var(--border-subtle);
    padding: 18px 20px;
}

.resumen-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.resumen-total-label {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.resumen-total-valor {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--color-primary-dark);
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    border-radius: var(--radius-md);
    border: none;
    font-family: inherit;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
    min-height: 48px;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: #fff;
    box-shadow: 0 4px 15px rgba(204, 0, 0, 0.25);
}

.btn-primary:hover {
    box-shadow: 0 6px 25px rgba(204, 0, 0, 0.38);
    transform: translateY(-1px);
}

.btn-danger {
    background: linear-gradient(135deg, #E74C3C, #C0392B);
    color: #fff;
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3);
}

.btn-danger:hover {
    box-shadow: 0 6px 25px rgba(231, 76, 60, 0.45);
}

.btn-success {
    background: linear-gradient(135deg, var(--color-libre), #27AE60);
    color: #fff;
    box-shadow: 0 4px 15px rgba(46, 204, 113, 0.3);
}

.btn-success:hover {
    box-shadow: 0 6px 25px rgba(46, 204, 113, 0.45);
}

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--border-color);
    color: var(--text-primary);
}

.btn-outline:hover {
    background: var(--bg-card-hover);
    border-color: var(--color-primary);
}

.btn-full { width: 100%; }

.btn-sm {
    padding: 8px 16px;
    font-size: 0.8rem;
    min-height: 36px;
    border-radius: var(--radius-sm);
}

.btn-icon {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: var(--radius-sm);
}

/* ---------- Bottom Navigation ---------- */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--navbar-height);
    background: rgba(244, 241, 236, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 200;
    padding: 0 8px;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    min-width: 64px;
}

.nav-item:hover, .nav-item.active {
    color: var(--color-primary);
}

.nav-item.active {
    background: rgba(204, 0, 0, 0.08);
}

.nav-item svg {
    width: 24px;
    height: 24px;
    stroke-width: 2;
}

/* ---------- Cocina View ---------- */
.cocina-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.cocina-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    overflow: hidden;
}

.cocina-card-header {
    padding: 14px 18px;
    background: var(--color-ocupada-bg);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cocina-mesa {
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--color-ocupada);
}

.cocina-tiempo {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.cocina-items {
    padding: 12px 18px;
}

.cocina-item {
    padding: 8px 0;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    gap: 10px;
}

.cocina-item:last-child { border-bottom: none; }

.cocina-item-qty {
    background: var(--color-primary);
    color: #fff;
    font-weight: 800;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.cocina-item-nombre {
    font-weight: 600;
    font-size: 0.9rem;
}

.cocina-item-nota {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
}

/* ---------- Inventario View ---------- */
.inventario-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.inventario-item {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    padding: 16px 20px;
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 16px;
    transition: all var(--transition-fast);
}

.inventario-item:hover {
    border-color: var(--border-color);
}

.inventario-item.stock-bajo {
    border-color: rgba(204, 0, 0, 0.4);
    background: rgba(204, 0, 0, 0.05);
}

.inventario-nombre {
    font-weight: 600;
}

.inventario-categoria {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.inventario-stock {
    text-align: center;
}

.stock-valor {
    font-size: 1.25rem;
    font-weight: 800;
}

.stock-bajo .stock-valor {
    color: var(--color-por-pagar);
}

.stock-unidad {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.stock-minimo {
    font-size: 0.68rem;
    color: var(--text-muted);
}

.inventario-actions {
    display: flex;
    gap: 6px;
}

/* ---------- Boleta View ---------- */
.boleta-container {
    max-width: 400px;
    margin: 0 auto;
    padding: 20px 0;
}

/* Todo el ticket en negro absoluto */
.boleta-ticket,
.boleta-ticket * {
    color: #000 !important;
}

.boleta-ticket {
    background: #fff;
    border-radius: var(--radius-md);
    padding: 28px 22px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.83rem;
    line-height: 1.65;
    box-shadow: var(--shadow-lg);
}

.boleta-header {
    text-align: center;
    border-bottom: 2px dashed #000;
    padding-bottom: 12px;
    margin-bottom: 12px;
}

.boleta-nombre-local {
    font-size: 1.25rem;
    font-weight: 900;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}

.boleta-propietario-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.74rem;
    font-weight: 700;
    margin-bottom: 2px;
    gap: 8px;
}

.boleta-empresa {
    font-size: 1.1rem;
    font-weight: 900;
    letter-spacing: 0.05em;
}

.boleta-detalle {
    font-size: 0.78rem;
    font-weight: 600;
}

.boleta-tipo {
    text-align: center;
    font-weight: 900;
    font-size: 1rem;
    margin: 10px 0;
    padding: 8px;
    border: 2px solid #000;
    border-radius: 4px;
}

.boleta-info {
    margin-bottom: 12px;
    font-size: 0.8rem;
    font-weight: 700;
}

.boleta-items-header {
    display: flex;
    justify-content: space-between;
    font-weight: 800;
    padding-bottom: 6px;
    border-bottom: 2px solid #000;
    margin-bottom: 6px;
    font-size: 0.75rem;
}

.boleta-item-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 3px 0;
    font-size: 0.79rem;
    font-weight: 600;
}

.boleta-item-row span:first-child { flex: 1; }

.boleta-totales {
    border-top: 2px dashed #000;
    margin-top: 12px;
    padding-top: 12px;
}

.boleta-total-row {
    display: flex;
    justify-content: space-between;
    padding: 2px 0;
    font-size: 0.83rem;
    font-weight: 700;
}

.boleta-total-row.total-final {
    font-weight: 900;
    font-size: 1.15rem;
    border-top: 2px solid #000;
    margin-top: 6px;
    padding-top: 8px;
}

.boleta-footer {
    text-align: center;
    border-top: 2px dashed #999;
    margin-top: 16px;
    padding-top: 14px;
    font-size: 0.8rem;
    color: #222;
    font-weight: 600;
}

.boleta-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.boleta-actions .btn {
    flex: 1;
}

/* ---------- Modal / Overlay ---------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 300;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    padding: 28px;
    width: 100%;
    max-width: 420px;
    max-height: 80vh;
    overflow-y: auto;
    animation: modalIn 0.3s var(--transition-slow);
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-title {
    font-size: 1.15rem;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ---------- Form Elements ---------- */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-input, .form-select {
    width: 100%;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    background: var(--bg-input);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    transition: border var(--transition-fast);
    min-height: 48px;
}

.form-input:focus, .form-select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(204, 0, 0, 0.12);
}

/* ---------- Toast Notifications ---------- */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 500;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 12px 18px;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow-md);
    animation: toastIn 0.3s ease, toastOut 0.3s ease 2.5s forwards;
    min-width: 200px;
    border-left: 3px solid var(--color-primary);
}

.toast.success { border-left-color: var(--color-libre); }
.toast.error { border-left-color: var(--color-por-pagar); }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
    from { opacity: 1; }
    to { opacity: 0; transform: translateY(-10px); }
}

/* ---------- Empty State ---------- */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 12px;
    opacity: 0.5;
}

.empty-state-text {
    font-size: 1rem;
    font-weight: 600;
}

/* ---------- Utilities ---------- */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.gap-8 { gap: 8px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.hidden { display: none !important; }

/* ---------- Section Title ---------- */
.section-title {
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 14px;
    padding-left: 4px;
}

/* ---------- Responsive ---------- */
@media (max-width: 600px) {
    .mesas-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 10px;
    }

    .mesa-card {
        min-height: 120px;
    }

    .mesa-card-top {
        padding: 12px 12px 6px 12px;
    }

    .mesa-card-body {
        padding: 4px 12px 10px 12px;
    }

    .mesa-numero {
        font-size: 1.5rem;
    }

    .stat-chip-number {
        font-size: 1.4rem;
    }

    .productos-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }

    .page-header {
        padding: 10px 14px;
    }

    .content {
        padding: 12px;
    }

    .inventario-item {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .inventario-actions {
        justify-content: flex-end;
    }
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar {
    width: 5px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary);
}

/* ---------- Print Styles — Papel térmico 72mm ---------- */
@media print {
    @page {
        size: 72mm auto;
        margin: 2mm 1mm;
    }

    * {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    html, body {
        width: 72mm;
        margin: 0;
        padding: 0;
        background: #fff;
        color: #000;
        font-size: 11px;
        font-family: 'Courier New', Courier, monospace;
    }

    /* Ocultar todo menos el ticket */
    .bottom-nav,
    .page-header,
    .boleta-actions,
    .btn,
    .toast-container {
        display: none !important;
    }

    /* Contenedor principal */
    .content {
        padding: 0;
        margin: 0;
        max-width: 72mm;
    }

    .boleta-container {
        max-width: 72mm;
        padding: 0;
        margin: 0;
    }

    /* Ticket */
    .boleta-ticket {
        width: 70mm;
        max-width: 70mm;
        box-shadow: none;
        border: none;
        border-radius: 0;
        padding: 2mm 1mm;
        font-size: 10px;
        line-height: 1.4;
        background: #fff;
        color: #000;
    }

    .boleta-ticket, .boleta-ticket * { color: #000 !important; }
    .boleta-nombre-local  { font-size: 14px; font-weight: 900; }
    .boleta-propietario-row { font-size: 8px; font-weight: 700; }
    .boleta-empresa       { font-size: 13px; font-weight: 900; }
    .boleta-tipo          { font-size: 11px; border: 2px solid #000; font-weight: 900; }
    .boleta-detalle       { font-size: 9px; font-weight: 600; }
    .boleta-items-header  { font-size: 8px; font-weight: 800; border-bottom: 2px solid #000; }
    .boleta-item-row      { font-size: 9px; font-weight: 600; }
    .boleta-total-row     { font-size: 10px; font-weight: 700; }
    .boleta-total-row.total-final { font-size: 13px; font-weight: 900; }
}


/* ============================================
   EDITOR PLANO 2D (SIMS STYLE)
   ============================================ */
.floorplan-canvas {
    background-color: #f8fafc;
    background-image: radial-gradient(#cbd5e1 2px, transparent 2px);
    background-size: 30px 30px;
    position: relative;
    overflow: hidden;
    border: 2px solid #e2e8f0;
    border-radius: var(--radius-lg);
}

.sidebar-editor {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    border-right: 1px solid rgba(0,0,0,0.05);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    z-index: 10;
}

.plano-mesa {
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.6), 0 8px 16px rgba(0,0,0,0.15);
    border: 2px solid rgba(0,0,0,0.05);
    transition: box-shadow 0.2s, transform 0.1s;
    background-color: #e2e8f0; /* Default wood/gray */
    color: #475569;
}

.plano-mesa:hover {
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.6), 0 12px 24px rgba(0,0,0,0.2);
    filter: brightness(1.05);
}

.plano-mesa.is-dragging {
    box-shadow: 0 20px 40px rgba(0,0,0,0.3) !important;
    opacity: 0.9;
    z-index: 999 !important;
}

/* Sillas Virtuales (Sims Style) */
.plano-mesa::before, .plano-mesa::after {
    content: "";
    position: absolute;
    background: rgba(0,0,0,0.2);
    border-radius: 4px;
    box-shadow: inset 0 1px 2px rgba(255,255,255,0.3);
}

.forma-cuadrada::before {
    width: 60%; height: 6px; top: -10px; left: 20%;
}
.forma-cuadrada::after {
    width: 60%; height: 6px; bottom: -10px; left: 20%;
}
.forma-redonda::before {
    width: 6px; height: 40%; left: -10px; top: 30%;
}
.forma-redonda::after {
    width: 6px; height: 40%; right: -10px; top: 30%;
}
.forma-rectangular::before {
    width: 70%; height: 6px; top: -10px; left: 15%;
}
.forma-rectangular::after {
    width: 70%; height: 6px; bottom: -10px; left: 15%;
}



/* ============================================
   BENTO BOX UI (MODULOS)
   ============================================ */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

@media(min-width: 900px) {
    .bento-grid {
        grid-template-columns: 2fr 1fr;
        grid-template-rows: auto auto;
    }
    .bento-card.featured {
        grid-row: span 2;
    }
}

.bento-card {
    position: relative;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 24px;
    padding: 32px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.03), inset 0 2px 4px rgba(255,255,255,0.8);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s;
    cursor: pointer;
}

.bento-card:hover {
    transform: translateY(-5px) scale(1.01);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08), inset 0 2px 4px rgba(255,255,255,0.9);
}

.bento-badge {
    position: absolute;
    top: 24px;
    right: 24px;
    background: rgba(0,0,0,0.05);
    color: var(--text-secondary);
    padding: 4px 12px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 1px;
}

.bento-card.ai .bento-badge.ai-badge {
    background: linear-gradient(135deg, #8b5cf6, #d946ef);
    color: white;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.bento-header {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 16px;
}

.bento-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: rgba(255,255,255,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--card-accent);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05), inset 0 2px 4px rgba(255,255,255,1);
}

.bento-card h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text-primary);
}

.bento-card.featured h3 {
    font-size: 2rem;
}

.bento-card p {
    flex-grow: 1;
    line-height: 1.6;
    margin-bottom: 24px;
}

.bento-btn {
    align-self: flex-start;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    background: var(--card-accent);
    color: white;
    border: none;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: all 0.2s;
}

.bento-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

.bento-btn.disabled {
    background: var(--bg-surface);
    color: var(--text-muted);
    box-shadow: none;
    cursor: not-allowed;
}

.bento-glow {
    position: absolute;
    width: 200px;
    height: 200px;
    background: var(--card-accent);
    filter: blur(80px);
    opacity: 0.05;
    bottom: -50px;
    right: -50px;
    border-radius: 50%;
    transition: opacity 0.3s;
}

.bento-card:hover .bento-glow {
    opacity: 0.15;
}

/* ============================================
   MATERIAL 3D PARA MESAS (FLOORPLAN)
   ============================================ */
.plano-mesa {
    box-shadow: 
        inset 0 2px 6px rgba(255,255,255,0.7), 
        inset 0 -4px 4px rgba(0,0,0,0.05),
        0 10px 20px rgba(0,0,0,0.15),
        0 2px 4px rgba(0,0,0,0.05) !important;
    border: 1px solid rgba(0,0,0,0.08) !important;
    background-image: linear-gradient(135deg, rgba(255,255,255,0.4) 0%, rgba(255,255,255,0) 100%);
}

.plano-mesa::before, .plano-mesa::after {
    content: "";
    position: absolute;
    background: linear-gradient(180deg, #94a3b8 0%, #64748b 100%);
    border-radius: 8px;
    box-shadow: 
        inset 0 1px 1px rgba(255,255,255,0.4),
        0 4px 6px rgba(0,0,0,0.2);
    z-index: -1; /* Sillas van por debajo de la mesa */
}

/* Ajuste fino de sillas */
.forma-cuadrada::before { width: 40px; height: 8px; top: -10px; left: calc(50% - 20px); }
.forma-cuadrada::after { width: 40px; height: 8px; bottom: -10px; left: calc(50% - 20px); }
.forma-rectangular::before { width: 60px; height: 8px; top: -10px; left: calc(50% - 30px); }
.forma-rectangular::after { width: 60px; height: 8px; bottom: -10px; left: calc(50% - 30px); }
.forma-redonda::before { width: 8px; height: 30px; left: -10px; top: calc(50% - 15px); border-radius: 8px; }
.forma-redonda::after { width: 8px; height: 30px; right: -10px; top: calc(50% - 15px); border-radius: 8px; }

