:root {
    --bg-main: #f5f6f8;
    --bg-white: #ffffff;
    --text-dark: #1e293b;
    --text-muted: #94a3b8;
    --primary: #2e3192;
    --primary-light: #4f46e5;
    --blue-light: #93c5fd;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.05);
}

body { margin: 0; font-family: 'Inter', sans-serif; background-color: var(--bg-main); color: var(--text-dark); }
.app { display: flex; height: 100vh; overflow: hidden; }

/* === SIDEBAR === */
.sidebar {
    width: 260px; background: var(--bg-white); border-right: 1px solid var(--border-color);
    display: flex; flex-direction: column; padding: 20px; position: relative; box-sizing: border-box;
}

.collapse-btn {
    position: absolute; right: -12px; top: 25px; background: white; border: 1px solid var(--border-color);
    border-radius: 50%; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center;
    font-size: 10px; color: var(--text-muted); cursor: pointer; box-shadow: var(--shadow-sm); z-index: 10;
}

.logo-container { text-align: center; margin-bottom: 30px; }
.logo { margin: 0; font-size: 32px; font-weight: 800; letter-spacing: -1px; }
.subtitle { margin: 0; font-size: 11px; color: var(--text-muted); font-weight: 500; }

/* === SELECTOR DE MÓDULOS === */
.module-selector-wrapper { position: relative; margin-bottom: 30px; }
.btn-module {
    display: flex; justify-content: space-between; align-items: center; width: 100%;
    background: var(--bg-white); border: 1px solid var(--border-color); padding: 12px 16px;
    border-radius: 8px; font-weight: 600; font-size: 14px; color: var(--text-dark);
    box-shadow: 0 4px 10px rgba(0,0,0,0.03); cursor: pointer;
}
.btn-module-left { display: flex; align-items: center; gap: 10px; }

.module-dropdown {
    display: none; position: absolute; top: 100%; left: 0; width: 100%;
    background: var(--bg-white); border: 1px solid var(--border-color); border-radius: 8px;
    box-shadow: var(--shadow-md); margin-top: 5px; z-index: 100; overflow: hidden;
}
.module-dropdown.show { display: block; }
.module-dropdown ul { list-style: none; padding: 0; margin: 0; }
.module-dropdown li {
    padding: 12px 16px; font-size: 13px; font-weight: 600; color: var(--text-dark); cursor: pointer;
    display: flex; align-items: center; gap: 10px; transition: background 0.2s, color 0.2s;
}
.module-dropdown li:hover { background: var(--bg-main); color: var(--primary-light); }
.module-dropdown li:hover i { color: var(--primary-light); }

/* === CONTENEDOR DINÁMICO DE MENÚS === */
#menus-container { flex-grow: 1; overflow-y: auto; padding-right: 5px; }
#menus-container::-webkit-scrollbar { width: 4px; }
#menus-container::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

.section-divider {
    display: flex; align-items: center; text-align: center; color: var(--text-muted); font-size: 10px; font-weight: 700; margin-bottom: 15px;
}
.section-divider::before, .section-divider::after { content: ''; flex: 1; border-bottom: 1px solid var(--border-color); }
.section-divider:not(:empty)::before { margin-right: .5em; }
.section-divider:not(:empty)::after { margin-left: .5em; }

/* Listas simples (Ventas y Compras) */
.menu-list { list-style: none; padding: 0; margin: 0; }
.menu-list li {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 0; font-size: 13px; font-weight: 500; color: var(--text-muted); cursor: pointer;
}
.menu-item-left { display: flex; align-items: center; gap: 10px; }
.menu-list li.active { color: var(--text-dark); font-weight: 600; }

/* Acordeones (Operaciones) */
.submenu { margin-bottom: 5px; }
.submenu summary {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 0; font-size: 13px; font-weight: 500; color: var(--text-muted); cursor: pointer; list-style: none;
}
.submenu summary::-webkit-details-marker { display: none; }
.submenu summary::after {
    content: '\f054'; font-family: 'Font Awesome 6 Free'; font-weight: 900;
    font-size: 10px; color: var(--text-muted); transition: transform 0.2s;
}
.submenu[open] summary { color: var(--text-dark); font-weight: 600; }
.submenu[open] summary i { color: var(--primary-light) !important; }
.submenu[open] summary::after { transform: rotate(90deg); }

