/* =========================================
   DESIGN SYSTEM & VARIABLES
   ========================================= */
:root {
    /* Primary Colors */
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --secondary: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    
    /* Gradients */
    --grad-header: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    --grad-turno: linear-gradient(90deg, #f43f5e 0%, #e11d48 100%);
    
    /* Neutrals */
    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    
    /* Radius */
    --radius: 12px;
    --radius-lg: 20px;
    
    /* Extra Gradients */
    --grad-btn: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    --grad-success: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --grad-auth: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}

/* =========================================
   BASE STYLES
   ========================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box !important;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    overflow-x: hidden;
    width: 100%;
    position: relative;
}

body {
    background: var(--bg-body);
    color: var(--text-main);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.5;
    min-height: 100vh;
}

/* =========================================
   HEADER — Barra compacta horizontal
   ========================================= */
header {
    background: var(--grad-header);
    color: #fff;
    padding: 0 16px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 1001;
}

/* --- Marca (izquierda) --- */
.header-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.brand-icon {
    font-size: 22px;
}

header h1 {
    font-size: 16px;
    font-weight: 800;
    letter-spacing: -0.3px;
    white-space: nowrap;
    color: #fff;
    background: none;
    -webkit-text-fill-color: #fff;
}

.brand-accent {
    color: #a5b4fc;
}

/* --- Chip de turno (centro) --- */
.turno-chip {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6px 14px;
    border-radius: 10px;
    transition: background 0.3s, box-shadow 0.3s;
    max-width: 220px;
    min-width: 0;
}

.turno-chip.turno-dia {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    box-shadow: 0 2px 8px rgba(245,158,11,0.4);
}

.turno-chip.turno-noche {
    background: linear-gradient(135deg, #6366f1, #4338ca);
    box-shadow: 0 2px 8px rgba(99,102,241,0.4);
}

#turnoActual {
    font-weight: 700;
    font-size: 13px;
    white-space: nowrap;
}

#fechaHoraActual {
    font-size: 11px;
    opacity: 0.85;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* --- Acciones derecha --- */
.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

/* --- RESPONSIVIDAD HEADER --- */
@media (max-width: 1023px) {
    /* Ocultar nombre del Kiosco, dejar solo logo */
    .header-brand h1 {
        display: none !important;
    }
    
    /* Compactar chip de turno */
    .turno-chip {
        padding: 4px 10px !important;
        max-width: 130px !important;
    }
    #fechaHoraActual {
        display: none !important; /* Ocultar fecha en móvil para ganar espacio */
    }
    
    /* Ocultar info de usuario, dejar solo avatar */
    .user-info {
        display: none !important;
    }
    .user-badge {
        padding: 5px !important;
    }
    
    /* Ocultar labels de botones de header */
    .btn-header-action .btn-label {
        display: none !important;
    }
    .btn-header-action {
        width: 40px !important;
        height: 40px !important;
        padding: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 20px !important;
    }
}

/* Badge usuario */
.user-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 10px;
    padding: 5px 10px;
    cursor: default;
}

.user-avatar {
    font-size: 20px;
    line-height: 1;
}

