/* ==========================================================================
   COMPARATIVO ANUAL DE VENTAS (2025 vs 2026) - TEMA COMISIONES
   Inspirado en la paleta y acabados visuales de MBA Comisiones
   ========================================================================== */

:root {
    /* Paleta Oficial Procables */
    --procables-blue: #231F83;
    --procables-blue-dark: #191660;
    --procables-blue-subtle: #eef2ff;
    --procables-red: #EE140F;
    --procables-red-hover: #c90e0a;
    --procables-red-light: #fef2f2;
    
    --bg-main: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f5f9;
    --border-color: #e2e8f0;
    --border-highlight: rgba(35, 31, 131, 0.3);
    
    /* Tipografía y Textos */
    --text-main: #1e293b;
    --text-muted: #64748b;
    --text-subtle: #94a3b8;
    
    /* Sidebar Procables Azul Corporativo */
    --sidebar-bg: #191660;
    --sidebar-header-bg: #110e42;
    --sidebar-border: rgba(255, 255, 255, 0.08);
    --sidebar-text: #cbd5e1;
    --sidebar-text-hover: #ffffff;
    --sidebar-item-hover: rgba(255, 255, 255, 0.12);
    
    /* Acentos y Finanzas */
    --primary: #231F83;
    --primary-hover: #191660;
    --primary-subtle: #eef2ff;
    
    --success: #10b981;
    --success-subtle: #ecfdf5;
    --danger: #EE140F;
    --danger-subtle: #fef2f2;
    --warning: #f59e0b;
    --warning-subtle: #fffbeb;
    --purple: #231F83;
    --purple-subtle: #eef2ff;
    --cyan: #06b6d4;
    --cyan-subtle: #ecfeff;

    /* Estructura y Sombras */
    --sidebar-width: 250px;
    --navbar-height: 64px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-card: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Theme Support opcional */
body.theme-dark {
    --bg-main: #0b0f19;
    --bg-secondary: #111827;
    --bg-card: rgba(17, 24, 39, 0.85);
    --bg-card-hover: rgba(31, 41, 55, 0.9);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-highlight: rgba(35, 31, 131, 0.4);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-subtle: #64748b;
    --sidebar-bg: #0b0f19;
    --sidebar-header-bg: #030712;
    --sidebar-border: rgba(255, 255, 255, 0.08);
}

/* Reset y Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

h1, h2, h3, h4, .brand-title, .kpi-val {
    font-family: 'Poppins', sans-serif;
}

/* Glassmorphism / Clean Cards */
.glass-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    transition: var(--transition);
}

.glass-card:hover {
    box-shadow: var(--shadow-hover);
}

/* Top Navigation Bar */
.navbar {
    min-height: 68px;
    height: auto;
    background: var(--bg-secondary);
    border-top: 4px solid #EE140F;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.btn-toggle-sidebar {
    display: none;
    background: #f1f5f9;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.45rem 0.65rem;
    font-size: 1rem;
    color: var(--text-main);
    cursor: pointer;
    transition: var(--transition);
}

.btn-toggle-sidebar:hover {
    background: var(--primary-subtle);
    color: var(--primary);
    border-color: var(--primary);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(3px);
    z-index: 105;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.brand-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    line-height: 1.25;
}

.brand-icon {
    font-size: 1.35rem;
    color: var(--primary);
    background: var(--primary-subtle);
    padding: 0.5rem 0.6rem;
    border-radius: var(--radius-sm);
}

.brand-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--procables-blue, #231F83);
    letter-spacing: -0.2px;
    display: block;
    line-height: 1.2;
    white-space: nowrap;
}

.brand-subtitle {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
    display: block;
    line-height: 1.2;
    white-space: nowrap;
}

.nav-center {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.filter-group-inline {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
}

.segmented-control {
    display: flex;
    background: #f1f5f9;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 2px;
}

.seg-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.35rem 0.85rem;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
}

.seg-btn.active {
    background: var(--primary);
    color: #FFF;
    box-shadow: 0 1px 2px rgba(79, 70, 229, 0.2);
}

.form-select-sm {
    background: #ffffff;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 500;
    outline: none;
    cursor: pointer;
}

.form-select-sm:focus {
    border-color: var(--primary);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.theme-toggle {
    background: #f1f5f9;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.theme-toggle:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-subtle);
}

/* App Layout */
.app-layout {
    display: flex;
    min-height: calc(100vh - var(--navbar-height));
}

/* Sidebar Estilo Comisiones - Fijo y siempre visible */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 1.25rem 0.75rem;
    position: sticky;
    top: var(--navbar-height, 60px);
    height: calc(100vh - var(--navbar-height, 60px));
    overflow-y: auto;
    flex-shrink: 0;
    z-index: 100;
}

.sidebar::-webkit-scrollbar {
    width: 5px;
}
.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 0.9rem;
    background: transparent;
    border: none;
    color: var(--sidebar-text);
    font-size: 0.88rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
    width: 100%;
}

.menu-item:hover {
    background: var(--sidebar-item-hover);
    color: var(--sidebar-text-hover);
}

.menu-item.active {
    background: var(--procables-red);
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(238, 20, 15, 0.35);
}

.menu-item i {
    font-size: 1rem;
    width: 20px;
    text-align: center;
}

.sidebar-section-divider {
    height: 1px;
    background: var(--sidebar-border);
    margin: 0.5rem 0.4rem;
}

/* Sidebar Acordeón y Secciones Desplegables */
.sidebar-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.55rem 0.85rem;
    font-size: 0.72rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    user-select: none;
    margin: 0.2rem 0;
}

.sidebar-section-header:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff;
}

.sidebar-section-header.has-active-child {
    color: #ffffff;
    background: rgba(238, 20, 15, 0.12);
    border-left: 3px solid var(--procables-red);
}

.sidebar-section-header .section-icon {
    font-size: 0.8rem;
    width: 16px;
    text-align: center;
    color: inherit;
}

.sidebar-section-header .section-chevron {
    font-size: 0.72rem;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    color: #94a3b8;
}

.sidebar-section-header.collapsed .section-chevron {
    transform: rotate(-90deg);
}

.sidebar-collapsible-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    overflow: hidden;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease, margin 0.25s ease;
    max-height: 500px;
    opacity: 1;
    padding-left: 0.35rem;
}

.sidebar-collapsible-group.collapsed {
    max-height: 0 !important;
    opacity: 0;
    margin-top: 0;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
    pointer-events: none;
}

.menu-subitem {
    font-size: 0.84rem;
    padding: 0.55rem 0.85rem;
    border-left: 2px solid transparent;
}

.menu-subitem:hover {
    border-left-color: rgba(255, 255, 255, 0.3);
}

.menu-subitem.active {
    border-left-color: #ffffff;
}

.sidebar-footer {
    border-top: 1px solid var(--sidebar-border);
    padding-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.76rem;
    color: var(--sidebar-text);
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.dot.online {
    background: var(--success);
    box-shadow: 0 0 6px var(--success);
}

.version-text {
    font-size: 0.68rem;
    color: #64748b;
}

/* Content Area */
.content-area {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    background: var(--bg-main);
}

/* Filters Bar */
.filters-bar {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.filter-item {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex: 1;
    min-width: 170px;
}

.filter-item label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-select {
    background: #ffffff;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.5rem 0.8rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    outline: none;
    transition: var(--transition);
}

.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-subtle);
}

.filter-actions {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    margin-top: 1.25rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition);
}

.btn-primary {
    background: var(--primary);
    color: #FFF;
}
.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: #ffffff;
    color: var(--text-muted);
    border-color: var(--border-color);
}
.btn-secondary:hover {
    background: var(--bg-card-hover);
    color: var(--text-main);
}

.btn-outline-primary {
    background: transparent;
    border-color: var(--primary);
    color: var(--primary);
}
.btn-outline-primary:hover {
    background: var(--primary);
    color: #FFF;
}

