:root {
    --primary: #8b5cf6;
    --primary-hover: #7c3aed;
    --bg-color: #0f172a;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --success: #10b981;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(at 0% 0%, rgba(139, 92, 246, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.1) 0px, transparent 50%);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

.app-container {
    width: 100%;
    height: 100%;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.login-wrapper {
    width: 100%;
    max-width: 420px;
    margin: auto;
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 40px 32px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transition: all 0.4s ease;
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.logo-container {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--primary), #d946ef);
    border-radius: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 16px;
    font-size: 32px;
    box-shadow: 0 10px 20px rgba(139, 92, 246, 0.3);
}

h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

p {
    color: var(--text-muted);
    font-size: 14px;
}

.input-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
}

input, .form-select {
    width: 100%;
    padding: 14px 16px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-main);
    font-size: 15px;
    transition: all 0.3s ease;
}

input:focus, .form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}
select, .form-select {
    color: #ffffff !important;
}

select option, .form-select option {
    background-color: #1e293b !important;
    color: #ffffff !important;
}

button {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

/* CSS para Impresión de Reportes */
@media print {
    body.imprimiendo-ahora > *:not(#print-container):not(style):not(script) {
        display: none !important;
    }
    
    body.imprimiendo-ahora {
        background: white !important;
        height: auto !important;
        min-height: auto !important;
        overflow: visible !important;
    }
    
    #print-container {
        display: block !important;
        position: static !important;
        width: 100% !important;
        background: white !important;
        color: black !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    #print-container * {
        color: black !important;
        text-shadow: none !important;
        box-shadow: none !important;
        border-color: #999 !important;
    }

    #print-container .card, 
    #print-container .glass-panel, 
    #print-container .dashboard-content, 
    #print-container .dashboard-wrapper {
        border: none !important;
        box-shadow: none !important;
        background: white !important;
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
        display: block !important;
    }

    #print-container table { width: 100% !important; border-collapse: collapse !important; }
    #print-container table, #print-container th, #print-container td { border: 1px solid #999 !important; }
    #print-container th, #print-container td { padding: 8px !important; text-align: left !important; }

    #print-container button,
    #print-container .btn-primary,
    #print-container .btn-secondary,
    #print-container .btn-danger,
    #print-container .config-tab-nav {
        display: none !important;
    }
}

.btn-primary {
    background: var(--primary);
    color: white;
    margin-top: 10px;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(139, 92, 246, 0.4);
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background: var(--danger);
    color: white;
}

.setup-container {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--glass-border);
}

.hidden {
    display: none !important;
}

.alert {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    margin-bottom: 20px;
    text-align: center;
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

/* Spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Dashboard Styles */
.dashboard-wrapper {
    width: 100vw;
    height: 100vh;
    display: flex;
    padding: 0;
    overflow: hidden;
    border-radius: 0;
    border: none;
}

.sidebar {
    width: 250px;
    background: rgba(15, 23, 42, 0.6);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--glass-border);
}

.logo-icon.small {
    width: 32px;
    height: 32px;
    font-size: 16px;
    margin: 0;
    border-radius: 8px;
}

.sidebar-header h2 {
    font-size: 18px;
    margin: 0;
}

.sidebar-nav {
    padding: 24px 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
}

.nav-btn {
    width: 100%;
    padding: 12px 16px;
    background: transparent;
    color: var(--text-muted);
    border: none;
    text-align: left;
    justify-content: flex-start;
    border-radius: 8px;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    transform: none;
    box-shadow: none;
}

.nav-btn.active {
    background: var(--primary);
    color: white;
}

.sidebar-footer {
    padding: 24px 16px;
    border-top: 1px solid var(--glass-border);
}

.dashboard-content {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
    min-width: 0;
}

