/*
 * Impulza ERP - Hoja de Estilos Maestra
 * Versión: Original + Fix Full Height (Sin perder estilos previos)
 */

/* --- 1. GLOBALES Y TIPOGRAFÍA --- */

:root {
    /* Paleta de Colores */
    --color-primario: #2C3E50;
    --color-acento: #007BFF;
    --color-fondo-pagina: #F8F9FA;
    --color-fondo-tarjeta: #FFFFFF;
    --color-texto-principal: #212529;
    --color-texto-secundario: #6C757D;
    --color-bordes: #DEE2E6;

    /* Colores Semánticos */
    --color-exito: #198754;       
    --color-advertencia: #FFC107; 
    --color-peligro: #DC3545;     
    --color-info: #0DCAF0;        

    /* Diseño */
    --border-radius-tarjeta: 8px;
    --border-radius-boton: 6px;
    --sombra-tarjeta: 0 4px 12px rgba(0, 0, 0, 0.05);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* FIX: Altura real del 100% para permitir que flexbox estire la tabla */
html, body {
    height: 100%;
    overflow: hidden; /* Evita doble barra de scroll */
    font-family: 'Inter', sans-serif;
    background-color: var(--color-fondo-pagina);
    color: var(--color-texto-principal);
    font-size: 15px;
    font-weight: 400;
}

h1 {
    font-weight: 700;
    font-size: 28px;
    color: var(--color-texto-principal);
    margin-bottom: 20px;
}

h2 {
    font-weight: 600;
    font-size: 20px;
}

/* --- 2. LAYOUT (MENÚ LATERAL) --- */

.layout-container {
    display: flex;
    height: 100%; /* FIX: Cambiado de min-height a height 100% */
    overflow: hidden;
}

.sidebar {
    width: 250px;
    background-color: var(--color-primario);
    color: var(--color-fondo-tarjeta);
    padding: 20px;
    display: flex;
    flex-direction: column;
    height: 100%;      
    overflow-y: auto;   
    transition: width 0.3s ease, padding 0.3s ease;
    z-index: 1000;
    flex-shrink: 0; /* Asegura que el sidebar no se aplaste */
}

/* --- CABECERA DEL SIDEBAR --- */
.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    min-height: 40px;
}

.brand-title {
    font-size: 22px;
    font-weight: 700;
    color: white;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity 0.2s ease;
}

/* Botón Hamburguesa Interno */
.btn-internal-toggle {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}
.btn-internal-toggle:hover {
    color: white;
    background-color: rgba(255, 255, 255, 0.1);
}

/* --- NAVEGACIÓN --- */

.sidebar-nav {
    list-style-type: none;
    flex-grow: 1;
}

.sidebar-nav li {
    margin-bottom: 5px;
}

.sidebar-nav a {
    color: var(--color-fondo-tarjeta);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    border-radius: var(--border-radius-boton);
    transition: background-color 0.3s ease;
    font-weight: 500;
    border-left: 3px solid transparent;
    white-space: nowrap;
}

.sidebar-nav a i {
    min-width: 20px;
    text-align: center;
    font-size: 18px;
}

.sidebar-nav a:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.sidebar-nav a.active {
    background-color: rgba(0, 123, 255, 0.1);
    border-left: 3px solid var(--color-acento);
    font-weight: 600;
}