.btn-outline-success {
    background: transparent;
    border-color: var(--success);
    color: var(--success);
}
.btn-outline-success:hover {
    background: var(--success);
    color: #FFF;
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.78rem;
}

/* KPI Cards Layout (2 Columnas Simétricas 2025 vs 2026) */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
    gap: 1.15rem;
    margin-bottom: 1.5rem;
}

.kpi-card {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.kpi-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.kpi-title-box {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.kpi-title-box i {
    font-size: 1.1rem;
}

.kpi-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.kpi-comparison-box {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.75rem 0.85rem;
    gap: 0.75rem;
}

.kpi-single-val-box {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.85rem 1rem;
}

.kpi-year-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    min-width: 0;
}

.kpi-col-divider {
    width: 1px;
    background: var(--border-color);
    margin: 0.2rem 0;
}

.year-tag {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    margin-bottom: 0.35rem;
    display: inline-block;
}

.tag-2025 {
    background: #e2e8f0;
    color: #475569;
}

.tag-2026 {
    background: #e0e7ff;
    color: #4338ca;
}

.kpi-val {
    font-size: 0.98rem;
    font-weight: 800;
    line-height: 1.25;
    font-family: 'JetBrains Mono', monospace;
    font-variant-numeric: tabular-nums;
    color: var(--text-main);
    letter-spacing: -0.02em;
}

.kpi-sub-info {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
}

.kpi-anticipo-tag {
    font-size: 0.68rem;
    color: #d97706;
    background: #fef3c7;
    padding: 2px 6px;
    border-radius: 3px;
    margin-top: 0.25rem;
    display: inline-block;
}

/* Badges */
.badge {
    padding: 0.2rem 0.55rem;
    border-radius: 9999px;
    font-size: 0.72rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.badge-positive, .text-emerald {
    background: var(--success-subtle);
    color: var(--success);
}

.badge-negative, .text-danger {
    background: var(--danger-subtle);
    color: var(--danger);
}

.badge-neutral {
    background: #f1f5f9;
    color: #475569;
}

.bg-blue-subtle, .text-blue {
    background: var(--primary-subtle);
    color: var(--primary);
}

.bg-purple-subtle, .text-purple {
    background: var(--purple-subtle);
    color: var(--purple);
}

.text-amber { color: #f59e0b; }

/* ==============================================================================
   ESTILOS ESPECÍFICOS: TABLA FORMATO EXCEL EJECUTIVO (HOJA 1)
   ============================================================================== */

.excel-style-table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
}

.excel-style-table thead th {
    background: #f1f5f9;
    color: #334155;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 0.85rem 1.1rem;
    border-bottom: 2px solid #cbd5e1;
    letter-spacing: 0.03em;
}

.excel-header-month {
    width: 22%;
    color: #1e293b !important;
}

.excel-header-year {
    background: #e2e8f0 !important;
    color: #0f172a !important;
}

.excel-style-table tbody td {
    padding: 0.85rem 1.1rem;
    font-size: 0.92rem;
    border-bottom: 1px solid #e2e8f0;
    font-variant-numeric: tabular-nums;
}

.excel-style-table tbody tr:hover td {
    background-color: #f8fafc;
}

.table-total-row td {
    background: #f1f5f9 !important;
    font-size: 0.98rem;
    padding: 1rem 1.1rem;
    border-top: 2px solid #94a3b8;
    border-bottom: 2px solid #94a3b8;
    color: #0f172a;
}

/* Dashboard Grids */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.chart-container {
    padding: 1.25rem;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 0.65rem;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 0.75rem;
}

.card-title-group {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.card-title {
    font-size: 0.95rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-main);
}

/* View Toggle Pill (Agrupar / Desglosar) */
.view-toggle-pill {
    display: inline-flex;
    background: #f1f5f9;
    padding: 2px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    gap: 2px;
}

.pill-btn {
    background: transparent;
    border: none;
    padding: 0.3rem 0.7rem;
    font-size: 0.76rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: var(--transition);
}

.pill-btn:hover {
    color: var(--text-main);
}

.pill-btn.active {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 1px 2px rgba(79, 70, 229, 0.2);
}

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

/* Tablas Modernas Estilo Comisiones */
.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.data-table th {
    background: #f8fafc;
    color: #475569;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.5px;
    padding: 0.75rem 0.9rem;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    text-align: left;
}

.data-table th.sortable {
    cursor: pointer;
    user-select: none;
    transition: background 0.15s ease, color 0.15s ease;
}

.data-table th.sortable:hover {
    background: #eef2ff;
    color: var(--primary);
}

.data-table th.sortable .sort-icon {
    margin-left: 0.35rem;
    font-size: 0.68rem;
    opacity: 0.4;
    transition: opacity 0.15s ease, color 0.15s ease;
}

.data-table th.sortable.sorted-asc .sort-icon,
.data-table th.sortable.sorted-desc .sort-icon {
    opacity: 1;
    color: var(--primary);
}

.data-table td {
    padding: 0.7rem 0.9rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
    white-space: nowrap;
}

.data-table tbody tr:hover {
    background: #f8fafc;
}

.text-right { text-align: right !important; }
.text-center { text-align: center !important; }
.font-bold { font-weight: 700; }
.mt-4 { margin-top: 1.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-1 { margin-bottom: 0.25rem; }
.p-4 { padding: 1.5rem; }

/* Modales */
.modal-overlay, .modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    padding: 1rem;
    box-sizing: border-box;
}

.modal-overlay.active, .modal.active {
    display: flex !important;
}

.modal-container, .modal-content {
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 1.5rem;
    background: var(--bg-card, #ffffff);
    color: var(--text-main, #1e293b);
    border-radius: var(--radius-lg, 12px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
    animation: modalFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: scale(0.96) translateY(-8px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    font-size: 1.05rem;
    font-weight: 700;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
    color: var(--text-muted);
}

.progress-bar-container {
    width: 100%;
    height: 6px;
    background: #f1f5f9;
    border-radius: 9999px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.progress-bar {
    height: 100%;
    background: var(--primary);
    width: 100%;
    animation: indeterminate 1.5s infinite linear;
    transform-origin: 0% 50%;
}

@keyframes indeterminate {
    0% { transform:  translateX(0) scaleX(0); }
    40% { transform:  translateX(0) scaleX(0.4); }
    100% { transform:  translateX(100%) scaleX(0.5); }
}

.d-none { display: none !important; }

/* Tab Panes */
.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
    animation: fadeIn 0.25s ease-in-out;
}

/* Sub Navigation Tabs (Estilo Comisiones) */
.sub-nav-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
    overflow-x: auto;
}

.sub-nav-item {
    background: transparent;
    border: none;
    padding: 0.55rem 1rem;
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
    white-space: nowrap;
}

.sub-nav-item:hover {
    color: var(--text-main);
    background: #f1f5f9;
}

.sub-nav-item.active {
    background: #eef2ff;
    color: var(--primary);
    box-shadow: 0 1px 2px rgba(79, 70, 229, 0.15);
}

.subtab-content {
    display: none;
}

.subtab-content.active {
    display: block;
    animation: fadeIn 0.2s ease-in-out;
}

/* Matriz Mensual Horizontal */
.table-monthly-matrix th, 
.table-monthly-matrix td {
    padding: 0.55rem 0.65rem;
    font-size: 0.78rem;
}

.matrix-cell {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.15;
}

.matrix-cell .val-26 {
    font-size: 0.78rem;
    color: var(--text-main);
}

.matrix-cell .val-25 {
    font-size: 0.68rem;
    color: var(--text-subtle);
    opacity: 0.85;
}

.font-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.bg-slate-50 {
    background: #f8fafc;
}

.bg-slate-100 {
    background: #f1f5f9;
}

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

/* ==========================================================================
   SISTEMA DE INDICADORES DE CARGA (LOADING STATES & SKELETON)
   ========================================================================== */

/* 1. Barra de progreso superior continua */
#globalTopLoader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3.5px;
    background: linear-gradient(90deg, #4f46e5, #06b6d4, #10b981, #4f46e5);
    background-size: 200% 100%;
    z-index: 9999;
    animation: topLoaderMove 1.2s infinite linear;
    display: none;
    box-shadow: 0 0 10px rgba(79, 70, 229, 0.5);
}

#globalTopLoader.active {
    display: block;
}

@keyframes topLoaderMove {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

/* 2. Shimmer Effect en valores de tarjetas durante filtrado */
.loading-shimmer,
.kpi-val.loading-shimmer,
.kpi-val.loading-shimmer.text-rose,
.kpi-val.loading-shimmer.text-cyan,
.kpi-val.loading-shimmer.text-indigo,
.kpi-val.loading-shimmer.text-amber,
.kpi-val.loading-shimmer.text-purple,
.kpi-val.loading-shimmer.text-emerald,
.kpi-val.loading-shimmer.text-blue,
.loading-shimmer * {
    position: relative;
    overflow: hidden;
    background: #e2e8f0 !important;
    color: transparent !important;
    -webkit-text-fill-color: transparent !important;
    border-radius: 4px;
    user-select: none !important;
    pointer-events: none !important;
    min-width: 80px;
    display: inline-block;
}

body.theme-dark .loading-shimmer,
body.theme-dark .kpi-val.loading-shimmer,
body.theme-dark .loading-shimmer * {
    background: #1e293b !important;
    color: transparent !important;
    -webkit-text-fill-color: transparent !important;
}

.loading-shimmer::after {
    content: '';
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0, rgba(255, 255, 255, 0.45) 50%, rgba(255, 255, 255, 0) 100%);
    animation: shimmerSlide 1.2s infinite ease-in-out;
}

.badge.loading-badge {
    opacity: 0.35;
    filter: grayscale(1);
}

@keyframes shimmerSlide {
    100% { transform: translateX(100%); }
}

/* 3. Badge Flotante de Carga en Pantalla */
.filter-loading-badge {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #0f172a;
    color: #f8fafc;
    padding: 0.75rem 1.35rem;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: 0 12px 30px -5px rgba(0, 0, 0, 0.35), 0 4px 6px -2px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.18);
    z-index: 9998;
    transform: translateY(120px);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.filter-loading-badge.active {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.filter-loading-badge .spinner-dot {
    width: 16px;
    height: 16px;
    border: 2.5px solid rgba(255, 255, 255, 0.25);
    border-top-color: #38bdf8;
    border-radius: 50%;
    animation: spinDot 0.75s infinite linear;
}

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

/* 4. Overlay de Carga para Gráficos */
.chart-container.is-loading {
    position: relative;
}

.chart-container.is-loading::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(2px);
    border-radius: var(--radius-lg);
    z-index: 10;
}

/* 5. Matriz Horizontal de Sucursales y Vendedores Estilo Excel */
.excel-matrix-container {
    max-height: 560px;
    overflow-x: auto;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    position: relative;
    box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.02);
}

.excel-matrix-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.78rem;
    font-variant-numeric: tabular-nums;
}

.excel-matrix-table th,
.excel-matrix-table td {
    padding: 0.45rem 0.65rem;
    white-space: nowrap;
    border-right: 1px solid rgba(0, 0, 0, 0.06);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

/* 1. Header Fijo Superior (Sticky Header) */
.excel-matrix-table thead {
    /* thead NO debe tener position: sticky para permitir sticky horizontal en sus <th> hijos */
    z-index: 25;
}

.excel-matrix-table thead th {
    color: #1e293b;
    font-weight: 700;
    text-align: center;
    position: sticky;
    top: 0;
    background: #e2e8f0;
    z-index: 20;
    box-shadow: inset 0 -1px 0 #cbd5e1;
}

/* Fila 1 de Encabezados de Meses */
.excel-matrix-table thead tr:first-child th {
    top: 0;
    height: 32px;
    background: #e2e8f0;
    border-bottom: 1px solid #cbd5e1;
    z-index: 25;
}

/* Fila 2 de Subencabezados 2025 / 2026 */
.excel-matrix-table thead tr:nth-child(2) th {
    top: 32px;
    height: 28px;
    font-size: 0.72rem;
    font-weight: 600;
    background: #f1f5f9;
    border-bottom: 2px solid #94a3b8;
    z-index: 24;
}

/* 2. Columnas Fijas Izquierdas (Sucursal / Vendedor) */
.excel-matrix-table th,
.excel-matrix-table td {
    white-space: nowrap;
}

.excel-matrix-table .sticky-col {
    position: sticky !important;
    left: 0 !important;
    background: #ffffff;
    font-weight: 600;
    z-index: 10;
    border-right: 2px solid #cbd5e1;
    box-shadow: 2px 0 6px -2px rgba(0, 0, 0, 0.08);
}

/* Esquina Superior Izquierda (Intersección Header + Columna) */
.excel-matrix-table thead th.sticky-col {
    position: sticky !important;
    top: 0 !important;
    left: 0 !important;
    z-index: 60 !important;
    background: #cbd5e1 !important;
    color: #0f172a !important;
    border-right: 2px solid #94a3b8 !important;
    border-bottom: 2px solid #94a3b8 !important;
}

/* Soporte Multi-Columna Sticky para Ventas 2026 x Vendedor y Sucursales */
.excel-matrix-table .sticky-col-vend {
    position: sticky !important;
    left: 0 !important;
    min-width: 230px !important;
    max-width: 230px !important;
    width: 230px !important;
    background: #ffffff;
    font-weight: 600;
    z-index: 10;
    border-right: 1px solid #cbd5e1;
    box-shadow: 1px 0 3px -1px rgba(0, 0, 0, 0.05);
    box-sizing: border-box;
}

.excel-matrix-table thead th.sticky-col-vend {
    position: sticky !important;
    top: 0 !important;
    left: 0 !important;
    z-index: 60 !important;
    background: #cbd5e1 !important;
    color: #0f172a !important;
    border-right: 1px solid #94a3b8 !important;
    border-bottom: 2px solid #94a3b8 !important;
}

.excel-matrix-table tbody tr:hover td.sticky-col-vend {
    background: #f1f5f9;
}

.excel-matrix-table tfoot td.sticky-col-vend {
    position: sticky !important;
    bottom: 0 !important;
    left: 0 !important;
    background: #020617 !important;
    color: #38bdf8 !important;
    z-index: 60 !important;
    border-right: 1px solid #38bdf8 !important;
}

.excel-matrix-table .sticky-col-suc {
    position: sticky !important;
    left: 230px !important;
    min-width: 200px !important;
    max-width: 200px !important;
    width: 200px !important;
    background: #ffffff;
    font-weight: 600;
    z-index: 10;
    border-right: 2px solid #cbd5e1;
    box-shadow: 2px 0 6px -2px rgba(0, 0, 0, 0.08);
    box-sizing: border-box;
}

.excel-matrix-table thead th.sticky-col-suc {
    position: sticky !important;
    top: 0 !important;
    left: 230px !important;
    z-index: 60 !important;
    background: #cbd5e1 !important;
    color: #0f172a !important;
    border-right: 2px solid #94a3b8 !important;
    border-bottom: 2px solid #94a3b8 !important;
}

.excel-matrix-table tbody tr:hover td.sticky-col-suc {
    background: #f1f5f9;
}

.excel-matrix-table tfoot td.sticky-col-suc {
    position: sticky !important;
    bottom: 0 !important;
    left: 230px !important;
    background: #020617 !important;
    color: #38bdf8 !important;
    z-index: 60 !important;
    border-right: 2px solid #38bdf8 !important;
}

/* Soporte Sticky para Clientes 2026 */
.excel-matrix-table .sticky-col-cod {
    position: sticky !important;
    left: 0 !important;
    min-width: 100px !important;
    max-width: 100px !important;
    width: 100px !important;
    background: #ffffff;
    font-weight: 700;
    z-index: 10;
    border-right: 1px solid #cbd5e1 !important;
    box-sizing: border-box;
}

.excel-matrix-table thead th.sticky-col-cod {
    position: sticky !important;
    top: 0 !important;
    left: 0 !important;
    z-index: 60 !important;
    background: #cbd5e1 !important;
    color: #0f172a !important;
    border-right: 1px solid #94a3b8 !important;
    border-bottom: 2px solid #94a3b8 !important;
}

.excel-matrix-table tbody tr:hover td.sticky-col-cod {
    background: #f1f5f9;
}

.excel-matrix-table tfoot td.sticky-col-cod {
    position: sticky !important;
    bottom: 0 !important;
    left: 0 !important;
    background: #020617 !important;
    color: #38bdf8 !important;
    z-index: 60 !important;
    border-right: 1px solid #38bdf8 !important;
}

.excel-matrix-table .sticky-col-cli {
    position: sticky !important;
    left: 100px !important;
    min-width: 250px !important;
    max-width: 250px !important;
    width: 250px !important;
    background: #ffffff;
    font-weight: 600;
    z-index: 10;
    border-right: 2px solid #cbd5e1 !important;
    box-shadow: 2px 0 6px -2px rgba(0, 0, 0, 0.08);
    box-sizing: border-box;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.excel-matrix-table thead th.sticky-col-cli {
    position: sticky !important;
    top: 0 !important;
    left: 100px !important;
    z-index: 60 !important;
    background: #cbd5e1 !important;
    color: #0f172a !important;
    border-right: 2px solid #94a3b8 !important;
    border-bottom: 2px solid #94a3b8 !important;
}

.excel-matrix-table tbody tr:hover td.sticky-col-cli {
    background: #f1f5f9;
}

.excel-matrix-table tfoot td.sticky-col-cli {
    position: sticky !important;
    bottom: 0 !important;
    left: 100px !important;
    background: #020617 !important;
    color: #38bdf8 !important;
    z-index: 60 !important;
    border-right: 2px solid #38bdf8 !important;
}

/* Soporte Sticky para Grupos de Inventarios y Ventas (Grupos x Sucursal) */
.excel-matrix-table .sticky-col-grp-cod {
    position: sticky !important;
    left: 0 !important;
    min-width: 100px !important;
    max-width: 100px !important;
    width: 100px !important;
    background: #ffffff;
    font-weight: 700;
    z-index: 10;
    border-right: 1px solid #cbd5e1 !important;
    box-sizing: border-box;
}

.excel-matrix-table thead th.sticky-col-grp-cod {
    position: sticky !important;
    top: 0 !important;
    left: 0 !important;
    z-index: 60 !important;
    background: #cbd5e1 !important;
    color: #0f172a !important;
    border-right: 1px solid #94a3b8 !important;
    border-bottom: 2px solid #94a3b8 !important;
}

.excel-matrix-table tbody tr:hover td.sticky-col-grp-cod {
    background: #f1f5f9;
}

.excel-matrix-table tfoot td.sticky-col-grp-cod {
    position: sticky !important;
    bottom: 0 !important;
    left: 0 !important;
    background: #020617 !important;
    color: #38bdf8 !important;
    z-index: 60 !important;
    border-right: 1px solid #38bdf8 !important;
}

.excel-matrix-table .sticky-col-grp-desc {
    position: sticky !important;
    left: 100px !important;
    min-width: 220px !important;
    max-width: 220px !important;
    width: 220px !important;
    background: #ffffff;
    font-weight: 600;
    z-index: 10;
    border-right: 2px solid #cbd5e1 !important;
    box-shadow: 2px 0 6px -2px rgba(0, 0, 0, 0.08);
    box-sizing: border-box;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.excel-matrix-table thead th.sticky-col-grp-desc {
    position: sticky !important;
    top: 0 !important;
    left: 100px !important;
    z-index: 60 !important;
    background: #cbd5e1 !important;
    color: #0f172a !important;
    border-right: 2px solid #94a3b8 !important;
    border-bottom: 2px solid #94a3b8 !important;
}

.excel-matrix-table tbody tr:hover td.sticky-col-grp-desc {
    background: #f1f5f9;
}

.excel-matrix-table tfoot td.sticky-col-grp-desc {
    position: sticky !important;
    bottom: 0 !important;
    left: 100px !important;
    background: #020617 !important;
    color: #38bdf8 !important;
    z-index: 60 !important;
    border-right: 2px solid #38bdf8 !important;
}

/* Soporte Sticky para Subgrupos de Inventarios (Subgrupos x Sucursal) */
.excel-matrix-table .sticky-col-sub-grp {
    position: sticky !important;
    left: 0 !important;
    min-width: 85px !important;
    max-width: 85px !important;
    width: 85px !important;
    background: #ffffff;
    font-weight: 700;
    z-index: 10;
    border-right: 1px solid #cbd5e1 !important;
    box-sizing: border-box;
}

.excel-matrix-table thead th.sticky-col-sub-grp {
    position: sticky !important;
    top: 0 !important;
    left: 0 !important;
    z-index: 60 !important;
    background: #cbd5e1 !important;
    color: #0f172a !important;
    border-right: 1px solid #94a3b8 !important;
    border-bottom: 2px solid #94a3b8 !important;
}

.excel-matrix-table tbody tr:hover td.sticky-col-sub-grp {
    background: #f1f5f9;
}

.excel-matrix-table tfoot td.sticky-col-sub-grp {
    position: sticky !important;
    bottom: 0 !important;
    left: 0 !important;
    background: #020617 !important;
    color: #38bdf8 !important;
    z-index: 60 !important;
    border-right: 1px solid #38bdf8 !important;
}

.excel-matrix-table .sticky-col-sub-cod {
    position: sticky !important;
    left: 85px !important;
    min-width: 95px !important;
    max-width: 95px !important;
    width: 95px !important;
    background: #ffffff;
    font-weight: 700;
    z-index: 10;
    border-right: 1px solid #cbd5e1 !important;
    box-sizing: border-box;
}

.excel-matrix-table thead th.sticky-col-sub-cod {
    position: sticky !important;
    top: 0 !important;
    left: 85px !important;
    z-index: 60 !important;
    background: #cbd5e1 !important;
    color: #0f172a !important;
    border-right: 1px solid #94a3b8 !important;
    border-bottom: 2px solid #94a3b8 !important;
}

.excel-matrix-table tbody tr:hover td.sticky-col-sub-cod {
    background: #f1f5f9;
}

.excel-matrix-table tfoot td.sticky-col-sub-cod {
    position: sticky !important;
    bottom: 0 !important;
    left: 85px !important;
    background: #020617 !important;
    color: #38bdf8 !important;
    z-index: 60 !important;
    border-right: 1px solid #38bdf8 !important;
}

.excel-matrix-table .sticky-col-sub-desc {
    position: sticky !important;
    left: 180px !important;
    min-width: 200px !important;
    max-width: 200px !important;
    width: 200px !important;
    background: #ffffff;
    font-weight: 600;
    z-index: 10;
    border-right: 2px solid #cbd5e1 !important;
    box-shadow: 2px 0 6px -2px rgba(0, 0, 0, 0.08);
    box-sizing: border-box;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.excel-matrix-table thead th.sticky-col-sub-desc {
    position: sticky !important;
    top: 0 !important;
    left: 180px !important;
    z-index: 60 !important;
    background: #cbd5e1 !important;
    color: #0f172a !important;
    border-right: 2px solid #94a3b8 !important;
    border-bottom: 2px solid #94a3b8 !important;
}

.excel-matrix-table tbody tr:hover td.sticky-col-sub-desc {
    background: #f1f5f9;
}

.excel-matrix-table tfoot td.sticky-col-sub-desc {
    position: sticky !important;
    bottom: 0 !important;
    left: 180px !important;
    background: #020617 !important;
    color: #38bdf8 !important;
    z-index: 60 !important;
    border-right: 2px solid #38bdf8 !important;
}

/* Hover en Filas */
.excel-matrix-table tbody tr:hover td {
    background: rgba(59, 130, 246, 0.05);
}

.excel-matrix-table tbody tr:hover td.sticky-col {
    background: #f1f5f9;
}

.excel-matrix-table .col-2025 {
    background: rgba(148, 163, 184, 0.08);
    color: #475569;
}

.excel-matrix-table .col-2026 {
    font-weight: 600;
    color: #0f172a;
}

.excel-matrix-table .col-total {
    background: rgba(59, 130, 246, 0.06);
    font-weight: 700;
}

/* 4. Pie Fijo Inferior (Sticky Footer TOTAL X MES) */
.excel-matrix-table tfoot {
    /* tfoot NO debe tener position: sticky para permitir sticky horizontal en sus <td> hijos */
    z-index: 25;
}

.excel-matrix-table tfoot td {
    position: sticky;
    bottom: 0;
    background: #0f172a !important;
    color: #f8fafc !important;
    font-weight: 700;
    font-size: 0.82rem;
    border-top: 2px solid #38bdf8;
    z-index: 20;
}

.excel-matrix-table tfoot td.sticky-col {
    position: sticky !important;
    bottom: 0 !important;
    left: 0 !important;
    background: #020617 !important;
    color: #38bdf8 !important;
    z-index: 60 !important;
    border-right: 2px solid #38bdf8 !important;
}

.excel-matrix-table .month-hdr {
    border-left: 2px solid #cbd5e1;
}

/* Header Fijo en Tabla Mensual Clásica */
.excel-style-table thead th {
    position: sticky;
    top: 0;
    z-index: 15;
    background: #f1f5f9;
    box-shadow: inset 0 -2px 0 #cbd5e1;
}

.chart-container.is-loading::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(2px);
    border-radius: var(--radius-md);
    z-index: 5;
}

/* Layout 5 Columnas para KPIs Ejecutivos de Sucursal */
.grid-5-col {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.kpi-card-sucursal {
    padding: 1rem 1.15rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 125px;
}

.kpi-card-sucursal .kpi-header {
    margin-bottom: 0.5rem;
}

.kpi-card-sucursal .kpi-label {
    font-size: 0.74rem;
}

.kpi-card-sucursal .kpi-single-val-box,
.kpi-card-sucursal .kpi-comparison-box {
    padding: 0.6rem 0.75rem;
}

.kpi-card-sucursal .kpi-val {
    font-size: 1.05rem;
    line-height: 1.2;
}

.kpi-card-sucursal .kpi-sub-info {
    font-size: 0.72rem;
    margin-top: 0.25rem;
}

@media (max-width: 1500px) {
    .grid-5-col {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 992px) {
    .grid-5-col {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .grid-5-col {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   ESTILOS PARA ORDENAMIENTO INTERACTIVO DE COLUMNAS (ASC / DESC)
   ========================================================================== */
th.sortable {
    cursor: pointer !important;
    user-select: none !important;
    transition: background-color 0.18s ease, color 0.18s ease;
}

th.sortable:hover {
    background-color: #cbd5e1 !important;
    color: #0f172a !important;
}

th.sortable .sort-icon {
    margin-left: 6px;
    font-size: 0.72rem;
    opacity: 0.35;
    transition: opacity 0.2s, transform 0.2s, color 0.2s;
    vertical-align: middle;
}

th.sortable:hover .sort-icon {
    opacity: 0.85;
    color: var(--primary);
}

th.sortable.sorted-asc,
th.sortable.sorted-desc {
    background-color: #dbeafe !important;
    color: #1e40af !important;
}

th.sortable.sorted-asc .sort-icon,
th.sortable.sorted-desc .sort-icon {
    opacity: 1 !important;
    color: #1e40af !important;
}

/* ==========================================================================
   ESTILOS DE ÁRBOL DESPLEGABLE (GRUPOS Y SUBGRUPOS EN MATRICES EXCEL)
   ========================================================================== */

.parent-group-row {
    transition: background-color 0.15s ease;
    cursor: pointer;
}

.parent-group-row:hover td {
    background: rgba(59, 130, 246, 0.08) !important;
}

.parent-group-row.is-expanded td {
    background: rgba(224, 242, 254, 0.35) !important;
}

.parent-group-row.is-expanded td.sticky-col-grp-cod,
.parent-group-row.is-expanded td.sticky-col-grp-desc {
    background: #f0f9ff !important;
}

.btn-toggle-subgroup {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 4px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #3b82f6;
    font-size: 0.72rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    vertical-align: middle;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn-toggle-subgroup:hover {
    background: #3b82f6;
    color: #ffffff;
    border-color: #2563eb;
    transform: scale(1.08);
}

.btn-toggle-subgroup .toggle-icon {
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-toggle-subgroup.expanded {
    background: #e0f2fe;
    color: #0369a1;
    border-color: #38bdf8;
}

.btn-toggle-subgroup.expanded .toggle-icon {
    transform: rotate(90deg);
}

.badge-subgroup-count {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.45rem;
    font-size: 0.68rem;
    font-weight: 600;
    border-radius: 12px;
    background: #e2e8f0;
    color: #475569;
    border: 1px solid #cbd5e1;
    margin-left: 6px;
    letter-spacing: 0.02em;
}

.subgroup-row {
    background: #f8fafc;
    font-size: 0.81rem;
    transition: background-color 0.12s ease;
    border-bottom: 1px dashed #e2e8f0;
}

.subgroup-row:hover td {
    background: rgba(14, 165, 233, 0.08) !important;
}

.subgroup-row td.sticky-col-grp-cod {
    background: #f8fafc !important;
    text-align: right !important;
    padding-right: 12px !important;
    color: #94a3b8;
    font-family: monospace;
    font-size: 0.85rem;
}

.subgroup-row td.sticky-col-grp-desc {
    background: #f8fafc !important;
    padding-left: 12px !important;
}

.subgroup-row:hover td.sticky-col-grp-cod,
.subgroup-row:hover td.sticky-col-grp-desc {
    background: #f1f5f9 !important;
}

.subgroup-tree-branch {
    color: #94a3b8;
    font-weight: bold;
    margin-right: 6px;
    font-family: monospace;
}

/* ==============================================================================
   TREEMAPS (APEXCHARTS) STYLES
   ============================================================================== */
.apexcharts-canvas {
    margin: 0 auto;
}

.apexcharts-treemap-rect {
    stroke: #ffffff !important;
    stroke-width: 2px !important;
    rx: 4px !important;
    ry: 4px !important;
    transition: filter 0.2s ease, opacity 0.2s ease;
}

.apexcharts-treemap-rect:hover {
    filter: brightness(1.18) contrast(1.05) drop-shadow(0 4px 10px rgba(0,0,0,0.25));
    cursor: pointer;
}

.apexcharts-datalabel text,
.apexcharts-data-labels text {
    font-family: 'Inter', sans-serif !important;
    font-weight: 700 !important;
    text-shadow: 0 1px 3px rgba(0,0,0,0.6) !important;
    fill: #ffffff !important;
}

.apexcharts-tooltip.apexcharts-theme-dark {
    background: #0f172a !important;
    border: 1px solid #334155 !important;
    box-shadow: 0 10px 25px rgba(0,0,0,0.4) !important;
    border-radius: 8px !important;
}

.badge-subgroup-code {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    font-size: 0.70rem;
    font-weight: 700;
    border-radius: 4px;
    background: #e0f2fe;
    color: #0284c7;
    border: 1px solid #bae6fd;
    font-family: monospace;
}

/* ==============================================================================
   CARTERA DE CLIENTES / CXC STYLES
   ============================================================================== */
.sticky-col-cli-nom {
    position: sticky;
    left: 0;
    z-index: 4;
    background: #ffffff;
    box-shadow: 2px 0 6px rgba(0, 0, 0, 0.05);
}

.excel-matrix-table tbody tr:hover td.sticky-col-cli-nom {
    background: #f1f5f9;
}

.excel-matrix-table tfoot td.sticky-col-cli-nom {
    background: #0f172a !important;
    color: #f8fafc !important;
}

.badge-clasif {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    font-size: 0.72rem;
    font-weight: 700;
    border-radius: 6px;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.badge-clasif-bueno {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.badge-clasif-regul {
    background: #fef9c3;
    color: #a16207;
    border: 1px solid #fef08a;
}

.badge-clasif-malo {
    background: #ffedd5;
    color: #c2410c;
    border: 1px solid #fed7aa;
}

.badge-clasif-pesim {
    background: #ffe4e6;
    color: #be123c;
    border: 1px solid #fecdd3;
    font-weight: 800;
}

.badge-vend-code {
    display: inline-block;
    padding: 0.15rem 0.45rem;
    font-size: 0.72rem;
    font-weight: 700;
    border-radius: 4px;
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
    font-family: monospace;
}

.badge-motivo-bloq {
    display: inline-block;
    padding: 0.15rem 0.45rem;
    font-size: 0.70rem;
    font-weight: 700;
    border-radius: 4px;
    background: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fca5a5;
    text-transform: uppercase;
}

.text-rose {
    color: #e11d48 !important;
}

.text-cyan {
    color: #0891b2 !important;
}

/* ==========================================================================
   TOOLBAR UNIFICADA DE REPORTES (Métrica / Buscador Central / Exportar)
   ========================================================================== */
.report-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
    padding: 0.75rem 1.25rem;
    margin-bottom: 1.5rem;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.report-toolbar .toolbar-left {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-shrink: 0;
}

.report-toolbar .toolbar-label {
    font-weight: 700;
    font-size: 0.875rem;
    color: var(--text-main);
    white-space: nowrap;
    margin-bottom: 0;
}

.report-toolbar .toolbar-select {
    min-width: 230px;
    height: 38px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-main);
    padding: 0.35rem 2rem 0.35rem 0.75rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background-color: var(--bg-main);
    cursor: pointer;
    transition: var(--transition);
}

.report-toolbar .toolbar-select:focus {
    border-color: var(--primary);
    background-color: #ffffff;
    outline: none;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.report-toolbar .toolbar-center {
    display: flex;
    align-items: center;
    flex: 1;
    max-width: 500px;
    margin: 0 0.5rem;
}

.report-toolbar .search-input-box-unified {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
}

.report-toolbar .search-input-box-unified .search-icon {
    position: absolute;
    left: 0.85rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    pointer-events: none;
}

.report-toolbar .search-input-box-unified .search-input-unified {
    width: 100%;
    height: 38px;
    padding: 0.45rem 0.85rem 0.45rem 2.35rem;
    font-size: 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background-color: var(--bg-main);
    color: var(--text-main);
    transition: var(--transition);
}

.report-toolbar .search-input-box-unified .search-input-unified:focus {
    border-color: var(--primary);
    background-color: #ffffff;
    outline: none;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.report-toolbar .toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.report-toolbar .btn-export-unified {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    height: 38px;
    padding: 0 1.25rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: #059669;
    background-color: #ecfdf5;
    border: 1.5px solid #10b981;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.report-toolbar .btn-export-unified:hover {
    background-color: #10b981;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
}

/* ==========================================================================
   RESPONSIVE MEDIA QUERIES (TABLETS, MÓVILES Y PANTALLAS PEQUEÑAS)
   ========================================================================== */
@media (max-width: 1024px) {
    .btn-toggle-sidebar {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .navbar {
        padding: 0.6rem 1.25rem;
        height: auto;
        min-height: var(--navbar-height);
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .nav-center {
        order: 3;
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 0.6rem;
        padding-top: 0.25rem;
        border-top: 1px solid var(--border-color);
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: calc(-1 * var(--sidebar-width) - 30px);
        height: 100vh;
        z-index: 110;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.25);
    }

    .sidebar.open {
        left: 0;
    }

    .app-layout {
        min-height: auto;
    }

    .content-area {
        padding: 1.25rem;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    .report-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    
    .report-toolbar .toolbar-center {
        max-width: 100%;
        margin: 0;
    }

    .report-toolbar .toolbar-right {
        justify-content: flex-end;
    }
}

@media (max-width: 768px) {
    .navbar {
        padding: 0.5rem 0.85rem;
    }

    .brand-title {
        font-size: 0.95rem;
    }

    .brand-subtitle {
        font-size: 0.68rem;
    }

    .filter-group-inline {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
        width: 48%;
    }

    .segmented-control {
        width: 100%;
    }

    .seg-btn {
        flex: 1;
        text-align: center;
    }

    .form-select-sm {
        width: 100%;
    }

    .content-area {
        padding: 0.85rem;
    }

    .filters-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
        padding: 0.85rem;
    }

    .filter-item {
        width: 100%;
        min-width: 100%;
    }

    .filter-actions {
        width: 100%;
        margin-top: 0.25rem;
        justify-content: stretch;
    }

    .filter-actions .btn {
        flex: 1;
        justify-content: center;
    }

    .kpi-grid,
    .kpi-cards-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .kpi-card {
        padding: 1rem;
    }

    .charts-grid,
    .charts-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .report-toolbar .toolbar-select {
        min-width: 100%;
    }

    .report-toolbar .btn-export-unified {
        width: 100%;
        justify-content: center;
    }

    .table-container,
    .table-responsive,
    .matrix-wrapper {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-bottom: 1rem;
    }

    .modal-dialog {
        max-width: 95%;
        margin: 1rem auto;
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .nav-left {
        gap: 0.35rem;
    }

    .brand-logo img {
        height: 30px !important;
    }

    .brand-text {
        padding-left: 0.5rem !important;
    }

    .brand-title {
        font-size: 0.85rem;
    }

    .filter-group-inline {
        width: 100%;
    }

    .btn-sync-text {
        display: none;
    }

    .card-header-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
}

/* ==============================================================================
   ESTILOS EXCLUSIVOS: TABLA VENTAS GRUPO VENDEDOR MES (2 NIVELES + STICKY OPACO)
   ============================================================================== */
#tablaVentasGrupoVendedorMes {
    border-collapse: separate !important;
    border-spacing: 0 !important;
    width: max-content !important;
    min-width: 100% !important;
}

#tablaVentasGrupoVendedorMes thead {
    position: sticky !important;
    top: 0 !important;
    z-index: 30 !important;
}

#tablaVentasGrupoVendedorMes thead tr#theadRow1VentasGrupoVendedorMes th {
    position: sticky !important;
    top: 0 !important;
    z-index: 30 !important;
    background: #e0f2fe !important;
    color: #0369a1 !important;
    border-bottom: 2px solid #0284c7 !important;
    border-right: 1px solid #cbd5e1 !important;
    padding: 7px 8px !important;
    white-space: nowrap !important;
    box-sizing: border-box !important;
    font-size: 0.82rem !important;
    height: 32px !important;
}

#tablaVentasGrupoVendedorMes thead tr#theadRow1VentasGrupoVendedorMes th.th-mes-group {
    background: #e0f2fe !important;
    color: #0369a1 !important;
    border-bottom: 2px solid #0284c7 !important;
    text-align: center !important;
    font-weight: 700 !important;
}

#tablaVentasGrupoVendedorMes thead tr#theadRow1VentasGrupoVendedorMes th.th-acum-group {
    background: #cbd5e1 !important;
    color: #0f172a !important;
    border-bottom: 2px solid #64748b !important;
    text-align: center !important;
    font-weight: 800 !important;
}

#tablaVentasGrupoVendedorMes thead tr#theadRow2VentasGrupoVendedorMes th {
    position: sticky !important;
    top: 32px !important;
    z-index: 28 !important;
    background: #f8fafc !important;
    color: #334155 !important;
    border-bottom: 2px solid #94a3b8 !important;
    border-right: 1px solid #e2e8f0 !important;
    padding: 6px 8px !important;
    white-space: nowrap !important;
    box-sizing: border-box !important;
    font-size: 0.76rem !important;
    height: 30px !important;
}

#tablaVentasGrupoVendedorMes thead tr#theadRow2VentasGrupoVendedorMes th.th-col-vta {
    background: #f8fafc !important;
    color: #0f172a !important;
}

#tablaVentasGrupoVendedorMes thead tr#theadRow2VentasGrupoVendedorMes th.th-col-mrg {
    background: #ecfdf5 !important;
    color: #047857 !important;
    border-bottom: 2px solid #10b981 !important;
}

#tablaVentasGrupoVendedorMes thead tr#theadRow2VentasGrupoVendedorMes th.th-col-prt {
    background: #fffbeb !important;
    color: #b45309 !important;
    border-bottom: 2px solid #f59e0b !important;
}

#tablaVentasGrupoVendedorMes thead tr#theadRow2VentasGrupoVendedorMes th.th-col-tot {
    background: #f1f5f9 !important;
    color: #1e40af !important;
    border-bottom: 2px solid #3b82f6 !important;
}

#tablaVentasGrupoVendedorMes thead tr#theadRow2VentasGrupoVendedorMes th.th-col-utl {
    background: #f1f5f9 !important;
    color: #047857 !important;
    border-bottom: 2px solid #10b981 !important;
}

#tablaVentasGrupoVendedorMes thead tr#theadRow2VentasGrupoVendedorMes th.th-col-mrg-tot {
    background: #f1f5f9 !important;
    color: #6b21a8 !important;
    border-bottom: 2px solid #8b5cf6 !important;
}

#tablaVentasGrupoVendedorMes thead tr#theadRow2VentasGrupoVendedorMes th.th-col-prt-tot {
    background: #f1f5f9 !important;
    color: #b45309 !important;
    border-bottom: 2px solid #f59e0b !important;
}

#tablaVentasGrupoVendedorMes thead th.sticky-col-grp-cod {
    position: sticky !important;
    top: 0 !important;
    left: 0 !important;
    z-index: 55 !important;
    background: #cbd5e1 !important;
    color: #0f172a !important;
    min-width: 100px !important;
    width: 100px !important;
    max-width: 100px !important;
    border-right: 1px solid #94a3b8 !important;
    border-bottom: 2px solid #94a3b8 !important;
}

#tablaVentasGrupoVendedorMes thead th.sticky-col-grp-desc {
    position: sticky !important;
    top: 0 !important;
    left: 100px !important;
    z-index: 55 !important;
    background: #cbd5e1 !important;
    color: #0f172a !important;
    min-width: 220px !important;
    width: 220px !important;
    max-width: 220px !important;
    border-right: 2px solid #94a3b8 !important;
    border-bottom: 2px solid #94a3b8 !important;
}

#tablaVentasGrupoVendedorMes tbody td.sticky-col-grp-cod {
    position: sticky !important;
    left: 0 !important;
    z-index: 15 !important;
    background: #ffffff !important;
    min-width: 100px !important;
    width: 100px !important;
    max-width: 100px !important;
    border-right: 1px solid #cbd5e1 !important;
    box-sizing: border-box !important;
}

#tablaVentasGrupoVendedorMes tbody td.sticky-col-grp-desc {
    position: sticky !important;
    left: 100px !important;
    z-index: 15 !important;
    background: #ffffff !important;
    min-width: 220px !important;
    width: 220px !important;
    max-width: 220px !important;
    border-right: 2px solid #cbd5e1 !important;
    box-shadow: 2px 0 6px -2px rgba(0, 0, 0, 0.08) !important;
    box-sizing: border-box !important;
}