/* Responsividad para móviles */
@media (max-width: 768px) {
    .dashboard-wrapper {
        flex-direction: column;
        width: 100vw;
        height: 100vh;
        border-radius: 0;
        border: none;
    }
    .sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--glass-border);
    }
    .sidebar-nav {
        flex-direction: row;
        padding: 12px;
        overflow-x: auto;
    }
    .nav-btn { text-align: center; white-space: nowrap; }
    .catalog-grid { grid-template-columns: 1fr !important; }
    #view-dashboard { height: auto !important; }
    .dashboard-grid { grid-template-columns: 1fr !important; height: auto !important; }
    #view-dashboard > div[style*="grid-template-columns: repeat(4, 1fr)"] { grid-template-columns: repeat(2, 1fr) !important; }
}

.view-section {
    display: none;
    animation: fadeIn 0.3s ease;
}

.view-section.active {
    display: block;
}

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

.dashboard-header {
    margin-bottom: 30px;
}

.dashboard-header h2 {
    font-size: 24px;
}

.btn-danger.small { margin:0; }
.small { padding: 8px 12px; font-size: 13px; }
.btn-success { background: var(--success); color: white; border: none; }
.btn-success:hover { background: #059669; transform: translateY(-2px); }

/* Vistas: Catálogo */
.catalog-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.card {
    background: rgba(15, 23, 42, 0.4);
    border-radius: 16px;
    padding: 24px;
    border: 1px solid var(--glass-border);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.card-header h3 { font-size: 16px; color: var(--primary); }

.list-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
}

.color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 8px;
}

/* --- MAPA DE MESAS Y SALONES (CANVAS) --- */
.salones-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 8px;
    overflow-x: auto;
}
.tab-btn {
    padding: 10px 20px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px 8px 0 0;
    white-space: nowrap;
    transition: all 0.2s ease;
}
.tab-btn:hover { color: white; background: rgba(255,255,255,0.05); }
.tab-btn.active {
    background: rgba(139, 92, 246, 0.2);
    color: var(--primary);
    border-bottom: 2px solid var(--primary);
}

.editor-palette {
    display: flex;
    gap: 10px;
    padding: 12px;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    margin-bottom: 16px;
    align-items: center;
    flex-wrap: wrap;
    animation: fadeIn 0.3s ease;
}
.btn-tool {
    padding: 8px 12px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--glass-border);
    color: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
}
.btn-tool:hover { background: rgba(255,255,255,0.1); }

.canvas-wrapper {
    width: 100%;
    height: 65vh;
    overflow: auto;
    background: #0f172a;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    position: relative;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
}

.mapa-canvas {
    width: 2500px;
    height: 2500px;
    background-image: 
        linear-gradient(rgba(255,255,255,0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.05) 1px, transparent 1px);
    background-size: 50px 50px;
    position: relative;
    transform-origin: 0 0;
}

.mapa-item {
    position: absolute;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-shadow: 0 6px 12px -2px rgba(0,0,0,0.5);
    color: white;
    font-weight: 700;
    font-size: 14px;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.9);
    user-select: none;
    transition: transform 0.1s, box-shadow 0.2s;
    text-align: center;
    padding: 5px;
    word-break: break-word;
}
.mapa-item small {
    font-size: 10px;
    color: rgba(255,255,255,0.8);
    font-weight: 500;
}

/* Comportamiento Cursor */
.mapa-canvas.modo-edicion .mapa-item {
    cursor: grab;
}
.mapa-canvas.modo-edicion .mapa-item:active {
    cursor: grabbing;
    transform: scale(1.05);
    z-index: 100 !important;
    box-shadow: 0 10px 20px rgba(0,0,0,0.8);
}
.mapa-canvas:not(.modo-edicion) .mapa-item.es-mesa {
    cursor: pointer;
}
.mapa-canvas:not(.modo-edicion) .mapa-item.es-mesa:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(139, 92, 246, 0.4);
}

/* Tipos Físicos */
.forma-rect { border-radius: 8px; }
.forma-circle { border-radius: 50%; }
.forma-oval { border-radius: 50%; } /* Ovalado se logra automático si w!=h */