.user-info {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.user-nombre {
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-rol {
    font-size: 10px;
    font-weight: 600;
    color: #a5b4fc;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Campana notificaciones */
.notif-bell {
    position: relative;
    cursor: pointer;
    font-size: 20px;
    padding: 7px;
    transition: transform 0.2s, background 0.2s;
    background: rgba(255,255,255,0.08);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notif-bell:hover {
    transform: scale(1.1);
    background: rgba(255,255,255,0.18);
}

.notif-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444 !important;
    color: #fff !important;
    font-size: 9px !important;
    font-weight: 900 !important;
    width: 18px !important;
    height: 18px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: 2px solid #1e293b !important;
    box-shadow: 0 0 8px rgba(239,68,68,0.6) !important;
    z-index: 5000 !important;
}

.notif-bell.notif-active .bell-icon {
    animation: bellShake 1s infinite alternate cubic-bezier(0.45, 0, 0.55, 1);
    color: #fbbf24 !important;
}

@keyframes bellShake {
    0%   { transform: rotate(0); }
    15%  { transform: rotate(15deg); }
    30%  { transform: rotate(-15deg); }
    45%  { transform: rotate(10deg); }
    60%  { transform: rotate(-10deg); }
    100% { transform: rotate(0); }
}

/* Botones de acción del header */
.btn-header-action {
    background: rgba(255,255,255,0.1) !important;
    color: #fff !important;
    border: 1px solid rgba(255,255,255,0.18) !important;
    padding: 7px 12px !important;
    border-radius: 10px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
    display: flex !important;
    align-items: center !important;
    gap: 5px !important;
    white-space: nowrap !important;
}

.btn-header-action:hover {
    background: rgba(255,255,255,0.2) !important;
}

.btn-header-action.btn-logout:hover {
    background: rgba(239,68,68,0.35) !important;
    border-color: var(--danger) !important;
}

/* En mobile ocultar etiquetas de texto en botones de header */
@media (max-width: 640px) {
    .btn-label { display: none; }
    .user-info  { display: none; }
    header h1   { font-size: 14px; }
    .turno-chip { padding: 5px 8px; }
    .user-badge { padding: 5px 6px; }
}

.oculto-mobile  { display: none !important; }
.oculto-desktop { display: block !important; }

@media (min-width: 768px) {
    .oculto-mobile  { display: flex !important; }
    .oculto-desktop { display: none !important; }
}



/* =========================================
   NAVIGATION TABS (Escritorio por defecto)
   ========================================= */
.tabs {
    display: flex;
    gap: 8px;
    padding: 0 16px;
    background: #fff;
    border-bottom: 2px solid var(--border);
    overflow-x: auto;
    scrollbar-width: none;
    position: sticky;
    top: 60px;
    z-index: 1000;
}

.tabs button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: transparent;
    color: var(--text-muted);
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    border-radius: 8px;
    transition: all 0.2s;
    white-space: nowrap;
}

.tabs button span {
    font-size: 18px;
}

.tabs button.active {
    background: var(--grad-header);
    color: #fff;
}

/* --- Ajuste de Acciones en Tabla --- */
.actions-cell {
    display: flex;
    flex-direction: row;
    gap: 6px;
    flex-wrap: nowrap;
}

/* Ajuste de body móvil y elementos responsivos */
@media (max-width: 1023px) {
    /* (El resto lo maneja el estilo inyectado en index.php) */
    body {
        padding-bottom: 160px !important;
    }
}


/* =========================================
   MAIN CONTENT
   ========================================= */
main {
    padding: 16px;
}

.tab {
    display: none;
    animation: fadeIn 0.3s ease-out;
}

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

.tab.active {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* =========================================
   BADGES & STATUS
   ========================================= */
.badge {
    padding: 6px 12px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-block;
}

.badge-ok {
    background: #ecfdf5;
    color: #059669;
}

.badge-low {
    background: #fffbeb;
    color: #d97706;
}

.badge-crit {
    background: #fef2f2;
    color: #dc2626;
    animation: pulseGlow 2s infinite;
}

@keyframes pulseGlow {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* =========================================
   TABLES & LISTS
   ========================================= */
.tabla-container {
    width: 100%;
    overflow-x: auto;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
}

.tabla {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

.tabla th {
    padding: 16px;
    text-align: left;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    background: #fdfdfd;
}

.tabla td {
    padding: 16px;
    font-size: 15px;
    color: var(--text-main);
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

/* Normalización de texto en Mayúsculas */
.mayus, 
.pos-nombre, 
.col-depto, 
#pagoDetalleTicket span,
#listaVentas7Dias td:first-child,
#listaTop5Productos td:first-child {
    text-transform: uppercase !important;
}


/* Contenedor para Password con Ojo */
.password-wrapper {
    position: relative;
    width: 100%;
    margin-bottom: 0px;
}

.password-wrapper input {
    padding-right: 45px !important;
}

.btn-toggle-pass {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none !important;
    border: none !important;
    color: var(--text-muted) !important;
    cursor: pointer;
    padding: 5px !important;
    font-size: 18px !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    z-index: 5;
    transition: color 0.2s;
    user-select: none;
    width: 32px !important;
    height: 32px !important;
}

.btn-toggle-pass:hover {
    color: var(--primary) !important;
}
.actions-cell button {
    width: 38px !important;
    height: 38px !important;
    padding: 0 !important;
    border-radius: 10px !important;
    background: #f1f5f9 !important;
    color: var(--text-main) !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    font-size: 16px !important;
    transition: all 0.2s;
}

.actions-cell button:hover {
    background: var(--primary) !important;
    color: #fff !important;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.actions-cell .btnEliminarProducto:hover {
    background: var(--danger) !important;
}

.tabla tr:hover {
    background: #f8fafc;
}

.tabla tr:last-child td {
    border-bottom: none;
}

/* =========================================
   TOOLBARS & FILTERS
   ========================================= */
.toolbar {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.search-wrap {
    position: relative;
    width: 100%;
}

input[type="text"], 
input[type="number"], 
input[type="time"] {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 15px;
    transition: all 0.2s;
    background: var(--bg-card);
    color: var(--text-main);
}

input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.filtros-departamentos {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 4px 0;
    scrollbar-width: none;
}

.filtros-departamentos button {
    flex-shrink: 0;
    padding: 8px 16px;
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    transition: all 0.2s;
}

.filtros-departamentos button.activo {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

/* =========================================
   PROVEEDORES (Split-View Layout)
   ========================================= */
.proveedores-layout {
    display: flex;
    flex-direction: column;
    gap: 0;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    min-height: calc(100vh - 250px);
}

.sidebar-prov {
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border);
}

.sidebar-header h3 {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.search-box {
    display: flex;
    gap: 8px;
}

#btnAgregarProveedor {
    width: 46px;
    height: 46px;
    padding: 0;
    min-width: 46px;
    background: var(--primary);
    color: #fff;
    font-size: 20px;
    border-radius: 12px;
}

.sidebar-scroll {
    overflow-y: auto;
    max-height: 400px;
}

#providersList {
    list-style: none;
    padding: 12px;
}

.prov-item {
    padding: 16px;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 8px;
    background: transparent;
    border: 1px solid transparent;
}

.prov-item:hover {
    background: rgba(255,255,255,0.8);
}

.prov-item.active {
    background: #fff;
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}

.prov-item strong {
    display: block;
    font-size: 15px;
    color: var(--text-main);
}

/* Detail Area */
.detail-prov {
    flex: 1;
    padding: 32px;
    background: #fff;
}

.prov-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 48px;
    color: var(--text-muted);
}

.welcome-icon {
    font-size: 64px;
    margin-bottom: 24px;
    opacity: 0.5;
}

.detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 24px;
}

#proveedorSeleccionadoTitulo {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-main);
}

.badge {
    padding: 6px 12px;
    background: #eef2ff;
    color: #4f46e5;
    font-size: 12px;
    font-weight: 700;
    border-radius: 999px;
    letter-spacing: 0.05em;
}

.guardarPrecioBtn {
    background: var(--grad-btn) !important;
    color: #fff !important;
    font-size: 13px !important;
    padding: 10px 16px !important;
    border-radius: 10px !important;
    box-shadow: var(--shadow-sm);
    white-space: nowrap;
}

.precioProveedorInput {
    border: 2px solid #cbd5e1 !important; /* Borde más grueso y oscuro */
    padding: 12px !important;
    border-radius: 10px !important;
    width: 120px !important;
    background: #fff !important;
    font-weight: 700 !important;
    color: var(--text-main) !important;
    outline: none !important;
    transition: all 0.2s;
    text-align: right;
    display: block !important;
}

.precioProveedorInput:focus {
    border-color: var(--primary) !important;
    background: #fdfdfd !important;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2) !important;
}

@media (min-width: 992px) {
    .proveedores-layout {
        flex-direction: row;
    }
    .sidebar-prov {
        width: 320px;
        border-bottom: none;
        border-right: 1px solid var(--border);
    }
    .sidebar-scroll {
        max-height: none;
    }
}

/* =========================================
   BUTTONS
   ========================================= */
button:not(.tabs button):not(.filtros-departamentos button) {
    padding: 12px 20px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: auto;
}

#btnNuevoProducto {
    background: var(--primary);
    color: #fff;
    white-space: nowrap;
}

#btnNuevoProducto:active {
    background: var(--primary-hover);
    transform: scale(0.98);
}