#tablaVentasGrupoVendedorMes tbody tr:hover td.sticky-col-grp-cod,
#tablaVentasGrupoVendedorMes tbody tr:hover td.sticky-col-grp-desc {
    background: #f1f5f9 !important;
}

#tablaVentasGrupoVendedorMes tbody td {
    padding: 6px 8px !important;
    white-space: nowrap !important;
    font-size: 0.82rem !important;
    background: #ffffff;
}

#tablaVentasGrupoVendedorMes tbody tr.subgroup-row td {
    background: #f8fafc;
}

#tablaVentasGrupoVendedorMes tbody tr:hover td {
    background: #f1f5f9 !important;
}

#tablaVentasGrupoVendedorMes tfoot {
    position: sticky !important;
    bottom: 0 !important;
    z-index: 35 !important;
}

#tablaVentasGrupoVendedorMes tfoot td {
    position: sticky !important;
    bottom: 0 !important;
    z-index: 35 !important;
    background: #0f172a !important;
    color: #f8fafc !important;
    border-top: 2px solid #38bdf8 !important;
    border-bottom: 2px solid #0f172a !important;
    padding: 8px 8px !important;
    white-space: nowrap !important;
    font-size: 0.84rem !important;
    box-sizing: border-box !important;
}

#tablaVentasGrupoVendedorMes tfoot td.sticky-col-grp-cod {
    position: sticky !important;
    bottom: 0 !important;
    left: 0 !important;
    z-index: 60 !important;
    background: #020617 !important;
    color: #38bdf8 !important;
    min-width: 320px !important;
    width: 320px !important;
    max-width: 320px !important;
    border-right: 2px solid #38bdf8 !important;
    font-size: 0.88rem !important;
    letter-spacing: 0.5px !important;
}

