/**
 * ============================================
 * ENGAGED BPO - Design System v1.0
 * Unified visual system: Light "Executive" + Dark "Executive Dark"
 * WCAG 2.1 AA compliant | Optimized for 4-8h sessions
 * ============================================
 */

/* ── Typography ──────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── CSS Custom Properties: Light Theme (Default) ── */
:root,
[data-theme="light"] {
    /* Foundation */
    --bg-app:            #f1f5f9;
    --bg-surface:        #ffffff;
    --bg-surface-alt:    #f8fafc;
    --bg-hover:          #e2e8f0;
    --bg-selected:       #dbeafe;

    /* Sidebar */
    --sidebar-bg:        #0f172a;
    --sidebar-hover:     #1e293b;
    --sidebar-active:    #0d9488;
    --sidebar-text:      #94a3b8;
    --sidebar-text-active: #ffffff;
    --sidebar-border:    rgba(255,255,255,0.06);
    --sidebar-width:     260px;
    --sidebar-collapsed: 68px;

    /* Navbar */
    --navbar-bg:         #ffffff;
    --navbar-border:     #e2e8f0;
    --navbar-text:       #334155;
    --navbar-height:     56px;

    /* Brand */
    --brand-primary:     #0d9488;
    --brand-primary-hover: #0f766e;
    --brand-primary-rgb: 13,148,136;
    --brand-secondary:   #6366f1;
    --brand-accent:      #f59e0b;

    /* Text */
    --text-primary:      #0f172a;
    --text-secondary:    #475569;
    --text-muted:        #94a3b8;
    --text-link:         #0d9488;
    --text-inverse:      #ffffff;

    /* Semantic */
    --success:           #059669;
    --success-bg:        #d1fae5;
    --success-text:      #065f46;
    --warning:           #d97706;
    --warning-bg:        #fef3c7;
    --warning-text:      #92400e;
    --danger:            #dc2626;
    --danger-bg:         #fee2e2;
    --danger-text:       #991b1b;
    --info:              #2563eb;
    --info-bg:           #dbeafe;
    --info-text:         #1e40af;

    /* Backgrounds (aliases for compatibility) */
    --bg-primary:        #ffffff;
    --bg-secondary:      #f8fafc;

    /* Borders & Shadows */
    --border-color:      #e2e8f0;
    --border-light:      #e2e8f0;
    --border-medium:     #cbd5e1;
    --radius-sm:         6px;
    --radius-md:         8px;
    --radius-lg:         12px;
    --radius-xl:         16px;
    --shadow-sm:         0 1px 2px rgba(0,0,0,0.05);
    --shadow-md:         0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-lg:         0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
    --shadow-xl:         0 20px 25px -5px rgba(0,0,0,0.08), 0 8px 10px -6px rgba(0,0,0,0.04);

    /* Typography Scale */
    --font-family:       'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-xs:           0.75rem;
    --font-sm:           0.8125rem;
    --font-base:         0.875rem;
    --font-md:           1rem;
    --font-lg:           1.125rem;
    --font-xl:           1.5rem;
    --font-2xl:          2rem;
    --font-3xl:          2.5rem;

    /* Spacing */
    --space-1:           4px;
    --space-2:           8px;
    --space-3:           12px;
    --space-4:           16px;
    --space-5:           20px;
    --space-6:           24px;
    --space-8:           32px;
    --space-10:          40px;

    /* Transitions */
    --transition-fast:   150ms ease;
    --transition-base:   200ms ease;
    --transition-slow:   300ms ease;

    /* Module Theme Colors */
    /* Teal - General / Dashboard / Empresas */
    --mod-teal:            #0d9488;
    --mod-teal-hover:      #0f766e;
    --mod-teal-dark:       #065f46;
    --mod-teal-light:      rgba(13,148,136,0.08);
    --mod-teal-glow:       rgba(13,148,136,0.22);

    /* Green - Afiliaciones */
    --mod-green:           #10b981;
    --mod-green-hover:     #059669;
    --mod-green-dark:      #047857;
    --mod-green-light:     rgba(16,185,129,0.08);
    --mod-green-glow:      rgba(16,185,129,0.22);

    /* Blue - Pagos */
    --mod-blue:            #3b82f6;
    --mod-blue-hover:      #2563eb;
    --mod-blue-dark:       #1d4ed8;
    --mod-blue-light:      rgba(59,130,246,0.08);
    --mod-blue-glow:       rgba(59,130,246,0.22);

    /* Red - Incapacidades */
    --mod-red:             #ef4444;
    --mod-red-hover:       #dc2626;
    --mod-red-dark:        #b91c1c;
    --mod-red-light:       rgba(239,68,68,0.08);
    --mod-red-glow:        rgba(239,68,68,0.22);

    /* Purple - CRM / Exportaciones */
    --mod-purple:          #8b5cf6;
    --mod-purple-hover:    #7c3aed;
    --mod-purple-dark:     #6d28d9;
    --mod-purple-light:    rgba(139,92,246,0.08);
    --mod-purple-glow:     rgba(139,92,246,0.22);

    /* Amber - Alertas / Nuevos */
    --mod-amber:           #f59e0b;
    --mod-amber-hover:     #d97706;
    --mod-amber-dark:      #b45309;
    --mod-amber-light:     rgba(245,158,11,0.08);
    --mod-amber-glow:      rgba(245,158,11,0.22);

    /* Page loader */
    --loader-bg:         rgba(241,245,249,0.95);

    /* Scrollbar */
    --scrollbar-thumb:   #cbd5e1;
    --scrollbar-track:   transparent;
}

/* ── CSS Custom Properties: Dark Theme ── */
[data-theme="dark"] {
    --bg-app:            #0f172a;
    --bg-surface:        #1e293b;
    --bg-surface-alt:    #162032;
    --bg-hover:          #334155;
    --bg-selected:       #1e3a5f;

    --sidebar-bg:        #020617;
    --sidebar-hover:     #0f172a;
    --sidebar-active:    #14b8a6;
    --sidebar-text:      #64748b;
    --sidebar-text-active: #f0fdfa;
    --sidebar-border:    rgba(255,255,255,0.04);

    --navbar-bg:         #1e293b;
    --navbar-border:     #334155;
    --navbar-text:       #e2e8f0;

    --brand-primary:     #14b8a6;
    --brand-primary-hover: #2dd4bf;
    --brand-primary-rgb: 20,184,166;
    --brand-secondary:   #818cf8;
    --brand-accent:      #fbbf24;

    --text-primary:      #f1f5f9;
    --text-secondary:    #94a3b8;
    --text-muted:        #64748b;
    --text-link:         #2dd4bf;
    --text-inverse:      #0f172a;

    --success:           #34d399;
    --success-bg:        rgba(16,185,129,0.15);
    --success-text:      #6ee7b7;
    --warning:           #fbbf24;
    --warning-bg:        rgba(245,158,11,0.15);
    --warning-text:      #fde68a;
    --danger:            #f87171;
    --danger-bg:         rgba(239,68,68,0.15);
    --danger-text:       #fca5a5;
    --info:              #60a5fa;
    --info-bg:           rgba(59,130,246,0.15);
    --info-text:         #93bbfd;

    --bg-primary:        #1e293b;
    --bg-secondary:      #162032;

    --border-color:      #334155;
    --border-light:      #334155;
    --border-medium:     #475569;
    --shadow-sm:         0 1px 2px rgba(0,0,0,0.3);
    --shadow-md:         0 4px 6px rgba(0,0,0,0.4);
    --shadow-lg:         0 10px 15px rgba(0,0,0,0.5);
    --shadow-xl:         0 20px 25px rgba(0,0,0,0.5);

    --loader-bg:         rgba(15,23,42,0.95);
    --scrollbar-thumb:   #475569;

    /* Bootstrap 5.3 CSS variable overrides for dark mode */
    --bs-body-bg:        #1e293b;
    --bs-body-color:     #f1f5f9;
    --bs-emphasis-color: #f1f5f9;
    --bs-table-bg:       transparent;
    --bs-table-color:    #f1f5f9;
    --bs-table-border-color: #334155;
    --bs-card-bg:        #1e293b;
    --bs-card-color:     #f1f5f9;
    --bs-border-color:   #334155;
}

/* ── Global Reset & Base ──────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body,
body.theme-green,
body.theme-purple {
    font-family: var(--font-family) !important;
    font-size: var(--font-base);
    line-height: 1.6;
    color: var(--text-primary) !important;
    background-color: var(--bg-app) !important;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    margin: 0;
    padding: 0;
}

::selection {
    background-color: rgba(var(--brand-primary-rgb), 0.2);
    color: var(--text-primary);
}

a {
    color: var(--text-link);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--brand-primary-hover);
    text-decoration: none;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: var(--space-3);
}

p {
    color: var(--text-secondary);
}

/* ── Accessibility: Reduced Motion ─────── */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ── Page Loader ──────────────────────── */
.page-loader-wrapper {
    background: var(--loader-bg) !important;
}

.page-loader-wrapper .loader p {
    color: var(--text-secondary) !important;
    font-family: var(--font-family) !important;
    font-weight: 500;
}

/* ── Scrollbar ────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
}

::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}


/* ═══════════════════════════════════════
   NAVBAR
   ═══════════════════════════════════════ */
.navbar,
.navbar.navbar-fixed-top {
    background-color: var(--navbar-bg) !important;
    border-bottom: 1px solid var(--navbar-border) !important;
    box-shadow: var(--shadow-sm) !important;
    height: var(--navbar-height);
    padding: 0 var(--space-4) !important;
    z-index: 1030;
    transition: background-color var(--transition-slow), border-color var(--transition-slow);
}

/* Kill old cosmic animations on navbar */
.navbar::before,
.navbar::after {
    display: none !important;
    animation: none !important;
}

.navbar .navbar-brand,
.navbar .navbar-brand span {
    color: var(--navbar-text) !important;
    font-weight: 700;
    font-size: var(--font-md);
}

.navbar .navbar-brand img,
.navbar .navbar-brand .logo {
    height: 32px !important;
    width: auto;
}

.navbar .icon-menu,
.navbar .nav-link,
.navbar a {
    color: var(--navbar-text) !important;
    transition: color var(--transition-fast);
}

.navbar .icon-menu:hover,
.navbar .nav-link:hover,
.navbar .navbar-right a:hover {
    color: var(--brand-primary) !important;
}

.navbar .btn-toggle-offcanvas,
.navbar .btn-toggle-fullwidth {
    color: var(--navbar-text) !important;
    background: transparent !important;
    border: none !important;
    cursor: pointer !important;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    outline: none !important;
}

.navbar .btn-toggle-offcanvas:hover,
.navbar .btn-toggle-fullwidth:hover {
    color: var(--brand-primary) !important;
}

/* ═══════════════════════════════════════
   HAMBURGER BUTTON - SUPREME PREMIUM
   Premium animated hamburger for mobile/tablet
   ═══════════════════════════════════════ */
@media screen and (max-width: 1200px) {
    /* Navbar btn container: flex layout for logo + hamburger */
    .navbar-fixed-top .navbar-btn {
        display: flex !important;
        align-items: center;
        gap: 8px;
        float: none !important;
        padding: 0 4px;
    }

    /* Hamburger button: premium circular style */
    .navbar-fixed-top .navbar-btn .btn-toggle-offcanvas {
        width: 42px !important;
        height: 42px !important;
        min-width: 42px !important;
        min-height: 42px !important;
        display: flex !important;
        align-items: center;
        justify-content: center;
        padding: 0 !important;
        margin: 0 !important;
        border-radius: 12px !important;
        background: linear-gradient(135deg, var(--brand-primary), #065f46) !important;
        color: #fff !important;
        border: none !important;
        cursor: pointer !important;
        position: relative;
        z-index: 2;
        transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 0 2px 8px rgba(13, 148, 136, 0.3);
        flex-shrink: 0;
        order: -1;
    }

    .navbar-fixed-top .navbar-btn .btn-toggle-offcanvas:hover,
    .navbar-fixed-top .navbar-btn .btn-toggle-offcanvas:focus {
        transform: scale(1.08);
        box-shadow: 0 4px 16px rgba(13, 148, 136, 0.45);
    }

    .navbar-fixed-top .navbar-btn .btn-toggle-offcanvas:active {
        transform: scale(0.95);
        box-shadow: 0 1px 4px rgba(13, 148, 136, 0.3);
    }

    .navbar-fixed-top .navbar-btn .btn-toggle-offcanvas i {
        font-size: 18px !important;
        color: #fff !important;
        pointer-events: none;
        line-height: 1;
    }

    /* When sidebar is open: change hamburger to X style */
    .offcanvas-active .navbar-fixed-top .navbar-btn .btn-toggle-offcanvas {
        background: linear-gradient(135deg, #ef4444, #dc2626) !important;
        box-shadow: 0 2px 8px rgba(239, 68, 68, 0.35);
    }

    /* Logo in navbar-btn: constrain size */
    .navbar-fixed-top .navbar-btn a {
        display: flex;
        align-items: center;
    }

    .navbar-fixed-top .navbar-btn .logo {
        height: 30px !important;
        width: auto;
    }

    /* Hide fullwidth toggle on mobile (not needed) */
    .navbar-fixed-top .btn-toggle-fullwidth {
        display: none !important;
    }

    /* Navbar left: use flex */
    .navbar-fixed-top .navbar-left {
        display: flex;
        align-items: center;
        gap: 6px;
    }
}

/* Small phones: tighter spacing */
@media screen and (max-width: 576px) {
    .navbar-fixed-top .navbar-btn .btn-toggle-offcanvas {
        width: 38px !important;
        height: 38px !important;
        min-width: 38px !important;
        min-height: 38px !important;
        border-radius: 10px !important;
    }

    .navbar-fixed-top .navbar-btn .btn-toggle-offcanvas i {
        font-size: 16px !important;
    }

    .navbar-fixed-top .navbar-btn .logo {
        height: 26px !important;
    }
}

/* Navbar dropdown */
.navbar .dropdown-menu {
    background-color: var(--bg-surface) !important;
    border: 1px solid var(--border-light) !important;
    border-radius: var(--radius-md) !important;
    box-shadow: var(--shadow-lg) !important;
    padding: var(--space-2) 0 !important;
}

.navbar .dropdown-menu a,
.navbar .dropdown-menu li a {
    color: var(--text-primary) !important;
    padding: var(--space-2) var(--space-4) !important;
    font-size: var(--font-sm) !important;
    transition: background-color var(--transition-fast);
}

.navbar .dropdown-menu a:hover,
.navbar .dropdown-menu li a:hover {
    background-color: var(--bg-hover) !important;
    color: var(--brand-primary) !important;
}


/* ═══════════════════════════════════════
   SIDEBAR
   ═══════════════════════════════════════ */
#left-sidebar,
#left-sidebar.sidebar {
    background-color: var(--sidebar-bg) !important;
    border-right: 1px solid var(--sidebar-border) !important;
    width: var(--sidebar-width) !important;
    transition: left 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                width var(--transition-slow),
                background-color var(--transition-slow),
                box-shadow 0.35s ease !important;
    box-shadow: none !important;
}

/* Kill cosmic sidebar effects (keep ::after for accent border) */
#left-sidebar::before,
.sidebar::before {
    display: none !important;
    animation: none !important;
}

/* Sidebar brand / logo area */
#left-sidebar .navbar-brand {
    border-bottom: 1px solid var(--sidebar-border) !important;
    padding: var(--space-4) var(--space-4) var(--space-3) !important;
    background: transparent !important;
}

#left-sidebar .navbar-brand a {
    color: var(--sidebar-text-active) !important;
    font-weight: 700;
    font-size: var(--font-md);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    text-decoration: none;
}

#left-sidebar .navbar-brand a span {
    color: var(--brand-primary) !important;
    font-weight: 800;
    letter-spacing: 0.5px;
}

#left-sidebar .navbar-brand .logo {
    height: 32px !important;
    width: auto;
}

#left-sidebar .navbar-brand .btn-toggle-offcanvas {
    color: var(--sidebar-text) !important;
    background: transparent !important;
    border: none !important;
}

/* User account area */
#left-sidebar .user-account {
    padding: var(--space-4) !important;
    border-bottom: 1px solid var(--sidebar-border) !important;
    background: transparent !important;
}

#left-sidebar .user-account img,
#left-sidebar .user-account .user_div img {
    width: 40px !important;
    height: 40px !important;
    border-radius: 50% !important;
    border: 2px solid var(--sidebar-active) !important;
    object-fit: cover;
}

#left-sidebar .user-account span {
    color: var(--sidebar-text) !important;
    font-size: var(--font-xs) !important;
}

#left-sidebar .user-account .user-name,
#left-sidebar .user-account .dropdown-toggle {
    color: var(--sidebar-text-active) !important;
    font-size: var(--font-sm) !important;
    font-weight: 600;
}

#left-sidebar .user-account .dropdown-menu {
    background-color: var(--bg-surface) !important;
    border: 1px solid var(--border-light) !important;
    border-radius: var(--radius-md) !important;
    box-shadow: var(--shadow-lg) !important;
}

#left-sidebar .user-account .dropdown-menu li a {
    color: var(--text-primary) !important;
    font-size: var(--font-sm) !important;
}

#left-sidebar .user-account .dropdown-menu li a:hover {
    background-color: var(--bg-hover) !important;
}

/* Sidebar navigation */
.sidebar-nav .metismenu,
.sidebar-nav .metismenu ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav .metismenu > li {
    margin: 2px var(--space-2) !important;
}

.sidebar-nav .metismenu > li > a,
.sidebar-nav .metismenu a {
    color: var(--sidebar-text) !important;
    padding: 10px var(--space-4) !important;
    border-radius: var(--radius-md) !important;
    font-size: var(--font-sm) !important;
    font-weight: 400;
    display: flex !important;
    align-items: center;
    gap: var(--space-3);
    transition: background-color var(--transition-fast), color var(--transition-fast);
    background: transparent !important;
    text-decoration: none !important;
}

.sidebar-nav .metismenu a i {
    width: 20px !important;
    font-size: var(--font-base) !important;
    opacity: 0.7;
    text-align: center;
    flex-shrink: 0;
    transition: opacity var(--transition-fast);
    color: inherit !important;
}

.sidebar-nav .metismenu > li > a:hover,
.sidebar-nav .metismenu a:hover {
    background-color: var(--sidebar-hover) !important;
    color: var(--sidebar-text-active) !important;
}

.sidebar-nav .metismenu > li > a:hover i,
.sidebar-nav .metismenu a:hover i {
    opacity: 1;
}

.sidebar-nav .metismenu > li.active > a,
.sidebar-nav .metismenu > li > .active,
.sidebar-nav .metismenu li .active a {
    background-color: var(--sidebar-active) !important;
    color: var(--sidebar-text-active) !important;
    font-weight: 600 !important;
}

.sidebar-nav .metismenu > li.active > a i,
.sidebar-nav .metismenu li .active a i {
    opacity: 1;
}

/* Submenu (nested) */
.sidebar-nav .metismenu ul a {
    padding-left: 48px !important;
    font-size: var(--font-xs) !important;
}

.sidebar-nav .metismenu ul a::before {
    content: '' !important;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--sidebar-text);
    position: absolute;
    left: 28px;
    top: 50%;
    transform: translateY(-50%);
}

.sidebar-nav .metismenu ul ul a {
    padding-left: 64px !important;
}

/* Sidebar scroll */
#left-sidebar .sidebar-scroll {
    overflow-y: auto;
    overflow-x: hidden;
    height: calc(100vh - var(--navbar-height));
}

#left-sidebar .sidebar-scroll::-webkit-scrollbar {
    width: 4px;
}

#left-sidebar .sidebar-scroll::-webkit-scrollbar-thumb {
    background: var(--sidebar-hover);
    border-radius: 2px;
}

/* ── Sidebar Section Headers ── */
.sidebar-nav .metismenu > li.sidebar-section {
    pointer-events: none;
    margin-top: 0.75rem;
    margin-bottom: 0.25rem;
    padding: 0.375rem 1.25rem 0.25rem;
    border-top: 1px solid var(--sidebar-border);
}
.sidebar-nav .metismenu > li.sidebar-section:first-child {
    margin-top: 0;
    border-top: none;
}
.sidebar-nav .metismenu > li.sidebar-section > span {
    display: block;
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--sidebar-active);
    opacity: 0.85;
}


/* ═══════════════════════════════════════
   MAIN CONTENT AREA
   ═══════════════════════════════════════ */
#main-content {
    background-color: var(--bg-app) !important;
    transition: background-color var(--transition-slow);
}

.block-header {
    margin-top: 60px !important;
    padding: var(--space-4) 0;
}

.block-header h2 {
    font-size: var(--font-xl) !important;
    color: var(--text-primary) !important;
    font-weight: 700 !important;
}

.container-fluid {
    padding: 0 var(--space-5);
}

/* ═══════════════════════════════════════
   CARDS
   ═══════════════════════════════════════ */
.card {
    background-color: var(--bg-surface) !important;
    border: 1px solid var(--border-light) !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-sm) !important;
    transition: box-shadow var(--transition-base), transform var(--transition-base), border-color var(--transition-base);
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-md) !important;
    transform: translateY(-2px) !important;
    border-color: var(--border-medium) !important;
}

.card .header {
    background-color: transparent !important;
    border-bottom: 1px solid var(--border-light) !important;
    padding: var(--space-4) var(--space-5) !important;
}

.card .header h2,
.card .header .title {
    color: var(--text-primary) !important;
    font-size: var(--font-md) !important;
    font-weight: 600 !important;
    margin: 0;
}

.card .body {
    padding: var(--space-5) !important;
    background: transparent !important;
    color: var(--text-primary) !important;
}

.card-title {
    color: var(--text-primary) !important;
    font-size: var(--font-md) !important;
    font-weight: 600 !important;
}

.card-text {
    color: var(--text-secondary) !important;
    font-size: var(--font-base) !important;
}

/* Kill all old card animations */
.card::before,
.card::after {
    display: none !important;
    animation: none !important;
}

/* Stat Cards (dashboard) */
.card.stat-card,
.state_w1,
.state_w2,
.state_w3 {
    border-left: 4px solid var(--brand-primary) !important;
}

.card.stat-card .value,
.state_w1 h5,
.state_w2 h5,
.state_w3 h5 {
    font-size: var(--font-2xl) !important;
    font-weight: 700 !important;
    color: var(--text-primary) !important;
}

.card.stat-card .label,
.state_w1 span,
.state_w2 span,
.state_w3 span {
    font-size: var(--font-sm) !important;
    font-weight: 500 !important;
    color: var(--text-secondary) !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Detalle card */
.card.detalle {
    border-radius: var(--radius-lg) !important;
    padding: var(--space-5) !important;
}


/* ═══════════════════════════════════════
   TABLES
   ═══════════════════════════════════════ */
.table,
table {
    background-color: var(--bg-surface) !important;
    color: var(--text-primary) !important;
    border-radius: var(--radius-md);
    overflow: hidden;
    width: 100%;
    max-width: 100%;
}

.table thead th,
table thead th,
table th {
    background-color: var(--bg-surface-alt) !important;
    color: var(--text-secondary) !important;
    font-size: var(--font-xs) !important;
    font-weight: 600 !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: var(--space-3) var(--space-4) !important;
    border-bottom: 2px solid var(--border-light) !important;
    border-top: none !important;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 1;
}

.table tbody td,
table tbody td,
table td {
    padding: var(--space-3) var(--space-4) !important;
    border-bottom: 1px solid var(--border-light) !important;
    font-size: var(--font-sm) !important;
    color: var(--text-primary) !important;
    vertical-align: middle;
}

.table tbody tr:hover,
table tbody tr:hover {
    background-color: var(--bg-hover) !important;
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: var(--bg-surface-alt) !important;
}

.table-striped tbody tr:nth-of-type(odd):hover {
    background-color: var(--bg-hover) !important;
}

/* DataTables integration */
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
    border: 1px solid var(--border-medium) !important;
    border-radius: var(--radius-md) !important;
    padding: var(--space-2) var(--space-3) !important;
    background-color: var(--bg-surface) !important;
    color: var(--text-primary) !important;
}

.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_length label {
    color: var(--text-secondary) !important;
    font-size: var(--font-sm) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    color: var(--text-primary) !important;
    border-radius: var(--radius-sm) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--brand-primary) !important;
    color: white !important;
    border-color: var(--brand-primary) !important;
}


/* ═══════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════ */
.btn,
button {
    font-family: var(--font-family) !important;
    font-size: var(--font-sm) !important;
    font-weight: 500 !important;
    border-radius: var(--radius-md) !important;
    padding: var(--space-2) var(--space-4) !important;
    transition: all var(--transition-fast) !important;
    cursor: pointer;
    border: 1px solid transparent;
    line-height: 1.5;
    box-shadow: none !important;
}

button:hover,
.btn:hover {
    transform: translateY(-1px) !important;
    box-shadow: var(--shadow-sm) !important;
}

button:active,
.btn:active {
    transform: translateY(0) !important;
}

button:focus,
.btn:focus {
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(var(--brand-primary-rgb), 0.25) !important;
}

/* Primary button */
.btn-primary,
.btn-success,
button.btn-primary {
    background-color: var(--brand-primary) !important;
    border-color: var(--brand-primary) !important;
    color: var(--text-inverse) !important;
}

.btn-primary:hover,
.btn-success:hover,
button.btn-primary:hover {
    background-color: var(--brand-primary-hover) !important;
    border-color: var(--brand-primary-hover) !important;
    color: var(--text-inverse) !important;
}

/* Warning / accent button */
.btn-warning {
    background-color: var(--brand-primary) !important;
    border-color: var(--brand-primary) !important;
    color: var(--text-inverse) !important;
}

.btn-warning:hover {
    background-color: var(--brand-primary-hover) !important;
    border-color: var(--brand-primary-hover) !important;
    color: var(--text-inverse) !important;
}

/* Danger button */
.btn-danger {
    background-color: var(--danger) !important;
    border-color: var(--danger) !important;
    color: white !important;
}

/* Info button */
.btn-info {
    background-color: var(--info) !important;
    border-color: var(--info) !important;
    color: white !important;
}

/* Secondary / default button */
.btn-default,
.btn-secondary,
.btn-outline-success {
    background-color: transparent !important;
    border: 1px solid var(--border-medium) !important;
    color: var(--text-primary) !important;
}

.btn-default:hover,
.btn-secondary:hover,
.btn-outline-success:hover {
    background-color: var(--bg-hover) !important;
    border-color: var(--brand-primary) !important;
    color: var(--brand-primary) !important;
}

/* Button sizes */
.btn-lg {
    padding: var(--space-3) var(--space-6) !important;
    font-size: var(--font-base) !important;
    font-weight: 600 !important;
    border-radius: var(--radius-md) !important;
}

.btn-sm {
    padding: var(--space-1) var(--space-3) !important;
    font-size: var(--font-xs) !important;
}

/* Kill old button animations */
.btn::before,
.btn::after,
button::before,
button::after {
    display: none !important;
    animation: none !important;
}


/* ═══════════════════════════════════════
   FORMS
   ═══════════════════════════════════════ */
.form-control,
.custom-select,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="date"],
input[type="search"],
textarea,
select {
    background-color: var(--bg-surface) !important;
    border: 1px solid var(--border-medium) !important;
    border-radius: var(--radius-md) !important;
    color: var(--text-primary) !important;
    font-family: var(--font-family) !important;
    font-size: var(--font-base) !important;
    padding: var(--space-2) var(--space-3) !important;
    height: auto !important;
    min-height: 40px;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus,
.custom-select:focus,
input:focus,
textarea:focus,
select:focus {
    border-color: var(--brand-primary) !important;
    box-shadow: 0 0 0 3px rgba(var(--brand-primary-rgb), 0.15) !important;
    outline: none !important;
    background-color: var(--bg-surface) !important;
}

.form-control::placeholder,
input::placeholder,
textarea::placeholder {
    color: var(--text-muted) !important;
}

label,
.control-label {
    color: var(--text-secondary) !important;
    font-size: var(--font-sm) !important;
    font-weight: 500;
    margin-bottom: var(--space-1);
}

.form-group {
    margin-bottom: var(--space-4);
}

.input-group-text,
.input-group-prepend .input-group-text {
    background-color: var(--bg-surface-alt) !important;
    border: 1px solid var(--border-medium) !important;
    color: var(--text-secondary) !important;
    font-size: var(--font-sm) !important;
    border-radius: var(--radius-md) !important;
}


/* ═══════════════════════════════════════
   MODALS
   ═══════════════════════════════════════ */
.modal-content {
    background-color: var(--bg-surface) !important;
    border: 1px solid var(--border-light) !important;
    border-radius: var(--radius-xl) !important;
    box-shadow: var(--shadow-xl) !important;
    overflow: hidden;
}

.modal-header {
    background-color: var(--bg-surface) !important;
    border-bottom: 1px solid var(--border-light) !important;
    padding: var(--space-4) var(--space-5) !important;
}

.modal-header h3,
.modal-header .title,
.modal-header .modal-title {
    color: var(--text-primary) !important;
    font-size: var(--font-lg) !important;
    font-weight: 600 !important;
}

.modal-body {
    padding: var(--space-5) !important;
    background-color: var(--bg-surface) !important;
}

.modal-footer {
    background-color: var(--bg-surface-alt) !important;
    border-top: 1px solid var(--border-light) !important;
    padding: var(--space-3) var(--space-5) !important;
}

.modal-backdrop.show {
    background-color: rgba(15, 23, 42, 0.5) !important;
}

.close,
.modal-header .close {
    color: var(--text-muted) !important;
    opacity: 0.7;
    text-shadow: none !important;
    font-size: var(--font-xl);
}

.close:hover {
    color: var(--text-primary) !important;
    opacity: 1;
}


/* ═══════════════════════════════════════
   BADGES
   ═══════════════════════════════════════ */
.badge {
    font-family: var(--font-family) !important;
    font-size: var(--font-xs) !important;
    font-weight: 600 !important;
    padding: 3px 8px !important;
    border-radius: 20px !important;
    letter-spacing: 0.3px;
}

.badge-primary,
.badge-success {
    background-color: var(--success-bg) !important;
    color: var(--success-text) !important;
}

.badge-warning {
    background-color: var(--warning-bg) !important;
    color: var(--warning-text) !important;
}

.badge-danger {
    background-color: var(--danger-bg) !important;
    color: var(--danger-text) !important;
}

.badge-info {
    background-color: var(--info-bg) !important;
    color: var(--info-text) !important;
}

.badge-secondary,
.badge-default {
    background-color: var(--bg-hover) !important;
    color: var(--text-secondary) !important;
}

/* ═══════════════════════════════════════
   ALERTS
   ═══════════════════════════════════════ */
.alert {
    border-radius: var(--radius-md) !important;
    border: none !important;
    font-size: var(--font-sm) !important;
    padding: var(--space-3) var(--space-4) !important;
}

.alert-success {
    background-color: var(--success-bg) !important;
    color: var(--success-text) !important;
}

.alert-warning {
    background-color: var(--warning-bg) !important;
    color: var(--warning-text) !important;
}

.alert-danger {
    background-color: var(--danger-bg) !important;
    color: var(--danger-text) !important;
}

.alert-info {
    background-color: var(--info-bg) !important;
    color: var(--info-text) !important;
}


/* ═══════════════════════════════════════
   BREADCRUMB
   ═══════════════════════════════════════ */
.breadcrumb {
    background-color: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
    font-size: var(--font-sm);
}

.breadcrumb-item a {
    color: var(--text-link) !important;
}

.breadcrumb-item.active {
    color: var(--text-muted) !important;
}

.breadcrumb-item + .breadcrumb-item::before {
    color: var(--text-muted) !important;
}


/* ═══════════════════════════════════════
   DROPDOWNS
   ═══════════════════════════════════════ */
.dropdown-menu {
    background-color: var(--bg-surface) !important;
    border: 1px solid var(--border-light) !important;
    border-radius: var(--radius-md) !important;
    box-shadow: var(--shadow-lg) !important;
    padding: var(--space-2) 0 !important;
}

.dropdown-item,
.dropdown-menu a,
.dropdown-menu li a {
    color: var(--text-primary) !important;
    font-size: var(--font-sm) !important;
    padding: var(--space-2) var(--space-4) !important;
    transition: background-color var(--transition-fast);
}

.dropdown-item:hover,
.dropdown-menu a:hover,
.dropdown-menu li a:hover {
    background-color: var(--bg-hover) !important;
    color: var(--brand-primary) !important;
}

.dropdown-divider {
    border-top: 1px solid var(--border-light) !important;
}


/* ═══════════════════════════════════════
   PAGINATION
   ═══════════════════════════════════════ */
.pagination .page-item .page-link {
    color: var(--text-primary) !important;
    background-color: var(--bg-surface) !important;
    border: 1px solid var(--border-light) !important;
    font-size: var(--font-sm) !important;
    padding: var(--space-2) var(--space-3) !important;
    border-radius: var(--radius-sm) !important;
    margin: 0 2px;
}

.pagination .page-item.active .page-link {
    background-color: var(--brand-primary) !important;
    border-color: var(--brand-primary) !important;
    color: white !important;
}

.pagination .page-item .page-link:hover {
    background-color: var(--bg-hover) !important;
}


/* ═══════════════════════════════════════
   TABS & NAV
   ═══════════════════════════════════════ */
.nav-tabs {
    border-bottom: 2px solid var(--border-light) !important;
}

.nav-tabs .nav-link {
    color: var(--text-secondary) !important;
    border: none !important;
    padding: var(--space-3) var(--space-4) !important;
    font-weight: 500;
    font-size: var(--font-sm);
    transition: color var(--transition-fast);
}

.nav-tabs .nav-link:hover {
    color: var(--brand-primary) !important;
    border-color: transparent !important;
}

.nav-tabs .nav-link.active {
    color: var(--brand-primary) !important;
    border-bottom: 2px solid var(--brand-primary) !important;
    background: transparent !important;
    font-weight: 600;
}

.tab-content {
    background-color: var(--bg-surface) !important;
    padding: var(--space-4) !important;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
}


/* ═══════════════════════════════════════
   TOOLTIPS & POPOVERS
   ═══════════════════════════════════════ */
.tooltip-inner {
    background-color: var(--sidebar-bg) !important;
    color: var(--sidebar-text-active) !important;
    font-size: var(--font-xs) !important;
    border-radius: var(--radius-sm) !important;
    padding: var(--space-1) var(--space-2) !important;
}


/* ═══════════════════════════════════════
   PROGRESS BARS
   ═══════════════════════════════════════ */
.progress {
    background-color: var(--bg-hover) !important;
    border-radius: var(--radius-sm) !important;
    height: 8px !important;
    overflow: hidden;
}

.progress-bar {
    background-color: var(--brand-primary) !important;
    border-radius: var(--radius-sm) !important;
    transition: width 0.6s ease;
}


/* ═══════════════════════════════════════
   LIST GROUPS
   ═══════════════════════════════════════ */
.list-group-item {
    background-color: var(--bg-surface) !important;
    border-color: var(--border-light) !important;
    color: var(--text-primary) !important;
    padding: var(--space-3) var(--space-4) !important;
}

.list-group-item:hover {
    background-color: var(--bg-hover) !important;
}

.list-group-item.active {
    background-color: var(--brand-primary) !important;
    border-color: var(--brand-primary) !important;
    color: white !important;
}


/* ═══════════════════════════════════════
   TOASTR NOTIFICATIONS
   ═══════════════════════════════════════ */
.toast-success {
    background-color: var(--success) !important;
}

.toast-error {
    background-color: var(--danger) !important;
}

.toast-warning {
    background-color: var(--warning) !important;
}

.toast-info {
    background-color: var(--info) !important;
}


/* ═══════════════════════════════════════
   SWEETALERT2 OVERRIDES
   ═══════════════════════════════════════ */
.swal2-popup {
    font-family: var(--font-family) !important;
    border-radius: var(--radius-xl) !important;
    background-color: var(--bg-surface) !important;
    color: var(--text-primary) !important;
}

.swal2-title {
    color: var(--text-primary) !important;
    font-size: var(--font-lg) !important;
    font-weight: 600 !important;
}

.swal2-content,
.swal2-html-container {
    color: var(--text-secondary) !important;
    font-size: var(--font-base) !important;
}

.swal2-confirm {
    background-color: var(--brand-primary) !important;
    border-radius: var(--radius-md) !important;
    font-weight: 600 !important;
}

.swal2-cancel {
    background-color: var(--bg-hover) !important;
    color: var(--text-primary) !important;
    border-radius: var(--radius-md) !important;
}

.swal2-input {
    border: 1px solid var(--border-medium) !important;
    border-radius: var(--radius-md) !important;
    color: var(--text-primary) !important;
    background-color: var(--bg-surface) !important;
}


/* ═══════════════════════════════════════════════════════════════════════════
   LOGIN / AUTH PAGES - PREMIUM
   World-class login experience for ENGAGED BPO
   ═══════════════════════════════════════════════════════════════════════════ */

/* --- Background & Layout --- */
/* CRITICAL: Override main.css .auth-main { margin-top:100px } and all competing rules */
.auth-main,
#wrapper.auth-main {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 40%, #0d3b3b 70%, #0f172a 100%) !important;
    min-height: 100vh !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: relative;
    overflow: hidden;
    margin: 0 !important;
    margin-top: 0 !important;
    padding: 0 !important;
}
[data-theme="dark"] .auth-main,
[data-theme="dark"] #wrapper.auth-main {
    background: linear-gradient(135deg, #020617 0%, #0f172a 40%, #042f2e 70%, #020617 100%) !important;
}

/* Animated background orbs - override main.css :before (31% right panel) and :after */
.auth-main::before,
.auth-main:before {
    content: '' !important;
    position: fixed !important;
    top: -20% !important;
    right: -10% !important;
    left: auto !important;
    bottom: auto !important;
    width: 600px !important;
    height: 600px !important;
    border-radius: 50% !important;
    background: radial-gradient(circle, rgba(13,148,136,0.15) 0%, transparent 70%) !important;
    animation: authOrb1 20s ease-in-out infinite alternate !important;
    pointer-events: none !important;
    z-index: 0 !important;
}
.auth-main::after,
.auth-main:after {
    content: '' !important;
    display: block !important;
    position: fixed !important;
    bottom: -20% !important;
    left: -10% !important;
    top: auto !important;
    right: auto !important;
    width: 500px !important;
    height: 500px !important;
    border-radius: 50% !important;
    background: radial-gradient(circle, rgba(99,102,241,0.12) 0%, transparent 70%) !important;
    animation: authOrb2 25s ease-in-out infinite alternate !important;
    pointer-events: none !important;
    z-index: 0 !important;
}
@keyframes authOrb1 {
    0%   { transform: translate(0, 0) scale(1); }
    100% { transform: translate(-60px, 40px) scale(1.1); }
}
@keyframes authOrb2 {
    0%   { transform: translate(0, 0) scale(1); }
    100% { transform: translate(40px, -50px) scale(1.15); }
}

.auth-main .container {
    position: relative;
    z-index: 1;
}
.auth-main .row {
    min-height: 100vh !important;
    align-items: center !important;
}

/* Override main.css: .auth-main .lead { font-size:18px } */
.auth-main .lead {
    font-size: 1.35rem !important;
    font-weight: 700 !important;
}
/* Override main.css: .auth-main .helper-text { color:#9A9A9A } */
.auth-main .helper-text {
    color: var(--text-secondary, #64748b) !important;
    font-size: 0.8125rem !important;
}
/* Override main.css: .auth-main .form-control:focus { color:#666d77 } */
.auth-main .form-control:focus {
    color: var(--text-primary, #1e293b) !important;
}
/* Override main.css: .auth-main .form-control { background:#fff; border-color:#eee } */
.auth-main .form-control {
    background-color: var(--bg-primary, #fff) !important;
    border: 1.5px solid var(--border-color, #e2e8f0) !important;
}

/* --- Navbar --- */
/* Override main.css: .auth-main .navbar { margin-bottom:80px; border-bottom:1px solid } */
.auth-main .navbar {
    background-color: transparent !important;
    border-bottom: none !important;
    box-shadow: none !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 10 !important;
    padding: 1.25rem 0 !important;
    margin-bottom: 0 !important;
    margin: 0 !important;
}
.auth-main .navbar-brand {
    color: white !important;
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: 0.3px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.auth-main .navbar-brand img {
    height: 38px !important;
    width: auto !important;
    filter: brightness(1.1);
}
.auth-main .navbar .nav-link {
    color: rgba(255,255,255,0.75) !important;
    font-weight: 500;
    transition: color 0.2s ease;
}
.auth-main .navbar .nav-link:hover {
    color: #2dd4bf !important;
}

/* --- Left side: Hero text --- */
/* Override main.css: .auth-main .auth_detail { padding:40px 0; max-width:360px } */
.auth-main .auth_detail {
    color: rgba(255,255,255,0.9);
    padding: 0 !important;
    padding-right: 2rem !important;
    max-width: none !important;
}
/* Override main.css: .auth-main .auth_detail h2 { font-weight:300; font-size:40px } */
.auth-main .auth_detail h2 {
    color: #fff !important;
    font-weight: 800 !important;
    font-size: 2.5rem !important;
    line-height: 1.15 !important;
    letter-spacing: -0.5px !important;
    margin-bottom: 1rem !important;
}
.auth-main .auth_detail p {
    color: rgba(255,255,255,0.65) !important;
    font-size: 1rem;
    line-height: 1.6;
    max-width: 480px;
}

/* Social links - override main.css .auth-main .auth_detail .social-links { margin-top:40px } */
.auth-main .social-links {
    display: flex;
    gap: 0.5rem;
    margin-top: 1.5rem !important;
}
.auth-main .social-links .btn-default {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.08) !important;
    border: 1px solid rgba(255,255,255,0.15) !important;
    color: rgba(255,255,255,0.7) !important;
    transition: all 0.3s ease;
    padding: 0;
}
.auth-main .social-links .btn-default:hover {
    background: rgba(13,148,136,0.2) !important;
    border-color: rgba(13,148,136,0.4) !important;
    color: #2dd4bf !important;
    transform: translateY(-2px);
}

/* --- Carousel --- */
.auth-main .carousel-item {
    color: #2dd4bf !important;
    font-weight: 800;
}
[data-theme="dark"] .auth-main .carousel-item {
    color: #5eead4 !important;
}

/* ── LOGIN CARD (GLASS-MORPHISM) ─────────────────────── */
.auth-main .card {
    background: rgba(255,255,255,0.95) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 20px !important;
    border: 1px solid rgba(255,255,255,0.2) !important;
    box-shadow:
        0 8px 32px rgba(0,0,0,0.12),
        0 2px 8px rgba(0,0,0,0.08),
        inset 0 1px 0 rgba(255,255,255,0.5) !important;
    padding: 0 !important;
    overflow: hidden;
    max-width: 420px;
    margin: 0 auto;
    transition: box-shadow 0.4s ease, transform 0.4s ease;
}
.auth-main .card:hover {
    box-shadow:
        0 12px 48px rgba(0,0,0,0.18),
        0 4px 12px rgba(0,0,0,0.1),
        inset 0 1px 0 rgba(255,255,255,0.5) !important;
    transform: translateY(-2px);
}

/* Dark mode card */
[data-theme="dark"] .auth-main .card {
    background: rgba(30,41,59,0.85) !important;
    border: 1px solid rgba(255,255,255,0.08) !important;
    box-shadow:
        0 8px 32px rgba(0,0,0,0.3),
        0 2px 8px rgba(0,0,0,0.2),
        inset 0 1px 0 rgba(255,255,255,0.05) !important;
}
[data-theme="dark"] .auth-main .card:hover {
    box-shadow:
        0 12px 48px rgba(0,0,0,0.4),
        0 4px 12px rgba(0,0,0,0.3) !important;
}

/* --- Card Header (override main.css .card .header) --- */
.auth-main .card .header {
    color: var(--text-primary, #1e293b) !important;
    padding: 2rem 2rem 0.75rem !important;
    text-align: center;
    box-shadow: none !important;
    background: transparent !important;
}
.auth-main .card .header img {
    height: 48px;
    margin-bottom: 1rem;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.1));
}
.auth-main .card .header .lead,
.auth-main .card .header .title,
.auth-main .card .header h3,
.auth-main .card .header p {
    color: var(--text-primary, #1e293b) !important;
    font-size: 1.35rem !important;
    font-weight: 700 !important;
    margin: 0;
    letter-spacing: -0.2px;
}
.auth-main .card .detalle-novedad {
    padding: 1.5rem 2rem 0;
}
.auth-main .card .detalle-novedad img {
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.1));
}

/* --- Card Body (override main.css .card .body { color: #666d77 }) --- */
.auth-main .card .body {
    color: var(--text-primary, #1e293b) !important;
    padding: 1rem 2rem 2rem !important;
    background: transparent !important;
    font-weight: 400;
}
.auth-main .card .body p {
    color: var(--text-secondary, #64748b) !important;
    font-size: 0.875rem;
    line-height: 1.5;
}

/* --- Form controls --- */
.auth-main .card .control-label {
    color: var(--text-secondary, #64748b) !important;
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 0.4rem;
}
.auth-main .card .form-control {
    background-color: var(--bg-primary, #fff) !important;
    border: 1.5px solid var(--border-color, #e2e8f0) !important;
    border-radius: 10px !important;
    color: var(--text-primary, #1e293b) !important;
    padding: 0.65rem 1rem !important;
    font-size: 0.9375rem !important;
    height: auto !important;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
.auth-main .card .form-control:focus {
    border-color: var(--brand-primary, #0d9488) !important;
    box-shadow: 0 0 0 3px rgba(13,148,136,0.12) !important;
    outline: none !important;
}
.auth-main .card .form-control::placeholder {
    color: var(--text-muted, #94a3b8) !important;
    font-weight: 400;
}
.auth-main .card .input-group-text {
    background: var(--bg-secondary, #f1f5f9) !important;
    border: 1.5px solid var(--border-color, #e2e8f0) !important;
    border-left: none !important;
    border-radius: 0 10px 10px 0 !important;
    color: var(--text-secondary, #64748b) !important;
    cursor: pointer;
    transition: color 0.2s ease;
}
.auth-main .card .input-group-text:hover {
    color: var(--brand-primary, #0d9488) !important;
}
.auth-main .card .input-group .form-control {
    border-radius: 10px 0 0 10px !important;
}

/* --- Submit button --- */
.auth-main .card .btn-warning,
.auth-main .card .btn-primary,
.auth-main .card .btn-lg.btn-block {
    background: linear-gradient(135deg, #0d9488 0%, #0891b2 100%) !important;
    border: none !important;
    color: #fff !important;
    font-weight: 700 !important;
    font-size: 0.9375rem !important;
    letter-spacing: 0.5px;
    padding: 0.75rem 1.5rem !important;
    border-radius: 12px !important;
    height: 48px;
    margin-top: 0.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 14px rgba(13,148,136,0.25);
    text-transform: uppercase;
}
.auth-main .card .btn-warning:hover,
.auth-main .card .btn-primary:hover,
.auth-main .card .btn-lg.btn-block:hover {
    background: linear-gradient(135deg, #0f766e 0%, #0e7490 100%) !important;
    box-shadow: 0 6px 20px rgba(13,148,136,0.35);
    transform: translateY(-1px);
}
.auth-main .card .btn-warning:active,
.auth-main .card .btn-primary:active,
.auth-main .card .btn-lg.btn-block:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(13,148,136,0.2);
}

/* --- Bottom links --- */
.auth-main .bottom {
    text-align: center;
    margin-top: 1.25rem;
}
.auth-main .bottom a {
    color: var(--brand-primary, #0d9488) !important;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s ease;
}
.auth-main .bottom a:hover {
    color: var(--brand-primary-hover, #0f766e) !important;
    text-decoration: underline;
}
.auth-main .bottom .helper-text {
    color: var(--text-secondary, #64748b) !important;
    font-size: 0.8125rem;
}

/* --- Form group spacing --- */
.auth-main .card .form-group {
    margin-bottom: 1.25rem;
}

/* ── AUTH DARK MODE OVERRIDES ──────────────────────── */
[data-theme="dark"] .auth-main .card .header,
[data-theme="dark"] .auth-main .card .header .lead,
[data-theme="dark"] .auth-main .card .header .title,
[data-theme="dark"] .auth-main .card .header h3,
[data-theme="dark"] .auth-main .card .header p {
    color: var(--text-primary) !important;
}
[data-theme="dark"] .auth-main .card .body {
    color: var(--text-primary) !important;
}
[data-theme="dark"] .auth-main .card .body p {
    color: var(--text-secondary) !important;
}
[data-theme="dark"] .auth-main .card .control-label {
    color: var(--text-secondary) !important;
}
[data-theme="dark"] .auth-main .card .form-control {
    background-color: rgba(255,255,255,0.05) !important;
    border-color: rgba(255,255,255,0.12) !important;
    color: var(--text-primary) !important;
}
[data-theme="dark"] .auth-main .card .form-control::placeholder {
    color: rgba(255,255,255,0.35) !important;
}
[data-theme="dark"] .auth-main .card .form-control:focus {
    border-color: #2dd4bf !important;
    box-shadow: 0 0 0 3px rgba(45,212,191,0.15) !important;
}
[data-theme="dark"] .auth-main .card .input-group-text {
    background: rgba(255,255,255,0.05) !important;
    border-color: rgba(255,255,255,0.12) !important;
    color: rgba(255,255,255,0.5) !important;
}
[data-theme="dark"] .auth-main .card .btn-warning,
[data-theme="dark"] .auth-main .card .btn-primary,
[data-theme="dark"] .auth-main .card .btn-lg.btn-block {
    background: linear-gradient(135deg, #0d9488 0%, #6366f1 100%) !important;
    box-shadow: 0 4px 14px rgba(13,148,136,0.3);
}
[data-theme="dark"] .auth-main .card .btn-warning:hover,
[data-theme="dark"] .auth-main .card .btn-primary:hover {
    box-shadow: 0 6px 20px rgba(13,148,136,0.4);
}
[data-theme="dark"] .auth-main .bottom .helper-text {
    color: rgba(255,255,255,0.5) !important;
}

/* ── AUTH RESPONSIVE ───────────────────────────────── */
@media (max-width: 992px) {
    .auth-main .auth_detail { display: none; }
    .auth-main .col-lg-8,
    .auth-main .col-lg-6.col-xl-7 { display: none !important; }
    .auth-main .col-lg-4,
    .auth-main .col-lg-6.col-xl-5 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }
    .auth-main .card {
        max-width: 420px !important;
        margin: 0 auto !important;
    }
}
@media (max-width: 576px) {
    .auth-main .card {
        max-width: 100% !important;
        border-radius: 16px !important;
        margin: 0 0.5rem !important;
    }
    .auth-main .card .header { padding: 1.5rem 1.5rem 0.5rem !important; }
    .auth-main .card .body { padding: 0.75rem 1.5rem 1.5rem !important; }
    .auth-main .auth_detail h2 { font-size: 2rem; }
}

/* --- Auth theme toggle (visible on dark gradient background) --- */
.auth-main .theme-toggle {
    border: 1px solid rgba(255,255,255,0.25) !important;
    color: rgba(255,255,255,0.8) !important;
    background: rgba(255,255,255,0.08) !important;
}
.auth-main .theme-toggle:hover {
    background: rgba(255,255,255,0.15) !important;
    color: #2dd4bf !important;
    border-color: rgba(45,212,191,0.4) !important;
}

/* Kill all main.css responsive overrides for auth */
@media screen and (max-width: 1440px) {
    .auth-main::before, .auth-main:before { width: 600px !important; border-radius: 50% !important; }
}
@media screen and (max-width: 1200px) {
    .auth-main { margin-top: 0 !important; margin: 0 !important; }
    .auth-main::before, .auth-main:before { width: 600px !important; border-radius: 50% !important; }
    .auth-main .navbar { margin-bottom: 0 !important; }
}
@media screen and (max-width: 992px) {
    .auth-main { margin: 0 !important; margin-top: 0 !important; }
    .auth-main::before, .auth-main:before { width: 600px !important; border-radius: 50% !important; }
    .auth-main .navbar { margin-bottom: 0 !important; }
    .auth-main .auth_detail { padding: 0 !important; }
}
@media screen and (max-width: 640px) {
    .auth-main { margin-top: 0 !important; margin: 0 !important; }
    .auth-main::before, .auth-main:before { width: 400px !important; height: 400px !important; border-radius: 50% !important; }
}

/* --- Outline secondary in auth (404 page) --- */
.auth-main .card .btn-outline-secondary {
    background: transparent !important;
    border: 1.5px solid var(--border-color, #e2e8f0) !important;
    color: var(--text-secondary, #64748b) !important;
    font-weight: 600 !important;
    border-radius: 12px !important;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}
.auth-main .card .btn-outline-secondary:hover {
    border-color: var(--brand-primary, #0d9488) !important;
    color: var(--brand-primary, #0d9488) !important;
    background: rgba(13,148,136,0.04) !important;
}
[data-theme="dark"] .auth-main .card .btn-outline-secondary {
    border-color: rgba(255,255,255,0.15) !important;
    color: rgba(255,255,255,0.6) !important;
}
[data-theme="dark"] .auth-main .card .btn-outline-secondary:hover {
    border-color: #2dd4bf !important;
    color: #2dd4bf !important;
    background: rgba(45,212,191,0.08) !important;
}


/* ═══════════════════════════════════════
   THEME TOGGLE BUTTON
   ═══════════════════════════════════════ */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    background-color: transparent;
    color: var(--navbar-text);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 16px;
    padding: 0;
    margin: 0 var(--space-2);
    box-shadow: none !important;
}

.theme-toggle:hover {
    background-color: var(--bg-hover);
    color: var(--brand-primary);
    transform: none !important;
}

.theme-toggle:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(var(--brand-primary-rgb), 0.25) !important;
}

.theme-toggle .fa-sun,
.theme-toggle .fa-moon {
    transition: transform var(--transition-base);
}

/* In light mode: show moon (to switch to dark) */
[data-theme="light"] .theme-toggle .fa-sun { display: none; }
[data-theme="light"] .theme-toggle .fa-moon { display: inline-block; }

/* In dark mode: show sun (to switch to light) */
[data-theme="dark"] .theme-toggle .fa-sun { display: inline-block; }
[data-theme="dark"] .theme-toggle .fa-moon { display: none; }


/* ═══════════════════════════════════════
   OVERLAY
   ═══════════════════════════════════════ */
.overlay {
    background-color: rgba(15, 23, 42, 0.6) !important;
    opacity: 0;
    transition: opacity 0.3s ease !important;
    pointer-events: none;
}

.overlay.open {
    opacity: 1;
    pointer-events: auto;
}

/* ═══════════════════════════════════════
   OFFCANVAS MOBILE SIDEBAR SYSTEM
   Supreme premium mobile sidebar with proper
   z-index stack, smooth transitions, overlay sync
   ═══════════════════════════════════════ */

/* Sidebar base: ensure fixed positioning and smooth left transition */
#left-sidebar {
    position: fixed !important;
    transition: left 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.35s ease !important;
}

/* When offcanvas-active: show sidebar + overlay + proper z-index stack */
.offcanvas-active .overlay {
    display: block !important;
    opacity: 1;
    pointer-events: auto;
    z-index: 1040 !important;
}

.offcanvas-active #left-sidebar {
    left: 0 !important;
    z-index: 1050 !important;
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.3) !important;
    transform: none !important;
}

.offcanvas-active .navbar-fixed-top {
    z-index: 1060 !important;
}


/* ═══════════════════════════════════════
   CHARTS (Chart.js / Canvas)
   ═══════════════════════════════════════ */
.chart-container,
[class*="chart"] canvas {
    background-color: transparent !important;
}


/* ═══════════════════════════════════════
   CUSTOM WIDGETS (Dashboard)
   ═══════════════════════════════════════ */
/* Notification bell */
.notification-bell {
    position: relative;
    cursor: pointer;
    padding: var(--space-2);
}

.notification-bell .badge-count {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--danger);
    color: white;
    font-size: 10px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}


/* ═══════════════════════════════════════
   KILL COSMIC / METALLIC ANIMATIONS
   ═══════════════════════════════════════ */
@keyframes cosmicGradient { from, to { background-position: 0% 50%; } }
@keyframes floatEffect { from, to { transform: none; } }
@keyframes pulseGlow { from, to { box-shadow: none; } }
@keyframes shimmer { from, to { background-position: 0 0; } }

/* Neutralize any element using cosmic animations */
[class*="cosmic"],
[class*="metallic"],
[class*="neon"],
[class*="glow"] {
    animation: none !important;
    background-image: none !important;
}

/* Remove all glow/pulse effects from the theme classes */
.theme-green *,
.theme-purple * {
    text-shadow: none;
}

/* Remove the gradient/animated backgrounds from theme wrappers */
.theme-green #wrapper,
.theme-purple #wrapper {
    background-color: var(--bg-app) !important;
    background-image: none !important;
}

.theme-green .navbar,
.theme-purple .navbar {
    background-image: none !important;
}

.theme-green #left-sidebar,
.theme-purple #left-sidebar {
    background-image: none !important;
}


/* ═══════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════ */

/* Tablet */
@media (max-width: 992px) {
    :root {
        --sidebar-width: 260px;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .block-header h2 {
        font-size: var(--font-lg) !important;
    }

    .card {
        margin-bottom: var(--space-4) !important;
    }

    .card:hover {
        transform: none !important;
    }

    .btn,
    button {
        min-height: 44px;
        min-width: 44px;
    }

    .table-responsive {
        border-radius: var(--radius-md);
        overflow-x: auto;
    }

    .container-fluid {
        padding: 0 var(--space-3);
    }

    /* Auth page: stack columns */
    .auth-main .col-lg-8 {
        display: none;
    }

    .auth-main .col-lg-4 {
        flex: 0 0 100%;
        max-width: 100%;
        padding: var(--space-4);
    }

    .auth-main .card {
        margin: 0 auto;
        max-width: 420px;
    }

    .modal-dialog {
        margin: var(--space-3) !important;
    }
}

/* Small mobile */
@media (max-width: 576px) {
    .block-header h2 {
        font-size: var(--font-md) !important;
    }

    .state_w1 h5,
    .state_w2 h5,
    .state_w3 h5 {
        font-size: var(--font-xl) !important;
    }

    .card .body {
        padding: var(--space-3) !important;
    }
}


/* ═══════════════════════════════════════
   PRINT STYLES
   ═══════════════════════════════════════ */
@media print {
    body {
        background-color: white !important;
        color: #000 !important;
        font-size: 12pt !important;
    }

    .navbar,
    #left-sidebar,
    .sidebar,
    .theme-toggle,
    .btn-toggle-offcanvas,
    .page-loader-wrapper,
    .overlay,
    .chat-widget,
    [class*="chat-"],
    .notification-bell {
        display: none !important;
    }

    #main-content {
        margin-left: 0 !important;
        padding: 0 !important;
    }

    .card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
        break-inside: avoid;
    }

    a[href]::after {
        content: none !important;
    }
}


/* ═══════════════════════════════════════
   THEME TRANSITION (smooth switch)
   ═══════════════════════════════════════ */
html.theme-transitioning,
html.theme-transitioning *,
html.theme-transitioning *::before,
html.theme-transitioning *::after {
    transition: background-color 0.3s ease,
                color 0.3s ease,
                border-color 0.3s ease,
                box-shadow 0.3s ease !important;
}


/* ═══════════════════════════════════════
   FULLCALENDAR OVERRIDES
   ═══════════════════════════════════════ */
.fc {
    font-family: var(--font-family) !important;
}

.fc-toolbar h2 {
    color: var(--text-primary) !important;
    font-size: var(--font-lg) !important;
}

.fc-day-header {
    color: var(--text-secondary) !important;
    background-color: var(--bg-surface-alt) !important;
}

.fc-event {
    background-color: var(--brand-primary) !important;
    border-color: var(--brand-primary) !important;
    border-radius: var(--radius-sm) !important;
    font-size: var(--font-xs) !important;
}


/* ═══════════════════════════════════════
   CHAT WIDGETS (Tesoreria, Afiliaciones, Unificado)
   ═══════════════════════════════════════ */
.chat-widget-btn,
[class*="chat-widget"] button[style*="position: fixed"] {
    background-color: var(--brand-primary) !important;
    box-shadow: var(--shadow-lg) !important;
}

.chat-widget-modal,
[class*="chat-widget"] [class*="modal"],
[class*="chat-widget"] [class*="container"] {
    background-color: var(--bg-surface) !important;
    border: 1px solid var(--border-light) !important;
    border-radius: var(--radius-xl) !important;
}


/* ═══════════════════════════════════════
   MISC UTILITY CLASSES
   ═══════════════════════════════════════ */
.text-muted {
    color: var(--text-muted) !important;
}

.bg-light {
    background-color: var(--bg-surface-alt) !important;
}

.border {
    border-color: var(--border-light) !important;
}

.shadow {
    box-shadow: var(--shadow-md) !important;
}

.shadow-sm {
    box-shadow: var(--shadow-sm) !important;
}

.shadow-lg {
    box-shadow: var(--shadow-lg) !important;
}

hr {
    border-top-color: var(--border-light) !important;
}

/* Code / Pre */
code {
    background-color: var(--bg-surface-alt);
    color: var(--danger);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-size: var(--font-xs);
}

pre {
    background-color: var(--bg-surface-alt) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: var(--space-4);
}

/* Generic link styling for .title / .subtitle classes used inline */
.title {
    font-size: var(--font-xl) !important;
    font-weight: 700 !important;
    color: var(--text-primary) !important;
}

.subtitle {
    font-size: var(--font-base) !important;
    color: var(--text-secondary) !important;
}

/* Override any inline font-family declarations */
[style*="font-family"] {
    font-family: var(--font-family) !important;
}


/* ═══════════════════════════════════════
   LAYOUT POSITIONING & STRUCTURE
   Critical: Sidebar, Navbar, Main Content geometry
   ═══════════════════════════════════════ */

/* Body overflow prevention */
body,
body.theme-green,
body.theme-purple {
    overflow-x: hidden !important;
    max-width: 100vw;
    position: relative;
}

#wrapper {
    position: relative;
    overflow-x: hidden;
    max-width: 100vw;
}

/* Navbar fixed positioning */
.navbar-fixed-top {
    position: fixed !important;
    top: 0 !important;
    right: 0 !important;
    width: calc(100% - var(--sidebar-width)) !important;
    left: auto !important;
    z-index: 1030 !important;
    display: flex !important;
    align-items: center;
}

.navbar-fixed-top .container-fluid {
    width: 100%;
    max-width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.navbar-fixed-top .navbar-left {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.navbar-fixed-top .navbar-right {
    display: inline-flex !important;
    align-items: center;
    gap: var(--space-1);
    margin-left: auto;
}

/* Sidebar fixed layout */
#left-sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    height: 100vh !important;
    z-index: 1040 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
}

/* Main content positioning */
#main-content {
    width: calc(100% - var(--sidebar-width)) !important;
    float: right !important;
    position: relative;
    min-height: 100vh;
}

/* Container overflow prevention */
.container-fluid,
#main-content,
.block-header,
.row {
    max-width: 100%;
    overflow-x: hidden;
}

.table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}

.table-responsive > .table {
    width: max-content;
    min-width: 100%;
}

/* Responsive layout: Sidebar hidden on small screens */
@media screen and (max-width: 1200px) {
    .navbar-fixed-top {
        width: 100% !important;
    }

    #left-sidebar {
        position: fixed !important;
        left: calc(-1 * var(--sidebar-width, 260px)) !important;
        top: 0 !important;
        height: 100vh !important;
        z-index: 1050 !important;
        transform: none !important;
    }

    .offcanvas-active #left-sidebar {
        left: 0 !important;
    }

    #main-content {
        width: 100% !important;
        float: none !important;
    }

    /* Overlay: base state for mobile */
    .overlay {
        display: block !important;
        z-index: 1040 !important;
    }
}

@media screen and (max-width: 768px) {
    .navbar-fixed-top {
        padding: 0 var(--space-2) !important;
    }

    #main-content {
        margin-top: 52px;
    }

    #main-content > .container-fluid {
        padding-right: 15px;
        padding-left: 15px;
    }
}


/* ═══════════════════════════════════════
   SIDEBAR ACCENT BORDER (Decorative)
   Subtle teal accent line on sidebar right edge
   ═══════════════════════════════════════ */
#left-sidebar::after {
    content: '' !important;
    display: block !important;
    animation: none !important;
    position: absolute;
    top: 0;
    right: 0;
    width: 2px;
    height: 100%;
    background: linear-gradient(180deg,
        transparent 0%,
        var(--sidebar-active) 20%,
        var(--brand-primary) 50%,
        var(--sidebar-active) 80%,
        transparent 100%
    );
    opacity: 0.4;
    pointer-events: none;
}

/* Sidebar nav margin from main.css */
.sidebar-nav {
    margin: 0 var(--space-3) !important;
}

/* Menu item subtle entrance animation */
.sidebar-nav .metismenu > li {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-md);
}

/* Active item left accent */
.sidebar-nav .metismenu > li.active > a {
    position: relative;
}

.sidebar-nav .metismenu > li.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--sidebar-text-active);
    border-radius: 0 2px 2px 0;
    z-index: 2;
}

/* Submenu container */
.sidebar-nav .metismenu > li ul {
    background: rgba(0,0,0,0.15) !important;
    border-radius: var(--radius-md) !important;
    margin: var(--space-1) 0 var(--space-1) var(--space-3) !important;
    padding: var(--space-1) 0 !important;
    border-left: 2px solid var(--sidebar-active) !important;
}


/* ═══════════════════════════════════════
   TABLE RESPONSIVE SCROLLBAR (Premium)
   ═══════════════════════════════════════ */
.table-responsive::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.table-responsive::-webkit-scrollbar-track {
    background: var(--bg-surface-alt);
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: var(--brand-primary-hover);
}

/* Inline table color overrides (from old inline styles) */
table[style*="color: #888888"],
table[style*="color:#888888"],
table[style*="color: #3f3f3f"],
table[style*="color:#3f3f3f"] {
    color: var(--text-primary) !important;
}

/* Table sticky header handled by .table-scroll-container (Phase 11) */


/* ═══════════════════════════════════════
   CHECKBOX & RADIO (Custom)
   ═══════════════════════════════════════ */
input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-medium) !important;
    border-radius: 4px !important;
    background: var(--bg-surface) !important;
    cursor: pointer;
    position: relative;
    transition: all var(--transition-fast);
    vertical-align: middle;
    flex-shrink: 0;
    padding: 0 !important;
    min-height: auto;
}

input[type="checkbox"]:hover {
    border-color: var(--brand-primary) !important;
    background: rgba(var(--brand-primary-rgb), 0.05) !important;
}

input[type="checkbox"]:checked {
    background: var(--brand-primary) !important;
    border-color: var(--brand-primary) !important;
}

input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 5px;
    width: 5px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

input[type="checkbox"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-medium) !important;
    border-radius: 50% !important;
    background: var(--bg-surface) !important;
    cursor: pointer;
    position: relative;
    transition: all var(--transition-fast);
    padding: 0 !important;
    min-height: auto;
}

input[type="radio"]:checked {
    border-color: var(--brand-primary) !important;
}

input[type="radio"]:checked::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--brand-primary);
}

/* Check-all in table headers */
.check-all {
    color: var(--text-primary) !important;
}


/* ═══════════════════════════════════════
   SELECT CUSTOM ARROW
   ═══════════════════════════════════════ */
select.form-control,
.custom-select {
    padding-right: 36px !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%230d9488' d='M6 9L1 4h10z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    background-size: 12px !important;
    cursor: pointer;
}

[data-theme="dark"] select.form-control,
[data-theme="dark"] .custom-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2314b8a6' d='M6 9L1 4h10z'/%3E%3C/svg%3E") !important;
}

select.form-control option,
.custom-select option {
    background: var(--bg-surface) !important;
    color: var(--text-primary) !important;
    padding: 8px 12px;
}


/* ═══════════════════════════════════════
   COUNTER / BIG NUMBERS
   ═══════════════════════════════════════ */
.counter {
    font-size: var(--font-3xl) !important;
    font-weight: 800 !important;
    color: var(--brand-primary) !important;
    line-height: 1.1;
}

.number h6 {
    color: var(--text-primary) !important;
    font-weight: 700;
}


/* ═══════════════════════════════════════
   MODAL FORM INPUTS (Higher specificity)
   Ensures dark-theme modal forms are readable
   ═══════════════════════════════════════ */
.modal-content .form-control,
.modal-content input.form-control,
.modal-content textarea.form-control,
.modal-content select.form-control,
.modal-content .custom-select {
    background-color: var(--bg-surface) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-medium) !important;
    -webkit-text-fill-color: var(--text-primary) !important;
}

.modal-content .form-control::placeholder {
    color: var(--text-muted) !important;
    -webkit-text-fill-color: var(--text-muted) !important;
    opacity: 1;
}

.modal-content .form-control:focus {
    border-color: var(--brand-primary) !important;
    box-shadow: 0 0 0 3px rgba(var(--brand-primary-rgb), 0.15) !important;
}

.modal-content label,
.modal-content .control-label {
    color: var(--text-secondary) !important;
    font-weight: 500;
}

.modal-content .form-group {
    margin-bottom: var(--space-4);
}


/* ═══════════════════════════════════════
   CARD INFO / STAT CARDS (Premium)
   Dashboard stat cards with icon backgrounds
   ═══════════════════════════════════════ */
.card-info,
.card.card-info {
    background-color: var(--bg-surface) !important;
    border: 1px solid var(--border-light) !important;
    border-radius: var(--radius-lg) !important;
    padding: var(--space-5) !important;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.card-info:hover,
.card.card-info:hover {
    box-shadow: var(--shadow-md) !important;
    transform: translateY(-3px) !important;
    border-color: var(--brand-primary) !important;
}

/* Stat card icon circles */
.stat-icon,
[class*="stat"] .icon,
.card-info .icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
    flex-shrink: 0;
}

/* Semantic icon backgrounds */
.bg-success-light { background-color: var(--success-bg) !important; color: var(--success) !important; }
.bg-warning-light { background-color: var(--warning-bg) !important; color: var(--warning) !important; }
.bg-danger-light  { background-color: var(--danger-bg) !important; color: var(--danger) !important; }
.bg-info-light    { background-color: var(--info-bg) !important; color: var(--info) !important; }
.bg-primary-light { background-color: rgba(var(--brand-primary-rgb),0.12) !important; color: var(--brand-primary) !important; }

/* State widgets (from main template) */
.state_w1,
.state_w2,
.state_w3 {
    background-color: var(--bg-surface) !important;
    border-radius: var(--radius-lg) !important;
    padding: var(--space-4) !important;
    border: 1px solid var(--border-light) !important;
    border-left: 4px solid var(--brand-primary) !important;
    transition: all var(--transition-base);
}

.state_w1:hover,
.state_w2:hover,
.state_w3:hover {
    box-shadow: var(--shadow-md) !important;
    transform: translateY(-2px);
}

/* Number display in stat widgets */
.state_w1 h2,
.state_w2 h2,
.state_w3 h2 {
    font-size: var(--font-2xl) !important;
    font-weight: 700 !important;
    color: var(--text-primary) !important;
    margin-bottom: var(--space-1);
}

.state_w1 small,
.state_w2 small,
.state_w3 small {
    color: var(--text-muted) !important;
    font-size: var(--font-xs) !important;
}


/* ═══════════════════════════════════════
   #listaAliados / SCROLLABLE LISTS
   ═══════════════════════════════════════ */
#listaAliados {
    max-height: 550px;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

#listaAliados::-webkit-scrollbar {
    width: 6px;
}

#listaAliados::-webkit-scrollbar-track {
    background: var(--bg-surface-alt);
    border-radius: 3px;
}

#listaAliados::-webkit-scrollbar-thumb {
    background: var(--brand-primary);
    border-radius: 3px;
}

#listaAliados:empty::before {
    content: 'No hay aliados asignados';
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    color: var(--text-muted);
    font-size: var(--font-base);
    font-weight: 500;
}


/* ═══════════════════════════════════════
   FORM LOADING STATE
   ═══════════════════════════════════════ */
.form-control.loading {
    background-image: linear-gradient(90deg,
        rgba(var(--brand-primary-rgb), 0.03) 0%,
        rgba(var(--brand-primary-rgb), 0.08) 50%,
        rgba(var(--brand-primary-rgb), 0.03) 100%) !important;
    background-size: 200% 100%;
    animation: formLoading 1.5s ease-in-out infinite;
}

@keyframes formLoading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}


/* ═══════════════════════════════════════
   CAROUSEL IN AUTH PAGES
   ═══════════════════════════════════════ */
.auth-main .carousel.vert {
    overflow: visible;
    position: relative;
    display: inline-block;
}

.auth-main .carousel.vert .carousel-inner {
    height: 60px;
    overflow: visible;
}

.auth-main .carousel.vert .carousel-item {
    font-size: var(--font-xl);
    font-weight: 800;
    line-height: 1.2;
}

.auth-main .carousel.vert .carousel-item.active {
    display: block;
    opacity: 1;
}


/* ═══════════════════════════════════════
   FULLSCREEN MODAL (.full class)
   Used in detail pages with iframes
   ═══════════════════════════════════════ */
.full {
    min-width: 100% !important;
    min-height: 120vh !important;
    border: none;
    overflow: hidden;
}


/* ═══════════════════════════════════════
   INLINE COLOR OVERRIDES
   Handle hardcoded inline style colors
   ═══════════════════════════════════════ */
/* Override inline #16a085 and #1abc9c colors to use brand-primary */
[style*="color:#16a085"],
[style*="color: #16a085"],
[style*="color:#1abc9c"],
[style*="color: #1abc9c"] {
    color: var(--brand-primary) !important;
}

/* Override inline #34495e (dark blue-gray) to use text-primary */
[style*="color:#34495e"],
[style*="color: #34495e"] {
    color: var(--text-primary) !important;
}

/* Override inline background #16a085 to use brand gradient */
[style*="background-color: #16a085"],
[style*="background-color:#16a085"],
[style*="background:#16a085"],
[style*="background: #16a085"] {
    background-color: var(--brand-primary) !important;
}

/* Override inline green button backgrounds */
[style*="background-color: rgb(191, 227, 118)"],
[style*="background-color: rgb(176, 233, 62)"] {
    background-color: var(--success-bg) !important;
    color: var(--success-text) !important;
}


/* ═══════════════════════════════════════
   DASHBOARD AFILIACIONES CSS VARIABLES
   (Used by dashboardAliadoAfiliaciones.html)
   ═══════════════════════════════════════ */
:root,
[data-theme="light"] {
    --afil-primary:   var(--brand-primary);
    --afil-warning:   var(--warning);
    --afil-success:   var(--success);
    --afil-info:      var(--info);
    --afil-danger:    var(--danger);
    --afil-purple:    var(--brand-secondary);
}

[data-theme="dark"] {
    --afil-primary:   var(--brand-primary);
    --afil-warning:   var(--warning);
    --afil-success:   var(--success);
    --afil-info:      var(--info);
    --afil-danger:    var(--danger);
    --afil-purple:    var(--brand-secondary);
}


/* ═══════════════════════════════════════
   PAGE LOADER (Premium)
   ═══════════════════════════════════════ */
.page-loader-wrapper {
    z-index: 99999999 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.page-loader-wrapper .loader {
    text-align: center;
}

.page-loader-wrapper .loader img {
    animation: loaderPulse 1.5s ease-in-out infinite;
}

@keyframes loaderPulse {
    0%, 100% { opacity: 0.7; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.05); }
}


/* ═══════════════════════════════════════
   NAVBAR BTN (Mobile hamburger)
   ═══════════════════════════════════════ */
.navbar-fixed-top .navbar-btn {
    display: none;
    float: left;
}

.navbar-fixed-top .navbar-btn button {
    font-size: 20px;
    line-height: 0.7;
    border: none !important;
    background: none !important;
    color: var(--navbar-text) !important;
    vertical-align: middle;
    padding: var(--space-2);
}

.navbar-fixed-top .navbar-btn .logo {
    width: 32px;
    height: auto;
}


/* ═══════════════════════════════════════
   CARD BODY SPECIFIC REFINEMENTS
   ═══════════════════════════════════════ */

/* Card body overflow for embedded tables */
.card .body {
    overflow: hidden;
}

/* Card body with table inside - reduce padding */
.card .body > .table-responsive,
.card .body > table {
    margin: calc(-1 * var(--space-5));
    margin-top: 0;
    width: calc(100% + 2 * var(--space-5));
}

/* Card header icons */
.card .header .header-dropdown {
    position: absolute;
    top: 14px;
    right: 20px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.card .header .header-dropdown li a {
    padding: var(--space-1) var(--space-2);
    color: var(--text-muted) !important;
    font-size: var(--font-sm);
}

.card .header .header-dropdown li a:hover {
    color: var(--brand-primary) !important;
}

/* Card header small text */
.card .header h2 small {
    color: var(--text-muted) !important;
    font-size: var(--font-sm);
    line-height: 1.3;
}


/* ═══════════════════════════════════════
   INPUT GROUP REFINEMENT
   Ensure proper border-radius on grouped inputs
   ═══════════════════════════════════════ */
.input-group .form-control:not(:last-child) {
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
}

.input-group .form-control:not(:first-child) {
    border-top-left-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
}

.input-group-append .input-group-text {
    border-top-left-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
    border-left: none !important;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.input-group-append .input-group-text:hover {
    background-color: var(--bg-hover) !important;
    color: var(--brand-primary) !important;
}

.input-group-prepend .input-group-text {
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
    border-right: none !important;
}

.input-group-prepend + .form-control,
.input-group-prepend + .custom-select {
    border-top-left-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
}


/* ═══════════════════════════════════════
   AVATAR COMPONENT
   ═══════════════════════════════════════ */
.user_div img,
img[id="avatar"] {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--brand-primary);
    background-color: var(--bg-surface-alt);
}


/* ═══════════════════════════════════════
   AUTH MAIN PSEUDO-ELEMENTS
   Override main.css ::before/:after decorations
   ═══════════════════════════════════════ */
.auth-main::before {
    content: '' !important;
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(2px 2px at 20% 30%, rgba(var(--brand-primary-rgb),0.15), transparent),
        radial-gradient(2px 2px at 60% 70%, rgba(var(--brand-primary-rgb),0.10), transparent),
        radial-gradient(1px 1px at 50% 50%, rgba(var(--brand-primary-rgb),0.08), transparent),
        radial-gradient(1px 1px at 80% 10%, rgba(var(--brand-primary-rgb),0.10), transparent) !important;
    z-index: 0;
    pointer-events: none;
}

.auth-main::after {
    display: none !important;
}

.auth-main .container {
    position: relative;
    z-index: 1;
}


/* ═══════════════════════════════════════
   FULLWIDTH LAYOUT VARIANT
   ═══════════════════════════════════════ */
.layout-fullwidth #wrapper .navbar-fixed-top {
    width: 100% !important;
}

.layout-fullwidth #wrapper #left-sidebar {
    left: calc(-1 * var(--sidebar-width)) !important;
}

.layout-fullwidth #wrapper #main-content {
    width: 100% !important;
}


/* ═══════════════════════════════════════
   RESPONSIVE FORM MOBILE
   Prevent zoom on iOS with 16px min font
   ═══════════════════════════════════════ */
@media (max-width: 768px) {
    .form-control,
    .custom-select,
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    select {
        font-size: 16px !important;
        min-height: 44px;
    }
}


/* ═══════════════════════════════════════
   DARK THEME SPECIFIC REFINEMENTS
   Fine-tuned overrides for dark mode readability
   ═══════════════════════════════════════ */
[data-theme="dark"] .card {
    border-color: var(--border-light) !important;
}

/* Global table dark mode - override Bootstrap 5.3 --bs-table-bg: #fff */
[data-theme="dark"] .table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--text-primary);
    color: var(--text-primary);
}
[data-theme="dark"] .table thead th {
    background-color: rgba(255,255,255,0.04) !important;
    border-bottom-color: var(--border-light) !important;
    color: var(--text-primary) !important;
}
[data-theme="dark"] .table tbody td {
    border-bottom-color: rgba(255,255,255,0.06) !important;
    color: var(--text-primary);
    background-color: transparent !important;
}
[data-theme="dark"] .table tbody tr {
    background-color: transparent;
}

[data-theme="dark"] .block-header {
    background: var(--bg-app) !important;
}
[data-theme="dark"] .block-header h2 {
    color: var(--text-primary) !important;
}
[data-theme="dark"] .block-header .breadcrumb li,
[data-theme="dark"] .block-header .breadcrumb li a,
[data-theme="dark"] .block-header .breadcrumb .breadcrumb-item.active {
    color: var(--text-secondary) !important;
}
[data-theme="dark"] .block-header .header-subtitle-premium {
    color: var(--text-muted) !important;
}

[data-theme="dark"] .modal-content {
    border-color: var(--border-light) !important;
}

[data-theme="dark"] .input-group-text {
    background-color: rgba(255,255,255,0.05) !important;
    border-color: var(--border-medium) !important;
}

[data-theme="dark"] .page-loader-wrapper {
    background: var(--loader-bg) !important;
}

[data-theme="dark"] .page-loader-wrapper .loader p {
    color: var(--text-secondary) !important;
}

/* Dark mode dropdown select options */
[data-theme="dark"] select.form-control option,
[data-theme="dark"] .custom-select option {
    background: var(--bg-surface) !important;
    color: var(--text-primary) !important;
}

/* Ensure links in cards are visible in dark mode */
[data-theme="dark"] .card a {
    color: var(--text-link) !important;
}

[data-theme="dark"] .card a:hover {
    color: var(--brand-primary-hover) !important;
}


/* ═══════════════════════════════════════════════════════════════
   ████  PREMIUM DASHBOARD SYSTEM  ████
   Elegant, harmonious, world-class UI components
   ═══════════════════════════════════════════════════════════════ */


/* ── STAT CARDS (Premium) ────────────────────────────
   Used in: dashboardAliadoAfiliaciones, tesoreria, etc.
   Structure: .stat-card > .stat-icon + .stat-value + .stat-label
   ──────────────────────────────────────────────────── */
.stat-card {
    background: var(--bg-surface) !important;
    border: 1px solid var(--border-light) !important;
    border-radius: var(--radius-lg) !important;
    padding: 24px 20px !important;
    position: relative;
    overflow: hidden;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    height: 100%;
    box-shadow: var(--shadow-sm);
}

/* Subtle decorative gradient bar at top */
.stat-card::before {
    content: '' !important;
    display: block !important;
    animation: none !important;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--brand-primary), var(--brand-secondary));
    opacity: 0;
    transition: opacity 0.25s ease;
}

.stat-card:hover {
    box-shadow: var(--shadow-lg) !important;
    transform: translateY(-3px) !important;
    border-color: rgba(var(--brand-primary-rgb), 0.3) !important;
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-card .stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: transform 0.25s ease;
}

.stat-card:hover .stat-icon {
    transform: scale(1.08);
}

.stat-card .stat-value {
    font-size: var(--font-2xl) !important;
    font-weight: 800 !important;
    color: var(--text-primary) !important;
    line-height: 1.1;
    margin: 0;
    letter-spacing: -0.5px;
}

.stat-card .stat-label {
    font-size: var(--font-xs) !important;
    font-weight: 600 !important;
    color: var(--text-muted) !important;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin: 0;
}

/* Clickable stat cards */
.stat-card-click {
    cursor: pointer;
}

.stat-card-click:hover {
    border-color: var(--brand-primary) !important;
}

.stat-card-click::after {
    content: '\f054' !important;
    font-family: 'Font Awesome 5 Free', 'FontAwesome' !important;
    font-weight: 900 !important;
    display: block !important;
    animation: none !important;
    position: absolute;
    bottom: 16px;
    right: 16px;
    font-size: 10px;
    color: var(--text-muted);
    opacity: 0;
    transform: translateX(-4px);
    transition: all 0.25s ease;
}

.stat-card-click:hover::after {
    opacity: 0.6;
    transform: translateX(0);
}

[data-theme="dark"] .stat-card {
    background: var(--bg-surface) !important;
    border-color: var(--border-light) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .stat-card:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4) !important;
    border-color: rgba(var(--brand-primary-rgb), 0.4) !important;
}


/* ── METRIC CARDS (Audit Dashboard) ──────────────────
   Structure: .metric-card > .metric-value + .metric-label
   ──────────────────────────────────────────────────── */
.metric-card {
    background: var(--bg-surface) !important;
    border: 1px solid var(--border-light) !important;
    border-radius: var(--radius-lg) !important;
    padding: 24px 20px !important;
    text-align: center;
    box-shadow: var(--shadow-sm) !important;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.metric-card::before {
    content: '' !important;
    display: block !important;
    animation: none !important;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    transition: opacity 0.25s ease;
    opacity: 0;
}

.metric-card:hover {
    box-shadow: var(--shadow-lg) !important;
    transform: translateY(-3px) !important;
}

.metric-card:hover::before {
    opacity: 1;
}

.metric-card .metric-value {
    font-size: var(--font-2xl) !important;
    font-weight: 800 !important;
    line-height: 1.1;
    margin-bottom: 6px;
    letter-spacing: -0.5px;
}

.metric-card .metric-label {
    font-size: var(--font-xs) !important;
    color: var(--text-muted) !important;
    font-weight: 500;
    margin-top: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-card .metric-label i {
    margin-right: 4px;
    font-size: 11px;
}

/* Semantic metric card colors */
.metric-card.info .metric-value { color: var(--info) !important; }
.metric-card.info::before { background: var(--info); }
.metric-card.danger .metric-value { color: var(--danger) !important; }
.metric-card.danger::before { background: var(--danger); }
.metric-card.warning .metric-value { color: var(--warning) !important; }
.metric-card.warning::before { background: var(--warning); }
.metric-card.success .metric-value { color: var(--success) !important; }
.metric-card.success::before { background: var(--success); }

[data-theme="dark"] .metric-card {
    background: var(--bg-surface) !important;
    border-color: var(--border-light) !important;
}


/* ── CHART CARDS ─────────────────────────────────────
   Container for Chart.js canvases and comparativo sections
   ──────────────────────────────────────────────────── */
.chart-card {
    background: var(--bg-surface) !important;
    border: 1px solid var(--border-light) !important;
    border-radius: var(--radius-lg) !important;
    padding: 24px !important;
    box-shadow: var(--shadow-sm);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    height: 100%;
}

.chart-card:hover {
    box-shadow: var(--shadow-md) !important;
}

.chart-card h5 {
    font-size: var(--font-md) !important;
    font-weight: 600 !important;
    color: var(--text-primary) !important;
    margin-bottom: 16px !important;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 8px;
}

.chart-card h5 i {
    color: var(--brand-primary) !important;
    font-size: 16px;
}

.chart-card canvas {
    max-width: 100%;
}

[data-theme="dark"] .chart-card {
    background: var(--bg-surface) !important;
    border-color: var(--border-light) !important;
}


/* ── ALIADO INFO CARD (Profile) ──────────────────────
   Structure: .aliado-card > .aliado-header > .aliado-avatar + .aliado-details
   ──────────────────────────────────────────────────── */
.aliado-card {
    background: linear-gradient(135deg,
        rgba(var(--brand-primary-rgb), 0.06) 0%,
        var(--bg-surface) 40%,
        var(--bg-surface) 100%
    ) !important;
    border: 1px solid var(--border-light) !important;
    border-radius: var(--radius-lg) !important;
    padding: 24px 28px !important;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    transition: all 0.25s ease;
}

/* Subtle left accent */
.aliado-card::before {
    content: '' !important;
    display: block !important;
    animation: none !important;
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, var(--brand-primary), var(--brand-secondary));
    border-radius: 2px;
}

.aliado-card:hover {
    box-shadow: var(--shadow-md) !important;
    border-color: rgba(var(--brand-primary-rgb), 0.2) !important;
}

.aliado-header {
    display: flex;
    align-items: center;
    gap: 20px;
}

.aliado-avatar {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-xl);
    font-weight: 800;
    flex-shrink: 0;
    letter-spacing: 1px;
    box-shadow: 0 4px 12px rgba(var(--brand-primary-rgb), 0.3);
}

.aliado-details {
    flex: 1;
    min-width: 0;
}

.aliado-details h3 {
    font-size: var(--font-lg) !important;
    font-weight: 700 !important;
    color: var(--text-primary) !important;
    margin: 0 0 4px 0 !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.aliado-details p {
    font-size: var(--font-sm) !important;
    color: var(--text-secondary) !important;
    margin: 2px 0 !important;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.aliado-details p i {
    color: var(--brand-primary);
    width: 16px;
    text-align: center;
    font-size: 12px;
}

.aliado-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: var(--font-xs);
    font-weight: 600;
    background: rgba(var(--brand-primary-rgb), 0.12);
    color: var(--brand-primary);
    letter-spacing: 0.3px;
}

[data-theme="dark"] .aliado-card {
    background: linear-gradient(135deg,
        rgba(var(--brand-primary-rgb), 0.08) 0%,
        var(--bg-surface) 40%,
        var(--bg-surface) 100%
    ) !important;
}


/* ── ACCESO RAPIDO (Quick Access Links) ──────────────
   Structure: a.acceso-rapido > i + span
   ──────────────────────────────────────────────────── */
a.acceso-rapido,
.acceso-rapido {
    display: flex !important;
    align-items: center;
    gap: 12px;
    padding: 12px 16px !important;
    margin-bottom: 6px;
    border-radius: var(--radius-md) !important;
    color: var(--text-primary) !important;
    font-size: var(--font-sm) !important;
    font-weight: 500;
    text-decoration: none !important;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    background: transparent;
}

a.acceso-rapido:hover,
.acceso-rapido:hover {
    background: rgba(var(--brand-primary-rgb), 0.06) !important;
    color: var(--brand-primary) !important;
    border-color: rgba(var(--brand-primary-rgb), 0.15);
    transform: translateX(4px);
}

a.acceso-rapido i,
.acceso-rapido i {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: rgba(var(--brand-primary-rgb), 0.08);
    color: var(--brand-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

a.acceso-rapido:hover i,
.acceso-rapido:hover i {
    background: var(--brand-primary);
    color: white;
    box-shadow: 0 3px 8px rgba(var(--brand-primary-rgb), 0.3);
}

a.acceso-rapido span {
    flex: 1;
}


/* ── NOTIFICATION BELL ───────────────────────────────
   Structure: .notif-bell > i.fa-bell + .badge
   ──────────────────────────────────────────────────── */
.notif-bell {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--navbar-text);
}

.notif-bell:hover {
    background: var(--bg-hover);
    color: var(--brand-primary);
}

.notif-bell i {
    font-size: 18px;
}

.notif-bell .badge {
    position: absolute !important;
    top: 2px !important;
    right: 2px !important;
    min-width: 18px;
    height: 18px;
    padding: 0 4px !important;
    border-radius: 10px !important;
    font-size: 10px !important;
    font-weight: 700 !important;
    background: var(--danger) !important;
    color: white !important;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    box-shadow: 0 2px 4px rgba(220, 38, 38, 0.4);
    border: 2px solid var(--navbar-bg);
}


/* ── AUDIT TOOLBAR ───────────────────────────────────
   Structure: .audit-toolbar > .row > inputs + selects
   ──────────────────────────────────────────────────── */
.audit-toolbar {
    background: var(--bg-surface-alt) !important;
    border-radius: var(--radius-lg) !important;
    padding: 16px 20px !important;
    margin-bottom: 16px;
    border: 1px solid var(--border-light) !important;
    transition: background-color 0.3s ease;
}

.audit-toolbar .form-control,
.audit-toolbar .btn {
    border-radius: var(--radius-md) !important;
    font-size: var(--font-sm) !important;
}

[data-theme="dark"] .audit-toolbar {
    background: rgba(255, 255, 255, 0.03) !important;
    border-color: var(--border-light) !important;
}


/* ── TABLE AUDIT ─────────────────────────────────────
   Structure: .table-audit > thead + tbody
   ──────────────────────────────────────────────────── */
.table-audit th {
    background-color: var(--brand-primary) !important;
    color: white !important;
    font-size: var(--font-xs) !important;
    font-weight: 600 !important;
    padding: 12px 10px !important;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: none !important;
}

.table-audit td {
    font-size: var(--font-xs) !important;
    padding: 10px !important;
    vertical-align: middle;
    color: var(--text-primary) !important;
    border-bottom: 1px solid var(--border-light) !important;
}

.table-audit tr:hover {
    background: rgba(var(--brand-primary-rgb), 0.04) !important;
}

[data-theme="dark"] .table-audit th {
    background-color: rgba(var(--brand-primary-rgb), 0.7) !important;
}

[data-theme="dark"] .table-audit tr:hover {
    background: rgba(var(--brand-primary-rgb), 0.08) !important;
}


/* ── SECTION TITLE ───────────────────────────────────
   Structure: .section-title (h5/h4 with bottom border)
   ──────────────────────────────────────────────────── */
.section-title {
    color: var(--brand-primary) !important;
    font-size: var(--font-md) !important;
    font-weight: 600 !important;
    margin-bottom: 16px;
    border-bottom: 2px solid var(--brand-primary) !important;
    padding-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}


/* ── PAGINATION BAR ──────────────────────────────────
   Structure: .pagination-bar > buttons
   ──────────────────────────────────────────────────── */
.pagination-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-top: 1px solid var(--border-light);
    margin-top: 8px;
}

.pagination-bar .btn {
    font-size: var(--font-xs) !important;
    padding: 6px 14px !important;
    border-radius: var(--radius-md) !important;
    font-weight: 500;
}

.pagination-container {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border-light);
}


/* ── FADE-IN ANIMATION ───────────────────────────────
   Staggered entrance for dashboard elements
   ──────────────────────────────────────────────────── */
.fade-in {
    animation: fadeInUp 0.4s ease-out both;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* ── MODAL PREMIUM HEADERS ───────────────────────────
   Gradient headers for all modals
   ──────────────────────────────────────────────────── */
.modal-header {
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-primary-hover) 100%) !important;
    color: white !important;
    border-bottom: none !important;
    padding: 20px 24px !important;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0 !important;
}

.modal-header .title,
.modal-header .modal-title,
.modal-header h3,
.modal-header h5 {
    color: white !important;
    font-weight: 600 !important;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-header .close,
.modal-header .close span {
    color: rgba(255, 255, 255, 0.85) !important;
    text-shadow: none !important;
    opacity: 1 !important;
    font-size: 24px;
}

.modal-header .close:hover,
.modal-header .close:hover span {
    color: white !important;
}

.modal-body {
    padding: 24px !important;
    background: var(--bg-surface) !important;
}

.modal-footer {
    background: var(--bg-surface-alt) !important;
    border-top: 1px solid var(--border-light) !important;
    padding: 14px 24px !important;
    border-radius: 0 0 var(--radius-xl) var(--radius-xl) !important;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* Modal body form grid refinement */
.modal-body .row {
    margin-left: -8px;
    margin-right: -8px;
}

.modal-body .row > [class*="col-"] {
    padding-left: 8px;
    padding-right: 8px;
}

.modal-body label {
    font-weight: 600 !important;
    font-size: var(--font-sm) !important;
    color: var(--text-secondary) !important;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.modal-body label i {
    color: var(--brand-primary);
    font-size: 12px;
}


/* ── CARD HEADER WITH GRADIENT ───────────────────────
   For inline gradient headers used in some sections
   ──────────────────────────────────────────────────── */
.card-header,
.card > .card-header {
    background: var(--bg-surface-alt) !important;
    border-bottom: 1px solid var(--border-light) !important;
    padding: 16px 20px !important;
}

/* Override inline gradient headers to use brand colors */
.card-header[style*="background: linear-gradient"],
.card-header[style*="background:linear-gradient"] {
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-primary-hover) 50%, var(--brand-secondary) 100%) !important;
    color: white !important;
    border-bottom: none !important;
}

.card-header[style*="background: linear-gradient"] h5,
.card-header[style*="background:linear-gradient"] h5 {
    color: white !important;
}

.card-header[style*="background: linear-gradient"] .badge-light,
.card-header[style*="background:linear-gradient"] .badge-light {
    background: rgba(255, 255, 255, 0.2) !important;
    color: white !important;
}


/* ── DASHBOARD GRID HARMONY ──────────────────────────
   Perfect spacing and alignment for dashboard sections
   ──────────────────────────────────────────────────── */
#main-content .container-fluid > .row {
    margin-bottom: 4px;
}

#main-content .container-fluid > .row > [class*="col-"] {
    display: flex;
    flex-direction: column;
}

/* Ensure cards fill their columns evenly */
#main-content .container-fluid > .row > [class*="col-"] > .stat-card,
#main-content .container-fluid > .row > [class*="col-"] > .chart-card,
#main-content .container-fluid > .row > [class*="col-"] > .metric-card,
#main-content .container-fluid > .row > [class*="col-"] > .card {
    flex: 1;
}

/* Equal height stat card rows */
.row > [class*="col-"].mb-4 {
    margin-bottom: 20px !important;
}

.row > [class*="col-"].mb-3 {
    margin-bottom: 16px !important;
}


/* ── BLOCK HEADER REFINEMENT ─────────────────────────
   Page title area with breadcrumb
   ──────────────────────────────────────────────────── */
.block-header {
    padding: 0 0 var(--space-4) 0 !important;
}

.block-header h2 {
    display: flex;
    align-items: center;
    gap: 10px;
}

.block-header h2 i {
    color: var(--brand-primary) !important;
    font-size: 0.85em;
}

/* Override inline color on page header icons */
.block-header [style*="color:#16a085"],
.block-header [style*="color: #16a085"],
.block-header [style*="color:#667eea"],
.block-header [style*="color: #667eea"] {
    color: var(--brand-primary) !important;
}


/* ── BUTTON GROUP REFINEMENT ─────────────────────────
   Tool buttons in dashboard action areas
   ──────────────────────────────────────────────────── */
.btn-outline-success {
    border-color: var(--success) !important;
    color: var(--success) !important;
    background: transparent !important;
}

.btn-outline-success:hover {
    background: var(--success) !important;
    color: white !important;
    border-color: var(--success) !important;
}

.btn-outline-primary {
    border-color: var(--brand-primary) !important;
    color: var(--brand-primary) !important;
    background: transparent !important;
}

.btn-outline-primary:hover {
    background: var(--brand-primary) !important;
    color: white !important;
    border-color: var(--brand-primary) !important;
}

.btn-outline-info {
    border-color: var(--info) !important;
    color: var(--info) !important;
    background: transparent !important;
}

.btn-outline-info:hover {
    background: var(--info) !important;
    color: white !important;
    border-color: var(--info) !important;
}

.btn-outline-secondary {
    border-color: var(--border-medium) !important;
    color: var(--text-secondary) !important;
    background: transparent !important;
}

.btn-outline-secondary:hover {
    background: var(--bg-hover) !important;
    color: var(--text-primary) !important;
    border-color: var(--brand-primary) !important;
}


/* ── CARD DETALLE (Detail View) ──────────────────────
   Used in admin.html, detail pages for aliado info
   ──────────────────────────────────────────────────── */
.card.detalle {
    border-radius: var(--radius-lg) !important;
    padding: 28px !important;
    border: 1px solid var(--border-light) !important;
    box-shadow: var(--shadow-sm) !important;
}

.card.detalle:hover {
    box-shadow: var(--shadow-md) !important;
    transform: none !important;
}


/* ── PLANNED TASK CARD ───────────────────────────────
   Task/todo list cards in dashboard
   ──────────────────────────────────────────────────── */
.card.planned_task .body,
.card.top_report .body {
    padding: var(--space-4) !important;
}

.card.planned_task .table td,
.card.top_report .table td {
    padding: var(--space-3) var(--space-4) !important;
    border-bottom: 1px solid var(--border-light) !important;
}


/* ── STATS CARD (Revenue/Count/Average) ──────────────
   Used in afiliaciones pages
   ──────────────────────────────────────────────────── */
.stats-card {
    background: var(--bg-surface) !important;
    border: 1px solid var(--border-light) !important;
    border-radius: var(--radius-lg) !important;
    padding: 20px !important;
    box-shadow: var(--shadow-sm);
    transition: all 0.25s ease;
    text-align: center;
}

.stats-card:hover {
    box-shadow: var(--shadow-md) !important;
    transform: translateY(-2px);
}

.stats-card h5,
.stats-card .stats-value {
    font-size: var(--font-xl) !important;
    font-weight: 700 !important;
    color: var(--text-primary) !important;
}

.stats-card p,
.stats-card .stats-label {
    font-size: var(--font-xs) !important;
    color: var(--text-muted) !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}


/* ── GLASS CARD STAT ─────────────────────────────────
   Glassmorphism-lite stat cards
   ──────────────────────────────────────────────────── */
.glass-card-stat {
    background: var(--bg-surface) !important;
    border: 1px solid var(--border-light) !important;
    border-radius: var(--radius-lg) !important;
    padding: 20px !important;
    box-shadow: var(--shadow-sm);
    transition: all 0.25s ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.glass-card-stat:hover,
.glass-card-stat.hover-scale:hover {
    box-shadow: var(--shadow-lg) !important;
    transform: translateY(-3px) scale(1.01) !important;
    border-color: rgba(var(--brand-primary-rgb), 0.3) !important;
}


/* ── FILTER CARD ─────────────────────────────────────
   Date filter / control cards
   ──────────────────────────────────────────────────── */
.filter-card,
.card.date-filters {
    background: var(--bg-surface) !important;
    border: 1px solid var(--border-light) !important;
    border-radius: var(--radius-lg) !important;
    padding: 16px 20px !important;
    box-shadow: var(--shadow-sm);
}


/* ── RESUMEN BANNER ──────────────────────────────────
   Summary stat banners at page tops
   ──────────────────────────────────────────────────── */
.resumen-banner,
[class*="resumen"] {
    background: var(--bg-surface) !important;
    border: 1px solid var(--border-light) !important;
    border-radius: var(--radius-lg) !important;
    padding: 16px 20px !important;
    box-shadow: var(--shadow-sm);
}


/* ── TOAST NOTIFICATIONS (Inline) ────────────────────
   Custom toast system for real-time notifications
   ──────────────────────────────────────────────────── */
.toast-container,
[id*="toast-container"] {
    z-index: 99999 !important;
}

.toast-custom,
.notification-toast {
    background: var(--bg-surface) !important;
    border: 1px solid var(--border-light) !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-xl) !important;
    color: var(--text-primary) !important;
    font-family: var(--font-family) !important;
    padding: 14px 18px !important;
}


/* ── RESPONSIVE DASHBOARD ────────────────────────────
   Mobile-first dashboard refinements
   ──────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .stat-card {
        padding: 18px 16px !important;
    }

    .stat-card .stat-icon {
        width: 44px;
        height: 44px;
        font-size: 18px;
    }

    .stat-card .stat-value {
        font-size: var(--font-xl) !important;
    }

    .metric-card {
        padding: 16px !important;
    }

    .metric-card .metric-value {
        font-size: var(--font-xl) !important;
    }

    .chart-card {
        padding: 16px !important;
    }

    .aliado-card {
        padding: 18px 16px !important;
    }

    .aliado-header {
        flex-direction: column;
        text-align: center;
        gap: 12px;
    }

    .aliado-details h3 {
        white-space: normal;
    }

    .modal-header {
        padding: 16px 18px !important;
    }

    .modal-body {
        padding: 18px !important;
    }

    .modal-footer {
        padding: 12px 18px !important;
        flex-wrap: wrap;
    }
}

@media (max-width: 576px) {
    .stat-card-click::after {
        display: none !important;
    }

    .acceso-rapido i,
    a.acceso-rapido i {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }

    .block-header h2 {
        font-size: var(--font-md) !important;
        gap: 6px;
    }
}


/* ── CARD HOVER SYSTEM (Unified) ─────────────────────
   Consistent, subtle hover effects across ALL card types
   ──────────────────────────────────────────────────── */
.card:hover,
.card-info:hover,
.stat-card:hover,
.metric-card:hover,
.chart-card:hover,
.glass-card-stat:hover {
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* Disable hover lift on mobile (prevents sticky hover on touch) */
@media (hover: none) {
    .card:hover,
    .card-info:hover,
    .stat-card:hover,
    .metric-card:hover,
    .chart-card:hover,
    .glass-card-stat:hover {
        transform: none !important;
        box-shadow: var(--shadow-sm) !important;
    }
}


/* ── INLINE GRADIENT OVERRIDE ────────────────────────
   Convert any remaining inline gradient styles to brand
   ──────────────────────────────────────────────────── */
[style*="color:#667eea"],
[style*="color: #667eea"],
[style*="color:#764ba2"],
[style*="color: #764ba2"] {
    color: var(--brand-primary) !important;
}

/* Override inline audit/purple theme header colors */
.table-audit th[style*="background"],
th[style*="background:#667eea"],
th[style*="background: #667eea"] {
    background-color: var(--brand-primary) !important;
}


/* ── ENGAGED BRANDING (Subtle) ───────────────────────
   Consistent branding touches across the app
   ──────────────────────────────────────────────────── */
.navbar-brand span,
#left-sidebar .navbar-brand span {
    color: var(--brand-primary) !important;
    font-weight: 800 !important;
    letter-spacing: 0.5px;
    font-size: var(--font-md) !important;
}

/* Badge in card headers */
.card .header .badge,
.card-header .badge {
    font-size: 10px !important;
    padding: 3px 8px !important;
    border-radius: 10px !important;
    vertical-align: middle;
}


/* ═══════════════════════════════════════════════════════════════
   ████  INLINE STYLE ABSORPTION  ████
   Replaces ALL inline <style> block patterns found in 73+ pages
   ═══════════════════════════════════════════════════════════════ */


/* ── GESTOR ASIGNACIONES MODAL ────────────────────────
   usuarioSistemaEnagaged.html modal components
   ──────────────────────────────────────────────────── */
.bg-gradient-primary {
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-secondary) 100%) !important;
    color: white !important;
}

.colaborador-info-header {
    background: var(--bg-surface-alt) !important;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 16px;
}

[data-theme="dark"] .colaborador-info-header {
    background: rgba(255,255,255,0.03) !important;
}

.avatar-circle {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-secondary) 100%) !important;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(var(--brand-primary-rgb), 0.3);
}

.resumen-asignacion {
    background: var(--bg-surface-alt) !important;
    border-radius: var(--radius-md);
    padding: 16px;
    border: 1px solid var(--border-light);
}

[data-theme="dark"] .resumen-asignacion {
    background: rgba(255,255,255,0.03) !important;
}

.resumen-asignacion h4 {
    font-weight: 700;
    color: var(--text-primary) !important;
}

.asignaciones-tree {
    max-height: 400px;
    overflow-y: auto;
}

.asignaciones-tree::-webkit-scrollbar {
    width: 6px;
}

.asignaciones-tree::-webkit-scrollbar-track {
    background: var(--bg-surface-alt);
    border-radius: 3px;
}

.asignaciones-tree::-webkit-scrollbar-thumb {
    background: var(--brand-primary);
    border-radius: 3px;
}

.empresa-card {
    border: 1px solid var(--border-light) !important;
    border-radius: var(--radius-md) !important;
    margin-bottom: 10px;
    background: var(--bg-surface) !important;
    transition: all 0.25s ease;
}

.empresa-card:hover {
    box-shadow: var(--shadow-md) !important;
    border-color: rgba(var(--brand-primary-rgb), 0.3) !important;
}

.empresa-card.empresa-seleccionada {
    border-color: var(--brand-primary) !important;
    border-width: 2px;
    background: rgba(var(--brand-primary-rgb), 0.03) !important;
}

/* empresa-header base (for empresa list cards only, not detail header) */
.empresa-card .empresa-header {
    padding: 12px 15px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: var(--radius-md);
    transition: background 0.2s;
}
.empresa-card .empresa-header:hover {
    background: var(--bg-hover);
}

.empresa-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.expand-icon {
    transition: transform 0.3s ease;
    color: var(--text-muted) !important;
}

.usuarios-container {
    padding: 0 15px 15px 15px;
    border-top: 1px solid var(--border-light);
    margin-top: 5px;
}

.usuarios-header {
    padding: 10px;
    background: var(--bg-surface-alt) !important;
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
}

[data-theme="dark"] .usuarios-header {
    background: rgba(255,255,255,0.03) !important;
}

.usuarios-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 8px;
}

.usuarios-list.usuarios-todos-seleccionados {
    opacity: 0.7;
}

.usuario-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg-surface-alt) !important;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
    transition: all 0.2s;
}

.usuario-item:hover {
    background: var(--bg-hover) !important;
}

.usuario-item.usuario-seleccionado {
    background: var(--success-bg) !important;
    border-color: var(--success) !important;
}

[data-theme="dark"] .usuario-item.usuario-seleccionado {
    background: rgba(16, 185, 129, 0.12) !important;
}

.usuario-nombre {
    font-weight: 500;
    display: block;
    color: var(--text-primary);
}

.usuario-documento {
    font-size: 11px;
    color: var(--text-muted) !important;
}

/* Custom checkbox in assignment modals */
.custom-control-input:checked ~ .custom-control-label::before {
    background-color: var(--brand-primary) !important;
    border-color: var(--brand-primary) !important;
}

.custom-control-input:focus ~ .custom-control-label::before {
    box-shadow: 0 0 0 0.2rem rgba(var(--brand-primary-rgb), 0.25) !important;
}

.badge-sm {
    font-size: 10px !important;
    padding: 3px 6px !important;
}


/* ── THEME SELECTOR CARDS ────────────────────────────
   Used in usuarioSistemaEnagaged.html for theme picker
   ──────────────────────────────────────────────────── */
.theme-selection-card {
    background: var(--bg-surface) !important;
    border: 2px solid var(--border-light) !important;
    border-radius: var(--radius-lg) !important;
    padding: 24px !important;
    text-align: center;
    transition: all 0.25s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.theme-selection-card:hover {
    border-color: var(--brand-primary) !important;
    box-shadow: var(--shadow-md) !important;
    transform: translateY(-3px);
}

.theme-selection-card.active,
.theme-selection-card[class*="selected"] {
    border-color: var(--brand-primary) !important;
    background: rgba(var(--brand-primary-rgb), 0.04) !important;
}

.theme-selection-check {
    position: absolute;
    top: 12px;
    right: 12px;
    color: var(--brand-primary);
    font-size: 20px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.theme-selection-card.active .theme-selection-check,
.theme-selection-card[class*="selected"] .theme-selection-check {
    opacity: 1;
}

.theme-selection-icon {
    font-size: 36px;
    margin-bottom: 12px;
}

.theme-selection-title {
    font-size: var(--font-md) !important;
    font-weight: 700 !important;
    color: var(--text-primary) !important;
    margin-bottom: 8px;
}

.theme-selection-description {
    font-size: var(--font-sm) !important;
    color: var(--text-secondary) !important;
    margin-bottom: 12px;
}

.theme-selection-features {
    list-style: none;
    padding: 0;
    margin: 0 0 16px 0;
    text-align: left;
}

.theme-selection-features li {
    padding: 4px 0;
    font-size: var(--font-sm);
    color: var(--text-secondary);
}

.theme-selection-features li i {
    color: var(--brand-primary);
    width: 20px;
    margin-right: 6px;
}

.theme-selection-btn {
    background: var(--brand-primary) !important;
    color: white !important;
    border: none !important;
    border-radius: var(--radius-md) !important;
    padding: 8px 16px !important;
    font-weight: 600 !important;
}

.theme-selection-btn:hover {
    background: var(--brand-primary-hover) !important;
}


/* ── LOGS TABLE CONTAINER ────────────────────────────
   Modal with scrollable activity logs
   ──────────────────────────────────────────────────── */
.logs-table-container {
    max-height: 500px;
    overflow-y: auto;
}

.logs-table-container::-webkit-scrollbar {
    width: 6px;
}

.logs-table-container::-webkit-scrollbar-thumb {
    background: var(--brand-primary);
    border-radius: 3px;
}


/* ── BTN-CUSTOM (Legacy pages) ───────────────────────
   Found in detalleRecaudo, contribuyentes, trabajadores
   ──────────────────────────────────────────────────── */
.btn-custom {
    background-color: var(--brand-primary) !important;
    color: white !important;
    padding: 10px 20px !important;
    font-size: var(--font-base) !important;
    font-weight: 600 !important;
    border-radius: var(--radius-md) !important;
    border: none !important;
    box-shadow: 0 2px 8px rgba(var(--brand-primary-rgb), 0.3);
    transition: all 0.2s ease !important;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.btn-custom:hover {
    background-color: var(--brand-primary-hover) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(var(--brand-primary-rgb), 0.4) !important;
}

.btn-custom:active {
    transform: translateY(0) !important;
}

.btn-outline-custom {
    background-color: transparent !important;
    border: 2px solid var(--brand-primary) !important;
    color: var(--brand-primary) !important;
    padding: 10px 20px !important;
    font-weight: 600 !important;
    border-radius: var(--radius-md) !important;
    transition: all 0.2s ease !important;
}

.btn-outline-custom:hover {
    background-color: var(--brand-primary) !important;
    color: white !important;
    transform: translateY(-1px) !important;
}


/* ── TABLE-CUSTOM (Legacy pages) ─────────────────────
   Found in detalleRecaudo, contribuyentes, trabajadores
   Now unified with Phase 11 scroll container
   ──────────────────────────────────────────────────── */
.table-custom {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0;
    overflow: hidden;
}

.table-custom th,
.table-custom td {
    padding: 0.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table-custom th {
    background: var(--brand-primary);
    color: #fff;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.table-custom thead tr {
    border-bottom: 2px solid var(--brand-secondary);
}

.table-custom tbody tr:nth-child(even) {
    background-color: rgba(13, 148, 136, 0.02);
}

.table-custom tbody tr:hover {
    background-color: rgba(13, 148, 136, 0.06);
}

.table-custom tfoot {
    font-weight: 600;
    color: var(--text-primary);
}

[data-theme="dark"] .table-custom th {
    background: rgba(13, 148, 136, 0.65);
}

[data-theme="dark"] .table-custom td {
    border-bottom-color: var(--border-color);
}

[data-theme="dark"] .table-custom tbody tr:nth-child(even) {
    background-color: rgba(255, 255, 255, 0.02);
}


/* ── THEAD-DARK (Bootstrap override) ─────────────────
   Dark table headers - use brand colors instead
   ──────────────────────────────────────────────────── */
.thead-dark th {
    background-color: var(--brand-primary) !important;
    color: white !important;
    border-color: var(--brand-primary-hover) !important;
    font-size: var(--font-xs) !important;
    font-weight: 600 !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

[data-theme="dark"] .thead-dark th {
    background-color: rgba(var(--brand-primary-rgb), 0.6) !important;
}


/* ── CARD-BODY (Bootstrap) ───────────────────────────
   Proper theming for card-body used in newer pages
   ──────────────────────────────────────────────────── */
.card-body {
    padding: 20px !important;
    background: transparent !important;
    color: var(--text-primary);
}


/* ── ADMIN-ONLY ──────────────────────────────────────
   Hide/show based on admin role (JS-controlled)
   ──────────────────────────────────────────────────── */
.admin-only {
    display: inline-block;
}


/* ── RESPONSIVE INLINE ABSORPTION ────────────────────
   Replace inline @media queries from legacy pages
   ──────────────────────────────────────────────────── */
@media (max-width: 576px) {
    .usuarios-list {
        grid-template-columns: 1fr;
    }

    .empresa-header {
        flex-wrap: wrap;
        gap: 10px;
    }

    .empresa-info {
        flex-wrap: wrap;
    }

    .theme-selection-card {
        margin-bottom: 12px;
    }
}


/* ── INLINE GRADIENT MODAL HEADERS ───────────────────
   Override ALL inline gradient modal headers to use
   brand colors instead of hardcoded hex values
   ──────────────────────────────────────────────────── */
.modal-header[style*="background: linear-gradient"],
.modal-header[style*="background:linear-gradient"],
.modal-header[style*="background-color"] {
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-primary-hover) 100%) !important;
    color: white !important;
    border-bottom: none !important;
}

.modal-header[style*="background"] .modal-title,
.modal-header[style*="background"] h5,
.modal-header[style*="background"] h3 {
    color: white !important;
}

.modal-header[style*="background"] .close,
.modal-header[style*="background"] .close span {
    color: rgba(255, 255, 255, 0.85) !important;
}


/* ── INLINE TABLE HEADER OVERRIDES ───────────────────
   Override inline background-color on table headers
   ──────────────────────────────────────────────────── */
th[style*="background-color"],
th[style*="background:"],
.table thead th[style*="background"] {
    background-color: var(--brand-primary) !important;
    color: white !important;
}


/* ── CARD BORDER OVERRIDES ───────────────────────────
   Override inline border-color on cards
   ──────────────────────────────────────────────────── */
.card[style*="border"],
.card[style*="border-color"] {
    border-color: var(--border-light) !important;
}

.card[style*="border"]:hover {
    border-color: rgba(var(--brand-primary-rgb), 0.3) !important;
}


/* ── FANCY CHECKBOX (Legacy) ─────────────────────────
   Used in tables with row selection
   ──────────────────────────────────────────────────── */
.fancy-checkbox {
    margin: 0;
}

.fancy-checkbox input[type="checkbox"] {
    margin-right: 6px;
}


/* ================================================================
   PHASE 3 — COMPREHENSIVE INLINE STYLE ABSORPTION
   Overrides ALL remaining hardcoded inline colors across 15+ pages
   ================================================================ */


/* ── MISSING COLOR SELECTORS ──────────────────────────
   Colors not covered by earlier selectors
   ──────────────────────────────────────────────────── */

/* Purple palette (#9b59b6, #8e44ad, #6c5ce7) → brand-secondary */
[style*="color:#9b59b6"],
[style*="color: #9b59b6"],
[style*="color:#8e44ad"],
[style*="color: #8e44ad"],
[style*="color:#6c5ce7"],
[style*="color: #6c5ce7"] {
    color: var(--brand-secondary) !important;
}

/* Darker teal (#138d75) → brand-primary-hover */
[style*="color:#138d75"],
[style*="color: #138d75"] {
    color: var(--brand-primary-hover) !important;
}

/* Info blue (#3498db, #2980b9) → info color */
[style*="color:#3498db"],
[style*="color: #3498db"],
[style*="color:#2980b9"],
[style*="color: #2980b9"] {
    color: var(--info) !important;
}

/* Navy (#1a237e, #3949ab) → brand-primary */
[style*="color:#1a237e"],
[style*="color: #1a237e"],
[style*="color:#3949ab"],
[style*="color: #3949ab"] {
    color: var(--brand-primary) !important;
}

/* Light/white text in non-modal contexts → theme-aware */
[style*="color: #ecf0f1"] {
    color: var(--text-secondary) !important;
}

/* Orange (#f39c12) → warning */
[style*="color: #f39c12"],
[style*="color:#f39c12"] {
    color: var(--warning) !important;
}

/* Green (#2ecc71) → success */
[style*="color: #2ecc71"],
[style*="color:#2ecc71"] {
    color: var(--success) !important;
}


/* ── COSMIC CONTAINER ─────────────────────────────────
   Used in billing/cuentas de cobro pages.
   Override dark cosmic backgrounds to themed surfaces
   ──────────────────────────────────────────────────── */
.cosmic-container {
    background: var(--bg-surface) !important;
    border-radius: var(--radius-lg);
    padding: 24px;
    color: var(--text-primary) !important;
}

.cosmic-container .header-section {
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-primary-hover) 100%) !important;
    color: white !important;
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 20px;
}

.cosmic-container .header-section h1,
.cosmic-container .header-section p {
    color: white !important;
}

.cosmic-container .header-section p {
    opacity: 0.85;
}


/* ── SCROLL CONTAINER (Cuentas de cobro list) ─────── */
.scroll-container {
    max-height: 600px;
    overflow-y: auto;
    position: relative;
    scrollbar-width: thin;
    scrollbar-color: var(--brand-primary) var(--bg-surface-alt);
}

.scroll-container::-webkit-scrollbar { width: 6px; }
.scroll-container::-webkit-scrollbar-track { background: var(--bg-surface-alt); border-radius: 3px; }
.scroll-container::-webkit-scrollbar-thumb { background: var(--brand-primary); border-radius: 3px; }

.scroll-indicator {
    text-align: center;
    padding: 8px;
    color: var(--text-muted);
    font-size: var(--font-sm);
}

.scroll-to-top {
    position: sticky;
    bottom: 10px;
    float: right;
    background: var(--brand-primary) !important;
    color: white !important;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    cursor: pointer;
}


/* ── EMPTY STATE ──────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted) !important;
}

.empty-state i {
    font-size: 3rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.empty-state h3 {
    color: var(--text-secondary) !important;
    font-weight: 600;
}

.empty-state p {
    color: var(--text-muted) !important;
}


/* ── CUENTAS COUNTER (billing pages) ──────────────── */
.cuentas-counter {
    color: var(--text-muted) !important;
}


/* ── COMPARISON CARD (Tesoreria dashboard) ────────── */
.comparison-card {
    background: var(--bg-surface) !important;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 20px;
}

.comparison-header {
    margin-bottom: 16px;
}

.comparison-title {
    color: var(--text-primary) !important;
    font-weight: 600;
}

.comparison-grid {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
}

.comparison-item {
    text-align: center;
    flex: 1;
}

.comparison-item .month-label {
    color: var(--text-muted);
    font-size: var(--font-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.comparison-item .value {
    font-size: var(--font-2xl);
    font-weight: 700;
    color: var(--text-primary);
}

.comparison-item.current .value {
    color: var(--brand-primary);
}

.comparison-vs {
    font-weight: 700;
    color: var(--text-muted);
    font-size: var(--font-lg);
}

.comparison-result {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    border-radius: var(--radius-md);
    margin-top: 16px;
}

.comparison-result.positive {
    background: var(--success-bg);
    color: var(--success);
}

.comparison-result.negative {
    background: var(--danger-bg);
    color: var(--danger);
}


/* ── SUMMARY TABLE CARD (Tesoreria) ───────────────── */
.summary-table-card {
    background: var(--bg-surface) !important;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 20px;
}

.summary-table-header {
    margin-bottom: 16px;
}

.summary-table-title {
    color: var(--text-primary) !important;
    font-weight: 600;
}

.summary-table {
    width: 100%;
}

.summary-table thead th {
    background: var(--brand-primary) !important;
    color: white !important;
    padding: 12px 16px;
    font-size: var(--font-xs);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.summary-table tbody td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
}

[data-theme="dark"] .summary-table thead th {
    background: rgba(var(--brand-primary-rgb), 0.7) !important;
}


/* ── BREAKDOWN CARD (Tesoreria) ───────────────────── */
.breakdown-card {
    background: var(--bg-surface) !important;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 20px;
    height: 100%;
}

.breakdown-list {
    max-height: 300px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--brand-primary) var(--bg-surface-alt);
}

.breakdown-list::-webkit-scrollbar { width: 4px; }
.breakdown-list::-webkit-scrollbar-track { background: var(--bg-surface-alt); }
.breakdown-list::-webkit-scrollbar-thumb { background: var(--brand-primary); border-radius: 2px; }


/* ── SPINNER (Loading) ────────────────────────────── */
.spinner-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border-light);
    border-top-color: var(--brand-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}


/* ── MODAL CONTENT DARK BACKGROUNDS ──────────────────
   Override dark gradient modal-content backgrounds
   used in billing/recibo modals
   ──────────────────────────────────────────────────── */
.modal-content[style*="background: linear-gradient"],
.modal-content[style*="background:linear-gradient"] {
    background: var(--bg-surface) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-light) !important;
}

/* Fix text inside overridden modal-content */
.modal-content[style*="background: linear-gradient"] h5,
.modal-content[style*="background: linear-gradient"] h6,
.modal-content[style*="background: linear-gradient"] label,
.modal-content[style*="background: linear-gradient"] .modal-title {
    color: var(--text-primary) !important;
}

.modal-content[style*="background: linear-gradient"] .modal-footer,
.modal-content[style*="background: linear-gradient"] .modal-header {
    border-color: var(--border-light) !important;
}

/* Fix form controls inside overridden dark modals */
.modal-content[style*="background"] .form-control,
.modal-content[style*="background"] select.form-control {
    background: var(--bg-surface) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-medium) !important;
}

.modal-content[style*="background"] .form-control:focus,
.modal-content[style*="background"] select.form-control:focus {
    border-color: var(--brand-primary) !important;
    box-shadow: 0 0 0 3px rgba(var(--brand-primary-rgb), 0.15) !important;
}

/* Alert overrides inside dark modals */
.modal-content[style*="background"] .alert-info {
    background: var(--info-bg) !important;
    border-color: var(--info) !important;
    color: var(--info) !important;
}

.modal-content[style*="background"] .alert-success {
    background: var(--success-bg) !important;
    border-color: var(--success) !important;
    color: var(--success) !important;
}


/* ── SEARCH CONTAINER GRADIENTS ──────────────────────
   Override hardcoded gradient search bars
   ──────────────────────────────────────────────────── */
.search-container[style*="background"],
.form-group.row[style*="background: linear-gradient"] {
    background: var(--bg-surface-alt) !important;
    border: 1px solid var(--border-light) !important;
    border-radius: var(--radius-lg) !important;
}

.search-container[style*="background"] label,
.form-group.row[style*="background"] label {
    color: var(--text-primary) !important;
}

.search-container[style*="background"] .form-control,
.form-group.row[style*="background"] .form-control,
.search-container[style*="background"] select,
.form-group.row[style*="background"] select {
    background: var(--bg-surface) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-medium) !important;
}

.search-container[style*="background"] .btn,
.form-group.row[style*="background"] .btn-light {
    background: var(--brand-primary) !important;
    color: white !important;
    border: none !important;
}


/* ── INPUT GROUP TEXT OVERRIDES ───────────────────── */
.input-group-text[style*="background-color: #16a085"],
.input-group-text[style*="background-color:#16a085"],
.input-group-text[style*="background: #16a085"] {
    background-color: var(--brand-primary) !important;
    color: white !important;
    border-color: var(--brand-primary) !important;
}


/* ── BUTTON GRADIENT OVERRIDES ───────────────────────
   Override hardcoded gradient buttons
   ──────────────────────────────────────────────────── */
button[style*="background: linear-gradient(135deg, #16a085"],
.btn[style*="background: linear-gradient(135deg, #16a085"],
.btn[style*="background: linear-gradient(135deg, #1abc9c"] {
    background: var(--brand-primary) !important;
    border-color: var(--brand-primary) !important;
}

button[style*="background: linear-gradient(135deg, #16a085"]:hover,
.btn[style*="background: linear-gradient(135deg, #16a085"]:hover {
    background: var(--brand-primary-hover) !important;
}

button[style*="background: linear-gradient(135deg, #3498db"],
.btn[style*="background: linear-gradient(135deg, #3498db"] {
    background: var(--info) !important;
    border-color: var(--info) !important;
}

button[style*="background: linear-gradient(135deg, #667eea"],
.btn[style*="background: linear-gradient(135deg, #667eea"] {
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-secondary) 100%) !important;
    border: none !important;
}

button[style*="background: linear-gradient(135deg, #1a237e"],
.btn[style*="background: linear-gradient(135deg, #1a237e"],
div[style*="background: linear-gradient(135deg, #1a237e"] {
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-primary-hover) 100%) !important;
}

button[style*="background: linear-gradient(135deg, #2e7d32"],
.btn[style*="background: linear-gradient(135deg, #2e7d32"] {
    background: var(--success) !important;
    border-color: var(--success) !important;
}

/* Progress bar gradient override */
.progress-bar[style*="background: linear-gradient"] {
    background: linear-gradient(90deg, var(--success) 0%, var(--brand-primary) 100%) !important;
}


/* ── THEAD GRADIENT OVERRIDES ─────────────────────── */
thead[style*="background: linear-gradient"],
thead[style*="background:linear-gradient"] {
    background: var(--brand-primary) !important;
}

thead[style*="background: linear-gradient"] th,
thead[style*="background:linear-gradient"] th {
    background: transparent !important;
    color: white !important;
}

[data-theme="dark"] thead[style*="background: linear-gradient"],
[data-theme="dark"] thead[style*="background:linear-gradient"] {
    background: rgba(var(--brand-primary-rgb), 0.7) !important;
}


/* ── FLOATING COUNTER (Consulta General) ──────────── */
#contadorSeleccionados > div[style*="background: linear-gradient"] {
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-primary-hover)) !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-lg) !important;
}

#contadorSeleccionados .contador-numero {
    background: rgba(255, 255, 255, 0.2) !important;
}


/* ── FORM SECTION (Billing modals) ────────────────── */
.form-section {
    background: var(--bg-surface-alt);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 16px;
}

.form-section .section-title {
    color: var(--brand-primary) !important;
    font-weight: 600;
}

.section-title[style*="color: #3498db"],
.section-title[style*="color:#3498db"],
h5[style*="color: #3498db"],
h5[style*="color:#3498db"] {
    color: var(--info) !important;
}


/* ── PDF PREVIEW IFRAME ───────────────────────────── */
iframe[style*="border: 2px solid rgba(22, 160, 133"] {
    border-color: var(--border-medium) !important;
}


/* ── RECEIPT SUMMARY TABLE (inside gradient div) ──── */
div[style*="background: linear-gradient"] table {
    color: inherit !important;
}


/* ── COSMIC BTN (Billing modal button) ────────────── */
.btn-cosmic {
    background: var(--brand-primary) !important;
    color: white !important;
    border: none !important;
    border-radius: var(--radius-md);
    padding: 8px 20px;
    font-weight: 600;
}

.btn-cosmic:hover {
    background: var(--brand-primary-hover) !important;
    color: white !important;
}


/* ── LOG GENERATION CONTAINER ─────────────────────── */
#logGeneracionRecibos {
    background: var(--bg-surface-alt) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-light) !important;
    border-radius: var(--radius-lg) !important;
    font-family: 'Consolas', 'Courier New', monospace;
}


/* ── PROGRESS MODAL COUNTERS ──────────────────────── */
.modal-body div[style*="background: #e3f2fd"] {
    background: var(--info-bg) !important;
    border-radius: var(--radius-lg) !important;
}

.modal-body div[style*="background: #e8f5e9"] {
    background: var(--success-bg) !important;
    border-radius: var(--radius-lg) !important;
}

.modal-body div[style*="background: #ffebee"] {
    background: var(--danger-bg) !important;
    border-radius: var(--radius-lg) !important;
}

.modal-body div[style*="background: #e3f2fd"] div[style*="color: #1976d2"] {
    color: var(--info) !important;
}

.modal-body div[style*="background: #e8f5e9"] div[style*="color: #388e3c"] {
    color: var(--success) !important;
}

.modal-body div[style*="background: #ffebee"] div[style*="color: #d32f2f"] {
    color: var(--danger) !important;
}


/* ── FORM CHECK BACKGROUNDS ───────────────────────── */
.form-check[style*="background: #fff3cd"] {
    background: var(--warning-bg) !important;
    border-radius: var(--radius-md) !important;
}

.form-check[style*="background: #d4edda"] {
    background: var(--success-bg) !important;
    border-radius: var(--radius-md) !important;
}

.form-check[style*="background: #e3f2fd"] {
    background: var(--info-bg) !important;
    border-radius: var(--radius-md) !important;
}


/* ── STAT CARD H3 (inside stats-card) ─────────────── */
.stats-card h3 {
    font-size: var(--font-xl) !important;
    font-weight: 700 !important;
    color: var(--text-primary) !important;
    margin-bottom: 4px;
}

/* Semantic color overrides for stats */
.stats-card h3[style*="color: #f39c12"] {
    color: var(--warning) !important;
}

.stats-card h3[style*="color: #2ecc71"] {
    color: var(--success) !important;
}

.stats-card[style*="border: 2px solid"] {
    border-color: var(--border-light) !important;
}


/* ── WHITE TEXT IN NON-MODAL CONTEXTS ─────────────────
   Override white text that was meant for dark backgrounds
   which are now themed light surfaces
   ──────────────────────────────────────────────────── */
.cosmic-container [style*="color: rgba(255,255,255"],
.cosmic-container [style*="color: #fff"],
.cosmic-container [style*="color:#fff"],
.cosmic-container [style*="color: white"],
.cosmic-container [style*="color:white"] {
    color: var(--text-primary) !important;
}

.cosmic-container h5[style*="color: #16a085"],
.cosmic-container h6[style*="color: #16a085"] {
    color: var(--brand-primary) !important;
}

.cosmic-container .filter-card label,
.cosmic-container .filter-card .form-label {
    color: var(--text-secondary) !important;
}

.cosmic-container .filter-card .form-control,
.cosmic-container .filter-card select {
    background: var(--bg-surface) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-medium) !important;
}


/* ── BLOCK HEADER SUBTITLE ────────────────────────── */
.block-header p[style*="color: rgba(255,255,255"],
.block-header [style*="color: rgba(255,255,255"] {
    color: var(--text-secondary) !important;
}

.block-header hr[style*="border-color"] {
    border-color: var(--border-light) !important;
}


/* ── BORDER OVERRIDES (rgba teal patterns) ────────── */
[style*="border: 1px solid rgba(22, 160, 133"],
[style*="border: 1px solid rgba(22,160,133"],
[style*="border: 2px solid rgba(22, 160, 133"] {
    border-color: var(--border-medium) !important;
}

[style*="border-bottom: 1px solid rgba(52, 152, 219"],
[style*="border-top: 1px solid rgba(52, 152, 219"],
[style*="border-top: 1px solid rgba(22, 160, 133"] {
    border-color: var(--border-light) !important;
}


/* ── GESTOR CARD ICONS (gestorAfil/Pagos/Incap pages) ── */
.gestorCard .card-body i[style*="color: #34495e"],
.card-info .card-body i[style*="color: #34495e"],
.card-info .card-body i[style*="color:#34495e"] {
    color: var(--brand-primary) !important;
}


/* ── DARK MODE EXTRA OVERRIDES FOR PHASE 3 ────────── */
[data-theme="dark"] .cosmic-container {
    background: var(--bg-surface) !important;
    border: 1px solid var(--border-light);
}

[data-theme="dark"] .comparison-card,
[data-theme="dark"] .summary-table-card,
[data-theme="dark"] .breakdown-card {
    border-color: var(--border-light);
}

[data-theme="dark"] .form-section {
    background: var(--bg-surface-alt);
    border: 1px solid var(--border-light);
}

[data-theme="dark"] #logGeneracionRecibos {
    background: #0f172a !important;
    color: #e2e8f0 !important;
}

[data-theme="dark"] .scroll-container {
    scrollbar-color: var(--brand-primary) var(--bg-surface);
}

[data-theme="dark"] .empty-state i {
    color: var(--text-muted);
}

[data-theme="dark"] .modal-content[style*="background"] .form-control,
[data-theme="dark"] .modal-content[style*="background"] select {
    background: var(--bg-surface-alt) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-light) !important;
}

[data-theme="dark"] .search-container[style*="background"] .form-control,
[data-theme="dark"] .form-group.row[style*="background"] .form-control {
    background: var(--bg-surface) !important;
    color: var(--text-primary) !important;
}

[data-theme="dark"] .modal-body div[style*="background: #e3f2fd"],
[data-theme="dark"] .modal-body div[style*="background: #e8f5e9"],
[data-theme="dark"] .modal-body div[style*="background: #ffebee"] {
    border: 1px solid var(--border-light);
}

[data-theme="dark"] .form-check[style*="background: #fff3cd"],
[data-theme="dark"] .form-check[style*="background: #d4edda"],
[data-theme="dark"] .form-check[style*="background: #e3f2fd"] {
    border: 1px solid var(--border-light);
}

/* ═══════════════════════════════════════
   PHASE 4: DETALLE PROFILE CARD SYSTEM
   Complete styling for renderAliadoAdminErp.js
   dynamic content (.detalle-* classes)
   ═══════════════════════════════════════ */

/* --- Profile Card Container --- */
.card.detalle {
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

/* --- Profile Header --- */
.detalle-header {
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    padding: 32px 28px 24px;
    position: relative;
    color: #fff;
}

.detalle-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--brand-accent), var(--brand-primary), var(--brand-secondary));
}

.detalle-header-content {
    display: flex;
    align-items: center;
    gap: 24px;
}

/* --- Avatar --- */
.detalle-avatar-container {
    position: relative;
    flex-shrink: 0;
}

.detalle-avatar {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(255,255,255,0.4);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    background: var(--bg-surface);
}

.detalle-avatar-badge {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--success);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

/* --- Header Info --- */
.detalle-header-info {
    flex: 1;
    min-width: 0;
}

.detalle-nombre {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    margin: 0 0 6px;
    line-height: 1.3;
}

.detalle-subtitulo {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 10px;
}

.detalle-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,0.18);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8125rem;
    color: rgba(255,255,255,0.95);
    backdrop-filter: blur(4px);
}

.detalle-badge i {
    font-size: 12px;
    opacity: 0.8;
}

/* --- Quick Stats (header row) --- */
.detalle-quick-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 6px;
}

.quick-stat-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8125rem;
    color: rgba(255,255,255,0.85);
}

.quick-stat-item i {
    font-size: 13px;
    opacity: 0.7;
}

.quick-stat-text {
    white-space: nowrap;
}

/* --- Status Badge --- */
.detalle-status-badge,
.status-badge {
    position: absolute;
    top: 16px;
    right: 20px;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge-activo {
    background: rgba(5,150,105,0.25);
    color: #6ee7b7;
    border: 1px solid rgba(52,211,153,0.3);
}

.status-badge-inactivo {
    background: rgba(220,38,38,0.25);
    color: #fca5a5;
    border: 1px solid rgba(252,165,165,0.3);
}

.status-badge-pendiente {
    background: rgba(217,119,6,0.25);
    color: #fcd34d;
    border: 1px solid rgba(252,211,77,0.3);
}

/* --- Detalle Body --- */
.detalle-body {
    padding: 28px;
}

/* --- Detalle Section --- */
.detalle-section {
    margin-bottom: 28px;
}

.detalle-section:last-child {
    margin-bottom: 0;
}

.detalle-section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 8px;
}

.detalle-section-title i {
    color: var(--brand-primary);
    font-size: 16px;
}

/* --- Mini Stats Grid --- */
.detalle-mini-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.mini-stat {
    background: var(--bg-surface-alt);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 20px 16px;
    text-align: center;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.mini-stat::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--brand-primary);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.mini-stat:hover {
    border-color: var(--brand-primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.mini-stat:hover::before {
    opacity: 1;
}

.mini-stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(var(--brand-primary-rgb, 13,148,136), 0.1);
    color: var(--brand-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    margin: 0 auto 10px;
}

.mini-stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mini-stat-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

.mini-stat-number {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.mini-stat-badge {
    font-size: 0.6875rem;
    color: var(--success);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: block;
    margin-top: 2px;
}

/* --- Info Grid --- */
.detalle-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}

.detalle-info-card {
    background: var(--bg-surface-alt);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    transition: border-color 0.2s ease;
}

.detalle-info-card:hover {
    border-color: var(--brand-primary);
}

.detalle-info-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.detalle-info-label i {
    color: var(--brand-primary);
    font-size: 12px;
}

.detalle-info-value {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-primary);
    word-break: break-word;
}

.detalle-info-value.highlight {
    color: var(--brand-primary);
    font-weight: 600;
}

/* --- Loading Shimmer --- */
.loading-shimmer {
    background: linear-gradient(90deg, var(--bg-surface-alt) 25%, var(--bg-hover) 50%, var(--bg-surface-alt) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* --- Theme Selection Cards --- */
.theme-selector-dashboard .theme-selection-card {
    background: var(--bg-surface);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-xl);
    padding: 28px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.theme-selector-dashboard .theme-selection-card:hover {
    border-color: var(--brand-primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.theme-selector-dashboard .theme-selection-card.active {
    border-color: var(--brand-primary);
    background: rgba(var(--brand-primary-rgb, 13,148,136), 0.04);
}

.theme-selection-check {
    position: absolute;
    top: 12px;
    right: 12px;
    font-size: 20px;
    color: var(--brand-primary);
    opacity: 0;
    transition: opacity 0.2s;
}

.theme-selection-card.active .theme-selection-check {
    opacity: 1;
}

.theme-selection-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
}

.theme-selection-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.theme-selection-description {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.theme-selection-features {
    list-style: none;
    padding: 0;
    margin: 0 0 16px;
    text-align: left;
}

.theme-selection-features li {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    padding: 4px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.theme-selection-features li i {
    color: var(--brand-primary);
    font-size: 12px;
    width: 16px;
    text-align: center;
}

.theme-selection-btn {
    background: var(--brand-primary) !important;
    color: #fff !important;
    border: none !important;
    border-radius: var(--radius-md) !important;
    padding: 8px 20px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.theme-selection-btn:hover {
    background: var(--brand-primary-hover) !important;
    transform: translateY(-1px);
}

/* --- Card-info stat card enhancements --- */
.card-info .card-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 20px 16px;
}

.card-info .card-body > i {
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(var(--brand-primary-rgb, 13,148,136), 0.1);
    color: var(--brand-primary);
    font-size: 22px;
    margin-bottom: 12px;
}

.card-info .card-body .card-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 8px;
}

.card-info .card-body .counter {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
}

/* Semantic colors for each stat card */
#asesoresCard .card-body > i { background: rgba(99,102,241,0.1); color: var(--brand-secondary); }
#asesoresCard:hover { border-color: var(--brand-secondary) !important; }

#clientesCard .card-body > i { background: var(--success-bg); color: var(--success); }
#clientesCard:hover { border-color: var(--success) !important; }

#contactosCard .card-body > i { background: var(--info-bg); color: var(--info); }
#contactosCard:hover { border-color: var(--info) !important; }

#usuariosCard .card-body > i { background: var(--warning-bg); color: var(--warning); }
#usuariosCard:hover { border-color: var(--warning) !important; }

/* --- Action buttons in block-header (unstyled buttons fix) --- */
.block-header .action-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
    margin-top: 12px;
}

.block-header .action-buttons .btn {
    font-size: 0.8125rem;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

/* --- Logs table container --- */
.logs-table-container {
    max-height: 500px;
    overflow-y: auto;
}

/* --- Responsive detalle --- */
@media (max-width: 768px) {
    .detalle-header-content {
        flex-direction: column;
        text-align: center;
    }
    .detalle-header-info {
        text-align: center;
    }
    .detalle-subtitulo {
        justify-content: center;
    }
    .detalle-quick-stats {
        justify-content: center;
    }
    .detalle-mini-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    .detalle-grid {
        grid-template-columns: 1fr;
    }
    .detalle-avatar {
        width: 72px;
        height: 72px;
    }
    .detalle-nombre {
        font-size: 1.25rem;
    }
    .mini-stat {
        padding: 16px 12px;
    }
    .mini-stat-value {
        font-size: 1.5rem;
    }
}

@media (max-width: 576px) {
    .detalle-header {
        padding: 24px 16px 20px;
    }
    .detalle-body {
        padding: 20px 16px;
    }
    .detalle-mini-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
}

/* --- Dark mode detalle enhancements --- */
[data-theme="dark"] .detalle-header {
    background: linear-gradient(135deg, rgba(20,184,166,0.25), rgba(129,140,248,0.2));
}

[data-theme="dark"] .detalle-avatar {
    border-color: rgba(255,255,255,0.2);
}

[data-theme="dark"] .mini-stat {
    background: var(--bg-surface);
}

[data-theme="dark"] .mini-stat-icon {
    background: rgba(20,184,166,0.15);
}

[data-theme="dark"] .detalle-info-card {
    background: var(--bg-surface);
}

[data-theme="dark"] .theme-selection-card {
    background: var(--bg-surface);
}

[data-theme="dark"] .card-info .card-body > i {
    background: rgba(20,184,166,0.15);
}

[data-theme="dark"] #asesoresCard .card-body > i { background: rgba(129,140,248,0.15); }
[data-theme="dark"] #clientesCard .card-body > i { background: rgba(52,211,153,0.15); }
[data-theme="dark"] #contactosCard .card-body > i { background: rgba(96,165,250,0.15); }
[data-theme="dark"] #usuariosCard .card-body > i { background: rgba(251,191,36,0.15); }

/* ============================================
   PHASE 5: GESTOR CARDS, SEARCH BAR, EMPTY STATE,
   INLINE COLOR ABSORPTION
   ============================================ */

/* --- Gestor Info Header Box --- */
.gestor-info,
.header-box {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s ease;
}
.gestor-info:hover,
.header-box:hover {
    box-shadow: var(--shadow-md);
}
.gestor-info .gestor-avatar,
.header-box .gestor-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.5rem;
    flex-shrink: 0;
}
.gestor-info .gestor-details h5,
.header-box .gestor-details h5 {
    margin: 0 0 0.25rem;
    font-weight: 700;
    color: var(--text-primary);
}
.gestor-info .gestor-details p,
.header-box .gestor-details p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* --- Gestor Action Cards --- */
.gestorCard {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    text-align: center;
    transition: all 0.25s ease;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}
.gestorCard:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--brand-primary);
}
.gestorCard i {
    font-size: 2rem;
    color: var(--brand-primary);
    transition: transform 0.2s ease;
}
.gestorCard:hover i {
    transform: scale(1.1);
}
.gestorCard h5,
.gestorCard .card-title {
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    font-size: 0.95rem;
}
.gestorCard p,
.gestorCard .card-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin: 0;
}
.gestorCard .btn {
    margin-top: auto;
}

/* --- Search Bar for Tables --- */
.search-bar {
    position: relative;
    margin-bottom: 1rem;
}
.search-bar input {
    width: 100%;
    padding: 0.625rem 1rem 0.625rem 2.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.search-bar input:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(13,148,136,0.15);
}
.search-bar .search-icon {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.9rem;
    pointer-events: none;
}

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
}
.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.4;
    display: block;
}
.empty-state h5 {
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}
.empty-state p {
    font-size: 0.9rem;
    max-width: 400px;
    margin: 0 auto;
}

/* --- Inline Color Absorption --- */
/* Absorb #2a9ef5 (old blue headings/titles) */
[style*="color: #2a9ef5"],
[style*="color:#2a9ef5"] {
    color: var(--brand-primary) !important;
}

/* Absorb #3f3f3f (old table text) */
[style*="color:#3f3f3f"],
[style*="color: #3f3f3f"] {
    color: var(--text-primary) !important;
}

/* Absorb rgb(65,61,61) (old table text) */
[style*="color: rgb(65, 61, 61)"],
[style*="color:rgb(65,61,61)"] {
    color: var(--text-primary) !important;
}

/* --- Title card for table pages (see Phase 8 for full definition) --- */

/* --- Block header margin-top override for consistency --- */
.block-header[style*="margin-top: 60px"] {
    margin-top: 0 !important;
}

/* --- Dark mode additions for Phase 5 --- */
[data-theme="dark"] .gestor-info,
[data-theme="dark"] .header-box {
    background: var(--bg-surface);
    border-color: var(--border-color);
}

[data-theme="dark"] .gestorCard {
    background: var(--bg-surface);
    border-color: var(--border-color);
}
[data-theme="dark"] .gestorCard:hover {
    border-color: var(--brand-primary);
}

[data-theme="dark"] .search-bar input {
    background: var(--bg-surface);
    border-color: var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .empty-state {
    color: var(--text-muted);
}
[data-theme="dark"] .empty-state h5 {
    color: var(--text-secondary);
}

/* --- Cuentas Bancarias modal badge sync --- */
#cuentasBancariasModal .modal-title .badge,
#listaUsuariosModal .modal-title .badge {
    background: rgba(255,255,255,0.2);
    color: #fff;
    font-size: 0.8rem;
    vertical-align: middle;
}

/* --- Responsive gestor cards --- */
@media (max-width: 768px) {
    .gestor-info,
    .header-box {
        flex-direction: column;
        text-align: center;
    }
    .gestorCard {
        margin-bottom: 1rem;
    }
}

/* ============================================
   PHASE 6: TIMELINE ACTIVIDADES RECIENTES
   Premium activity feed component
   ============================================ */

/* --- Section container --- */
.detalle-section .detalle-section-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border-color);
}
.detalle-section .detalle-section-title i {
    color: var(--brand-primary);
    font-size: 1.2rem;
}
.detalle-section .detalle-section-title .badge {
    font-size: 0.7rem;
    vertical-align: middle;
}

/* --- Timeline filters --- */
.timeline-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.timeline-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.85rem;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: var(--bg-surface);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}
.timeline-filter-btn:hover {
    border-color: var(--brand-primary);
    color: var(--brand-primary);
    background: rgba(13,148,136,0.05);
}
.timeline-filter-btn.active {
    background: var(--brand-primary);
    color: #fff;
    border-color: var(--brand-primary);
    box-shadow: 0 2px 8px rgba(13,148,136,0.25);
}
.timeline-filter-btn.active i {
    color: #fff !important;
}

/* --- Timeline search bar override --- */
.detalle-section .input-group {
    max-width: 400px;
    margin-bottom: 1rem;
}
.detalle-section .input-group .input-group-text {
    background: var(--brand-primary);
    color: #fff;
    border: 1px solid var(--brand-primary);
    border-radius: 8px 0 0 8px;
}
.detalle-section .input-group .form-control {
    border-radius: 0 8px 8px 0;
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-primary);
}
.detalle-section .input-group .form-control:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(13,148,136,0.12);
}

/* --- Timeline container --- */
.detalle-timeline {
    position: relative;
    padding-left: 2rem;
}
.detalle-timeline::before {
    content: '';
    position: absolute;
    left: 15px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, var(--brand-primary), var(--border-color));
    border-radius: 2px;
}

/* --- Timeline item --- */
.timeline-item {
    position: relative;
    margin-bottom: 1.25rem;
    opacity: 0;
    animation: timelineFadeIn 0.4s ease forwards;
}
@keyframes timelineFadeIn {
    from { opacity: 0; transform: translateX(-12px); }
    to { opacity: 1; transform: translateX(0); }
}

/* --- Timeline content card --- */
.timeline-content {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    transition: all 0.25s ease;
    box-shadow: var(--shadow-sm);
}
.timeline-content:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--brand-primary);
    transform: translateX(4px);
}

/* --- Content wrapper layout --- */
.timeline-content-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

/* --- Icon wrapper (type dot) --- */
.timeline-icon-wrapper {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.timeline-icon-wrapper.primary {
    background: linear-gradient(135deg, var(--brand-primary), #0f766e);
}
.timeline-icon-wrapper.success {
    background: linear-gradient(135deg, #10b981, #059669);
}
.timeline-icon-wrapper.warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}
.timeline-icon-wrapper.danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}
.timeline-icon-wrapper.info {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

/* --- Timeline dot on the line --- */
.timeline-item::before {
    content: '';
    position: absolute;
    left: -25px;
    top: 18px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--brand-primary);
    border: 2px solid var(--bg-surface);
    box-shadow: 0 0 0 2px var(--brand-primary);
    z-index: 1;
}
.timeline-item.type-success::before { background: #10b981; box-shadow: 0 0 0 2px #10b981; }
.timeline-item.type-warning::before { background: #f59e0b; box-shadow: 0 0 0 2px #f59e0b; }
.timeline-item.type-danger::before { background: #ef4444; box-shadow: 0 0 0 2px #ef4444; }
.timeline-item.type-info::before { background: #3b82f6; box-shadow: 0 0 0 2px #3b82f6; }

/* --- Text area --- */
.timeline-text {
    flex: 1;
    min-width: 0;
}
.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.35rem;
}
.timeline-title {
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--text-primary);
    line-height: 1.4;
}
.timeline-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
    white-space: nowrap;
}
.timeline-date i {
    margin-right: 0.25rem;
}
.timeline-description {
    font-size: 0.83rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-top: 0.25rem;
}

/* --- Metadata badges --- */
.timeline-metadata {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.6rem;
}
.timeline-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.55rem;
    border-radius: 12px;
    font-size: 0.72rem;
    background: rgba(13,148,136,0.08);
    color: var(--brand-primary);
    border: 1px solid rgba(13,148,136,0.15);
    font-weight: 500;
}
.timeline-badge i {
    font-size: 0.65rem;
    opacity: 0.7;
}

/* --- Action buttons (hover reveal) --- */
.timeline-actions {
    display: none;
    margin-top: 0.65rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
}
.timeline-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.7rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    color: var(--text-secondary);
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.2s ease;
}
.timeline-action-btn:hover {
    border-color: var(--brand-primary);
    color: var(--brand-primary);
    background: rgba(13,148,136,0.05);
}

/* --- Quick action buttons in detalle --- */
.detalle-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 2px solid var(--border-color);
}
.btn-action-quick {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 1.1rem;
    border: 1px solid var(--brand-primary);
    border-radius: var(--radius-md);
    background: var(--brand-primary);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}
.btn-action-quick:hover {
    background: var(--brand-primary-hover);
    box-shadow: 0 4px 12px rgba(13,148,136,0.3);
    transform: translateY(-1px);
}
.btn-action-quick.success {
    background: #10b981;
    border-color: #10b981;
}
.btn-action-quick.success:hover {
    background: #059669;
    border-color: #059669;
    box-shadow: 0 4px 12px rgba(16,185,129,0.3);
}
.btn-action-quick.warning {
    background: #f59e0b;
    border-color: #f59e0b;
    color: #1e293b;
}
.btn-action-quick.warning:hover {
    background: #d97706;
    border-color: #d97706;
    box-shadow: 0 4px 12px rgba(245,158,11,0.3);
}
.btn-action-quick.secondary {
    background: transparent;
    border-color: var(--border-color);
    color: var(--text-secondary);
}
.btn-action-quick.secondary:hover {
    border-color: var(--brand-primary);
    color: var(--brand-primary);
    background: rgba(13,148,136,0.05);
}
.btn-action-quick.info {
    background: transparent;
    border-color: var(--info);
    color: var(--info);
}
.btn-action-quick.info:hover {
    background: var(--info);
    color: #fff;
    border-color: var(--info);
    box-shadow: 0 4px 12px rgba(52,152,219,0.3);
}

/* --- Load more button --- */
.timeline-load-more {
    text-align: center;
    margin-top: 1rem;
    padding-top: 1rem;
}
.timeline-load-more button {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1.25rem;
    border: 1px dashed var(--border-color);
    border-radius: 20px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}
.timeline-load-more button:hover {
    border-color: var(--brand-primary);
    color: var(--brand-primary);
    background: rgba(13,148,136,0.05);
}

/* --- Empty / Loading states --- */
.timeline-empty,
.timeline-loading {
    text-align: center;
    padding: 2.5rem 1.5rem;
    color: var(--text-muted);
}
.timeline-empty i,
.timeline-loading i {
    font-size: 3rem;
    color: var(--text-muted);
    opacity: 0.35;
    display: block;
    margin-bottom: 0.75rem;
}
.timeline-empty-title {
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
}
.timeline-empty-text {
    font-size: 0.85rem;
    color: var(--text-muted);
}
.timeline-loading p {
    color: var(--text-muted);
    margin-top: 0.75rem;
    font-size: 0.9rem;
}

/* --- Dark mode for timeline --- */
[data-theme="dark"] .timeline-content {
    background: var(--bg-surface);
    border-color: var(--border-color);
}
[data-theme="dark"] .timeline-content:hover {
    border-color: var(--brand-primary);
}
[data-theme="dark"] .timeline-filter-btn {
    background: var(--bg-surface);
    border-color: var(--border-color);
    color: var(--text-secondary);
}
[data-theme="dark"] .timeline-filter-btn:hover {
    border-color: var(--brand-primary);
    color: var(--brand-primary);
}
[data-theme="dark"] .timeline-filter-btn.active {
    background: var(--brand-primary);
    color: #fff;
}
[data-theme="dark"] .timeline-badge {
    background: rgba(13,148,136,0.12);
    border-color: rgba(13,148,136,0.2);
}
[data-theme="dark"] .timeline-action-btn {
    background: var(--bg-surface);
    border-color: var(--border-color);
}
[data-theme="dark"] .timeline-item::before {
    border-color: var(--bg-surface);
}
[data-theme="dark"] .btn-action-quick.secondary {
    border-color: var(--border-color);
    color: var(--text-secondary);
}
[data-theme="dark"] .btn-action-quick.secondary:hover {
    border-color: var(--brand-primary);
    color: var(--brand-primary);
}
[data-theme="dark"] .timeline-load-more button {
    border-color: var(--border-color);
    color: var(--text-secondary);
}

/* --- Responsive timeline --- */
@media (max-width: 768px) {
    .timeline-filters {
        gap: 0.35rem;
    }
    .timeline-filter-btn {
        padding: 0.3rem 0.6rem;
        font-size: 0.75rem;
    }
    .timeline-content-wrapper {
        flex-direction: column;
        gap: 0.65rem;
    }
    .timeline-icon-wrapper {
        width: 34px;
        height: 34px;
        min-width: 34px;
        font-size: 0.8rem;
    }
    .detalle-timeline {
        padding-left: 1.5rem;
    }
    .detalle-timeline::before {
        left: 10px;
    }
    .timeline-item::before {
        left: -20px;
        width: 8px;
        height: 8px;
    }
    .detalle-actions {
        flex-direction: column;
    }
    .btn-action-quick {
        justify-content: center;
    }
    .detalle-section .input-group {
        max-width: 100%;
    }
}

/* ============================================================
   Phase 8: Premium Detail & Afiliaciones Treatment
   ============================================================ */

/* --- Title card premium --- */
.title-card-p {
    padding: 0.75rem 1rem;
    border-bottom: 2px solid var(--brand-primary);
    background: linear-gradient(135deg, rgba(13,148,136,0.05), transparent);
}
/* Override Bootstrap col-md-12 padding when combined with title-card-p */
.col-md-12.title-card-p,
.col-sm-12.title-card-p {
    padding: 0.75rem 1rem;
    flex: 0 0 100%;
    max-width: 100%;
}
.title-card-p h4,
.title-card-p h3 {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
}
.title-card-p h4::before,
.title-card-p h3::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 1em;
    background: var(--brand-primary);
    border-radius: 2px;
    margin-right: 0.5rem;
    vertical-align: middle;
}

/* --- Inline color absorption: #888888 (table text) --- */
[style*="color: #888888"],
[style*="color:#888888"] {
    color: var(--text-secondary) !important;
}
[style*="text-transform: uppercase"] {
    text-transform: uppercase;
}

/* --- Activities modal premium --- */
#actividadesModal .modal-body {
    max-height: 70vh;
    overflow-y: auto;
}
#actividadesModal .timeline-filters {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg-primary);
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
}
#actividadesModal .detalle-timeline {
    min-height: 200px;
}

/* --- Table premium treatment (c_list tables outside scroll-container) --- */
.table.c_list thead th {
    background: var(--brand-primary);
    color: #fff;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 2px solid var(--brand-secondary);
    padding: 0.5rem;
    white-space: nowrap;
}
.table.c_list tbody td {
    color: var(--text-primary);
    font-size: 0.8125rem;
    vertical-align: middle;
    padding: 0.375rem 0.5rem;
    line-height: 1.4;
}
.table.c_list tbody tr:hover {
    background: rgba(13,148,136,0.04);
}

/* --- Card detalle premium for detail pages --- */
.card.detalle {
    border: none;
    border-radius: var(--radius-xl) !important;
    padding: 0 !important;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    overflow: hidden;
    transition: box-shadow 0.3s ease;
}
.card.detalle:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
}

/* --- Block header icon auto-tinting --- */
.block-header h2 i.fa,
.block-header h2 i.fas {
    color: var(--brand-primary);
    margin-right: 0.35rem;
}

/* --- Botones acciones (flex container for detail pages) --- */
.botones-acciones {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

/* --- Fancy checkbox in tables --- */
.fancy-checkbox span {
    border-color: var(--border-color);
}
.fancy-checkbox input:checked + span {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
}

/* --- Pagination container --- */
.pagination-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}
.pagination-container label {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin: 0;
}
.pagination-container select {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0.25rem 0.5rem;
    font-size: 0.85rem;
}

/* --- Dark mode additions (Phase 8) --- */
[data-theme="dark"] .title-card-p {
    background: linear-gradient(135deg, rgba(13,148,136,0.1), transparent);
}
[data-theme="dark"] .table.c_list thead th {
    background: rgba(13, 148, 136, 0.65);
    border-bottom-color: var(--brand-primary);
}
[data-theme="dark"] .table-custom tbody tr:hover,
[data-theme="dark"] .table.c_list tbody tr:hover {
    background: rgba(13,148,136,0.08);
}
[data-theme="dark"] .card.detalle {
    box-shadow: 0 2px 12px rgba(0,0,0,0.2);
}
[data-theme="dark"] .card.detalle:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
[data-theme="dark"] #actividadesModal .timeline-filters {
    background: var(--bg-primary);
    border-bottom-color: var(--border-color);
}
[data-theme="dark"] .btn-action-quick.info {
    border-color: var(--info);
    color: var(--info);
}
[data-theme="dark"] .btn-action-quick.info:hover {
    background: var(--info);
    color: #fff;
}
[data-theme="dark"] .pagination-container select {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    color: var(--text-primary);
}
[data-theme="dark"] .fancy-checkbox span {
    border-color: var(--border-color);
}

/* ============================================================
   Phase 9: Empresa Detail Cards & Premium Views Balance
   ============================================================ */

/* --- Empresa details card (cosmic variant) --- */
.empresa-details-card {
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg, 12px);
    box-shadow: 0 2px 16px rgba(0,0,0,0.08);
    overflow: hidden;
    margin-bottom: 0.5rem;
    border: 1px solid var(--border-color);
}
.empresa-details-card .empresa-header,
.cosmic-card .cosmic-header {
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary, #6366f1)) !important;
    padding: 1.25rem 1.5rem;
    color: #fff !important;
}
.empresa-header .empresa-nombre {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
    color: #fff;
}
.empresa-header .empresa-subtitulo {
    font-size: 0.85rem;
    opacity: 0.9;
    margin: 0.25rem 0 0;
    color: rgba(255,255,255,0.85);
}
.empresa-body {
    padding: 1.5rem;
}

/* --- Info cards (glass-card variant) --- */
.info-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--bg-primary);
    border-radius: var(--border-radius, 8px);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    height: 100%;
}
.info-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}
.info-card .info-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: #fff;
    flex-shrink: 0;
}
.info-card .info-content h6 {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin: 0;
}
.info-card .info-content p {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0.15rem 0 0;
    word-break: break-word;
}

/* --- Info icon gradient variants --- */
.cosmic-gradient-purple, .bg-cosmic-purple { background: linear-gradient(135deg, #7c3aed, #a78bfa) !important; }
.cosmic-gradient-blue, .bg-cosmic-blue { background: linear-gradient(135deg, #2563eb, #60a5fa) !important; }
.cosmic-gradient-green, .bg-cosmic-green { background: linear-gradient(135deg, #059669, #34d399) !important; }
.cosmic-gradient-orange, .bg-cosmic-orange { background: linear-gradient(135deg, #ea580c, #fb923c) !important; }
.bg-cosmic-gold { background: linear-gradient(135deg, #d97706, #fbbf24) !important; }
.bg-cosmic-cyan { background: linear-gradient(135deg, #0891b2, #22d3ee) !important; }

/* Icons inside gradient/colored containers MUST be white + visible */
.cosmic-gradient-purple i, .cosmic-gradient-blue i, .cosmic-gradient-green i,
.cosmic-gradient-orange i, .bg-cosmic-purple i, .bg-cosmic-blue i,
.bg-cosmic-green i, .bg-cosmic-orange i, .bg-cosmic-gold i, .bg-cosmic-cyan i,
.info-icon i, .stat-icon i, .admin-icon i,
.bg-warning i {
    color: #fff !important;
    position: relative;
    z-index: 1;
}

/* --- Stat card (glass variant) --- */
.stat-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    background: var(--bg-primary);
    border-radius: var(--border-radius, 8px);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    height: 100%;
}
.stat-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}
.stat-card .stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: #fff;
    flex-shrink: 0;
    position: relative;
}
.stat-card .stat-content h4 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}
.stat-card .stat-content p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin: 0.1rem 0 0;
}
.stat-card .stat-content small {
    font-size: 0.7rem;
    color: var(--text-secondary);
}
.stat-card .stat-background {
    position: absolute;
    right: -10px;
    bottom: -10px;
    font-size: 4rem;
    opacity: 0.05;
    color: var(--text-primary);
}
.glass-card-stat {
    backdrop-filter: blur(4px);
}
.hover-scale:hover { transform: scale(1.02); }
.hover-lift:hover { transform: translateY(-3px); }

/* --- Cosmic card overrides (remove old cosmic effects) --- */
.cosmic-card {
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg, 12px);
    box-shadow: 0 2px 16px rgba(0,0,0,0.08);
    border: 1px solid var(--border-color);
    overflow: hidden;
}
.cosmic-header {
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary, #6366f1));
    padding: 1.25rem 1.5rem;
}
.cosmic-title { color: #fff; font-weight: 700; }
.cosmic-subtitle { color: rgba(255,255,255,0.85); }
.cosmic-icon { color: rgba(255,255,255,0.9); }
.cosmic-number { color: var(--text-primary); }
.cosmic-glow { display: none; }
.cosmic-border { display: none; }
.pulse-icon { animation: none; }

/* --- Cosmic buttons --- */
.btn-cosmic { background: var(--brand-primary); color: #fff; border: none; border-radius: var(--border-radius); }
.btn-cosmic:hover { background: var(--brand-primary-hover, #0f766e); color: #fff; }
.btn-cosmic-success { background: var(--success); color: #fff; border: none; border-radius: var(--border-radius); }
.btn-cosmic-success:hover { filter: brightness(1.1); color: #fff; }
.btn-cosmic-info { background: var(--info); color: #fff; border: none; border-radius: var(--border-radius); }
.btn-cosmic-info:hover { filter: brightness(1.1); color: #fff; }

/* --- Quick stat cards (usuOutsClientesErp) --- */
.quick-stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.quick-stat-card {
    background: var(--bg-primary);
    border-radius: var(--border-radius, 8px);
    padding: 1rem;
    text-align: center;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}
.quick-stat-card:hover { transform: translateY(-3px); box-shadow: 0 4px 16px rgba(0,0,0,0.1); }
.quick-stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
}
.quick-stat-card.cyan::before { background: var(--info); }
.quick-stat-card.green::before { background: var(--success); }
.quick-stat-card.orange::before { background: var(--warning); }
.quick-stat-card.purple::before { background: #7c3aed; }
.quick-stat-card.gold::before { background: #d97706; }
.quick-stat-card.red::before { background: var(--danger); }
.quick-stat-icon { font-size: 1.5rem; margin-bottom: 0.5rem; color: var(--brand-primary); }
.quick-stat-value { font-size: 1.75rem; font-weight: 800; color: var(--text-primary); }
.quick-stat-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-secondary); margin-top: 0.25rem; }
.quick-stat-trend { font-size: 0.7rem; padding: 0.15rem 0.5rem; border-radius: 12px; background: rgba(13,148,136,0.1); color: var(--brand-primary); display: inline-block; margin-top: 0.25rem; }

/* --- Empresa card premium (usuOutsClientesErp) --- */
.empresa-detail-container { margin-bottom: 1.5rem; }
.empresa-card-premium {
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg, 12px);
    box-shadow: 0 2px 16px rgba(0,0,0,0.08);
    border: 1px solid var(--border-color);
    overflow: hidden;
}
.empresa-header-premium {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary, #6366f1));
    color: #fff;
}
.empresa-logo-container {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: rgba(255,255,255,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}
.empresa-name-premium { font-size: 1.25rem; font-weight: 700; margin: 0; color: #fff; }
.empresa-nit-badge {
    background: rgba(255,255,255,0.15);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}
.empresa-status-badge {
    background: rgba(16,185,129,0.2);
    color: #34d399;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}
.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #34d399;
    display: inline-block;
}
.empresa-body-premium { padding: 1.5rem; }
.empresa-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}
.empresa-info-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: var(--border-radius, 8px);
    background: var(--bg-secondary);
    transition: background 0.2s ease;
}
.empresa-info-item:hover { background: rgba(13,148,136,0.05); }
.empresa-info-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(13,148,136,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--brand-primary);
    flex-shrink: 0;
}
.empresa-info-label { font-size: 0.7rem; text-transform: uppercase; color: var(--text-secondary); }
.empresa-info-value { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); }
.empresa-actions-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}
.empresa-action-btn {
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius, 8px);
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.empresa-action-btn:hover { border-color: var(--brand-primary); color: var(--brand-primary); }
.empresa-action-btn.primary { background: var(--brand-primary); color: #fff; border-color: var(--brand-primary); }
.empresa-action-btn.primary:hover { filter: brightness(1.1); }

/* --- Quick actions bar --- */
.quick-actions-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    padding: 1rem;
    background: var(--bg-primary);
    border-radius: var(--border-radius, 8px);
    border: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}
.quick-actions-bar .search-box {
    flex: 1;
    min-width: 200px;
    position: relative;
}
.quick-actions-bar .search-box i {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}
.quick-actions-bar .search-box input {
    width: 100%;
    padding: 0.5rem 0.75rem 0.5rem 2.25rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius, 8px);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.85rem;
}
.quick-action-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius, 8px);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}
.quick-action-btn:hover { border-color: var(--brand-primary); color: var(--brand-primary); }
.quick-action-btn.export { border-color: var(--success); color: var(--success); }
.quick-action-btn.export:hover { background: var(--success); color: #fff; }

/* --- Nav cards grid --- */
.cards-section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 1.5rem 0 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.cards-section-title i { color: var(--brand-primary); }
.section-badge {
    font-size: 0.65rem;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    background: rgba(13,148,136,0.1);
    color: var(--brand-primary);
    font-weight: 600;
    text-transform: uppercase;
}
.cards-navigation-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.nav-card {
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg, 12px);
    border: 1px solid var(--border-color);
    padding: 1.25rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    cursor: pointer;
}
.nav-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
}
.nav-card.green::before { background: var(--success); }
.nav-card.cyan::before { background: var(--info); }
.nav-card.orange::before { background: var(--warning); }
.nav-card.purple::before { background: #7c3aed; }
.nav-card.gold::before { background: #d97706; }
.nav-card.red::before { background: var(--danger); }
.nav-card.featured { grid-column: 1 / -1; }
.nav-card.featured::before { background: linear-gradient(90deg, var(--brand-primary), var(--brand-secondary, #6366f1)); height: 4px; }
.nav-card:hover { transform: translateY(-3px); box-shadow: 0 4px 20px rgba(0,0,0,0.1); }
.nav-card-badge {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: var(--brand-primary);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    min-width: 24px;
    text-align: center;
}
.nav-card-icon { font-size: 1.5rem; color: var(--brand-primary); margin-bottom: 0.5rem; }
.nav-card-title { font-size: 0.95rem; font-weight: 600; color: var(--text-primary); margin: 0 0 0.35rem; }
.nav-card-description { font-size: 0.8rem; color: var(--text-secondary); margin: 0; line-height: 1.4; }
.nav-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}
.nav-card-action { font-size: 0.8rem; color: var(--brand-primary); font-weight: 500; }
.nav-card-status { font-size: 0.7rem; color: var(--text-secondary); display: flex; align-items: center; gap: 0.3rem; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--success); }

/* --- Featured card content (nav-card.featured) --- */
.nav-card.featured .nav-card-content { display: flex; align-items: center; gap: 1.25rem; }
.featured-info { flex: 1; }
.featured-stats { display: flex; gap: 1.5rem; margin-top: 0.75rem; }
.featured-stat-value { font-size: 1.25rem; font-weight: 700; color: var(--text-primary); }
.featured-stat-label { font-size: 0.7rem; color: var(--text-secondary); text-transform: uppercase; }
.featured-action-btn {
    padding: 0.6rem 1.25rem;
    background: var(--brand-primary);
    color: #fff;
    border: none;
    border-radius: var(--border-radius, 8px);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}
.featured-action-btn:hover { filter: brightness(1.1); }

/* --- Admin badge (EPS/ARL/AFP) --- */
.admin-badge {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--bg-primary);
    border-radius: var(--border-radius, 8px);
    border: 1px solid var(--border-color);
}
.admin-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
}
.admin-label { font-size: 0.7rem; text-transform: uppercase; color: var(--text-secondary); display: block; }
.admin-value { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); display: block; }
.section-title { font-size: 1rem; font-weight: 600; color: var(--text-primary); }

/* --- Btn gradient variants (usuNuevosClientesErpAdmin) --- */
.btn-gradient { border: none; color: #fff; font-weight: 500; border-radius: var(--border-radius, 8px); transition: all 0.2s ease; }
.btn-warning-gradient { background: linear-gradient(135deg, var(--warning), #f59e0b); }
.btn-primary-gradient { background: linear-gradient(135deg, var(--brand-primary), #0f766e); }
.btn-danger-gradient { background: linear-gradient(135deg, var(--danger), #ef4444); }
.btn-gradient:hover { filter: brightness(1.1); transform: translateY(-1px); color: #fff; }
.btn-group-flex { display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* --- Dark mode additions (Phase 9) --- */
[data-theme="dark"] .empresa-details-card,
[data-theme="dark"] .cosmic-card {
    background: var(--bg-primary);
    border-color: var(--border-color);
    box-shadow: 0 2px 16px rgba(0,0,0,0.2);
}
[data-theme="dark"] .info-card {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}
[data-theme="dark"] .stat-card {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}
[data-theme="dark"] .quick-stat-card {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}
[data-theme="dark"] .empresa-card-premium {
    background: var(--bg-primary);
    border-color: var(--border-color);
}
[data-theme="dark"] .empresa-info-item {
    background: var(--bg-primary);
}
[data-theme="dark"] .empresa-actions-bar {
    background: var(--bg-primary);
    border-color: var(--border-color);
}
[data-theme="dark"] .empresa-action-btn {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    color: var(--text-primary);
}
[data-theme="dark"] .quick-actions-bar {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}
[data-theme="dark"] .quick-actions-bar .search-box input {
    background: var(--bg-primary);
    border-color: var(--border-color);
    color: var(--text-primary);
}
[data-theme="dark"] .quick-action-btn {
    background: var(--bg-primary);
    border-color: var(--border-color);
    color: var(--text-primary);
}
[data-theme="dark"] .nav-card {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}
[data-theme="dark"] .admin-badge {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}
/* Dark mode: empresa detail page - ensure all content is readable */
[data-theme="dark"] .empresa-body {
    background: var(--bg-primary);
    color: var(--text-primary);
}
[data-theme="dark"] .empresa-body .info-label {
    color: var(--text-secondary);
}
[data-theme="dark"] .empresa-body .info-value {
    color: var(--text-primary);
}
[data-theme="dark"] .empresa-body .stat-content h4,
[data-theme="dark"] .empresa-body .stat-content p,
[data-theme="dark"] .empresa-body .stat-content small {
    color: var(--text-primary);
}
[data-theme="dark"] .empresa-body .section-title {
    color: var(--text-primary);
}
[data-theme="dark"] .empresa-body .admin-info .admin-label {
    color: var(--text-secondary);
}
[data-theme="dark"] .empresa-body .admin-info .admin-value {
    color: var(--text-primary);
}
/* Dark mode: table card text must be readable */
[data-theme="dark"] .title-card-p h4,
[data-theme="dark"] .title-card-p h3 {
    color: var(--text-primary);
}
[data-theme="dark"] .card-body label,
[data-theme="dark"] .card-body .form-label {
    color: var(--text-primary);
}
[data-theme="dark"] .card-body .form-text {
    color: var(--text-secondary) !important;
}
[data-theme="dark"] .card-header.bg-primary {
    color: #fff;
}
/* Dark mode: override main.css .card .body { color: #666d77 } - critical for readability */
[data-theme="dark"] .card .body {
    color: var(--text-primary) !important;
    background: var(--bg-primary) !important;
}
[data-theme="dark"] .card .body p,
[data-theme="dark"] .card .body span,
[data-theme="dark"] .card .body td,
[data-theme="dark"] .card .body th,
[data-theme="dark"] .card .body li,
[data-theme="dark"] .card .body div,
[data-theme="dark"] .card .body a:not(.btn) {
    color: var(--text-primary);
}
[data-theme="dark"] .card .body small,
[data-theme="dark"] .card .body .text-muted {
    color: var(--text-secondary) !important;
}

/* --- Responsive (Phase 9) --- */
@media (max-width: 768px) {
    .quick-stats-container { grid-template-columns: repeat(2, 1fr); }
    .empresa-header-premium { flex-direction: column; text-align: center; }
    .empresa-info-grid { grid-template-columns: 1fr; }
    .cards-navigation-grid { grid-template-columns: 1fr; }
    .nav-card.featured .nav-card-content { flex-direction: column; text-align: center; }
    .featured-stats { justify-content: center; }
    .empresa-actions-bar { justify-content: center; }
    .quick-actions-bar { flex-direction: column; }
}
@media (max-width: 576px) {
    .quick-stats-container { grid-template-columns: 1fr 1fr; gap: 0.5rem; }
    .quick-stat-card { padding: 0.75rem; }
    .quick-stat-value { font-size: 1.25rem; }
    .botones-acciones { flex-direction: column; }
    .botones-acciones .btn { width: 100%; justify-content: center; }
}

/* =====================================================================
   PHASE 10: RECIBOS DE RECAUDO - PREMIUM MODULE
   ===================================================================== */

/* --- Recibos Container --- */
.recibos-container {
    padding: 0 0.5rem;
}

/* --- Stats Card (Recibos Header) --- */
.recibos-container .stats-card {
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-secondary) 100%);
    border-radius: 16px;
    padding: 1.75rem 2rem;
    color: #fff;
    margin-bottom: 1.5rem;
    box-shadow: 0 8px 32px rgba(13, 148, 136, 0.25);
    position: relative;
    overflow: hidden;
}
.recibos-container .stats-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 300px;
    height: 300px;
    background: rgba(255,255,255,0.06);
    border-radius: 50%;
    pointer-events: none;
}
.recibos-container .stats-card::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -10%;
    width: 200px;
    height: 200px;
    background: rgba(255,255,255,0.04);
    border-radius: 50%;
    pointer-events: none;
}
.recibos-container .stats-card h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    color: #fff;
    letter-spacing: -0.01em;
}
.recibos-container .stats-card p {
    margin-bottom: 0;
    opacity: 0.9;
    font-size: 0.95rem;
}
.stats-item {
    text-align: center;
    padding: 0.5rem;
    position: relative;
}
.stats-item::after {
    content: '';
    position: absolute;
    right: 0;
    top: 15%;
    height: 70%;
    width: 1px;
    background: rgba(255,255,255,0.2);
}
.stats-item:last-child::after {
    display: none;
}
.stats-item h4 {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 0.15rem;
    color: #fff;
    letter-spacing: -0.02em;
}
.stats-item span {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.85;
    font-weight: 500;
}

/* --- Search Container Modern --- */
.search-container-modern {
    background: var(--card-bg);
    border-radius: 14px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: box-shadow 0.3s ease;
}
.search-container-modern:focus-within {
    box-shadow: 0 4px 20px rgba(13, 148, 136, 0.15);
    border-color: var(--brand-primary);
}
.search-input-modern {
    width: 100%;
    padding: 0.75rem 1.25rem;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 0.95rem;
    background: var(--body-bg);
    color: var(--text-primary);
    transition: all 0.3s ease;
    outline: none;
}
.search-input-modern:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.12);
}
.search-input-modern::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}
.search-container-modern .form-control {
    border-radius: 12px !important;
    height: 48px !important;
    border: 2px solid var(--border-color);
    background: var(--body-bg);
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: border-color 0.3s ease;
}
.search-container-modern .form-control:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.12);
}
.btn-search-modern {
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-secondary) 100%);
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    height: 48px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.2);
}
.btn-search-modern:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(13, 148, 136, 0.35);
    color: #fff;
}

/* --- Recibo Card --- */
.recibo-card {
    background: var(--card-bg);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    margin-bottom: 1.25rem;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: fadeInUp 0.5s ease forwards;
    opacity: 0;
}
.recibo-card:hover {
    box-shadow: 0 8px 30px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}
.recibo-card.anulado {
    opacity: 1;
    border-left: 4px solid var(--danger);
    background: var(--card-bg);
}
.recibo-card.anulado .recibo-header {
    background: linear-gradient(135deg, rgba(220,53,69,0.08) 0%, rgba(220,53,69,0.03) 100%);
}

/* --- Recibo Header --- */
.recibo-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.15rem 1.5rem;
    background: linear-gradient(135deg, rgba(13,148,136,0.06) 0%, rgba(13,148,136,0.02) 100%);
    border-bottom: 1px solid var(--border-color);
}
.recibo-numero {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}
.recibo-numero i {
    color: var(--brand-primary);
}
.recibo-fecha {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-top: 0.2rem;
}
.recibo-estado {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 1rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.recibo-estado.activo {
    background: rgba(16, 185, 129, 0.12);
    color: #059669;
}
.recibo-estado.anulado {
    background: rgba(220, 53, 69, 0.12);
    color: #dc3545;
}

/* --- Recibo Body --- */
.recibo-body {
    padding: 1.25rem 1.5rem;
}
.recibo-section {
    margin-bottom: 1.15rem;
    padding-bottom: 1rem;
    border-bottom: 1px dashed var(--border-color);
}
.recibo-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}
.recibo-section-title {
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--brand-primary);
    margin-bottom: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.recibo-section-title i {
    font-size: 0.9rem;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(13, 148, 136, 0.1);
    border-radius: 8px;
    color: var(--brand-primary);
}

/* --- Info Grid (inside recibo cards) --- */
.recibo-section .info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
}
.recibo-section .info-item {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.recibo-section .info-item label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 0;
}
.recibo-section .info-item span {
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* --- Valores Grid --- */
.valores-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}
.valor-item {
    text-align: center;
    padding: 0.85rem 0.5rem;
    border-radius: 12px;
    background: var(--body-bg);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}
.valor-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}
.valor-item label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
}
.valor-item span {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}
.valor-item.aportes {
    border-top: 3px solid var(--info);
}
.valor-item.servicio {
    border-top: 3px solid var(--warning);
}
.valor-item.total {
    border-top: 3px solid var(--brand-primary);
    background: rgba(13, 148, 136, 0.04);
}
.valor-item.total span {
    color: var(--brand-primary);
    font-size: 1.2rem;
}

/* --- Metodo de Pago Badge --- */
.metodo-pago-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.85rem;
    border-radius: 50px;
    font-size: 0.82rem;
    font-weight: 600;
}
.metodo-pago-badge.efectivo {
    background: rgba(16, 185, 129, 0.12);
    color: #059669;
}
.metodo-pago-badge.transferencia {
    background: rgba(59, 130, 246, 0.12);
    color: #2563eb;
}
.metodo-pago-badge.consignacion {
    background: rgba(139, 92, 246, 0.12);
    color: #7c3aed;
}

/* --- Cuenta Bancaria Info --- */
.cuenta-bancaria-info {
    margin-top: 0.75rem;
    padding: 0.85rem 1rem;
    background: var(--body-bg);
    border-radius: 10px;
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--info);
}
.banco-nombre {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-primary);
    margin-bottom: 0.3rem;
}
.banco-nombre i {
    color: var(--info);
}
.cuenta-detalle {
    font-size: 0.85rem;
    color: var(--text-secondary);
}
.cuenta-detalle small {
    color: var(--text-secondary);
    opacity: 0.8;
}

/* --- Recibo Footer --- */
.recibo-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.85rem 1.5rem;
    background: var(--body-bg);
    border-top: 1px solid var(--border-color);
}
.recibo-footer small {
    color: var(--text-secondary);
}
.recibo-acciones {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.btn-recibo {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.85rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.25s ease;
    text-decoration: none;
}
.btn-recibo:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}
.btn-recibo.btn-ver {
    background: rgba(13, 148, 136, 0.1);
    color: var(--brand-primary);
}
.btn-recibo.btn-ver:hover {
    background: var(--brand-primary);
    color: #fff;
}
.btn-recibo.btn-pdf {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}
.btn-recibo.btn-pdf:hover {
    background: #dc3545;
    color: #fff;
}
.btn-recibo.btn-anular {
    background: rgba(245, 158, 11, 0.1);
    color: #d97706;
}
.btn-recibo.btn-anular:hover {
    background: #d97706;
    color: #fff;
}

/* --- Modal Vista Previa --- */
.modal-vista-previa .modal-content {
    border-radius: 16px;
    overflow: hidden;
    border: none;
    box-shadow: 0 25px 60px rgba(0,0,0,0.2);
}
.modal-vista-previa .modal-header {
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-secondary) 100%);
    color: #fff;
    border-bottom: none;
    padding: 1rem 1.5rem;
}
.modal-vista-previa .modal-title {
    font-weight: 700;
    color: #fff;
}
.modal-vista-previa .modal-body {
    padding: 0;
}
.modal-vista-previa .modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 0.85rem 1.5rem;
    background: var(--body-bg);
}
.vista-previa-container {
    max-height: 70vh;
    overflow-y: auto;
}

/* --- Preview Elements --- */
.preview-header {
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-secondary) 100%);
    color: #fff;
    padding: 2rem;
    text-align: center;
}
.preview-header h3 {
    font-weight: 800;
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    color: #fff;
    letter-spacing: 0.02em;
}
.preview-header .preview-recibo-numero {
    font-size: 1.5rem;
    font-weight: 700;
}
.preview-header .preview-recibo-fecha {
    opacity: 0.9;
}
.preview-body {
    padding: 1.5rem 2rem;
}
.preview-section {
    padding-bottom: 1.15rem;
    margin-bottom: 1.15rem;
    border-bottom: 1px dashed var(--border-color);
}
.preview-section:last-child {
    border-bottom: none;
}
.preview-section h6 {
    color: var(--brand-primary);
    margin-bottom: 1rem;
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.preview-section h6 i {
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(13, 148, 136, 0.1);
    border-radius: 6px;
    font-size: 0.8rem;
}
.preview-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.55rem 0;
    border-bottom: 1px dotted rgba(0,0,0,0.06);
}
.preview-row:last-child {
    border-bottom: none;
}
.preview-row label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.preview-row span {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.92rem;
    text-align: right;
}
.preview-total {
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-secondary) 100%);
    color: #fff;
    padding: 1.25rem 2rem;
    text-align: center;
    margin: 0 -2rem;
    border-radius: 0;
}
.preview-total div {
    font-size: 0.82rem;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
}
.preview-total h4 {
    font-size: 2rem;
    font-weight: 800;
    margin: 0.25rem 0 0;
    color: #fff;
    letter-spacing: -0.02em;
}

/* --- Empty State (Recibos specific) --- */
.recibos-container .empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--card-bg);
    border-radius: 16px;
    border: 2px dashed var(--border-color);
}
.recibos-container .empty-state i {
    font-size: 3.5rem;
    color: var(--brand-primary);
    opacity: 0.4;
    margin-bottom: 1rem;
    display: block;
}
.recibos-container .empty-state h4 {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}
.recibos-container .empty-state p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* --- Dark Mode: Recibos --- */
[data-theme="dark"] .recibos-container .stats-card {
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}
[data-theme="dark"] .search-input-modern {
    background: var(--body-bg);
    color: var(--text-primary);
}
[data-theme="dark"] .recibo-card {
    border-color: var(--border-color);
}
[data-theme="dark"] .recibo-card:hover {
    box-shadow: 0 8px 30px rgba(0,0,0,0.25);
}
[data-theme="dark"] .recibo-estado.activo {
    background: rgba(16, 185, 129, 0.18);
    color: #34d399;
}
[data-theme="dark"] .recibo-estado.anulado {
    background: rgba(220, 53, 69, 0.18);
    color: #f87171;
}
[data-theme="dark"] .valor-item {
    background: rgba(255,255,255,0.03);
    border-color: var(--border-color);
}
[data-theme="dark"] .cuenta-bancaria-info {
    background: rgba(255,255,255,0.03);
    border-color: var(--border-color);
}
[data-theme="dark"] .recibo-footer {
    background: rgba(255,255,255,0.02);
}
[data-theme="dark"] .metodo-pago-badge.efectivo {
    background: rgba(16, 185, 129, 0.18);
    color: #34d399;
}
[data-theme="dark"] .metodo-pago-badge.transferencia {
    background: rgba(59, 130, 246, 0.18);
    color: #60a5fa;
}
[data-theme="dark"] .metodo-pago-badge.consignacion {
    background: rgba(139, 92, 246, 0.18);
    color: #a78bfa;
}
[data-theme="dark"] .btn-recibo.btn-ver { background: rgba(13, 148, 136, 0.15); }
[data-theme="dark"] .btn-recibo.btn-pdf { background: rgba(220, 53, 69, 0.15); }
[data-theme="dark"] .btn-recibo.btn-anular { background: rgba(245, 158, 11, 0.15); }
[data-theme="dark"] .preview-row { border-bottom-color: rgba(255,255,255,0.06); }
[data-theme="dark"] .preview-section { border-bottom-color: var(--border-color); }
[data-theme="dark"] .modal-vista-previa .modal-content {
    background: var(--card-bg);
    box-shadow: 0 25px 60px rgba(0,0,0,0.4);
}
[data-theme="dark"] .recibos-container .empty-state {
    background: var(--card-bg);
    border-color: var(--border-color);
}

/* --- Responsive: Recibos --- */
@media (max-width: 768px) {
    .recibos-container .stats-card { padding: 1.25rem; }
    .stats-item h4 { font-size: 1.3rem; }
    .recibo-header { flex-direction: column; align-items: flex-start; gap: 0.5rem; padding: 1rem; }
    .recibo-body { padding: 1rem; }
    .valores-grid { grid-template-columns: 1fr; }
    .recibo-footer { flex-direction: column; gap: 0.75rem; text-align: center; padding: 0.85rem 1rem; }
    .recibo-acciones { justify-content: center; }
    .preview-body { padding: 1rem; }
    .preview-total { margin: 0 -1rem; padding: 1rem; }
    .preview-total h4 { font-size: 1.5rem; }
    .search-container-modern .row > div { margin-bottom: 0.5rem; }
}
@media (max-width: 576px) {
    .recibo-section .info-grid { grid-template-columns: 1fr; }
    .stats-item h4 { font-size: 1.1rem; }
    .recibos-container .stats-card .row > .col-md-4 { margin-bottom: 1rem; }
}

/* =====================================================================
   PHASE 11: TABLE SCROLL CONTAINER - VIEWPORT-BASED
   ===================================================================== */

/* Replaces inline max-height:500px with viewport-adaptive height */
.table-scroll-container {
    max-height: calc(100vh - 100px);
    min-height: 400px;
    overflow-y: auto;
    overflow-x: auto;
    border-radius: 0 0 8px 8px;
    scrollbar-width: thin;
    scrollbar-color: var(--brand-primary) transparent;
}
.table-scroll-container::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
.table-scroll-container::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 3px;
}
.table-scroll-container::-webkit-scrollbar-thumb {
    background: var(--brand-primary);
    border-radius: 3px;
    opacity: 0.6;
}
.table-scroll-container::-webkit-scrollbar-thumb:hover {
    background: var(--brand-secondary);
}

/* Sticky thead inside scroll container - highest specificity for tables */
.table-scroll-container .table thead {
    position: sticky;
    top: 0;
    z-index: 2;
}
.table-scroll-container .table thead th,
.table-scroll-container .table-custom thead th,
.table-scroll-container .table.c_list thead th {
    background: var(--brand-primary) !important;
    color: #fff !important;
    border-bottom: 2px solid var(--brand-secondary) !important;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0.5rem !important;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 2;
}

/* Table body refinements */
.table-scroll-container .table tbody tr {
    transition: background-color 0.15s ease;
}
.table-scroll-container .table tbody tr:hover {
    background-color: rgba(13, 148, 136, 0.06);
}
.table-scroll-container .table tbody td,
.table-scroll-container .table-custom tbody td,
.table-scroll-container .table.c_list tbody td {
    font-size: 0.8125rem;
    padding: 0.375rem 0.5rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    line-height: 1.4;
}
.table-scroll-container .table tbody tr:nth-child(even) {
    background-color: rgba(13, 148, 136, 0.02);
}

/* Dark mode */
[data-theme="dark"] .table-scroll-container {
    scrollbar-color: var(--brand-primary) rgba(255,255,255,0.05);
}
[data-theme="dark"] .table-scroll-container .table thead th {
    border-bottom-color: rgba(255,255,255,0.1);
}
[data-theme="dark"] .table-scroll-container .table tbody tr:hover {
    background-color: rgba(13, 148, 136, 0.08);
}
[data-theme="dark"] .table-scroll-container .table tbody td {
    border-bottom-color: var(--border-color);
}

/* Responsive: shorter viewport = more space for table */
@media (max-width: 768px) {
    .table-scroll-container {
        max-height: calc(100vh - 100px);
        min-height: 350px;
    }
}

/* =====================================================================
   PHASE 11B: TABLE & CARD BEAUTY IMPROVEMENTS
   ===================================================================== */

/* Card with table - seamless header-to-table flow */
.card > .body.p-0 {
    padding: 0 !important;
}
.card > .body.p-0 .table-scroll-container {
    border-radius: 0;
}
.card > .body.p-0 #paginacion {
    padding: 0.75rem 1rem;
}

/* title-card-p to table body transition */
.title-card-p + .body {
    padding-top: 0;
}
.title-card-p + .body.p-0 {
    padding: 0 !important;
}

/* Search/filter card premium (card-header bg-primary override) */
.card-header.bg-primary {
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-secondary) 100%) !important;
    border: none;
    padding: 0.85rem 1.25rem;
}
.card-header.bg-primary h5 {
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

/* Filter button group refinement */
.btn-group .filtro-rapido {
    font-size: 0.8rem;
    padding: 0.35rem 0.75rem;
    border-radius: 50px !important;
    margin-right: 0.25rem;
    font-weight: 500;
    transition: all 0.25s ease;
}
.btn-group .filtro-rapido:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0,0,0,0.1);
}
.btn-group .filtro-rapido.active,
.btn-group .filtro-rapido:focus {
    box-shadow: 0 3px 12px rgba(13, 148, 136, 0.2);
}

/* Pagination container refinement */
#paginacion,
#paginacionContainer,
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem 0;
    gap: 0.25rem;
}
#paginacion .btn,
#paginacionContainer .btn {
    min-width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0;
    transition: all 0.2s ease;
}

/* =====================================================================
   UNIFIED USUARIOS CARD - PREMIUM EDITION
   Search + Filters + Table fused in one elegant card
   ===================================================================== */

/* Card wrapper - no hover lift, solid presence */
.usuarios-unified-card {
    border-radius: 14px !important;
    overflow: hidden;
    border: 1px solid var(--border-color) !important;
    box-shadow: 0 4px 24px rgba(13, 148, 136, 0.08), 0 1px 3px rgba(0,0,0,0.06) !important;
    transition: box-shadow 0.3s ease !important;
}
.usuarios-unified-card:hover {
    transform: none !important;
    box-shadow: 0 8px 32px rgba(13, 148, 136, 0.12), 0 2px 6px rgba(0,0,0,0.08) !important;
}

/* Header - gradient with glass accent */
.usuarios-unified-card > .card-header {
    background: linear-gradient(135deg, var(--brand-primary), #0f766e) !important;
    padding: 0.875rem 1.25rem;
    border-bottom: none;
    position: relative;
}
.usuarios-unified-card > .card-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
}
.usuarios-unified-card > .card-header h5 {
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #fff !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.15);
}
.usuarios-unified-card > .card-header h5 i {
    color: #fff !important;
    margin-right: 0.5rem;
    opacity: 0.9;
}

/* Filtros area - subtle frost glass effect */
.usuarios-filtros-area {
    padding: 0.875rem 1.25rem !important;
    background: linear-gradient(180deg, var(--bg-surface-alt, #f8fafc), var(--bg-surface, #fff));
    border-bottom: 1px solid var(--border-color);
    position: relative;
}
.usuarios-filtros-area::before {
    content: '';
    position: absolute;
    top: 0;
    left: 1.25rem;
    right: 1.25rem;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--brand-primary), transparent);
    opacity: 0.15;
}
.usuarios-filtros-area .form-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
}
.usuarios-filtros-area .form-label i {
    color: var(--brand-primary);
    margin-right: 0.25rem;
}
.usuarios-filtros-area .form-control {
    font-size: 0.8125rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.usuarios-filtros-area .form-control:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.12);
}
.usuarios-filtros-area .input-group-text {
    font-size: 0.8125rem;
    border-radius: 8px 0 0 8px;
    background: var(--bg-surface-alt, #f1f5f9);
    border-color: var(--border-color);
    color: var(--brand-primary);
}
.usuarios-filtros-area .input-group .form-control {
    border-radius: 0;
}
.usuarios-filtros-area .input-group .btn {
    border-radius: 0 8px 8px 0;
}

/* Quick filter pills - premium style */
.usuarios-filtros-area .btn-group .btn {
    border-radius: 20px;
    padding: 0.25rem 0.75rem;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    transition: all 0.2s ease;
}
.usuarios-filtros-area .btn-group .btn:first-child {
    border-radius: 20px;
}
.usuarios-filtros-area .btn-group .btn:last-child {
    border-radius: 20px;
}
.usuarios-filtros-area .btn-group .btn.active,
.usuarios-filtros-area .btn-group .btn:active {
    transform: scale(0.97);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* Contador - integrated badge */
#contadorUsuarios {
    margin: 0;
}
#contadorUsuarios .alert {
    margin: 0;
    padding: 0.3rem 0.75rem;
    font-size: 0.75rem;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.25);
    background: rgba(255,255,255,0.15) !important;
    color: #fff !important;
    backdrop-filter: blur(4px);
    font-weight: 600;
}
#contadorUsuarios .badge,
#contadorUsuarios span {
    font-size: 0.75rem;
    font-weight: 600;
}

/* Table container - seamless connection */
.usuarios-unified-card > .table-scroll-container {
    border-radius: 0;
    border-top: none;
    background: var(--bg-surface, #fff);
}

/* Row hover accent - left teal bar */
.usuarios-unified-card .table tbody tr {
    transition: all 0.15s ease;
    border-left: 3px solid transparent;
}
.usuarios-unified-card .table tbody tr:hover {
    background-color: rgba(13, 148, 136, 0.05) !important;
    border-left-color: var(--brand-primary);
}

/* Alternating rows - subtle zebra */
.usuarios-unified-card .table tbody tr:nth-child(even) {
    background-color: rgba(13, 148, 136, 0.015);
}

/* Paginacion - premium bar */
.usuarios-paginacion {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0.625rem 1.25rem;
    gap: 0.375rem;
    border-top: 1px solid var(--border-color);
    background: linear-gradient(180deg, var(--bg-surface, #fff), var(--bg-surface-alt, #f8fafc));
}
.usuarios-paginacion .btn,
.usuarios-paginacion .page-link {
    min-width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.15s ease;
}
.usuarios-paginacion .btn.active,
.usuarios-paginacion .page-link.active {
    background: var(--brand-primary);
    color: #fff;
    border-color: var(--brand-primary);
    box-shadow: 0 2px 8px rgba(13, 148, 136, 0.3);
}

/* ── Dark mode - comprehensive ── */
[data-theme="dark"] .usuarios-unified-card {
    border-color: var(--border-color) !important;
    box-shadow: 0 4px 24px rgba(0,0,0,0.3), 0 1px 3px rgba(0,0,0,0.2) !important;
}
[data-theme="dark"] .usuarios-unified-card:hover {
    box-shadow: 0 8px 32px rgba(0,0,0,0.4), 0 2px 6px rgba(0,0,0,0.25) !important;
}
[data-theme="dark"] .usuarios-unified-card > .card-header {
    background: linear-gradient(135deg, #0f766e, #134e4a) !important;
}
[data-theme="dark"] .usuarios-filtros-area {
    background: linear-gradient(180deg, var(--bg-secondary), var(--bg-primary));
    border-bottom-color: var(--border-color);
}
[data-theme="dark"] .usuarios-filtros-area .form-label {
    color: var(--text-secondary);
}
[data-theme="dark"] .usuarios-filtros-area .form-label i {
    color: var(--brand-primary);
}
[data-theme="dark"] .usuarios-filtros-area .form-control,
[data-theme="dark"] .usuarios-filtros-area .input-group-text {
    background: var(--bg-primary);
    border-color: var(--border-color);
    color: var(--text-primary);
}
[data-theme="dark"] .usuarios-filtros-area .form-control:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.15);
}
[data-theme="dark"] .usuarios-filtros-area .form-control option {
    background: var(--bg-primary);
    color: var(--text-primary);
}
[data-theme="dark"] .usuarios-filtros-area .input-group-text {
    background: var(--bg-secondary);
}
/* Dark mode table - CRITICAL: override Bootstrap 5.3 white backgrounds */
[data-theme="dark"] .usuarios-unified-card > .table-scroll-container {
    background: var(--bg-primary);
}
[data-theme="dark"] .usuarios-unified-card .table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--text-primary);
    color: var(--text-primary);
}
[data-theme="dark"] .usuarios-unified-card .table thead th {
    background: linear-gradient(135deg, #0f766e, #134e4a) !important;
    color: #fff !important;
    border-bottom: 2px solid rgba(20, 184, 166, 0.3) !important;
}
[data-theme="dark"] .usuarios-unified-card .table tbody tr {
    background: transparent;
}
[data-theme="dark"] .usuarios-unified-card .table tbody tr:nth-child(even) {
    background-color: rgba(20, 184, 166, 0.03);
}
[data-theme="dark"] .usuarios-unified-card .table tbody tr:hover {
    background-color: rgba(20, 184, 166, 0.08) !important;
}
[data-theme="dark"] .usuarios-unified-card .table tbody td {
    color: var(--text-primary) !important;
    background: transparent !important;
    border-bottom-color: var(--border-color);
}
[data-theme="dark"] .usuarios-unified-card .table tbody td a {
    color: var(--text-link);
}
[data-theme="dark"] .usuarios-unified-card .table tbody td .btn {
    border-color: var(--border-color);
}
[data-theme="dark"] .usuarios-paginacion {
    background: linear-gradient(180deg, var(--bg-primary), var(--bg-secondary));
    border-top-color: var(--border-color);
}
[data-theme="dark"] .usuarios-paginacion .btn {
    color: var(--text-primary);
    border-color: var(--border-color);
}
[data-theme="dark"] #contadorUsuarios .alert {
    color: #fff !important;
    background: rgba(255,255,255,0.1) !important;
    border-color: rgba(255,255,255,0.2);
}

/* empresa-details-card nested table fix */
.empresa-details-card + .col-lg-12 .card,
.col-lg-12 > .card:has(.table-scroll-container) {
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

/* Form text muted refinement */
.form-text.text-muted i {
    margin-right: 0.25rem;
    opacity: 0.7;
}

/* =====================================================================
   PHASE 12: PRECISION LAYOUT & TABLE PERFECTION
   =====================================================================
   Padding scale: XS=0.25rem SM=0.375rem MD=0.5rem LG=0.75rem XL=1rem
   Table: th=MD(0.5rem) symmetric, td=SM×MD(0.375rem 0.5rem)
   Title: LG×XL(0.75rem 1rem), card-header: LG×XL(0.75rem 1.25rem)
   Font: th=0.75rem(12px) uppercase, td=0.8125rem(13px) normal
   ===================================================================== */

/* Action buttons inside table cells - precise sizing */
.table-custom td .btn,
.table.c_list td .btn,
.table-scroll-container .table td .btn {
    padding: 0.2rem 0.5rem;
    font-size: 0.7rem;
    line-height: 1.3;
    border-radius: 4px;
    white-space: nowrap;
    vertical-align: middle;
}
.table-custom td .btn i,
.table.c_list td .btn i,
.table-scroll-container .table td .btn i {
    font-size: 0.7rem;
    width: auto;
    margin-right: 0.15rem;
}
.table-custom td .btn-group,
.table.c_list td .btn-group,
.table-scroll-container .table td .btn-group {
    display: inline-flex;
    gap: 2px;
    flex-wrap: nowrap;
}
.table-custom td .btn-group .btn,
.table.c_list td .btn-group .btn,
.table-scroll-container .table td .btn-group .btn {
    padding: 0.15rem 0.35rem;
    border-radius: 3px;
}

/* Status badges inside table cells */
.table-custom td .badge,
.table.c_list td .badge,
.table-scroll-container .table td .badge {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    font-weight: 500;
    border-radius: 50px;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

/* Row minimum height for visual consistency */
.table-custom tbody tr,
.table.c_list tbody tr,
.table-scroll-container .table tbody tr {
    min-height: 38px;
}

/* Table number/ID columns - right-aligned for precision */
.table-custom td:first-child,
.table.c_list td:first-child {
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

/* Ensure table fills container width */
.table-scroll-container .table,
.table-scroll-container .table-custom {
    margin-bottom: 0;
    width: 100%;
    min-width: max-content;
}

/* Dark mode: action buttons in tables */
[data-theme="dark"] .table-custom td .btn,
[data-theme="dark"] .table.c_list td .btn,
[data-theme="dark"] .table-scroll-container .table td .btn {
    border-color: rgba(255,255,255,0.15);
}
[data-theme="dark"] .table-custom td .btn-default,
[data-theme="dark"] .table.c_list td .btn-default {
    background: rgba(255,255,255,0.05);
    color: var(--text-primary);
    border-color: rgba(255,255,255,0.1);
}
[data-theme="dark"] .table-custom td .btn-default:hover,
[data-theme="dark"] .table.c_list td .btn-default:hover {
    background: rgba(13, 148, 136, 0.15);
    border-color: var(--brand-primary);
}

/* Responsive table precision */
@media (max-width: 768px) {
    .title-card-p {
        padding: 0.6rem 0.75rem;
    }
    .col-md-12.title-card-p,
    .col-sm-12.title-card-p {
        padding: 0.6rem 0.75rem;
    }
    .title-card-p h4,
    .title-card-p h3 {
        font-size: 0.85rem;
    }
    .table-scroll-container .table thead th,
    .table-scroll-container .table-custom thead th {
        padding: 0.375rem !important;
        font-size: 0.7rem;
    }
    .table-scroll-container .table tbody td,
    .table-scroll-container .table-custom tbody td {
        padding: 0.3rem 0.375rem;
        font-size: 0.75rem;
    }
    .table-custom td .btn,
    .table.c_list td .btn,
    .table-scroll-container .table td .btn {
        padding: 0.15rem 0.3rem;
        font-size: 0.65rem;
    }
}

/* Action cards (used in detalleEmpUsuaErpAdmin for afiliaciones/recaudo buttons) */
.cards.card-action-info {
    background-color: rgba(52, 152, 219, 0.1);
    border: 1px solid rgba(52, 152, 219, 0.3);
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    text-align: center;
    padding: 1.25rem;
    cursor: pointer;
    transition: all 0.3s ease;
}
.cards.card-action-info:hover {
    background-color: rgba(52, 152, 219, 0.15);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}
.cards.card-action-info i { color: var(--info); }
.cards.card-action-info p { color: var(--info); font-weight: 600; }

.cards.card-action-primary {
    background-color: rgba(13, 148, 136, 0.08);
    border: 1px solid rgba(13, 148, 136, 0.3);
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    text-align: center;
    padding: 1.25rem;
    cursor: pointer;
    transition: all 0.3s ease;
}
.cards.card-action-primary:hover {
    background-color: rgba(13, 148, 136, 0.15);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}
.cards.card-action-primary i { color: var(--brand-primary); }
.cards.card-action-primary p { color: var(--brand-primary); font-weight: 600; }

.cards.card-action-warning {
    background-color: rgba(241, 196, 15, 0.08);
    border: 1px solid rgba(241, 196, 15, 0.3);
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    text-align: center;
    padding: 1.25rem;
    cursor: pointer;
    transition: all 0.3s ease;
}
.cards.card-action-warning:hover {
    background-color: rgba(241, 196, 15, 0.15);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}
.cards.card-action-warning i { color: var(--warning); }
.cards.card-action-warning p { color: var(--warning); font-weight: 600; }

/* Dark mode for action cards */
[data-theme="dark"] .cards.card-action-info {
    background-color: rgba(52, 152, 219, 0.12);
    border-color: rgba(52, 152, 219, 0.25);
}
[data-theme="dark"] .cards.card-action-primary {
    background-color: rgba(13, 148, 136, 0.12);
    border-color: rgba(13, 148, 136, 0.25);
}
[data-theme="dark"] .cards.card-action-warning {
    background-color: rgba(241, 196, 15, 0.12);
    border-color: rgba(241, 196, 15, 0.25);
}


/* ═══════════════════════════════════════════════════════════════════════════
   USER DETAIL PREMIUM - Detalle Usuario Outsourcing
   Premium card system for user profile views
   Used by: detalUsuarioAdminsErp.js → #detalleUsuarioAliAdmin
   ═══════════════════════════════════════════════════════════════════════════ */

/* --- Main profile card container --- */
.detalle-usuario-card {
    border-radius: 16px;
    overflow: hidden;
    background: var(--bg-primary, #fff);
    border: 1px solid var(--border-color, #e2e8f0);
    box-shadow: 0 4px 24px rgba(0,0,0,0.06);
}

/* --- User Header (gradient banner with avatar + info) --- */
.usuario-header {
    background: linear-gradient(135deg, #0d9488 0%, #0891b2 40%, #6366f1 100%);
    padding: 2rem 2rem 1.75rem;
    position: relative;
    overflow: hidden;
    border-radius: 16px 16px 0 0;
}
.usuario-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: rgba(255,255,255,0.06);
    pointer-events: none;
}
.usuario-header::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -10%;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: rgba(255,255,255,0.04);
    pointer-events: none;
}

/* --- Avatar --- */
.usuario-avatar-container {
    position: relative;
    display: inline-block;
}
.usuario-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 4px solid rgba(255,255,255,0.3);
    object-fit: cover;
    background: rgba(255,255,255,0.15);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}
.avatar-overlay {
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #059669, #34d399);
    border: 3px solid rgba(255,255,255,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.7rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* --- User Info (in header) --- */
.usuario-info .usuario-nombre {
    color: #fff !important;
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    text-shadow: 0 1px 3px rgba(0,0,0,0.15);
    display: block;
}
.usuario-subtitulo {
    color: rgba(255,255,255,0.9) !important;
    font-size: 0.9rem;
    margin: 0.35rem 0 0;
}
.usuario-subtitulo i {
    color: rgba(255,255,255,0.8) !important;
}
.usuario-subtitulo .badge {
    font-size: 0.75rem;
    padding: 0.3em 0.65em;
    vertical-align: middle;
}

/* --- User Body (info grid area) --- */
.usuario-body {
    padding: 1.5rem 2rem;
    background: var(--bg-primary, #fff);
}

/* --- Default info-icon background when no explicit gradient class --- */
.info-icon:not([class*="bg-"]):not([class*="cosmic"]) {
    background: linear-gradient(135deg, #0d9488, #14b8a6);
}

/* --- Key-Value Detail Card (.card-detal) --- */
.card-detal {
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-color, #e2e8f0);
    background: var(--bg-primary, #fff);
    margin-top: 0.75rem;
}
.card-detal .detalle-row {
    display: flex;
    align-items: center;
    padding: 0.65rem 1.25rem;
    border-bottom: 1px solid var(--border-color, #e2e8f0);
    transition: background 0.15s ease;
    gap: 0.5rem;
}
.card-detal .detalle-row:last-child {
    border-bottom: none;
}
.card-detal .detalle-row:nth-child(even) {
    background: var(--bg-secondary, #f8fafc);
}
.card-detal .detalle-row:hover {
    background: rgba(13, 148, 136, 0.05);
}
.card-detal .detalle-label {
    flex: 0 0 220px;
    font-size: 0.8125rem;
    color: var(--text-secondary, #64748b);
}
.card-detal .detalle-label strong {
    font-weight: 600;
    color: var(--text-secondary, #64748b);
}
.card-detal .detalle-value {
    flex: 1;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary, #1e293b);
    word-break: break-word;
}
.card-detal .detalle-value .badge {
    font-size: 0.8rem;
    padding: 0.3em 0.7em;
}
.card-detal .detalle-value .btn-sm {
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
}

/* --- Delete button area (premium) --- */
.delete-usuario-section {
    text-align: center;
    padding: 1rem;
    margin-top: 1rem;
}
.delete-usuario-section .btn-danger {
    border-radius: 8px;
    padding: 0.5rem 2rem;
    font-weight: 600;
    transition: all 0.25s ease;
}
.delete-usuario-section .btn-danger:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220,38,38,0.3);
}

/* --- Novedades card premium --- */
#novedadesUsuarioAliadoEngaged {
    margin-top: 0.75rem;
}

/* ── USER DETAIL DARK MODE ─────────────────────────── */
[data-theme="dark"] .detalle-usuario-card {
    background: var(--bg-primary);
}
[data-theme="dark"] .usuario-header {
    background: linear-gradient(135deg, #0d9488 0%, #065f46 40%, #4338ca 100%);
}
[data-theme="dark"] .usuario-body {
    background: var(--bg-primary);
}
[data-theme="dark"] .card-detal {
    border-color: var(--border-color);
    background: var(--bg-primary);
}
[data-theme="dark"] .card-detal .detalle-row {
    border-bottom-color: var(--border-color);
}
[data-theme="dark"] .card-detal .detalle-row:nth-child(even) {
    background: rgba(255,255,255,0.03);
}
[data-theme="dark"] .card-detal .detalle-row:hover {
    background: rgba(13, 148, 136, 0.08);
}
[data-theme="dark"] .card-detal .detalle-label,
[data-theme="dark"] .card-detal .detalle-label strong {
    color: var(--text-secondary);
}
[data-theme="dark"] .card-detal .detalle-value {
    color: var(--text-primary);
}
[data-theme="dark"] .delete-usuario-section .btn-danger {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    border: none;
}

/* ── USER DETAIL RESPONSIVE ────────────────────────── */
@media (max-width: 768px) {
    .usuario-header { padding: 1.5rem 1.25rem; }
    .usuario-avatar { width: 80px; height: 80px; }
    .usuario-info .usuario-nombre { font-size: 1.25rem; }
    .usuario-body { padding: 1rem; }
    .card-detal .detalle-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.15rem;
        padding: 0.5rem 1rem;
    }
    .card-detal .detalle-label { flex: none; }
}
@media (max-width: 576px) {
    .usuario-header .row { text-align: center; }
    .usuario-header .col-md-9 { margin-top: 1rem; }
    .usuario-info .usuario-nombre { font-size: 1.1rem; }
    .usuario-subtitulo { font-size: 0.8rem; }
}

/* --- Document cards (user detail) --- */
.documento-card {
    border-radius: 10px !important;
    transition: all 0.3s ease;
    border: 1px solid var(--border-color, #e2e8f0) !important;
}
.documento-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.documento-icono {
    flex-shrink: 0;
}
#seccionDocumentos > .card-header.bg-primary {
    background: linear-gradient(135deg, var(--brand-primary, #0d9488), var(--brand-primary-hover, #0f766e)) !important;
}
[data-theme="dark"] .documento-card {
    background: var(--bg-primary) !important;
    border-color: var(--border-color) !important;
}
[data-theme="dark"] .documento-card .card-body {
    background: transparent !important;
}


/* ═══════════════════════════════════════════════════════════════════════════
   PREMIUM DETAIL SECTIONS SYSTEM
   Reusable sectioned layout for all detail/profile views
   Used by: detalUsuarioAdminsErp.js, and future detail page upgrades
   ═══════════════════════════════════════════════════════════════════════════ */

/* --- Quick Stats Bar (below header) --- */
.detail-quick-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0;
    background: var(--bg-secondary, #f8fafc);
    border-bottom: 1px solid var(--border-color, #e2e8f0);
}
.detail-quick-stat {
    padding: 1rem 1.25rem;
    text-align: center;
    border-right: 1px solid var(--border-color, #e2e8f0);
    transition: background 0.2s ease;
    position: relative;
}
.detail-quick-stat:last-child {
    border-right: none;
}
.detail-quick-stat:hover {
    background: rgba(13, 148, 136, 0.04);
}
.detail-quick-stat-label {
    font-size: 0.625rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-secondary, #64748b);
    margin-bottom: 0.3rem;
    font-weight: 600;
}
.detail-quick-stat-value {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--brand-primary, #0d9488);
    line-height: 1.2;
}
.detail-quick-stat-value .badge {
    font-size: 0.8rem;
    padding: 0.35em 0.75em;
}

/* --- Sections Container --- */
.detail-sections {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    padding: 1.5rem;
    border-radius: 0 0 16px 16px;
    background: var(--bg-primary, #fff);
}

/* --- Individual Section --- */
.detail-section {
    background: var(--bg-primary, #fff);
    border-radius: 12px;
    border: 1px solid var(--border-color, #e2e8f0);
    overflow: hidden;
    transition: box-shadow 0.3s ease;
}
.detail-section:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}

/* Full-width section (spans both columns) */
.detail-section.full-width {
    grid-column: 1 / -1;
}

/* --- Section Header --- */
.detail-section-header {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.75rem 1.15rem;
    background: var(--bg-secondary, #f8fafc);
    border-bottom: 1px solid var(--border-color, #e2e8f0);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-primary, #1e293b);
}
.detail-section-header i {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.75rem;
    flex-shrink: 0;
}

/* --- Section Body (grid of items) --- */
.detail-section-body {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0;
}

/* --- Individual Detail Item --- */
.detail-item {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.7rem 1.15rem;
    border-bottom: 1px solid var(--border-color, #e2e8f0);
    border-right: 1px solid var(--border-color, #e2e8f0);
    transition: background 0.15s ease;
}
.detail-item:hover {
    background: rgba(13, 148, 136, 0.03);
}
/* Right column: remove right border */
.detail-item:nth-child(even) {
    border-right: none;
}
/* Last row: remove bottom border */
.detail-section-body .detail-item:nth-last-child(1),
.detail-section-body .detail-item:nth-last-child(2):nth-child(odd) {
    border-bottom: none;
}
/* Single item in last row */
.detail-section-body .detail-item:nth-last-child(1):nth-child(odd) {
    border-right: none;
}

.detail-item-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-secondary, #64748b);
    font-weight: 600;
}
.detail-item-value {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary, #1e293b);
    word-break: break-word;
    line-height: 1.3;
}
.detail-item-value .badge {
    font-size: 0.75rem;
    padding: 0.25em 0.6em;
}
.detail-item-value .btn-sm {
    font-size: 0.7rem;
    padding: 0.15rem 0.45rem;
    margin-left: 0.35rem;
}

/* Full-width item (spans both columns) */
.detail-item.full-width {
    grid-column: 1 / -1;
    border-right: none;
}

/* Money values get brand color */
.detail-item-value.money {
    color: var(--brand-primary, #0d9488);
    font-weight: 700;
}

/* --- Section header icon color variants --- */
.detail-section-header .icon-personal { background: linear-gradient(135deg, #7c3aed, #a78bfa); }
.detail-section-header .icon-contact { background: linear-gradient(135deg, #2563eb, #60a5fa); }
.detail-section-header .icon-social { background: linear-gradient(135deg, #059669, #34d399); }
.detail-section-header .icon-financial { background: linear-gradient(135deg, #ea580c, #fb923c); }
.detail-section-header .icon-empresa { background: linear-gradient(135deg, #9a3412, #ea580c); }
.detail-section-header .icon-status { background: linear-gradient(135deg, #0891b2, #22d3ee); }
.detail-section-header .icon-location { background: linear-gradient(135deg, #d97706, #fbbf24); }
.detail-section-header .icon-docs { background: linear-gradient(135deg, #dc2626, #f87171); }
.detail-section-header .icon-ibc { background: linear-gradient(135deg, #7c3aed, #c084fc); }
.detail-section-header .icon-tarifas { background: linear-gradient(135deg, #0369a1, #38bdf8); }
.detail-section-header .icon-cotizaciones { background: linear-gradient(135deg, #b45309, #fbbf24); }
.detail-section-header .icon-dias { background: linear-gradient(135deg, #0f766e, #5eead4); }

/* Fix: allow detail card to expand fully with all sections */
#detalleUsuarioAliAdmin.card.detalle {
    overflow: visible;
}
#detalleUsuarioAliAdmin .detalle-usuario-card {
    overflow: visible;
}

/* Hide empty novedades card */
#novedadesUsuarioAliadoEngaged:empty {
    display: none;
}

/* ── DETAIL SECTIONS DARK MODE ──────────────────────── */
[data-theme="dark"] .detail-quick-stats {
    background: rgba(255,255,255,0.03);
    border-color: var(--border-color);
}
[data-theme="dark"] .detail-quick-stat {
    border-color: var(--border-color);
}
[data-theme="dark"] .detail-quick-stat:hover {
    background: rgba(13, 148, 136, 0.08);
}
[data-theme="dark"] .detail-quick-stat-value {
    color: #2dd4bf;
}
[data-theme="dark"] .detail-section {
    background: var(--bg-primary);
    border-color: var(--border-color);
}
[data-theme="dark"] .detail-section:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}
[data-theme="dark"] .detail-section-header {
    background: rgba(255,255,255,0.04);
    border-color: var(--border-color);
    color: var(--text-primary);
}
[data-theme="dark"] .detail-item {
    border-color: var(--border-color);
}
[data-theme="dark"] .detail-item:hover {
    background: rgba(13, 148, 136, 0.06);
}
[data-theme="dark"] .detail-item-label {
    color: var(--text-secondary);
}
[data-theme="dark"] .detail-item-value {
    color: var(--text-primary);
}
[data-theme="dark"] .detail-item-value.money {
    color: #2dd4bf;
}

/* ── DETAIL SECTIONS RESPONSIVE ─────────────────────── */
@media (max-width: 992px) {
    .detail-sections {
        grid-template-columns: 1fr;
    }
}
@media (max-width: 768px) {
    .detail-sections {
        padding: 1rem;
        gap: 0.75rem;
    }
    .detail-quick-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    .detail-quick-stat {
        padding: 0.75rem;
    }
    .detail-quick-stat:nth-child(2) {
        border-right: none;
    }
    .detail-quick-stat:nth-child(-n+2) {
        border-bottom: 1px solid var(--border-color, #e2e8f0);
    }
}
@media (max-width: 576px) {
    .detail-sections {
        padding: 0.75rem;
    }
    .detail-section-body {
        grid-template-columns: 1fr;
    }
    .detail-item {
        border-right: none !important;
    }
    .detail-item:last-child {
        border-bottom: none;
    }
    .detail-quick-stats {
        grid-template-columns: 1fr;
    }
    .detail-quick-stat {
        border-right: none;
        border-bottom: 1px solid var(--border-color, #e2e8f0);
    }
    .detail-quick-stat:last-child {
        border-bottom: none;
    }
}

/* ═══════════════════════════════════════════════════════════════════
   PHASE 16: TESORERIA DASHBOARD PREMIUM
   Complete component system for treasury/financial dashboards
   ═══════════════════════════════════════════════════════════════════ */

/* --- View Toggle (used by showView) --- */
.view.hidden {
    display: none !important;
}

/* --- Gestor Info Card --- */
.gestor-card {
    background: linear-gradient(135deg, var(--brand-primary) 0%, #0891b2 100%);
    border-radius: 16px;
    padding: 1.5rem 2rem;
    margin-bottom: 1.5rem;
    color: #fff;
    box-shadow: 0 4px 20px rgba(13, 148, 136, 0.25);
    position: relative;
    overflow: hidden;
}
.gestor-card::before {
    content: '';
    position: absolute;
    top: -30%;
    right: -10%;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    pointer-events: none;
}
.gestor-card .gestor-name {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}
.gestor-card .gestor-role {
    font-size: 0.8125rem;
    opacity: 0.85;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.gestor-card .gestor-header {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}
.gestor-card .gestor-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
    border: 2px solid rgba(255, 255, 255, 0.3);
}
.gestor-card .gestor-details h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    margin: 0 0 0.25rem;
}
.gestor-card .gestor-details p {
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.75);
    margin: 0 0 0.35rem;
}
.gestor-card .gestor-details p i {
    margin-right: 0.35rem;
    width: 14px;
    text-align: center;
}
.gestor-card .gestor-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.gestor-card .gestor-info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}
.gestor-card .gestor-info-item {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    padding: 0.625rem 0.75rem;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    transition: background 0.2s ease;
}
.gestor-card .gestor-info-item:hover {
    background: rgba(255, 255, 255, 0.14);
}
.gestor-card .gestor-info-item > i {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.875rem;
    margin-top: 0.15rem;
    width: 16px;
    text-align: center;
    flex-shrink: 0;
}
.gestor-card .info-label {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 0.125rem;
}
.gestor-card .info-value {
    font-size: 0.8125rem;
    font-weight: 500;
    color: #fff;
    word-break: break-word;
}
@media (max-width: 992px) {
    .gestor-card .gestor-info-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 576px) {
    .gestor-card .gestor-info-grid { grid-template-columns: 1fr; }
    .gestor-card .gestor-header { flex-direction: column; text-align: center; }
    .gestor-card .gestor-avatar { margin: 0 auto; }
}
[data-theme="dark"] .gestor-card {
    background: linear-gradient(135deg, #134e4a 0%, #164e63 100%);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* --- Live Indicator Bar --- */
.live-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
}
.live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    display: inline-block;
    animation: livePulse 2s ease-in-out infinite;
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.5);
}
@keyframes livePulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.85); }
}
.refresh-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1.25rem;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--brand-primary) 0%, #0891b2 100%);
    color: #fff;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(13, 148, 136, 0.2);
}
.refresh-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(13, 148, 136, 0.35);
}
.refresh-btn:active {
    transform: translateY(0);
}
.refresh-btn i {
    transition: transform 0.5s ease;
}
.refresh-btn:hover i {
    transform: rotate(180deg);
}
[data-theme="dark"] .refresh-btn {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* --- Large Stats Row (Hero Stats) --- */
.large-stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
    margin-bottom: 2rem;
}
.large-stat-card {
    background: var(--bg-primary, #fff);
    border-radius: 16px;
    padding: 1.5rem;
    text-align: center;
    border: 1px solid var(--border-color, #e2e8f0);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.large-stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    border-radius: 16px 16px 0 0;
    transition: height 0.3s ease;
}
.large-stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
}
.large-stat-card:hover::before {
    height: 5px;
}
.large-stat-card.primary::before { background: linear-gradient(90deg, var(--brand-primary), #0891b2); }
.large-stat-card.success::before { background: linear-gradient(90deg, #10b981, #34d399); }
.large-stat-card.warning::before { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.large-stat-card.info::before { background: linear-gradient(90deg, #6366f1, #818cf8); }
.large-stat-card.danger::before { background: linear-gradient(90deg, #ef4444, #f87171); }

.stat-icon-large {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin: 0 auto 1rem;
    color: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.large-stat-card.primary .stat-icon-large { background: linear-gradient(135deg, var(--brand-primary), #0891b2); }
.large-stat-card.success .stat-icon-large { background: linear-gradient(135deg, #10b981, #34d399); }
.large-stat-card.warning .stat-icon-large { background: linear-gradient(135deg, #f59e0b, #fbbf24); }
.large-stat-card.info .stat-icon-large { background: linear-gradient(135deg, #6366f1, #818cf8); }
.large-stat-card.danger .stat-icon-large { background: linear-gradient(135deg, #ef4444, #f87171); }

.large-stat-value {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.1;
    margin-bottom: 0.35rem;
    letter-spacing: -1px;
}
.large-stat-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-secondary);
}
[data-theme="dark"] .large-stat-card {
    background: var(--bg-primary);
    border-color: var(--border-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}
[data-theme="dark"] .large-stat-card:hover {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

/* --- Stats Container (Grid for small stat cards) --- */
.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

/* --- Stat Card (Dashboard variant with header/trend/footer) --- */
.stats-container .stat-card {
    background: var(--bg-primary, #fff);
    border-radius: 14px;
    padding: 1.25rem;
    border: 1px solid var(--border-color, #e2e8f0);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.stats-container .stat-card::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    transition: height 0.3s ease;
}
.stats-container .stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
}
.stats-container .stat-card:hover::before { height: 4px; }

/* Color variants */
.stats-container .stat-card.success::before { background: linear-gradient(90deg, #10b981, #34d399); }
.stats-container .stat-card.warning::before { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.stats-container .stat-card.info::before { background: linear-gradient(90deg, #6366f1, #818cf8); }
.stats-container .stat-card.primary::before { background: linear-gradient(90deg, var(--brand-primary), #0891b2); }
.stats-container .stat-card.danger::before { background: linear-gradient(90deg, #ef4444, #f87171); }
.stats-container .stat-card.purple::before { background: linear-gradient(90deg, #8b5cf6, #a78bfa); }
.stats-container .stat-card.orange::before { background: linear-gradient(90deg, #f97316, #fb923c); }
.stats-container .stat-card.teal::before { background: linear-gradient(90deg, #14b8a6, #5eead4); }

.stat-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}
.stats-container .stat-card .stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: #fff;
}
.stats-container .stat-card.success .stat-icon { background: linear-gradient(135deg, #10b981, #34d399); }
.stats-container .stat-card.warning .stat-icon { background: linear-gradient(135deg, #f59e0b, #fbbf24); }
.stats-container .stat-card.info .stat-icon { background: linear-gradient(135deg, #6366f1, #818cf8); }
.stats-container .stat-card.primary .stat-icon { background: linear-gradient(135deg, var(--brand-primary), #0891b2); }
.stats-container .stat-card.danger .stat-icon { background: linear-gradient(135deg, #ef4444, #f87171); }
.stats-container .stat-card.purple .stat-icon { background: linear-gradient(135deg, #8b5cf6, #a78bfa); }
.stats-container .stat-card.orange .stat-icon { background: linear-gradient(135deg, #f97316, #fb923c); }
.stats-container .stat-card.teal .stat-icon { background: linear-gradient(135deg, #14b8a6, #5eead4); }

/* Trend indicators */
.stat-trend {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.5rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
}
.stat-trend.up {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}
.stat-trend.down {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}
.stat-trend.neutral {
    background: rgba(107, 114, 128, 0.1);
    color: #6b7280;
}

.stats-container .stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.1;
    margin-bottom: 0.2rem;
    letter-spacing: -0.5px;
}
.stats-container .stat-card .stat-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}
.stat-footer {
    font-size: 0.7rem;
    color: var(--text-muted, #94a3b8);
    border-top: 1px solid var(--border-color, #e2e8f0);
    padding-top: 0.5rem;
    margin-top: 0.5rem;
}

[data-theme="dark"] .stats-container .stat-card {
    background: var(--bg-primary);
    border-color: var(--border-color);
}

/* --- Charts Row --- */
.charts-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
    margin-bottom: 2rem;
}
.chart-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color, #e2e8f0);
}
.chart-card-title {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.chart-card-title i {
    color: var(--brand-primary);
    font-size: 0.875rem;
}
[data-theme="dark"] .chart-card-header {
    border-bottom-color: var(--border-color);
}

/* --- Comparison Card Enhancement --- */
.comparison-card {
    background: var(--bg-primary, #fff);
    border-radius: 16px;
    border: 1px solid var(--border-color, #e2e8f0);
    margin-bottom: 2rem;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: all 0.3s ease;
}
.comparison-card:hover {
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
}
.comparison-header {
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, rgba(13, 148, 136, 0.05) 0%, rgba(99, 102, 241, 0.05) 100%);
    border-bottom: 1px solid var(--border-color, #e2e8f0);
}
.comparison-title {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
}
.comparison-title i {
    color: var(--brand-primary);
    margin-right: 0.625rem;
}

/* --- Breakdown Card Enhancement --- */
.breakdown-card {
    background: var(--bg-primary, #fff);
    border-radius: 16px;
    border: 1px solid var(--border-color, #e2e8f0);
    margin-bottom: 1.5rem;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: all 0.3s ease;
}
.breakdown-card:hover {
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
}
.breakdown-card .chart-card-header {
    background: linear-gradient(135deg, rgba(13, 148, 136, 0.04) 0%, transparent 100%);
}

/* --- Summary Table Enhancement --- */
.summary-table-card {
    background: var(--bg-primary, #fff);
    border-radius: 16px;
    border: 1px solid var(--border-color, #e2e8f0);
    margin-bottom: 2rem;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.summary-table-header {
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, rgba(13, 148, 136, 0.05) 0%, rgba(99, 102, 241, 0.05) 100%);
    border-bottom: 1px solid var(--border-color, #e2e8f0);
}
.summary-table-title {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
}
.summary-table-title i {
    color: var(--brand-primary);
    margin-right: 0.625rem;
}

/* --- Filter Cards (clientesErp view) --- */
.filter-card {
    background: var(--bg-primary, #fff);
    border-radius: 14px;
    border: 2px solid var(--border-color, #e2e8f0);
    cursor: pointer;
    transition: all 0.3s ease;
}
.filter-card:hover {
    border-color: var(--brand-primary);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(13, 148, 136, 0.12);
}
.filter-card.active,
.filter-card:active {
    border-color: var(--brand-primary);
    background: linear-gradient(135deg, rgba(13, 148, 136, 0.05) 0%, transparent 100%);
}
.filter-card .card-title {
    color: var(--text-primary);
    font-weight: 700;
    font-size: 0.9375rem;
}
.filter-card .card-text {
    color: var(--text-secondary);
    font-size: 0.8125rem;
}
[data-theme="dark"] .filter-card {
    background: var(--bg-primary);
    border-color: var(--border-color);
}

/* --- Tareas Cards --- */
.tareas-card {
    background: var(--bg-primary, #fff);
    border-radius: 16px;
    border: 1px solid var(--border-color, #e2e8f0);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
    margin-bottom: 1.25rem;
    overflow: hidden;
    transition: all 0.3s ease;
}
.tareas-card:hover {
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}
.tareas-card .card-body h5 {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.tareas-card .card-body h5 i {
    font-size: 1rem;
}
[data-theme="dark"] .tareas-card {
    background: var(--bg-primary);
    border-color: var(--border-color);
}

/* --- Notification Toasts (injected by JS, dark mode override) --- */
[data-theme="dark"] .notif-toast {
    background: var(--bg-primary) !important;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3) !important;
}
[data-theme="dark"] .notif-toast .notif-title { color: var(--text-primary) !important; }
[data-theme="dark"] .notif-toast .notif-msg { color: var(--text-secondary) !important; }
[data-theme="dark"] .notif-toast .notif-close { color: var(--text-muted) !important; }
[data-theme="dark"] .notif-toast .notif-close:hover { color: var(--text-primary) !important; }

/* --- List Group flush (in tareas cards) --- */
.tareas-card .list-group-item {
    background: transparent;
    border-color: var(--border-color, #e2e8f0);
    color: var(--text-primary);
}
.tareas-card .list-group-item strong {
    color: var(--text-primary);
}
[data-theme="dark"] .tareas-card .list-group-item {
    border-color: var(--border-color);
}

/* --- Dashboard Responsive --- */
@media (max-width: 1200px) {
    .large-stats-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 992px) {
    .charts-row { grid-template-columns: 1fr; }
    .stats-container { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
    .large-stats-row { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
    .large-stat-card { padding: 1rem; }
    .large-stat-value { font-size: 1.75rem; }
    .stat-icon-large { width: 44px; height: 44px; font-size: 1.25rem; }
    .stats-container { grid-template-columns: 1fr 1fr; gap: 0.75rem; }
    .stats-container .stat-card .stat-value { font-size: 1.35rem; }
    .comparison-grid { flex-direction: column; gap: 0.75rem; }
    .comparison-vs { transform: rotate(90deg); }
}
@media (max-width: 576px) {
    .large-stats-row { grid-template-columns: 1fr 1fr; gap: 0.5rem; }
    .large-stat-card { padding: 0.875rem; border-radius: 12px; }
    .large-stat-value { font-size: 1.5rem; }
    .large-stat-label { font-size: 0.65rem; }
    .stat-icon-large { width: 38px; height: 38px; font-size: 1.1rem; margin-bottom: 0.625rem; border-radius: 10px; }
    .stats-container { grid-template-columns: 1fr; }
    .stats-container .stat-card { padding: 1rem; }
}

/* ============================================
   PHASE 17: EMPRESA VISTA PREMIUM
   Grid cards, tabs, search, detail, status badges
   ============================================ */

/* --- Empresa Stats Bar --- */
.empresa-stats-bar {
    display: flex;
    gap: 1.25rem;
    padding: 0.75rem 1.25rem;
    background: var(--bg-surface);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    align-items: center;
    flex-wrap: wrap;
}
.empresa-stat {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}
.empresa-stat strong {
    color: var(--brand-primary);
    font-size: 1.125rem;
    font-weight: 800;
}

/* --- Empresa Tabs --- */
.empresa-tabs {
    display: flex;
    gap: 0.5rem;
    list-style: none;
    padding: 0;
    margin: 0;
}
.empresa-tab-link {
    cursor: pointer;
    padding: 0.5rem 1.25rem;
    border-radius: 25px;
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    transition: all 0.2s;
    text-decoration: none !important;
}
.empresa-tab-link:hover {
    color: var(--brand-primary);
    border-color: var(--brand-primary);
}
.empresa-tab-link.active {
    background: var(--brand-primary);
    color: #fff;
    border-color: var(--brand-primary);
}

/* --- Empresa Toolbar (Search + View Toggle) --- */
.empresa-toolbar {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}
.empresa-toolbar .empresa-search {
    flex: 1;
    min-width: 0;
}

/* --- Empresa Search --- */
.empresa-search {
    position: relative;
}
.empresa-search i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.875rem;
}
.empresa-search input {
    width: 100%;
    padding: 0.625rem 1rem 0.625rem 2.5rem;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.empresa-search input:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.1);
}

/* --- View Toggle Buttons --- */
.empresa-view-toggle {
    display: flex;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
}
.view-toggle-btn {
    padding: 0.5rem 0.75rem;
    border: none;
    background: var(--bg-surface);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9375rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}
.view-toggle-btn:first-child {
    border-right: 1px solid var(--border-color);
}
.view-toggle-btn:hover {
    color: var(--brand-primary);
    background: var(--bg-hover);
}
.view-toggle-btn.active {
    background: var(--brand-primary);
    color: #fff;
}

/* --- Empresa Breadcrumb (aliado drill-down) --- */
.empresa-breadcrumb {
    display: flex;
    align-items: center;
    padding: 0.625rem 1rem;
    background: var(--bg-surface);
    border-radius: 10px;
    border: 1px solid var(--border-color);
}
.empresa-breadcrumb span {
    font-size: 0.875rem;
    color: var(--text-primary);
}

/* --- Aliado Card Variant --- */
.aliado-card-item::before {
    background: #6366f1 !important;
}
.aliado-card-item:hover {
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.12);
    border-color: #6366f1;
}

/* --- Empresa Lista (table mode) --- */
.empresa-lista {
    display: block;
}
.empresa-table-list {
    text-transform: uppercase;
}
.empresa-table-list td strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* --- Empresa Grid --- */
.empresa-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
}

/* --- Empresa Card Item --- */
.empresa-card-item {
    background: var(--bg-surface);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    padding: 1.25rem;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}
.empresa-card-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--brand-primary);
    border-radius: 4px 0 0 4px;
    opacity: 0;
    transition: opacity 0.2s;
}
.empresa-card-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(13, 148, 136, 0.12);
    border-color: var(--brand-primary);
}
.empresa-card-item:hover::before {
    opacity: 1;
}
.empresa-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}
.empresa-card-item .empresa-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
    margin-bottom: 0.125rem;
}
.empresa-card-item .empresa-nit {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}
.empresa-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.625rem;
    border-radius: 20px;
    font-size: 0.6875rem;
    font-weight: 600;
    white-space: nowrap;
    letter-spacing: 0.02em;
}
.empresa-badge.badge-asignada {
    background: rgba(13, 148, 136, 0.12);
    color: #0d9488;
}
.empresa-badge.badge-aliado {
    background: rgba(99, 102, 241, 0.12);
    color: #6366f1;
}
.empresa-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.25rem;
    margin-bottom: 0.75rem;
}
.empresa-meta-item {
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}
.empresa-meta-item i {
    color: var(--brand-primary);
    width: 14px;
    text-align: center;
    font-size: 0.6875rem;
}
.btn-empresa-detalle {
    width: 100%;
    padding: 0.4rem 0.75rem;
    border-radius: 8px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--brand-primary);
    background: rgba(13, 148, 136, 0.08);
    border: 1px solid rgba(13, 148, 136, 0.2);
    transition: all 0.2s;
}
.btn-empresa-detalle:hover {
    background: var(--brand-primary);
    color: #fff;
    border-color: var(--brand-primary);
}

/* --- Detalle Empresa Header Card --- */
.detalle-emp-header-card {
    background: var(--bg-surface);
    border-radius: 14px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}
.emp-header-top {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, #0d9488 0%, #0f766e 100%);
    color: #fff;
}
.emp-header-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}
.emp-header-info {
    flex: 1;
    min-width: 0;
}
.emp-header-name {
    font-size: 1.25rem;
    font-weight: 800;
    margin: 0 0 0.25rem;
    color: #fff;
}
.emp-header-top .empresa-badge {
    background: rgba(255,255,255,0.2);
    color: #fff;
}
.emp-header-fields {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.75rem;
    padding: 1.25rem 1.5rem;
}
.emp-header-field {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}
.emp-header-label {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}
.emp-header-label i {
    color: var(--brand-primary);
    margin-right: 0.25rem;
}
.emp-header-value {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* --- User Status Stats Grid --- */
.emp-usuarios-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.75rem;
}
.emp-stat-card {
    background: var(--bg-surface);
    border-radius: 10px;
    border: 1px solid var(--border-color);
    padding: 0.875rem 0.75rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}
.emp-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}
.emp-stat-icon {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
}
.emp-stat-count {
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1.2;
}
.emp-stat-label {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
    margin-top: 0.125rem;
}
/* Stat color variants */
.emp-stat-total .emp-stat-icon { color: #6366f1; }
.emp-stat-total .emp-stat-count { color: #6366f1; }
.emp-stat-total { border-color: rgba(99, 102, 241, 0.3); }
.emp-stat-success .emp-stat-icon { color: #10b981; }
.emp-stat-success .emp-stat-count { color: #10b981; }
.emp-stat-success { border-color: rgba(16, 185, 129, 0.3); }
.emp-stat-primary .emp-stat-icon { color: #0d9488; }
.emp-stat-primary .emp-stat-count { color: #0d9488; }
.emp-stat-primary { border-color: rgba(13, 148, 136, 0.3); }
.emp-stat-info .emp-stat-icon { color: #3b82f6; }
.emp-stat-info .emp-stat-count { color: #3b82f6; }
.emp-stat-info { border-color: rgba(59, 130, 246, 0.3); }
.emp-stat-danger .emp-stat-icon { color: #ef4444; }
.emp-stat-danger .emp-stat-count { color: #ef4444; }
.emp-stat-danger { border-color: rgba(239, 68, 68, 0.3); }
.emp-stat-warning .emp-stat-icon { color: #f59e0b; }
.emp-stat-warning .emp-stat-count { color: #f59e0b; }
.emp-stat-warning { border-color: rgba(245, 158, 11, 0.3); }
.emp-stat-orange .emp-stat-icon { color: #f97316; }
.emp-stat-orange .emp-stat-count { color: #f97316; }
.emp-stat-orange { border-color: rgba(249, 115, 22, 0.3); }
.emp-stat-teal .emp-stat-icon { color: #14b8a6; }
.emp-stat-teal .emp-stat-count { color: #14b8a6; }
.emp-stat-teal { border-color: rgba(20, 184, 166, 0.3); }

/* --- Filter Pills --- */
.emp-filter-pills {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.emp-filter-pill {
    padding: 0.35rem 0.875rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}
.emp-filter-pill:hover {
    border-color: var(--brand-primary);
    color: var(--brand-primary);
}
.emp-filter-pill.active {
    background: var(--brand-primary);
    color: #fff;
    border-color: var(--brand-primary);
}
.emp-pill-success.active { background: #10b981; border-color: #10b981; }
.emp-pill-primary.active { background: #0d9488; border-color: #0d9488; }
.emp-pill-info.active { background: #3b82f6; border-color: #3b82f6; }
.emp-pill-danger.active { background: #ef4444; border-color: #ef4444; }
.emp-pill-warning.active { background: #f59e0b; border-color: #f59e0b; }
.emp-pill-orange.active { background: #f97316; border-color: #f97316; }
.emp-pill-teal.active { background: #14b8a6; border-color: #14b8a6; }

/* --- User Status Badges --- */
.user-status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.625rem;
    border-radius: 20px;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.status-activo { background: rgba(16, 185, 129, 0.12); color: #10b981; }
.status-pagado { background: rgba(13, 148, 136, 0.12); color: #0d9488; }
.status-pagado-mes { background: rgba(59, 130, 246, 0.12); color: #3b82f6; }
.status-mora { background: rgba(239, 68, 68, 0.12); color: #ef4444; }
.status-retirado { background: rgba(245, 158, 11, 0.12); color: #f59e0b; }
.status-retirado-pago { background: rgba(249, 115, 22, 0.12); color: #f97316; }
.status-pagado-ali { background: rgba(20, 184, 166, 0.12); color: #14b8a6; }
.status-pendiente { background: rgba(148, 163, 184, 0.15); color: #94a3b8; }

/* --- Dark Mode: Empresa Views --- */
[data-theme="dark"] .empresa-breadcrumb {
    background: var(--bg-surface);
    border-color: var(--border-color);
}
[data-theme="dark"] .empresa-stats-bar {
    background: var(--bg-surface);
    border-color: var(--border-color);
}
[data-theme="dark"] .empresa-tab-link {
    background: var(--bg-surface);
    border-color: var(--border-color);
    color: var(--text-secondary);
}
[data-theme="dark"] .empresa-tab-link.active {
    background: var(--brand-primary);
    color: #fff;
}
[data-theme="dark"] .empresa-search input {
    background: var(--bg-surface);
    border-color: var(--border-color);
    color: var(--text-primary);
}
[data-theme="dark"] .empresa-view-toggle {
    border-color: var(--border-color);
}
[data-theme="dark"] .view-toggle-btn {
    background: var(--bg-surface);
    color: var(--text-muted);
}
[data-theme="dark"] .view-toggle-btn:first-child {
    border-right-color: var(--border-color);
}
[data-theme="dark"] .view-toggle-btn:hover {
    background: var(--bg-hover);
    color: var(--brand-primary);
}
[data-theme="dark"] .view-toggle-btn.active {
    background: var(--brand-primary);
    color: #fff;
}
[data-theme="dark"] .empresa-card-item {
    background: var(--bg-surface);
    border-color: var(--border-color);
}
[data-theme="dark"] .empresa-card-item:hover {
    border-color: var(--brand-primary);
}
[data-theme="dark"] .btn-empresa-detalle {
    color: var(--brand-primary);
    background: rgba(13, 148, 136, 0.1);
    border-color: rgba(13, 148, 136, 0.25);
}
[data-theme="dark"] .btn-empresa-detalle:hover {
    background: var(--brand-primary);
    color: #fff;
}
[data-theme="dark"] .detalle-emp-header-card {
    background: var(--bg-surface);
    border-color: var(--border-color);
}
[data-theme="dark"] .emp-header-value {
    color: var(--text-primary);
}
[data-theme="dark"] .emp-stat-card {
    background: var(--bg-surface);
    border-color: var(--border-color);
}
[data-theme="dark"] .emp-filter-pill {
    background: var(--bg-surface);
    border-color: var(--border-color);
    color: var(--text-secondary);
}

/* --- Responsive: Empresa Views --- */
@media (max-width: 992px) {
    .empresa-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
    .emp-header-fields { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
    .emp-usuarios-stats { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 768px) {
    .empresa-stats-bar { gap: 0.75rem; }
    .empresa-tabs { flex-wrap: wrap; }
    .empresa-grid { grid-template-columns: 1fr 1fr; }
    .emp-header-top { flex-direction: column; text-align: center; }
    .emp-header-fields { grid-template-columns: 1fr 1fr; }
    .emp-usuarios-stats { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 576px) {
    .empresa-grid { grid-template-columns: 1fr; }
    .emp-header-fields { grid-template-columns: 1fr; }
    .emp-usuarios-stats { grid-template-columns: repeat(2, 1fr); }
    .emp-filter-pills { gap: 0.375rem; }
    .emp-stat-count { font-size: 1.25rem; }
}

/* ============================================
   PHASE 18: CARTERA VIEW + WIZARD + AUTO-STATUS
   ============================================ */

/* --- Cartera Aging Bar --- */
.cartera-aging-bar {
    display: flex;
    height: 28px;
    border-radius: 6px;
    overflow: hidden;
    background: var(--bg-secondary, #f1f5f9);
    margin-bottom: 1rem;
}
.cartera-aging-segment {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
    color: #fff;
    transition: flex 0.3s ease;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    padding: 0 0.375rem;
}
.cartera-aging-segment.aging-0-15 { background: var(--brand-primary, #0d9488); }
.cartera-aging-segment.aging-15-30 { background: #f59e0b; }
.cartera-aging-segment.aging-30-60 { background: #f97316; }
.cartera-aging-segment.aging-60plus { background: #ef4444; }

.cartera-aging-legend {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    font-size: 0.75rem;
}
.cartera-aging-legend-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}
.cartera-aging-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* --- Cartera Badges --- */
.cartera-valor-badge {
    display: inline-block;
    padding: 0.25rem 0.625rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}
.cartera-valor-badge.pendiente {
    background: rgba(245, 158, 11, 0.15);
    color: #d97706;
}
.cartera-valor-badge.mora {
    background: rgba(239, 68, 68, 0.15);
    color: #dc2626;
}
.cartera-dias-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
}
.cartera-dias-badge.leve { background: #e2e8f0; color: #475569; }
.cartera-dias-badge.moderado { background: rgba(245, 158, 11, 0.15); color: #d97706; }
.cartera-dias-badge.critico { background: rgba(239, 68, 68, 0.15); color: #dc2626; }

/* --- Wizard Steps --- */
.wizard-steps {
    display: flex;
    justify-content: center;
    gap: 0;
    margin-bottom: 1.5rem;
    position: relative;
}
.wizard-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    position: relative;
}
.wizard-step-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    background: var(--bg-secondary, #e2e8f0);
    color: var(--text-secondary, #64748b);
    border: 2px solid var(--border-color, #e2e8f0);
    z-index: 1;
    transition: all 0.3s ease;
}
.wizard-step-label {
    margin-top: 0.5rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary, #64748b);
    font-weight: 500;
}
.wizard-step::after {
    content: '';
    position: absolute;
    top: 18px;
    left: 50%;
    width: 100%;
    height: 2px;
    background: var(--border-color, #e2e8f0);
    z-index: 0;
}
.wizard-step:last-child::after { display: none; }
.wizard-step.active .wizard-step-circle {
    background: var(--brand-primary, #0d9488);
    color: #fff;
    border-color: var(--brand-primary, #0d9488);
    box-shadow: 0 0 0 4px rgba(13, 148, 136, 0.2);
}
.wizard-step.active .wizard-step-label { color: var(--brand-primary, #0d9488); font-weight: 600; }
.wizard-step.completed .wizard-step-circle {
    background: var(--brand-primary, #0d9488);
    color: #fff;
    border-color: var(--brand-primary, #0d9488);
}
.wizard-step.completed::after { background: var(--brand-primary, #0d9488); }

/* --- Auto Status Card --- */
.auto-status-card {
    border-radius: 12px;
    padding: 1.25rem;
    background: var(--bg-primary, #fff);
    border: 1px solid var(--border-color, #e2e8f0);
    transition: box-shadow 0.2s ease;
}
.auto-status-card:hover { box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06); }
.auto-status-card .auto-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: #fff;
}
.auto-status-card .auto-icon.bg-success { background: linear-gradient(135deg, #10b981, #059669); }
.auto-status-card .auto-icon.bg-danger { background: linear-gradient(135deg, #ef4444, #dc2626); }
.auto-status-card .auto-icon.bg-warning { background: linear-gradient(135deg, #f59e0b, #d97706); }
.auto-status-card .auto-icon.bg-info { background: linear-gradient(135deg, #3b82f6, #2563eb); }

/* --- Dark mode: Cartera + Wizard + AutoStatus --- */
[data-theme="dark"] .cartera-aging-bar { background: var(--bg-surface); }
[data-theme="dark"] .cartera-valor-badge.pendiente { background: rgba(245, 158, 11, 0.25); color: #fbbf24; }
[data-theme="dark"] .cartera-valor-badge.mora { background: rgba(239, 68, 68, 0.25); color: #f87171; }
[data-theme="dark"] .cartera-dias-badge.leve { background: var(--bg-surface); color: var(--text-secondary); }
[data-theme="dark"] .cartera-dias-badge.moderado { background: rgba(245, 158, 11, 0.25); color: #fbbf24; }
[data-theme="dark"] .cartera-dias-badge.critico { background: rgba(239, 68, 68, 0.25); color: #f87171; }
[data-theme="dark"] .wizard-step-circle { background: var(--bg-surface); border-color: var(--border-color); }
[data-theme="dark"] .wizard-step::after { background: var(--border-color); }
[data-theme="dark"] .auto-status-card { background: var(--bg-surface); border-color: var(--border-color); }

/* --- Responsive: Wizard --- */
@media (max-width: 576px) {
    .wizard-steps { gap: 0.25rem; }
    .wizard-step-circle { width: 28px; height: 28px; font-size: 0.75rem; }
    .wizard-step-label { font-size: 0.6rem; }
    .wizard-step::after { top: 14px; }
}

/* =====================================================
 * PHASE 18: MÓDULO NÓMINA - Premium Components
 * Payroll dashboard, calculation cards, payslip design
 * =====================================================
 */

/* --- Nomina Dashboard Layout --- */
.nomina-dashboard { padding: 0; }
.nomina-stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.nomina-stat-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0.2s, box-shadow 0.2s;
}
.nomina-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.15);
}

.nomina-stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: #fff;
    flex-shrink: 0;
}
.nomina-stat-icon.bg-salario { background: linear-gradient(135deg, #0d9488, #14b8a6); }
.nomina-stat-icon.bg-empleados { background: linear-gradient(135deg, #3b82f6, #60a5fa); }
.nomina-stat-icon.bg-deducciones { background: linear-gradient(135deg, #f59e0b, #fbbf24); }
.nomina-stat-icon.bg-neto { background: linear-gradient(135deg, #10b981, #34d399); }
.nomina-stat-icon.bg-costo { background: linear-gradient(135deg, #8b5cf6, #a78bfa); }
.nomina-stat-icon.bg-novedad { background: linear-gradient(135deg, #ef4444, #f87171); }

.nomina-stat-info { flex: 1; min-width: 0; }
.nomina-stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
}
.nomina-stat-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-top: 0.15rem;
}
.nomina-stat-trend {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 20px;
    display: inline-block;
    margin-top: 0.25rem;
}
.nomina-stat-trend.up { background: rgba(16, 185, 129, 0.15); color: #059669; }
.nomina-stat-trend.down { background: rgba(239, 68, 68, 0.15); color: #dc2626; }
.nomina-stat-trend.neutral { background: rgba(107, 114, 128, 0.15); color: #6b7280; }

/* --- Nomina Periodo Selector --- */
.nomina-periodo-selector {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    margin-bottom: 1rem;
}
.nomina-periodo-selector label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
}
.nomina-periodo-selector select,
.nomina-periodo-selector input[type="month"] {
    background: var(--bg-surface, #f8fafc);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
    color: var(--text-primary);
}

/* --- Nomina Payslip / Desprendible --- */
.payslip-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 1rem;
}
.payslip-header {
    background: linear-gradient(135deg, #0d9488, #14b8a6);
    color: #fff;
    padding: 1rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.payslip-header h4 { margin: 0; font-size: 1rem; font-weight: 700; color: #fff; }
.payslip-header .payslip-periodo {
    font-size: 0.8rem;
    background: rgba(255,255,255,0.2);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
}
.payslip-body { padding: 1.25rem; }
.payslip-section { margin-bottom: 1rem; }
.payslip-section-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--brand-primary, #0d9488);
    padding-bottom: 0.4rem;
    margin-bottom: 0.75rem;
}

.payslip-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.35rem 0;
    font-size: 0.85rem;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}
.payslip-row:last-child { border-bottom: none; }
.payslip-row .label { color: var(--text-secondary); }
.payslip-row .value { font-weight: 600; color: var(--text-primary); }
.payslip-row .value.money { color: var(--brand-primary, #0d9488); }
.payslip-row .value.deduction { color: #ef4444; }

.payslip-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.25rem;
    background: linear-gradient(135deg, rgba(13, 148, 136, 0.08), rgba(20, 184, 166, 0.04));
    border-top: 2px solid var(--brand-primary, #0d9488);
    font-weight: 800;
    font-size: 1.1rem;
}
.payslip-total .total-label { color: var(--text-primary); }
.payslip-total .total-value { color: var(--brand-primary, #0d9488); }

/* --- Nomina Process Steps --- */
.nomina-process-steps {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}
.nomina-step {
    flex: 1;
    min-width: 120px;
    padding: 0.75rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}
.nomina-step.active {
    border-color: var(--brand-primary, #0d9488);
    background: linear-gradient(135deg, rgba(13, 148, 136, 0.08), rgba(20, 184, 166, 0.04));
}
.nomina-step.completed {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.08);
}
.nomina-step-number {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--border-color);
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: 0.4rem;
}
.nomina-step.active .nomina-step-number {
    background: var(--brand-primary, #0d9488);
    color: #fff;
}
.nomina-step.completed .nomina-step-number {
    background: #10b981;
    color: #fff;
}
.nomina-step-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
}
.nomina-step.active .nomina-step-label { color: var(--brand-primary, #0d9488); }

/* --- Novedades Badge --- */
.novedad-tipo-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}
.novedad-tipo-badge.incapacidad { background: rgba(239, 68, 68, 0.12); color: #dc2626; }
.novedad-tipo-badge.hora-extra { background: rgba(59, 130, 246, 0.12); color: #2563eb; }
.novedad-tipo-badge.licencia { background: rgba(245, 158, 11, 0.12); color: #d97706; }
.novedad-tipo-badge.vacaciones { background: rgba(16, 185, 129, 0.12); color: #059669; }
.novedad-tipo-badge.prima { background: rgba(139, 92, 246, 0.12); color: #7c3aed; }
.novedad-tipo-badge.comision { background: rgba(236, 72, 153, 0.12); color: #db2777; }
.novedad-tipo-badge.bonificacion { background: rgba(13, 148, 136, 0.12); color: #0d9488; }

/* =====================================================
 * PHASE 19: MÓDULO SST - Premium Components
 * Risk matrix, indicators, COPASST, emergency plans
 * =====================================================
 */

/* --- SST Dashboard Stats --- */
.sst-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.sst-stat-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    position: relative;
    overflow: hidden;
}
.sst-stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: 12px 12px 0 0;
}
.sst-stat-card.card-safe::before { background: linear-gradient(90deg, #10b981, #34d399); }
.sst-stat-card.card-warning::before { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.sst-stat-card.card-danger::before { background: linear-gradient(90deg, #ef4444, #f87171); }
.sst-stat-card.card-info::before { background: linear-gradient(90deg, #3b82f6, #60a5fa); }

.sst-stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
}
.sst-stat-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

/* --- SST Risk Matrix (GTC-45) --- */
.risk-matrix-container {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}
.risk-matrix-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.risk-matrix-title i { color: var(--brand-primary, #0d9488); }

.risk-matrix-grid {
    display: grid;
    grid-template-columns: auto repeat(4, 1fr);
    gap: 2px;
    font-size: 0.75rem;
}
.risk-matrix-cell {
    padding: 0.5rem;
    text-align: center;
    font-weight: 600;
    border-radius: 4px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.risk-matrix-header {
    background: var(--bg-surface, #f1f5f9);
    color: var(--text-secondary);
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.risk-cell-I { background: #dc2626; color: #fff; }
.risk-cell-II { background: #f59e0b; color: #fff; }
.risk-cell-III { background: #3b82f6; color: #fff; }
.risk-cell-IV { background: #22c55e; color: #fff; }

/* --- SST Risk Level Badges --- */
.risk-level-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}
.risk-level-badge.nivel-I { background: rgba(220, 38, 38, 0.15); color: #dc2626; }
.risk-level-badge.nivel-II { background: rgba(245, 158, 11, 0.15); color: #d97706; }
.risk-level-badge.nivel-III { background: rgba(59, 130, 246, 0.15); color: #2563eb; }
.risk-level-badge.nivel-IV { background: rgba(34, 197, 94, 0.15); color: #16a34a; }

.risk-level-badge .risk-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}
.risk-level-badge.nivel-I .risk-dot { background: #dc2626; }
.risk-level-badge.nivel-II .risk-dot { background: #f59e0b; }
.risk-level-badge.nivel-III .risk-dot { background: #3b82f6; }
.risk-level-badge.nivel-IV .risk-dot { background: #22c55e; }

/* --- SST Indicator Cards --- */
.sst-indicator-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    text-align: center;
}
.sst-indicator-value {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.2;
}
.sst-indicator-value.safe { color: #10b981; }
.sst-indicator-value.warning { color: #f59e0b; }
.sst-indicator-value.danger { color: #ef4444; }
.sst-indicator-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 0.25rem;
}
.sst-indicator-meta {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 0.15rem;
}
.sst-indicator-bar {
    height: 4px;
    border-radius: 2px;
    background: var(--bg-surface, #e2e8f0);
    margin-top: 0.75rem;
    overflow: hidden;
}
.sst-indicator-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.6s ease;
}
.sst-indicator-bar-fill.safe { background: linear-gradient(90deg, #10b981, #34d399); }
.sst-indicator-bar-fill.warning { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.sst-indicator-bar-fill.danger { background: linear-gradient(90deg, #ef4444, #f87171); }

/* --- SST PHVA Score (Estandares Minimos) --- */
.phva-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}
.phva-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
    position: relative;
}
.phva-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: 12px 12px 0 0;
}
.phva-card.planear::before { background: #3b82f6; }
.phva-card.hacer::before { background: #10b981; }
.phva-card.verificar::before { background: #f59e0b; }
.phva-card.actuar::before { background: #8b5cf6; }

.phva-letter {
    font-size: 1.5rem;
    font-weight: 900;
    line-height: 1;
}
.phva-card.planear .phva-letter { color: #3b82f6; }
.phva-card.hacer .phva-letter { color: #10b981; }
.phva-card.verificar .phva-letter { color: #f59e0b; }
.phva-card.actuar .phva-letter { color: #8b5cf6; }

.phva-label {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}
.phva-score {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-top: 0.5rem;
}
.phva-weight {
    font-size: 0.65rem;
    color: var(--text-secondary);
}

/* --- SST COPASST Timeline --- */
.copasst-timeline {
    position: relative;
    padding-left: 2rem;
}
.copasst-timeline::before {
    content: '';
    position: absolute;
    left: 0.75rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-color);
}
.copasst-item {
    position: relative;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
}
.copasst-item::before {
    content: '';
    position: absolute;
    left: -1.65rem;
    top: 1.25rem;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--brand-primary, #0d9488);
    border: 2px solid var(--bg-primary);
}
.copasst-item.reunion-pendiente::before { background: #f59e0b; }
.copasst-item.reunion-realizada::before { background: #10b981; }

/* --- SST EPP Status --- */
.epp-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
}
.epp-status-badge.vigente { background: rgba(16, 185, 129, 0.12); color: #059669; }
.epp-status-badge.por-vencer { background: rgba(245, 158, 11, 0.12); color: #d97706; }
.epp-status-badge.vencido { background: rgba(239, 68, 68, 0.12); color: #dc2626; }

/* =====================================================
 * PHASE 20: MÓDULO INCAPACIDADES - Premium Components
 * Disability tracking, cobro/recobro, CIE-10
 * =====================================================
 */

/* --- Incapacidad Status Timeline --- */
.incapacidad-timeline {
    display: flex;
    gap: 0;
    margin-bottom: 1.5rem;
    position: relative;
}
.incapacidad-timeline::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--border-color);
    z-index: 0;
}
.incapacidad-stage {
    flex: 1;
    text-align: center;
    position: relative;
    z-index: 1;
}
.incapacidad-stage-dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-primary);
    border: 3px solid var(--border-color);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    transition: all 0.3s;
    margin-bottom: 0.5rem;
}
.incapacidad-stage.active .incapacidad-stage-dot {
    border-color: var(--brand-primary, #0d9488);
    background: var(--brand-primary, #0d9488);
    color: #fff;
}
.incapacidad-stage.completed .incapacidad-stage-dot {
    border-color: #10b981;
    background: #10b981;
    color: #fff;
}
.incapacidad-stage-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
}
.incapacidad-stage.active .incapacidad-stage-label { color: var(--brand-primary, #0d9488); }

/* --- Incapacidad Card --- */
.incapacidad-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 1rem;
    transition: transform 0.2s, box-shadow 0.2s;
}
.incapacidad-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.incapacidad-card-header {
    padding: 0.75rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}
.incapacidad-tipo-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}
.incapacidad-tipo-badge.general { background: rgba(59, 130, 246, 0.12); color: #2563eb; }
.incapacidad-tipo-badge.laboral { background: rgba(239, 68, 68, 0.12); color: #dc2626; }
.incapacidad-tipo-badge.maternidad { background: rgba(236, 72, 153, 0.12); color: #db2777; }
.incapacidad-tipo-badge.paternidad { background: rgba(139, 92, 246, 0.12); color: #7c3aed; }

.incapacidad-card-body {
    padding: 1rem 1.25rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
}
.incapacidad-info-item { }
.incapacidad-info-label {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-secondary);
}
.incapacidad-info-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* --- Incapacidad Payment Breakdown --- */
.incapacidad-pago-breakdown {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, rgba(13, 148, 136, 0.04), rgba(20, 184, 166, 0.02));
    border-top: 1px solid var(--border-color);
}
.pago-segment {
    text-align: center;
    padding: 0.5rem;
    border-radius: 8px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
}
.pago-segment-label {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
}
.pago-segment-dias {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-primary);
}
.pago-segment-valor {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--brand-primary, #0d9488);
}
.pago-segment-responsable {
    font-size: 0.6rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* --- Cobro/Recobro Status --- */
.recobro-status {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
}
.recobro-status.pendiente { background: rgba(245, 158, 11, 0.12); color: #d97706; }
.recobro-status.radicado { background: rgba(59, 130, 246, 0.12); color: #2563eb; }
.recobro-status.aprobado { background: rgba(16, 185, 129, 0.12); color: #059669; }
.recobro-status.rechazado { background: rgba(239, 68, 68, 0.12); color: #dc2626; }
.recobro-status.pagado { background: rgba(13, 148, 136, 0.12); color: #0d9488; }

/* --- CIE-10 Search --- */
.cie10-search {
    position: relative;
    margin-bottom: 1rem;
}
.cie10-search input {
    width: 100%;
    padding: 0.6rem 1rem 0.6rem 2.5rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 0.85rem;
    color: var(--text-primary);
}
.cie10-search i {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}
.cie10-results {
    max-height: 200px;
    overflow-y: auto;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 0 0 10px 10px;
    display: none;
}
.cie10-results.active { display: block; }
.cie10-result-item {
    padding: 0.5rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    font-size: 0.8rem;
    transition: background 0.15s;
}
.cie10-result-item:hover { background: rgba(13, 148, 136, 0.06); }
.cie10-result-item .code {
    font-weight: 700;
    color: var(--brand-primary, #0d9488);
    margin-right: 0.5rem;
}

/* =====================================================
 * PHASE 18-20: DARK MODE OVERRIDES
 * =====================================================
 */

/* --- Dark Mode: Nomina --- */
[data-theme="dark"] .nomina-stat-card { background: var(--bg-surface); border-color: var(--border-color); }
[data-theme="dark"] .nomina-periodo-selector { background: var(--bg-surface); }
[data-theme="dark"] .nomina-periodo-selector select,
[data-theme="dark"] .nomina-periodo-selector input[type="month"] { background: var(--bg-primary); color: var(--text-primary); }
[data-theme="dark"] .payslip-card { background: var(--bg-surface); }
[data-theme="dark"] .payslip-body { background: var(--bg-surface); }
[data-theme="dark"] .payslip-row { border-color: rgba(255,255,255,0.05); }
[data-theme="dark"] .payslip-total { background: linear-gradient(135deg, rgba(13, 148, 136, 0.15), rgba(20, 184, 166, 0.08)); }
[data-theme="dark"] .nomina-step { background: var(--bg-surface); border-color: var(--border-color); }
[data-theme="dark"] .nomina-step-number { background: var(--bg-primary); }
[data-theme="dark"] .novedad-tipo-badge.incapacidad { background: rgba(239, 68, 68, 0.2); }
[data-theme="dark"] .novedad-tipo-badge.hora-extra { background: rgba(59, 130, 246, 0.2); }
[data-theme="dark"] .novedad-tipo-badge.vacaciones { background: rgba(16, 185, 129, 0.2); }

/* --- Dark Mode: SST --- */
[data-theme="dark"] .sst-stat-card { background: var(--bg-surface); border-color: var(--border-color); }
[data-theme="dark"] .risk-matrix-container { background: var(--bg-surface); }
[data-theme="dark"] .risk-matrix-header { background: var(--bg-primary); }
[data-theme="dark"] .sst-indicator-card { background: var(--bg-surface); }
[data-theme="dark"] .sst-indicator-bar { background: var(--bg-primary); }
[data-theme="dark"] .phva-card { background: var(--bg-surface); border-color: var(--border-color); }
[data-theme="dark"] .copasst-item { background: var(--bg-surface); border-color: var(--border-color); }
[data-theme="dark"] .copasst-timeline::before { background: var(--border-color); }
[data-theme="dark"] .copasst-item::before { border-color: var(--bg-surface); }
[data-theme="dark"] .epp-status-badge.vigente { background: rgba(16, 185, 129, 0.2); }
[data-theme="dark"] .epp-status-badge.por-vencer { background: rgba(245, 158, 11, 0.2); }
[data-theme="dark"] .epp-status-badge.vencido { background: rgba(239, 68, 68, 0.2); }

/* --- Dark Mode: Incapacidades --- */
[data-theme="dark"] .incapacidad-card { background: var(--bg-surface); border-color: var(--border-color); }
[data-theme="dark"] .incapacidad-card-header { border-color: var(--border-color); }
[data-theme="dark"] .incapacidad-stage-dot { background: var(--bg-surface); border-color: var(--border-color); }
[data-theme="dark"] .incapacidad-pago-breakdown { background: linear-gradient(135deg, rgba(13, 148, 136, 0.08), rgba(20, 184, 166, 0.04)); }
[data-theme="dark"] .pago-segment { background: var(--bg-primary); border-color: var(--border-color); }
[data-theme="dark"] .cie10-search input { background: var(--bg-surface); border-color: var(--border-color); }
[data-theme="dark"] .cie10-results { background: var(--bg-surface); border-color: var(--border-color); }
[data-theme="dark"] .cie10-result-item { border-color: rgba(255,255,255,0.05); }
[data-theme="dark"] .cie10-result-item:hover { background: rgba(13, 148, 136, 0.12); }
[data-theme="dark"] .recobro-status.pendiente { background: rgba(245, 158, 11, 0.2); }
[data-theme="dark"] .recobro-status.aprobado { background: rgba(16, 185, 129, 0.2); }
[data-theme="dark"] .recobro-status.rechazado { background: rgba(239, 68, 68, 0.2); }

/* =====================================================
 * PHASE 18-20: RESPONSIVE BREAKPOINTS
 * =====================================================
 */
@media (max-width: 992px) {
    .nomina-stats-row { grid-template-columns: repeat(2, 1fr); }
    .sst-stats-grid { grid-template-columns: repeat(2, 1fr); }
    .phva-container { grid-template-columns: repeat(2, 1fr); }
    .incapacidad-card-body { grid-template-columns: 1fr 1fr; }
    .incapacidad-pago-breakdown { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
    .nomina-stats-row { grid-template-columns: 1fr 1fr; }
    .nomina-process-steps { flex-wrap: nowrap; overflow-x: auto; }
    .risk-matrix-grid { font-size: 0.65rem; }
    .incapacidad-timeline { flex-direction: column; gap: 0.5rem; }
    .incapacidad-timeline::after { display: none; }
}
@media (max-width: 576px) {
    .nomina-stats-row { grid-template-columns: 1fr; }
    .sst-stats-grid { grid-template-columns: 1fr; }
    .phva-container { grid-template-columns: 1fr 1fr; }
    .nomina-stat-card { padding: 1rem; }
    .nomina-stat-value { font-size: 1.25rem; }
    .incapacidad-card-body { grid-template-columns: 1fr; }
    .incapacidad-pago-breakdown { grid-template-columns: 1fr; }
    .payslip-header { flex-direction: column; gap: 0.5rem; text-align: center; }
}

/* =============================================================================
   PHASE 21: CRM ENGAGED ONE - Pipeline, Dashboard, WhatsApp, Chat, Timeline
   ============================================================================= */

/* --- Pipeline Kanban --- */
.pipeline-container {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.75rem;
    padding: 1rem 0;
    overflow-x: auto;
    min-height: 400px;
}
.pipeline-stage {
    background: var(--bg-primary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    min-width: 220px;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 250px);
}
.pipeline-stage-header {
    padding: 0.75rem 1rem;
    border-radius: 12px 12px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 2;
}
.pipeline-stage-header .stage-count {
    background: rgba(255,255,255,0.25);
    border-radius: 50%;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 800;
}
.pipeline-stage.stage-prospecto .pipeline-stage-header { background: linear-gradient(135deg, #6366f1, #818cf8); }
.pipeline-stage.stage-calificado .pipeline-stage-header { background: linear-gradient(135deg, #0d9488, #14b8a6); }
.pipeline-stage.stage-propuesta .pipeline-stage-header { background: linear-gradient(135deg, #f59e0b, #fbbf24); }
.pipeline-stage.stage-negociacion .pipeline-stage-header { background: linear-gradient(135deg, #3b82f6, #60a5fa); }
.pipeline-stage.stage-cerrado_ganado .pipeline-stage-header { background: linear-gradient(135deg, #10b981, #34d399); }
.pipeline-stage.stage-cerrado_perdido .pipeline-stage-header { background: linear-gradient(135deg, #ef4444, #f87171); }

.pipeline-stage-body {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.pipeline-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.75rem;
    cursor: grab;
    transition: all 0.2s ease;
    position: relative;
}
.pipeline-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-color: var(--brand-primary);
}
.pipeline-card:active { cursor: grabbing; }
.pipeline-card.dragging {
    opacity: 0.5;
    transform: rotate(3deg);
}
.pipeline-card-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}
.pipeline-card-empresa {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}
.pipeline-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}
.pipeline-card-score {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 20px;
    background: rgba(13, 148, 136, 0.1);
    color: var(--brand-primary);
}
.pipeline-card-score.score-high { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.pipeline-card-score.score-medium { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.pipeline-card-score.score-low { background: rgba(239, 68, 68, 0.15); color: #ef4444; }
.pipeline-card-date {
    font-size: 0.7rem;
    color: var(--text-secondary);
}
.pipeline-card-asesor {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-primary), #14b8a6);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
}
.pipeline-drop-zone {
    border: 2px dashed var(--brand-primary);
    border-radius: 10px;
    padding: 1.5rem;
    text-align: center;
    color: var(--brand-primary);
    opacity: 0;
    transition: opacity 0.2s ease;
    font-size: 0.8rem;
}
.pipeline-stage.drag-over .pipeline-drop-zone { opacity: 1; }
.pipeline-stage.drag-over { background: rgba(13, 148, 136, 0.03); }

/* Pipeline Filters */
.pipeline-filters {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
    padding: 0.75rem 1rem;
    background: var(--bg-primary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    margin-bottom: 1rem;
}
.pipeline-filters .form-control,
.pipeline-filters .form-select {
    max-width: 220px;
    font-size: 0.85rem;
    border-radius: 8px;
}
.pipeline-filters .btn-limpiar {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: 8px;
    font-size: 0.8rem;
    padding: 0.375rem 0.75rem;
    transition: all 0.2s ease;
}
.pipeline-filters .btn-limpiar:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* --- CRM Dashboard Stats --- */
.crm-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.crm-stat-card {
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 1.25rem;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.3s ease;
}
.crm-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}
.crm-stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: #fff;
    flex-shrink: 0;
}
.crm-stat-icon.icon-primary { background: linear-gradient(135deg, #0d9488, #14b8a6); }
.crm-stat-icon.icon-success { background: linear-gradient(135deg, #10b981, #34d399); }
.crm-stat-icon.icon-warning { background: linear-gradient(135deg, #f59e0b, #fbbf24); }
.crm-stat-icon.icon-info { background: linear-gradient(135deg, #3b82f6, #60a5fa); }
.crm-stat-icon.icon-danger { background: linear-gradient(135deg, #ef4444, #f87171); }
.crm-stat-icon.icon-purple { background: linear-gradient(135deg, #8b5cf6, #a78bfa); }
.crm-stat-content { flex: 1; }
.crm-stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
}
.crm-stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 0.15rem;
}
.crm-stat-trend {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 20px;
}
.crm-stat-trend.up { background: rgba(16,185,129,0.1); color: #10b981; }
.crm-stat-trend.down { background: rgba(239,68,68,0.1); color: #ef4444; }
.crm-stat-trend.neutral { background: rgba(100,116,139,0.1); color: #64748b; }

/* CRM Conversion Funnel */
.crm-conversion-funnel {
    background: var(--bg-primary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    padding: 1.5rem;
}
.crm-funnel-step {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}
.crm-funnel-step:last-child { border-bottom: none; }
.crm-funnel-bar {
    flex: 1;
    height: 32px;
    border-radius: 8px;
    background: var(--bg-secondary);
    overflow: hidden;
    position: relative;
}
.crm-funnel-fill {
    height: 100%;
    border-radius: 8px;
    transition: width 0.6s ease;
    display: flex;
    align-items: center;
    padding-left: 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
}
.crm-funnel-label {
    width: 120px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    flex-shrink: 0;
}
.crm-funnel-value {
    width: 60px;
    text-align: right;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    flex-shrink: 0;
}

/* CRM Chart Card */
.crm-chart-card {
    background: var(--bg-primary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}
.crm-chart-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.crm-chart-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.crm-chart-title i { color: var(--brand-primary); }
.crm-chart-body { padding: 1rem 1.25rem; }

/* --- WhatsApp Chat --- */
.whatsapp-chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 200px);
    max-height: 700px;
    background: var(--bg-primary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}
.whatsapp-chat-header {
    background: linear-gradient(135deg, #25d366, #128c7e);
    color: #fff;
    padding: 0.75rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.whatsapp-chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}
.whatsapp-chat-info { flex: 1; }
.whatsapp-chat-name { font-weight: 700; font-size: 0.95rem; }
.whatsapp-chat-status { font-size: 0.75rem; opacity: 0.85; }
.whatsapp-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: #e5ddd5;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
[data-theme="dark"] .whatsapp-messages { background: #0b141a; }
.whatsapp-message {
    max-width: 75%;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    font-size: 0.875rem;
    line-height: 1.4;
    position: relative;
}
.whatsapp-message.sent {
    align-self: flex-end;
    background: #dcf8c6;
    color: #303030;
    border-bottom-right-radius: 2px;
}
[data-theme="dark"] .whatsapp-message.sent { background: #005c4b; color: #e9edef; }
.whatsapp-message.received {
    align-self: flex-start;
    background: #fff;
    color: #303030;
    border-bottom-left-radius: 2px;
}
[data-theme="dark"] .whatsapp-message.received { background: #202c33; color: #e9edef; }
.whatsapp-message-time {
    font-size: 0.65rem;
    color: #667781;
    text-align: right;
    margin-top: 0.25rem;
}
.whatsapp-message-status { font-size: 0.7rem; color: #53bdeb; margin-left: 0.25rem; }
.whatsapp-input-area {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
}
.whatsapp-input-area input {
    flex: 1;
    border: none;
    background: var(--bg-primary);
    border-radius: 20px;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    color: var(--text-primary);
    outline: none;
}
.whatsapp-input-area .btn-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #25d366, #128c7e);
    border: none;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease;
}
.whatsapp-input-area .btn-send:hover { transform: scale(1.08); }

/* WhatsApp Config Panel */
.whatsapp-config-panel {
    background: var(--bg-primary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    padding: 1.5rem;
}
.whatsapp-config-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}
.whatsapp-config-section:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }
.whatsapp-config-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.whatsapp-config-title i { color: #25d366; }
.whatsapp-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}
.whatsapp-status-badge.connected { background: rgba(37,211,102,0.1); color: #25d366; }
.whatsapp-status-badge.disconnected { background: rgba(239,68,68,0.1); color: #ef4444; }
.whatsapp-status-badge .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}

/* --- Chat Widget --- */
.chat-widget-floating {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
}
.chat-widget-trigger {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-primary), #14b8a6);
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(13, 148, 136, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}
.chat-widget-trigger:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 28px rgba(13, 148, 136, 0.5);
}
.chat-widget-trigger .badge-unread {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #ef4444;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-primary);
}
.chat-widget-window {
    position: fixed;
    bottom: 96px;
    right: 24px;
    width: 380px;
    height: 520px;
    background: var(--bg-primary);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: 0 16px 48px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 9998;
    transform: scale(0.9) translateY(20px);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.chat-widget-window.open {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: all;
}
.chat-widget-header {
    background: linear-gradient(135deg, var(--brand-primary), #14b8a6);
    color: #fff;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.chat-widget-header-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}
.chat-widget-header-info { flex: 1; }
.chat-widget-header-name { font-weight: 700; font-size: 0.9rem; }
.chat-widget-header-status { font-size: 0.7rem; opacity: 0.85; display: flex; align-items: center; gap: 0.35rem; }
.chat-widget-header-status .online-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #34d399;
}
.chat-widget-close {
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}
.chat-widget-close:hover { background: rgba(255,255,255,0.3); }
.chat-widget-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: var(--bg-secondary);
}
.chat-widget-msg {
    max-width: 80%;
    padding: 0.625rem 0.875rem;
    border-radius: 12px;
    font-size: 0.85rem;
    line-height: 1.4;
}
.chat-widget-msg.bot {
    align-self: flex-start;
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 4px;
}
.chat-widget-msg.user {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--brand-primary), #14b8a6);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.chat-widget-msg-time {
    font-size: 0.6rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}
.chat-widget-input {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-primary);
}
.chat-widget-input input {
    flex: 1;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.2s ease;
}
.chat-widget-input input:focus { border-color: var(--brand-primary); }
.chat-widget-input .btn-send {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-primary), #14b8a6);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}
.chat-widget-input .btn-send:hover { transform: scale(1.08); }

/* --- Interaction Timeline --- */
.interaction-timeline {
    position: relative;
    padding-left: 2rem;
}
.interaction-timeline::before {
    content: '';
    position: absolute;
    left: 15px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-color);
}
.interaction-item {
    position: relative;
    padding: 0.75rem 0 0.75rem 1.5rem;
    border-bottom: 1px solid transparent;
}
.interaction-item:hover { background: rgba(13,148,136,0.02); border-radius: 8px; }
.interaction-icon {
    position: absolute;
    left: -2rem;
    top: 0.75rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: #fff;
    z-index: 1;
    border: 2px solid var(--bg-primary);
}
.interaction-icon.type-llamada { background: linear-gradient(135deg, #3b82f6, #60a5fa); }
.interaction-icon.type-email { background: linear-gradient(135deg, #f59e0b, #fbbf24); }
.interaction-icon.type-whatsapp { background: linear-gradient(135deg, #25d366, #128c7e); }
.interaction-icon.type-reunion { background: linear-gradient(135deg, #8b5cf6, #a78bfa); }
.interaction-icon.type-nota { background: linear-gradient(135deg, #64748b, #94a3b8); }
.interaction-icon.type-tarea { background: linear-gradient(135deg, #0d9488, #14b8a6); }
.interaction-icon.type-propuesta { background: linear-gradient(135deg, #ec4899, #f472b6); }
.interaction-content {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.75rem 1rem;
}
.interaction-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.35rem;
}
.interaction-type {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--brand-primary);
}
.interaction-date {
    font-size: 0.7rem;
    color: var(--text-secondary);
}
.interaction-text {
    font-size: 0.85rem;
    color: var(--text-primary);
    line-height: 1.5;
}
.interaction-meta {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}
.interaction-meta-item {
    font-size: 0.7rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}
.interaction-meta-item i { font-size: 0.65rem; }

/* --- Agent Dashboard --- */
.agent-dashboard-card {
    background: var(--bg-primary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: all 0.3s ease;
}
.agent-dashboard-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}
.agent-dashboard-header {
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}
.agent-avatar {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #fff;
    flex-shrink: 0;
}
.agent-avatar.agent-atencion { background: linear-gradient(135deg, #3b82f6, #60a5fa); }
.agent-avatar.agent-analitica { background: linear-gradient(135deg, #8b5cf6, #a78bfa); }
.agent-avatar.agent-automatizacion { background: linear-gradient(135deg, #0d9488, #14b8a6); }
.agent-info { flex: 1; }
.agent-name { font-size: 1rem; font-weight: 700; color: var(--text-primary); }
.agent-description { font-size: 0.8rem; color: var(--text-secondary); margin-top: 0.15rem; }
.agent-status {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
}
.agent-status.online { background: rgba(16,185,129,0.1); color: #10b981; }
.agent-status.offline { background: rgba(100,116,139,0.1); color: #64748b; }
.agent-status.processing { background: rgba(245,158,11,0.1); color: #f59e0b; }
.agent-status .status-pulse {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    animation: agentPulse 2s ease-in-out infinite;
}
@keyframes agentPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.3); }
}
.agent-metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.5rem;
    padding: 0 1.25rem 1.25rem;
}
.agent-metric {
    text-align: center;
    padding: 0.75rem 0.5rem;
    background: var(--bg-secondary);
    border-radius: 8px;
}
.agent-metric-value {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--brand-primary);
}
.agent-metric-label {
    font-size: 0.65rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-top: 0.15rem;
}
.agent-actions {
    padding: 0 1.25rem 1.25rem;
    display: flex;
    gap: 0.5rem;
}

/* --- Contract / Firma Digital --- */
.contract-viewer {
    background: var(--bg-primary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}
.contract-header {
    background: linear-gradient(135deg, var(--brand-primary), #14b8a6);
    color: #fff;
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.contract-header-title { font-weight: 700; font-size: 1.1rem; }
.contract-status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}
.contract-status-badge.pendiente { background: rgba(245,158,11,0.2); color: #fbbf24; }
.contract-status-badge.firmado { background: rgba(16,185,129,0.2); color: #34d399; }
.contract-status-badge.rechazado { background: rgba(239,68,68,0.2); color: #f87171; }
.contract-body { padding: 1.5rem; max-height: 500px; overflow-y: auto; }
.contract-body p { font-size: 0.9rem; line-height: 1.7; color: var(--text-primary); margin-bottom: 1rem; }
.signature-pad-container {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
}
.signature-pad {
    width: 100%;
    max-width: 500px;
    height: 200px;
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    margin: 0 auto 1rem;
    background: var(--bg-secondary);
    cursor: crosshair;
}
.signature-pad.has-signature { border-color: var(--brand-primary); border-style: solid; }
.signature-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    margin-top: 1rem;
}

/* --- Campanas Marketing --- */
.campana-card {
    background: var(--bg-primary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: all 0.3s ease;
}
.campana-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}
.campana-card-header {
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
}
.campana-card-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
}
.campana-status {
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
}
.campana-status.activa { background: rgba(16,185,129,0.1); color: #10b981; }
.campana-status.programada { background: rgba(59,130,246,0.1); color: #3b82f6; }
.campana-status.pausada { background: rgba(245,158,11,0.1); color: #f59e0b; }
.campana-status.finalizada { background: rgba(100,116,139,0.1); color: #64748b; }
.campana-card-body { padding: 1rem 1.25rem; }
.campana-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    text-align: center;
}
.campana-metric-value { font-size: 1.1rem; font-weight: 700; color: var(--brand-primary); }
.campana-metric-label { font-size: 0.65rem; color: var(--text-secondary); text-transform: uppercase; }
.campana-card-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.campana-date { font-size: 0.75rem; color: var(--text-secondary); display: flex; align-items: center; gap: 0.35rem; }

/* --- RPA Automatizaciones --- */
.rpa-flow-card {
    background: var(--bg-primary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    padding: 1.25rem;
    transition: all 0.3s ease;
}
.rpa-flow-card:hover { border-color: var(--brand-primary); box-shadow: 0 4px 16px rgba(13,148,136,0.1); }
.rpa-flow-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}
.rpa-flow-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: #fff;
    background: linear-gradient(135deg, var(--brand-primary), #14b8a6);
    flex-shrink: 0;
}
.rpa-flow-name { font-weight: 700; font-size: 0.9rem; color: var(--text-primary); }
.rpa-flow-trigger { font-size: 0.75rem; color: var(--text-secondary); display: flex; align-items: center; gap: 0.25rem; }
.rpa-flow-steps {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
    overflow-x: auto;
}
.rpa-step {
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
}
.rpa-step.active { background: rgba(13,148,136,0.1); color: var(--brand-primary); }
.rpa-step-arrow { color: var(--text-secondary); font-size: 0.6rem; }
.rpa-flow-stats {
    display: flex;
    gap: 1rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}
.rpa-flow-stat { font-size: 0.75rem; color: var(--text-secondary); display: flex; align-items: center; gap: 0.25rem; }
.rpa-flow-stat strong { color: var(--text-primary); }

/* --- MCP Integracion Web --- */
.mcp-integration-card {
    background: var(--bg-primary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    padding: 1.5rem;
}
.mcp-code-block {
    background: #1e293b;
    color: #e2e8f0;
    border-radius: 8px;
    padding: 1rem;
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 0.8rem;
    line-height: 1.6;
    overflow-x: auto;
    margin: 1rem 0;
}
.mcp-code-block .keyword { color: #c084fc; }
.mcp-code-block .string { color: #86efac; }
.mcp-code-block .comment { color: #64748b; font-style: italic; }

/* --- CRM Engaged One - Responsive --- */
@media (max-width: 1200px) {
    .pipeline-container { grid-template-columns: repeat(3, 1fr); }
    .crm-stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 992px) {
    .pipeline-container { grid-template-columns: repeat(2, 1fr); }
    .chat-widget-window { width: 340px; height: 480px; }
    .whatsapp-chat-container { height: calc(100vh - 160px); }
}
@media (max-width: 768px) {
    .pipeline-container { grid-template-columns: 1fr; }
    .crm-stats-grid { grid-template-columns: 1fr 1fr; }
    .pipeline-filters { flex-direction: column; }
    .pipeline-filters .form-control,
    .pipeline-filters .form-select { max-width: 100%; }
    .agent-metrics-grid { grid-template-columns: repeat(2, 1fr); }
    .campana-metrics { grid-template-columns: 1fr 1fr; }
    .chat-widget-window { width: calc(100vw - 32px); right: 16px; bottom: 80px; }
    .chat-widget-floating { bottom: 16px; right: 16px; }
}
@media (max-width: 576px) {
    .crm-stats-grid { grid-template-columns: 1fr; }
    .agent-metrics-grid { grid-template-columns: 1fr; }
    .campana-metrics { grid-template-columns: 1fr; }
    .rpa-flow-stats { flex-direction: column; gap: 0.5rem; }
    .chat-widget-trigger { width: 52px; height: 52px; font-size: 1.25rem; }
}

/* --- CRM Dark Mode Overrides --- */
[data-theme="dark"] .pipeline-card { border-color: var(--border-color); }
[data-theme="dark"] .pipeline-stage { border-color: var(--border-color); background: var(--bg-primary); }
[data-theme="dark"] .pipeline-filters { background: var(--bg-primary); border-color: var(--border-color); }
[data-theme="dark"] .crm-stat-card { background: var(--bg-primary); border-color: var(--border-color); }
[data-theme="dark"] .crm-chart-card { background: var(--bg-primary); border-color: var(--border-color); }
[data-theme="dark"] .crm-conversion-funnel { background: var(--bg-primary); border-color: var(--border-color); }
[data-theme="dark"] .whatsapp-chat-container { border-color: var(--border-color); }
[data-theme="dark"] .whatsapp-config-panel { background: var(--bg-primary); border-color: var(--border-color); }
[data-theme="dark"] .whatsapp-input-area input { background: var(--bg-primary); color: var(--text-primary); }
[data-theme="dark"] .chat-widget-window { background: var(--bg-primary); border-color: var(--border-color); }
[data-theme="dark"] .chat-widget-messages { background: var(--bg-primary); }
[data-theme="dark"] .chat-widget-msg.bot { background: var(--bg-secondary); border-color: var(--border-color); }
[data-theme="dark"] .chat-widget-input { background: var(--bg-primary); border-color: var(--border-color); }
[data-theme="dark"] .chat-widget-input input { background: var(--bg-secondary); color: var(--text-primary); border-color: var(--border-color); }
[data-theme="dark"] .interaction-content { background: var(--bg-primary); border-color: var(--border-color); }
[data-theme="dark"] .interaction-timeline::before { background: var(--border-color); }
[data-theme="dark"] .interaction-icon { border-color: var(--bg-primary); }
[data-theme="dark"] .agent-dashboard-card { background: var(--bg-primary); border-color: var(--border-color); }
[data-theme="dark"] .agent-metric { background: var(--bg-secondary); }
[data-theme="dark"] .contract-viewer { background: var(--bg-primary); border-color: var(--border-color); }
[data-theme="dark"] .contract-body p { color: var(--text-primary); }
[data-theme="dark"] .signature-pad { background: var(--bg-secondary); border-color: var(--border-color); }
[data-theme="dark"] .campana-card { background: var(--bg-primary); border-color: var(--border-color); }
[data-theme="dark"] .rpa-flow-card { background: var(--bg-primary); border-color: var(--border-color); }
[data-theme="dark"] .mcp-integration-card { background: var(--bg-primary); border-color: var(--border-color); }

/* =============================================
   CSS Phase 22: AGENT DETAIL PAGES PREMIUM
   ============================================= */

/* --- Card Agente Base --- */
.card-agente {
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    border: none;
    background: var(--bg-primary);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card-agente:hover {
    box-shadow: 0 8px 25px rgba(0,0,0,0.12);
}
.card-agente .card-header {
    color: #fff;
    border: none;
    padding: 1rem 1.25rem;
    font-weight: 600;
}
.card-agente .card-header h5 { margin: 0; color: #fff; }
.card-agente .card-header .badge { font-size: 0.75rem; }
.card-agente .card-body { padding: 1.25rem; }

/* Card Agente - Color Variants */
.card-agente.agente-atencion .card-header,
.card-agente .card-header.header-atencion {
    background: linear-gradient(135deg, var(--brand-primary), #14b8a6);
}
.card-agente.agente-automatizacion .card-header,
.card-agente .card-header.header-automatizacion {
    background: linear-gradient(135deg, #3498db, #2980b9);
}
.card-agente.agente-analitica .card-header,
.card-agente .card-header.header-analitica {
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
}

/* --- Stat Box --- */
.stat-box {
    color: #fff;
    border-radius: 12px;
    padding: 1.25rem;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transition: transform 0.2s ease;
    position: relative;
    overflow: hidden;
}
.stat-box::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.05);
    border-radius: 50%;
}
.stat-box:hover { transform: translateY(-3px); }
.stat-box h3 {
    margin: 0;
    font-size: 2.25rem;
    font-weight: 800;
    line-height: 1.2;
}
.stat-box p { opacity: 0.9; font-size: 0.85rem; }
.stat-box.stat-primary { background: linear-gradient(135deg, var(--brand-primary), #14b8a6); }
.stat-box.stat-blue { background: linear-gradient(135deg, #3498db, #2980b9); }
.stat-box.stat-red { background: linear-gradient(135deg, #e74c3c, #c0392b); }
.stat-box.stat-purple { background: linear-gradient(135deg, #9b59b6, #8e44ad); }
.stat-box.stat-green { background: linear-gradient(135deg, #27ae60, #2ecc71); }
.stat-box.stat-orange { background: linear-gradient(135deg, #f39c12, #e67e22); }

/* --- Chat UI (Agente Atención) --- */
.chat-container {
    height: 420px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: var(--bg-secondary);
}
.chat-input {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-primary);
}
.mensaje-usuario {
    background: linear-gradient(135deg, var(--brand-primary), #14b8a6);
    color: #fff;
    padding: 0.75rem 1rem;
    border-radius: 16px 16px 0 16px;
    margin-bottom: 0.75rem;
    max-width: 75%;
    margin-left: auto;
    box-shadow: 0 2px 8px rgba(13,148,136,0.25);
}
.mensaje-bot {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
    border-radius: 16px 16px 16px 0;
    margin-bottom: 0.75rem;
    max-width: 75%;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}
.tabla-conversaciones { max-height: 400px; overflow-y: auto; }
.btn-canal { border-radius: 20px; padding: 0.5rem 1.25rem; }

/* --- Tipo Automatización Card --- */
.tipo-auto-card {
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    background: var(--bg-primary);
}
.tipo-auto-card:hover {
    border-color: var(--brand-primary);
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(13,148,136,0.15);
}
.tipo-auto-card.activo {
    border-color: #27ae60;
    background: rgba(39,174,96,0.08);
}
.tipo-auto-card i { font-size: 2.5rem; margin-bottom: 0.75rem; display: block; }
.tipo-auto-card h6 { font-weight: 600; color: var(--text-primary); }
.tipo-auto-card p { color: var(--text-secondary); }

/* --- Timeline (Automatización) --- */
.timeline-item {
    border-left: 3px solid var(--brand-primary);
    padding-left: 1.25rem;
    margin-left: 0.75rem;
    padding-bottom: 1.25rem;
    position: relative;
}
.timeline-item:last-child { border-left-color: transparent; }
.timeline-dot {
    width: 14px;
    height: 14px;
    background: var(--brand-primary);
    border-radius: 50%;
    position: absolute;
    left: -8.5px;
    top: 0;
    box-shadow: 0 0 0 4px rgba(13,148,136,0.2);
}

/* --- Industria Card (Analítica) --- */
.industria-card {
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    background: var(--bg-primary);
    height: 100%;
}
.industria-card:hover {
    border-color: #9b59b6;
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(155,89,182,0.15);
}
.industria-card i { font-size: 2rem; margin-bottom: 0.75rem; display: block; }

/* --- Insight Card (Analítica) --- */
.insight-card {
    border-left: 4px solid #9b59b6;
    background: var(--bg-primary);
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 0 10px 10px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    transition: transform 0.2s ease;
}
.insight-card:hover { transform: translateX(4px); }

/* --- Predicción Box (Analítica) --- */
.prediccion-box {
    background: linear-gradient(135deg, #1e293b, #334155);
    color: #fff;
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
    position: relative;
    overflow: hidden;
}
.prediccion-box::before {
    content: '';
    position: absolute;
    top: -40%;
    right: -30%;
    width: 60%;
    height: 100%;
    background: rgba(155,89,182,0.1);
    border-radius: 50%;
}
.prediccion-box h2 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}
.prediccion-box h6 { opacity: 0.8; letter-spacing: 0.05em; }
.confianza-bar {
    height: 8px;
    background: rgba(255,255,255,0.15);
    border-radius: 4px;
    overflow: hidden;
}
.confianza-fill {
    height: 100%;
    background: linear-gradient(90deg, #27ae60, #2ecc71);
    border-radius: 4px;
    transition: width 0.6s ease;
}

/* --- Agent Pages Dark Mode --- */
[data-theme="dark"] .card-agente { background: var(--bg-primary); box-shadow: 0 4px 15px rgba(0,0,0,0.3); }
[data-theme="dark"] .card-agente .card-body { color: var(--text-primary); }
[data-theme="dark"] .chat-container { border-color: var(--border-color); }
[data-theme="dark"] .chat-messages { background: var(--bg-secondary); }
[data-theme="dark"] .chat-input { background: var(--bg-primary); border-color: var(--border-color); }
[data-theme="dark"] .mensaje-bot { background: var(--bg-secondary); border-color: var(--border-color); color: var(--text-primary); }
[data-theme="dark"] .tipo-auto-card { background: var(--bg-primary); border-color: var(--border-color); }
[data-theme="dark"] .tipo-auto-card.activo { background: rgba(39,174,96,0.15); border-color: #27ae60; }
[data-theme="dark"] .tipo-auto-card h6 { color: var(--text-primary); }
[data-theme="dark"] .industria-card { background: var(--bg-primary); border-color: var(--border-color); }
[data-theme="dark"] .insight-card { background: var(--bg-secondary); color: var(--text-primary); }
[data-theme="dark"] .prediccion-box { background: linear-gradient(135deg, #0f172a, #1e293b); }
[data-theme="dark"] .stat-box { box-shadow: 0 4px 12px rgba(0,0,0,0.3); }
[data-theme="dark"] .timeline-item { border-left-color: var(--brand-primary); }

/* --- Agent Pages Responsive --- */
@media (max-width: 992px) {
    .stat-box h3 { font-size: 1.75rem; }
    .prediccion-box h2 { font-size: 2.25rem; }
    .prediccion-box { padding: 1.5rem; }
}
@media (max-width: 768px) {
    .chat-container { height: 350px; }
    .mensaje-usuario, .mensaje-bot { max-width: 85%; }
    .tipo-auto-card i { font-size: 2rem; }
}
@media (max-width: 576px) {
    .stat-box { padding: 1rem; }
    .stat-box h3 { font-size: 1.5rem; }
    .prediccion-box h2 { font-size: 1.75rem; }
    .chat-container { height: 300px; }
}

/* =============================================
   CSS Phase 23: RECAUDO TOOLBAR PREMIUM
   ============================================= */

/* --- Recaudo Toolbar Card --- */
.recaudo-toolbar-card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    overflow: visible;
    margin-bottom: 1.25rem;
    background: var(--bg-primary);
}
.recaudo-toolbar-card .card-header { border-radius: 12px 12px 0 0; }
.recaudo-toolbar-header {
    background: linear-gradient(135deg, var(--brand-primary), #14b8a6);
    color: #fff;
    padding: 0.875rem 1.25rem;
    border: none;
}
.recaudo-toolbar-header h5 { color: #fff; margin: 0; font-weight: 600; }
.recaudo-toolbar-card .card-body { padding: 1.25rem; }

/* --- Actions Row (buttons) --- */
.recaudo-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.625rem;
    align-items: center;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}
.recaudo-actions .btn {
    font-size: 0.8125rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    transition: all 0.2s ease;
    white-space: nowrap;
}
.recaudo-actions .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.recaudo-actions #vista-cuenta-cobro-aliado { display: inline; }

/* --- Config Panel (concepto + cobro adicional) --- */
.recaudo-config {
    background: var(--bg-secondary);
    border-radius: 10px;
    padding: 1rem;
    border: 1px solid var(--border-color);
}
.recaudo-config-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
}
.recaudo-config-row + .recaudo-config-row { margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px dashed var(--border-color); }
.recaudo-config-item {
    flex: 1;
    min-width: 200px;
}
.recaudo-config-item label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.375rem;
    display: block;
}
.recaudo-config-item .form-control {
    border-radius: 8px;
    font-size: 0.875rem;
}
.recaudo-check-label {
    display: inline-flex !important;
    align-items: center;
    font-weight: 600 !important;
    color: var(--text-primary) !important;
    cursor: pointer;
    padding: 0.5rem 0;
}
.recaudo-cobro-adicional { align-items: flex-end; }

/* --- Counter Badge --- */
.recaudo-counter {
    background: linear-gradient(135deg, var(--brand-primary), #14b8a6);
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.8125rem;
    margin: 0.75rem 0;
    display: inline-block;
}
.recaudo-counter strong { font-size: 1rem; }

/* --- Date Group (filter rows) --- */
.recaudo-date-group {
    padding-left: 0.5rem;
    margin-right: 1rem;
}

/* --- Pagination --- */
.recaudo-pagination {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

/* --- Recaudo Dark Mode --- */
[data-theme="dark"] .recaudo-toolbar-card { background: var(--bg-primary); box-shadow: 0 4px 15px rgba(0,0,0,0.3); }
[data-theme="dark"] .recaudo-config { background: var(--bg-primary); border-color: var(--border-color); }
[data-theme="dark"] .recaudo-config-item label { color: var(--text-secondary); }
[data-theme="dark"] .recaudo-check-label { color: var(--text-primary) !important; }
[data-theme="dark"] .recaudo-actions { border-color: var(--border-color); }
[data-theme="dark"] .recaudo-pagination { border-color: var(--border-color); }

/* --- Recaudo Responsive --- */
@media (max-width: 768px) {
    .recaudo-actions { gap: 0.5rem; }
    .recaudo-actions .btn { font-size: 0.75rem; padding: 0.375rem 0.75rem; }
    .recaudo-config-row { flex-direction: column; gap: 0.75rem; }
    .recaudo-config-item { min-width: 100%; }
    .recaudo-date-group { padding-left: 0; margin-right: 0; }
}
@media (max-width: 576px) {
    .recaudo-actions { flex-direction: column; align-items: stretch; }
    .recaudo-actions .btn { justify-content: center; }
}

/* =============================================
   CSS Phase 24: RECAUDO PREMIUM - Aliado Card + Users Card + Pagination
   ============================================= */

/* --- Aliado Premium Profile Card (componente unificado) --- */
.aliado-profile-card {
    border: none;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(13,148,136,0.08), 0 1px 4px rgba(0,0,0,0.04);
    margin-bottom: 1.25rem;
    background: var(--bg-primary);
    overflow: hidden;
    position: relative;
    transition: box-shadow 0.3s ease, transform 0.2s ease;
}
.aliado-profile-card:hover {
    box-shadow: 0 8px 32px rgba(13,148,136,0.14), 0 2px 8px rgba(0,0,0,0.06);
    transform: translateY(-1px);
}
.aliado-profile-card::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--brand-primary), #14b8a6, #2dd4bf, var(--brand-primary));
    background-size: 200% 100%;
    animation: aliado-gradient-shift 4s ease infinite;
}
@keyframes aliado-gradient-shift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* Hero section */
.aliado-profile-hero {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1.5rem 1.75rem 1.25rem;
    background: linear-gradient(160deg, rgba(13,148,136,0.05) 0%, rgba(20,184,166,0.02) 50%, transparent 100%);
}
.aliado-profile-avatar {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    background: linear-gradient(145deg, var(--brand-primary), #0f766e);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(13,148,136,0.3);
    position: relative;
}
.aliado-profile-avatar i {
    color: #fff;
    font-size: 1.5rem;
}
.aliado-profile-avatar::after {
    content: "";
    position: absolute;
    bottom: -3px;
    right: -3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #10b981;
    border: 2.5px solid var(--bg-primary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.aliado-profile-identity {
    flex: 1;
    min-width: 0;
}
.aliado-profile-identity h6 {
    margin: 0 0 0.15rem;
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--text-primary);
    letter-spacing: -0.01em;
    line-height: 1.3;
}
.aliado-profile-identity .aliado-profile-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.15rem 0.6rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    background: rgba(13,148,136,0.08);
    color: var(--brand-primary);
    border: 1px solid rgba(13,148,136,0.15);
}
.aliado-profile-identity .aliado-profile-badge i {
    font-size: 0.6rem;
}

/* Tarifa highlight */
.aliado-profile-tarifa {
    text-align: center;
    flex-shrink: 0;
    padding: 0.6rem 1rem;
    border-radius: 12px;
    background: linear-gradient(145deg, rgba(13,148,136,0.06), rgba(13,148,136,0.02));
    border: 1px solid rgba(13,148,136,0.12);
    min-width: 120px;
}
.aliado-profile-tarifa-label {
    display: block;
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    font-weight: 700;
    margin-bottom: 0.15rem;
}
.aliado-profile-tarifa-value {
    font-size: 1.25rem;
    font-weight: 900;
    color: var(--brand-primary);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

/* Details grid */
.aliado-profile-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0;
    padding: 0;
    border-top: 1px solid var(--border-color);
}
.aliado-profile-detail {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.75rem;
    font-size: 0.825rem;
    color: var(--text-primary);
    border-bottom: 1px solid rgba(0,0,0,0.04);
    transition: background 0.2s ease;
}
.aliado-profile-detail:hover {
    background: rgba(13,148,136,0.02);
}
.aliado-profile-detail:last-child,
.aliado-profile-detail:nth-last-child(2) {
    border-bottom: none;
}
.aliado-profile-detail .aliado-detail-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.75rem;
}
.aliado-detail-icon.icon-email { background: rgba(59,130,246,0.08); color: #3b82f6; }
.aliado-detail-icon.icon-phone { background: rgba(16,185,129,0.08); color: #10b981; }
.aliado-detail-icon.icon-location { background: rgba(239,68,68,0.08); color: #ef4444; }
.aliado-detail-icon.icon-calendar { background: rgba(245,158,11,0.08); color: #f59e0b; }
.aliado-detail-icon.icon-city { background: rgba(139,92,246,0.08); color: #8b5cf6; }
.aliado-detail-icon.icon-birthday { background: rgba(236,72,153,0.08); color: #ec4899; }
.aliado-detail-icon.icon-doc { background: rgba(107,114,128,0.08); color: #6b7280; }
.aliado-profile-detail .aliado-detail-content {
    min-width: 0;
}
.aliado-profile-detail .aliado-detail-label {
    display: block;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 0.05rem;
}
.aliado-profile-detail .aliado-detail-value {
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

/* Legacy compatibility aliases */
.recaudo-aliado-card { /* alias */ }
.recaudo-aliado-header { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.25rem; }
.recaudo-aliado-avatar { width: 48px; height: 48px; border-radius: 50%; background: linear-gradient(135deg, var(--brand-primary), #14b8a6); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.recaudo-aliado-avatar i { color: #fff; font-size: 1.25rem; }
.recaudo-aliado-name { flex: 1; min-width: 0; }
.recaudo-aliado-name h6 { margin: 0; font-weight: 700; font-size: 1rem; color: var(--text-primary); }
.recaudo-aliado-id { font-size: 0.75rem; color: var(--text-secondary); font-weight: 500; }
.recaudo-aliado-tarifa { text-align: right; flex-shrink: 0; }
.recaudo-aliado-tarifa-label { display: block; font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-secondary); font-weight: 600; }
.recaudo-aliado-tarifa-value { font-size: 1.125rem; font-weight: 800; color: var(--brand-primary); }
.recaudo-aliado-details { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0; padding: 0; }
.recaudo-aliado-item { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 1.25rem; font-size: 0.8125rem; color: var(--text-primary); border-bottom: 1px solid var(--border-color); }
.recaudo-aliado-item:last-child, .recaudo-aliado-item:nth-last-child(2) { border-bottom: none; }
.recaudo-aliado-item i { color: var(--brand-primary); width: 16px; text-align: center; font-size: 0.75rem; flex-shrink: 0; }

/* --- Users Card (unified) --- */
.recaudo-users-card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    overflow: hidden;
    background: var(--bg-primary);
}
.recaudo-users-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1.25rem;
    background: linear-gradient(135deg, var(--brand-primary), #14b8a6);
    color: #fff;
}
.recaudo-users-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.recaudo-users-title h5 {
    color: #fff;
    font-weight: 600;
    font-size: 0.9375rem;
}
.recaudo-badge-count {
    background: rgba(255,255,255,0.2);
    padding: 0.25rem 0.625rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
}
.recaudo-users-controls {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}
.recaudo-users-controls label {
    color: rgba(255,255,255,0.8);
    font-size: 0.75rem;
    font-weight: 500;
}
.recaudo-users-controls select {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    color: #fff;
    border-radius: 6px;
    font-size: 0.8125rem;
    padding: 0.25rem 0.5rem;
}
.recaudo-users-controls select option { color: #333; background: #fff; }

/* --- Filter Bar --- */
.recaudo-filter-bar {
    padding: 0.75rem 1.25rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}
.recaudo-filter-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.625rem;
    align-items: flex-end;
}
.recaudo-filter-group + .recaudo-filter-group {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px dashed var(--border-color);
}
.recaudo-filter-item {
    flex: 0 0 auto;
    min-width: 120px;
}
.recaudo-filter-item label {
    display: block;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}
.recaudo-filter-search {
    flex: 1;
    min-width: 180px;
}
.recaudo-search-input {
    position: relative;
}
.recaudo-search-input i {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 0.75rem;
}
.recaudo-search-input input {
    padding-left: 30px !important;
}
.recaudo-filter-action {
    min-width: auto !important;
}
.recaudo-btn-consultar {
    background: linear-gradient(135deg, var(--brand-primary), #0f766e);
    color: #fff;
    border: none;
    padding: 0.375rem 1rem;
    font-size: 0.8125rem;
    font-weight: 600;
    border-radius: 6px;
    transition: all 0.2s ease;
    white-space: nowrap;
}
.recaudo-btn-consultar:hover {
    background: linear-gradient(135deg, #0f766e, #115e59);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(13, 148, 136, 0.3);
}
.recaudo-btn-consultar:active {
    transform: translateY(0);
}
.recaudo-btn-consultar i {
    font-size: 0.75rem;
}

/* --- Pagination Bar (professional numbered) --- */
.recaudo-pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.25rem;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
}
.recaudo-page-info {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}
.recaudo-page-controls {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}
.recaudo-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}
.recaudo-page-btn:hover:not(.disabled):not(.active) {
    background: rgba(13,148,136,0.08);
    border-color: var(--brand-primary);
    color: var(--brand-primary);
}
.recaudo-page-btn.active {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
    color: #fff;
    font-weight: 700;
    box-shadow: 0 2px 6px rgba(13,148,136,0.3);
}
.recaudo-page-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.recaudo-page-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    color: var(--text-secondary);
    font-size: 0.8125rem;
}

/* --- Recaudo Phase 24 Dark Mode --- */
[data-theme="dark"] .aliado-profile-card { background: var(--bg-primary); box-shadow: 0 4px 24px rgba(0,0,0,0.3), 0 1px 4px rgba(0,0,0,0.15); }
[data-theme="dark"] .aliado-profile-card::before { opacity: 0.7; }
[data-theme="dark"] .aliado-profile-hero { background: linear-gradient(160deg, rgba(13,148,136,0.1) 0%, rgba(20,184,166,0.04) 50%, transparent 100%); }
[data-theme="dark"] .aliado-profile-avatar { box-shadow: 0 4px 12px rgba(13,148,136,0.2); }
[data-theme="dark"] .aliado-profile-avatar::after { border-color: var(--bg-primary); }
[data-theme="dark"] .aliado-profile-identity .aliado-profile-badge { background: rgba(13,148,136,0.15); border-color: rgba(13,148,136,0.25); }
[data-theme="dark"] .aliado-profile-tarifa { background: rgba(13,148,136,0.1); border-color: rgba(13,148,136,0.2); }
[data-theme="dark"] .aliado-profile-details { border-color: var(--border-color); }
[data-theme="dark"] .aliado-profile-detail { border-color: rgba(255,255,255,0.04); }
[data-theme="dark"] .aliado-profile-detail:hover { background: rgba(13,148,136,0.05); }
[data-theme="dark"] .recaudo-aliado-card { background: var(--bg-primary); box-shadow: 0 2px 12px rgba(0,0,0,0.25); }
[data-theme="dark"] .recaudo-aliado-header { background: linear-gradient(135deg, rgba(13,148,136,0.12), rgba(20,184,166,0.08)); border-color: var(--border-color); }
[data-theme="dark"] .recaudo-aliado-item { border-color: var(--border-color); }
[data-theme="dark"] .recaudo-users-card { background: var(--bg-primary); box-shadow: 0 4px 15px rgba(0,0,0,0.3); }
[data-theme="dark"] .recaudo-filter-bar { background: var(--bg-secondary); border-color: var(--border-color); }
[data-theme="dark"] .recaudo-filter-group + .recaudo-filter-group { border-color: var(--border-color); }
[data-theme="dark"] .recaudo-pagination-bar { background: var(--bg-secondary); border-color: var(--border-color); }
[data-theme="dark"] .recaudo-page-btn { background: var(--bg-primary); border-color: var(--border-color); color: var(--text-primary); }
[data-theme="dark"] .recaudo-page-btn:hover:not(.disabled):not(.active) { background: rgba(13,148,136,0.15); }
[data-theme="dark"] .recaudo-page-btn.active { background: var(--brand-primary); color: #fff; }
[data-theme="dark"] .recaudo-users-controls select { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.2); }

/* --- Recaudo Phase 24 Responsive --- */
@media (max-width: 992px) {
    .aliado-profile-hero { flex-wrap: wrap; gap: 0.75rem; padding: 1.25rem 1.25rem 1rem; }
    .aliado-profile-tarifa { width: 100%; text-align: left; display: flex; gap: 0.5rem; align-items: baseline; padding: 0.5rem 0.75rem; }
    .aliado-profile-avatar { width: 50px; height: 50px; border-radius: 12px; }
    .recaudo-aliado-header { flex-wrap: wrap; }
    .recaudo-aliado-tarifa { width: 100%; text-align: left; margin-top: 0.25rem; display: flex; gap: 0.5rem; align-items: baseline; }
}
@media (max-width: 768px) {
    .recaudo-users-header { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
    .recaudo-filter-group { flex-direction: column; gap: 0.5rem; }
    .recaudo-filter-item { min-width: 100%; }
    .recaudo-pagination-bar { flex-direction: column; gap: 0.5rem; text-align: center; }
    .aliado-profile-details { grid-template-columns: 1fr; }
    .aliado-profile-detail { padding: 0.625rem 1.25rem; }
    .recaudo-aliado-details { grid-template-columns: 1fr; }
    .recaudo-aliado-item { border-bottom: 1px solid var(--border-color); }
    .recaudo-aliado-item:last-child { border-bottom: none; }
}
@media (max-width: 576px) {
    .recaudo-page-btn { min-width: 28px; height: 28px; font-size: 0.75rem; }
    .recaudo-page-info { font-size: 0.75rem; }
}

/* ==========================================
 * Phase 25: Estado de Cuenta Modal Premium
 * ========================================== */
.ec-modal { border: none; border-radius: 16px; overflow: hidden; box-shadow: 0 25px 60px rgba(0,0,0,0.15); }
.ec-header { background: linear-gradient(135deg, #0D9488, #14B8A6, #2DD4BF); color: #fff; border: none; padding: 1.25rem 1.5rem; display: flex; align-items: center; gap: 1rem; }
.ec-header .close { color: #fff; opacity: 0.8; text-shadow: none; }
.ec-header .close:hover { opacity: 1; }
.ec-header-info { flex: 1; }
.ec-header-info .modal-title { font-size: 1.25rem; font-weight: 700; margin: 0; }
.ec-header-aliado { font-size: 0.9rem; opacity: 0.9; display: block; margin-top: 2px; }
.ec-header-badge { background: rgba(255,255,255,0.2); color: #fff; font-size: 0.75rem; padding: 0.35rem 0.75rem; border-radius: 20px; }
.ec-body { padding: 1.5rem; background: var(--bg-secondary, #f8fafc); }
.ec-section { margin-bottom: 1.75rem; }
.ec-section-title { font-size: 0.95rem; font-weight: 700; color: var(--text-primary, #1e293b); margin-bottom: 1rem; padding-bottom: 0.5rem; border-bottom: 2px solid #0D9488; display: inline-block; }

/* KPI Grid */
.ec-kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.ec-kpi-card { background: var(--bg-primary, #fff); border-radius: 12px; padding: 1.25rem; display: flex; align-items: center; gap: 1rem; box-shadow: 0 2px 8px rgba(0,0,0,0.06); border-left: 4px solid transparent; transition: transform 0.2s, box-shadow 0.2s; }
.ec-kpi-card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,0.1); }
.ec-kpi-facturado { border-left-color: #3B82F6; }
.ec-kpi-recaudado { border-left-color: #10B981; }
.ec-kpi-pendiente { border-left-color: #F59E0B; }
.ec-kpi-tasa { border-left-color: #8B5CF6; }
.ec-kpi-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.25rem; color: #fff; flex-shrink: 0; }
.ec-kpi-facturado .ec-kpi-icon { background: linear-gradient(135deg, #3B82F6, #60A5FA); }
.ec-kpi-recaudado .ec-kpi-icon { background: linear-gradient(135deg, #10B981, #34D399); }
.ec-kpi-pendiente .ec-kpi-icon { background: linear-gradient(135deg, #F59E0B, #FBBF24); }
.ec-kpi-tasa .ec-kpi-icon { background: linear-gradient(135deg, #8B5CF6, #A78BFA); }
.ec-kpi-content { display: flex; flex-direction: column; min-width: 0; }
.ec-kpi-value { font-size: 1.35rem; font-weight: 800; color: var(--text-primary, #1e293b); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ec-kpi-label { font-size: 0.75rem; color: var(--text-secondary, #64748b); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }

/* Indicator Grid */
.ec-indicator-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.ec-indicator-card { background: var(--bg-primary, #fff); border-radius: 12px; overflow: hidden; display: flex; box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.ec-indicator-accent { width: 5px; flex-shrink: 0; }
.ec-ind-mora .ec-indicator-accent { background: #EF4444; }
.ec-ind-dias .ec-indicator-accent { background: #3B82F6; }
.ec-ind-cartera .ec-indicator-accent { background: #F59E0B; }
.ec-indicator-body { padding: 1rem 1.25rem; flex: 1; }
.ec-indicator-count { font-size: 2rem; font-weight: 800; color: var(--text-primary, #1e293b); display: block; line-height: 1; }
.ec-indicator-label { font-size: 0.8rem; color: var(--text-secondary, #64748b); margin: 0.25rem 0; display: block; font-weight: 600; }
.ec-indicator-value { font-size: 0.85rem; font-weight: 700; color: var(--text-primary, #1e293b); }
.ec-cartera-buckets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem; margin-top: 0.5rem; }
.ec-bucket { text-align: center; }
.ec-bucket-label { font-size: 0.65rem; color: var(--text-secondary, #64748b); display: block; font-weight: 600; }
.ec-bucket-value { font-size: 0.75rem; font-weight: 700; color: var(--text-primary, #1e293b); display: block; }

/* Tabs */
.ec-tab-bar { display: flex; gap: 0.25rem; margin-bottom: 1rem; border-bottom: 2px solid var(--border-color, #e2e8f0); padding-bottom: 0; flex-wrap: wrap; }
.ec-tab { background: none; border: none; padding: 0.6rem 1rem; font-size: 0.85rem; font-weight: 600; color: var(--text-secondary, #64748b); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; transition: all 0.2s; display: flex; align-items: center; gap: 0.4rem; }
.ec-tab:hover { color: #0D9488; }
.ec-tab.active { color: #0D9488; border-bottom-color: #0D9488; }
.ec-tab-count { background: var(--bg-secondary, #f1f5f9); padding: 0.1rem 0.5rem; border-radius: 10px; font-size: 0.7rem; }
.ec-tab.active .ec-tab-count { background: rgba(13,148,136,0.1); color: #0D9488; }

/* Table */
.ec-table { font-size: 0.85rem; margin-bottom: 0; }
.ec-table thead th { background: var(--bg-secondary, #f8fafc); color: var(--text-secondary, #64748b); font-weight: 700; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 2px solid var(--border-color, #e2e8f0); padding: 0.75rem; white-space: nowrap; }
.ec-table tbody td { padding: 0.65rem 0.75rem; vertical-align: middle; border-bottom: 1px solid var(--border-color, #f1f5f9); color: var(--text-primary, #1e293b); }
.ec-table tbody tr:hover { background: rgba(13,148,136,0.04); }

/* Pagination */
.ec-pagination { display: flex; align-items: center; justify-content: center; gap: 0.35rem; padding: 0.75rem 0; }
.ec-page-info { font-size: 0.8rem; color: var(--text-secondary, #64748b); margin-right: 0.5rem; }
.ec-page-btn { min-width: 32px; height: 32px; border: 1px solid var(--border-color, #e2e8f0); background: var(--bg-primary, #fff); color: var(--text-primary, #1e293b); border-radius: 6px; font-size: 0.8rem; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: all 0.2s; }
.ec-page-btn:hover:not(.disabled):not(.active) { background: rgba(13,148,136,0.08); border-color: #0D9488; color: #0D9488; }
.ec-page-btn.active { background: #0D9488; color: #fff; border-color: #0D9488; }
.ec-page-btn.disabled { opacity: 0.4; cursor: not-allowed; }

/* Bar Chart */
.ec-bar-chart { display: flex; flex-direction: column; gap: 0.5rem; }
.ec-bar-item { display: flex; align-items: center; gap: 0.75rem; }
.ec-bar-track { flex: 1; height: 24px; background: var(--bg-primary, #f1f5f9); border-radius: 6px; overflow: hidden; }
.ec-bar-fill { height: 100%; background: linear-gradient(90deg, #0D9488, #14B8A6); border-radius: 6px; min-width: 2px; transition: width 0.6s ease; }
.ec-bar-info { display: flex; justify-content: space-between; min-width: 180px; }
.ec-bar-label { font-size: 0.75rem; color: var(--text-secondary, #64748b); font-weight: 600; min-width: 60px; }
.ec-bar-value { font-size: 0.75rem; font-weight: 700; color: var(--text-primary, #1e293b); text-align: right; }

/* Export Bar */
.ec-export-bar { display: flex; gap: 1rem; justify-content: center; padding: 1rem 0; border-top: 1px solid var(--border-color, #e2e8f0); margin-top: 1rem; }
.ec-export-btn { padding: 0.6rem 1.5rem; border-radius: 8px; font-weight: 600; transition: all 0.2s; }
.ec-export-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }

/* Dark Mode - Estado de Cuenta */
[data-theme="dark"] .ec-modal { background: var(--bg-primary); }
[data-theme="dark"] .ec-body { background: var(--bg-primary); }
[data-theme="dark"] .ec-kpi-card { background: var(--bg-secondary); box-shadow: 0 2px 8px rgba(0,0,0,0.2); }
[data-theme="dark"] .ec-indicator-card { background: var(--bg-secondary); box-shadow: 0 2px 8px rgba(0,0,0,0.2); }
[data-theme="dark"] .ec-table thead th { background: var(--bg-secondary); }
[data-theme="dark"] .ec-table tbody td { border-bottom-color: var(--border-color); }
[data-theme="dark"] .ec-page-btn { background: var(--bg-secondary); border-color: var(--border-color); }
[data-theme="dark"] .ec-bar-track { background: var(--bg-secondary); }
[data-theme="dark"] .ec-tab-count { background: var(--bg-secondary); }
[data-theme="dark"] .ec-export-bar { border-color: var(--border-color); }
[data-theme="dark"] .ec-section-title { color: var(--text-primary); }

/* Responsive - Estado de Cuenta */
@media (max-width: 992px) {
    .ec-kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .ec-indicator-grid { grid-template-columns: 1fr; }
}
@media (max-width: 576px) {
    .ec-kpi-grid { grid-template-columns: 1fr; }
    .ec-header { flex-wrap: wrap; }
    .ec-bar-info { min-width: 120px; flex-direction: column; }
    .ec-tab-bar { gap: 0; }
    .ec-tab { padding: 0.5rem 0.6rem; font-size: 0.75rem; }
    .ec-export-bar { flex-direction: column; }
    .ec-cartera-buckets { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================
 * Phase 26: Gestor de Cartera - Detalle Aliado
 * ============================================ */
.gc-card { transition: all 0.3s ease; border-radius: 10px !important; }
.gc-card:hover { transform: translateY(-3px); box-shadow: 0 8px 25px rgba(0,0,0,0.12); }
.gc-card-badge { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; opacity: 0.9; }
.gc-card-valor { font-size: 15px; font-weight: 600; }
.gc-vista { margin-bottom: 20px; }
.gc-vista .card { border-radius: 12px; overflow: hidden; box-shadow: 0 4px 15px rgba(0,0,0,0.08); }
.gc-vista-header { border-radius: 12px 12px 0 0; }
.gc-vista-header h5 { font-weight: 600; }
.gc-stats-bar { display: flex; flex-wrap: wrap; gap: 0; background: var(--bg-primary, #f8f9fa); border-bottom: 1px solid var(--border-color, #e9ecef); padding: 12px 15px; }
.gc-stat { flex: 1; min-width: 120px; text-align: center; padding: 8px 12px; border-right: 1px solid var(--border-color, #e9ecef); }
.gc-stat:last-child { border-right: none; }
.gc-stat-label { display: block; font-size: 11px; color: #6c757d; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.gc-stat-value { display: block; font-size: 14px; font-weight: 700; color: var(--text-primary, #333); }
.gc-stat-success { color: #28a745 !important; }
.gc-stat-muted { color: #6c757d !important; }
.gc-stat-small { font-size: 11px !important; }
.gc-stat-accent-danger { border-bottom: 3px solid #dc3545; }
.gc-pagination-bar { display: flex; justify-content: space-between; align-items: center; padding: 10px 15px; border-top: 1px solid var(--border-color, #e9ecef); }
.gc-pagination-info { color: #6c757d; font-size: 13px; }
.gc-pagination-bar .btn-group .btn { padding: 4px 10px; font-size: 12px; }

/* Dark mode - Gestor de Cartera */
[data-theme="dark"] .gc-card { background: var(--bg-primary, #1e1e2d); border-color: var(--border-color, #2d2d3f); }
[data-theme="dark"] .gc-card:hover { box-shadow: 0 8px 25px rgba(0,0,0,0.3); }
[data-theme="dark"] .gc-stats-bar { background: var(--bg-primary, #1e1e2d); }
[data-theme="dark"] .gc-stat { border-right-color: var(--border-color, #2d2d3f); }
[data-theme="dark"] .gc-pagination-bar { border-top-color: var(--border-color, #2d2d3f); }
[data-theme="dark"] .gc-vista .card { background: var(--bg-primary, #1e1e2d); }

/* Responsive - Gestor de Cartera */
@media (max-width: 768px) {
    .gc-stats-bar { flex-direction: column; }
    .gc-stat { border-right: none; border-bottom: 1px solid var(--border-color, #e9ecef); min-width: 100%; text-align: left; display: flex; justify-content: space-between; }
    .gc-stat:last-child { border-bottom: none; }
    .gc-pagination-bar { flex-direction: column; gap: 8px; text-align: center; }
    .gc-vista-header .d-flex { flex-direction: column; gap: 10px; }
    .gc-vista-header .d-flex > div:last-child { text-align: center; }
}

/* =============================================
   CSS Phase 26: INGRESO-RETIRO PREMIUM
   ============================================= */

/* --- Quick Stat Card Indigo Variant --- */
.quick-stat-card.indigo::before {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
}
.quick-stat-card.indigo .quick-stat-icon {
    color: #6366f1;
    background: rgba(99,102,241,0.1);
}

/* --- Nav Card I/R Featured --- */
.nav-card.ir-featured {
    background: linear-gradient(135deg, rgba(99,102,241,0.06), rgba(139,92,246,0.04));
    border: 1px solid rgba(99,102,241,0.2);
}
.nav-card.ir-featured:hover {
    border-color: #6366f1;
    box-shadow: 0 8px 32px rgba(99,102,241,0.18);
}
.nav-card.ir-featured .nav-card-icon {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
}
.nav-card.ir-featured .featured-action-btn {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
}
.nav-card.ir-featured .featured-action-btn:hover {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    box-shadow: 0 4px 16px rgba(99,102,241,0.35);
}

/* --- Section Badge I/R --- */
.section-badge.ir-badge {
    background: rgba(99,102,241,0.12);
    color: #6366f1;
    border: 1px solid rgba(99,102,241,0.25);
}

/* --- I/R Stat Grid (Recaudo Page) --- */
.ir-stat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.ir-stat-card {
    background: var(--bg-primary, #fff);
    border-radius: 12px;
    border: 1px solid var(--border-color, #e9ecef);
    padding: 1.25rem;
    text-align: center;
    transition: all 0.3s ease;
}
.ir-stat-card:hover {
    box-shadow: 0 4px 16px rgba(99,102,241,0.12);
    border-color: rgba(99,102,241,0.3);
}
.ir-stat-card .ir-stat-icon {
    width: 42px; height: 42px; border-radius: 10px;
    display: inline-flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff; font-size: 1rem; margin-bottom: 0.75rem;
}
.ir-stat-card .ir-stat-value {
    font-size: 1.5rem; font-weight: 800; color: var(--text-primary);
}
.ir-stat-card .ir-stat-label {
    font-size: 0.72rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px;
}

/* --- I/R Plan Badge --- */
.ir-plan-badge {
    display: inline-block; padding: 0.2rem 0.6rem; border-radius: 20px;
    font-size: 0.7rem; font-weight: 700;
    background: linear-gradient(135deg, rgba(99,102,241,0.15), rgba(139,92,246,0.1));
    color: #6366f1; border: 1px solid rgba(99,102,241,0.25);
}

/* --- I/R Table Container --- */
.ir-table-container {
    background: var(--bg-primary, #fff);
    border-radius: 12px;
    border: 1px solid var(--border-color, #e9ecef);
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
.ir-table-container .table thead th {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff; font-size: 0.75rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.5px; border: none;
    padding: 0.75rem 0.6rem; white-space: nowrap;
}
.ir-table-container .table tbody td {
    font-size: 0.82rem; vertical-align: middle;
    padding: 0.65rem 0.6rem; border-bottom: 1px solid var(--border-color, #e9ecef);
}
.ir-table-container .table tbody tr:hover {
    background: rgba(99,102,241,0.04);
}

/* --- I/R Recibo Button --- */
.ir-recibo-btn {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff; border: none; padding: 0.35rem 0.85rem;
    border-radius: 8px; font-size: 0.78rem; font-weight: 600;
    cursor: pointer; transition: all 0.3s ease;
    display: inline-flex; align-items: center; gap: 0.4rem;
}
.ir-recibo-btn:hover {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    box-shadow: 0 4px 14px rgba(99,102,241,0.35);
    transform: translateY(-1px); color: #fff;
}
.ir-recibo-btn:disabled {
    opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none;
}

/* --- I/R Dark Mode --- */
[data-theme="dark"] .ir-stat-card { background: var(--bg-primary); border-color: var(--border-color); }
[data-theme="dark"] .ir-table-container { background: var(--bg-primary); border-color: var(--border-color); }
[data-theme="dark"] .nav-card.ir-featured { background: rgba(99,102,241,0.08); border-color: rgba(99,102,241,0.25); }
[data-theme="dark"] .section-badge.ir-badge { background: rgba(99,102,241,0.15); }

/* --- I/R Responsive --- */
@media (max-width: 768px) {
    .ir-stat-grid { grid-template-columns: 1fr; }
    .ir-table-container .table { font-size: 0.75rem; }
}
@media (max-width: 992px) {
    .ir-stat-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================
   ENGAGED SKELETON LOADING SYSTEM
   Prefix: esk- | Reutilizable en todas las vistas
   Bloques: card, circle, line, badge, stat, btn, sep
   ============================================ */
@keyframes eskShimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
@keyframes eskFadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Base shimmer gradient (apply to all skeleton elements) */
.esk-pulse {
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 37%, #f1f5f9 63%) !important;
    background-size: 200% 100% !important;
    animation: eskShimmer 1.4s ease-in-out infinite !important;
}

/* Card container */
.esk-card {
    background: #fff;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05), 0 4px 16px rgba(0,0,0,0.04);
    animation: eskFadeIn 0.4s ease both;
}
.esk-card:nth-child(2) { animation-delay: 0.08s; }
.esk-card:nth-child(3) { animation-delay: 0.16s; }
.esk-card:nth-child(4) { animation-delay: 0.24s; }
.esk-card:nth-child(5) { animation-delay: 0.32s; }
.esk-card:nth-child(6) { animation-delay: 0.40s; }

/* Layout helpers */
.esk-row { display: flex; align-items: center; gap: 12px; }
.esk-col { display: flex; flex-direction: column; gap: 8px; flex: 1; min-width: 0; }
.esk-grid { display: grid; gap: 10px; }
.esk-grid.g2 { grid-template-columns: 1fr 1fr; }
.esk-grid.g3 { grid-template-columns: 1fr 1fr 1fr; }
.esk-grid.g4 { grid-template-columns: repeat(4, 1fr); }
.esk-grid.g5 { grid-template-columns: repeat(5, 1fr); }

/* Circle (avatar) */
.esk-circle { width: 48px; height: 48px; border-radius: 50%; flex-shrink: 0; }
.esk-circle.sm { width: 36px; height: 36px; }
.esk-circle.lg { width: 56px; height: 56px; }

/* Line (text placeholder) */
.esk-line { height: 12px; border-radius: 6px; width: 100%; }
.esk-line.sm { height: 10px; }
.esk-line.xs { height: 8px; }
.esk-line.w80 { width: 80%; }
.esk-line.w70 { width: 70%; }
.esk-line.w60 { width: 60%; }
.esk-line.w50 { width: 50%; }
.esk-line.w40 { width: 40%; }
.esk-line.w30 { width: 30%; }

/* Badge */
.esk-badge { width: 72px; height: 24px; border-radius: 20px; flex-shrink: 0; }

/* Stat box */
.esk-stat { height: 52px; border-radius: 10px; flex: 1; }
.esk-stat.sm { height: 40px; }

/* Button placeholder */
.esk-btn { height: 36px; border-radius: 10px; flex: 1; }

/* Separator */
.esk-sep { height: 1px; background: #f1f5f9; margin: 12px 0; }

/* Card spacing (for non-grid containers like vertical lists) */
.esk-card + .esk-card { margin-top: 0.75rem; }

/* Table row placeholder */
.esk-table-row { height: 44px; border-radius: 8px; margin-bottom: 6px; }

/* Spacing helpers */
.esk-mb-sm { margin-bottom: 0.6rem; }
.esk-mb { margin-bottom: 1rem; }
.esk-mb-lg { margin-bottom: 1.4rem; }

/* Dark mode */
[data-theme="dark"] .esk-pulse {
    background: linear-gradient(90deg, #1e293b 25%, #334155 37%, #1e293b 63%) !important;
}
[data-theme="dark"] .esk-card {
    background: var(--bg-primary, #0f172a);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2), 0 4px 16px rgba(0,0,0,0.15);
}
[data-theme="dark"] .esk-sep { background: #1e293b; }

/* Responsive */
@media (max-width: 768px) {
    .esk-grid.g4, .esk-grid.g5 { grid-template-columns: repeat(2, 1fr); }
    .esk-card { padding: 1rem; }
}

/* ═══════════════════════════════════════════════════════════════════
 * Phase 27: Modal Supreme Premium - Calculo de Planilla
 * Reusable across all archivo plano / preliquidacion views
 * ═══════════════════════════════════════════════════════════════════ */

/* ── Modal Container ── */
.modal-premium-supreme .modal-content {
    border: none;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.2);
    background: var(--bg-primary, #fff);
}

/* ── Modal Header Supreme ── */
.modal-header-supreme {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #6d28d9 100%);
    padding: 28px 32px;
    border: none;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}
.modal-header-supreme::before {
    content: '';
    position: absolute;
    top: -50%; right: -20%;
    width: 200px; height: 200px;
    border-radius: 50%;
    background: rgba(255,255,255,0.06);
}
.modal-header-supreme::after {
    content: '';
    position: absolute;
    bottom: -30%; left: 10%;
    width: 120px; height: 120px;
    border-radius: 50%;
    background: rgba(255,255,255,0.04);
}
.modal-header-supreme .modal-title-supreme {
    font-family: var(--font-family, 'Inter', sans-serif);
    color: #fff;
    font-weight: 800;
    font-size: 1.35rem;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    z-index: 1;
    margin: 0;
}
.modal-header-supreme .modal-title-supreme .title-icon {
    width: 44px; height: 44px;
    border-radius: 12px;
    background: rgba(255,255,255,0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    backdrop-filter: blur(4px);
    flex-shrink: 0;
}
.modal-header-supreme .modal-subtitle-supreme {
    font-family: var(--font-family);
    color: rgba(255,255,255,0.7);
    font-size: 0.82rem;
    font-weight: 400;
    margin-top: 6px;
    position: relative;
    z-index: 1;
}
.modal-header-supreme .close-supreme {
    position: absolute;
    top: 20px; right: 24px;
    width: 36px; height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.12);
    border: none;
    color: rgba(255,255,255,0.9);
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 2;
    line-height: 1;
}
.modal-header-supreme .close-supreme:hover {
    background: rgba(255,255,255,0.25);
}

/* ── Modal Body Supreme ── */
.modal-body-supreme {
    padding: 32px;
    background: var(--bg-primary, #fff);
    max-height: 70vh;
    overflow-y: auto;
}
.modal-body-supreme::-webkit-scrollbar { width: 8px; }
.modal-body-supreme::-webkit-scrollbar-track { background: transparent; }
.modal-body-supreme::-webkit-scrollbar-thumb { background: var(--border-color, #e5e7eb); border-radius: 4px; }

/* ── Section Titles ── */
.section-title-supreme {
    font-family: var(--font-family);
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary, #1e293b);
    margin: 0 0 16px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}
.section-title-supreme .section-icon {
    width: 32px; height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
}
.section-title-supreme .section-icon.indigo { background: rgba(99,102,241,0.12); color: #6366f1; }
.section-title-supreme .section-icon.teal { background: rgba(13,148,136,0.12); color: #0d9488; }

/* ── Resumen Ejecutivo Grid ── */
.resumen-grid-supreme {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}
.resumen-card-supreme {
    background: var(--bg-primary, #fff);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 14px;
    padding: 20px;
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: all 0.3s;
}
.resumen-card-supreme::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
}
.resumen-card-supreme:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}
.resumen-card-supreme.card-indigo::before { background: linear-gradient(90deg, #6366f1, #818cf8); }
.resumen-card-supreme.card-emerald::before { background: linear-gradient(90deg, #059669, #10b981); }
.resumen-card-supreme.card-amber::before { background: linear-gradient(90deg, #d97706, #f59e0b); }
.resumen-card-supreme.card-teal::before { background: linear-gradient(90deg, #0d9488, #14b8a6); }
.resumen-card-supreme .rc-icon {
    width: 48px; height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    font-size: 1.2rem;
}
.resumen-card-supreme.card-indigo .rc-icon { background: rgba(99,102,241,0.15); color: #4f46e5; }
.resumen-card-supreme.card-emerald .rc-icon { background: rgba(5,150,105,0.15); color: #059669; }
.resumen-card-supreme.card-amber .rc-icon { background: rgba(217,119,6,0.15); color: #d97706; }
.resumen-card-supreme.card-teal .rc-icon { background: rgba(13,148,136,0.15); color: #0d9488; }
.resumen-card-supreme .rc-value {
    font-family: var(--font-family);
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-primary, #1e293b);
    line-height: 1.2;
    margin-bottom: 4px;
}
.resumen-card-supreme .rc-label {
    font-family: var(--font-family);
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary, #64748b);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ── Admin Cards Grid ── */
.admin-grid-supreme {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}
.admin-card-supreme {
    background: var(--bg-primary, #fff);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 14px;
    overflow: hidden;
    transition: all 0.3s;
}
.admin-card-supreme:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}
.admin-card-header-supreme {
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.admin-card-header-supreme .ac-icon {
    width: 34px; height: 34px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    color: #fff;
}
.admin-card-supreme.ac-eps .admin-card-header-supreme .ac-icon { background: linear-gradient(135deg, #e11d48, #f43f5e); }
.admin-card-supreme.ac-afp .admin-card-header-supreme .ac-icon { background: linear-gradient(135deg, #4f46e5, #6366f1); }
.admin-card-supreme.ac-arl .admin-card-header-supreme .ac-icon { background: linear-gradient(135deg, #d97706, #f59e0b); }
.admin-card-supreme.ac-ccf .admin-card-header-supreme .ac-icon { background: linear-gradient(135deg, #059669, #10b981); }
.admin-card-header-supreme h5 {
    font-family: var(--font-family);
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary, #1e293b);
    margin: 0;
}
.admin-card-body-supreme { padding: 0 16px 16px; }
.admin-card-body-supreme .ac-stat-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.admin-card-body-supreme .ac-stat-label {
    font-family: var(--font-family);
    font-size: 0.75rem;
    color: var(--text-secondary, #64748b);
    font-weight: 500;
}
.admin-card-body-supreme .ac-stat-value {
    font-family: var(--font-family);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary, #1e293b);
}
.admin-card-body-supreme .ac-stat-value.money { color: #059669; }
.admin-card-body-supreme .ac-divider {
    border: none;
    border-top: 1px solid var(--border-color, #e5e7eb);
    margin: 10px 0;
}
.admin-card-body-supreme .ac-detail-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 0;
}
.admin-card-body-supreme .ac-detail-name {
    font-family: var(--font-family);
    font-size: 0.7rem;
    color: var(--text-secondary, #64748b);
    font-weight: 500;
    max-width: 75%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.admin-card-body-supreme .ac-detail-count {
    font-family: var(--font-family);
    font-size: 0.72rem;
    font-weight: 700;
    color: #6366f1;
    min-width: 24px;
    text-align: right;
}

/* ── Filtros Supreme ── */
.filtros-supreme {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-bottom: 16px;
}
.filtro-group-supreme label {
    font-family: var(--font-family);
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-secondary, #64748b);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 6px;
    display: block;
}
.filtro-group-supreme input,
.filtro-group-supreme select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: var(--border-radius, 8px);
    font-family: var(--font-family);
    font-size: 0.85rem;
    color: var(--text-primary, #1e293b);
    background: var(--bg-primary, #fff);
    outline: none;
    transition: border-color 0.2s;
}
.filtro-group-supreme input:focus,
.filtro-group-supreme select:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}
.filtro-info-supreme {
    font-family: var(--font-family);
    font-size: 0.75rem;
    color: var(--text-secondary, #64748b);
    font-weight: 500;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ── Tabla Empleados Supreme ── */
.tabla-empleados-scroll-supreme {
    overflow-x: auto;
    border-radius: var(--border-radius, 8px);
    border: 1px solid var(--border-color, #e5e7eb);
}
.tabla-empleados-scroll-supreme::-webkit-scrollbar { height: 8px; }
.tabla-empleados-scroll-supreme::-webkit-scrollbar-track { background: var(--bg-secondary, #f8fafc); }
.tabla-empleados-scroll-supreme::-webkit-scrollbar-thumb { background: linear-gradient(90deg, #6366f1, #818cf8); border-radius: 4px; }
.table-empleados-supreme {
    width: 100%;
    min-width: 1000px;
    border-collapse: collapse;
    font-family: var(--font-family);
}
.table-empleados-supreme thead th {
    background: linear-gradient(135deg, #312e81, #4338ca);
    padding: 12px;
    font-size: 0.7rem;
    font-weight: 700;
    color: #e0e7ff;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    border-bottom: 2px solid #6366f1;
    white-space: nowrap;
    text-align: center;
}
.table-empleados-supreme thead th:first-child { text-align: left; }
.table-empleados-supreme tbody tr {
    border-bottom: 1px solid var(--border-color, #e5e7eb);
    transition: background 0.15s;
}
.table-empleados-supreme tbody tr:hover { background: var(--bg-hover, rgba(0,0,0,0.02)); }
.table-empleados-supreme tbody td {
    padding: 10px 12px;
    font-size: 0.8rem;
    color: var(--text-primary, #1e293b);
    vertical-align: middle;
    text-align: center;
}
.table-empleados-supreme tbody td:first-child { text-align: left; }
.table-empleados-supreme .emp-name { font-weight: 700; color: var(--text-primary, #1e293b); }
.table-empleados-supreme .emp-doc { font-family: 'Courier New', monospace; font-weight: 600; font-size: 0.78rem; }
.table-empleados-supreme .emp-salary { font-weight: 700; color: #059669; }
.table-empleados-supreme .emp-total { font-weight: 800; font-size: 0.85rem; color: #059669; }

/* ── Admin Badge Supreme ── */
.admin-badge-supreme {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.65rem;
    font-weight: 700;
    margin-bottom: 2px;
}
.admin-badge-supreme.badge-eps { background: rgba(225,29,72,0.1); color: #e11d48; }
.admin-badge-supreme.badge-afp { background: rgba(99,102,241,0.1); color: #6366f1; }
.admin-badge-supreme.badge-arl { background: rgba(217,119,6,0.1); color: #d97706; }
.admin-badge-supreme.badge-ccf { background: rgba(5,150,105,0.1); color: #059669; }
.admin-amount-supreme { font-size: 0.7rem; color: var(--text-secondary, #64748b); font-weight: 500; }

/* ── Novedad Badges Supreme ── */
.novedad-badge-supreme {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    border-radius: 10px;
    font-size: 0.6rem;
    font-weight: 700;
    margin: 1px;
}
.novedad-badge-supreme.novedad-ingreso { background: rgba(5,150,105,0.1); color: #059669; }
.novedad-badge-supreme.novedad-retiro { background: rgba(239,68,68,0.1); color: #ef4444; }
.novedad-badge-supreme.novedad-vacaciones { background: rgba(99,102,241,0.1); color: #6366f1; }
.novedad-badge-supreme.novedad-incapacidad { background: rgba(217,119,6,0.1); color: #d97706; }
.novedad-badge-supreme.novedad-licencia { background: rgba(236,72,153,0.1); color: #ec4899; }
.novedad-badge-supreme.novedad-vsp { background: rgba(13,148,136,0.1); color: #0d9488; }

/* ── Modal Footer Supreme ── */
.modal-footer-supreme {
    padding: 20px 32px;
    border-top: 1px solid var(--border-color, #e5e7eb);
    background: var(--bg-secondary, #f8fafc);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}
.btn-footer-supreme {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    border-radius: var(--border-radius, 8px);
    font-family: var(--font-family);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s;
    border: none;
}
.btn-footer-supreme.btn-cancel {
    background: var(--bg-primary, #fff);
    border: 1px solid var(--border-color, #e5e7eb);
    color: var(--text-secondary, #64748b);
}
.btn-footer-supreme.btn-cancel:hover { background: var(--bg-hover, rgba(0,0,0,0.02)); }
.btn-footer-supreme.btn-confirm {
    background: linear-gradient(135deg, #4f46e5, #6366f1);
    color: #fff;
    box-shadow: 0 2px 8px rgba(99,102,241,0.3);
}
.btn-footer-supreme.btn-confirm:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(99,102,241,0.4);
}

/* ── Dark Mode - Modal Supreme ── */
[data-theme="dark"] .modal-premium-supreme .modal-content {
    box-shadow: 0 25px 60px rgba(0,0,0,0.5);
}
[data-theme="dark"] .modal-header-supreme {
    background: linear-gradient(135deg, #3730a3 0%, #5b21b6 50%, #4c1d95 100%);
}
[data-theme="dark"] .resumen-card-supreme.card-indigo .rc-icon { background: rgba(99,102,241,0.2); color: #818cf8; }
[data-theme="dark"] .resumen-card-supreme.card-emerald .rc-icon { background: rgba(5,150,105,0.2); color: #10b981; }
[data-theme="dark"] .resumen-card-supreme.card-amber .rc-icon { background: rgba(217,119,6,0.2); color: #f59e0b; }
[data-theme="dark"] .resumen-card-supreme.card-teal .rc-icon { background: rgba(13,148,136,0.2); color: #14b8a6; }
[data-theme="dark"] .admin-card-body-supreme .ac-stat-value.money { color: #10b981; }
[data-theme="dark"] .admin-card-body-supreme .ac-detail-count { color: #818cf8; }
[data-theme="dark"] .table-empleados-supreme thead th {
    background: linear-gradient(135deg, #1e1b4b, #312e81);
    border-bottom: 2px solid #818cf8;
}
[data-theme="dark"] .table-empleados-supreme .emp-salary,
[data-theme="dark"] .table-empleados-supreme .emp-total { color: #10b981; }
[data-theme="dark"] .admin-badge-supreme.badge-eps { background: rgba(225,29,72,0.15); color: #fb7185; }
[data-theme="dark"] .admin-badge-supreme.badge-afp { background: rgba(99,102,241,0.15); color: #818cf8; }
[data-theme="dark"] .admin-badge-supreme.badge-arl { background: rgba(217,119,6,0.15); color: #f59e0b; }
[data-theme="dark"] .admin-badge-supreme.badge-ccf { background: rgba(5,150,105,0.15); color: #10b981; }
[data-theme="dark"] .novedad-badge-supreme.novedad-ingreso { background: rgba(5,150,105,0.15); color: #10b981; }
[data-theme="dark"] .novedad-badge-supreme.novedad-retiro { background: rgba(239,68,68,0.15); color: #f87171; }
[data-theme="dark"] .novedad-badge-supreme.novedad-vacaciones { background: rgba(99,102,241,0.15); color: #818cf8; }
[data-theme="dark"] .novedad-badge-supreme.novedad-incapacidad { background: rgba(217,119,6,0.15); color: #f59e0b; }
[data-theme="dark"] .novedad-badge-supreme.novedad-licencia { background: rgba(236,72,153,0.15); color: #f472b6; }
[data-theme="dark"] .novedad-badge-supreme.novedad-vsp { background: rgba(13,148,136,0.15); color: #14b8a6; }
[data-theme="dark"] .btn-footer-supreme.btn-confirm {
    background: linear-gradient(135deg, #4338ca, #6366f1);
}

/* ── Responsive - Modal Supreme ── */
@media (max-width: 768px) {
    .resumen-grid-supreme { grid-template-columns: repeat(2, 1fr); }
    .admin-grid-supreme { grid-template-columns: repeat(2, 1fr); }
    .filtros-supreme { grid-template-columns: 1fr; }
    .modal-header-supreme { padding: 20px 20px; }
    .modal-body-supreme { padding: 20px; }
    .modal-footer-supreme { padding: 16px 20px; }
}
@media (max-width: 480px) {
    .resumen-grid-supreme { grid-template-columns: 1fr; }
    .admin-grid-supreme { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════════════════
   STAT CARDS SUPREME - Premium World-Class Statistics Cards
   ═══════════════════════════════════════════════════════════════ */
.stat-card-supreme {
    position: relative;
    background: var(--bg-surface, #fff);
    border: 1px solid var(--border-light, #e2e8f0);
    border-radius: 20px;
    overflow: visible;
    transition: all 0.4s cubic-bezier(0.22, 1, 0.36, 1);
    isolation: isolate;
    margin-top: 8px;
    cursor: pointer;
}
/* Clip only the internal glow, not the card itself */
.stat-card-supreme .stat-supreme-glow {
    border-radius: 20px;
    overflow: hidden;
}
/* Ensure parent row doesn't clip hovering cards */
.stat-card-supreme-row {
    overflow: visible !important;
    padding-top: 8px;
    padding-bottom: 12px;
}
.stat-card-supreme::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 20px;
    padding: 1.5px;
    background: linear-gradient(135deg, transparent 40%, rgba(13,148,136,0.2) 60%, transparent 80%);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
    z-index: 1;
}
.stat-card-supreme:hover {
    transform: translateY(-6px);
    box-shadow:
        0 20px 40px -12px rgba(0,0,0,0.1),
        0 8px 20px -8px rgba(13,148,136,0.08);
    border-color: transparent;
}
.stat-card-supreme:hover::before { opacity: 1; }

.stat-supreme-glow {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.6;
    transition: opacity 0.4s ease;
    z-index: 0;
}
.stat-card-supreme:hover .stat-supreme-glow { opacity: 1; }

.stat-card-supreme .card-body {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 24px 22px 20px;
}

.stat-supreme-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 18px;
}

.stat-supreme-icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.25rem;
    flex-shrink: 0;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.stat-card-supreme:hover .stat-supreme-icon {
    transform: scale(1.08) rotate(-3deg);
}

.stat-supreme-trend-wrap {
    display: flex;
    align-items: center;
}

.stat-card-supreme .card-trend {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.2px;
}
.stat-card-supreme .card-trend.positive { background: rgba(16,185,129,0.1); color: #10b981; }
.stat-card-supreme .card-trend.negative { background: rgba(239,68,68,0.1); color: #ef4444; }
.stat-card-supreme .card-trend.neutral { background: rgba(100,116,139,0.08); color: var(--text-muted, #94a3b8); }
.stat-card-supreme .card-trend i { font-size: 0.6rem; }

.stat-supreme-value {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-primary, #0f172a);
    line-height: 1;
    letter-spacing: -0.03em;
    margin-bottom: 4px;
    font-feature-settings: 'tnum';
}

.stat-supreme-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary, #64748b);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
    padding: 0;
}

.stat-supreme-sub {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-muted, #94a3b8);
    margin-top: 2px;
}

.stat-supreme-bar {
    width: 100%;
    height: 4px;
    background: var(--bg-surface-alt, #f1f5f9);
    border-radius: 4px;
    margin-top: 16px;
    overflow: hidden;
}
.stat-supreme-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Dark mode */
[data-theme="dark"] .stat-card-supreme {
    background: var(--bg-surface, #1e293b);
    border-color: var(--border-light, #334155);
}
[data-theme="dark"] .stat-card-supreme:hover {
    box-shadow:
        0 20px 40px -12px rgba(0,0,0,0.4),
        0 8px 20px -8px rgba(13,148,136,0.15);
}
[data-theme="dark"] .stat-supreme-bar {
    background: rgba(255,255,255,0.06);
}

/* Responsive */
@media (max-width: 768px) {
    .stat-card-supreme .card-body { padding: 18px 16px 16px; }
    .stat-supreme-value { font-size: 2rem; }
    .stat-supreme-icon { width: 44px; height: 44px; border-radius: 12px; font-size: 1.1rem; }
}

/* ═══════════════════════════════════════════════════════════════
   STATS SUPREME MODAL - World-Class Analytics Modal
   ═══════════════════════════════════════════════════════════════ */

/* Modal backdrop & dialog */
.stats-supreme-modal .modal-dialog {
    max-width: 780px;
}
.stats-supreme-content {
    border: none;
    border-radius: 24px;
    overflow: hidden;
    box-shadow:
        0 25px 80px -12px rgba(0, 0, 0, 0.25),
        0 0 0 1px rgba(255,255,255,0.06);
    background: var(--bg-surface, #fff);
}

/* ── Header ── */
.stats-supreme-header {
    position: relative;
    padding: 28px 32px 24px;
    overflow: hidden;
}
.stats-supreme-header-orbs {
    position: absolute;
    inset: 0;
    pointer-events: none;
}
.stats-supreme-header-orbs::before {
    content: '';
    position: absolute;
    top: -40%; right: -10%;
    width: 200px; height: 200px;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
}
.stats-supreme-header-orbs::after {
    content: '';
    position: absolute;
    bottom: -50%; left: 8%;
    width: 140px; height: 140px;
    border-radius: 50%;
    background: rgba(255,255,255,0.05);
}
.stats-supreme-header-inner {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}
.stats-supreme-title-row {
    display: flex;
    align-items: center;
    gap: 14px;
}
.stats-supreme-title-icon {
    width: 48px; height: 48px;
    border-radius: 14px;
    background: rgba(255,255,255,0.18);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.2rem;
    flex-shrink: 0;
}
.stats-supreme-title {
    color: #fff;
    font-weight: 800;
    font-size: 1.3rem;
    margin: 0;
    letter-spacing: -0.01em;
}
.stats-supreme-subtitle {
    color: rgba(255,255,255,0.7);
    font-size: 0.8rem;
    font-weight: 400;
    margin: 4px 0 0;
}
.stats-supreme-close {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.12);
    border: none;
    color: rgba(255,255,255,0.9);
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}
.stats-supreme-close:hover {
    background: rgba(255,255,255,0.25);
    transform: rotate(90deg);
}

/* ── Body ── */
.stats-supreme-body {
    padding: 28px 32px 20px;
    max-height: 65vh;
    overflow-y: auto;
}
.stats-supreme-body::-webkit-scrollbar { width: 5px; }
.stats-supreme-body::-webkit-scrollbar-track { background: transparent; }
.stats-supreme-body::-webkit-scrollbar-thumb { background: var(--border-light, #cbd5e1); border-radius: 10px; }

/* ── Period Selector ── */
.stats-supreme-period-bar {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
}
.stats-supreme-period-group {
    display: inline-flex;
    background: var(--bg-surface-alt, #f1f5f9);
    border-radius: 12px;
    padding: 4px;
    gap: 2px;
}
.stats-supreme-period {
    border: none;
    background: transparent;
    padding: 8px 18px;
    border-radius: 10px;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-secondary, #64748b);
    cursor: pointer;
    transition: all 0.25s ease;
    letter-spacing: 0.3px;
}
.stats-supreme-period:hover {
    color: var(--text-primary, #0f172a);
    background: rgba(255,255,255,0.6);
}
.stats-supreme-period.active {
    background: var(--bg-surface, #fff);
    color: var(--text-primary, #0f172a);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* ── Metric Cards Grid ── */
.stats-supreme-metrics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    margin-bottom: 24px;
}
.stats-supreme-metric {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    background: var(--bg-surface, #fff);
    border: 1px solid var(--border-light, #e2e8f0);
    border-radius: 16px;
    transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.stats-supreme-metric:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px -8px rgba(0,0,0,0.1);
    border-color: transparent;
}
.stats-supreme-metric-icon {
    width: 44px; height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    flex-shrink: 0;
}
.stats-supreme-metric-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.stats-supreme-metric-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary, #0f172a);
    line-height: 1.1;
    letter-spacing: -0.02em;
    font-feature-settings: 'tnum';
}
.stats-supreme-metric-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary, #64748b);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-top: 2px;
}
.stats-supreme-metric-sub {
    font-size: 0.7rem;
    color: var(--text-muted, #94a3b8);
    margin-top: 1px;
}

/* ── Chart Section ── */
.stats-supreme-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}
.stats-supreme-section-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary, #0f172a);
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}
.stats-supreme-section-title i {
    font-size: 0.8rem;
    color: var(--text-secondary, #64748b);
}
.stats-supreme-chart-section {
    margin-bottom: 24px;
}
.stats-supreme-chart-wrap {
    background: var(--bg-surface, #fff);
    border: 1px solid var(--border-light, #e2e8f0);
    border-radius: 16px;
    padding: 20px;
    height: 260px;
}

/* ── KPI Row ── */
.stats-supreme-kpi-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-bottom: 4px;
}
.stats-supreme-kpi {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    background: var(--bg-surface, #fff);
    border: 1px solid var(--border-light, #e2e8f0);
    border-radius: 16px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}
.stats-supreme-kpi:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px -6px rgba(0,0,0,0.1);
}
.stats-supreme-kpi-icon {
    width: 40px; height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.95rem;
    flex-shrink: 0;
}
.stats-supreme-kpi-body {
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}
.stats-supreme-kpi-value {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-primary, #0f172a);
    line-height: 1.1;
    font-feature-settings: 'tnum';
}
.stats-supreme-kpi-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary, #64748b);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.stats-supreme-kpi-ring {
    position: absolute;
    right: 12px; top: 50%;
    transform: translateY(-50%);
    width: 36px; height: 36px;
    border-radius: 50%;
    background: conic-gradient(
        var(--kpi-color) calc(var(--kpi-pct) * 3.6deg),
        var(--bg-surface-alt, #f1f5f9) 0
    );
    opacity: 0.2;
}

/* ── Comparatives ── */
.stats-supreme-comparatives {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.stats-supreme-compare-item {
    padding: 16px 20px;
    background: var(--bg-surface, #fff);
    border: 1px solid var(--border-light, #e2e8f0);
    border-radius: 14px;
    transition: all 0.3s ease;
}
.stats-supreme-compare-item:hover {
    box-shadow: 0 4px 16px -4px rgba(0,0,0,0.08);
}
.stats-supreme-compare-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.stats-supreme-compare-icon {
    font-size: 0.85rem;
}
.stats-supreme-compare-label {
    flex: 1;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary, #0f172a);
}
.stats-supreme-compare-pct {
    font-size: 0.9rem;
    font-weight: 800;
    font-feature-settings: 'tnum';
}
.stats-supreme-bar-track {
    width: 100%;
    height: 8px;
    background: var(--bg-surface-alt, #f1f5f9);
    border-radius: 8px;
    overflow: hidden;
}
.stats-supreme-bar-inner {
    height: 100%;
    border-radius: 8px;
    transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ── Footer ── */
.stats-supreme-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 32px;
    border-top: 1px solid var(--border-light, #e2e8f0);
    background: var(--bg-surface-alt, #f8fafc);
}
.stats-supreme-footer-brand {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted, #94a3b8);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.stats-supreme-footer-brand i {
    color: #f59e0b;
}
.stats-supreme-footer-actions {
    display: flex;
    gap: 10px;
}
.stats-supreme-btn-ghost {
    border: 1px solid var(--border-light, #e2e8f0);
    background: transparent;
    color: var(--text-secondary, #64748b);
    padding: 8px 20px;
    border-radius: 12px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}
.stats-supreme-btn-ghost:hover {
    background: var(--bg-surface-alt, #f1f5f9);
    color: var(--text-primary, #0f172a);
}
.stats-supreme-btn-primary {
    border: none;
    background: linear-gradient(135deg, #6366f1, #818cf8);
    color: #fff;
    padding: 8px 22px;
    border-radius: 12px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 12px rgba(99,102,241,0.3);
}
.stats-supreme-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(99,102,241,0.4);
}

/* ── Dark Mode ── */
[data-theme="dark"] .stats-supreme-content {
    background: var(--bg-surface, #1e293b);
    box-shadow: 0 25px 80px -12px rgba(0,0,0,0.5);
}
[data-theme="dark"] .stats-supreme-body::-webkit-scrollbar-thumb {
    background: var(--border-medium, #475569);
}
[data-theme="dark"] .stats-supreme-period-group {
    background: rgba(255,255,255,0.06);
}
[data-theme="dark"] .stats-supreme-period.active {
    background: rgba(255,255,255,0.1);
    color: #fff;
    box-shadow: none;
}
[data-theme="dark"] .stats-supreme-metric,
[data-theme="dark"] .stats-supreme-kpi,
[data-theme="dark"] .stats-supreme-compare-item,
[data-theme="dark"] .stats-supreme-chart-wrap {
    background: rgba(255,255,255,0.04);
    border-color: rgba(255,255,255,0.08);
}
[data-theme="dark"] .stats-supreme-footer {
    background: rgba(255,255,255,0.03);
    border-color: rgba(255,255,255,0.08);
}
[data-theme="dark"] .stats-supreme-btn-ghost {
    border-color: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.6);
}
[data-theme="dark"] .stats-supreme-bar-track,
[data-theme="dark"] .stats-supreme-kpi-ring {
    background: rgba(255,255,255,0.06);
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .stats-supreme-modal .modal-dialog { max-width: 100%; margin: 12px; }
    .stats-supreme-header { padding: 22px 20px 18px; }
    .stats-supreme-body { padding: 20px; }
    .stats-supreme-metrics-grid { grid-template-columns: 1fr; }
    .stats-supreme-kpi-row { grid-template-columns: 1fr; }
    .stats-supreme-footer { flex-direction: column; gap: 12px; text-align: center; }
    .stats-supreme-footer-actions { width: 100%; justify-content: center; }
    .stats-supreme-title-icon { width: 40px; height: 40px; border-radius: 10px; font-size: 1rem; }
    .stats-supreme-title { font-size: 1.1rem; }
}

/* ═══════════════════════════════════════════════════════════════
   USUARIOS SUPREME LIST - Premium World-Class User List
   ═══════════════════════════════════════════════════════════════ */

/* ── Filter Bar ── */
.usu-supreme-filters {
    margin-bottom: 20px;
}
.usu-supreme-search-row {
    display: flex;
    gap: 12px;
    align-items: stretch;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.usu-supreme-search-box {
    flex: 1;
    min-width: 220px;
    position: relative;
}
.usu-supreme-search-icon {
    position: absolute;
    left: 14px; top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted, #94a3b8);
    font-size: 0.85rem;
}
.usu-supreme-search-input {
    width: 100%;
    padding: 10px 14px 10px 38px;
    border: 1.5px solid var(--border-light, #e2e8f0);
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary, #0f172a);
    background: var(--bg-surface, #fff);
    transition: all 0.25s;
    outline: none;
}
.usu-supreme-search-input:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}
.usu-supreme-filter-pills {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}
.usu-supreme-select {
    padding: 10px 32px 10px 12px;
    border: 1.5px solid var(--border-light, #e2e8f0);
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary, #0f172a);
    background: var(--bg-surface, #fff) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 10px center;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    transition: all 0.25s;
    outline: none;
}
.usu-supreme-select:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}

/* ── Toolbar ── */
.usu-supreme-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.usu-supreme-info-text {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary, #64748b);
}
.usu-supreme-view-toggle {
    display: inline-flex;
    background: var(--bg-surface-alt, #f1f5f9);
    border-radius: 10px;
    padding: 3px;
    gap: 2px;
}
.usu-supreme-view-btn {
    border: none;
    background: transparent;
    padding: 7px 12px;
    border-radius: 8px;
    color: var(--text-muted, #94a3b8);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}
.usu-supreme-view-btn.active {
    background: var(--bg-surface, #fff);
    color: var(--text-primary, #0f172a);
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

/* ── Loading ── */
.usu-supreme-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 48px 20px;
    color: var(--text-secondary, #64748b);
    font-size: 0.88rem;
    font-weight: 500;
}
.usu-supreme-spinner {
    width: 32px; height: 32px;
    border: 3px solid var(--border-light, #e2e8f0);
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: usu-spin 0.7s linear infinite;
    margin-bottom: 12px;
}
@keyframes usu-spin { to { transform: rotate(360deg); } }

/* ── Empty State ── */
.usu-supreme-empty {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted, #94a3b8);
}
.usu-supreme-empty i {
    font-size: 40px;
    display: block;
    margin-bottom: 12px;
}
.usu-supreme-empty p {
    font-size: 0.9rem;
    font-weight: 500;
}

/* ── Supreme Table ── */
.usu-supreme-table-wrap {
    margin-top: 12px;
    border-radius: 12px;
    overflow-x: auto;
    overflow-y: visible;
    border: 1px solid var(--border-color, rgba(0,0,0,0.06));
    -webkit-overflow-scrolling: touch;
}
.usu-supreme-table {
    margin-bottom: 0;
    font-family: 'Exo 2', 'Inter', sans-serif;
    font-size: 0.82rem;
    white-space: nowrap;
    min-width: 1600px;
}
.usu-supreme-table thead tr {
    background: linear-gradient(135deg, #16a085 0%, #1abc9c 50%, #2ecc71 100%);
}
.usu-supreme-table thead th {
    color: #fff;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 12px 10px;
    border: none;
    position: sticky;
    top: 0;
    z-index: 2;
    font-family: 'Rajdhani', sans-serif;
}
.usu-supreme-table tbody tr {
    transition: background 0.18s, box-shadow 0.18s;
    border-bottom: 1px solid var(--border-color, rgba(0,0,0,0.04));
}
.usu-supreme-table tbody tr:hover {
    background: rgba(22,160,133,0.06);
    box-shadow: inset 3px 0 0 #16a085;
}
.usu-supreme-table tbody td {
    padding: 10px 10px;
    vertical-align: middle;
    color: var(--text-primary, #334155);
    border-top: none;
}
.usu-supreme-td-bold {
    font-weight: 700;
    color: var(--text-primary, #1e293b) !important;
}
.usu-supreme-td-small {
    font-size: 0.72rem;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── List View (legacy compat) ── */
.usu-supreme-list-view {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 12px;
}
.usu-supreme-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 18px;
    background: var(--bg-surface, #fff);
    border: 1px solid var(--border-light, #e2e8f0);
    border-radius: 14px;
    transition: all 0.25s cubic-bezier(0.22,1,0.36,1);
    cursor: default;
}
.usu-supreme-item:hover {
    border-color: rgba(99,102,241,0.25);
    box-shadow: 0 4px 16px -4px rgba(0,0,0,0.08);
    transform: translateY(-1px);
}
.usu-supreme-item-main {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1.5;
}
.usu-supreme-item-avatar {
    width: 40px; height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, #6366f1, #818cf8);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.78rem;
    flex-shrink: 0;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}
.usu-supreme-item-info {
    min-width: 0;
}
.usu-supreme-item-name {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-primary, #0f172a);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.usu-supreme-item-meta {
    display: flex;
    gap: 14px;
    font-size: 0.73rem;
    color: var(--text-muted, #94a3b8);
    margin-top: 2px;
    flex-wrap: wrap;
}
.usu-supreme-item-meta i {
    margin-right: 3px;
    font-size: 0.65rem;
}
.usu-supreme-item-details {
    display: flex;
    gap: 16px;
    flex: 1.8;
    flex-wrap: wrap;
}
.usu-supreme-item-detail {
    display: flex;
    flex-direction: column;
    min-width: 70px;
}
.usu-supreme-detail-label {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted, #94a3b8);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.usu-supreme-detail-value {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-primary, #0f172a);
    margin-top: 1px;
}
.usu-supreme-detail-small {
    font-size: 0.72rem;
    font-weight: 600;
}
.usu-supreme-plan-badge {
    display: inline-block;
    background: rgba(99,102,241,0.1);
    color: #6366f1;
    padding: 1px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 800;
}
.usu-supreme-item-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* ── Status Badges ── */
.usu-supreme-status {
    display: inline-flex;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.2px;
    white-space: nowrap;
}
.usu-supreme-status-success { background: rgba(16,185,129,0.12); color: #10b981; }
.usu-supreme-status-info { background: rgba(59,130,246,0.12); color: #3b82f6; }
.usu-supreme-status-purple { background: rgba(139,92,246,0.12); color: #8b5cf6; }
.usu-supreme-status-warning { background: rgba(245,158,11,0.12); color: #f59e0b; }
.usu-supreme-status-neutral { background: rgba(100,116,139,0.1); color: #64748b; }

/* ── Action Buttons ── */
.usu-supreme-btn-action {
    border: none;
    background: linear-gradient(135deg, #6366f1, #818cf8);
    color: #fff;
    padding: 6px 14px;
    border-radius: 10px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.usu-supreme-btn-action:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99,102,241,0.3);
}
.usu-supreme-btn-action-ghost {
    border: 1px solid var(--border-light, #e2e8f0);
    background: transparent;
    color: var(--text-secondary, #64748b);
    padding: 6px 10px;
    border-radius: 10px;
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.2s;
}
.usu-supreme-btn-action-ghost:hover {
    background: var(--bg-surface-alt, #f1f5f9);
    color: var(--text-primary, #0f172a);
}

/* ── Card View ── */
.usu-supreme-card-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
    margin-top: 12px;
}
.usu-supreme-card {
    background: var(--bg-surface, #fff);
    border: 1px solid var(--border-light, #e2e8f0);
    border-radius: 18px;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.22,1,0.36,1);
}
.usu-supreme-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 28px -8px rgba(0,0,0,0.12);
    border-color: transparent;
}
.usu-supreme-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px 0;
}
.usu-supreme-card-avatar {
    width: 48px; height: 48px;
    border-radius: 14px;
    background: linear-gradient(135deg, #6366f1, #818cf8);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.9rem;
    text-transform: uppercase;
}
.usu-supreme-card-body {
    padding: 12px 18px 14px;
}
.usu-supreme-card-name {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-primary, #0f172a);
    margin: 0 0 4px;
}
.usu-supreme-card-id {
    font-size: 0.75rem;
    color: var(--text-secondary, #64748b);
    margin: 0 0 2px;
}
.usu-supreme-card-id i, .usu-supreme-card-meta i {
    margin-right: 4px;
    font-size: 0.68rem;
    color: var(--text-muted, #94a3b8);
}
.usu-supreme-card-meta {
    font-size: 0.73rem;
    color: var(--text-muted, #94a3b8);
    margin: 0 0 2px;
}
.usu-supreme-card-divider {
    height: 1px;
    background: var(--border-light, #e2e8f0);
    margin: 10px 0;
}
.usu-supreme-card-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}
.usu-supreme-card-stat-label {
    display: block;
    font-size: 0.62rem;
    font-weight: 700;
    color: var(--text-muted, #94a3b8);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.usu-supreme-card-stat-value {
    display: block;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-primary, #0f172a);
}
.usu-supreme-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    border-top: 1px solid var(--border-light, #e2e8f0);
    background: var(--bg-surface-alt, #f8fafc);
}

/* ── Pagination ── */
.usu-supreme-pagination {
    display: flex;
    justify-content: center;
    padding: 16px 0 4px;
}
.usu-supreme-load-more {
    border: none;
    background: linear-gradient(135deg, #6366f1, #818cf8);
    color: #fff;
    padding: 10px 28px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 14px rgba(99,102,241,0.3);
}
.usu-supreme-load-more:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(99,102,241,0.4);
}

/* ── Dark Mode ── */
[data-theme="dark"] .usu-supreme-table-wrap {
    border-color: var(--border-light, #334155);
}
[data-theme="dark"] .usu-supreme-table tbody tr {
    border-color: rgba(255,255,255,0.06);
}
[data-theme="dark"] .usu-supreme-table tbody tr:hover {
    background: rgba(22,160,133,0.12);
}
[data-theme="dark"] .usu-supreme-table tbody td {
    color: var(--text-primary, #e2e8f0);
}
[data-theme="dark"] .usu-supreme-td-bold {
    color: #f1f5f9 !important;
}
[data-theme="dark"] .usu-supreme-item,
[data-theme="dark"] .usu-supreme-card {
    background: var(--bg-surface, #1e293b);
    border-color: var(--border-light, #334155);
}
[data-theme="dark"] .usu-supreme-search-input,
[data-theme="dark"] .usu-supreme-select {
    background-color: var(--bg-surface, #1e293b);
    border-color: var(--border-light, #334155);
    color: #e2e8f0;
}
[data-theme="dark"] .usu-supreme-view-toggle {
    background: rgba(255,255,255,0.06);
}
[data-theme="dark"] .usu-supreme-view-btn.active {
    background: rgba(255,255,255,0.1);
    color: #fff;
}
[data-theme="dark"] .usu-supreme-card-footer {
    background: rgba(255,255,255,0.03);
    border-color: rgba(255,255,255,0.06);
}

/* ── Responsive ── */
@media (max-width: 992px) {
    .usu-supreme-item { flex-wrap: wrap; }
    .usu-supreme-item-details { flex: 1 1 100%; margin-top: 8px; padding-left: 52px; }
    .usu-supreme-item-actions { flex: 1 1 100%; justify-content: flex-end; margin-top: 8px; }
}
@media (max-width: 768px) {
    .usu-supreme-search-row { flex-direction: column; }
    .usu-supreme-filter-pills { flex-wrap: wrap; }
    .usu-supreme-card-view { grid-template-columns: 1fr; }
    .usu-supreme-item-details { padding-left: 0; }
}