.btn-icon {
    font-size: 18px;
}

/* =========================================
   VENTAS TAB (POS)
   ========================================= */
.ventas-layout {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.buscador-wrap {
    position: relative;
}

.suggestions {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 1002;
    max-height: 350px;
    overflow-y: auto;
    border: 1px solid var(--border);
}

.suggestion-pos {
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
}

.suggestion-pos:last-child {
    border-bottom: none;
}

.suggestion-pos:active {
    background: #f1f5f9;
}

.pos-nombre {
    font-weight: 600;
    font-size: 15px;
}

.pos-precio {
    color: var(--secondary);
    font-weight: 700;
    font-size: 16px;
}

.totales {
    background: var(--bg-card);
    padding: 16px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: var(--shadow-md);
    position: sticky;
    bottom: 16px;
}

.total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 16px;
    font-weight: 500;
}

.total-value {
    font-size: 24px;
    font-weight: 800;
    color: var(--primary);
}

#btnConfirmarVenta {
    background: var(--secondary);
    color: #fff;
    width: 100%;
    padding: 16px;
    font-size: 16px;
    margin-top: 8px;
}

/* =========================================
   MODAL
   ========================================= */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 16px;
    transition: opacity 0.3s ease;
}

.oculto {
    display: none !important;
}

.modal-content {
    background: var(--bg-card);
    border-radius: 24px;
    padding: 32px;
    width: 100%;
    max-width: 550px;
    box-shadow: var(--shadow-lg);
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-header h3 {
    margin-bottom: 0;
}

.btnCerrarModal#btnCerrarModalX {
    background: transparent;
    border: none;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0;
    width: auto !important;
    height: auto !important;
    display: flex;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

@media (min-width: 480px) {
    .form-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.modal-content label {
    display: block;
    margin-bottom: 16px;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-muted);
}

.modal-content input {
    margin-top: 6px;
}

.modal-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 24px;
}