/* ==============================================================================
   ESTILOS: TABLA TOP 200 PRODUCTOS MENOS VENDIDOS (ANÁLISIS INVENTARIO)
   ============================================================================== */
#tablaProductosMenosVendidos {
    border-collapse: separate !important;
    border-spacing: 0 !important;
    width: 100% !important;
    min-width: 1200px !important;
}

#tablaProductosMenosVendidos thead th {
    position: sticky !important;
    top: 0 !important;
    z-index: 25 !important;
    background: #0f172a !important;
    color: #f8fafc !important;
    border-bottom: 2px solid #38bdf8 !important;
    border-right: 1px solid #334155 !important;
    padding: 8px 10px !important;
    font-size: 0.80rem !important;
    letter-spacing: 0.3px !important;
    white-space: nowrap !important;
    box-sizing: border-box !important;
}

#tablaProductosMenosVendidos tbody td {
    padding: 6px 10px !important;
    font-size: 0.82rem !important;
    border-bottom: 1px solid #f1f5f9 !important;
    border-right: 1px solid #f8fafc !important;
    white-space: nowrap !important;
    background: #ffffff;
}

#tablaProductosMenosVendidos tbody tr:nth-child(even) td {
    background: #fbfcfe;
}

#tablaProductosMenosVendidos tbody tr:hover td {
    background: #f1f5f9 !important;
}

