:root {
    /* TEMA ORIGINAL (Por defecto) */
    --bg-main: #f3f4f6;
    --border: #d1d5db;
    --text-main: #1f2937;
    --text-red: #dc2626;
    --text-blue: #2563eb;
    --primary: #4b5563;
    --primary-hover: #f9fafb;
    --highlight: #e0e7ff;
    
    /* Configuración por defecto para tablas e inputs */
    --input-bg: #ffffff;
    --th-bg: #f9fafb;
    --tr-hover: #f3f4f6;
}

/* TEMA ALTO CONTRASTE */
[data-theme="high-contrast"] {
    --bg-main: #ffffff;
    --border: #000000;
    --text-main: #000000;
    --text-red: #d90000;
    --text-blue: #0026e6;
    --primary: #000000;
    --primary-hover: #e2e8f0;
    --highlight: #ffff00;
    
    --input-bg: #ffffff;
    --th-bg: #e2e8f0;
    --tr-hover: #cbd5e1;
    --font-w: 600;
    --th-w: 800;
    --border-w: 2px;
}

/* TEMA OSCURO */
[data-theme="dark"] {
    --bg-main: #121212;
    --border: #333333;
    --text-main: #ffffff;
    --text-red: #ff6b6b;
    --text-blue: #60a5fa;
    --primary: #ffffff;
    --primary-hover: #1f2937;
    --highlight: #374151;
    
    --input-bg: #1e1e1e;
    --th-bg: #1f2937;
    --tr-hover: #1e1e1e;
    --font-w: 400;
    --th-w: 500;
    --border-w: 1px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', sans-serif;
    font-weight: var(--font-w, 400);
    background-color: var(--bg-main);
    color: var(--text-main);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

input[type="text"], input[type="number"], select, input[type="date"] {
    border: 1px solid var(--border);
    padding: 6px 10px;
    outline: none;
    font-size: 13px;
    font-weight: var(--font-w, 400);
    color: var(--text-main);
    background: var(--input-bg);
}
input[readonly] { background-color: var(--tr-hover); }

.top-bar {
    display: flex; justify-content: space-between; align-items: center; padding: 10px 20px;
}
.datetime-box { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.datetime-box input { width: 90px; text-align: center; color: var(--text-main); }

.app-container {
    display: flex; flex: 1; padding: 0 20px 20px 20px; gap: 15px; overflow: hidden;
}

fieldset.panel-group {
    border: 1px solid var(--border);
    padding: 15px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: transparent;
    overflow: hidden; /* EVITA QUE EL CONTENIDO ESTIRE LA PANTALLA */
}
legend { padding: 0 5px; font-size: 13px; color: var(--text-main); font-weight: bold; }

/* Panel Izquierdo */
.main-panel {
    flex: 6;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* MANTIENE LOS BOTONES EN PANTALLA */
}

.search-box input { width: 60%; margin-bottom: 5px; flex-shrink: 0;}

.table-container {
    flex: 1;
    background: var(--bg-main);
    border: 1px solid var(--border);
    overflow-y: auto;
    min-height: 0; /* PERMITE QUE LA TABLA SE ENCOJA */
}

table { width: 100%; border-collapse: collapse; font-size: 13px; font-weight: var(--font-w, 400); color: var(--text-main); }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border); }
th { background: var(--th-bg); position: sticky; top: 0; font-weight: var(--th-w, 500); border-bottom: var(--border-w, 1px) solid var(--border); }
tr { cursor: pointer; }
tr:hover { background: var(--tr-hover); }
tr.selected { background: var(--highlight); color: #000; } /* Keep text black in selection for visibility */

.info-section { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; flex-shrink: 0; }
.info-box label { display: block; font-size: 12px; margin-bottom: 4px; }
.info-box input { width: 100%; background: var(--input-bg); }
.add-cart-btn-container { display: flex; justify-content: flex-end; margin-top: 5px; }

/* Botones Inferiores */
.bottom-actions { display: flex; justify-content: center; gap: 20px; margin-top: 15px; flex-shrink: 0; }
.spacer { flex: 1; }
.spacer-right { flex: 1.5; }
.right-align { justify-content: flex-end; padding-right: 20px; }

.btn { padding: 6px 20px; border: 1px solid var(--border); background: var(--input-bg); color: var(--text-main); cursor: pointer; font-size: 13px; box-shadow: 0 1px 2px rgba(0,0,0,0.05); font-weight: bold; }
.btn:hover { background: var(--primary-hover); }
.btn-outline-primary { border-color: var(--text-blue); color: var(--text-blue); }

/* Panel Derecho */
.sidebar {
    flex: 4;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.cart-table-container {
    flex: 1; background: var(--bg-main); border: 1px solid var(--border); overflow-y: auto; min-height: 0;
}
.cart-summary { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; flex-shrink: 0;}
.t-items { font-size: 13px; display: flex; align-items: center; gap: 8px; }
.t-items input { width: 60px; text-align: center; }

.payment-section { display: flex; gap: 15px; margin-top: 15px; flex-shrink: 0;}
.payment-type-container { flex: 1; }
.tipo-pago-group { border: 1px solid var(--border); padding: 15px; }
.radio-group { display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.checkbox-group { font-size: 13px; margin-top: 10px; }
.mt-2 { margin-top: 15px; }
.input-sm { width: 100%; }

.totales-group { flex: 1.5; display: flex; flex-direction: column; gap: 8px; padding-top: 10px; }
.total-row { display: flex; align-items: center; justify-content: flex-end; gap: 15px; }
.total-row label { font-size: 12px; }
.total-row input { width: 100px; text-align: right; font-size: 15px; font-weight: 500; }
.space-top { margin-top: 15px; }

.text-red { color: var(--text-red) !important; font-weight: 600; }
.text-blue { color: var(--text-blue) !important; font-weight: 600; }
.bold { font-weight: 700 !important; font-size: 16px !important; }

.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.4); align-items: center; justify-content: center; z-index: 50;}
.modal.active { display: flex; }
.modal-content { background: white; padding: 20px; border-radius: 4px; width: 300px; text-align: center; box-shadow: 0 4px 6px rgba(0,0,0,0.1); }
.modal-content input { width: 100%; margin: 15px 0; text-align: center; font-size: 16px; }
.modal-actions { display: flex; justify-content: center; gap: 10px; }

/* === ADAPTACION PARA TABLETS Y PANTALLAS PEQUENAS === */
@media screen and (max-width: 950px) {
    .app-container {
        flex-direction: column !important;
    }
    .main-content, .sidebar {
        width: 100% !important;
        flex: none !important;
    }
    .splitter {
        display: none !important;
    }
}

@media screen and (max-width: 950px) {
    body {
        height: auto !important;
        min-height: 100vh !important;
        overflow-y: auto !important;
    }
    .app-container {
        height: auto !important;
        overflow-y: visible !important;
    }
    .main-content, .sidebar {
        overflow-y: visible !important;
    }
    fieldset.panel-group {
        overflow: visible !important;
    }
    .cart-table-container, .list-table {
        min-height: 350px !important;
    }
}


/* ESTILOS EXTRAIDOS DE TEMPLATES */

/* From 403.html */
body.error-body {
            font-family: 'Inter', sans-serif;
            background-color: #f1f5f9;
            height: 100vh;
            margin: 0;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        .container {
            background-color: #fee2e2;
            color: #b91c1c;
            padding: 40px 50px;
            border-radius: 8px;
            border: 1px solid #fca5a5;
            box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
            text-align: center;
            max-width: 400px;
        }
        h2 { margin-top: 0; font-size: 24px; margin-bottom: 15px;}
        p { font-size: 15px; margin-bottom: 25px; }
        .btn {
            display: inline-block;
            padding: 10px 20px;
            background-color: #b91c1c;
            color: white;
            text-decoration: none;
            border-radius: 6px;
            font-weight: 600;
            transition: background-color 0.2s;
        }
        .btn:hover {
            background-color: #991b1b;
        }

/* From base.html */
body.base-body { margin: 0; font-family: 'Inter', sans-serif; background: var(--bg-main, #f8fafc); display: flex; height: 100vh; overflow: hidden; color: var(--text-main, #1e293b); }
        
        /* Sidebar Menu */
        .sidebar-menu { width: 260px; background: #0f172a; color: white; display: flex; flex-direction: column; box-shadow: 4px 0 15px rgba(0,0,0,0.05); z-index: 10;}
        .sidebar-header { padding: 25px 20px; border-bottom: 1px solid #1e293b; display: flex; align-items: center; gap: 10px; }
        .logo-mini { background: #3b82f6; color: white; width: 35px; height: 35px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-weight: bold; font-size: 18px; }
        .sidebar-header h2 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: 0.5px; }
        
        .menu-items { flex: 1; overflow-y: auto; padding: 20px 0; }
        .menu-items a { display: block; padding: 12px 25px; color: #cbd5e1; text-decoration: none; font-weight: 500; transition: all 0.2s; display: flex; align-items: center; gap: 12px; }
        .menu-items a:hover { background: #1e293b; color: white; border-left: 4px solid #3b82f6; padding-left: 21px; }
        .menu-items i { width: 20px; text-align: center; font-size: 1.1em; }
        
        .section-title { padding: 10px 25px; font-size: 11px; text-transform: uppercase; color: #64748b; letter-spacing: 1px; font-weight: 600; margin-top: 15px; margin-bottom: 5px; }
        
        .user-info { padding: 20px; background: #0b1121; border-top: 1px solid #1e293b; font-size: 13px; }
        .user-info .role { display: block; color: #94a3b8; font-size: 11px; margin-bottom: 4px; }
        .user-info a { display: inline-block; margin-top: 10px; color: #ef4444; text-decoration: none; font-weight: 600; }
        .user-info a:hover { color: #f87171; }
        
        /* Área Central */
        .main-content, .content { flex: 1; padding: 40px; overflow-y: auto; background: var(--bg-main); color: var(--text-main); }
        .header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 40px; border-bottom: 1px solid var(--border); padding-bottom: 20px; }
        .header h1 { margin: 0; color: var(--text-main); font-size: 26px; font-weight: 700; }
        .header .datetime { color: var(--text-main); font-size: 14px; background: var(--input-bg); padding: 8px 15px; border-radius: 20px; border: 1px solid var(--border); }
        
        /* Tarjetas (Módulos) */
        .card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 25px; }
        .card, .dashboard-card { background: var(--input-bg); border-radius: 12px; padding: 25px; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); border-top: 4px solid #e2e8f0; display: flex; flex-direction: column; transition: transform 0.2s; text-decoration: none; color: var(--text-main); }
        .card:hover, .dashboard-card:hover { transform: translateY(-5px); }
        .card h3, .card-title { margin-top: 0; margin-bottom: 15px; font-size: 18px; color: var(--text-main); font-weight: 600; }
        .card p, .card-desc { color: #64748b; font-size: 14px; line-height: 1.5; margin-bottom: 20px; flex: 1; }
        .btn-module { display: inline-block; padding: 10px 20px; color: white; text-decoration: none; border-radius: 6px; font-weight: 500; text-align: center; transition: opacity 0.2s; border: none; cursor: pointer; }
        .btn-module:hover { opacity: 0.9; }

        /* Scrollbar */
        .menu-items::-webkit-scrollbar { width: 6px; }
        .menu-items::-webkit-scrollbar-track { background: transparent; }
        .menu-items::-webkit-scrollbar-thumb { background: #334155; border-radius: 10px; }
        .menu-items::-webkit-scrollbar-thumb:hover { background: #475569; }
body.base-body { margin: 0; font-family: \'Inter\', sans-serif; background: var(--bg-main, #f8fafc); display: flex; flex-direction: row !important; height: 100vh; overflow: hidden; color: var(--text-main, #1e293b); }
            
            /* Toggle Sidebar Styles */
            .sidebar-menu { 
                width: 260px; 
                transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
                overflow-x: hidden;
                white-space: nowrap;
            }
            .sidebar-menu.collapsed {
                width: 65px;
            }
            /* Al hacer hover sobre el menú colapsado, se expande temporalmente */
            .sidebar-menu.collapsed:hover {
                width: 260px;
            }
            /* Ocultar elementos de texto cuando está colapsado y NO se le hace hover */
            .sidebar-menu.collapsed:not(:hover) .sidebar-text,
            .sidebar-menu.collapsed:not(:hover) .menu-btn span:last-child,
            .sidebar-menu.collapsed:not(:hover) .chevron,
            .sidebar-menu.collapsed:not(:hover) .submenu,
            .sidebar-menu.collapsed:not(:hover) .user-info {
                opacity: 0;
                pointer-events: none;
            }
            .sidebar-menu.collapsed:not(:hover) .menu-btn {
                padding-left: 22px; /* Centrar icono */
            }
            .sidebar-menu.collapsed:not(:hover) .single-link {
                padding-left: 22px;
            }
            .sidebar-menu.collapsed:not(:hover) .single-link span {
                opacity: 0;
            }
            .sidebar-text {
                transition: opacity 0.2s;
            }
            .toggle-sidebar-btn {
                background: none; border: none; color: #94a3b8; cursor: pointer; font-size: 1.2rem;
                transition: color 0.2s;
                padding-right: 15px;
            }
            .toggle-sidebar-btn:hover { color: white; }

            /* Sidebar Accordion Styles */
            .sidebar-menu { width: 260px; background: #0f172a; color: white; display: flex; flex-direction: column; box-shadow: 4px 0 15px rgba(0,0,0,0.05); z-index: 10;}
            .sidebar-header { padding: 25px 20px; border-bottom: 1px solid #1e293b; display: flex; align-items: center; gap: 10px; }
            .logo-mini { background: #3b82f6; color: white; width: 35px; height: 35px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-weight: bold; font-size: 18px; }
            .sidebar-header h2 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: 0.5px; }
            
            .menu-items { flex: 1; overflow-y: auto; padding: 10px 0; }
            .menu-item { padding: 0 15px; margin-bottom: 5px; }
            .menu-btn { 
                width: 100%; display: flex; align-items: center; justify-content: space-between; 
                padding: 12px 15px; background: transparent; border: none; color: #cbd5e1; 
                font-size: 14px; font-weight: 500; font-family: 'Inter', sans-serif; cursor: pointer; 
                border-radius: 8px; transition: all 0.2s;
            }
            .menu-btn:hover { background: #1e293b; color: white; }
            .menu-btn.active { background: #1e293b; color: white; border-left: 4px solid #3b82f6; }
            .menu-btn i.icon { width: 20px; text-align: center; margin-right: 10px; font-size: 1.1em; }
            .menu-btn .chevron { font-size: 0.8em; transition: transform 0.3s; }
            .menu-btn.active .chevron { transform: rotate(180deg); }
            
            .submenu { display: none; padding-left: 35px; padding-top: 5px; padding-bottom: 5px; flex-direction: column; gap: 8px; }
            .submenu.open { display: flex; }
            .submenu a { color: #94a3b8; text-decoration: none; font-size: 13px; font-weight: 500; transition: color 0.2s; }
            .submenu a:hover {
                color: #fff;
                background: #334155;
                padding-left: 45px;
            }
            
            /* Sub-submenus */
            .inner-menu-btn {
                width: 100%;
                text-align: left;
                padding: 10px 15px 10px 40px;
                background: none;
                border: none;
                color: #94a3b8;
                font-size: 0.85rem;
                cursor: pointer;
                display: flex;
                justify-content: space-between;
                align-items: center;
            }
            .inner-menu-btn:hover { color: #fff; background: #334155; }
            .inner-submenu.open { max-height: 500px !important; }
            
            .single-link {
                display: flex; align-items: center; padding: 12px 15px; margin: 0 15px 5px 15px;
                color: #cbd5e1; text-decoration: none; font-weight: 500; font-size: 14px;
                border-radius: 8px; transition: all 0.2s;
            }
            .single-link:hover { background: #1e293b; color: white; }
            .single-link i { width: 20px; text-align: center; margin-right: 10px; font-size: 1.1em; }

            .user-info { padding: 20px; background: #0b1121; border-top: 1px solid #1e293b; font-size: 13px; }
            .user-info .role { display: block; color: #94a3b8; font-size: 11px; margin-bottom: 4px; }
            .user-info a { display: inline-block; margin-top: 10px; color: #ef4444; text-decoration: none; font-weight: 600; }
            .user-info a:hover { color: #f87171; }
            
            /* Main Content Area */
            .main-content, .content { flex: 1; padding: 40px; overflow-y: auto; background: var(--bg-main); color: var(--text-main); }
            .header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 40px; border-bottom: 1px solid var(--border); padding-bottom: 20px; }
            .header h1 { margin: 0; color: var(--text-main); font-size: 26px; font-weight: 700; }
            .header .datetime { color: var(--text-main); font-size: 14px; background: var(--input-bg); padding: 8px 15px; border-radius: 20px; border: 1px solid var(--border); }
            
            /* Dashboard Cards */
            .card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 25px; }
            .card, .dashboard-card { background: var(--input-bg); border-radius: 12px; padding: 25px; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); border-top: 4px solid #e2e8f0; display: flex; flex-direction: column; transition: transform 0.2s, box-shadow 0.2s; text-decoration: none; color: var(--text-main); }
            .card:hover, .dashboard-card:hover { transform: translateY(-5px); box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1); }
            .card h3, .card-title { margin-top: 0; margin-bottom: 15px; font-size: 18px; font-weight: 600; color: var(--text-main); }
            .card p, .card-desc { color: #64748b; font-size: 14px; line-height: 1.5; flex: 1; margin-bottom: 20px; }
            .btn-module { display: inline-block; padding: 10px 20px; color: white; text-decoration: none; border-radius: 6px; font-weight: 500; text-align: center; transition: opacity 0.2s; border: none; cursor: pointer; }
            .btn-module:hover { opacity: 0.9; }

            /* Scrollbar */
            .menu-items::-webkit-scrollbar { width: 6px; }
            .menu-items::-webkit-scrollbar-track { background: transparent; }
            .menu-items::-webkit-scrollbar-thumb { background: #334155; border-radius: 10px; }
            .menu-items::-webkit-scrollbar-thumb:hover { background: #475569; }

/* From categorias.html */
.splitter {

        width: 6px;

        background-color: #e2e8f0;

        cursor: col-resize;

        transition: background-color 0.2s;

        z-index: 10;

        margin: 0 10px;

    }

    .splitter:hover, .splitter.dragging {

        background-color: #3b82f6;

    }

    .form-group label {

        display: block; margin-bottom: 4px; font-weight: 500; font-size: 14px;

    }

    .form-control {

        width: 100%; padding: 8px; border: 1px solid #cbd5e1; border-radius: 4px; box-sizing: border-box;

    }

/* From cierre_caja.html */
.caja-container {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 40px;
    }
    .caja-card {
        background: #fff;
        border: 1px solid #ccc;
        border-radius: 8px;
        padding: 30px;
        width: 100%;
        max-width: 600px;
        box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    }
    .status-badge {
        display: inline-block;
        padding: 5px 15px;
        border-radius: 15px;
        color: #fff;
        font-weight: bold;
        margin-bottom: 20px;
    }
    .status-abierta { background-color: #10b981; }
    .status-cerrada { background-color: #ef4444; }
    
    .summary-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 15px;
        margin-bottom: 30px;
    }
    .summary-item {
        background: #f8f9fa;
        padding: 15px;
        border-radius: 6px;
        border: 1px solid #e5e7eb;
    }
    .summary-item label {
        display: block;
        font-size: 13px;
        color: #6b7280;
        margin-bottom: 5px;
    }
    .summary-item .value {
        font-size: 20px;
        font-weight: bold;
        color: #111827;
    }

/* From clientes.html */
.splitter {
            width: 6px;
            background-color: #e2e8f0;
            cursor: col-resize;
            transition: background-color 0.2s;
            z-index: 10;
        }
        .splitter:hover, .splitter.dragging {
            background-color: #3b82f6;
        }
        input[type="text"] { text-transform: uppercase; }

/* From compras.html */
.splitter {
            width: 6px;
            background-color: #e2e8f0;
            cursor: col-resize;
            transition: background-color 0.2s;
            z-index: 10;
        }
        .splitter:hover, .splitter.dragging {
            background-color: #3b82f6;
        }
        .modal {
            display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%;
            background-color: rgba(0,0,0,0.5); justify-content: center; align-items: center;
        }
        .modal-content {
            background-color: white; padding: 25px; border-radius: 8px; width: 350px;
            box-shadow: 0 4px 15px rgba(0,0,0,0.2);
        }
        .modal-content h3 { margin-top: 0; margin-bottom: 20px; font-size: 18px; color: #1e293b; }
        .form-group { margin-bottom: 12px; }
        .form-group label { display: block; margin-bottom: 5px; font-size: 13px; font-weight: 500; }
        .form-group input, .form-group select { width: 100%; padding: 8px; border: 1px solid #cbd5e1; border-radius: 4px; box-sizing: border-box; margin: 0; }
        .modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* From historial_ventas.html */
#ventasTable {
        border-collapse: separate;
        border-spacing: 0;
    }
    #ventasTable th {
        position: sticky;
        top: 0;
        background-color: #e2e8f0;
        z-index: 2;
        border-bottom: 2px solid #cbd5e1;
    }
    .table-container.list-table {
        overflow-y: auto !important;
        overflow-x: auto !important;
    }

    
        .splitter {
            width: 6px;
            background-color: #e2e8f0;
            cursor: col-resize;
            transition: background-color 0.2s;
            z-index: 10;
        }
        .splitter:hover, .splitter.dragging {
            background-color: #3b82f6;
        }
        .details-table-container {
            margin-top: 15px;
            background: #fff;
            border: 1px solid #ccc;
            flex: 1;
            overflow-y: auto;
            min-height: 0;
        }
        .details-table {
            width: 100%;
            border-collapse: collapse;
        }
        .details-table th, .details-table td {
            border: 1px solid #ddd;
            padding: 6px;
            font-size: 13px;
        }
        .details-table th {
            background-color: #f4f4f4;
            position: sticky;
            top: 0;
        }
    
    /* Adapting to base.html flex content */
    .content, .main-content {
        display: flex;
        flex-direction: column;
        padding: 20px !important;
        overflow-y: auto !important; /* Prevent page scroll, use internal scroll */
    }
    .app-container {
        flex: 1;
        min-height: 0;
        margin-top: 20px;
    }

/* From index.html */
.splitter {
            width: 6px;
            background-color: #e2e8f0;
            cursor: col-resize;
            transition: background-color 0.2s;
            z-index: 10;
        }
        .splitter:hover, .splitter.dragging {
            background-color: #3b82f6;
        }

/* From inventario.html */
.details-table-container { margin-top: 15px; background: #fff; border: 1px solid #ccc; flex: 1; min-height: 100px; overflow-y: auto; display: flex; flex-direction: column; }
        .details-table { width: 100%; border-collapse: collapse; }
        .details-table th, .details-table td { border: 1px solid #ddd; padding: 6px; font-size: 13px; }
        .details-table th {
            background-color: #f4f4f4;
            position: sticky;
            top: 0;
        }
        .splitter {
            width: 6px;
            background-color: #e2e8f0;
            cursor: col-resize;
            transition: background-color 0.2s;
            z-index: 10;
        }
        .splitter:hover, .splitter.dragging {
            background-color: #3b82f6;
        }
        .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
        .form-group { display: flex; flex-direction: column; }
        .form-group label { font-size: 12px; font-weight: bold; margin-bottom: 2px; }
        .form-group input, .form-group select { padding: 6px; border: 1px solid #ccc; border-radius: 4px; }
        .form-group input[type="text"] { text-transform: uppercase; }
        
        .btn-small { padding: 4px 8px; font-size: 11px; }
        
        .hidden { display: none !important; }

/* From login.html */
body.login-body { font-family: 'Inter', sans-serif; background: #e2e8f0; display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; }
        .login-box { background: white; padding: 40px; border-radius: 10px; box-shadow: 0 10px 25px rgba(0,0,0,0.1); width: 320px; text-align: center; }
        .logo-box { width: 60px; height: 60px; background: #2563eb; color: white; font-size: 30px; font-weight: bold; display: flex; justify-content: center; align-items: center; border-radius: 15px; margin: 0 auto 20px auto; }
        .login-box h2 { color: #1e293b; margin: 0 0 5px 0; font-size: 24px; }
        .login-box p { color: #64748b; margin-bottom: 25px; font-size: 14px; }
        .login-box input { width: 100%; padding: 12px; margin: 8px 0; border: 1px solid #cbd5e1; border-radius: 6px; box-sizing: border-box; font-size: 14px; outline: none; transition: border 0.3s; }
        .login-box input:focus { border-color: #2563eb; }
        .login-box button { width: 100%; padding: 12px; background: #2563eb; color: white; border: none; border-radius: 6px; cursor: pointer; font-size: 15px; font-weight: 600; margin-top: 15px; transition: background 0.3s; }
        .login-box button:hover { background: #1d4ed8; }
        .error { color: #ef4444; font-size: 13px; margin-bottom: 15px; font-weight: 500; background: #fee2e2; padding: 10px; border-radius: 6px; }

/* From proveedores.html */
.splitter {
            width: 6px;
            background-color: #e2e8f0;
            cursor: col-resize;
            transition: background-color 0.2s;
            z-index: 10;
        }
        .splitter:hover, .splitter.dragging {
            background-color: #3b82f6;
        }

/* From reporte_existencias.html */
.content, .main-content {
        min-width: 0 !important; /* Fix flexbox blowout */
        overflow-x: hidden !important;
    }

/* From reporte_proveedores.html */
/* Adapting to base.html flex content */
    .content, .main-content {
        display: flex;
        flex-direction: column;
        padding: 20px !important;
        overflow-y: auto !important;
    }
    .app-container {
        flex: 1;
        min-height: 0;
        margin-top: 20px;
        display: flex;
    }

/* From vencimientos.html */
.status-vencido { background-color: #fca5a5; color: #991b1b; font-weight: bold; }
    .status-por-vencer { background-color: #fde047; color: #854d0e; font-weight: bold; }
    .status-atencion { background-color: #fef08a; color: #a16207; }
    .status-ok { color: #166534; }
    
    .badge {
        padding: 3px 8px;
        border-radius: 12px;
        font-size: 11px;
        display: inline-block;
    }
\n    #lotesTable {
        table-layout: fixed;
        width: 100%;
    }
    #lotesTable th {
        resize: horizontal;
        overflow: hidden;
        white-space: nowrap;
        position: sticky;
        top: 0;
        z-index: 2;
        background: #f8fafc;
        border-right: 1px solid #ccc;
    }
    #lotesTable td {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
.status-vencido { background-color: #fca5a5; color: #991b1b; font-weight: bold; }
    .status-por-vencer { background-color: #fde047; color: #854d0e; font-weight: bold; }
    .status-atencion { background-color: #fef08a; color: #a16207; }
    .status-ok { color: #166534; }
    
    .badge {
        padding: 3px 8px;
        border-radius: 12px;
        font-size: 11px;
        display: inline-block;
    }
\n    #lotesTable {
        table-layout: fixed;
        width: 100%;
    }
    #lotesTable th {
        resize: horizontal;
        overflow: hidden;
        white-space: nowrap;
        position: sticky;
        top: 0;
        z-index: 2;
        background: #f8fafc;
        border-right: 1px solid #ccc;
    }
    #lotesTable td {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

/* --- SEMANTIC UTILITY CLASSES (Refactored from inline styles) --- */
.text-center { text-align: center; }
.w-100 { width: 100%; }
.m-0 { margin: 0; }
.p-20 { padding: 20px; }

.header-flex-row { 
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; 
}
.header-left-group { 
    display: flex; align-items: center; gap: 15px; 
}

.btn-primary-link { 
    background: #2563eb; color: white; padding: 8px 15px; border-radius: 6px; 
    text-decoration: none; font-weight: bold; font-family: 'Inter', sans-serif; 
}
.btn-primary-link:hover {
    background: #1d4ed8;
}

.form-control-standard {
    width: 100%; padding: 8px; border: 1px solid #cbd5e1; border-radius: 4px;
}

.table-cell-standard { padding: 12px; }
.table-cell-border { padding: 12px; border-bottom: 2px solid #e2e8f0; }
.font-13 { font-size: 13px; }
.mb-0 { margin-bottom: 0; }

/* From index.html */
body.pos-body { margin: 0; display: flex; flex-direction: column; height: 100vh; overflow: hidden; background: #f8fafc; }