#btnGuardarProducto {
    background: var(--primary);
    color: #fff;
}

#btnCerrarModal {
    background: #f1f5f9;
    color: var(--text-main);
}

/* =========================================
   CONFIG PAGE
   ========================================= */
.config-container {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.config-section {
    background: var(--bg-card);
    padding: 24px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.config-section h3 {
    margin-bottom: 20px;
    font-size: 18px;
    color: var(--text-main);
}

.config-actions {
    display: flex;
    justify-content: flex-end;
}

#guardarConfig {
    background: var(--primary);
    color: #fff;
    padding: 16px 32px;
}

/* =========================================
   TOASTS
   ========================================= */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    left: 24px;
    padding: 16px 20px;
    border-radius: var(--radius);
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 9999;
    text-align: center;
    backdrop-filter: blur(8px);
    box-shadow: var(--shadow-lg);
}

.toast.visible {
    opacity: 1;
    transform: translateY(0);
}

.toast-error { background: rgba(239, 68, 68, 0.9); }
.toast-info { background: rgba(59, 130, 246, 0.9); }
.toast-success { background: rgba(16, 185, 129, 0.9); }
.btn-danger {
    background: var(--danger) !important;
    color: #fff !important;
}

.btn-cancel {
    background: #f1f5f9 !important;
    color: var(--text-main) !important;
}

.confirm-msg {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 24px;
    color: var(--text-main);
    line-height: 1.4;
}

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

/* =========================================
   RESPONSIVE (DESKTOP)
   ========================================= */
/* =========================================
   RESPONSIVE (MOBILE SPECIFIC)
   ========================================= */