.sidebar-footer {
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.sidebar-footer button {
    width: 100%;
    background-color: var(--color-peligro);
    justify-content: center;
    gap: 10px;
}

.main-content {
    flex-grow: 1;
    padding: 30px;
    transition: margin-left 0.3s ease;
    
    /* FIX: Configuración para que el contenido ocupe el 100% correctamente */
    display: flex;           
    flex-direction: column;  
    height: 100%;           
    overflow-y: auto; /* Scroll normal para páginas que no son el POS */
    overflow-x: hidden;
    position: relative;
}

/* --- ESTILOS COLAPSADOS (Escritorio) --- */

.layout-container.sidebar-collapsed .sidebar {
    width: 80px;
    padding-left: 10px;
    padding-right: 10px;
}

.layout-container.sidebar-collapsed .brand-title,
.layout-container.sidebar-collapsed .sidebar-nav a span,
.layout-container.sidebar-collapsed .sidebar-footer .btn span,
.layout-container.sidebar-collapsed .sidebar-nav li.nav-separator {
    display: none;
}

.layout-container.sidebar-collapsed .sidebar-header {
    justify-content: center;
}

.layout-container.sidebar-collapsed .sidebar-nav a {
    justify-content: center;
    padding: 12px 0;
}
.layout-container.sidebar-collapsed .sidebar-nav a i {
    font-size: 22px;
}

/* --- BOTONES GENERALES --- */

button, .btn {
    padding: 10px 16px;
    border: none;
    border-radius: var(--border-radius-boton);
    font-size: 15px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary { background-color: var(--color-exito); color: white; }
.btn-primary:hover { background-color: #157347; }

.btn-edit { background-color: var(--color-advertencia); color: var(--color-texto-principal); }
.btn-edit:hover { background-color: #FFCA2C; }

.btn-delete, .btn-icon-delete { background-color: var(--color-peligro); color: white; }
.btn-delete:hover, .btn-icon-delete:hover { background-color: #BB2D3B; }

.btn-secondary {
    background-color: transparent;
    border: 1px solid var(--color-texto-secundario);
    color: var(--color-texto-secundario);
}
.btn-secondary:hover {
    background-color: var(--color-texto-secundario);
    color: white;
}

.btn-add-mov {
    background-color: var(--color-acento);
    color: white;
    padding: 6px 12px;
}
.btn-add-mov:hover { background-color: #0069D9; }

.btn-detail {
    background-color: var(--color-texto-secundario);
    color: white;
}
.btn-detail:hover { background-color: var(--color-primario); }

/* --- TABLAS --- */
.header-bar {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 10px;
}

/* --- TARJETAS --- */

/* Contenedor de tabla general */
.table-container {
    background-color: transparent !important; 
    border: none !important;      
    box-shadow: none !important;  
    padding: 0 5px;
    /* FIX: Por defecto flex para el POS */
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

table {
    width: 100%;
    border-collapse: separate !important; 
    border-spacing: 0 10px; /* Separación vertical entre filas */
}

/* FIX: Sticky Header para que los títulos se queden fijos al scrollear la tabla */
thead tr th {
    background-color: #f8f9fa;
    color: #6C757D;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 12px;
    padding: 10px 15px;
    border: none;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05); /* Sombra para distinguir el header */
}

tbody tr {
    background-color: #FFFFFF;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02); 
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

tbody tr:hover {
    transform: translateY(-2px); 
    box-shadow: 0 6px 12px rgba(0,0,0,0.05);
    z-index: 10;
}

tbody td {
    padding: 15px 15px; 
    border: none; 
    vertical-align: middle;
    border-top: 1px solid #eee;   
    border-bottom: 1px solid #eee; 
}

tbody td:first-child {
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
    border-left: 1px solid #eee;
}

tbody td:last-child {
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
    border-right: 1px solid #eee;
}

.actions-cell {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.btn-detail {
    background-color: #6C757D;
    color: white;
    width: 35px; height: 35px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 6px;
    padding: 0;
}

.btn-history {
    background-color: #E9ECEF;
    color: #495057;
    border: none;
    width: 35px; height: 35px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 6px;
    padding: 0;
}

.btn-edit {
    background-color: #FFC107;
    color: #000;
    width: 35px; height: 35px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 6px;
    padding: 0;
}

.btn-icon-delete {
    background-color: #DC3545;
    color: white;
    width: 35px; height: 35px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 6px;
    padding: 0;
}

.btn-add-mov {
    background-color: #0D6EFD;
    color: white;
    width: 35px; height: 35px;
    border-radius: 6px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
}

/* --- TARJETAS --- */
.dashboard-grid, .config-menu-grid, .detail-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; margin-bottom: 20px;
}
.widget-card, .config-card, .detail-card {
    background-color: var(--color-fondo-tarjeta); border-radius: var(--border-radius-tarjeta);
    box-shadow: var(--sombra-tarjeta); padding: 20px; border: 1px solid var(--color-bordes);
    text-decoration: none; color: inherit; transition: transform 0.2s; display: block;
}
.config-card:hover { transform: translateY(-5px); border-color: var(--color-acento); }
.widget-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; border-bottom: 1px solid var(--color-bordes); padding-bottom: 10px; }
.widget-header i { font-size: 24px; color: var(--color-texto-secundario); }
.widget-header h3 { font-size: 16px; margin: 0; color: var(--color-texto-secundario); }
.widget-value { font-size: 32px; font-weight: 700; color: var(--color-texto-principal); }
.widget-detail { font-size: 13px; color: var(--color-texto-secundario); margin-top: 5px; }
.widget-danger .widget-value, .text-danger { color: var(--color-peligro); }
.widget-success .widget-value, .text-success { color: var(--color-exito); }
.widget-warning .widget-value, .text-warning { color: var(--color-advertencia); }
.text-primary { color: var(--color-acento); }

/* --- FORMULARIOS --- */
.modal { display: none; position: fixed; z-index: 1100; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.5); }
.modal-content, .scanner-modal-content { background-color: white; margin: 5% auto; padding: 0; border: 0; width: 90%; max-width: 500px; border-radius: 8px; animation: slide-down 0.3s ease-out; }
@keyframes slide-down { from { transform: translateY(-30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-header { padding: 20px; background: var(--color-primario); color: white; display: flex; justify-content: space-between; border-radius: 8px 8px 0 0; }
.modal-body { padding: 25px; }
.close-modal-button, .close-scanner-modal-button { cursor: pointer; font-size: 24px; }
.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 5px; font-weight: 500; color: var(--color-texto-secundario); }
.form-group-row { display: flex; gap: 15px; }
.form-group-row > .form-group { flex: 1; margin-bottom: 0; }
.form-group.flex-2 { flex: 2; }
input, select, textarea { width: 100%; padding: 10px; border: 1px solid var(--color-bordes); border-radius: 6px; font-size: 15px; font-family: 'Inter', sans-serif; }
input:focus, select:focus { outline: none; border-color: var(--color-acento); box-shadow: 0 0 0 3px rgba(0,123,255,0.2); }

/* --- POS (Punto de Venta) --- */
/* FIX: Layout específico para POS que elimina el scroll global */
.pos-main-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 15px !important;
    overflow: hidden !important; /* El scroll lo maneja la tabla, no el body */
}

.pos-card { background: white; border-radius: 8px; box-shadow: var(--sombra-tarjeta); margin-bottom: 15px; border: 1px solid var(--color-bordes); }
.pos-section-header { padding: 10px 20px; background: #f8f9fa; border-bottom: 1px solid var(--color-bordes); display: flex; align-items: center; gap: 10px; }
.pos-subtotal-bar { padding: 15px 20px; text-align: right; font-size: 18px; border-top: 1px solid var(--color-bordes); }
.pos-footer { margin-top: auto; padding-top: 15px; border-top: 2px solid var(--color-bordes); }
.pos-scanner-bar { display: flex; gap: 10px; align-items: center; margin-bottom: 15px; position: relative; }
.pos-payment-bar { display: flex; justify-content: space-between; align-items: flex-end; }
.pos-total-display { display: flex; align-items: flex-end; gap: 15px; }
.total-value-final { font-size: 36px; font-weight: 800; color: var(--color-exito); }

/* --- ESTILOS ADICIONALES (Badges, Tabla Items, Buscador) --- */

/* Badges */
.status-badge { padding: 4px 8px; border-radius: 4px; font-size: 11px; font-weight: bold; text-transform: uppercase; color: white; }
.status-aprobado { background: var(--color-exito); }
.status-pendiente { background: var(--color-advertencia); color: #664d03; }
.status-anulado { background: var(--color-peligro); text-decoration: line-through; }
.status-facturado { background: #198754; }
.status-no-facturable { background: #e9ecef; color: #666; }

/* Sección Artículos y Buscador */
.articles-section { background: #fff; border: 1px solid #dee2e6; border-radius: 8px; padding: 20px; box-shadow: 0 2px 4px rgba(0,0,0,0.05); margin-bottom: 20px; }
.search-bar-container { display: flex; gap: 10px; margin-bottom: 15px; }
.search-bar-container input { flex: 1; padding: 12px 15px; font-size: 16px; border: 2px solid #e9ecef; border-radius: 6px; transition: border-color 0.3s; }
.search-bar-container input:focus { border-color: var(--color-primario, #0d6efd); outline: none; }

/* Tabla del Carrito */
.cart-table-container { min-height: 300px; max-height: 500px; overflow-y: auto; border: 1px solid #f0f0f0; border-radius: 6px; background-color: #fafafa; }
.cart-table { width: 100%; border-collapse: collapse; background: white; }
.cart-table th { background-color: #f8f9fa; color: #495057; font-weight: 600; padding: 12px; text-align: left; position: sticky; top: 0; border-bottom: 2px solid #dee2e6; }
.cart-table td { padding: 10px 12px; border-bottom: 1px solid #dee2e6; vertical-align: middle; }

/* Footer y Totales */
.sales-footer { margin-top: 20px; padding-top: 15px; border-top: 2px solid #f0f0f0; display: flex; justify-content: space-between; align-items: flex-end; }
.totals-panel { display: flex; gap: 20px; align-items: center; background: #f8f9fa; padding: 15px; border-radius: 8px; }
.final-price { font-size: 28px; font-weight: 700; color: #198754; }

/* Menú Desplegable Buscador */
.search-dropdown-menu {
    display: none; position: absolute; bottom: 100%; left: 0; width: 100%; max-height: 300px;
    overflow-y: auto; background: white; border: 1px solid #ccc; border-radius: 4px; box-shadow: 0 -4px 10px rgba(0,0,0,0.15); z-index: 10000;
}
.search-result-item { padding: 10px 15px; border-bottom: 1px solid #eee; cursor: pointer; font-size: 14px; color: #333; transition: background 0.2s; }
.search-result-item:hover { background-color: #e9ecef; color: #000; }

/* =========================================
   FIX CRÍTICO: Layout POS Full Height
   ========================================= */

/* Hacemos que el formulario use todo el espacio */
#pos-form { display: flex; flex-direction: column; height: 100%; gap: 15px; }

/* La tarjeta de la tabla (la segunda) debe crecer */
#pos-form > .pos-card:nth-child(2) {
    flex-grow: 1 !important;
    flex-shrink: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    min-height: 0 !important; /* CRÍTICO para que funcione el scroll interno */
    margin-bottom: 0 !important;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

/* El contenedor de la tabla usa el espacio sobrante */
#pos-form .table-container {
    flex-grow: 1;
    height: 100%;
    overflow-y: auto; /* Aquí ocurre el scroll */
    min-height: 0; /* Resetear alturas mínimas viejas */
}

/* Visualización de Totales */
.pos-total-display { display: flex; flex-direction: row; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 10px; min-width: 300px; }
.pos-total-display > div:last-of-type { text-align: right; margin-left: auto; display: flex; flex-direction: column; justify-content: center; }
.total-label { font-size: 13px; color: #666; white-space: nowrap; margin-bottom: 0px; }
.total-value-final { font-size: 32px; line-height: 1.1; font-weight: 800; color: #2c7a7b; white-space: nowrap; display: block; }
@media (max-width: 1366px) { .total-value-final { font-size: 24px; } }

/* --- 9. RESPONSIVE (MÓVIL/TABLET - Menor a 1024px) --- */

.btn-mobile-float { display: none; } /* Oculto en escritorio por defecto */

@media (max-width: 1024px) {
    /* --- A. SIDEBAR (Menú Lateral) --- */
    .sidebar {
        position: fixed; top: 0; bottom: 0; left: -100%;
        width: 280px !important; z-index: 2000; box-shadow: none;
        transition: left 0.3s ease; display: flex; flex-direction: column; padding: 20px;
    }
    
    /* ESTADO ABIERTO */
    .layout-container.sidebar-collapsed .sidebar { left: 0 !important; box-shadow: 5px 0 15px rgba(0,0,0,0.5); }
    
    /* HEADER DEL SIDEBAR */
    .sidebar-header { display: flex; justify-content: space-between; align-items: center; width: 100%; }
    .sidebar-header .btn-internal-toggle { display: inline-flex !important; color: white; font-size: 28px; background: transparent; border: none; padding: 5px; cursor: pointer; }

    /* Forzar visibilidad de textos */
    .layout-container.sidebar-collapsed .brand-title,
    .layout-container.sidebar-collapsed .sidebar-nav a span,
    .layout-container.sidebar-collapsed .sidebar-footer .btn span,
    .layout-container.sidebar-collapsed .sidebar-nav li.nav-separator { display: inline !important; }
    .layout-container.sidebar-collapsed .sidebar-nav a { padding-left: 15px; justify-content: flex-start; }

    /* --- B. CONTENIDO PRINCIPAL --- */
    .main-content { margin-left: 0 !important; padding: 15px; width: 100%; padding-top: 80px; }

    /* --- C. BOTÓN FLOTANTE --- */
    .btn-mobile-float {
        display: inline-flex !important; position: fixed; top: 15px; left: 15px; z-index: 100;
        background: var(--color-primario); color: white; width: 45px; height: 45px;
        align-items: center; justify-content: center; border-radius: 50%;
        box-shadow: 0 4px 12px rgba(0,0,0,0.3); border: none; font-size: 22px; transition: opacity 0.2s;
    }
    .layout-container.sidebar-collapsed .btn-mobile-float { display: none !important; opacity: 0; pointer-events: none; }

    /* --- D. OVERLAY --- */
    .layout-container.sidebar-collapsed::before {
        content: ''; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(0,0,0,0.6); z-index: 1500; animation: fadeIn 0.3s;
    }
    @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

    /* Ajustes generales formularios móvil */
    .form-group-row { flex-direction: column; gap: 0; }
    .form-group-row > .form-group { margin-bottom: 15px; }
    .table-container { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    
    /* Layout Vertical de Totales en Tablet */
    .pos-payment-bar { flex-direction: column; align-items: stretch; gap: 20px; }
    .pos-total-display { flex-direction: column; align-items: stretch; }
    .total-value-final { text-align: center; background: #f8f9fa; padding: 10px; border-radius: 8px; }
    #pos-confirmar-btn { width: 100%; }
}

/* =========================================
   10. AJUSTE RESPONSIVE (Mantener Full Height)
   ========================================= */
@media (max-width: 991px) {
    /* FIX: Permitimos que Flexbox siga controlando la altura incluso en móvil
       para cumplir con tu requisito de "ajustar a toda la pantalla".
       Eliminamos el bloqueo de scroll y alturas fijas anteriores. */
    
    .pos-footer {
        position: relative !important;
        margin-top: 0;
        padding-bottom: 20px !important;
        background-color: #fff;
        z-index: 10;
        border-top: 1px solid #eee;
    }
    
    /* Layout de Totales Vertical */
    .pos-payment-bar { flex-direction: column; align-items: stretch; gap: 20px; }
    .pos-total-display { flex-direction: column; align-items: stretch; }
    .pos-total-display > div:last-of-type { text-align: center; margin: 15px 0; }
    .total-value-final { text-align: center; background: #f8f9fa; padding: 10px; border-radius: 8px; margin-top: 5px; }
    #pos-confirmar-btn { width: 100%; }
}

/* --- MODAL SELECCIÓN DE VARIANTES --- */
.variant-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    margin-top: 15px;
}

.btn-variant-option {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.btn-variant-option:hover {
    background-color: var(--color-primario);
    color: white;
    transform: translateY(-2px);
    border-color: var(--color-primario);
}

.btn-variant-option .variant-stock {
    font-size: 11px;
    margin-top: 5px;
    opacity: 0.8;
}

.btn-variant-option.out-of-stock {
    opacity: 0.5;
    background-color: #eee;
    cursor: not-allowed;
}

/* --- NOTIFICACIÓN DE ÉXITO (POPUP ANIMADO) --- */
.success-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.3);
    display: flex; justify-content: center; align-items: center;
    z-index: 9999;
    animation: fadeIn 0.2s ease-out;
}

.success-box {
    background: white;
    padding: 30px 50px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    text-align: center;
    transform: scale(0.8);
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.success-message {
    margin-top: 15px;
    font-size: 18px;
    font-weight: 600;
    color: #333;
    font-family: 'Inter', sans-serif;
}

/* ANIMACIÓN DEL CHECK VERDE */
.checkmark-circle {
    width: 60px; height: 60px; position: relative;
    display: inline-block; vertical-align: top;
}
.checkmark-circle .background {
    width: 60px; height: 60px;
    border-radius: 50%; background: #28a745;
    position: absolute; left: 0; top: 0;
    animation: scale .4s ease-in-out .2s both;
}
.checkmark-circle .checkmark {
    border-radius: 5px; stroke: #fff; stroke-width: 3; stroke-miterlimit: 10;
    box-shadow: inset 0px 0px 0px #28a745;
    animation: fill .4s ease-in-out .4s forwards, scale .3s ease-in-out .9s both;
    position: absolute; left: 0; top: 0; width: 60px; height: 60px;
    z-index: 10;
}
.checkmark-circle .check {
    transform-origin: 50% 50%; stroke-dasharray: 48; stroke-dashoffset: 48;
    animation: stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.5s forwards;
}

@keyframes stroke { 100% { stroke-dashoffset: 0; } }
@keyframes scale { 0%, 100% { transform: none; } 50% { transform: scale3d(1.1, 1.1, 1); } }
@keyframes fill { 100% { box-shadow: inset 0px 0px 0px 30px #28a745; } }
@keyframes popIn { from { transform: scale(0.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* =========================================
   10. OPTIMIZACIÓN FINAL PARA MÓVILES (Smartphone)
   ========================================= */
@media (max-width: 991px) {
    /* 1. Liberar el scroll global */
    html, body { 
        height: auto !important; 
        overflow-y: auto !important; 
        position: static !important; 
    }
    
    /* 2. Romper la estructura flex rígida */
    .layout-container, .pos-main-content, #pos-form {
        height: auto !important; 
        min-height: 100vh; 
        display: block !important; 
        padding: 10px !important;
        overflow: visible !important;
    }

    /* 3. Ajustar tarjetas para que se apilen */
    .pos-card {
        height: auto !important;
        flex-grow: 0 !important;
        margin-bottom: 15px !important;
        border-radius: 8px !important;
    }

    /* 4. Tabla de productos con altura fija para que no se haga eterna */
    .pos-card:nth-child(2) {
        display: block !important;
    }
    
    .pos-card:nth-child(2) .table-container {
        height: 300px !important; /* Altura fija solo para la lista de items */
        max-height: 50vh;
        overflow-y: auto !important;
        border: 1px solid #eee;
        background: #fafafa;
    }

    /* 5. Footer (Totales y Botón) al final natural de la página */
    .pos-footer {
        position: relative !important; 
        margin-top: 20px;
        padding-bottom: 80px !important; /* Espacio extra para evitar que el navegador tape el botón */
        background-color: transparent;
        border-top: none;
        display: block !important;
    }

    /* 6. Reorganizar la barra de pago para que sea vertical */
    .pos-payment-bar {
        flex-direction: column !important;
        gap: 15px;
    }

    .pos-total-display {
        flex-direction: column !important;
        align-items: stretch !important;
        width: 100%;
        margin-top: 15px;
    }

    .pos-total-display > div {
        text-align: center !important;
        margin-bottom: 10px;
    }

    /* 7. Botón de Cobrar Gigante y Flotante (Opcional, pero mejor UX) */
    #pos-confirmar-btn {
        width: 100% !important;
        height: 60px !important;
        font-size: 18px !important;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 9999;
        border-radius: 0 !important;
        box-shadow: 0 -4px 10px rgba(0,0,0,0.2);
        margin: 0 !important;
    }
    
    /* Ajuste para que el botón flotante no tape el contenido final */
    body {
        padding-bottom: 70px; 
    }

    /* 8. Scanner y Buscador en una línea */
    .pos-scanner-bar {
        flex-direction: column;
        align-items: stretch;
    }
    .pos-scanner-bar input {
        font-size: 16px !important; /* Evita zoom en iPhone */
        padding: 12px;
    }
}

/* --- ESTILOS DE VARIANTES (Responsive) --- */

/* 1. Estilo Base (Escritorio/Tablet) */
.variants-header {
    display: flex; gap: 10px; margin-bottom: 10px;
    font-size: 12px; font-weight: bold; color: #555;
}
.variants-header span { flex: 1; }
.variants-header .col-name { flex: 2; }
.variants-header .col-ean { flex: 1.5; }
.variants-header .col-action { flex: 0 0 40px; }

.variant-row {
    display: flex; align-items: flex-start; gap: 10px; margin-bottom: 8px;
    background: #fff;
}

.variant-inputs-container {
    display: flex; flex: 1; gap: 10px; width: 100%;
}

.var-group-main { display: flex; flex: 3.5; gap: 10px; }
.var-group-main .var-name { flex: 2; }
.var-group-main .var-ean { flex: 1.5; }

.var-group-numbers { display: flex; flex: 4; gap: 10px; }
.var-group-numbers .input-wrapper { flex: 1; }

.mobile-label { display: none; } /* Ocultamos etiquetas internas en PC */
.input-min { border-color: #ffc107 !important; }

.variant-inactive { opacity: 0.5; pointer-events: none; }

/* --- MODO MÓVIL (Menos de 768px) --- */
@media (max-width: 768px) {
    
    /* Ocultamos el encabezado tipo tabla */
    .variants-header { display: none; }

    /* Transformamos la fila en una TARJETA */
    .variant-row {
        flex-direction: row; 
        flex-wrap: nowrap;
        background: #fff;
        border: 1px solid #dee2e6;
        border-radius: 8px;
        padding: 15px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.02);
        gap: 10px;
    }

    .variant-inputs-container {
        flex-direction: column;
        gap: 15px;
    }

    /* Grupo 1: Nombre y EAN */
    .var-group-main {
        flex-direction: column;
        flex: 1;
        gap: 10px;
    }

    /* Grupo 2: Números (Grid de 2x2) */
    .var-group-numbers {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    /* Mostramos las etiquetas */
    .mobile-label {
        display: block;
        font-size: 10px;
        font-weight: 700;
        color: #adb5bd;
        text-transform: uppercase;
        margin-bottom: 2px;
    }

    /* Botón borrar alineado */
    .btn-icon-delete, .btn-success {
        height: auto; align-self: center; background: transparent; color: #dc3545; border: none;
    }
}

/* --- ESTILO SIDEBAR "IMPULZA" --- */

:root {
    --sidebar-width: 260px;
    --sidebar-bg: #1e2227; /* Gris oscuro profesional */
    --sidebar-text: #adb5bd;
    --sidebar-hover: rgba(255,255,255,0.08);
    --primary-color: #0d6efd; /* Azul Impulza */
}

/* El link base */
.nav-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 15px;
    margin: 4px 12px; /* Margen a los lados crea el efecto flotante */
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: 8px; /* Bordes redondeados */
    transition: all 0.2s ease;
    font-size: 0.9rem;
    font-weight: 500;
}

.nav-link .link-wrapper { display: flex; align-items: center; gap: 12px; }
.nav-link i { font-size: 1.1rem; width: 24px; text-align: center; }

/* Efecto Hover */
.nav-link:hover {
    background-color: var(--sidebar-hover);
    color: white;
}

/* Estado Activo (La Pastilla Azul) */
.nav-link.active {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.4); /* Sombra suave */
}

/* Submenú */
.sub-menu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
    background-color: rgba(0,0,0,0.15); /* Ligeramente más oscuro */
    margin: 0 12px; /* Alineado con los botones padre */
    border-radius: 8px;
}

.menu-item-has-children.open .sub-menu {
    max-height: 500px; /* Abrir */
    margin-bottom: 10px;
}

.sub-menu a {
    padding: 8px 15px 8px 45px; /* Indentación */
    font-size: 0.85rem;
    color: #8a96a3;
    display: block;
    text-decoration: none;
}
.sub-menu a:hover { color: white; }

/* Etiquetas de Sección (TABLERO, EL MOSTRADOR...) */
.nav-label {
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 1px;
    color: #495057;
    margin: 20px 0 5px 20px;
    text-transform: uppercase;
}

/* Flecha rotatoria */
.arrow { transition: transform 0.3s; font-size: 0.7rem; }
.menu-item-has-children.open .arrow { transform: rotate(180deg); }


/*
 * Impulza ERP - Hoja de Estilos Maestra
 * Versión: Dark Sidebar + Clean Content
 */

/* --- 1. GLOBALES Y TIPOGRAFÍA --- */

:root {
    /* --- PALETA GENERAL (EXISTENTE) --- */
    --color-primario: #2C3E50;
    --color-acento: #0d6efd;
    --color-fondo-pagina: #F8F9FA;
    --color-fondo-tarjeta: #FFFFFF;
    --color-texto-principal: #212529;
    --color-texto-secundario: #6C757D;
    --color-bordes: #DEE2E6;

    --color-exito: #198754;       
    --color-advertencia: #FFC107; 
    --color-peligro: #DC3545;     
    --color-info: #0DCAF0;        

    /* --- NUEVAS VARIABLES PARA SIDEBAR DARK --- */
    --sidebar-width: 260px;
    --sidebar-bg: #0f172a; /* Azul noche profundo (Moderno) */
    --sidebar-text: #94a3b8; /* Gris azulado para texto inactivo */
    --sidebar-text-hover: #ffffff;
    --sidebar-item-hover: rgba(255, 255, 255, 0.1);
    --sidebar-active-bg: #0d6efd; /* Azul brillante "Impulza" */
    --sidebar-active-shadow: 0 4px 12px rgba(13, 110, 253, 0.4);

    /* Diseño */
    --border-radius-tarjeta: 12px;
    --border-radius-boton: 6px;
    --sombra-tarjeta: 0 2px 10px rgba(0, 0, 0, 0.03);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    height: 100%;
    overflow: hidden; /* El scroll lo manejan los contenedores internos */
    font-family: 'Inter', sans-serif;
    background-color: var(--color-fondo-pagina);
    color: var(--color-texto-principal);
    font-size: 14px; /* Un poco más elegante */
}

h1 { font-weight: 700; font-size: 24px; color: #1e293b; margin-bottom: 20px; }
h2 { font-weight: 600; font-size: 18px; }

/* ==========================================================
   2. LAYOUT Y SIDEBAR (DISEÑO IMPULZA DARK)
   ========================================================== */

.layout-container {
    display: flex;
    height: 100%;
    overflow: hidden;
}

/* El Contenedor del Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    height: 100%;
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    border-right: 1px solid rgba(255,255,255,0.05);
}

/* Header (Logo) */
.sidebar-header {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand-icon { 
    background: white; color: var(--sidebar-bg); 
    width: 32px; height: 32px; border-radius: 6px; 
    display: flex; align-items: center; justify-content: center; font-size: 18px; 
}
.brand-title { color: white; font-size: 18px; font-weight: 700; letter-spacing: -0.5px; margin: 0; }

/* Contenido Scrolleable del Menú */
.sidebar-content {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px 12px;
    
    /* Scrollbar fino oscuro */
    scrollbar-width: thin;
    scrollbar-color: #334155 transparent;
}
.sidebar-content::-webkit-scrollbar { width: 4px; }
.sidebar-content::-webkit-scrollbar-thumb { background-color: #334155; border-radius: 4px; }

/* Lista de Navegación */
.sidebar-nav ul { list-style: none; padding: 0; margin: 0; }

/* Etiquetas de Sección (ej: PRINCIPAL) */
.nav-label {
    font-size: 11px;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin: 20px 0 8px 12px;
}

/* Enlaces del Menú */
.nav-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    margin-bottom: 4px;
    border-radius: 8px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
}

.nav-link .link-wrapper { display: flex; align-items: center; gap: 12px; }
.nav-link i { font-size: 18px; width: 20px; text-align: center; }
.nav-link .arrow { font-size: 12px; transition: transform 0.3s; }

/* Hover y Activo */
.nav-link:hover {
    background-color: var(--sidebar-item-hover);
    color: var(--sidebar-text-hover);
}

.nav-link.active {
    background-color: var(--sidebar-active-bg);
    color: white;
    box-shadow: var(--sidebar-active-shadow);
}
.nav-link.active i { color: white; }

/* Submenús (Acordeón) */
.sub-menu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    padding-left: 0;
}

.menu-item-has-children.open .sub-menu {
    max-height: 500px; /* Altura arbitraria suficiente */
    transition: max-height 0.5s ease-in;
}

.menu-item-has-children.open > .nav-link {
    color: var(--sidebar-text-hover);
}
.menu-item-has-children.open > .nav-link .arrow {
    transform: rotate(180deg);
}

/* Enlaces del Submenú */
.sub-menu a {
    padding: 8px 12px 8px 48px; /* Indentación visual */
    font-size: 13px;
    color: #64748b;
    display: block;
    text-decoration: none;
    position: relative;
    transition: color 0.2s;
}
.sub-menu a:hover { color: var(--sidebar-text-hover); }
.sub-menu a.active { color: var(--color-acento); font-weight: 600; }
.sub-menu a.active::before {
    content: ''; position: absolute; left: 30px; top: 50%; transform: translateY(-50%);
    width: 4px; height: 4px; border-radius: 50%; background-color: var(--color-acento);
}

/* Footer del Sidebar */
.sidebar-footer {
    padding: 15px 20px;
    border-top: 1px solid rgba(255,255,255,0.05);
    background-color: rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.btn-logout {
    background: none; border: none; color: #ef4444; font-size: 18px; cursor: pointer; padding: 5px;
    transition: transform 0.2s;
}
.btn-logout:hover { transform: translateX(3px); color: #ff6b6b; }

/* Badge de Notificación */
.badge-pill {
    background-color: var(--color-peligro);
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: bold;
}

/* --- RESPONSIVE MÓVIL (SIDEBAR) --- */
.mobile-menu-btn {
    position: fixed; bottom: 20px; right: 20px;
    width: 50px; height: 50px;
    background-color: var(--color-acento);
    color: white;
    border: none; border-radius: 50%;
    box-shadow: 0 4px 15px rgba(13, 110, 253, 0.4);
    z-index: 2000;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px; cursor: pointer;
}

.sidebar-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); z-index: 1005;
    opacity: 0; visibility: hidden; transition: all 0.3s;
    backdrop-filter: blur(2px);
}

@media (max-width: 1024px) {
    .sidebar {
        position: fixed; top: 0; left: -100%; height: 100%;
        box-shadow: 5px 0 25px rgba(0,0,0,0.2);
    }
    .sidebar.active { left: 0; }
    .sidebar-overlay.active { opacity: 1; visibility: visible; }
    .main-content { margin-left: 0; width: 100%; }
}
@media (min-width: 1025px) {
    .mobile-menu-btn, .sidebar-overlay, .close-sidebar-btn { display: none !important; }
}

/* ==========================================================
   3. ÁREA PRINCIPAL Y COMPONENTES (Estilos existentes)
   ========================================================== */

.main-content {
    flex-grow: 1;
    padding: 30px;
    overflow-y: auto;
    height: 100%;
    background-color: var(--color-fondo-pagina);
}

/* --- TARJETAS --- */
.dashboard-grid, .config-menu-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; margin-bottom: 20px; }
.widget-card, .config-card, .detail-card {
    background: white; border-radius: var(--border-radius-tarjeta);
    padding: 20px; border: 1px solid var(--color-bordes);
    box-shadow: var(--sombra-tarjeta); text-decoration: none; color: inherit;
    transition: transform 0.2s;
}
.widget-card:hover, .config-card:hover { transform: translateY(-3px); border-color: var(--color-acento); }

/* Headers */
.header-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; flex-wrap: wrap; gap: 15px; }

/* Botones */
.btn {
    padding: 10px 18px; border-radius: var(--border-radius-boton); border: none; font-weight: 600; cursor: pointer;
    display: inline-flex; align-items: center; gap: 8px; text-decoration: none; font-size: 14px; transition: all 0.2s;
}
.btn-primary { background: var(--color-acento); color: white; }
.btn-primary:hover { background: #0056b3; box-shadow: 0 4px 10px rgba(0,123,255,0.3); }
.btn-secondary { background: white; border: 1px solid #ccc; color: #555; }
.btn-secondary:hover { background: #f1f1f1; }
.btn-icon-delete { background: white; color: #dc3545; border: 1px solid #f8d7da; padding: 6px 10px; }
.btn-icon-delete:hover { background: #dc3545; color: white; }

/* Tablas */
.table-container { background: white; border-radius: 12px; border: 1px solid var(--color-bordes); overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
th { background: #f8f9fa; padding: 12px 15px; text-align: left; font-size: 12px; text-transform: uppercase; color: #64748b; font-weight: 600; }
td { padding: 12px 15px; border-bottom: 1px solid #f1f5f9; color: #334155; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8fafc; }

/* Badges Status */
.status-badge { padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; text-transform: uppercase; }
.status-aprobado { background: #dcfce7; color: #166534; }
.status-pendiente { background: #fef9c3; color: #854d0e; }
.status-anulado { background: #fee2e2; color: #991b1b; }

/* Inputs */
input, select, textarea {
    width: 100%; padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 6px;
    font-size: 14px; transition: border-color 0.2s;
}
input:focus, select:focus { outline: none; border-color: var(--color-acento); box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.1); }
.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 500; font-size: 13px; color: #475569; }
.form-group-row { display: flex; gap: 15px; }
.form-group-row > div { flex: 1; }

@media (max-width: 768px) {
    .form-group-row { flex-direction: column; gap: 0; }
    .header-bar { flex-direction: column; align-items: stretch; }
    .btn { width: 100%; justify-content: center; }
}

/*
 * Impulza ERP - Hoja de Estilos Maestra
 * Versión: Dark Sidebar + Mobile Fixes
 */

/* --- 1. GLOBALES Y TIPOGRAFÍA --- */

:root {
    /* --- PALETA GENERAL --- */
    --color-primario: #2C3E50;
    --color-acento: #0d6efd;
    --color-fondo-pagina: #F8F9FA;
    --color-fondo-tarjeta: #FFFFFF;
    --color-texto-principal: #212529;
    --color-texto-secundario: #6C757D;
    --color-bordes: #DEE2E6;

    --color-exito: #198754;       
    --color-advertencia: #FFC107; 
    --color-peligro: #DC3545;     
    --color-info: #0DCAF0;        

    /* --- VARIABLES SIDEBAR DARK --- */
    --sidebar-width: 260px;
    --sidebar-bg: #0f172a; /* Azul noche profundo */
    --sidebar-text: #94a3b8; 
    --sidebar-text-hover: #ffffff;
    --sidebar-item-hover: rgba(255, 255, 255, 0.1);
    --sidebar-active-bg: #0d6efd; 
    --sidebar-active-shadow: 0 4px 12px rgba(13, 110, 253, 0.4);

    /* Diseño */
    --border-radius-tarjeta: 12px;
    --border-radius-boton: 6px;
    --sombra-tarjeta: 0 2px 10px rgba(0, 0, 0, 0.03);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    height: 100%;
    overflow: hidden; 
    font-family: 'Inter', sans-serif;
    background-color: var(--color-fondo-pagina);
    color: var(--color-texto-principal);
    font-size: 14px; 
}

h1 { font-weight: 700; font-size: 24px; color: #1e293b; margin-bottom: 20px; }
h2 { font-weight: 600; font-size: 18px; }

/* ==========================================================
   2. LAYOUT Y SIDEBAR (DARK THEME)
   ========================================================== */

.layout-container {
    display: flex;
    height: 100%;
    overflow: hidden;
}

/* El Contenedor del Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    height: 100%;
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    border-right: 1px solid rgba(255,255,255,0.05);
}

/* Header (Logo) */
.sidebar-header {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand-icon { 
    background: white; color: var(--sidebar-bg); 
    width: 32px; height: 32px; border-radius: 6px; 
    display: flex; align-items: center; justify-content: center; font-size: 18px; 
}
.brand-title { color: white; font-size: 18px; font-weight: 700; letter-spacing: -0.5px; margin: 0; }

/* Contenido Scrolleable del Menú */
.sidebar-content {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px 12px;
    scrollbar-width: thin;
    scrollbar-color: #334155 transparent;
}
.sidebar-content::-webkit-scrollbar { width: 4px; }
.sidebar-content::-webkit-scrollbar-thumb { background-color: #334155; border-radius: 4px; }

/* Lista de Navegación */
.sidebar-nav ul { list-style: none; padding: 0; margin: 0; }

.nav-label {
    font-size: 11px; font-weight: 700; color: #475569;
    text-transform: uppercase; letter-spacing: 0.8px; margin: 20px 0 8px 12px;
}

/* Enlaces del Menú */
.nav-link {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 12px; margin-bottom: 4px; border-radius: 8px;
    color: var(--sidebar-text); text-decoration: none; font-weight: 500;
    transition: all 0.2s ease; cursor: pointer;
}

.nav-link .link-wrapper { display: flex; align-items: center; gap: 12px; }
.nav-link i { font-size: 18px; width: 20px; text-align: center; }
.nav-link .arrow { font-size: 12px; transition: transform 0.3s; }

.nav-link:hover { background-color: var(--sidebar-item-hover); color: var(--sidebar-text-hover); }
.nav-link.active { background-color: var(--sidebar-active-bg); color: white; box-shadow: var(--sidebar-active-shadow); }
.nav-link.active i { color: white; }

/* Submenús */
.sub-menu { max-height: 0; overflow: hidden; transition: max-height 0.3s ease-out; padding-left: 0; }
.menu-item-has-children.open .sub-menu { max-height: 500px; transition: max-height 0.5s ease-in; }
.menu-item-has-children.open > .nav-link { color: var(--sidebar-text-hover); }
.menu-item-has-children.open > .nav-link .arrow { transform: rotate(180deg); }

.sub-menu a {
    padding: 8px 12px 8px 48px; font-size: 13px; color: #64748b;
    display: block; text-decoration: none; position: relative; transition: color 0.2s;
}
.sub-menu a:hover { color: var(--sidebar-text-hover); }
.sub-menu a.active { color: var(--color-acento); font-weight: 600; }
.sub-menu a.active::before {
    content: ''; position: absolute; left: 30px; top: 50%; transform: translateY(-50%);
    width: 4px; height: 4px; border-radius: 50%; background-color: var(--color-acento);
}

/* Footer del Sidebar */
.sidebar-footer {
    padding: 15px 20px; border-top: 1px solid rgba(255,255,255,0.05);
    background-color: rgba(0,0,0,0.1); display: flex;
    justify-content: space-between; align-items: center;
}
.btn-logout {
    background: none; border: none; color: #ef4444; font-size: 18px; cursor: pointer; padding: 5px;
    transition: transform 0.2s;
}
.btn-logout:hover { transform: translateX(3px); color: #ff6b6b; }

.badge-pill {
    background-color: var(--color-peligro); color: white;
    font-size: 10px; padding: 2px 6px; border-radius: 10px; font-weight: bold;
}

/* --- RESPONSIVE MÓVIL (SIDEBAR FIX) --- */
.mobile-menu-btn {
    position: fixed; bottom: 20px; right: 20px;
    width: 50px; height: 50px;
    background-color: var(--color-acento);
    color: white;
    border: none; border-radius: 50%;
    box-shadow: 0 4px 15px rgba(13, 110, 253, 0.4);
    z-index: 2000;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px; cursor: pointer;
}

.sidebar-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); z-index: 1005;
    opacity: 0; visibility: hidden; transition: all 0.3s;
    backdrop-filter: blur(2px);
}

.btn-internal-toggle {
    display: none; /* Por defecto oculto en escritorio */
}

@media (max-width: 1024px) {
    .sidebar {
        position: fixed; top: 0; left: -100%; height: 100%;
        box-shadow: 5px 0 25px rgba(0,0,0,0.2);
        /* FIX: Z-Index mayor que overlay (1005) para que no se vea borroso ni bloqueado */
        z-index: 2100 !important; 
    }
    .sidebar.active { left: 0; }
    .sidebar-overlay.active { opacity: 1; visibility: visible; }
    
    .btn-internal-toggle {
        display: inline-flex; /* Mostrar X en móvil */
        cursor: pointer;
        z-index: 2200; /* Asegurar click */
    }

    .main-content { margin-left: 0; width: 100%; }
}

/* --- AJUSTES ESCRITORIO (Mayores a 1024px) --- */
@media (min-width: 1025px) {
    /* Ocultamos solo los elementos exclusivamente móviles */
    .mobile-menu-btn, .sidebar-overlay { 
        display: none !important; 
    }

    /* HACEMOS VISIBLE EL BOTÓN DE COLAPSAR EN ESCRITORIO */
    .btn-internal-toggle {
        display: inline-flex !important; /* Visible */
        background: transparent;
        border: 1px solid rgba(255,255,255,0.1);
        color: rgba(255,255,255,0.6);
        border-radius: 4px;
        padding: 4px 8px;
        font-size: 18px;
        cursor: pointer;
        transition: all 0.2s;
    }
    
    .btn-internal-toggle:hover {
        background: rgba(255,255,255,0.1);
        color: white;
    }

    /* Ajuste: Cuando está colapsado, centramos el botón */
    .layout-container.sidebar-collapsed .btn-internal-toggle {
        margin: 0 auto;
    }
}


/* ==========================================================
   3. ÁREA PRINCIPAL Y COMPONENTES
   ========================================================== */

.main-content {
    flex-grow: 1; padding: 30px; overflow-y: auto; height: 100%;
    background-color: var(--color-fondo-pagina);
}

/* Tarjetas */
.dashboard-grid, .config-menu-grid, .detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; margin-bottom: 20px; }
.widget-card, .config-card, .detail-card {
    background: white; border-radius: var(--border-radius-tarjeta);
    padding: 20px; border: 1px solid var(--color-bordes);
    box-shadow: var(--sombra-tarjeta); text-decoration: none; color: inherit;
    transition: transform 0.2s;
}
.widget-card:hover, .config-card:hover { transform: translateY(-3px); border-color: var(--color-acento); }

/* Headers y Tablas */
.header-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; flex-wrap: wrap; gap: 15px; }
.table-container { background: white; border-radius: 12px; border: 1px solid var(--color-bordes); overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
th { background: #f8f9fa; padding: 12px 15px; text-align: left; font-size: 12px; text-transform: uppercase; color: #64748b; font-weight: 600; }
td { padding: 12px 15px; border-bottom: 1px solid #f1f5f9; color: #334155; }
tr:last-child td { border-bottom: none; }

/* Botones Generales */
.btn {
    padding: 10px 18px; border-radius: var(--border-radius-boton); border: none; font-weight: 600; cursor: pointer;
    display: inline-flex; align-items: center; gap: 8px; text-decoration: none; font-size: 14px; transition: all 0.2s;
}
.btn-primary { background: var(--color-acento); color: white; }
.btn-primary:hover { background: #0056b3; }
.btn-secondary { background: white; border: 1px solid #ccc; color: #555; }
.btn-icon-delete { background: white; color: #dc3545; border: 1px solid #f8d7da; padding: 6px 10px; }

/* Badges */
.status-badge { padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; text-transform: uppercase; }
.status-aprobado { background: #dcfce7; color: #166534; }
.status-pendiente { background: #fef9c3; color: #854d0e; }
.status-anulado { background: #fee2e2; color: #991b1b; }

/* Inputs */
input, select, textarea {
    width: 100%; padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 6px;
    font-size: 14px; transition: border-color 0.2s;
}
input:focus, select:focus { outline: none; border-color: var(--color-acento); box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.1); }
.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 500; font-size: 13px; color: #475569; }
.form-group-row { display: flex; gap: 15px; }
.form-group-row > div { flex: 1; }

/* =========================================
   4. ESTILOS ESPECÍFICOS POS (VENTAS)
   ========================================= */

.pos-main-content {
    display: flex; flex-direction: column; height: 100%;
    padding: 15px !important; overflow: hidden !important;
}

.pos-card { background: white; border-radius: 8px; box-shadow: var(--sombra-tarjeta); margin-bottom: 15px; border: 1px solid var(--color-bordes); }
.pos-section-header { padding: 10px 20px; background: #f8f9fa; border-bottom: 1px solid var(--color-bordes); display: flex; align-items: center; gap: 10px; }
.pos-subtotal-bar { padding: 15px 20px; text-align: right; font-size: 18px; border-top: 1px solid var(--color-bordes); }
.pos-footer { margin-top: auto; padding-top: 15px; border-top: 2px solid var(--color-bordes); }

.pos-payment-bar { display: flex; justify-content: space-between; align-items: flex-end; }
.pos-total-display { display: flex; align-items: flex-end; gap: 15px; }
.total-value-final { font-size: 32px; font-weight: 800; color: var(--color-exito); }

/* FIX: Layout Full Height POS */
#pos-form { display: flex; flex-direction: column; height: 100%; gap: 15px; }
#pos-form > .pos-card:nth-child(2) {
    flex-grow: 1 !important; flex-shrink: 1 !important; display: flex !important;
    flex-direction: column !important; min-height: 0 !important; margin-bottom: 0 !important;
}
#pos-form .table-container { flex-grow: 1; height: 100%; overflow-y: auto; min-height: 0; box-shadow: none; border: none; }

/* FIX COLOR BOTÓN COBRAR 
   Se fuerza el color verde para diferenciarlo del menú azul en móvil
*/
#pos-confirmar-btn {
    background-color: var(--color-exito) !important;
    border-color: var(--color-exito) !important;
    color: white;
}
#pos-confirmar-btn:hover {
    background-color: #157347 !important;
}

/* --- OPTIMIZACIÓN POS MÓVIL --- */
@media (max-width: 991px) {
    html, body { height: auto !important; overflow-y: auto !important; position: static !important; }
    .layout-container, .pos-main-content, #pos-form {
        height: auto !important; min-height: 100vh; display: block !important; padding: 10px !important; overflow: visible !important;
    }
    .pos-card { height: auto !important; flex-grow: 0 !important; margin-bottom: 15px !important; }
    
    .pos-card:nth-child(2) { display: block !important; }
    .pos-card:nth-child(2) .table-container { height: 300px !important; max-height: 50vh; overflow-y: auto !important; border: 1px solid #eee; }

    .pos-footer { position: relative !important; margin-top: 20px; padding-bottom: 80px !important; border-top: none; display: block !important; }
    .pos-payment-bar { flex-direction: column !important; gap: 15px; }
    .pos-total-display { flex-direction: column !important; width: 100%; align-items: stretch !important; }
    .pos-total-display > div { text-align: center !important; }
    
    /* Botón Flotante Cobrar */
    #pos-confirmar-btn {
        width: 100% !important; height: 60px !important; font-size: 18px !important;
        position: fixed; bottom: 0; left: 0; right: 0; z-index: 9999;
        border-radius: 0 !important; box-shadow: 0 -4px 10px rgba(0,0,0,0.2); margin: 0 !important;
    }
    
    .pos-scanner-bar { flex-direction: column; }
    .form-group-row { flex-direction: column; gap: 0; }
}

/* Modales */
.modal { display: none; position: fixed; z-index: 1100; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.5); }
.modal-content, .scanner-modal-content { background-color: white; margin: 5% auto; width: 90%; max-width: 500px; border-radius: 8px; }
.search-dropdown-menu { display: none; position: absolute; width: 100%; background: white; border: 1px solid #ccc; z-index: 10000; }
.variant-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-top: 15px; }
.btn-variant-option { background-color: #f8f9fa; border: 1px solid #dee2e6; padding: 15px; border-radius: 8px; text-align: center; cursor: pointer; }
.btn-variant-option:hover { background-color: var(--color-primario); color: white; }

/* Notificación Éxito */
.success-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.3); display: flex; justify-content: center; align-items: center; z-index: 9999; }
.success-box { background: white; padding: 30px; border-radius: 12px; text-align: center; animation: popIn 0.3s forwards; }
@keyframes popIn { from { transform: scale(0.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/*
 * Impulza ERP - Hoja de Estilos Maestra
 * Versión: Dark Sidebar + Mobile Fixes + Collapsed State
 */

/* --- 1. GLOBALES Y TIPOGRAFÍA --- */

:root {
    /* --- PALETA GENERAL --- */
    --color-primario: #2C3E50;
    --color-acento: #0d6efd;
    --color-fondo-pagina: #F8F9FA;
    --color-fondo-tarjeta: #FFFFFF;
    --color-texto-principal: #212529;
    --color-texto-secundario: #6C757D;
    --color-bordes: #DEE2E6;

    --color-exito: #198754;       
    --color-advertencia: #FFC107; 
    --color-peligro: #DC3545;     
    --color-info: #0DCAF0;        

    /* --- VARIABLES SIDEBAR DARK --- */
    --sidebar-width: 260px;
    --sidebar-bg: #0f172a; /* Azul noche profundo */
    --sidebar-text: #94a3b8; 
    --sidebar-text-hover: #ffffff;
    --sidebar-item-hover: rgba(255, 255, 255, 0.1);
    --sidebar-active-bg: #0d6efd; 
    --sidebar-active-shadow: 0 4px 12px rgba(13, 110, 253, 0.4);

    /* Diseño */
    --border-radius-tarjeta: 12px;
    --border-radius-boton: 6px;
    --sombra-tarjeta: 0 2px 10px rgba(0, 0, 0, 0.03);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    height: 100%;
    overflow: hidden; 
    font-family: 'Inter', sans-serif;
    background-color: var(--color-fondo-pagina);
    color: var(--color-texto-principal);
    font-size: 14px; 
}

h1 { font-weight: 700; font-size: 24px; color: #1e293b; margin-bottom: 20px; }
h2 { font-weight: 600; font-size: 18px; }

/* ==========================================================
   2. LAYOUT Y SIDEBAR (DARK THEME)
   ========================================================== */

.layout-container {
    display: flex;
    height: 100%;
    overflow: hidden;
    transition: all 0.3s ease;
}

/* El Contenedor del Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    height: 100%;
    z-index: 1000;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    border-right: 1px solid rgba(255,255,255,0.05);
    white-space: nowrap; /* Evita que el texto salte al encoger */
}

/* Header (Logo) */
.sidebar-header {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.brand { display: flex; align-items: center; gap: 10px; overflow: hidden; }
.brand-icon { 
    background: white; color: var(--sidebar-bg); 
    min-width: 32px; height: 32px; border-radius: 6px; 
    display: flex; align-items: center; justify-content: center; font-size: 18px; 
}
.brand-title { color: white; font-size: 18px; font-weight: 700; letter-spacing: -0.5px; margin: 0; }

/* Contenido Scrolleable del Menú */
.sidebar-content {
    flex-grow: 1;
    overflow-y: auto; overflow-x: hidden;
    padding: 20px 12px;
    scrollbar-width: thin;
    scrollbar-color: #334155 transparent;
}
.sidebar-content::-webkit-scrollbar { width: 4px; }
.sidebar-content::-webkit-scrollbar-thumb { background-color: #334155; border-radius: 4px; }

/* Lista de Navegación */
.sidebar-nav ul { list-style: none; padding: 0; margin: 0; }

.nav-label {
    font-size: 11px; font-weight: 700; color: #475569;
    text-transform: uppercase; letter-spacing: 0.8px; margin: 20px 0 8px 12px;
    white-space: nowrap; overflow: hidden;
}

/* Enlaces del Menú */
.nav-link {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 12px; margin-bottom: 4px; border-radius: 8px;
    color: var(--sidebar-text); text-decoration: none; font-weight: 500;
    transition: all 0.2s ease; cursor: pointer;
}

.nav-link .link-wrapper { display: flex; align-items: center; gap: 12px; }
.nav-link i { font-size: 18px; min-width: 20px; text-align: center; }
.nav-link .arrow { font-size: 12px; transition: transform 0.3s; }

.nav-link:hover { background-color: var(--sidebar-item-hover); color: var(--sidebar-text-hover); }
.nav-link.active { background-color: var(--sidebar-active-bg); color: white; box-shadow: var(--sidebar-active-shadow); }
.nav-link.active i { color: white; }

/* Submenús */
.sub-menu { max-height: 0; overflow: hidden; transition: max-height 0.3s ease-out; padding-left: 0; }
.menu-item-has-children.open .sub-menu { max-height: 500px; transition: max-height 0.5s ease-in; }
.menu-item-has-children.open > .nav-link { color: var(--sidebar-text-hover); }
.menu-item-has-children.open > .nav-link .arrow { transform: rotate(180deg); }

.sub-menu a {
    padding: 8px 12px 8px 48px; font-size: 13px; color: #64748b;
    display: block; text-decoration: none; position: relative; transition: color 0.2s;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sub-menu a:hover { color: var(--sidebar-text-hover); }
.sub-menu a.active { color: var(--color-acento); font-weight: 600; }
.sub-menu a.active::before {
    content: ''; position: absolute; left: 30px; top: 50%; transform: translateY(-50%);
    width: 4px; height: 4px; border-radius: 50%; background-color: var(--color-acento);
}

/* Footer del Sidebar */
.sidebar-footer {
    padding: 15px 20px; border-top: 1px solid rgba(255,255,255,0.05);
    background-color: rgba(0,0,0,0.1); display: flex;
    justify-content: space-between; align-items: center; overflow: hidden;
}
.btn-logout {
    background: none; border: none; color: #ef4444; font-size: 18px; cursor: pointer; padding: 5px;
    transition: transform 0.2s; min-width: 20px;
}
.btn-logout:hover { transform: translateX(3px); color: #ff6b6b; }

.badge-pill {
    background-color: var(--color-peligro); color: white;
    font-size: 10px; padding: 2px 6px; border-radius: 10px; font-weight: bold;
}

/* ==========================================================
   3. ESTILOS COLAPSADOS (LO QUE FALTABA)
   ========================================================== */

/* Cuando el contenedor tiene la clase .sidebar-collapsed */
.layout-container.sidebar-collapsed .sidebar {
    width: 80px; /* Ancho reducido */
}

/* Ocultamos textos y flechas */
.layout-container.sidebar-collapsed .brand-title,
.layout-container.sidebar-collapsed .nav-label,
.layout-container.sidebar-collapsed .link-wrapper span,
.layout-container.sidebar-collapsed .arrow,
.layout-container.sidebar-collapsed .sidebar-footer div,
.layout-container.sidebar-collapsed .badge-pill {
    display: none !important;
}

/* Centramos el contenido restante */
.layout-container.sidebar-collapsed .sidebar-header {
    justify-content: center;
    padding: 20px 0;
}
.layout-container.sidebar-collapsed .brand { gap: 0; }

.layout-container.sidebar-collapsed .nav-link {
    justify-content: center;
    padding: 15px 0;
}
.layout-container.sidebar-collapsed .nav-link i {
    font-size: 22px;
    margin: 0;
}

/* Ocultar submenús en modo colapsado para evitar bugs visuales */
.layout-container.sidebar-collapsed .sub-menu {
    display: none !important; 
}

/* ==========================================================
   4. RESPONSIVE MÓVIL
   ========================================================== */
.mobile-menu-btn {
    position: fixed; bottom: 20px; right: 20px;
    width: 50px; height: 50px;
    background-color: var(--color-acento);
    color: white;
    border: none; border-radius: 50%;
    box-shadow: 0 4px 15px rgba(13, 110, 253, 0.4);
    z-index: 2000;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px; cursor: pointer;
}

.sidebar-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); z-index: 1005;
    opacity: 0; visibility: hidden; transition: all 0.3s;
    backdrop-filter: blur(2px);
}

/* Botón interno (Hamburguesa) visible en escritorio */
.btn-internal-toggle {
    display: inline-flex; 
    background: transparent;
    border: 1px solid rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.6);
    border-radius: 4px;
    padding: 4px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 2200;
}
.btn-internal-toggle:hover { background: rgba(255,255,255,0.1); color: white; }

@media (max-width: 1024px) {
    .sidebar {
        position: fixed; top: 0; left: -100%; height: 100%;
        box-shadow: 5px 0 25px rgba(0,0,0,0.2);
        z-index: 2100 !important; 
    }
    .sidebar.active { left: 0; }
    .sidebar-overlay.active { opacity: 1; visibility: visible; }
    
    .btn-internal-toggle { border: none; font-size: 24px; color: white; }
    .main-content { margin-left: 0; width: 100%; }
}

@media (min-width: 1025px) {
    .mobile-menu-btn, .sidebar-overlay { display: none !important; }
    
    /* Ajuste botón cuando está colapsado */
    .layout-container.sidebar-collapsed .btn-internal-toggle {
        display: none !important; /* Ocultamos el botón al colapsar o lo movemos */
    }
    /* Mejor: hacemos que el header entero sea el trigger o mostramos solo el icono */
    .layout-container.sidebar-collapsed .brand { justify-content: center; width: 100%; cursor: pointer; }
    .layout-container.sidebar-collapsed .sidebar-header { flex-direction: column; gap: 10px; height: auto; }
    .layout-container.sidebar-collapsed .btn-internal-toggle { display: flex !important; margin-top: 5px; border: none; }
}


/* ==========================================================
   5. ÁREA PRINCIPAL Y COMPONENTES
   ========================================================== */

.main-content {
    flex-grow: 1; padding: 30px; overflow-y: auto; height: 100%;
    background-color: var(--color-fondo-pagina);
}

/* Tarjetas */
.dashboard-grid, .config-menu-grid, .detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; margin-bottom: 20px; }
.widget-card, .config-card, .detail-card {
    background: white; border-radius: var(--border-radius-tarjeta);
    padding: 20px; border: 1px solid var(--color-bordes);
    box-shadow: var(--sombra-tarjeta); text-decoration: none; color: inherit;
    transition: transform 0.2s;
}
.widget-card:hover, .config-card:hover { transform: translateY(-3px); border-color: var(--color-acento); }

/* Headers y Tablas */
.header-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; flex-wrap: wrap; gap: 15px; }
.table-container { background: white; border-radius: 12px; border: 1px solid var(--color-bordes); overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
th { background: #f8f9fa; padding: 12px 15px; text-align: left; font-size: 12px; text-transform: uppercase; color: #64748b; font-weight: 600; }
td { padding: 12px 15px; border-bottom: 1px solid #f1f5f9; color: #334155; }
tr:last-child td { border-bottom: none; }

/* Botones Generales */
.btn {
    padding: 10px 18px; border-radius: var(--border-radius-boton); border: none; font-weight: 600; cursor: pointer;
    display: inline-flex; align-items: center; gap: 8px; text-decoration: none; font-size: 14px; transition: all 0.2s;
}
.btn-primary { background: var(--color-acento); color: white; }
.btn-primary:hover { background: #0056b3; }
.btn-secondary { background: white; border: 1px solid #ccc; color: #555; }
.btn-icon-delete { background: white; color: #dc3545; border: 1px solid #f8d7da; padding: 6px 10px; }

/* Badges */
.status-badge { padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; text-transform: uppercase; }
.status-aprobado { background: #dcfce7; color: #166534; }
.status-pendiente { background: #fef9c3; color: #854d0e; }
.status-anulado { background: #fee2e2; color: #991b1b; }

/* Inputs */
input, select, textarea {
    width: 100%; padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 6px;
    font-size: 14px; transition: border-color 0.2s;
}
input:focus, select:focus { outline: none; border-color: var(--color-acento); box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.1); }
.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 500; font-size: 13px; color: #475569; }
.form-group-row { display: flex; gap: 15px; }
.form-group-row > div { flex: 1; }

/* =========================================
   6. ESTILOS ESPECÍFICOS POS (VENTAS)
   ========================================= */

.pos-main-content {
    display: flex; flex-direction: column; height: 100%;
    padding: 15px !important; overflow: hidden !important;
}

.pos-card { background: white; border-radius: 8px; box-shadow: var(--sombra-tarjeta); margin-bottom: 15px; border: 1px solid var(--color-bordes); }
.pos-section-header { padding: 10px 20px; background: #f8f9fa; border-bottom: 1px solid var(--color-bordes); display: flex; align-items: center; gap: 10px; }
.pos-subtotal-bar { padding: 15px 20px; text-align: right; font-size: 18px; border-top: 1px solid var(--color-bordes); }
.pos-footer { margin-top: auto; padding-top: 15px; border-top: 2px solid var(--color-bordes); }

.pos-payment-bar { display: flex; justify-content: space-between; align-items: flex-end; }
.pos-total-display { display: flex; align-items: flex-end; gap: 15px; }
.total-value-final { font-size: 32px; font-weight: 800; color: var(--color-exito); }

/* FIX: Layout Full Height POS */
#pos-form { display: flex; flex-direction: column; height: 100%; gap: 15px; }
#pos-form > .pos-card:nth-child(2) {
    flex-grow: 1 !important; flex-shrink: 1 !important; display: flex !important;
    flex-direction: column !important; min-height: 0 !important; margin-bottom: 0 !important;
}
#pos-form .table-container { flex-grow: 1; height: 100%; overflow-y: auto; min-height: 0; box-shadow: none; border: none; }

/* FIX COLOR BOTÓN COBRAR */
#pos-confirmar-btn {
    background-color: var(--color-exito) !important;
    border-color: var(--color-exito) !important;
    color: white;
}
#pos-confirmar-btn:hover {
    background-color: #157347 !important;
}

/* --- OPTIMIZACIÓN POS MÓVIL --- */
@media (max-width: 991px) {
    html, body { height: auto !important; overflow-y: auto !important; position: static !important; }
    .layout-container, .pos-main-content, #pos-form {
        height: auto !important; min-height: 100vh; display: block !important; padding: 10px !important; overflow: visible !important;
    }
    .pos-card { height: auto !important; flex-grow: 0 !important; margin-bottom: 15px !important; }
    
    .pos-card:nth-child(2) { display: block !important; }
    .pos-card:nth-child(2) .table-container { height: 300px !important; max-height: 50vh; overflow-y: auto !important; border: 1px solid #eee; }

    .pos-footer { position: relative !important; margin-top: 20px; padding-bottom: 80px !important; border-top: none; display: block !important; }
    .pos-payment-bar { flex-direction: column !important; gap: 15px; }
    .pos-total-display { flex-direction: column !important; width: 100%; align-items: stretch !important; }
    .pos-total-display > div { text-align: center !important; }
    
    /* Botón Flotante Cobrar */
    #pos-confirmar-btn {
        width: 100% !important; height: 60px !important; font-size: 18px !important;
        position: fixed; bottom: 0; left: 0; right: 0; z-index: 9999;
        border-radius: 0 !important; box-shadow: 0 -4px 10px rgba(0,0,0,0.2); margin: 0 !important;
    }
    
    .pos-scanner-bar { flex-direction: column; }
    .form-group-row { flex-direction: column; gap: 0; }
}

/* Modales */
.modal { display: none; position: fixed; z-index: 1100; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.5); }
.modal-content, .scanner-modal-content { background-color: white; margin: 5% auto; width: 90%; max-width: 500px; border-radius: 8px; }
.search-dropdown-menu { display: none; position: absolute; width: 100%; background: white; border: 1px solid #ccc; z-index: 10000; }
.variant-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-top: 15px; }
.btn-variant-option { background-color: #f8f9fa; border: 1px solid #dee2e6; padding: 15px; border-radius: 8px; text-align: center; cursor: pointer; }
.btn-variant-option:hover { background-color: var(--color-primario); color: white; }

/* Notificación Éxito */
.success-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.3); display: flex; justify-content: center; align-items: center; z-index: 9999; }
.success-box { background: white; padding: 30px; border-radius: 12px; text-align: center; animation: popIn 0.3s forwards; }
@keyframes popIn { from { transform: scale(0.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }


/*
 * Impulza ERP - Hoja de Estilos
 * Versión: Logo Personalizado + Sidebar Colapsable Perfecta
 */

/* ==========================================================
   1. GLOBALES Y VARIABLES
   ========================================================== */
:root {
    /* Paleta */
    --color-primario: #2C3E50;
    --color-acento: #0d6efd;
    --color-fondo-pagina: #F8F9FA;
    --color-fondo-tarjeta: #FFFFFF;
    --color-texto-principal: #212529;
    --color-texto-secundario: #6C757D;
    --color-bordes: #DEE2E6;

    --color-exito: #198754;       
    --color-advertencia: #FFC107; 
    --color-peligro: #DC3545;     
    --color-info: #0DCAF0;        

    /* Sidebar Dark */
    --sidebar-width: 260px;
    --sidebar-width-collapsed: 80px;
    --sidebar-bg: #0f172a; 
    --sidebar-text: #94a3b8; 
    --sidebar-text-hover: #ffffff;
    --sidebar-item-hover: rgba(255, 255, 255, 0.1);
    --sidebar-active-bg: #0d6efd; 
    --sidebar-active-shadow: 0 4px 12px rgba(13, 110, 253, 0.4);

    --border-radius-tarjeta: 12px;
    --border-radius-boton: 6px;
    --sombra-tarjeta: 0 2px 10px rgba(0, 0, 0, 0.03);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    height: 100%; overflow: hidden; 
    font-family: 'Inter', sans-serif;
    background-color: var(--color-fondo-pagina);
    color: var(--color-texto-principal);
    font-size: 14px; 
}

h1 { font-weight: 700; font-size: 24px; color: #1e293b; margin-bottom: 20px; }
h2 { font-weight: 600; font-size: 18px; }

/* ==========================================================
   2. SIDEBAR Y LAYOUT
   ========================================================== */
.layout-container { display: flex; height: 100%; overflow: hidden; transition: all 0.3s ease; }

/* Sidebar Base */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex; flex-direction: column;
    height: 100%; z-index: 1000;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    border-right: 1px solid rgba(255,255,255,0.05);
    white-space: nowrap;
}

/* Header */
.sidebar-header {
    padding: 20px;
    display: flex; align-items: center; justify-content: space-between;
    height: 70px; border-bottom: 1px solid rgba(255,255,255,0.05);
    overflow: hidden;
}
.brand { display: flex; align-items: center; gap: 10px; overflow: hidden; transition: all 0.3s; }

/* Logo Container */
.brand-icon { 
    background: white; /* Fondo blanco para el JPG si es necesario */
    min-width: 40px; height: 40px; /* Un poco más grande para el logo */
    border-radius: 8px; 
    display: flex; align-items: center; justify-content: center; 
    overflow: hidden;
}

.brand-title { color: white; font-size: 18px; font-weight: 700; letter-spacing: -0.5px; margin: 0; }

/* Navegación */
.sidebar-content {
    flex-grow: 1; overflow-y: auto; overflow-x: hidden; padding: 20px 10px;
    scrollbar-width: thin; scrollbar-color: #334155 transparent;
}
.sidebar-nav ul { list-style: none; padding: 0; margin: 0; }

.nav-label {
    font-size: 11px; font-weight: 700; color: #475569;
    text-transform: uppercase; letter-spacing: 0.8px; margin: 20px 0 8px 12px;
    white-space: nowrap; overflow: hidden;
}

.nav-link {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 12px; margin-bottom: 4px; border-radius: 8px;
    color: var(--sidebar-text); text-decoration: none; font-weight: 500;
    transition: all 0.2s ease; cursor: pointer;
}
.nav-link .link-wrapper { display: flex; align-items: center; gap: 12px; }
.nav-link i { font-size: 20px; min-width: 24px; text-align: center; display: flex; align-items: center; justify-content: center; }

.nav-link:hover { background-color: var(--sidebar-item-hover); color: var(--sidebar-text-hover); }
.nav-link.active { background-color: var(--sidebar-active-bg); color: white; box-shadow: var(--sidebar-active-shadow); }
.nav-link.active i { color: white; }

/* Submenús */
.sub-menu { max-height: 0; overflow: hidden; transition: max-height 0.3s ease-out; padding-left: 0; }
.menu-item-has-children.open .sub-menu { max-height: 500px; transition: max-height 0.5s ease-in; }
.menu-item-has-children.open > .nav-link { color: var(--sidebar-text-hover); }
.menu-item-has-children.open .arrow { transform: rotate(180deg); }
.arrow { transition: transform 0.3s; font-size: 12px; }

.sub-menu a {
    padding: 8px 12px 8px 48px; font-size: 13px; color: #64748b;
    display: block; text-decoration: none; position: relative; transition: color 0.2s;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sub-menu a:hover { color: var(--sidebar-text-hover); }
.sub-menu a.active { color: var(--color-acento); font-weight: 600; }
.sub-menu a.active::before {
    content: ''; position: absolute; left: 30px; top: 50%; transform: translateY(-50%);
    width: 4px; height: 4px; border-radius: 50%; background-color: var(--color-acento);
}

/* Footer Sidebar */
.sidebar-footer {
    padding: 15px; border-top: 1px solid rgba(255,255,255,0.05);
    background-color: rgba(0,0,0,0.1); 
    display: flex; justify-content: space-between; align-items: center; overflow: hidden;
}
.btn-logout { 
    background: none; border: none; color: #ef4444; font-size: 20px; 
    cursor: pointer; transition: transform 0.2s; padding: 8px; border-radius: 6px;
}
.btn-logout:hover { background: rgba(220, 53, 69, 0.1); transform: scale(1.1); }
.badge-pill { background-color: var(--color-peligro); color: white; font-size: 10px; padding: 2px 6px; border-radius: 10px; font-weight: bold; }

/* ----------------------------------------------------------
   ESTADO COLAPSADO (SOLO ICONOS)
   ---------------------------------------------------------- */
.layout-container.sidebar-collapsed .sidebar { width: var(--sidebar-width-collapsed); }

/* OCULTAR TEXTOS Y ELEMENTOS SOBRANTES */
.layout-container.sidebar-collapsed .brand-title,
.layout-container.sidebar-collapsed .nav-label,
.layout-container.sidebar-collapsed .link-wrapper span, /* Texto del link */
.layout-container.sidebar-collapsed .arrow,
.layout-container.sidebar-collapsed .badge-pill,
.layout-container.sidebar-collapsed .sub-menu,
.layout-container.sidebar-collapsed .user-info { /* Info usuario footer */
    display: none !important;
}

/* CENTRAR ELEMENTOS */
.layout-container.sidebar-collapsed .sidebar-header {
    flex-direction: column; gap: 15px; padding: 15px 0; height: auto; justify-content: center;
}
.layout-container.sidebar-collapsed .brand { justify-content: center; width: 100%; margin: 0; }
.layout-container.sidebar-collapsed .brand-icon { min-width: 45px; height: 45px; } /* Icono más grande al colapsar */

/* LINKS CENTRADOS */
.layout-container.sidebar-collapsed .nav-link {
    justify-content: center; padding: 12px 0;
}
.layout-container.sidebar-collapsed .nav-link .link-wrapper { margin: 0; }
.layout-container.sidebar-collapsed .nav-link i { font-size: 24px; margin: 0; }

/* FOOTER CENTRADO */
.layout-container.sidebar-collapsed .sidebar-footer {
    justify-content: center; padding: 15px 0;
}
.layout-container.sidebar-collapsed .btn-logout {
    background-color: var(--color-peligro); /* Botón Rojo Sólido */
    color: white;
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 8px;
}

/* HAMBURGUESA Y MÓVIL */
.btn-internal-toggle {
    display: inline-flex; background: transparent; border: 1px solid rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.6); border-radius: 4px; padding: 4px; font-size: 18px;
    cursor: pointer; transition: all 0.2s; z-index: 2200;
}
.btn-internal-toggle:hover { background: rgba(255,255,255,0.1); color: white; }

.mobile-menu-btn {
    position: fixed; bottom: 20px; right: 20px; width: 50px; height: 50px;
    background-color: var(--color-acento); color: white; border: none; border-radius: 50%;
    box-shadow: 0 4px 15px rgba(13, 110, 253, 0.4); z-index: 2000;
    display: flex; align-items: center; justify-content: center; font-size: 24px; cursor: pointer;
}
.sidebar-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); z-index: 1005; opacity: 0; visibility: hidden; transition: all 0.3s;
    backdrop-filter: blur(2px);
}

@media (max-width: 1024px) {
    .sidebar { position: fixed; top: 0; left: -100%; height: 100%; box-shadow: 5px 0 25px rgba(0,0,0,0.2); z-index: 2100 !important; }
    .sidebar.active { left: 0; }
    .sidebar-overlay.active { opacity: 1; visibility: visible; }
    .btn-internal-toggle { border: none; font-size: 24px; color: white; }
    .main-content { margin-left: 0; width: 100%; }
}
@media (min-width: 1025px) {
    .mobile-menu-btn, .sidebar-overlay { display: none !important; }
    .layout-container.sidebar-collapsed .btn-internal-toggle { display: flex !important; margin-top: 5px; border: none; font-size: 20px; }
}

/* ==========================================================
   3. CONTENIDO PRINCIPAL & COMPONENTES
   ========================================================== */
.main-content { flex-grow: 1; padding: 30px; overflow-y: auto; height: 100%; background-color: var(--color-fondo-pagina); }

/* Grids */
.dashboard-grid, .config-menu-grid, .detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; margin-bottom: 20px; }
.widget-card, .config-card, .detail-card, .pos-card {
    background: white; border-radius: var(--border-radius-tarjeta);
    padding: 20px; border: 1px solid var(--color-bordes);
    box-shadow: var(--sombra-tarjeta); text-decoration: none; color: inherit;
    transition: transform 0.2s;
}
.widget-card:hover, .config-card:hover { transform: translateY(-3px); border-color: var(--color-acento); }

/* Tablas */
.table-container { background: white; border-radius: 12px; border: 1px solid var(--color-bordes); overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
th { background: #f8f9fa; padding: 12px 15px; text-align: left; font-size: 12px; text-transform: uppercase; color: #64748b; font-weight: 600; position: sticky; top: 0; z-index: 10; }
td { padding: 12px 15px; border-bottom: 1px solid #f1f5f9; color: #334155; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8fafc; }

/* Botones */
.btn {
    padding: 10px 18px; border-radius: var(--border-radius-boton); border: none; font-weight: 600; cursor: pointer;
    display: inline-flex; align-items: center; gap: 8px; text-decoration: none; font-size: 14px; transition: all 0.2s;
}
.btn-primary { background: var(--color-acento); color: white; }
.btn-primary:hover { background: #0056b3; }
.btn-secondary { background: white; border: 1px solid #ccc; color: #555; }
.btn-secondary:hover { background: #f1f1f1; }
.btn-icon-delete { background: white; color: #dc3545; border: 1px solid #f8d7da; padding: 6px 10px; }

/* Forms */
.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 500; font-size: 13px; color: #475569; }
.form-group-row { display: flex; gap: 15px; }
.form-group-row > div { flex: 1; }
input, select, textarea {
    width: 100%; padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 6px;
    font-size: 14px; transition: border-color 0.2s;
}
input:focus, select:focus { outline: none; border-color: var(--color-acento); box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.1); }

/* Badges */
.status-badge { padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; text-transform: uppercase; }
.status-aprobado { background: #dcfce7; color: #166534; }
.status-pendiente { background: #fef9c3; color: #854d0e; }
.status-anulado { background: #fee2e2; color: #991b1b; }
.status-facturado { background: #198754; color:white; }

/* ==========================================================
   4. ESTILOS POS (VENTAS)
   ========================================================== */
.pos-main-content { display: flex; flex-direction: column; height: 100%; padding: 15px !important; overflow: hidden !important; }
#pos-form { display: flex; flex-direction: column; height: 100%; gap: 15px; }
#pos-form > .pos-card:nth-child(2) { flex-grow: 1 !important; display: flex !important; flex-direction: column !important; min-height: 0 !important; margin-bottom: 0 !important; }
#pos-form .table-container { flex-grow: 1; height: 100%; overflow-y: auto; min-height: 0; border: none; box-shadow: none; }

.pos-section-header { padding: 10px 20px; background: #f8f9fa; border-bottom: 1px solid var(--color-bordes); display: flex; align-items: center; gap: 10px; }
.pos-subtotal-bar { padding: 15px 20px; text-align: right; font-size: 18px; border-top: 1px solid var(--color-bordes); }
.pos-footer { margin-top: auto; padding-top: 15px; border-top: 2px solid var(--color-bordes); }
.pos-payment-bar { display: flex; justify-content: space-between; align-items: flex-end; }
.pos-total-display { display: flex; align-items: flex-end; gap: 15px; }
.total-value-final { font-size: 32px; font-weight: 800; color: var(--color-exito); }
#pos-confirmar-btn { background-color: var(--color-exito) !important; border-color: var(--color-exito) !important; color: white; }

@media (max-width: 991px) {
    html, body { height: auto !important; overflow-y: auto !important; position: static !important; }
    .layout-container, .pos-main-content, #pos-form { height: auto !important; min-height: 100vh; display: block !important; padding: 10px !important; overflow: visible !important; }
    .pos-card { height: auto !important; flex-grow: 0 !important; margin-bottom: 15px !important; }
    .pos-card:nth-child(2) { display: block !important; }
    .pos-card:nth-child(2) .table-container { height: 300px !important; max-height: 50vh; overflow-y: auto !important; border: 1px solid #eee; }
    .pos-footer { position: relative !important; margin-top: 20px; padding-bottom: 80px !important; border-top: none; display: block !important; }
    .pos-payment-bar { flex-direction: column !important; gap: 15px; }
    .pos-total-display { flex-direction: column !important; width: 100%; align-items: stretch !important; }
    .pos-total-display > div { text-align: center !important; }
    #pos-confirmar-btn { width: 100% !important; height: 60px !important; font-size: 18px !important; position: fixed; bottom: 0; left: 0; right: 0; z-index: 9999; margin: 0 !important; border-radius: 0 !important; }
    .pos-scanner-bar { flex-direction: column; }
    .form-group-row { flex-direction: column; gap: 0; }
}

/* OTROS ESTILOS (Buscador, Variantes, Modales) */
.search-dropdown-menu { display: none; position: absolute; width: 100%; background: white; border: 1px solid #ccc; z-index: 10000; max-height: 300px; overflow-y: auto; }
.search-result-item { padding: 10px 15px; border-bottom: 1px solid #eee; cursor: pointer; transition: background 0.2s; }
.search-result-item:hover { background-color: #e9ecef; }
.variant-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-top: 15px; }
.btn-variant-option { background-color: #f8f9fa; border: 1px solid #dee2e6; padding: 15px; border-radius: 8px; text-align: center; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.btn-variant-option:hover { background-color: var(--color-primario); color: white; transform: translateY(-2px); }
.variants-header { display: flex; gap: 10px; margin-bottom: 10px; font-size: 12px; font-weight: bold; color: #555; }
.variants-header .col-name { flex: 2; } .variants-header span { flex: 1; }
.variant-row { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 8px; background: #fff; }
.variant-inputs-container { display: flex; flex: 1; gap: 10px; width: 100%; }
.var-group-main { display: flex; flex: 3.5; gap: 10px; }
.var-group-numbers { display: flex; flex: 4; gap: 10px; }
.mobile-label { display: none; }
@media (max-width: 768px) {
    .variants-header { display: none; }
    .variant-row { flex-direction: row; flex-wrap: wrap; padding: 15px; border: 1px solid #dee2e6; border-radius: 8px; }
    .variant-inputs-container { flex-direction: column; gap: 15px; }
    .var-group-main { flex-direction: column; flex: 1; }
    .var-group-numbers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
    .mobile-label { display: block; font-size: 10px; font-weight: 700; color: #adb5bd; text-transform: uppercase; }
}
.modal { display: none; position: fixed; z-index: 1100; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.5); }
.modal-content { background-color: white; margin: 5% auto; width: 90%; max-width: 500px; border-radius: 8px; animation: slide-down 0.3s; }
@keyframes slide-down { from { transform: translateY(-30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.success-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.3); display: flex; justify-content: center; align-items: center; z-index: 9999; }
.success-box { background: white; padding: 30px; border-radius: 12px; text-align: center; animation: popIn 0.3s forwards; }
@keyframes popIn { from { transform: scale(0.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }


/* --- ESTILOS E-COMMERCE (PORTAL) --- */

/* 1. Header y Navegación */
.store-navbar { 
    background: white; padding: 15px 20px; position: sticky; top: 0; z-index: 1000; 
    box-shadow: 0 2px 10px rgba(0,0,0,0.05); display: flex; justify-content: space-between; align-items: center;
}
.store-nav-links { display: flex; gap: 20px; font-size: 14px; font-weight: 500; }
.store-nav-links a { color: #333; text-decoration: none; transition: color 0.2s; }
.store-nav-links a:hover { color: var(--color-acento); }

/* 2. Banner / Carrusel */
.hero-banner { 
    width: 100%; height: 300px; background-color: #eee; background-size: cover; background-position: center; 
    display: flex; align-items: center; justify-content: center; margin-bottom: 20px;
}
.hero-text { background: rgba(0,0,0,0.5); color: white; padding: 20px; border-radius: 8px; text-align: center; }

/* 3. Categorías (Píldoras) */
.category-scroll { 
    display: flex; gap: 10px; overflow-x: auto; padding: 10px 0; margin-bottom: 20px; 
    scrollbar-width: none; /* Ocultar scrollbar */
}
.cat-pill { 
    background: white; border: 1px solid #ddd; padding: 8px 20px; border-radius: 30px; 
    white-space: nowrap; cursor: pointer; transition: all 0.2s; font-size: 14px; color: #555;
}
.cat-pill.active { background: #212529; color: white; border-color: #212529; }

/* 4. GRILLA DE PRODUCTOS (Modo Visual) */
.product-grid-view { 
    display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 20px; 
}
.prod-card-visual { 
    background: white; border-radius: 0; cursor: pointer; transition: transform 0.2s; position: relative;
    display: flex; flex-direction: column; height: 100%; border: none; /* Estilo limpio */
}
.prod-card-visual:hover { transform: translateY(-5px); }
.prod-img-container { 
    width: 100%; aspect-ratio: 1 / 1.2; /* Formato vertical ropa */
    overflow: hidden; background: #f8f9fa; position: relative;
    border-radius: 4px;
}
.prod-img-visual { width: 100%; height: 100%; object-fit: cover; transition: scale 0.3s; }
.prod-card-visual:hover .prod-img-visual { scale: 1.05; }

.prod-info-visual { padding: 10px 0; text-align: left; }
.prod-title-visual { font-size: 14px; color: #333; margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prod-price-visual { font-weight: 700; color: #000; font-size: 15px; }
.prod-add-btn {
    position: absolute; bottom: 10px; right: 10px; width: 35px; height: 35px;
    background: white; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1); font-size: 18px; color: #333; transition: all 0.2s;
}
.prod-add-btn:hover { background: #000; color: white; }

/* 5. MODAL DE PRODUCTO (Estilo Zara) */
.modal-product-layout { display: flex; gap: 20px; }
.modal-img-col { flex: 1; }
.modal-img-col img { width: 100%; border-radius: 8px; object-fit: cover; aspect-ratio: 1/1; }
.modal-info-col { flex: 1; display: flex; flex-direction: column; gap: 15px; }

.modal-price-big { font-size: 24px; font-weight: 700; color: #000; }
.modal-installments { font-size: 13px; color: #666; background: #f5f5f5; padding: 8px; border-radius: 4px; }
.modal-variant-select { padding: 10px; border: 1px solid #ddd; border-radius: 4px; width: 100%; margin-top: 10px; }
.modal-description { font-size: 14px; color: #555; line-height: 1.5; margin-top: 10px; border-top: 1px solid #eee; padding-top: 10px; }

@media (max-width: 768px) {
    .modal-product-layout { flex-direction: column; }
    .store-nav-links { display: none; } /* En móvil quizas menu hambuguesa */
    .hero-banner { height: 200px; }
    .product-grid-view { grid-template-columns: repeat(2, 1fr); gap: 10px; }
}

/* --- ESTILOS E-COMMERCE (PORTAL) --- */

/* Navbar & Header */
.store-navbar { 
    background: white; padding: 15px 20px; position: sticky; top: 0; z-index: 500; 
    box-shadow: 0 2px 10px rgba(0,0,0,0.05); display: flex; justify-content: space-between; align-items: center;
}
.store-nav-links { display: flex; gap: 20px; font-size: 14px; font-weight: 500; }
.store-nav-links a { color: #333; text-decoration: none; }

/* Banner */
.hero-banner { 
    width: 100%; height: 250px; background-color: #eee; background-size: cover; background-position: center; 
    display: flex; align-items: center; justify-content: center; margin-bottom: 20px;
}

/* Selector de Categoría (Header) */
.category-select-container { flex-grow: 1; max-width: 250px; margin-left: 20px; }
.category-select {
    width: 100%; padding: 8px 12px; border-radius: 20px; border: 1px solid #ddd;
    background-color: #f8f9fa; font-size: 14px; outline: none; cursor: pointer;
}

/* Grilla Productos Visual */
.product-grid-view { 
    display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 20px; padding-bottom: 80px; 
}
.prod-card-visual { 
    background: white; cursor: pointer; transition: transform 0.2s; position: relative;
    display: flex; flex-direction: column; height: 100%; border: none; 
}
.prod-card-visual:hover { transform: translateY(-5px); }

/* IMAGEN CON ESPACIO Y BORDE */
.prod-img-container { 
    width: 100%; aspect-ratio: 1 / 1.1; 
    overflow: hidden; background: #fff; position: relative;
    border-radius: 8px;
    padding: 10px; /* ESPACIO BLANCO SOLICITADO */
}
.prod-img-visual { width: 100%; height: 100%; object-fit: contain; /* Para que se vea entera */ mix-blend-mode: multiply;} 

.prod-info-visual { padding: 10px 5px; text-align: left; }
.prod-title-visual { font-size: 14px; color: #333; margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.prod-price-visual { font-weight: 700; color: #000; font-size: 16px; }

/* Botón flotante Carrito (FIX: Z-INDEX ALTO) */
.floating-cart-btn {
    position: fixed; bottom: 20px; left: 5%; width: 90%; max-width: 580px;
    background-color: #198754; color: white; padding: 15px 20px;
    border-radius: 12px; box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    display: flex; justify-content: space-between; align-items: center;
    font-size: 16px; font-weight: 700; border: none; cursor: pointer; 
    z-index: 10000 !important; /* SIEMPRE ADELANTE */
    transform: translateY(150%); transition: transform 0.3s;
}
.floating-cart-btn.visible { transform: translateY(0); }

/* Modal Producto */
.modal-product-layout { display: flex; gap: 20px; }
.modal-img-col { flex: 1; text-align: center; background: #fff; padding: 10px; border-radius: 8px; }
.modal-img-col img { width: 100%; max-height: 400px; object-fit: contain; }
.modal-info-col { flex: 1; display: flex; flex-direction: column; gap: 15px; }
.modal-price-big { font-size: 26px; font-weight: 700; color: #000; }
.modal-installments { font-size: 13px; color: #0d6efd; background: #e7f1ff; padding: 10px; border-radius: 6px; display: flex; gap: 10px; align-items: center; }

/* Checkout Steps */
.checkout-step { display: none; }
.checkout-step.active { display: block; animation: fadeIn 0.3s; }

@media (max-width: 768px) {
    .modal-product-layout { flex-direction: column; }
    .store-nav-links { display: none; }
    .hero-banner { height: 180px; }
    .product-grid-view { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .category-select-container { display: none; } /* En móvil quizás usar otro método o dejarlo */
}

/* --- FIX NEWSLETTER --- */
#newsletter-section input[type="email"] {
    flex: 2; /* Ocupa más espacio */
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    outline: none;
}
#newsletter-section button {
    flex: 1; /* Botón más pequeño pero visible */
    max-width: 80px; 
    padding: 10px;
}

/* --- CHECKOUT OPTIONS (Tarjetas de selección) --- */
.checkout-option {
    border: 1px solid #eee;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 15px;
    background: white;
}
.checkout-option:hover { border-color: var(--color-acento); background: #f8f9fa; }
.checkout-option.selected { 
    border-color: var(--color-acento); 
    background-color: #e7f1ff; 
    box-shadow: 0 2px 5px rgba(13, 110, 253, 0.2);
}
.checkout-option i { font-size: 24px; color: #555; }
.checkout-option.selected i { color: var(--color-acento); }

/* --- ERRORES --- */
.input-error { border-color: #dc3545 !important; background-color: #fff8f8; }

/*
 * Impulza ERP - Hoja de Estilos Maestra
 * Versión: Dark Sidebar + E-commerce Full + Mobile Cards Fix
 */

/* --- 1. GLOBALES --- */
:root {
    --color-primario: #2C3E50;
    --color-acento: #0d6efd;
    --color-fondo-pagina: #F8F9FA;
    --color-fondo-tarjeta: #FFFFFF;
    --color-texto-principal: #212529;
    --color-bordes: #DEE2E6;
    --color-exito: #198754;       
    --color-advertencia: #FFC107; 
    --color-peligro: #DC3545;     
    
    /* Sidebar */
    --sidebar-width: 260px;
    --sidebar-bg: #0f172a;
    --sidebar-text: #94a3b8; 
    --sidebar-active-bg: #0d6efd; 
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    height: 100%;
    font-family: 'Inter', sans-serif;
    background-color: var(--color-fondo-pagina);
    color: var(--color-texto-principal);
    font-size: 14px; 
}

/* --- 2. SIDEBAR Y LAYOUT (ERP) --- */
.layout-container { display: flex; height: 100%; overflow: hidden; }

.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex; flex-direction: column; height: 100%; z-index: 1000;
    transition: all 0.3s; flex-shrink: 0;
}

.sidebar-header { padding: 20px; height: 70px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(255,255,255,0.05); }
.brand-title { color: white; font-size: 18px; font-weight: 700; margin: 0; }

.sidebar-content { flex-grow: 1; overflow-y: auto; padding: 20px 10px; }
.sidebar-nav ul { list-style: none; padding: 0; margin: 0; }
.nav-label { font-size: 11px; font-weight: 700; text-transform: uppercase; margin: 20px 0 8px 12px; }

.nav-link {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin-bottom: 4px; border-radius: 8px;
    color: var(--sidebar-text); text-decoration: none; font-weight: 500; transition: all 0.2s;
}
.nav-link:hover { background: rgba(255,255,255,0.1); color: white; }
.nav-link.active { background: var(--sidebar-active-bg); color: white; }
.nav-link i { font-size: 18px; width: 20px; text-align: center; }

.sidebar-footer { padding: 15px; border-top: 1px solid rgba(255,255,255,0.05); }
.btn-logout { background: none; border: none; color: #ef4444; cursor: pointer; font-size: 18px; }

/* Mobile Sidebar */
@media (max-width: 1024px) {
    .sidebar { position: fixed; left: -100%; height: 100%; }
    .sidebar.active { left: 0; }
    .btn-internal-toggle { display: block; color: white; background: none; border: none; font-size: 24px; }
}

/* --- 3. CONTENIDO PRINCIPAL --- */
.main-content { flex-grow: 1; padding: 30px; overflow-y: auto; height: 100%; }
.header-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; }

/* Tarjetas y Grids */
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.widget-card { background: white; border-radius: 12px; padding: 20px; border: 1px solid var(--color-bordes); box-shadow: 0 2px 5px rgba(0,0,0,0.03); }
.widget-header { display: flex; align-items: center; gap: 10px; margin-bottom: 15px; border-bottom: 1px solid #eee; padding-bottom: 10px; }
.widget-header h3 { margin: 0; font-size: 16px; color: #333; }

/* Botones */
.btn { padding: 10px 18px; border-radius: 6px; border: none; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; text-decoration: none; font-size: 14px; }
.btn-primary { background: var(--color-acento); color: white; }
.btn-secondary { background: white; border: 1px solid #ccc; color: #555; }

/* Forms */
.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 5px; font-weight: 500; font-size: 13px; color: #666; }
.form-group-row { display: flex; gap: 15px; }
.form-group-row > div { flex: 1; }
input, select, textarea { width: 100%; padding: 10px; border: 1px solid #cbd5e1; border-radius: 6px; font-size: 14px; }

/* --- 4. ESTILOS COMPRAS (ITEMS HEADER) --- */
.items-header { display: flex; background: #f8f9fa; padding: 10px; font-weight: bold; font-size: 12px; color: #666; text-transform: uppercase; border-radius: 4px; margin-bottom: 10px; }
.item-line { display: flex; gap: 10px; margin-bottom: 10px; align-items: center; }
.total-section { margin-top: 20px; padding-top: 20px; border-top: 2px solid #eee; text-align: right; font-size: 24px; font-weight: bold; color: #2c3e50; }

/* --- MOBILE COMPRA ITEMS (Card View) --- */
@media (max-width: 768px) {
    /* Ocultamos el encabezado de tabla */
    .items-header { display: none !important; }

    /* Transformamos la fila en una TARJETA */
    .item-line {
        display: grid !important; /* Usamos Grid para acomodar */
        grid-template-columns: 1fr 1fr; /* 2 Columnas */
        gap: 10px;
        background: #fff;
        border: 1px solid #dee2e6;
        padding: 15px;
        border-radius: 8px;
        box-shadow: 0 2px 5px rgba(0,0,0,0.05);
        margin-bottom: 15px;
        position: relative; /* Para posicionar el botón de borrar */
    }

    /* El input de búsqueda ocupa todo el ancho */
    .item-line .item-search {
        grid-column: 1 / -1;
        font-weight: 600;
        border-color: var(--color-acento);
    }

    /* Cantidad y Costo */
    .item-line .item-qty, .item-line .item-cost {
        width: 100% !important;
    }

    /* Subtotal ocupa todo el ancho abajo */
    .item-line .item-subtotal {
        grid-column: 1 / -1;
        text-align: right !important;
        font-size: 18px;
        color: var(--color-exito);
        border-top: 1px solid #eee;
        padding-top: 10px;
        margin-top: 5px;
    }
    
    /* El botón de borrar flota arriba a la derecha */
    .item-line div:last-child {
        position: absolute;
        top: 5px;
        right: 5px;
        width: auto !important;
    }
    .item-line .btn-remove {
        background: #ffebe9 !important;
        width: 30px; height: 30px;
        border-radius: 50%;
        display: flex; align-items: center; justify-content: center;
        font-size: 18px;
    }
}

/* =========================================
   ESTILOS ESPECÍFICOS PORTAL E-COMMERCE
   ========================================= */

/* Navbar & Header */
.store-navbar { 
    background: white; padding: 15px 20px; position: sticky; top: 0; z-index: 500; 
    box-shadow: 0 2px 10px rgba(0,0,0,0.05); display: flex; justify-content: space-between; align-items: center;
}
.store-nav-links { display: flex; gap: 20px; font-size: 14px; font-weight: 500; }
.store-nav-links a { color: #333; text-decoration: none; }

/* Banner */
.hero-banner { 
    width: 100%; height: 250px; background-color: #eee; background-size: cover; background-position: center; 
    display: flex; align-items: center; justify-content: center; margin-bottom: 20px;
}

/* Selector de Categoría (Header) */
.category-select-container { flex-grow: 1; max-width: 250px; margin-left: 20px; }
.category-select {
    width: 100%; padding: 8px 12px; border-radius: 20px; border: 1px solid #ddd;
    background-color: #f8f9fa; font-size: 14px; outline: none; cursor: pointer;
}

/* Grilla Productos Visual */
.product-grid-view { 
    display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 20px; padding-bottom: 80px; 
}
.prod-card-visual { 
    background: white; cursor: pointer; transition: transform 0.2s; position: relative;
    display: flex; flex-direction: column; height: 100%; border: none; 
}
.prod-card-visual:hover { transform: translateY(-5px); }

/* IMAGEN CON ESPACIO Y BORDE */
.prod-img-container { 
    width: 100%; aspect-ratio: 1 / 1.1; 
    overflow: hidden; background: #fff; position: relative;
    border-radius: 8px;
    padding: 10px; /* ESPACIO BLANCO SOLICITADO */
}
.prod-img-visual { width: 100%; height: 100%; object-fit: contain; mix-blend-mode: multiply;} 

.prod-info-visual { padding: 10px 5px; text-align: left; }
.prod-title-visual { font-size: 14px; color: #333; margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.prod-price-visual { font-weight: 700; color: #000; font-size: 16px; }

/* Botón flotante Carrito (FIX: Z-INDEX ALTO) */
.floating-cart-btn {
    position: fixed; bottom: 20px; left: 5%; width: 90%; max-width: 580px;
    background-color: #198754; color: white; padding: 15px 20px;
    border-radius: 12px; box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    display: flex; justify-content: space-between; align-items: center;
    font-size: 16px; font-weight: 700; border: none; cursor: pointer; 
    z-index: 10000 !important; /* SIEMPRE ADELANTE */
    transform: translateY(150%); transition: transform 0.3s;
}
.floating-cart-btn.visible { transform: translateY(0); }

/* Modal Producto */
.modal { display: none; position: fixed; z-index: 1100; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.5); }
.modal-content { background-color: white; margin: 5% auto; width: 90%; max-width: 800px; border-radius: 8px; position: relative; animation: fadeIn 0.3s; }
.modal-body { padding: 25px; }

.modal-product-layout { display: flex; gap: 20px; }
.modal-img-col { flex: 1; text-align: center; background: #fff; padding: 10px; border-radius: 8px; }
.modal-img-col img { width: 100%; max-height: 400px; object-fit: contain; }
.modal-info-col { flex: 1; display: flex; flex-direction: column; gap: 15px; }
.modal-price-big { font-size: 26px; font-weight: 700; color: #000; }
.modal-installments { font-size: 13px; color: #0d6efd; background: #e7f1ff; padding: 10px; border-radius: 6px; display: flex; gap: 10px; align-items: center; }

/* FIX NEWSLETTER */
#newsletter-section input[type="email"] {
    flex: 1; padding: 10px 15px; border: 1px solid #ddd; border-radius: 4px; outline: none; min-width: 0;
}
#newsletter-section button {
    padding: 10px 20px; white-space: nowrap;
}

/* Tarjetas de Selección en Checkout */
.checkout-option {
    border: 1px solid #eee; padding: 15px; border-radius: 8px; margin-bottom: 10px;
    cursor: pointer; display: flex; align-items: center; gap: 15px; background: white;
}
.checkout-option.selected { border-color: var(--color-acento); background-color: #e7f1ff; }
.checkout-option i { font-size: 24px; color: #555; }

/* Checkout Steps */
.checkout-step { display: none; }
.checkout-step.active { display: block; animation: fadeIn 0.3s; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Fix Checkbox Alignment */
.check-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; cursor: pointer; }
.check-row input[type="checkbox"] { width: 18px; height: 18px; margin: 0; cursor: pointer; accent-color: var(--color-acento); }
.check-row span { font-size: 14px; color: #333; font-weight: 500; }

/* Editor de Texto */
.text-editor { width: 100%; min-height: 200px; padding: 15px; border: 1px solid #dee2e6; border-radius: 8px; font-family: inherit; font-size: 14px; line-height: 1.5; resize: vertical; }

@media (max-width: 768px) {
    .modal-product-layout { flex-direction: column; }
    .store-nav-links { display: none; }
    .hero-banner { height: 180px; }
    .product-grid-view { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .category-select-container { display: none; } 
    .modal-content { margin: 0; width: 100%; height: 100%; border-radius: 0; overflow-y: auto; }
}

/* --- RESPONSIVE CARDS PARA TABLAS Y LISTAS --- */

@media (max-width: 768px) {
    /* 1. Transformar Tablas Clásicas en Tarjetas (Necesidad de Compra) */
    .responsive-table thead { display: none; }
    .responsive-table, .responsive-table tbody, .responsive-table tr, .responsive-table td { display: block; width: 100%; }
    
    .responsive-table tr {
        margin-bottom: 15px;
        background: #fff;
        border: 1px solid #dee2e6;
        border-radius: 8px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.05);
        padding: 15px;
    }

    .responsive-table td {
        padding: 8px 0;
        border: none;
        border-bottom: 1px solid #eee;
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: right;
    }
    
    .responsive-table td:last-child { border-bottom: none; }

    /* El atributo data-label hace de título en el celular */
    .responsive-table td::before {
        content: attr(data-label);
        font-weight: 700;
        color: #666;
        font-size: 12px;
        text-transform: uppercase;
        margin-right: 10px;
        text-align: left;
    }

    /* 2. Transformar Items de Compra (Registrar Compra) */
    .item-line {
        flex-direction: column;
        background: #fff;
        border: 1px solid #dee2e6;
        padding: 15px;
        border-radius: 8px;
        margin-bottom: 10px;
        gap: 10px;
        box-shadow: 0 2px 5px rgba(0,0,0,0.03);
    }
    
    .item-line input, .item-line select { margin: 0 !important; }
    
    /* Fila superior: Producto */
    .item-line .item-search { width: 100%; }
    
    /* Fila media: Cantidad y Costo */
    .mobile-row-inputs { display: flex; gap: 10px; width: 100%; }
    .mobile-row-inputs input { flex: 1; }

    /* Fila inferior: Subtotal y Borrar */
    .mobile-row-footer { display: flex; justify-content: space-between; align-items: center; width: 100%; border-top: 1px solid #eee; padding-top: 10px; margin-top: 5px; }
    .item-subtotal { text-align: left !important; font-size: 16px; color: var(--color-acento); }
}

/* --- TIMELINE VISUAL FIX (ESCRITORIO - Horizontal) --- */
        .timeline-wrapper { 
            overflow-x: auto; 
            padding-bottom: 15px; 
            margin-bottom: 20px;
        }
        .status-timeline { 
            display: flex; 
            justify-content: space-between; 
            min-width: 100%; 
            width: max-content; /* Crece en desktop si es necesario */
            position: relative; 
            padding: 0 10px;
            margin: 0 auto;
        }
        /* Línea Horizontal (Desktop) */
        .status-timeline::before { 
            content: ''; position: absolute; top: 14px; left: 25px; right: 25px; 
            height: 3px; background: #e5e7eb; z-index: 0; 
        }
        .status-step { 
            position: relative; z-index: 1; 
            display: flex; flex-direction: column; align-items: center; 
            width: 90px; 
            text-align: center; 
            flex-shrink: 0; 
        }
        .step-circle { 
            width: 32px; height: 32px; background: #fff; border: 3px solid #e5e7eb; 
            border-radius: 50%; display: flex; align-items: center; justify-content: center; 
            margin-bottom: 8px; color: #9ca3af; font-size: 14px; transition: all 0.3s;
            position: relative; z-index: 2; /* Importante para tapar línea */
        }
        .step-label { font-size: 11px; color: #9ca3af; font-weight: 500; line-height: 1.2; }
        
        .status-step.active .step-circle { background: #198754; border-color: #198754; color: white; transform: scale(1.1); }
        .status-step.active .step-label { color: #198754; font-weight: 700; }

        /* --- TRANSFORMACIÓN A VERTICAL EN MÓVIL --- */
        @media (max-width: 768px) {
            .timeline-wrapper {
                overflow: visible; /* Quitamos scroll lateral */
                width: 100%;
                padding-bottom: 0;
            }

            .status-timeline {
                flex-direction: column; /* Cambiamos a columna */
                width: 100%;
                align-items: flex-start; /* Alineamos a la izquierda */
                padding: 0 10px;
            }

            /* Transformamos la línea a Vertical */
            .status-timeline::before {
                top: 0; 
                bottom: 20px; /* Que no llegue al final del todo */
                left: 24px; /* Centrado con el círculo (10px padding + 16px mitad circulo) */
                right: auto; /* Anulamos el right de desktop */
                width: 3px; 
                height: 100%;
            }

            .status-step {
                flex-direction: row; /* Círculo izquierda, texto derecha */
                width: 100%;
                text-align: left;
                margin-bottom: 25px; /* Espacio entre pasos */
                gap: 15px;
            }
            
            .status-step:last-child {
                margin-bottom: 0;
            }

            .step-circle {
                margin-bottom: 0; /* Quitamos margen inferior de desktop */
                flex-shrink: 0;
                background-color: #fff; /* Fondo blanco para no ver la línea atravesada */
            }

            .step-label {
                font-size: 14px; /* Texto más grande y legible en móvil */
                padding-top: 2px;
            }
        }