.tipo-Columna { 
    border-radius: 50%; 
    background: linear-gradient(135deg, #475569, #1e293b) !important; 
    border: 2px solid #64748b; 
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}
.tipo-Barra { 
    border-radius: 4px; 
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(79, 70, 229, 0.4)) !important; 
    border: 2px solid rgba(129, 140, 248, 0.6); 
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.2);
}
.tipo-Pared { 
    border-radius: 0; 
    background: #334155 !important; 
    border: 1px solid #475569; 
}
.tipo-Baño { 
    border-radius: 8px; 
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.25), rgba(2, 132, 199, 0.4)) !important; 
    border: 2px solid rgba(56, 189, 248, 0.6); 
    box-shadow: 0 0 15px rgba(14, 165, 233, 0.2);
}

.mapa-item:not(.es-mesa) small {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #f1f5f9;
}

/* Colores de Estado Operativo (Sobrescriben el fondo para Mesas) */
.estado-Libre { background: var(--success) !important; border: 2px solid #059669; }
.estado-Ocupada { background: var(--danger) !important; border: 2px solid #b91c1c; }
.estado-Cobrada { background: #f97316 !important; border: 2px solid #c2410c; }
.estado-Reservada { background: #eab308 !important; border: 2px solid #a16207; }

/* Selección en Editor */
.mapa-item.selected {
    box-shadow: 0 0 0 4px #fff, 0 0 15px var(--primary) !important;
    z-index: 90 !important;
}

/* Ocultar botones de modal actions sin forzar margin 0 */

.profile-card {
    background: rgba(15, 23, 42, 0.4);
    border-radius: 16px;
    padding: 24px;
    border: 1px solid var(--glass-border);
}

.profile-card h3 {
    margin-bottom: 16px;
    font-size: 16px;
    color: var(--primary);
}

pre {
    background: rgba(0,0,0,0.3);
    padding: 16px;
    border-radius: 10px;
    overflow-x: auto;
    font-size: 13px;
    color: #e2e8f0;
}

/* Custom Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    display: grid;
    place-items: center;
    overflow-y: auto;
    padding: 20px 10px;
    box-sizing: border-box;
    z-index: 9999;
}

.modal-box {
    width: 90%;
    max-width: 400px;
    text-align: center;
    padding: 30px;
}

.modal-box h3 {
    margin-bottom: 12px;
    font-size: 18px;
    color: var(--primary);
}

.modal-box p {
    margin-bottom: 24px;
    font-size: 15px;
    color: var(--text-main);
}

.modal-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.modal-actions button {
    margin: 0;
    width: auto;
    padding: 10px 24px;
}

/* KDS STYLES */
.kds-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    height: calc(100vh - 120px);
    overflow-y: auto;
    padding-right: 10px;
}

.kds-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    height: 350px; /* Altura fija para que las comandas se vean uniformes */
    overflow: hidden;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    animation: fadeIn 0.3s ease;
}

.kds-card-header {
    background: rgba(15, 23, 42, 0.6);
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    border-bottom: 1px solid var(--glass-border);
}

.kds-card-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.kds-card-header-bottom {
    display: flex;
    justify-content: flex-start;
    align-items: center;
}

.kds-card-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    font-size: 14px;
}

.kds-card-body ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.kds-card-body li {
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.kds-card-body li:last-child {
    border-bottom: none;
}

.kds-card-footer {
    padding: 12px;
    border-top: 1px solid var(--glass-border);
    background: rgba(0,0,0,0.2);
}

.kds-listo-btn {
    width: 100%;
    padding: 12px;
    font-size: 16px;
}

.mesa-badge {
    color: var(--primary);
    font-size: 18px;
    font-weight: 800;
}
.mozo-badge { color: var(--text-muted); font-size: 13px; }
.time-badge { color: var(--text-muted); font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.time-badge.late { color: var(--danger); }

/* Hacer que todos los catalog-grid sean de una sola columna, para que el listado tome todo el ancho */
.catalog-grid {
    grid-template-columns: 1fr !important;
}

/* Modal Overlay para todos los formularios de edición/creación */
#form-categoria-card,
#form-producto-card,
#form-insumo-card,
#form-receta-card,
#form-usuario-card,
#form-rol-card {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    background: rgba(0, 0, 0, 0.65) !important;
    backdrop-filter: blur(8px) !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    z-index: 2500 !important;
    padding: 0 !important;
    margin: 0 !important;
    border-radius: 0 !important;
    border: none !important;
    box-sizing: border-box !important;
}

#form-categoria-card.hidden,
#form-producto-card.hidden,
#form-insumo-card.hidden,
#form-receta-card.hidden,
#form-usuario-card.hidden,
#form-rol-card.hidden {
    display: none !important;
}

/* El contenido interno del formulario (el contenedor centrado) */
#form-categoria-card > *,
#form-producto-card > *,
#form-insumo-card > *,
#form-receta-card > *,
#form-usuario-card > *,
#form-rol-card > * {
    width: 90% !important;
    max-width: 600px !important;
    max-height: 85vh !important;
    overflow-y: auto !important;
    background: rgba(22, 22, 26, 0.98) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    border-radius: 16px !important;
    padding: 24px !important;
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.6) !important;
    animation: modalSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
    box-sizing: border-box !important;
}