#tablaProductosMenosVendidos .badge-rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 22px;
    border-radius: 4px;
    background: #f1f5f9;
    color: #475569;
    font-weight: 700;
    font-size: 0.75rem;
    font-family: monospace;
}

#tablaProductosMenosVendidos .badge-rank-low {
    background: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fca5a5;
}

#tablaProductosMenosVendidos tfoot {
    position: sticky !important;
    bottom: 0 !important;
    z-index: 35 !important;
}

#tablaProductosMenosVendidos tfoot td {
    position: sticky !important;
    bottom: 0 !important;
    z-index: 35 !important;
    background: #020617 !important;
    color: #f8fafc !important;
    border-top: 2px solid #38bdf8 !important;
    padding: 8px 10px !important;
    font-size: 0.85rem !important;
    white-space: nowrap !important;
}

/* ==========================================================================
   TABLA DE CASA (MARCAS PROPIAS: ALPHA, SERLIGHT, IDEAL)
   ========================================================================== */

#tablaDeCasa th,
#tablaDeCasa td {
    white-space: nowrap !important;
}

#tablaDeCasa .sticky-col-decasa-num {
    position: sticky !important;
    left: 0 !important;
    min-width: 50px !important;
    max-width: 50px !important;
    width: 50px !important;
    background: #ffffff;
    font-weight: 700;
    z-index: 15;
    border-right: 1px solid #e2e8f0 !important;
    text-align: center;
    box-sizing: border-box;
}