@media (max-width: 767px) {
    .col-codigo, .col-depto {
        display: none !important;
    }
    
    .tabla {
        min-width: 100%;
    }

    /* Force clear desktop stickers */
    .tabs {
        top: auto !important;
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        height: 75px !important;
        background: #ffffff !important;
        border-top: 1px solid var(--border);
        box-shadow: 0 -8px 24px rgba(0,0,0,0.12);
        display: grid !important;
        grid-template-columns: repeat(6, 1fr) !important;
        padding: 0 !important;
        margin: 0 !important;
        z-index: 9999 !important;
        border-radius: 0;
    }

    /* Custom Dropdown Styles */
    .custom-dropdown {
        position: relative;
        width: 100% !important;
        max-width: calc(100vw - 32px) !important;
        margin: 0 auto 24px auto !important;
        user-select: none;
        z-index: 2000;
    }

    .dropdown-selected {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 16px 20px;
        background: #fff;
        border: 2px solid var(--primary);
        border-radius: 14px;
        color: var(--primary);
        font-weight: 800;
        font-size: 15px;
        box-shadow: var(--shadow-sm);
        cursor: pointer;
    }

    .dropdown-arrow {
        font-size: 12px;
        transition: transform 0.3s;
    }

    .dropdown-content {
        position: absolute;
        top: calc(100% + 8px);
        left: 0;
        right: 0;
        background: #fff;
        border-radius: 16px;
        box-shadow: 0 12px 32px rgba(0,0,0,0.15);
        border: 1px solid var(--border);
        overflow: hidden;
        max-height: 300px;
        overflow-y: auto;
        z-index: 2001;
        animation: slideDown 0.2s ease-out;
    }

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

    .dropdown-item {
        padding: 16px 20px;
        font-size: 14px;
        font-weight: 600;
        color: var(--text-main);
        border-bottom: 1px solid #f1f5f9;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis; /* Evita desborde de texto largo */
    }

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

    .dropdown-item:active {
        background: var(--primary);
        color: #fff;
    }

    .tabs button {
        flex-direction: column;
        justify-content: center;
        gap: 4px;
        padding: 0;
        font-size: 10px;
        border-radius: 0;
        background: transparent !important;
        color: var(--text-muted);
        box-shadow: none !important;
        width: 100%;
        height: 100%;
        border: none !important;
    }

    .tabs button.active {
        color: var(--primary) !important;
        background: transparent !important;
        border-top: 3px solid var(--primary) !important;
        padding-top: 5px; /* Adjust for border */
    }

    .tabs button span {
        font-size: 20px !important;
    }

    .tabs button label {
        display: block !important;
        font-size: 8px !important;
        text-transform: uppercase !important;
        font-weight: 700 !important;
    }

    main {
        padding-bottom: 90px; /* Space for bottom bar */
    }
}

/* =========================================
   AUTH / LOGIN SCREEN
   ========================================= */
#authContainer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--grad-auth);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
}

.auth-card {
    background: #fff;
    width: 100%;
    max-width: 440px;
    padding: 40px;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 50px rgba(0,0,0,0.1);
    text-align: center;
    animation: authSlideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.auth-logo {
    width: 80px;
    height: 80px;
    background: var(--grad-btn);
    border-radius: 22px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    color: #fff;
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.3);
}

.auth-title {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 8px;
    color: var(--text-main);
}

.auth-subtitle {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 32px;
}

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

.input-group label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-main);
    padding-left: 4px;
}

.input-field {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #f1f5f9;
    border-radius: 12px;
    font-size: 15px;
    transition: all 0.2s;
    background: #f8fafc;
}

.input-field:focus {
    border-color: var(--primary);
    background: #fff;
    outline: none;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.btn-auth {
    width: 100%;
    padding: 16px;
    background: var(--grad-btn);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    margin-top: 10px;
    transition: all 0.3s;
}

.btn-auth:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(99, 102, 241, 0.4);
}

/* =========================================
   DASHBOARD KPI CARDS
   ========================================= */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.kpi-card {
    background: #fff;
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: transform 0.2s;
}

.kpi-card:hover { transform: translateY(-4px); }

.kpi-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}