/* Para recetas y productos que son complejos/ancho, hacerlos más grandes */
#form-receta-card > *,
#form-producto-card > * {
    max-width: 800px !important;
}

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

/* ===== CONFIG TABS ===== */
.config-tab-nav {
    display: flex;
    flex-direction: row !important;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 6px;
    margin-bottom: 20px;
    overflow-x: auto !important;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    min-width: 0;
}

.config-tab-nav::-webkit-scrollbar {
    display: none !important;
}

.config-tab-nav {
    -ms-overflow-style: none !important;
    scrollbar-width: none !important;
}

.config-tab-btn {
    background: transparent !important;
    color: var(--text-muted) !important;
    border: none !important;
    border-radius: 8px !important;
    padding: 8px 14px !important;
    font-size: 13px !important;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.config-tab-btn:hover {
    background: rgba(255,255,255,0.07) !important;
    color: #fff !important;
}

.config-tab-btn.active {
    background: var(--primary) !important;
    color: #fff !important;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.35) !important;
}

.config-tab-panel {
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ===== KDS IMPROVEMENTS ===== */
.kds-card-body ul li:last-child {
    border-bottom: none !important;
}

/* ===== RESERVAS ===== */
.badge-reserva-inminente {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ef4444; /* Rojo llamativo */
    color: white;
    font-size: 14px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    box-shadow: 0 4px 8px rgba(0,0,0,0.5);
    z-index: 10;
    animation: pulso-reserva 1.5s infinite ease-in-out;
}

@keyframes pulso-reserva {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }
    70% {
        transform: scale(1.15);
        box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

#custom-modal-overlay {
    z-index: 11000 !important;
}

/* ===== TICKET PRINTING AND PREVIEW ===== */
.ticket-paper {
    background-color: #ffffff !important;
    color: #000000 !important;
    font-family: 'Courier New', Courier, monospace !important;
    font-size: 13px !important;
    line-height: 1.4 !important;
    width: 320px;
    padding: 15px 10px;
    box-sizing: border-box;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.ticket-paper * {
    color: #000000 !important;
    font-family: 'Courier New', Courier, monospace !important;
}

.ticket-header {
    text-align: center;
    margin-bottom: 12px;
}

.ticket-title {
    font-size: 16px !important;
    font-weight: bold !important;
    text-transform: uppercase;
    margin-bottom: 4px;
    text-align: center;
}

.ticket-subtitle {
    font-size: 11px !important;
    text-align: center;
    color: #333 !important;
    margin-bottom: 2px;
}

.ticket-divider {
    border-top: 1px dashed #000000 !important;
    margin: 8px 0 !important;
    height: 0;
    width: 100%;
}

.ticket-double-divider {
    border-top: 1px double #000000 !important;
    margin: 8px 0 !important;
    height: 0;
    width: 100%;
}

.ticket-meta-info {
    font-size: 12px !important;
    margin-bottom: 8px;
}

.ticket-meta-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2px;
}

.ticket-items-table {
    width: 100%;
    margin-bottom: 8px;
}

.ticket-item-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 4px;
}

.ticket-item-name {
    flex: 1;
    padding-right: 8px;
    word-break: break-word;
}

.ticket-item-qty {
    margin-right: 8px;
    font-weight: bold;
}

.ticket-item-price {
    text-align: right;
    white-space: nowrap;
}

.ticket-item-notes {
    font-size: 11px !important;
    padding-left: 20px;
    margin-bottom: 4px;
    font-style: italic;
    color: #555 !important;
}

.ticket-totals {
    margin-top: 8px;
    font-size: 13px !important;
}

.ticket-total-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 3px;
}