#tablaDeCasa thead th.sticky-col-decasa-num {
    position: sticky !important;
    top: 0 !important;
    left: 0 !important;
    z-index: 60 !important;
    background: #cbd5e1 !important;
    color: #0f172a !important;
    border-right: 1px solid #94a3b8 !important;
    border-bottom: 2px solid #94a3b8 !important;
}

#tablaDeCasa tbody tr:hover td.sticky-col-decasa-num {
    background: #f1f5f9;
}

#tablaDeCasa tfoot td.sticky-col-decasa-num {
    position: sticky !important;
    bottom: 0 !important;
    left: 0 !important;
    background: #020617 !important;
    color: #38bdf8 !important;
    z-index: 60 !important;
    border-right: 1px solid #38bdf8 !important;
}

#tablaDeCasa .sticky-col-decasa-name {
    position: sticky !important;
    left: 50px !important;
    min-width: 240px !important;
    max-width: 240px !important;
    width: 240px !important;
    background: #ffffff;
    font-weight: 600;
    z-index: 15;
    border-right: 2px solid #cbd5e1 !important;
    box-shadow: 3px 0 6px -2px rgba(0, 0, 0, 0.08);
    box-sizing: border-box;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#tablaDeCasa thead th.sticky-col-decasa-name {
    position: sticky !important;
    top: 0 !important;
    left: 50px !important;
    z-index: 60 !important;
    background: #cbd5e1 !important;
    color: #0f172a !important;
    border-right: 2px solid #94a3b8 !important;
    border-bottom: 2px solid #94a3b8 !important;
}