.sub-menu-list {
    list-style: none; padding-left: 28px; margin: 0 0 15px 0; border-left: 1px solid var(--border-color); margin-left: 10px;
}
.sub-menu-list li {
    padding: 8px 10px; font-size: 12px; color: var(--text-muted); cursor: pointer; border-radius: 6px; transition: background 0.2s; margin-bottom: 2px;
}
.sub-menu-list li:hover { background: var(--bg-main); color: var(--text-dark); }
.sub-menu-list li.active { color: var(--primary-light); font-weight: 600; background: #e0e7ff; }

/* === FOOTER SIDEBAR === */
.sidebar-footer { margin-top: auto; padding-top: 15px; }
.footer-divider { display: flex; align-items: center; font-size: 9px; font-weight: 700; color: var(--text-muted); margin-bottom: 15px; }
.footer-divider::after { content: ''; flex: 1; border-bottom: 1px solid var(--border-color); margin-left: .5em; }
.date-input-container { display: flex; justify-content: space-between; align-items: center; border: 1px solid var(--border-color); padding: 10px 12px; border-radius: 6px; }
.date-input-container input { border: none; outline: none; font-size: 12px; color: var(--text-dark); font-weight: 500; width: 100%; font-family: 'Inter'; background: transparent; }
.date-input-container i { color: var(--text-muted); }

/* === CONTENIDO PRINCIPAL Y DASHBOARD === */
.main-content { flex: 1; display: flex; flex-direction: column; background: var(--bg-main); overflow-y: auto;}

.topbar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 15px 40px; background: var(--bg-white); border-bottom: 1px solid var(--border-color);
}
.topbar-left { display: flex; align-items: center; gap: 20px; }
.user-info { display: flex; flex-direction: column; }
.welcome-text { font-size: 14px; color: var(--text-dark); }
.company-text { font-size: 10px; color: var(--text-muted); font-weight: 600; letter-spacing: 0.5px; margin-top: 2px;}
.vertical-divider { width: 1px; height: 30px; background: var(--border-color); }
.module-info { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.text-primary { color: var(--primary-light); }

.company-logo-card {
    background: var(--bg-white); border: 1px solid var(--border-color);
    padding: 8px 20px; border-radius: 8px; box-shadow: var(--shadow-sm);
}

.dashboard-container { padding: 30px 40px; max-width: 1400px; margin: 0 auto; width: 100%; box-sizing: border-box; }

.banner-card { background: var(--bg-white); padding: 10px; border-radius: 16px; margin-bottom: 25px; box-shadow: var(--shadow-sm); }
.banner-content {
    background: linear-gradient(90deg, #2e3192 0%, #4f46e5 40%, rgba(79, 70, 229, 0.8) 100%), url('https://images.unsplash.com/photo-1600880292203-757bb62b4baf?ixlib=rb-4.0.3&auto=format&fit=crop&w=1000&q=80') center/cover;
    border-radius: 12px; padding: 50px 60px; color: white;
}
.banner-content h2 { font-size: 32px; margin: 0 0 15px 0; font-weight: 700; }
.banner-content h3 { font-size: 16px; margin: 0 0 20px 0; font-weight: 500; }
.banner-content p { font-size: 13px; line-height: 1.6; max-width: 60%; margin: 0; color: rgba(255,255,255,0.9); }

.cards-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 25px; }

.card { background: var(--bg-white); padding: 25px; border-radius: 16px; box-shadow: var(--shadow-sm); border: 1px solid rgba(0,0,0,0.02); }
.card-header { display: flex; align-items: center; gap: 15px; margin-bottom: 25px; }
.icon-circle {
    width: 40px; height: 40px; background: #e0e7ff; color: var(--primary-light);
    border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.card-header h4 { margin: 0; font-size: 16px; color: var(--text-dark); }

.feature-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 15px; }
.feature-list li { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--text-dark); font-weight: 500; }
.text-blue-light { color: var(--blue-light); font-size: 18px; }

.right-cards { display: flex; flex-direction: column; gap: 25px; }
.date-text { font-size: 11px; color: var(--text-muted); font-weight: 600; }
.view-container { display: none; width: 100%; }
.sub-menu-list li.active { color: var(--primary-light); font-weight: 700; background: #e0e7ff; }

/* === CLASES ADICIONALES PARA FORMULARIOS === */
.input-style {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    color: var(--text-dark);
    box-sizing: border-box;
    margin-bottom: 10px;
}
.btn-primary {
    background: var(--primary);
    color: var(--bg-white);
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}
.section {
    background: var(--bg-main);
    padding: 15px;
    border-radius: 8px;
}
.section h4, .section h5 { margin: 0 0 10px 0; color: var(--text-dark); font-size: 14px; }