.kpi-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kpi-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.kpi-icon.blue   { background: #eff6ff; color: #3b82f6; }
.kpi-icon.green  { background: #ecfdf5; color: #10b981; }
.kpi-icon.purple { background: #f5f3ff; color: #8b5cf6; }
.kpi-icon.orange { background: #fff7ed; color: #f97316; }

.kpi-value {
    font-size: 32px;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 4px;
}

.kpi-sub {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
}

/* =========================================
   REPORT LAYOUT (CHARTS & TABLES)
   ========================================= */
.report-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

@media (max-width: 1024px) {
    .report-row { grid-template-columns: 1fr !important; }
}

.report-card {
    background: #fff;
    padding: 28px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.header-info h2 { font-size: 24px; font-weight: 800; }
.header-info p { color: var(--text-muted); margin-top: 4px; }

.chart-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
    margin-bottom: 20px;
}

.chart-wrapper {
    position: relative;
    height: 320px;
    width: 100%;
}

.tabla-simple {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.tabla-simple th {
    text-align: left;
    padding: 12px 0;
    font-size: 11px;
    font-weight: 800;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    text-transform: uppercase;
}

.tabla-simple td {
    padding: 16px 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    border-bottom: 1px solid rgba(0,0,0,0.03);
}

/* =========================================
   USER & PERMISSION MATRIX
   ========================================= */
.config-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    margin-bottom: 40px;
}

@media (min-width: 1024px) {
    .config-grid { grid-template-columns: 1.2fr 0.8fr; }
}

.config-card {
    background: #fff;
    padding: 28px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.permisos-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-top: 24px;
}

.permiso-box {
    background: #f8fafc;
    padding: 20px;
    border-radius: 16px;
    border: 1px solid var(--border);
}

.permiso-box h4 {
    font-size: 11px;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 16px;
    letter-spacing: 1px;
}

.permiso-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

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

.permiso-item span {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
}

/* TOGGLE SWITCH */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input { opacity: 0; width: 0; height: 0; }

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #cbd5e1;
  transition: .3s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px; width: 18px;
  left: 3px; bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

input:checked + .slider { background-color: var(--primary); }
input:checked + .slider:before { transform: translateX(20px); }

@media (min-width: 768px) {
    header {
        flex-direction: row;
        justify-content: space-between;
        padding: 16px 32px;
    }
    
    #infoTurnoFecha {
        width: auto;
    }

    .toolbar {
        flex-direction: row;
        align-items: center;
        gap: 16px;
    }
    
    .toolbar input[type="text"] {
        flex: 1;
    }

    #btnNuevoProducto {
        width: auto;
    }

    .tabs {
        top: 80px; /* Header unificado en una linea */
        padding: 6px 32px;
    }
    
    .proveedores-wrap {
        flex-direction: row;
        align-items: flex-start;
    }
    
    .lista-proveedores {
        width: 320px;
        position: sticky;
        top: 130px;
    }
    
    main {
        padding: 32px;
    }
}

/* =========================================
   ROLE BASED VISIBILITY
   ========================================= */
.rol-no-edit .btnEditarProducto,
.rol-no-edit .btnEliminarProducto,
.rol-no-edit .btn-edit-stock,
.rol-no-edit .btn-danger,
.rol-no-edit #btnNuevoProducto {
   display: none !important;
}

.rol-no-sell #btnConfirmarVenta {
   opacity: 0.5;
   pointer-events: none;
   filter: grayscale(1);
}

/* =========================================
   MODAL PAGO (Resumen Venta)
   ========================================= */
.pago-ticket-area {
   background: #f8fafc;
   border: 1px solid #e2e8f0;
   border-radius: 12px;
   padding: 16px;
   margin-bottom: 20px;
}

.pago-line {
   display: flex;
   justify-content: space-between;
   padding: 4px 0;
   font-size: 14px;
   color: #475569;
}

.pago-total-line {
   display: flex;
   justify-content: space-between;
   border-top: 1px solid #e2e8f0;
   margin-top: 12px;
   padding-top: 12px;
   font-weight: 800;
   font-size: 18px;
   color: var(--primary);
}

.pago-metodos-grid {
   display: flex;
   flex-direction: column;
   gap: 12px;
}

.pago-option {
   position: relative;
   cursor: pointer;
}

.pago-option input {
   position: absolute;
   opacity: 0;
}

.pago-card {
   display: flex;
   align-items: center;
   padding: 14px 20px;
   background: white;
   border: 2px solid #e2e8f0;
   border-radius: 12px;
   transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
   font-weight: 600;
   color: #64748b;
}

.pago-option input:checked + .pago-card {
   border-color: var(--primary);
   background: rgba(99, 102, 241, 0.05); /* Sutil tinte del color primario */
   color: var(--primary);
}

.pago-option:hover .pago-card {
   border-color: #cbd5e1;
}

/* =========================================
   ESTILOS DE IMPRESIÓN (TICKET TÉRMICO)
   ========================================= */
.ticket-impresion {
   display: none;
}

@media print {
   body * {
      visibility: hidden;
   }
   #ticketPrintArea, #ticketPrintArea * {
      visibility: visible;
   }
   #ticketPrintArea {
      display: block !important;
      position: absolute;
      top: 0;
      left: 0;
      width: 80mm; /* Standard Thermal Size */
      font-family: 'Courier New', Courier, monospace;
      font-size: 11px;
      color: #000;
      padding: 0;
      margin: 0;
   }
   .t-center { text-align: center; }
   .t-bold { font-weight: 800; }
   .t-divider { border-bottom: 1px dashed #000; margin: 8px 0; }
   .t-row { display: flex; justify-content: space-between; }
   .t-header { 
      font-size: 14px; 
      margin-bottom: 4px; 
      text-transform: uppercase;
   }
   .t-footer { margin-top: 12px; font-size: 10px; }
}