#tablaDeCasa tbody tr:hover td.sticky-col-decasa-name {
    background: #f1f5f9;
}

#tablaDeCasa tfoot td.sticky-col-decasa-name {
    position: sticky !important;
    bottom: 0 !important;
    left: 50px !important;
    background: #020617 !important;
    color: #38bdf8 !important;
    z-index: 60 !important;
    border-right: 2px solid #38bdf8 !important;
}

#tablaDeCasa tbody tr.zone-parent-row td.sticky-col-decasa-num,
#tablaDeCasa tbody tr.zone-parent-row td.sticky-col-decasa-name,
#tablaDeCasa tbody tr.brand-parent-row td.sticky-col-decasa-num,
#tablaDeCasa tbody tr.brand-parent-row td.sticky-col-decasa-name {
    background: #f8fafc !important;
}

#tablaDeCasa tbody tr.zone-parent-row:hover td.sticky-col-decasa-num,
#tablaDeCasa tbody tr.zone-parent-row:hover td.sticky-col-decasa-name,
#tablaDeCasa tbody tr.brand-parent-row:hover td.sticky-col-decasa-num,
#tablaDeCasa tbody tr.brand-parent-row:hover td.sticky-col-decasa-name {
    background: #f1f5f9 !important;
}

.brand-chevron,
.zone-chevron {
    transition: transform 0.2s ease;
    display: inline-block;
}