.ticket-total-final {
    font-size: 16px !important;
    font-weight: bold !important;
    margin-top: 6px;
    border-top: 1px dashed #000000;
    border-bottom: 1px dashed #000000;
    padding: 6px 0;
}

.ticket-footer {
    text-align: center;
    margin-top: 15px;
    font-size: 11px !important;
}

.ticket-wifi-box {
    border: 1px dashed #000;
    padding: 6px;
    margin-top: 10px;
    text-align: center;
    font-size: 11px !important;
}

/* @media print para la bobina termica */
@media print {
    body.imprimiendo-ticket html, 
    body.imprimiendo-ticket, 
    body.imprimiendo-ticket .app-container, 
    body.imprimiendo-ticket .sidebar, 
    body.imprimiendo-ticket .view-section, 
    body.imprimiendo-ticket .modal-overlay:not(#ticket-preview-modal-overlay), 
    body.imprimiendo-ticket .modal-box {
        visibility: hidden !important;
        background: none !important;
        box-shadow: none !important;
        margin: 0 !important;
        padding: 0 !important;
        width: auto !important;
        height: auto !important;
    }
    
    /* Mostrar unicamente el contenido del ticket en la esquina superior izquierda */
    body.imprimiendo-ticket #ticket-preview-modal-overlay {
        visibility: visible !important;
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        height: auto !important;
        background: none !important;
        display: block !important;
        box-shadow: none !important;
        margin: 0 !important;
        padding: 0 !important;
        z-index: 999999 !important;
    }
    
    body.imprimiendo-ticket #ticket-preview-modal-overlay .modal-box {
        visibility: visible !important;
        background: none !important;
        border: none !important;
        box-shadow: none !important;
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    #ticket-preview-modal-overlay .modal-box > div:first-child,
    .ticket-preview-scroll-container {
        background: none !important;
        padding: 0 !important;
        margin: 0 !important;
        overflow: visible !important;
        max-height: none !important;
        display: block !important;
    }
    
    #ticket-preview-modal-overlay h3,
    #ticket-preview-modal-overlay button,
    #btn-imprimir-ticket-execute,
    #btn-cerrar-ticket-preview {
        display: none !important; /* Ocultar botones de control en impresion */
    }

    #ticket-paper-content {
        visibility: visible !important;
        width: 80mm !important; /* bobina de 80mm */
        max-width: 80mm !important;
        margin: 0 !important;
        padding: 5mm !important;
        box-shadow: none !important;
        border: none !important;
        display: block !important;
        background: #ffffff !important;
    }
    
    /* Configurar página sin márgenes del navegador */
    @page {
        size: auto;
        margin: 0mm;
    }
}

/* --- Custom Switch & Card UI --- */
.permisos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
    margin-top: 10px;
}
.switch-card {
    background: var(--surface);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: all 0.2s;
}
.switch-card:hover {
    border-color: var(--primary);
    background: rgba(0, 158, 227, 0.05);
}
.switch-toggle {
    position: relative;
    width: 44px;
    height: 24px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    transition: 0.3s;
    flex-shrink: 0;
}
.switch-toggle::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    transition: 0.3s;
}
input[type="checkbox"]:checked + .switch-toggle {
    background: var(--primary);
    box-shadow: 0 0 10px var(--primary-glow);
}
input[type="checkbox"]:checked + .switch-toggle::after {
    transform: translateX(20px);
}
.switch-card input[type="checkbox"] {
    display: none;
}
.config-section {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    padding: 24px;
    border-radius: 16px;
    margin-bottom: 24px;
}
.config-section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.config-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
}

/* Responsividad para tablas y listas que desbordan */
.table-responsive, .table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Quitar flechas/spinners en inputs numéricos de todo el sistema */
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type=number] {
    -moz-appearance: textfield;
}