#tablaDeCasa .sticky-col-decasa-sku {
    position: sticky !important;
    left: 50px !important;
    min-width: 140px !important;
    max-width: 140px !important;
    width: 140px !important;
    background: #ffffff;
    font-weight: 700;
    z-index: 15;
    border-right: 1px solid #cbd5e1 !important;
    box-shadow: 3px 0 6px -2px rgba(0, 0, 0, 0.08);
    box-sizing: border-box;
}

#tablaDeCasa thead th.sticky-col-decasa-sku {
    position: sticky !important;
    top: 0 !important;
    left: 50px !important;
    z-index: 60 !important;
    background: #cbd5e1 !important;
    color: #0f172a !important;
    border-right: 1px solid #94a3b8 !important;
    border-bottom: 2px solid #94a3b8 !important;
}

#tablaDeCasa tbody tr:hover td.sticky-col-decasa-sku {
    background: #f1f5f9;
}

#tablaDeCasa tfoot td.sticky-col-decasa-sku {
    position: sticky !important;
    bottom: 0 !important;
    left: 50px !important;
    background: #020617 !important;
    color: #38bdf8 !important;
    z-index: 60 !important;
    border-right: 1px solid #38bdf8 !important;
}

#tablaDeCasa tbody tr.vendor-parent-row td.sticky-col-decasa-num,
#tablaDeCasa tbody tr.vendor-parent-row td.sticky-col-decasa-name {
    background: #f8fafc !important;
}

#tablaDeCasa tbody tr.vendor-parent-row:hover td.sticky-col-decasa-num,
#tablaDeCasa tbody tr.vendor-parent-row:hover td.sticky-col-decasa-name {
    background: #f1f5f9 !important;
}

.vendor-chevron {
    transition: transform 0.2s ease;
    display: inline-block;
}

/* ==========================================================================
   KPI CARDS & GRIDS (MÓDULOS DE CASA Y EJECUTIVOS)
   ========================================================================== */

.grid-4-col {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 1.15rem !important;
}

@media (max-width: 1200px) {
    .grid-4-col {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 640px) {
    .grid-4-col {
        grid-template-columns: 1fr !important;
    }
}

.grid-3-col {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 1.15rem !important;
}

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

.stat-card {
    padding: 1.15rem 1.25rem !important;
    display: flex !important;
    align-items: center !important;
    gap: 1rem !important;
    border-radius: var(--radius-md) !important;
    background: #ffffff !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04) !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease !important;
    min-width: 0 !important;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08) !important;
}

.stat-icon {
    width: 48px !important;
    height: 48px !important;
    min-width: 48px !important;
    border-radius: 12px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 1.35rem !important;
}

.stat-details {
    flex: 1 !important;
    min-width: 0 !important;
    overflow: hidden !important;
}

.stat-label {
    font-size: 0.72rem !important;
    font-weight: 700 !important;
    color: var(--text-muted) !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    display: block !important;
    margin-bottom: 0.25rem !important;
    white-space: nowrap !important;
    text-overflow: ellipsis !important;
    overflow: hidden !important;
}

.stat-value {
    font-size: 1.35rem !important;
    font-weight: 800 !important;
    color: var(--text-main) !important;
    line-height: 1.2 !important;
    margin-bottom: 0.2rem !important;
    white-space: nowrap !important;
    text-overflow: ellipsis !important;
    overflow: hidden !important;
}

.stat-subtext {
    font-size: 0.72rem !important;
    color: var(--text-subtle) !important;
    font-weight: 500 !important;
    display: block !important;
    white-space: nowrap !important;
    text-overflow: ellipsis !important;
    overflow: hidden !important;
}

.bg-blue-light { background: #e0f2fe !important; color: #0284c7 !important; }
.bg-amber-light { background: #fef3c7 !important; color: #d97706 !important; }
.bg-emerald-light { background: #d1fae5 !important; color: #059669 !important; }
.bg-purple-light { background: #ede9fe !important; color: #7c3aed !important; }

/* ==========================================================================
   CARTERA DE CLIENTES - DRILLDOWN DE DOCUMENTOS & ESTILOS DE VENDEDOR
   ========================================================================== */
.cartera-chevron {
    display: inline-block;
    transition: transform 0.2s ease;
    font-size: 0.75rem;
    color: var(--primary-color, #0284c7);
}

.cartera-chevron.rotated {
    transform: rotate(90deg);
}

.cartera-parent-row {
    transition: background-color 0.15s ease;
}

.cartera-parent-row:hover {
    background-color: #f8fafc !important;
}

.cartera-child-row {
    animation: fadeInSlideDown 0.2s ease-out;
}

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

/* ==========================================================================
   MATRIZ DE PERMISOS POR USUARIO
   ========================================================================== */
.perm-checkbox-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.perm-checkbox-card:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    transform: translateY(-1px);
}

.perm-checkbox-card input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    accent-color: #231F83;
    cursor: pointer;
    flex-shrink: 0;
}

.perm-title {
    font-weight: 600;
    font-size: 0.88rem;
    color: #1e293b;
    line-height: 1.25;
}

.perm-desc {
    font-size: 0.74rem;
    color: #64748b;
    margin-top: 3px;
    line-height: 1.3;
}
