/* style.css - Light Professional Design System */
:root {
    --primary: #10b981; /* Verde suave moderno */
    --primary-hover: #059669;
    --primary-light: #ecfdf5; /* Menta suave */
    --secondary: #059669;
    --secondary-hover: #047857;
    --secondary-light: #f0fdf4;
    --danger: #ef4444;
    --danger-light: #fef2f2;
    --warning: #f59e0b;
    --warning-light: #fffbeb;
    --info: #06b6d4; /* Cian suave */
    --bg-color: #f8fafc; /* Gris pizarra muy claro */
    --card-bg: #ffffff;
    --text-color: #0f172a; /* Slate 900 */
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --sidebar-bg: #ffffff;
    --shadow-sm: 0 1px 2px rgba(16, 185, 129, 0.05);
    --shadow-md: 0 4px 20px rgba(15, 23, 42, 0.05);
    --shadow-lg: 0 10px 30px rgba(15, 23, 42, 0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-color);
    background-image:
        radial-gradient(circle at 10% 10%, rgba(79, 70, 229, 0.06) 0%, transparent 45%),
        radial-gradient(circle at 90% 90%, rgba(5, 150, 105, 0.05) 0%, transparent 45%);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

.glass-effect {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    box-shadow: var(--shadow-md);
}

.login-body {
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.login-container {
    width: 90%;
    max-width: 440px;
    padding: 3rem 2.5rem;
}

.login-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.login-header h2 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    margin-bottom: 0.5rem;
    color: var(--primary);
}

.login-header p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.form-standard {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

@media (max-width: 600px) {
    .form-row { grid-template-columns: 1fr; }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-color);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 0.625rem;
    border: 1px solid var(--border-color);
    background: #fff;
    color: var(--text-color);
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.input-readonly {
    opacity: 0.75;
    background: #f8fafc !important;
}

.form-divider {
    border: 0;
    height: 1px;
    background: var(--border-color);
    margin: 1rem 0;
}

.form-section-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-color);
}

.btn-primary {
    padding: 0.75rem 1.25rem;
    border: none;
    border-radius: 0.625rem;
    background-color: var(--primary);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    padding: 0.75rem 1.25rem;
    border: 1px solid var(--border-color);
    border-radius: 0.625rem;
    background-color: #fff;
    color: var(--text-color);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.btn-secondary:hover {
    background-color: #f8fafc;
    border-color: #cbd5e1;
}

.btn-success {
    background-color: var(--secondary) !important;
}

.btn-success:hover {
    background-color: var(--secondary-hover) !important;
}

.btn-danger {
    padding: 0.75rem 1.25rem;
    border: none;
    border-radius: 0.625rem;
    background-color: var(--danger);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    box-shadow: var(--shadow-sm);
}

.btn-danger:hover {
    background-color: #b91c1c;
    transform: translateY(-1px);
}

.btn-sm {
    padding: 0.45rem 0.75rem;
    font-size: 0.78rem;
    border-radius: 0.5rem;
}

.btn-group-inline {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.alert {
    padding: 0.85rem 1.25rem;
    border-radius: 0.625rem;
    font-size: 0.9rem;
    line-height: 1.4;
    text-align: center;
    border: 1px solid transparent;
}

.alert.error, .alert.danger {
    background-color: var(--danger-light);
    color: #991b1b;
    border-color: #fecaca;
}

.alert.success {
    background-color: var(--secondary-light);
    color: #065f46;
    border-color: #a7f3d0;
}

.alert.hidden { display: none !important; }

.dashboard-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
    width: 100%;
}

.sidebar {
    width: 270px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 1.25rem 0;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
    transition: width 0.28s cubic-bezier(0.4, 0, 0.2, 1), padding 0.28s ease;
    position: relative;
    z-index: 50;
}

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

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

.logo-icon { 
    font-size: 1.5rem; 
    flex-shrink: 0;
}

.sidebar-brand-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity 0.2s ease;
}

.sidebar-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: #ffffff;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    flex-shrink: 0;
}

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

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

/* Logo Full vs Mini Icon */
.sidebar-logo-icon {
    display: none !important;
}

.sidebar-logo-full,
.sidebar-logo-img {
    display: inline-block;
    max-height: 42px;
    max-width: 175px;
    object-fit: contain;
    vertical-align: middle;
}

/* --- SIDEBAR COLLAPSED (MINI) STATE (SOLO DESKTOP >= 993px) --- */
@media (min-width: 993px) {
    .dashboard-layout.sidebar-collapsed .sidebar {
        width: 68px;
        padding: 1.25rem 0;
    }

    .dashboard-layout.sidebar-collapsed .sidebar-header {
        padding: 0 0.5rem 1.25rem;
        justify-content: center;
        position: relative;
    }

    .dashboard-layout.sidebar-collapsed .sidebar-brand-name {
        display: none;
    }

    .dashboard-layout.sidebar-collapsed .logo {
        justify-content: center;
    }

    .dashboard-layout.sidebar-collapsed .sidebar-logo-full,
    .dashboard-layout.sidebar-collapsed .sidebar-logo-img {
        display: none !important;
    }

    .dashboard-layout.sidebar-collapsed .sidebar-logo-icon {
        display: block !important;
        width: 38px;
        height: 38px;
        object-fit: contain;
        margin: 0 auto;
    }

    .dashboard-layout.sidebar-collapsed .sidebar-header .sidebar-toggle-btn {
        position: absolute;
        right: -13px;
        top: 22px;
        width: 26px;
        height: 26px;
        border-radius: 50%;
        z-index: 100;
        background: #ffffff;
        border: 1px solid var(--border-color);
        box-shadow: 0 2px 6px rgba(0,0,0,0.14);
    }

    .dashboard-layout.sidebar-collapsed .sidebar-toggle-btn .toggle-icon-svg {
        transform: rotate(180deg);
    }

    .dashboard-layout.sidebar-collapsed .nav-item {
        justify-content: center;
        width: 44px;
        height: 42px;
        margin: 0 auto;
        padding: 0;
        border-radius: 8px;
        border-left: none !important;
        position: relative;
        display: flex;
        align-items: center;
        transition: background 0.15s, color 0.15s;
    }

    .dashboard-layout.sidebar-collapsed .nav-item.active {
        background: var(--primary-light, #ecfdf5);
        color: var(--primary, #059669);
        box-shadow: 0 1px 3px rgba(5, 150, 105, 0.15);
    }

    .dashboard-layout.sidebar-collapsed .nav-item:hover:not(.active) {
        background: #f1f5f9;
        color: #0f172a;
    }

    .dashboard-layout.sidebar-collapsed .nav-item .nav-icon {
        font-size: 1.15rem;
        margin: 0;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .dashboard-layout.sidebar-collapsed .nav-item .nav-label {
        display: none;
    }

    .dashboard-layout.sidebar-collapsed .nav-item .badge {
        position: absolute;
        top: 4px;
        right: 6px;
        padding: 1px 4px;
        font-size: 0.6rem;
        border-radius: 9999px;
    }

    .dashboard-layout.sidebar-collapsed .sidebar-footer {
        padding: 0 0.5rem;
    }

    .dashboard-layout.sidebar-collapsed .btn-logout {
        padding: 0.65rem 0;
        justify-content: center;
    }

    .dashboard-layout.sidebar-collapsed .btn-logout span:not(.logout-icon) {
        display: none;
    }

    /* Tooltip flotante en modo mini-sidebar */
    .dashboard-layout.sidebar-collapsed .nav-item[data-title]:hover::after {
        content: attr(data-title);
        position: absolute;
        left: 74px;
        top: 50%;
        transform: translateY(-50%);
        background: #0f172a;
        color: #ffffff;
        font-size: 0.78rem;
        font-weight: 500;
        padding: 0.35rem 0.75rem;
        border-radius: 6px;
        white-space: nowrap;
        z-index: 1000;
        box-shadow: 0 4px 12px rgba(0,0,0,0.2);
        pointer-events: none;
        animation: fadeIn 0.15s ease;
    }

    .dashboard-layout.sidebar-collapsed .nav-item[data-title]:hover::before {
        content: '';
        position: absolute;
        left: 68px;
        top: 50%;
        transform: translateY(-50%);
        border: 5px solid transparent;
        border-right-color: #0f172a;
        z-index: 1000;
        pointer-events: none;
    }
}

.sidebar-nav {
    flex: 1;
    padding: 1.25rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    overflow-y: auto;
    scrollbar-width: thin;
}

.sidebar-nav::-webkit-scrollbar {
    width: 6px;
}
.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar-nav::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}
.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    cursor: pointer;
    border-left: 3px solid transparent;
    gap: 0.65rem;
    white-space: nowrap;
}

.nav-item:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.nav-item.active {
    background: var(--primary-light);
    color: var(--primary);
    border-left-color: var(--primary);
    font-weight: 600;
}

.sidebar-footer { padding: 0 1.5rem; }

.btn-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.75rem;
    border-radius: 0.625rem;
    background: var(--danger-light);
    border: 1px solid #fecaca;
    color: var(--danger);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.btn-logout:hover {
    background: var(--danger);
    color: #fff;
}

.main-content {
    flex: 1;
    min-width: 0;
    padding: 2rem;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    transition: all 0.28s ease;
}

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

.welcome-text h1 {
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 0.25rem;
}

.welcome-text p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: #fff;
    padding: 0.5rem 1rem 0.5rem 0.75rem;
    border-radius: 9999px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.avatar {
    width: 36px;
    height: 36px;
    background: var(--primary-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.user-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-color);
}

.user-role { font-size: 0.7rem; font-weight: 600; }

.view-section { display: none; }

.view-section.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

.section-card {
    padding: 1.75rem;
    margin-bottom: 1.5rem;
}

.table-header { margin-bottom: 1.25rem; }

.table-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 0.25rem;
}

.table-header p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.table-container {
    width: 100%;
    overflow-x: auto;
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
    background: #fff;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    text-align: left;
}

th, td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

th {
    font-weight: 600;
    color: var(--text-muted);
    background: #f8fafc;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

tr:last-child td { border-bottom: none; }

tr:hover td { background: #f8fafc; }

.text-center { text-align: center; }
.text-muted-sm { font-size: 0.8rem; color: var(--text-muted); }
.text-muted-center { text-align: center; color: var(--text-muted); padding: 1rem; }
.text-danger { color: var(--danger); }
.text-success { color: var(--secondary); font-weight: 600; }

.badge {
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.72rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
}

.badge-role-admin { background: var(--primary-light); color: var(--primary); }
.badge-role-empleado { background: #fef3c7; color: #b45309; }
.badge-role-cliente { background: var(--secondary-light); color: var(--secondary); }

.badge.pendiente { background: var(--warning-light); color: var(--warning); }
.badge.en_verificacion { background: #eff6ff; color: var(--info); }
.badge.aprobado { background: var(--secondary-light); color: var(--secondary); }
.badge.finalizado { background: #f1f5f9; color: #475569; }
.badge.pagado { background: var(--secondary-light); color: var(--secondary); }
.badge.rechazado { background: #fef2f2; color: #dc2626; border: 1px solid #fca5a5; }
.badge.pago_parcial { background: #ffedd5; color: #ea580c; border: 1px solid #fed7aa; }
.badge-danger { background: var(--danger); color: white; }

.progress-bar-container {
    width: 120px;
    background: #e2e8f0;
    border-radius: 9999px;
    height: 6px;
    margin-top: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 9999px;
    transition: width 0.5s ease;
}

.progress-text {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.cronograma-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    background: #f8fafc;
    padding: 1rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
}

.staff-upload-bar {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin: 1rem 0;
    padding: 1rem;
    background: var(--primary-light);
    border-radius: 0.75rem;
    border: 1px solid #c7d2fe;
}

.credit-summary-tags {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.summary-tag {
    background: #fff;
    padding: 0.4rem 0.85rem;
    border-radius: 0.5rem;
    font-size: 0.8rem;
    border: 1px solid var(--border-color);
}

.grid-form {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 1.5rem;
    align-items: start;
}

@media (max-width: 1250px) {
    .grid-form { grid-template-columns: 1fr; }
}

#view-nuevo-credito .grid-form {
    grid-template-columns: minmax(420px, 540px) 1fr;
    gap: 1.25rem;
    align-items: start;
}

@media (max-width: 1250px) {
    #view-nuevo-credito .grid-form {
        grid-template-columns: 1fr;
    }
}

/* Formulario Compacto Crear Crédito */
#view-nuevo-credito .section-card {
    padding: 1.1rem 1.25rem;
}

#view-nuevo-credito .table-header h2 {
    font-size: 1.1rem;
    margin-bottom: 0.1rem;
}

#view-nuevo-credito .table-header p {
    font-size: 0.76rem;
    margin-bottom: 0.35rem;
    color: #64748b;
}

#view-nuevo-credito #crearCreditoForm {
    gap: 0.5rem;
}

#view-nuevo-credito #crearCreditoForm .form-row {
    gap: 0.5rem;
}

#view-nuevo-credito #crearCreditoForm .form-group {
    gap: 0.15rem;
}

#view-nuevo-credito #crearCreditoForm .form-group label {
    font-size: 0.74rem;
    font-weight: 600;
    color: #475569;
}

#view-nuevo-credito #crearCreditoForm .form-group input,
#view-nuevo-credito #crearCreditoForm .form-group select {
    padding: 0.35rem 0.55rem;
    font-size: 0.82rem;
    border-radius: 0.45rem;
    height: 34px;
}

/* Fila layouts para crear crédito */
#view-nuevo-credito .credito-fila-2col {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px 10px !important;
    width: 100% !important;
}

#view-nuevo-credito .credito-fila-3col {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 8px 10px !important;
    width: 100% !important;
}

#view-nuevo-credito .credito-fila-2col > .form-group,
#view-nuevo-credito .credito-fila-3col > .form-group {
    min-width: 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

#view-nuevo-credito .credito-fila-2col > .form-group label,
#view-nuevo-credito .credito-fila-3col > .form-group label {
    white-space: normal !important;
    overflow-wrap: break-word !important;
    word-break: break-word !important;
    line-height: 1.25 !important;
}

/* Caja verde especial */
.credito-caja-especial {
    background: rgba(0, 121, 107, 0.035);
    padding: 10px 12px 6px 12px;
    border-radius: 8px;
    border: 1px dashed #00897b;
    margin-bottom: 4px;
}

.credito-caja-especial .form-row + .form-row {
    margin-top: 2px;
}

#view-nuevo-credito .seguros-section {
    padding: 0.65rem 0.85rem;
    margin-top: 0.35rem;
}

#view-nuevo-credito .seguros-header {
    margin-bottom: 0.4rem;
}

#view-nuevo-credito .seguros-header h3 {
    font-size: 0.82rem;
}

/* Botones de acción del formulario */
.credito-form-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.85rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e2e8f0;
    flex-wrap: wrap;
}

.credito-btn-simular {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid #4f46e5;
    background: #4f46e5;
    color: #fff;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.credito-btn-simular:hover {
    background: #4338ca;
    border-color: #4338ca;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
    color: #fff;
}

.credito-btn-limpiar {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 0.5rem 0.85rem;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid #d1d5db;
    background: #f9fafb;
    color: #6b7280;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.credito-btn-limpiar:hover {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #dc2626;
}

.credito-btn-guardar {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    border: none;
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    color: #fff;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    margin-left: auto;
}

.credito-btn-guardar:hover {
    background: linear-gradient(135deg, #047857 0%, #065f46 100%);
    box-shadow: 0 2px 8px rgba(5, 150, 105, 0.3);
}

#view-nueva-solicitud .grid-form,
#view-simular-credito .grid-form,
#view-nueva-simulacion .grid-form {
    grid-template-columns: minmax(420px, 540px) 1fr;
    gap: 1.25rem;
    align-items: start;
}

@media (max-width: 1250px) {
    #view-nueva-solicitud .grid-form,
    #view-simular-credito .grid-form,
    #view-nueva-simulacion .grid-form {
        grid-template-columns: 1fr;
    }
}

/* Compact form styles for solicitud (same as crear crédito) */
#view-nueva-solicitud .section-card,
#view-simular-credito .section-card,
#view-nueva-simulacion .section-card {
    padding: 1.1rem 1.25rem;
}

#view-nueva-solicitud .table-header h2,
#view-nueva-solicitud .table-header h3,
#view-simular-credito .table-header h2,
#view-simular-credito .table-header h3,
#view-nueva-simulacion .table-header h2,
#view-nueva-simulacion .table-header h3 {
    font-size: 1.1rem;
    margin-bottom: 0.1rem;
}

#view-nueva-solicitud .table-header p,
#view-simular-credito .table-header p,
#view-nueva-simulacion .table-header p {
    font-size: 0.76rem;
    margin-bottom: 0.35rem;
    color: #64748b;
}

#view-nueva-solicitud #nuevaSolicitudForm,
#view-simular-credito #simuladorCreditoForm,
#view-nueva-simulacion #simuladorCreditoForm {
    gap: 0.5rem;
}

#view-nueva-solicitud #nuevaSolicitudForm .form-row,
#view-simular-credito #simuladorCreditoForm .form-row,
#view-nueva-simulacion #simuladorCreditoForm .form-row {
    gap: 0.5rem;
}

#view-nueva-solicitud #nuevaSolicitudForm .form-group,
#view-simular-credito #simuladorCreditoForm .form-group,
#view-nueva-simulacion #simuladorCreditoForm .form-group {
    gap: 0.15rem;
}

#view-nueva-solicitud #nuevaSolicitudForm .form-group label,
#view-simular-credito #simuladorCreditoForm .form-group label,
#view-nueva-simulacion #simuladorCreditoForm .form-group label {
    font-size: 0.74rem;
    font-weight: 600;
    color: #475569;
    white-space: normal;
    overflow-wrap: break-word;
    word-break: break-word;
    line-height: 1.25;
}

#view-nueva-solicitud #nuevaSolicitudForm .form-group input,
#view-nueva-solicitud #nuevaSolicitudForm .form-group select,
#view-simular-credito #simuladorCreditoForm .form-group input,
#view-simular-credito #simuladorCreditoForm .form-group select,
#view-nueva-simulacion #simuladorCreditoForm .form-group input,
#view-nueva-simulacion #simuladorCreditoForm .form-group select {
    padding: 0.35rem 0.55rem;
    font-size: 0.82rem;
    border-radius: 0.45rem;
    height: 34px;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
}

/* Fila layouts */
#view-nueva-solicitud .solicitud-fila-2col,
#view-simular-credito .solicitud-fila-2col,
#view-nueva-simulacion .solicitud-fila-2col {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px 10px !important;
    width: 100% !important;
}

#view-nueva-solicitud .solicitud-fila-3col,
#view-simular-credito .solicitud-fila-3col,
#view-nueva-simulacion .solicitud-fila-3col {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 8px 10px !important;
    width: 100% !important;
}

#view-nueva-solicitud .solicitud-fila-2col > .form-group,
#view-nueva-solicitud .solicitud-fila-3col > .form-group,
#view-simular-credito .solicitud-fila-2col > .form-group,
#view-simular-credito .solicitud-fila-3col > .form-group,
#view-nueva-simulacion .solicitud-fila-2col > .form-group,
#view-nueva-simulacion .solicitud-fila-3col > .form-group {
    min-width: 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* Caja azul: Bienes a Financiar */
.solicitud-caja-bienes {
    background: rgba(2, 136, 209, 0.035);
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px dashed #0288d1;
    margin-bottom: 4px;
}

.caja-bienes-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    margin-bottom: 8px !important;
    gap: 8px !important;
}

.caja-bienes-header h4 {
    margin: 0 !important;
    color: #0288d1 !important;
    font-size: 0.95rem !important;
    font-weight: 700 !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
}

.btn-anadir-bien {
    background: #5046e5 !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 8px !important;
    padding: 7px 16px !important;
    font-weight: 600 !important;
    font-size: 0.84rem !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    box-shadow: 0 2px 4px rgba(80, 70, 229, 0.25) !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    transition: background-color 0.15s ease, transform 0.1s ease !important;
}

.btn-anadir-bien:hover {
    background: #4338ca !important;
    transform: translateY(-1px) !important;
}

/* Caja verde: Condiciones Financieras */
.solicitud-caja-financiera {
    background: rgba(46, 125, 50, 0.035);
    padding: 10px 12px 6px 12px;
    border-radius: 8px;
    border: 1px dashed #2e7d32;
    margin-bottom: 4px;
}

.solicitud-caja-financiera .form-row + .form-row {
    margin-top: 2px;
}

/* Caja documentos */
.solicitud-caja-documentos {
    background: rgba(30, 41, 59, 0.02);
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    margin-bottom: 4px;
}

.seguros-section {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1.25rem;
    margin-top: 1rem;
}

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

.seguros-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
}

.seguros-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.seguro-row {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr auto;
    gap: 0.75rem;
    align-items: center;
}

.permisos-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-size: 0.85rem;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.checkbox-label:hover {
    background: rgba(18, 183, 106, 0.05);
    color: #12b76a;
}

.checkbox-label input[type="checkbox"] {
    width: 16px !important;
    height: 16px !important;
    margin: 0;
    cursor: pointer;
    accent-color: #12b76a;
}

.archivos-cell {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 140px;
}

.archivo-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.archivo-nombre {
    font-size: 0.75rem;
    color: var(--text-muted);
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.timer-badge {
    background: var(--warning-light);
    color: var(--warning);
    padding: 0.1rem 0.4rem;
    border-radius: 0.25rem;
    font-size: 0.7rem;
    font-weight: 600;
}

.archivos-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.archivo-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    flex-wrap: wrap;
}

.archivo-card-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.archivo-card-info small {
    color: var(--text-muted);
    font-size: 0.78rem;
}

.archivo-card-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.anexos-section {
    margin-top: 1rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
}

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.modal-backdrop.hidden { display: none !important; }

.modal-card {
    width: 90%;
    max-width: 520px;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    animation: modalScaleUp 0.25s ease;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-large { max-width: 820px; }

@keyframes modalScaleUp {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

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

.modal-header h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-color);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
}

.modal-close:hover { color: var(--text-color); }

.modal-body {
    max-height: 55vh;
    overflow-y: auto;
    margin-bottom: 1.25rem;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.file-upload-zone {
    border: 2px dashed #cbd5e1;
    border-radius: 0.875rem;
    padding: 2rem 1.5rem;
    text-align: center;
    background: #f8fafc;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.file-upload-zone:hover,
.file-upload-zone.dragover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.file-upload-zone input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.file-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.5rem;
}

.file-rules {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.preview-list {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.preview-list.hidden { display: none; }

.preview-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.25rem;
}

.preview-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    padding: 0.65rem 0.85rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
    font-size: 0.85rem;
}

.btn-remove {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.78rem;
}

.btn-remove:hover { text-decoration: underline; }

#viewerModal {
    z-index: 200000 !important;
}

.pdf-viewer {
    width: 100%;
    height: 450px;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
}

.img-viewer {
    max-width: 100%;
    max-height: calc(85vh - 200px);
    display: block;
    margin: 0 auto;
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
    object-fit: contain;
}

/* Controles de Navegación Carrusel Multi-Imágenes */
.viewer-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(15, 23, 42, 0.75);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s ease;
    user-select: none;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}
.viewer-nav-btn:hover {
    background: rgba(15, 118, 110, 0.95);
    border-color: #14b8a6;
    transform: translateY(-50%) scale(1.08);
}
.viewer-nav-prev { left: 14px; }
.viewer-nav-next { right: 14px; }

.viewer-thumbnails-strip {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
    padding: 8px 10px;
    background: #f8fafc;
    border-radius: 6px;
    margin-top: 10px;
    overflow-x: auto;
}
.viewer-thumb {
    width: 46px;
    height: 46px;
    border-radius: 6px;
    border: 2px solid #cbd5e1;
    cursor: pointer;
    object-fit: cover;
    opacity: 0.65;
    transition: all 0.2s ease;
    background: #1e293b;
}
.viewer-thumb:hover {
    opacity: 0.95;
    transform: scale(1.06);
}
.viewer-thumb.active {
    border-color: #0f766e;
    opacity: 1;
    box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.35);
    transform: scale(1.08);
}
.viewer-thumb-pdf {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #ef4444;
    background: #fee2e2;
}

/* Botón Ver Detalle de Cuota no colapsable */
.btn-ver-detalle-cuota {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 26px !important;
    width: 26px !important;
    height: 26px !important;
    padding: 0 !important;
    font-size: 0.8rem !important;
    border-radius: 5px !important;
    flex-shrink: 0 !important;
}

.hidden { display: none !important; }

.login-footer {
    text-align: center;
    margin-top: 2rem;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.login-btn { width: 100%; }

/* --- DISEÑO DE LOGIN SPLIT-SCREEN --- */
.login-page-body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background-color: var(--bg-color);
    font-family: 'Inter', sans-serif;
}

.login-split-container {
    display: flex;
    width: 100%;
    min-height: 100vh;
    align-items: stretch;
}

.login-hero {
    flex: 1.2;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    background-color: #0a8d60; /* Soft brand green matching Bismarck logo background */
    position: relative;
    display: flex;
    align-items: flex-end;
    padding: 5rem 4rem;
    color: #ffffff;
}

.login-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.8) 0%, rgba(5, 150, 105, 0.75) 100%);
    z-index: 1;
}

.hero-overlay-content {
    position: relative;
    z-index: 2;
    max-width: 600px;
}

.hero-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.hero-logo-icon {
    font-size: 2.2rem;
}

.hero-logo h2 {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: #ffffff;
}

.hero-tagline {
    font-size: 1.15rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 400;
}

.login-pane {
    flex: 0.8;
    background-color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    box-shadow: -4px 0 24px rgba(15, 23, 42, 0.03);
}

.login-card {
    width: 100%;
    max-width: 440px;
    padding: 2.5rem;
    border: none;
    box-shadow: none;
    background: transparent;
}

.login-card.glass-effect {
    box-shadow: none;
    border: none;
    background: none;
}

.login-options {
    display: flex;
    justify-content: flex-end;
    margin-top: 1rem;
    font-size: 0.88rem;
}

.forgot-pass-link, .back-to-login-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.forgot-pass-link:hover, .back-to-login-link:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* --- BOTÓN FLOTANTE DE WHATSAPP --- */
.whatsapp-float-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background-color: #25d366;
    color: #ffffff;
    padding: 0.75rem 1.25rem;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    box-shadow: 0 4px 16px rgba(37, 211, 102, 0.35);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 9999;
}

.whatsapp-float-btn:hover {
    background-color: #128c7e;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.45);
}

.whatsapp-icon {
    width: 20px;
    height: 20px;
}

/* --- ADAPTACIONES Y MEJORAS ESTÉTICAS --- */
.badge-role-admin {
    background-color: var(--primary-light);
    color: var(--primary);
}

.badge-role-empleado {
    background-color: #fffbeb;
    color: #d97706;
}

/* Transiciones suaves en la navegación */
.nav-item {
    transition: all 0.25s ease;
    border-radius: 0.375rem;
    margin: 0.1rem 0.75rem;
    padding: 0.7rem 1rem;
}

.nav-item:hover {
    transform: translateX(2px);
}

.nav-item.active {
    box-shadow: var(--shadow-sm);
}

/* Tarjetas y tablas más limpias */
.section-card {
    border-radius: 1rem;
    border: 1px solid rgba(226, 232, 240, 0.8);
    background: #ffffff;
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.04);
}

body {
    background-image:
        radial-gradient(circle at 5% 5%, rgba(79, 70, 229, 0.04) 0%, transparent 40%),
        radial-gradient(circle at 95% 95%, rgba(5, 150, 105, 0.03) 0%, transparent 40%);
}

.table-container {
    border: 1px solid rgba(226, 232, 240, 0.6);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.01);
}

th {
    background: #f8fafc;
    border-bottom: 2px solid var(--border-color);
}

/* Animación spinner */
.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

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

@media (max-width: 1024px) {
    .login-hero {
        display: none;
    }
    .login-pane {
        flex: 1;
        padding: 2rem;
    }
    .login-card {
        padding: 1.5rem;
    }
}

/* ==========================================================================
   SISTEMA RESPONSIVO PROFESIONAL: BARRA APP MÓVIL Y DRAWER OFF-CANVAS
   ========================================================================== */
.mobile-top-bar {
    display: none;
}
.mobile-drawer-backdrop {
    display: none;
}
.mobile-drawer-close-btn {
    display: none;
}

@media (max-width: 992px) {
    /* Layout */
    .dashboard-layout {
        display: block;
        width: 100%;
        height: auto;
        min-height: 100vh;
        overflow-x: hidden;
    }

    /* Barra Superior Móvil Nativa (Estilo Prestamype / Fintech) */
    .mobile-top-bar {
        display: flex !important;
        position: sticky;
        top: 0;
        left: 0;
        right: 0;
        z-index: 9999;
        height: 56px;
        background: #ffffff;
        border-bottom: 1px solid #e2e8f0;
        padding: 0 1rem;
        align-items: center;
        justify-content: space-between;
        box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
    }
    .mobile-menu-btn {
        width: 40px;
        height: 40px;
        border-radius: 8px;
        border: 1px solid #e2e8f0;
        background: #f8fafc;
        display: flex;
        align-items: center;
        justify-content: center;
        color: #1e293b;
        cursor: pointer;
        flex-shrink: 0;
        transition: background 0.15s;
    }
    .mobile-menu-btn:hover {
        background: #f1f5f9;
    }
    .mobile-brand-container {
        display: flex;
        align-items: center;
        justify-content: center;
        flex: 1;
        cursor: pointer;
        max-width: calc(100% - 130px);
    }
    .mobile-brand-logo {
        max-height: 28px;
        width: auto;
        max-width: 100%;
        object-fit: contain;
    }
    .mobile-top-actions {
        display: flex;
        align-items: center;
        gap: 8px;
        flex-shrink: 0;
    }
    .mobile-company-chip {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        padding: 5px 9px;
        background: #f1f5f9;
        border: 1px solid #cbd5e1;
        border-radius: 20px;
        font-size: 0.76rem;
        font-weight: 700;
        color: #334155;
        cursor: pointer;
        transition: background 0.15s;
    }
    .mobile-user-chip {
        width: 34px;
        height: 34px;
        border-radius: 50%;
        background: #e0f2fe;
        border: 1.5px solid #bae6fd;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 0.95rem;
        cursor: pointer;
        color: #0288d1;
    }

    /* Backdrop para Menú Móvil */
    .mobile-drawer-backdrop {
        display: block !important;
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.6);
        backdrop-filter: blur(2px);
        z-index: 10000;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.25s ease;
    }
    .mobile-drawer-backdrop.active {
        opacity: 1;
        pointer-events: auto;
    }

    /* Sidebar Transformado en Drawer Off-Canvas */
    .sidebar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        bottom: 0 !important;
        width: 300px !important;
        max-width: 86vw !important;
        height: 100vh !important;
        background: #ffffff !important;
        z-index: 10001 !important;
        transform: translateX(-105%) !important;
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.22) !important;
        flex-direction: column !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        padding: 0 !important;
        display: flex !important;
    }
    .sidebar.mobile-open {
        transform: translateX(0) !important;
    }
    #sidebarToggleBtn {
        display: none !important;
    }
    .mobile-drawer-close-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        border-radius: 8px;
        border: 1px solid #e2e8f0;
        background: #f8fafc;
        font-size: 1.15rem;
        color: #64748b;
        cursor: pointer;
        transition: all 0.15s;
    }
    .mobile-drawer-close-btn:hover {
        background: #fee2e2;
        color: #ef4444;
        border-color: #fca5a5;
    }
    .sidebar-header {
        padding: 1rem 1.25rem !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        border-bottom: 1px solid #f1f5f9 !important;
        width: 100% !important;
        box-sizing: border-box !important;
        background: #ffffff !important;
    }
    .sidebar-header .logo {
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
        justify-content: flex-start !important;
    }
    .sidebar-brand-name {
        display: block !important;
        font-size: 0.95rem !important;
        font-weight: 700 !important;
        color: #0f172a !important;
    }
    .sidebar-logo-full,
    .sidebar-logo-img {
        display: block !important;
        max-height: 32px !important;
        width: auto !important;
    }
    .sidebar-logo-icon {
        display: none !important;
    }

    .sidebar-company-wrapper {
        padding: 0.85rem 1.25rem 0.5rem 1.25rem !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    .sidebar-company-wrapper .company-switcher-btn {
        width: 100% !important;
    }

    .sidebar-nav {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        padding: 0.5rem 1rem 1.5rem 1rem !important;
        gap: 6px !important;
        overflow-y: auto !important;
        flex: 1 !important;
        box-sizing: border-box !important;
    }

    /* Accordion en móvil: estilo nativo limpio y legible */
    .menu-accordion {
        width: 100% !important;
        margin-bottom: 6px !important;
        border-radius: 8px !important;
        position: static !important;
    }

    .menu-accordion-toggle {
        width: 100% !important;
        min-height: 44px !important;
        height: auto !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        padding: 0.75rem 0.85rem !important;
        background: #f8fafc !important;
        border: 1px solid #e2e8f0 !important;
        border-radius: 8px !important;
        cursor: pointer !important;
        text-align: left !important;
        margin: 0 !important;
        transition: all 0.15s ease !important;
        box-sizing: border-box !important;
    }

    .menu-accordion-toggle:hover {
        background: #f1f5f9 !important;
        border-color: #cbd5e1 !important;
    }

    .menu-accordion.open .menu-accordion-toggle {
        background: #eff6ff !important;
        border-color: #bfdbfe !important;
    }

    .group-icon-mini {
        display: inline-flex !important;
        font-size: 1.15rem !important;
        margin-right: 8px !important;
        align-items: center !important;
        justify-content: center !important;
        flex-shrink: 0 !important;
    }

    .group-title-text {
        display: inline !important;
        flex: 1 !important;
        font-size: 0.76rem !important;
        font-weight: 700 !important;
        color: #334155 !important;
        letter-spacing: 0.5px !important;
        text-transform: uppercase !important;
        white-space: normal !important;
        line-height: 1.3 !important;
    }

    .menu-accordion.open .group-title-text {
        color: #1d4ed8 !important;
    }

    .chevron {
        display: inline-block !important;
        font-size: 12px !important;
        font-weight: 800 !important;
        color: #94a3b8 !important;
        transition: transform 0.2s ease !important;
        margin-left: 6px !important;
        flex-shrink: 0 !important;
    }

    .menu-accordion.open .chevron {
        transform: rotate(90deg) !important;
        color: #1d4ed8 !important;
    }

    /* Submenú acordeón inline (NO flotante) */
    .menu-accordion-content {
        display: none !important;
        position: static !important;
        flex-direction: column !important;
        gap: 3px !important;
        background: #f8fafc !important;
        border: 1px solid #e2e8f0 !important;
        border-top: none !important;
        border-radius: 0 0 8px 8px !important;
        padding: 6px 6px !important;
        margin: -4px 0 6px 0 !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        box-shadow: none !important;
        z-index: auto !important;
        animation: none !important;
        box-sizing: border-box !important;
    }

    .menu-accordion.open .menu-accordion-content {
        display: flex !important;
    }

    /* Ocultar el título repetido del flyout */
    .mini-flyout-title {
        display: none !important;
    }

    /* Elementos del menú nav-item */
    .sidebar-nav .nav-item {
        width: 100% !important;
        height: auto !important;
        min-height: 42px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: flex-start !important;
        gap: 10px !important;
        padding: 0.65rem 0.85rem !important;
        border-radius: 6px !important;
        background: transparent !important;
        color: #334155 !important;
        text-decoration: none !important;
        margin: 0 !important;
        border-left: none !important;
        cursor: pointer !important;
        box-sizing: border-box !important;
        transition: background 0.15s ease, color 0.15s ease !important;
    }

    .sidebar-nav .nav-item:hover {
        background: #ffffff !important;
        color: #0f172a !important;
    }

    .sidebar-nav .nav-item.active {
        background: #ffffff !important;
        color: var(--primary, #059669) !important;
        font-weight: 700 !important;
        box-shadow: 0 1px 3px rgba(0,0,0,0.06) !important;
    }

    .sidebar-nav .nav-item .nav-icon {
        font-size: 1.15rem !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        margin: 0 !important;
        flex-shrink: 0 !important;
    }

    .sidebar-nav .nav-item .nav-label {
        display: inline !important;
        font-size: 0.86rem !important;
        font-weight: inherit !important;
        color: inherit !important;
        white-space: normal !important;
        flex: 1 !important;
    }

    .sidebar-nav .nav-item .badge {
        display: inline-block !important;
        position: static !important;
        margin-left: auto !important;
        padding: 2px 7px !important;
        font-size: 0.72rem !important;
        font-weight: 700 !important;
        border-radius: 10px !important;
        background: #ef4444 !important;
        color: #ffffff !important;
    }

    /* Mi perfil en móvil */
    #nav-perfil {
        width: 100% !important;
        height: auto !important;
        min-height: 42px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: flex-start !important;
        gap: 10px !important;
        padding: 0.65rem 0.85rem !important;
        border-radius: 8px !important;
        background: #f8fafc !important;
        border: 1px solid #e2e8f0 !important;
        margin: 10px 0 0 0 !important;
        cursor: pointer !important;
    }
    #nav-perfil .nav-label {
        display: inline !important;
        font-size: 0.86rem !important;
        font-weight: 700 !important;
        color: #334155 !important;
    }

    /* Footer del sidebar */
    .sidebar-footer {
        padding: 1rem 1.25rem !important;
        width: 100% !important;
        box-sizing: border-box !important;
        border-top: 1px solid #f1f5f9 !important;
        margin-top: auto !important;
        background: #ffffff !important;
    }

    .btn-logout {
        width: 100% !important;
        min-height: 42px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 8px !important;
        font-size: 0.86rem !important;
        font-weight: 600 !important;
        padding: 8px 14px !important;
        border-radius: 8px !important;
        background: #fef2f2 !important;
        color: #dc2626 !important;
        border: 1px solid #fecaca !important;
    }

    .btn-logout span:not(.logout-icon) {
        display: inline !important;
    }

    /* Quitar tooltips flotantes en móvil */
    .dashboard-layout.sidebar-collapsed .nav-item[data-title]:hover::after,
    .dashboard-layout.sidebar-collapsed .nav-item[data-title]:hover::before,
    .nav-item[data-title]:hover::after,
    .nav-item[data-title]:hover::before {
        display: none !important;
    }

    /* Main content */
    .main-content {
        padding: 1rem 0.85rem 4rem 0.85rem !important;
        width: 100% !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important;
    }
    .header-top {
        margin-bottom: 1.25rem !important;
        padding-bottom: 0.75rem !important;
        border-bottom: 1px solid #e2e8f0 !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 4px !important;
    }
    .header-top .user-profile {
        display: none !important;
    }
    .welcome-text h1 {
        font-size: 1.35rem !important;
    }
    .welcome-text p {
        font-size: 0.8rem !important;
        line-height: 1.35 !important;
    }
}

@media (max-width: 768px) {

    /* Prevenir cualquier desbordamiento horizontal en móvil */
    html, body {
        overflow-x: hidden !important;
        max-width: 100vw !important;
    }
    .dashboard-layout,
    .main-content,
    .container-fluid,
    .view-section {
        width: 100% !important;
        max-width: 100vw !important;
        min-width: 0 !important;
        overflow-x: hidden !important;
        box-sizing: border-box !important;
    }

    /* Ocultar header-top repetitivo en vistas de formulario (elimina doble cabecera) */
    body.in-form-view .header-top,
    body:has(#view-nueva-simulacion.active) .header-top,
    body:has(#view-nueva-solicitud.active) .header-top,
    body:has(#view-nuevo-credito.active) .header-top,
    body:has(#view-simular-credito.active) .header-top {
        display: none !important;
    }

    /* Header-top compacto en vistas de lista */
    .header-top {
        margin-bottom: 0.85rem !important;
        padding-bottom: 0.5rem !important;
    }
    .welcome-text h1 {
        font-size: 1.15rem !important;
        font-weight: 800 !important;
    }
    .welcome-text p {
        display: none !important;
    }

    /* Tables: scroll horizontal encapsulado estrictamente dentro del contenedor */
    .table-container,
    .table-responsive {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        display: block !important;
        box-sizing: border-box !important;
    }
    table {
        min-width: 0 !important;
    }
    .table-container > #creditosTable { min-width: 750px !important; }
    .table-container > #tablaSolicitudes { min-width: 700px !important; }
    .table-container > #cronogramaTable { min-width: 820px !important; }
    .table-container > #clientesTable,
    .table-container > #usuariosTable,
    .table-container > #clientesPotencialesTable {
        min-width: 680px !important;
    }

    /* Vista resumen del cronograma: se adapta al ancho de pantalla */
    .crono-vista-resumen {
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
    }

    /* Action buttons: wrap & stack */
    .btn-group-inline {
        display: flex;
        flex-direction: column;
        gap: 4px;
        align-items: flex-start;
    }
    .btn-group-inline .btn-primary,
    .btn-group-inline .btn-secondary,
    .btn-group-inline .btn-danger {
        width: 100%;
        font-size: 0.8rem;
    }
    td .btn, td .btn-primary, td .btn-secondary, td .btn-danger {
        font-size: 0.78rem;
        padding: 0.4rem 0.65rem;
        margin-bottom: 3px;
        display: inline-block;
    }

    /* Modals: full-width */
    .modal-card { width: 96vw !important; max-width: 96vw !important; margin: 0 auto; }
    .modal-backdrop { padding: 1rem 0.5rem; align-items: flex-start; }

    /* Section cards */
    .section-card {
        padding: 0.85rem !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important;
        border-radius: 12px !important;
    }
    .table-header { flex-direction: column; align-items: flex-start; gap: 8px; }

    /* Permission grids */
    .permisos-grid { grid-template-columns: 1fr !important; }

    /* WhatsApp float */
    .whatsapp-float-btn {
        bottom: 1rem;
        right: 1rem;
        padding: 0.6rem 1rem;
        font-size: 0.8rem;
    }

    /* Charts & Canvas Responsive */
    .dashboard-charts-grid { 
        grid-template-columns: 1fr !important; 
        gap: 1rem !important;
    }
    .chart-card {
        padding: 1.15rem 0.85rem !important;
        border-radius: 10px !important;
        overflow: hidden !important;
    }
    .chart-card h3 {
        font-size: 0.96rem !important;
        margin-bottom: 0.65rem !important;
        padding-left: 0.2rem !important;
    }
    .chart-container-canvas {
        height: 350px !important;
        min-height: 330px !important;
        max-height: 380px !important;
    }
    .ranking-filters-bar {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 8px !important;
        padding: 10px !important;
    }
    .ranking-filters-bar > div {
        width: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 4px !important;
    }
    .ranking-filters-bar input,
    .ranking-filters-bar select {
        width: 100% !important;
        box-sizing: border-box !important;
    }

    /* Credit summary tags */
    .credit-summary-tags { flex-wrap: wrap; gap: 4px; }

    /* Cronograma print actions */
    #cronogramaPrintActions { flex-wrap: wrap; gap: 4px; }
    #cronogramaPrintActions button { font-size: 0.78rem; padding: 0.4rem 0.7rem; }

    /* ADV modal upload area */
    .upload-drop-area { padding: 1rem; }

    /* Formulario adaptativo en Celular y Tablet: apilamiento vertical a prueba de fallos */
    .grid-form,
    #view-nuevo-credito .grid-form,
    #view-nueva-solicitud .grid-form,
    #view-simular-credito .grid-form,
    #view-nueva-simulacion .grid-form {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
        gap: 1rem !important;
    }

    /* En vista móvil dentro de formulario, ocultar el header principal para evitar duplicidad */
    body.in-form-view .header-top {
        display: none !important;
    }

    /* Grillas en 2 columnas emparejadas en celular y tablet */
    .solicitud-fila-2col,
    .credito-fila-2col,
    .solicitud-fila-3col,
    .credito-fila-3col {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 8px 10px !important;
        margin-bottom: 8px !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
    }

    .solicitud-fila-2col > .form-group,
    .credito-fila-2col > .form-group,
    .solicitud-fila-3col > .form-group,
    .credito-fila-3col > .form-group {
        min-width: 0 !important;
        max-width: 100% !important;
        width: 100% !important;
        box-sizing: border-box !important;
        margin-bottom: 0 !important;
    }

    /* Ocultar placeholders vacíos en celular/tablet */
    .solicitud-fila-3col > .form-group:empty,
    .credito-fila-3col > .form-group:empty {
        display: none !important;
    }

    /* El 3er elemento sin pareja en móvil ocupa ambas columnas */
    .solicitud-fila-3col > .form-group:nth-child(3):last-child,
    .credito-fila-3col > .form-group:nth-child(3):last-child {
        grid-column: span 2 !important;
    }

    .form-group.col-span-full {
        grid-column: span 2 !important;
    }

    .cliente-label-row {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        margin-bottom: 4px !important;
    }

    .btn-agregar-cliente-pill {
        background: #eff6ff !important;
        border: 1px solid #bfdbfe !important;
        color: #2563eb !important;
        font-size: 0.72rem !important;
        font-weight: 700 !important;
        cursor: pointer !important;
        padding: 3px 8px !important;
        border-radius: 6px !important;
        display: inline-flex !important;
        align-items: center !important;
        gap: 4px !important;
        line-height: 1.2 !important;
    }

    .form-standard input:not([type="checkbox"]):not([type="radio"]),
    .form-standard select,
    .form-standard textarea {
        height: 38px !important;
        font-size: 0.84rem !important;
        border-radius: 8px !important;
        border: 1px solid #cbd5e1 !important;
        padding: 0.35rem 0.55rem !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
        background: #ffffff !important;
        text-overflow: ellipsis !important;
    }

    /* Excepción obligatoria para inputs con ícono interior (como en Login o formularios especiales) */
    .form-standard .input-icon-group input,
    .login-form .input-icon-group input,
    .input-icon-group input,
    #username,
    #password,
    #recover_input {
        padding-left: 50px !important;
        padding-right: 50px !important;
        height: 48px !important;
        font-size: 0.95rem !important;
    }

    .form-standard input[type="checkbox"],
    .form-standard input[type="radio"] {
        width: 18px !important;
        height: 18px !important;
        min-width: 18px !important;
        max-width: 18px !important;
        margin: 0 !important;
        padding: 0 !important;
        flex-shrink: 0 !important;
        display: inline-block !important;
    }

    .form-standard input:focus,
    .form-standard select:focus,
    .form-standard textarea:focus {
        border-color: #059669 !important;
        box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.12) !important;
        outline: none !important;
    }

    .form-standard input[readonly] {
        background: #f8fafc !important;
        color: #475569 !important;
    }

    .form-standard label {
        font-size: 0.72rem !important;
        font-weight: 700 !important;
        color: #475569 !important;
        text-transform: uppercase !important;
        letter-spacing: 0.3px !important;
        margin-bottom: 3px !important;
        display: block !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    /* Cajas temáticas estilizadas en móvil */
    .solicitud-caja-bienes {
        background: #f0f9ff !important;
        border: 1px solid #bae6fd !important;
        border-radius: 12px !important;
        padding: 10px 12px !important;
        margin: 10px 0 !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .caja-bienes-header {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        gap: 8px !important;
        margin-bottom: 8px !important;
    }

    .caja-bienes-header h4 {
        margin: 0 !important;
        color: #0288d1 !important;
        font-size: 0.88rem !important;
        font-weight: 700 !important;
        display: inline-flex !important;
        align-items: center !important;
        gap: 5px !important;
    }

    .caja-bienes-header button,
    .caja-bienes-header .btn-anadir-bien {
        background: #5046e5 !important;
        color: #ffffff !important;
        border: none !important;
        padding: 6px 12px !important;
        font-size: 0.76rem !important;
        font-weight: 700 !important;
        border-radius: 8px !important;
        white-space: nowrap !important;
        box-shadow: 0 2px 4px rgba(80, 70, 229, 0.25) !important;
        flex-shrink: 0 !important;
    }

    .solicitud-caja-financiera,
    .credito-caja-especial {
        background: #f0fdf4 !important;
        border: 1px solid #bbf7d0 !important;
        border-radius: 12px !important;
        padding: 10px 12px !important;
        margin: 10px 0 !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .solicitud-caja-financiera h4,
    .credito-caja-especial h4 {
        margin: 0 0 8px 0 !important;
        color: #166534 !important;
        font-size: 0.84rem !important;
        font-weight: 700 !important;
    }

    .form-section-header {
        display: flex !important;
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: center !important;
        gap: 8px !important;
        margin-bottom: 10px !important;
        padding-bottom: 8px !important;
        border-bottom: 1px solid #f1f5f9 !important;
    }

    .form-section-header > div:first-child {
        min-width: 0 !important;
        flex: 1 1 auto !important;
    }

    .form-section-header h2 {
        font-size: 1.05rem !important;
        font-weight: 800 !important;
        color: #0f172a !important;
        margin: 0 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .form-section-header p {
        display: none !important;
    }

    .form-header-actions {
        display: flex !important;
        width: auto !important;
        gap: 6px !important;
        flex-shrink: 0 !important;
    }

    .form-header-actions .btn {
        height: 32px !important;
        padding: 0 10px !important;
        font-size: 0.76rem !important;
        font-weight: 700 !important;
        border-radius: 6px !important;
        display: inline-flex !important;
        align-items: center !important;
        gap: 4px !important;
        white-space: nowrap !important;
    }

    .credito-form-actions {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
        margin-top: 14px !important;
        width: 100% !important;
    }

    .credito-form-actions button {
        flex: 1 1 calc(50% - 4px) !important;
        height: 42px !important;
        font-size: 0.84rem !important;
        font-weight: 700 !important;
        border-radius: 8px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 6px !important;
    }

    .credito-form-actions .credito-btn-guardar,
    .credito-form-actions button[type="submit"] {
        flex: 1 1 100% !important;
    }

    .dashboard-kpi-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    /* Barras de filtros responsivas (evitan desbordamiento en listados) */
    #creditosFiltersBar,
    #solicitudesFiltersBar,
    .filters-card {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 6px !important;
        width: 100% !important;
    }
    #creditosFiltersBar > input,
    #creditosFiltersBar > select,
    #solicitudesFiltersBar > input,
    #solicitudesFiltersBar > select {
        flex: 1 1 calc(50% - 4px) !important;
        min-width: 0 !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    #creditosFiltersBar > button,
    #solicitudesFiltersBar > button {
        flex: 1 1 100% !important;
        margin-top: 2px !important;
    }

    /* ==========================================================================
       MODALES CREAR / EDITAR CLIENTE EN MÓVIL (EXCLUSIVO MÓVIL <= 768px)
       ========================================================================== */
    #crearClientePotencialModal .modal-card,
    #editClienteModal .modal-card {
        width: 95vw !important;
        max-width: 95vw !important;
        padding: 1.1rem 0.85rem !important;
        margin: 6px auto !important;
        max-height: 92vh !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        box-sizing: border-box !important;
        border-radius: 14px !important;
    }

    #crearClientePotencialModal form,
    #editClienteModal form {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: hidden !important;
        box-sizing: border-box !important;
    }

    /* Fila Tipo Persona + Documento: apilados verticalmente al 100% de ancho */
    .modal-cliente-tipo-doc-row {
        display: flex !important;
        flex-direction: column !important;
        gap: 10px !important;
        margin-bottom: 0.85rem !important;
        width: 100% !important;
    }

    .modal-cliente-tipo-doc-row > .form-group {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        margin: 0 !important;
    }

    .modal-cliente-tipo-doc-row > .form-group > div {
        display: flex !important;
        gap: 8px !important;
        width: 100% !important;
    }

    .modal-cliente-tipo-doc-row input[type="text"] {
        flex: 1 1 auto !important;
        min-width: 0 !important;
    }

    /* Botón Consultar RENIEC / SUNAT */
    #btn_consultar_potencial_ruc,
    #btn_consultar_edit_ruc {
        padding: 0.55rem 0.95rem !important;
        font-size: 0.8rem !important;
        white-space: nowrap !important;
        flex-shrink: 0 !important;
        border-radius: 8px !important;
    }

    /* Fila Ubigeo: 2x2 grid en móvil */
    .modal-cliente-ubigeo-row {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 8px 10px !important;
        margin-bottom: 0.85rem !important;
        width: 100% !important;
    }

    .modal-cliente-ubigeo-row > .form-group {
        width: 100% !important;
        min-width: 0 !important;
        margin: 0 !important;
    }

    .modal-cliente-ubigeo-row .custom-select-trigger {
        padding: 0.5rem 0.6rem !important;
        font-size: 0.78rem !important;
        height: 38px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
    }

    .modal-cliente-ubigeo-row .custom-select-text {
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        display: block !important;
        max-width: 115px !important;
    }

    /* Fila SUNAT (Fechas, Estado, Condición): 2x2 grid en móvil */
    .modal-cliente-sunat-row {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 8px 10px !important;
        margin-bottom: 0.85rem !important;
        width: 100% !important;
    }

    .modal-cliente-sunat-row > .form-group {
        width: 100% !important;
        min-width: 0 !important;
        margin: 0 !important;
    }

    /* Fila Partida y Registro: 1 columna en móvil */
    .modal-cliente-partida-row {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 8px !important;
        margin-bottom: 0.85rem !important;
        width: 100% !important;
    }

    .modal-cliente-partida-row > .form-group {
        width: 100% !important;
        min-width: 0 !important;
        margin: 0 !important;
    }

    /* Fila Contacto (Email y Teléfono): 1 columna en móvil */
    .modal-cliente-contacto-row {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 8px !important;
        margin-bottom: 0.85rem !important;
        width: 100% !important;
    }

    .modal-cliente-contacto-row > .form-group {
        width: 100% !important;
        min-width: 0 !important;
        margin: 0 !important;
    }

    /* Selector Multi-Empresa en móvil */
    .multi-empresa-selector-card {
        padding: 8px 10px !important;
    }
    .empresa-check-row {
        padding: 6px 10px !important;
    }
    .empresa-check-left {
        gap: 8px !important;
        font-size: 0.8rem !important;
    }

    /* ==========================================================================
       MODAL AGREGAR BIEN / VEHÍCULO EN MÓVIL (EXCLUSIVO MÓVIL <= 768px)
       ========================================================================== */
    #modalAgregarBien .modal-card {
        width: 95vw !important;
        max-width: 95vw !important;
        padding: 1.1rem 0.9rem !important;
        margin: 6px auto !important;
        border-radius: 16px !important;
        box-sizing: border-box !important;
    }

    /* Fila Unidades y Precio Unitario: apilados verticalmente en móvil */
    .modal-bien-unidades-precio-row {
        display: flex !important;
        flex-direction: column !important;
        gap: 12px !important;
        margin-bottom: 14px !important;
        width: 100% !important;
    }

    .modal-bien-unidades-precio-row > .form-group {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        margin-bottom: 0 !important;
    }

    .modal-bien-unidades-precio-row label {
        display: block !important;
        font-size: 0.84rem !important;
        font-weight: 700 !important;
        color: #334155 !important;
        margin-bottom: 5px !important;
        white-space: nowrap !important;
    }

    .modal-bien-unidades-precio-row #modal_bien_unidades {
        height: 44px !important;
        font-size: 1.05rem !important;
        font-weight: 700 !important;
        text-align: center !important;
        border-radius: 10px !important;
        width: 100% !important;
        box-sizing: border-box !important;
        background: #ffffff !important;
        border: 1.5px solid #cbd5e1 !important;
    }

    .modal-bien-unidades-precio-row #modal_bien_precio_unitario {
        height: 44px !important;
        font-size: 1.05rem !important;
        font-weight: 700 !important;
        text-align: right !important;
        border-radius: 10px !important;
        padding-left: 54px !important;
        padding-right: 14px !important;
        width: 100% !important;
        box-sizing: border-box !important;
        background: #ffffff !important;
        border: 1.5px solid #cbd5e1 !important;
    }

    .modal-bien-unidades-precio-row #modal_bien_moneda_prefix {
        font-size: 0.95rem !important;
        font-weight: 800 !important;
        color: #059669 !important;
        left: 14px !important;
    }

    #modal_bien_subtotal_preview {
        padding: 10px 14px !important;
        border-radius: 10px !important;
    }

    #modalAgregarBien .modal-actions {
        display: flex !important;
        justify-content: space-between !important;
        gap: 8px !important;
        width: 100% !important;
    }

    #modalAgregarBien .modal-actions button {
        padding: 9px 12px !important;
        font-size: 0.82rem !important;
        white-space: nowrap !important;
    }

    #modalAgregarBien .modal-actions button.btn-secondary {
        flex: 0 0 auto !important;
        min-width: 80px !important;
    }

    #modalAgregarBien .modal-actions button.btn-primary {
        flex: 1 1 auto !important;
        justify-content: center !important;
    }
}

@media (max-width: 480px) {
    /* Extra small phones */
    .main-content { padding: 0.75rem 0.5rem 4rem 0.5rem !important; }
    .section-card { padding: 0.85rem 0.75rem !important; border-radius: 12px; }

    /* Buttons on phones */
    .btn-primary, .btn-secondary, .btn-danger {
        font-size: 0.82rem;
        padding: 0.5rem 0.75rem;
    }

    /* Modal */
    .modal-card { padding: 1rem; width: 95vw !important; }
    .modal-header h3, .modal-header h2 { font-size: 1.05rem; }
}

/* ==========================================================================
   ESTILOS CRONOGRAMA RESPONSIVO (INSPIRACIÓN PRESTAMYPE) - SOLO MÓVIL
   ========================================================================== */
.crono-tabs-container {
    display: none !important;
}

@media (min-width: 769px) {
    .crono-tabs-container {
        display: none !important;
    }
    .crono-subrow-detalle {
        display: none !important;
    }
    .crono-row {
        cursor: default !important;
    }
}

@media (max-width: 768px) {
    .crono-tabs-container {
        display: flex !important;
        justify-content: space-between;
        align-items: center;
        margin: 10px 0 12px 0;
        flex-wrap: wrap;
        gap: 8px;
    }
    .crono-tabs-pills {
        display: inline-flex;
        background: #f1f5f9;
        padding: 3px;
        border-radius: 10px;
        border: 1px solid #e2e8f0;
        gap: 3px;
    }
    .crono-tab-btn {
        border: none;
        background: transparent;
        padding: 6px 14px;
        border-radius: 7px;
        font-size: 0.78rem;
        font-weight: 600;
        color: #64748b;
        cursor: pointer;
        transition: all 0.2s ease;
        display: inline-flex;
        align-items: center;
        gap: 5px;
    }
    .crono-tab-btn:hover {
        color: #1e293b;
    }
    .crono-tab-btn.active {
        background: #ffffff;
        color: var(--primary, #059669);
        font-weight: 700;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    }
    .crono-badge-subinfo {
        font-size: 0.76rem;
        color: #64748b;
        background: #f8fafc;
        padding: 4px 10px;
        border-radius: 6px;
        border: 1px solid #e2e8f0;
        font-weight: 600;
    }

    /* Modo Resumen: enfocado en legibilidad móvil */
    .crono-vista-resumen {
        width: 100% !important;
        min-width: 100% !important;
        table-layout: auto !important;
    }
    .crono-vista-resumen th:nth-child(5),
    .crono-vista-resumen td:nth-child(5),
    .crono-vista-resumen th:nth-child(6),
    .crono-vista-resumen td:nth-child(6),
    .crono-vista-resumen th:nth-child(7),
    .crono-vista-resumen td:nth-child(7),
    .crono-vista-resumen th:nth-child(8),
    .crono-vista-resumen td:nth-child(8),
    .crono-vista-resumen th:nth-child(9),
    .crono-vista-resumen td:nth-child(9),
    .crono-vista-resumen th:nth-child(10),
    .crono-vista-resumen td:nth-child(10),
    .crono-vista-resumen th:nth-child(11),
    .crono-vista-resumen td:nth-child(11),
    .crono-vista-resumen th:nth-child(12),
    .crono-vista-resumen td:nth-child(12) {
        display: none !important;
    }
    .crono-vista-resumen th,
    .crono-vista-resumen td {
        padding: 9px 8px !important;
        font-size: 0.82rem !important;
    }
    .crono-vista-resumen tbody tr.crono-row {
        cursor: pointer;
        transition: background 0.15s ease;
    }
    .crono-vista-resumen tbody tr.crono-row:hover {
        background: #f0fdf4 !important;
    }
    .crono-subrow-detalle {
        transition: all 0.2s ease;
    }
    .crono-subrow-detalle.hidden {
        display: none !important;
    }

    /* Modo Completo: 13 columnas con scroll horizontal en móvil */
    .crono-vista-completa {
        min-width: 1000px !important;
    }
    .crono-vista-completa .crono-subrow-detalle {
        display: none !important;
    }
}

/* Fila de selección de cliente */
.fila-cliente-selector {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 14px;
    align-items: start;
    margin-bottom: 12px;
}
.btn-agregar-cliente-pill {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #2563eb;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    padding: 2px 8px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    line-height: 1.2;
    transition: all 0.15s;
}
.btn-agregar-cliente-pill:hover {
    background: #dbeafe;
}


/* --- CLASES DE REDISEÑO PREMIUM (ESTILO BISMARCK EN VERDE) --- */
.hero-overlay-green {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.82) 0%, rgba(4, 120, 87, 0.88) 100%);
    z-index: 1;
}

.login-card-wrapper {
    width: 100%;
    max-width: 440px;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.login-footer-copy {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 1rem;
    line-height: 1.4;
}

.secure-badge {
    position: static;
    font-size: 0.72rem;
    font-weight: 700;
    color: #94a3b8;
    letter-spacing: 0.08em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    margin: 0.5rem auto 0 auto;
    text-align: center;
}

/* Campos de entrada con Icono Interior */
.input-icon-group {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.input-icon-group input,
.form-standard .input-icon-group input,
.login-form .input-icon-group input {
    padding-left: 2.85rem !important;
    padding-right: 2.85rem !important;
    height: 48px !important;
    border-radius: 8px !important;
    border: 1px solid var(--border-color) !important;
    width: 100% !important;
    font-size: 0.95rem !important;
    background-color: #f8fafc !important;
    transition: all 0.25s ease !important;
    box-sizing: border-box !important;
}

.input-icon-group input:focus,
.form-standard .input-icon-group input:focus,
.login-form .input-icon-group input:focus {
    background-color: #ffffff !important;
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15) !important;
    outline: none !important;
}

.input-icon-left {
    position: absolute !important;
    left: 1rem !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: #94a3b8 !important;
    pointer-events: none !important;
    z-index: 2 !important;
}

.password-toggle-btn {
    position: absolute !important;
    right: 1rem !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    background: none !important;
    border: none !important;
    color: #94a3b8 !important;
    cursor: pointer !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: color 0.2s !important;
    z-index: 2 !important;
}

.password-toggle-btn:hover {
    color: var(--text-color);
}

.forgot-pass-link-inline {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s;
}

.forgot-pass-link-inline:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* Buscador de Clientes Dinámico */
.search-input-field {
    width: 100%;
    padding: 0.65rem 0.85rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
    font-size: 0.9rem;
    transition: all 0.2s;
}

.search-input-field:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.12);
    outline: none;
}

.search-results-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    max-height: 220px;
    overflow-y: auto;
    z-index: 9999;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

.search-result-item {
    padding: 0.65rem 0.95rem;
    cursor: pointer;
    font-size: 0.88rem;
    transition: all 0.15s ease;
}

.search-result-item:hover {
    background: var(--primary-light);
    color: var(--primary-hover);
}

/* Grillas y contenedores de documentos */
.docs-upload-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    background: #f8fafc;
    padding: 0.75rem;
    border-radius: 8px;
    border: 1px dashed var(--border-color);
}

.docs-list-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
    background: #ffffff;
}

.input-readonly {
    background-color: #f1f5f9;
    color: #64748b;
    cursor: not-allowed;
}

/* Formato de alineación inline de botones */
.btn-group-inline {
    display: flex;
    gap: 4px;
}

/* Dashboard Styles */
.dashboard-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}
.kpi-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.03);
    border-left: 5px solid #00796b;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.kpi-card.kpi-otorgado { border-left-color: #00796b; }
.kpi-card.kpi-pagado { border-left-color: #2e7d32; }
.kpi-card.kpi-pendiente { border-left-color: #f57c00; }
.kpi-card.kpi-mora { border-left-color: #d32f2f; }
.kpi-card.kpi-penalidad { border-left-color: #ea580c; }
.kpi-card .kpi-title {
    font-size: 0.8rem;
    color: #757575;
    text-transform: uppercase;
    font-weight: 700;
    margin-bottom: 0.5rem;
}
.kpi-card .kpi-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: #212121;
}
.kpi-card .kpi-value-secondary {
    font-size: 1.15rem;
    font-weight: 600;
    color: #666;
    margin-top: 0.25rem;
}
.dashboard-charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}
@media (max-width: 900px) {
    .dashboard-charts-grid {
        grid-template-columns: 1fr;
    }
}
.chart-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.03);
    min-height: 360px;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.chart-card h3 {
    align-self: flex-start;
    margin-top: 0;
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    color: #333;
    border-bottom: 2px solid #e8f5e9;
    width: 100%;
    padding-bottom: 8px;
    font-weight: 700;
}
.chart-container-canvas {
    position: relative;
    width: 100%;
    height: 300px;
    min-height: 290px;
    max-height: 330px;
    display: flex;
    justify-content: center;
    align-items: center;
}
.ranking-filters-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    background: #f5f5f5;
    padding: 12px;
    border-radius: 8px;
}
.ranking-filters-bar input, .ranking-filters-bar select {
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 0.9rem;
    outline: none;
}
.ranking-filters-bar input:focus, .ranking-filters-bar select:focus {
    border-color: #00796b;
}

/* Custom Multiselect styles */
.multiselect-dropdown label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 0.85rem;
    margin: 0;
    transition: background 0.2s;
    color: #333;
    font-weight: 500;
}
.multiselect-dropdown label:hover {
    background: #e8f5e9;
}
.multiselect-dropdown label input {
    margin: 0;
    width: auto !important;
    cursor: pointer;
}

/* Premium Custom Searchable Select */
.custom-select-container {
    position: relative;
    width: 100%;
}
.custom-select-trigger {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 0.6rem;
    border-radius: 0.375rem;
    border: 1px solid var(--border-color);
    background: white;
    cursor: pointer;
    font-size: 0.9rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}
.custom-select-trigger:hover {
    border-color: var(--primary);
}
.custom-select-trigger.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(9, 188, 138, 0.25);
}
.custom-select-trigger.disabled {
    background-color: #f1f5f9;
    color: #94a3b8;
    cursor: not-allowed;
    border-color: var(--border-color);
}
.custom-select-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.custom-select-arrow {
    font-size: 0.75rem;
    color: #475569;
    transition: transform 0.2s ease;
}
.custom-select-trigger.active .custom-select-arrow {
    transform: rotate(180deg);
}
.custom-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    z-index: 1000;
    margin-top: 4px;
    padding: 8px;
}
.custom-select-search-wrapper {
    margin-bottom: 8px;
}
.custom-select-search-input {
    width: 100%;
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    font-size: 0.85rem;
    box-sizing: border-box;
}
.custom-select-search-input:focus {
    border-color: var(--primary);
    outline: none;
}
.custom-select-options {
    max-height: 180px;
    overflow-y: auto;
}
.custom-select-option {
    padding: 0.5rem 0.6rem;
    cursor: pointer;
    font-size: 0.85rem;
    border-radius: 0.25rem;
    color: var(--text-color);
    transition: background 0.1s ease;
    text-align: left;
}
.custom-select-option:hover {
    background-color: rgba(9, 188, 138, 0.1);
    color: #0b6623;
    font-weight: 600;
}
.custom-select-option.selected {
    background-color: var(--primary);
    color: white;
    font-weight: 700;
}
.custom-select-option.no-results {
    color: #94a3b8;
    cursor: default;
    text-align: center;
    padding: 0.5rem 0;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* --- PAGINACIÓN MODERNA Y FLUIDA --- */
.pagination-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding: 14px 4px 4px;
    margin-top: 12px;
    border-top: 1px solid var(--border-color);
}

.pagination-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.pagination-info {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.pagination-info strong {
    color: var(--text-color);
    font-weight: 600;
}

.pagination-size-select {
    padding: 4px 8px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-color);
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    outline: none;
    transition: all 0.2s ease;
}

.pagination-size-select:hover,
.pagination-size-select:focus {
    border-color: var(--primary);
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}

.pagination-btn {
    min-width: 32px;
    height: 32px;
    padding: 0 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-color);
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
}

.pagination-btn.active {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
    font-weight: 700;
    box-shadow: 0 1px 3px rgba(16, 185, 129, 0.3);
}

.pagination-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    background: #f8fafc;
}

.pagination-nav {
    padding: 0 10px;
    font-size: 0.8rem;
    font-weight: 600;
}

.pagination-ellipsis {
    padding: 0 4px;
    color: var(--text-muted);
    font-size: 0.85rem;
    letter-spacing: 1px;
}

/* ==========================================================================
   MÓDULO: TRAZABILIDAD DE TIEMPOS, WORKFLOW GANTT & CALENDARIO SLA
   ========================================================================== */

.tiempos-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.tiempos-kpi-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.tiempos-kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.08);
}

.tiempos-kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.tiempos-kpi-info {
    display: flex;
    flex-direction: column;
}

.tiempos-kpi-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tiempos-kpi-value {
    font-size: 1.35rem;
    font-weight: 800;
    color: #1e293b;
    line-height: 1.2;
    margin-top: 2px;
}

.tiempos-kpi-sub {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 2px;
}

/* Selector de Vistas */
.tiempos-view-tabs {
    display: inline-flex;
    background: #f1f5f9;
    padding: 4px;
    border-radius: 8px;
    gap: 4px;
}

.tiempos-view-tab {
    padding: 7px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #64748b;
    border-radius: 6px;
    cursor: pointer;
    border: none;
    background: transparent;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tiempos-view-tab.active {
    background: #ffffff;
    color: var(--primary, #0ea5e9);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Barra de Avance Gantt */
.workflow-gantt-wrapper {
    position: relative;
    width: 100%;
    min-width: 260px;
}

.workflow-gantt-bar {
    display: flex;
    height: 18px;
    width: 100%;
    background: #e2e8f0;
    border-radius: 9px;
    overflow: hidden;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.08);
}

.gantt-segment {
    position: relative;
    height: 100%;
    transition: filter 0.15s ease, transform 0.15s ease;
    cursor: pointer;
}

.gantt-segment:hover {
    filter: brightness(1.12);
    z-index: 10;
}

.gantt-segment.is-active {
    animation: ganttPulse 2s infinite ease-in-out;
}

@keyframes ganttPulse {
    0% { opacity: 0.85; }
    50% { opacity: 1; }
    100% { opacity: 0.85; }
}

/* Tooltip interactivo flotante */
.gantt-tooltip-bubble {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #0f172a;
    color: #ffffff;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.75rem;
    line-height: 1.35;
    white-space: nowrap;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.3);
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease, visibility 0.15s ease;
}

.gantt-tooltip-bubble::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 5px;
    border-style: solid;
    border-color: #0f172a transparent transparent transparent;
}

.gantt-segment:hover .gantt-tooltip-bubble {
    opacity: 1;
    visibility: visible;
}

/* Badges de Fases de Workflow */
.badge-workflow {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
}

/* ==========================================================================
   CALENDARIO DE HITOS Y EVENTOS
   ========================================================================== */

.tiempos-calendar-box {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.calendar-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    flex-wrap: wrap;
    gap: 10px;
}

.calendar-month-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: #1e293b;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.calendar-nav-btn {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #334155;
    cursor: pointer;
    transition: all 0.15s ease;
}

.calendar-nav-btn:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

.calendar-grid-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: #f1f5f9;
    border-bottom: 1px solid #e2e8f0;
    text-align: center;
}

.calendar-weekday-col {
    padding: 10px 4px;
    font-size: 0.78rem;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
}

.calendar-grid-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: #e2e8f0;
    gap: 1px;
}

.calendar-day-cell {
    background: #ffffff;
    min-height: 110px;
    height: 120px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: background 0.15s ease;
    overflow: hidden;
    position: relative;
}

.calendar-day-cell:hover {
    background: #f8fafc;
}

.calendar-day-cell.has-events {
    cursor: pointer;
}

.calendar-day-cell.has-events:hover {
    background: #f1f5f9;
}

.calendar-day-cell.other-month {
    background: #fafafa;
    opacity: 0.55;
}

.calendar-day-cell.is-today {
    background: #eff6ff;
}

.calendar-day-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2px;
}

.calendar-day-number {
    font-size: 0.82rem;
    font-weight: 700;
    color: #334155;
}

.calendar-day-badge {
    font-size: 0.65rem;
    font-weight: 700;
    color: #475569;
    background: #e2e8f0;
    padding: 1px 6px;
    border-radius: 10px;
    line-height: 1.3;
}

.calendar-day-cell.is-today .calendar-day-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #2563eb;
    color: #ffffff;
    width: 22px;
    height: 22px;
    border-radius: 50%;
}

.calendar-events-wrap {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
    overflow: hidden;
}

.calendar-event-pill {
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    border-left: 3px solid transparent;
    transition: transform 0.1s ease, filter 0.1s ease;
}

.calendar-event-pill:hover {
    filter: brightness(0.95);
    transform: translateX(2px);
}

.calendar-more-pill {
    padding: 2px 6px;
    border-radius: 4px;
    background: #f1f5f9;
    color: #334155;
    font-size: 0.68rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    border: 1px dashed #cbd5e1;
    margin-top: 1px;
    transition: all 0.15s ease;
}

.calendar-more-pill:hover {
    background: #e2e8f0;
    color: #0f172a;
    border-color: #94a3b8;
}

/* ==========================================================================
   LÍNEA DE TIEMPO VERTICAL DETALLADA (MODAL)
   ========================================================================== */

.workflow-stepper-v {
    position: relative;
    padding-left: 30px;
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.workflow-stepper-v::before {
    content: '';
    position: absolute;
    top: 10px;
    bottom: 10px;
    left: 14px;
    width: 2px;
    background: #cbd5e1;
}

.timeline-step-node {
    position: relative;
    display: flex;
    flex-direction: column;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 14px 18px;
    transition: box-shadow 0.15s ease;
}

.timeline-step-node:hover {
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.06);
}

.timeline-step-node.is-active {
    border-color: #3b82f6;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}

.timeline-step-dot {
    position: absolute;
    left: -30px;
    top: 14px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #ffffff;
    border: 2px solid #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    z-index: 2;
}

.timeline-step-node.is-active .timeline-step-dot {
    border-color: #2563eb;
    background: #dbeafe;
}

.timeline-step-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    flex-wrap: wrap;
}

.timeline-step-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

.timeline-step-dates {
    display: flex;
    gap: 12px;
    margin-top: 6px;
    font-size: 0.78rem;
    color: #64748b;
    flex-wrap: wrap;
}

.timeline-step-duration-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #f1f5f9;
    color: #334155;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    border: 1px solid #e2e8f0;
}

/* Tablas Compactas y Adaptabilidad Responsiva */
thead th {
    white-space: nowrap !important;
    font-size: 0.72rem !important;
    font-weight: 600;
    letter-spacing: 0.025em;
    vertical-align: middle !important;
}

#creditosTable th, #creditosTable td {
    padding: 6px 7px;
    font-size: 0.76rem;
    vertical-align: middle;
}

#creditosTable th {
    font-size: 0.70rem !important;
    white-space: nowrap !important;
}

.cell-cliente {
    max-width: 170px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

#cronogramaTable th, #cronogramaTable td {
    padding: 6px 7px;
    font-size: 0.75rem;
    vertical-align: middle;
}

#cronogramaTable .text-right,
#cronogramaTable th[style*="text-align: right"],
#cronogramaTable td[style*="text-align: right"] {
    text-align: right !important;
}

#cronogramaTable .text-center,
#cronogramaTable th[style*="text-align: center"],
#cronogramaTable td[style*="text-align: center"] {
    text-align: center !important;
}

#creditosTable.tabla-compacta th,
#creditosTable.tabla-compacta td {
    padding: 3px 5px !important;
    font-size: 0.70rem !important;
    white-space: nowrap !important;
}

#cronogramaTable.tabla-compacta th {
    padding: 3px 2px !important;
    font-size: 0.67rem !important;
    white-space: normal !important;
    text-align: center !important;
    vertical-align: middle !important;
    line-height: 1.1 !important;
    letter-spacing: -0.01em !important;
}

#cronogramaTable.tabla-compacta td {
    padding: 3px 2px !important;
    font-size: 0.69rem !important;
    white-space: nowrap !important;
    letter-spacing: -0.01em !important;
}

#creditosTable.tabla-compacta .btn-sm,
#cronogramaTable.tabla-compacta .btn-sm {
    padding: 1px 4px !important;
    font-size: 0.66rem !important;
    border-radius: 4px !important;
}

#cronogramaTable.tabla-compacta .badge {
    padding: 1px 4px !important;
    font-size: 0.63rem !important;
}

.credito-badge-pill {
    flex-shrink: 0;
    padding: 3px 7px;
    border-radius: 5px;
    font-size: 0.72rem;
    white-space: nowrap;
    line-height: 1.2;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* Custom scrollbar para contenedores de tablas */
.table-container {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f8fafc;
}
.table-container::-webkit-scrollbar {
    height: 8px;
    width: 8px;
}
.table-container::-webkit-scrollbar-track {
    background: #f8fafc;
    border-radius: 4px;
}
.table-container::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
.table-container::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Contenedor del cronograma con scroll horizontal y vertical clásico gris y encabezados fijos */
#cronogramaTableContainer {
    width: 100%;
    overflow-x: auto !important;
    overflow-y: auto !important;
    max-height: calc(100vh - 280px) !important;
    min-height: 320px;
    border: 1px solid #e2e8f0;
    border-radius: 0 0 8px 8px;
    background: #ffffff;
    scrollbar-width: thin;
    scrollbar-color: #94a3b8 #f1f5f9;
}

/* === Scrollbar Superior del Cronograma === */
#cronogramaScrollTop {
    overflow-x: auto;
    overflow-y: hidden;
    width: 100%;
    height: 14px;
    margin-bottom: 0;
    border-radius: 6px 6px 0 0;
    border: 1px solid #e2e8f0;
    border-bottom: none;
    background: #f8fafc;
    scrollbar-width: thin;
    scrollbar-color: #94a3b8 #e2e8f0;
}

#cronogramaScrollTop::-webkit-scrollbar {
    height: 8px;
}

#cronogramaScrollTop::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

#cronogramaScrollTop::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
}

#cronogramaScrollTop::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

#cronogramaTableContainer::-webkit-scrollbar {
    height: 10px;
    width: 8px;
}

#cronogramaTableContainer::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 6px;
}

#cronogramaTableContainer::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 6px;
    border: 2px solid #f1f5f9;
}

#cronogramaTableContainer::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

#cronogramaTable thead th {
    position: sticky;
    top: 0;
    z-index: 5;
    background: #f8fafc;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

/* Columna de Acción / Selección Sticky para Cronograma (Siempre visible al desplazarse horizontalmente) */
#cronogramaTable th:first-child {
    position: sticky !important;
    left: 0 !important;
    top: 0 !important;
    z-index: 25 !important;
    background: #f8fafc !important;
    box-shadow: 2px 0 6px rgba(0, 0, 0, 0.08) !important;
}

#cronogramaTable td:first-child {
    position: sticky !important;
    left: 0 !important;
    z-index: 10 !important;
    background: #ffffff !important;
    box-shadow: 2px 0 6px rgba(0, 0, 0, 0.06) !important;
}

#cronogramaTable tr.row-refinanciar-selected td:first-child {
    background: #eef2ff !important;
}

#cronogramaTable tr:hover td:first-child {
    background: #f8fafc !important;
}

#cronogramaTable tr.row-refinanciar-selected:hover td:first-child {
    background: #e0e7ff !important;
}

#cronogramaTable tfoot td:first-child {
    position: sticky !important;
    left: 0 !important;
    z-index: 10 !important;
    background: #f8fafc !important;
}


/* ==========================================================================
   FILTROS DE TABLA ESTILO EXCEL (CLIENT-SIDE)
   ========================================================================== */
.excel-filter-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 4px;
    cursor: pointer;
    opacity: 0.35;
    transition: opacity 0.2s, color 0.2s, transform 0.15s;
    font-size: 9px;
    vertical-align: middle;
    user-select: none;
    line-height: 1;
}

.excel-filter-icon:hover {
    opacity: 0.9;
    transform: scale(1.15);
    color: var(--secondary, #059669);
}

.excel-filter-icon.active {
    opacity: 1;
    color: var(--secondary, #059669);
    font-weight: bold;
    transform: scale(1.1);
}

.excel-filter-popup {
    position: absolute;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    padding: 12px;
    z-index: 99999;
    min-width: 230px;
    max-width: 320px;
    font-size: 0.82rem;
    display: flex;
    flex-direction: column;
    gap: 8px;
    animation: fadeInExcelFilter 0.15s ease-out;
}

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

.excel-filter-search {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.8rem;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.excel-filter-search:focus {
    border-color: var(--primary, #10b981);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.excel-filter-list {
    max-height: 190px;
    overflow-y: auto;
    border-top: 1px solid #f1f5f9;
    border-bottom: 1px solid #f1f5f9;
    padding: 6px 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    scrollbar-width: thin;
}

.excel-filter-label {
    display: flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
    user-select: none;
    font-weight: 500;
    padding: 3px 6px;
    border-radius: 4px;
    color: #334155;
    font-size: 0.8rem;
    line-height: 1.3;
}

.excel-filter-label:hover {
    background: #ecfdf5; /* var(--primary-light) */
    color: #065f46;
}

.excel-filter-label input[type="checkbox"] {
    width: 14px;
    height: 14px;
    margin: 0;
    cursor: pointer;
    accent-color: var(--secondary, #059669);
}

.excel-filter-actions {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-top: 2px;
}

.excel-filter-btn {
    flex: 1;
    padding: 6px 0;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.78rem;
    transition: all 0.15s;
}

.excel-filter-btn.apply {
    background: var(--secondary, #059669);
    color: #ffffff;
}

.excel-filter-btn.apply:hover {
    background: var(--secondary-hover, #047857);
}

.excel-filter-btn.clear {
    background: #f1f5f9;
    color: #64748b;
}

.excel-filter-btn.clear:hover {
    background: #e2e8f0;
    color: #334155;
}

/* Sección de Ordenamiento Excel (A-Z / Z-A) */
.excel-filter-sort-section {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-bottom: 4px;
}

.excel-filter-sort-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: #334155;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s ease-in-out;
}

.excel-filter-sort-btn:hover {
    background: #ecfdf5; /* var(--primary-light) */
    color: #065f46;
}

.excel-filter-sort-btn .sort-icon {
    font-size: 0.85rem;
    color: var(--secondary, #059669);
}

.excel-filter-divider {
    height: 1px;
    background: #f1f5f9;
    margin: 4px 0 6px 0;
}

/* ==========================================================================
   SIDEBAR ACCORDIONS (ESTILO ERP MULTI-GRUPO)
   ========================================================================== */
.menu-accordion {
    border-radius: 8px;
    margin-bottom: 4px;
    transition: all 0.2s ease;
}

.menu-accordion-toggle {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: left;
    padding: 7px 12px;
    background: transparent;
    border: 0;
    color: #64748b;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.15s ease-in-out;
}

.menu-accordion-toggle:hover {
    background: #f1f5f9;
    color: var(--primary);
}

.menu-accordion.open .menu-accordion-toggle {
    color: var(--primary);
    font-weight: 800;
}

.menu-accordion-content {
    display: none;
    flex-direction: column;
    gap: 2px;
    padding: 2px 0 4px 6px;
}

.menu-accordion.open .menu-accordion-content {
    display: flex;
}

.group-icon-mini {
    display: none;
}

.mini-flyout-title {
    display: none;
}

.chevron {
    font-style: normal;
    font-weight: 800;
    font-size: 11px;
    transition: transform 0.2s ease;
    display: inline-block;
    color: #94a3b8;
}

.menu-accordion.open .chevron {
    transform: rotate(90deg);
    color: var(--primary);
}

/* ==========================================================================
   SIDEBAR MINI (COLLAPSED): FLYOUT MENU FLOTANTE (SOLO DESKTOP >= 993px)
   ========================================================================== */
@media (min-width: 993px) {
    .dashboard-layout.sidebar-collapsed .sidebar {
        overflow: visible !important;
    }

    .dashboard-layout.sidebar-collapsed .sidebar-nav {
        overflow: visible !important;
        padding: 0.75rem 0;
    }

    .dashboard-layout.sidebar-collapsed .menu-accordion {
        position: relative;
        margin: 3px 0;
    }

    .dashboard-layout.sidebar-collapsed .menu-accordion-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 42px;
        margin: 0 auto;
        border-radius: 8px;
        cursor: pointer;
        padding: 0;
        background: transparent;
        transition: all 0.15s ease;
        border: none;
    }

    .dashboard-layout.sidebar-collapsed .menu-accordion-toggle:hover {
        background: #f1f5f9;
    }

    .dashboard-layout.sidebar-collapsed .menu-accordion.active-group .menu-accordion-toggle {
        background: var(--primary-light, #ecfdf5);
        color: var(--primary, #059669);
        box-shadow: 0 1px 3px rgba(5, 150, 105, 0.2);
    }

    .dashboard-layout.sidebar-collapsed .group-icon-mini {
        display: flex !important;
        align-items: center;
        justify-content: center;
        font-size: 1.25rem;
    }

    .dashboard-layout.sidebar-collapsed .group-title-text {
        display: none !important;
    }

    .dashboard-layout.sidebar-collapsed .menu-accordion-toggle .chevron {
        display: none !important;
    }

    /* Flyout Submenu desplegable al pasar el mouse */
    .dashboard-layout.sidebar-collapsed .menu-accordion-content {
        display: none !important;
    }

    .dashboard-layout.sidebar-collapsed .menu-accordion:hover .menu-accordion-content {
        display: flex !important;
        flex-direction: column;
        gap: 3px;
        position: absolute;
        left: 56px;
        top: 0;
        min-width: 225px;
        max-width: 270px;
        background: #ffffff;
        border: 1px solid #e2e8f0;
        border-radius: 10px;
        box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12), 0 4px 10px rgba(0, 0, 0, 0.05);
        padding: 8px;
        z-index: 9999;
        animation: flyoutIn 0.15s cubic-bezier(0.16, 1, 0.3, 1);
    }

    .dashboard-layout.sidebar-collapsed .mini-flyout-title {
        display: flex !important;
        align-items: center;
        gap: 6px;
        font-size: 0.72rem;
        font-weight: 800;
        color: #64748b;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        padding: 6px 10px;
        border-bottom: 1px solid #f1f5f9;
        margin-bottom: 4px;
    }

    .dashboard-layout.sidebar-collapsed .menu-accordion-content .nav-item {
        display: flex !important;
        align-items: center;
        gap: 10px;
        padding: 8px 12px;
        border-radius: 6px;
        width: 100% !important;
        border-left: none !important;
        color: #334155;
        font-size: 0.85rem;
        font-weight: 500;
        text-decoration: none;
        cursor: pointer;
        justify-content: flex-start !important;
        height: auto !important;
        margin: 0 !important;
    }

    .dashboard-layout.sidebar-collapsed .menu-accordion-content .nav-item .nav-label {
        display: inline !important;
        font-size: 0.85rem;
        white-space: nowrap;
    }

    .dashboard-layout.sidebar-collapsed .menu-accordion-content .nav-item .nav-icon {
        font-size: 1.05rem;
        margin: 0;
    }

    .dashboard-layout.sidebar-collapsed .menu-accordion-content .nav-item:hover {
        background: #f1f5f9;
        color: var(--primary, #059669);
    }

    .dashboard-layout.sidebar-collapsed .menu-accordion-content .nav-item.active {
        background: var(--primary-light, #ecfdf5);
        color: var(--primary, #059669);
        font-weight: 600;
    }

    .dashboard-layout.sidebar-collapsed .menu-accordion-content .nav-item .badge {
        position: static !important;
        margin-left: auto;
    }

    /* Mi Perfil en modo mini */
    .dashboard-layout.sidebar-collapsed #nav-perfil {
        width: 44px;
        height: 42px;
        margin: 4px auto;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 8px;
        border-left: none !important;
    }

    .dashboard-layout.sidebar-collapsed #nav-perfil .nav-label {
        display: none;
    }
}

/* ==========================================================================
   CARDS AGRUPADAS DE PERMISOS (MODAL PERFILES)
   ========================================================================== */
.permisos-cards-toolbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    flex-shrink: 0;
}

.btn-cards-tool {
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 5px 12px;
    font-size: 0.74rem;
    font-weight: 600;
    color: #334155;
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-cards-tool:hover {
    background: #e2e8f0;
    color: #0f172a;
    border-color: #94a3b8;
}

.permisos-cards-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 56vh;
    overflow-y: auto;
    padding: 4px 6px 10px 2px;
    scrollbar-width: thin;
}

.permisos-group-card {
    flex-shrink: 0 !important;
    width: 100%;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 9px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.permisos-group-card:hover {
    border-color: #cbd5e1;
}

.permisos-group-card.open {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.permisos-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: #f8fafc;
    border-bottom: 1px solid transparent;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s ease;
}

.permisos-group-header:hover {
    background: #f1f5f9;
}

.permisos-group-card.open .permisos-group-header {
    background: #f8fafc;
    border-bottom-color: #e2e8f0;
}

.permisos-group-header h4 {
    margin: 0;
    font-size: 0.85rem;
    font-weight: 700;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-chevron {
    font-size: 11px;
    font-weight: 800;
    color: #64748b;
    transition: transform 0.2s ease;
    display: inline-block;
}

.permisos-group-card.open .card-chevron {
    transform: rotate(90deg);
    color: var(--primary, #059669);
}

.btn-toggle-all-group {
    background: transparent;
    border: none;
    color: var(--primary, #059669);
    font-size: 0.74rem;
    font-weight: 600;
    cursor: pointer;
    padding: 3px 8px;
    border-radius: 4px;
    transition: background 0.15s;
}

.btn-toggle-all-group:hover {
    background: var(--primary-light, #ecfdf5);
    text-decoration: underline;
}

.permisos-group-body {
    display: none;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 10px 14px;
    padding: 14px 16px;
    background: #ffffff;
}

.permisos-group-card.open .permisos-group-body {
    display: grid;
}

.permisos-group-body .checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-size: 0.85rem;
    color: #334155;
    cursor: pointer;
    line-height: 1.35;
    user-select: none;
    padding: 3px 4px;
    border-radius: 4px;
    transition: background 0.1s;
}

.permisos-group-body .checkbox-label:hover {
    background: #f8fafc;
}

.permisos-group-body .checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary, #059669);
    cursor: pointer;
    flex-shrink: 0;
    margin: 0;
}

@media (max-width: 600px) {
    .permisos-group-body {
        grid-template-columns: 1fr;
        gap: 8px;
    }
}

/* ==========================================================================
   DASHBOARD DE CARTERA & MOROSIDAD HISTÓRICA (AGING MATRIX)
   ========================================================================== */
.btn-periodo {
    padding: 6px 12px;
    font-size: 0.80rem;
    font-weight: 600;
    border: none;
    background: #ffffff;
    color: #475569;
    cursor: pointer;
    border-right: 1px solid #cbd5e1;
    transition: all 0.2s ease;
}
.btn-periodo:last-child {
    border-right: none;
}
.btn-periodo:hover {
    background: #f1f5f9;
    color: #0f172a;
}
.btn-periodo.active {
    background: #0f4c81;
    color: #ffffff;
}

.tabla-financiera th, 
.tabla-financiera td {
    padding: 6px 10px;
    border: 1px solid #cbd5e1;
    vertical-align: middle;
}
.tabla-financiera tbody tr:nth-child(even) {
    background-color: #f8fafc;
}
.tabla-financiera tbody tr:hover {
    background-color: #f1f5f9;
}
.tabla-financiera .cell-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.tabla-financiera .row-total-cobranza {
    background: #e2e8f0 !important;
    font-weight: bold;
    border-top: 2px solid #0f4c81;
    border-bottom: 2px solid #0f4c81;
}
.tabla-financiera .row-total-cobranza td {
    font-weight: 800;
    color: #0f172a;
}
.tabla-financiera .row-morosidad-total {
    background: #bae6fd !important;
    font-weight: bold;
    border-top: 2px solid #0284c7;
    border-bottom: 2px solid #0284c7;
}
.tabla-financiera .row-morosidad-total td {
    font-weight: 800;
    color: #0369a1;
}
.tabla-financiera .text-red-bold {
    color: #dc2626;
    font-weight: bold;
}

/* ==========================================================================
   INTERACCIÓN Y SELECCIÓN ELEGANTE DE PERIODOS (AGING Y RATIOS)
   ========================================================================== */
.th-mes-clickable {
    cursor: pointer !important;
    user-select: none;
    transition: background-color 0.15s ease, color 0.15s ease !important;
    position: relative;
}
.th-mes-clickable:hover {
    background-color: #e0f2fe !important;
    color: #0369a1 !important;
}

/* Cabecera del mes activo: estilo pestaña refinada, contraste suave con borde acento inferior */
.th-mes-activo {
    background-color: #e0f2fe !important;
    color: #0369a1 !important;
    font-weight: 800 !important;
    box-shadow: inset 0 -3px 0 0 #0284c7 !important;
}

/* Resaltado sutil de la columna seleccionada (Spotlight vertical) */
.col-mes-activo {
    background-color: #f0f7ff !important;
    color: #0f172a;
}
.tabla-financiera tbody tr:nth-child(even) td.col-mes-activo {
    background-color: #e6f0fa !important;
}

/* Fila MOROSIDAD TOTAL y TOTAL DE COBRANZA: celdas interactivas */
.cell-ratio-clickable, .cell-cobranza-clickable {
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    user-select: none;
    position: relative;
}
.cell-ratio-clickable:hover, .cell-cobranza-clickable:hover {
    background-color: #7dd3fc !important;
    color: #0c4a6e !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(2, 132, 199, 0.25);
}
.cell-ratio-clickable:hover span, .cell-cobranza-clickable:hover span {
    color: #0c4a6e !important;
}

/* Celda seleccionada en MOROSIDAD TOTAL y TOTAL DE COBRANZA: Placa / Insignia azul corporativa Motor Capital */
.cell-ratio-mes-activo, .cell-cobranza-mes-activo {
    background-color: #0f4c81 !important;
    color: #ffffff !important;
    font-weight: 800 !important;
    border-radius: 4px;
    box-shadow: inset 0 0 0 2px #38bdf8, 0 2px 5px rgba(15, 76, 129, 0.3) !important;
}
.cell-ratio-mes-activo span, .cell-cobranza-mes-activo span {
    color: #ffffff !important;
    font-weight: 800 !important;
}

.tabla-pivot-black thead th {
    background: #000000 !important;
    color: #ffffff !important;
    border: 1px solid #334155;
}
.tabla-pivot-black tfoot td {
    background: #000000 !important;
    color: #ffffff !important;
    font-weight: bold;
    border: 1px solid #334155;
}

/* Botón y Acordeón Desplegable de Préstamos y Cuotas por Cliente en Morosidad */
.btn-toggle-creditos {
    transition: all 0.2s ease-in-out;
}
.btn-toggle-creditos:hover {
    background-color: #f1f5f9 !important;
    border-color: #94a3b8 !important;
    transform: translateY(-1px);
}
.tabla-financiera tbody tr.row-detalle-creditos:hover {
    background-color: #f8fafc !important;
}
.tabla-financiera tbody tr.row-cliente-morosidad.active {
    background-color: #f1f5f9 !important;
}

/* ==========================================================================
   ESTILOS DE DASHBOARD DE MOROSIDAD, IMPRESIÓN & PDF (A4 LANDSCAPE)
   ========================================================================== */

/* Tarjetas de Gráficos exclusivas para Morosidad (Vista Normal) */
.chart-card-morosidad {
    background: #ffffff;
    padding: 14px 16px 10px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    min-height: auto !important;
    height: auto !important;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

.chart-card-morosidad h3 {
    text-align: center;
    font-size: 0.88rem;
    color: #1e293b;
    margin: 0 0 6px 0;
    font-weight: 700;
    border-bottom: none;
    padding-bottom: 0;
    width: 100%;
}

.chart-card-morosidad .chart-canvas-wrap {
    position: relative;
    height: 290px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Cabecera visible solo en impresión / PDF */
.print-only-header {
    display: none;
}

@page {
    size: A4 landscape;
    margin: 5mm 7mm;
}

/* ----- @media print (Ctrl+P / Imprimir A4) ----- */
@media print {
    *, *::before, *::after {
        box-shadow: none !important;
        text-shadow: none !important;
    }
    html, body, .dashboard-body {
        background: #fff !important;
        color: #0f172a !important;
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        font-size: 10px !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    /* Ocultar UI */
    .sidebar, .topbar, .filters-card, .btn, .btn-group-periodo,
    .modal-backdrop, .whatsapp-float-btn, header, nav,
    .table-header, .sidebar-overlay, .screen-only-pivot-header,
    .row-detalle-creditos, .btn-toggle-creditos {
        display: none !important;
    }
    /* Reset de contenedores */
    .dashboard-layout, .main-content, .view-section, .section-card {
        padding: 0 !important;
        margin: 0 !important;
        border: none !important;
        background: transparent !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    #view-dashboard-morosidad {
        display: block !important;
    }
    /* Cabecera de impresión */
    .print-only-header {
        display: flex !important;
        margin-bottom: 6px !important;
        padding-bottom: 4px !important;
    }
    #printableDashboardMorosidad {
        width: 100% !important;
        margin: 0 !important;
    }
    /* Página 1 */
    .morosidad-page-1 {
        page-break-after: always !important;
        break-after: page !important;
    }
    /* Página 2 */
    .morosidad-page-2 {
        page-break-before: always !important;
        break-before: page !important;
    }
    /* Tablas compactas */
    .tabla-financiera {
        font-size: 0.58rem !important;
        width: 100% !important;
        margin-bottom: 4px !important;
        border-collapse: collapse !important;
    }
    .tabla-financiera th,
    .tabla-financiera td {
        padding: 2px 4px !important;
        font-size: 0.58rem !important;
        line-height: 1.1 !important;
    }
    .tabla-financiera thead th {
        background: #0f4c81 !important;
        color: #fff !important;
    }
    .tabla-pivot-black thead th,
    .tabla-pivot-black tfoot td {
        background: #000 !important;
        color: #fff !important;
    }
    /* Gráficos en impresión */
    .dashboard-grid-morosidad {
        display: grid !important;
        grid-template-columns: 1.15fr 1fr !important;
        gap: 10px !important;
        margin-top: 4px !important;
        margin-bottom: 0 !important;
        page-break-inside: avoid !important;
    }
    .chart-card-morosidad {
        padding: 5px 8px 4px !important;
        border: 1px solid #cbd5e1 !important;
        background: #fff !important;
        border-radius: 6px !important;
        min-height: auto !important;
        height: auto !important;
    }
    .chart-card-morosidad h3 {
        font-size: 0.68rem !important;
        margin: 0 0 2px 0 !important;
        text-align: center !important;
    }
    .chart-card-morosidad .chart-canvas-wrap {
        height: 155px !important;
        max-height: 155px !important;
        overflow: hidden !important;
    }
    .chart-card-morosidad canvas {
        max-height: 155px !important;
        width: 100% !important;
    }
    .chart-card-morosidad img {
        height: 155px !important;
        max-height: 155px !important;
        width: 100% !important;
        object-fit: contain !important;
        display: block !important;
    }
    .badge {
        font-size: 0.55rem !important;
        padding: 1px 3px !important;
    }
    .table-container {
        overflow: visible !important;
    }
    /* Asegurar tabla página 2 visible completa */
    #pivotClientesTable {
        table-layout: fixed !important;
        width: 100% !important;
    }
    #pivotClientesTable td:first-child {
        white-space: normal !important;
        word-break: break-word !important;
        overflow: hidden !important;
    }
    .morosidad-page-2 .tabla-financiera {
        font-size: 0.55rem !important;
    }
    .morosidad-page-2 .tabla-financiera th,
    .morosidad-page-2 .tabla-financiera td {
        padding: 2px 3.5px !important;
        font-size: 0.55rem !important;
    }
}

/* ----- Clase auxiliar para html2pdf (PDF desde JS) ----- */
.pdf-render-mode .print-only-header {
    display: flex !important;
}
.pdf-render-mode .screen-only-pivot-header {
    display: none !important;
}
.pdf-render-mode .table-header {
    display: none !important;
}
.pdf-render-mode .tabla-financiera {
    font-size: 0.56rem !important;
    margin-bottom: 3px !important;
}
.pdf-render-mode .tabla-financiera th,
.pdf-render-mode .tabla-financiera td {
    padding: 1.5px 3px !important;
    font-size: 0.56rem !important;
    line-height: 1.08 !important;
}
.pdf-render-mode .dashboard-grid-morosidad {
    display: grid !important;
    grid-template-columns: 1.15fr 1fr !important;
    gap: 8px !important;
    margin-top: 3px !important;
    margin-bottom: 0 !important;
}
.pdf-render-mode .chart-card-morosidad {
    padding: 5px 8px 4px !important;
    border: 1px solid #cbd5e1 !important;
    background: #fff !important;
    border-radius: 6px !important;
    min-height: auto !important;
    height: auto !important;
}
.pdf-render-mode .chart-card-morosidad h3 {
    font-size: 0.65rem !important;
    margin: 0 0 2px 0 !important;
    text-align: center !important;
}
.pdf-render-mode .chart-card-morosidad .chart-canvas-wrap {
    height: 165px !important;
    max-height: 165px !important;
    overflow: hidden !important;
}
.pdf-render-mode .chart-card-morosidad img {
    height: 165px !important;
    max-height: 165px !important;
    width: 100% !important;
    object-fit: contain !important;
    display: block !important;
}
.pdf-render-mode #pivotClientesTable {
    table-layout: fixed !important;
    width: 100% !important;
}
.pdf-render-mode #pivotClientesTable td:first-child {
    white-space: normal !important;
    word-break: break-word !important;
    overflow: hidden !important;
}
.pdf-render-mode .morosidad-page-2 .tabla-financiera {
    font-size: 0.52rem !important;
}
.pdf-render-mode .morosidad-page-2 .tabla-financiera th,
.pdf-render-mode .morosidad-page-2 .tabla-financiera td {
    padding: 1.5px 3px !important;
    font-size: 0.52rem !important;
}

/* ==========================================================================
   MULTI-EMPRESA (HOLDING / SUBSIDIARIAS) STYLES
   ========================================================================== */
/* Contenedor en el Sidebar (debajo del logo) */
.sidebar-company-wrapper {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    position: relative;
    z-index: 60;
    transition: padding 0.28s ease;
}

.sidebar-company-wrapper .company-dropdown-wrapper {
    position: relative;
    width: 100%;
}

.sidebar-switcher-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f0fdf4;
    border: 1.5px solid #10b981;
    border-radius: 8px;
    padding: 7px 10px;
    font-size: 0.84rem;
    font-weight: 600;
    color: #1f2937;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(16, 185, 129, 0.12);
    transition: all 0.2s ease;
    box-sizing: border-box;
    text-align: left;
}

.sidebar-switcher-btn:hover {
    background: #dcfce7;
    border-color: #059669;
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.2);
}

.company-switcher-left {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
    min-width: 0;
    flex: 1;
}

.company-switcher-left .company-icon {
    font-size: 1.05rem;
    flex-shrink: 0;
}

.company-switcher-left .company-name {
    font-size: 0.83rem;
    font-weight: 700;
    color: #1f2937;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.company-switcher-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    margin-left: 6px;
}

.company-badge-code {
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #a7f3d0;
    font-size: 0.72rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.company-chevron {
    font-size: 0.65rem;
    color: #059669;
    transition: transform 0.2s;
}

.sidebar-company-wrapper .company-dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    width: 100%;
    min-width: 250px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    z-index: 1050;
    overflow: hidden;
    padding: 6px 0;
    animation: fadeInSlide 0.15s ease-out;
}

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

.company-dropdown-header {
    padding: 6px 14px;
    font-size: 0.70rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #9ca3af;
    letter-spacing: 0.5px;
}

.company-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    cursor: pointer;
    transition: background 0.15s;
}

.company-dropdown-item:hover {
    background: #f8fafc;
}

.company-dropdown-item.active {
    background: #f0fdf4;
    border-left: 3px solid #10b981;
}

.company-item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.company-item-name {
    font-size: 0.84rem;
    font-weight: 600;
    color: #1f2937;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.company-item-sub {
    font-size: 0.72rem;
    color: #6b7280;
}

.company-badge-pill {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    background: #f3f4f6;
    color: #4b5563;
    flex-shrink: 0;
}

.company-badge-pill.pill-mc {
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #a7f3d0;
}

.company-badge-pill.pill-sm,
.company-badge-pill.pill-sv {
    background: #eff6ff;
    color: #2563eb;
    border: 1px solid #bfdbfe;
}

.company-dropdown-item.active .company-badge-pill {
    background: #10b981;
    color: #ffffff;
    border-color: #10b981;
}

.company-badge-pill.badge-all {
    background: #ede9fe;
    color: #7c3aed;
    border: 1px solid #ddd6fe;
}

.company-dropdown-item.item-consolidado:hover {
    background: #faf5ff;
}

.company-dropdown-divider {
    height: 1px;
    background: #e5e7eb;
    margin: 4px 0;
}

.sidebar-single-company {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 7px 10px;
    font-size: 0.83rem;
    font-weight: 600;
    color: #374151;
    box-sizing: border-box;
    width: 100%;
}

/* Modo Mini-Sidebar Colapsado */
.dashboard-layout.sidebar-collapsed .sidebar-company-wrapper {
    padding: 0.5rem 0.35rem;
    display: flex;
    justify-content: center;
}

.dashboard-layout.sidebar-collapsed .sidebar-switcher-btn,
.dashboard-layout.sidebar-collapsed .sidebar-single-company {
    width: 44px;
    height: 40px;
    justify-content: center;
    padding: 0;
    gap: 0;
    margin: 0 auto;
}

.dashboard-layout.sidebar-collapsed .company-switcher-left {
    justify-content: center;
    width: 100%;
}

.dashboard-layout.sidebar-collapsed .company-switcher-left .company-name,
.dashboard-layout.sidebar-collapsed .company-switcher-right {
    display: none !important;
}

.dashboard-layout.sidebar-collapsed .company-switcher-left .company-icon {
    font-size: 1.25rem;
    margin: 0;
}

.dashboard-layout.sidebar-collapsed .sidebar-company-wrapper .company-dropdown-menu {
    position: fixed;
    left: 74px;
    top: 75px;
    width: 260px;
    min-width: 260px;
    z-index: 9999;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
}

/* Badges de empresa en tablas */
.badge-empresa-mc {
    display: inline-block;
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
    font-size: 0.70rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 4px;
    margin-right: 4px;
}

.badge-empresa-sm,
.badge-empresa-sv {
    display: inline-block;
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
    font-size: 0.70rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 4px;
    margin-right: 4px;
}

/* ==========================================================
   COMPONENTE: SELECTOR DE VISIBILIDAD MULTI-EMPRESA (ESTILO IMAGEN 4)
   ========================================================== */
.multi-empresa-selector-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px 14px;
    margin-top: 4px;
}

.multi-empresa-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding-bottom: 10px;
    margin-bottom: 10px;
    border-bottom: 1px solid #e2e8f0;
}

.multi-empresa-header-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: #334155;
    display: flex;
    align-items: center;
    gap: 6px;
}

.multi-empresa-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.btn-quick-empresa {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #475569;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 0.76rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.btn-quick-empresa:hover {
    background: #f1f5f9;
    color: #0f172a;
    border-color: #94a3b8;
    transform: translateY(-1px);
}

.btn-quick-empresa:active {
    transform: translateY(0);
}

.multi-empresa-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 220px;
    overflow-y: auto;
    padding-right: 2px;
}

.empresa-check-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
    margin: 0;
}

.empresa-check-row:hover {
    border-color: #93c5fd;
    background: #f0fdf4;
}

.empresa-check-left {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    color: #1e293b;
    font-weight: 500;
}

.empresa-check-left input[type="checkbox"] {
    width: 17px;
    height: 17px;
    accent-color: #0284c7;
    cursor: pointer;
    margin: 0;
}

.empresa-check-name {
    display: flex;
    align-items: center;
    gap: 6px;
}

.badge-matriz {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 4px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.badge-filial {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 4px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

/* ==========================================================
   VISTA CONFIGURACIÓN: FULL-WIDTH & PESTAÑAS (TABS)
   ========================================================== */
.config-container-full {
    width: 100%;
    max-width: 100%;
    margin: 0;
}

.config-tabs-nav {
    display: flex;
    gap: 8px;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 25px;
    overflow-x: auto;
    padding-bottom: 2px;
}

.config-tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 20px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: #64748b;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    border-radius: 8px 8px 0 0;
}

.config-tab-btn:hover {
    color: #0f172a;
    background: #f8fafc;
}

.config-tab-btn.active {
    color: #0284c7;
    border-bottom-color: #0284c7;
    background: #f0f9ff;
}

.config-tab-pane {
    display: none;
    animation: fadeInTab 0.2s ease;
}

.config-tab-pane.active {
    display: block;
}

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

/* Selector de Subsidiarias en Tab 1 */
.subsidiarias-nav-pills {
    display: flex;
    gap: 12px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.subsidiaria-pill {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 600;
    color: #334155;
}

.subsidiaria-pill:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.subsidiaria-pill.active {
    border-color: #0284c7;
    background: #f0f9ff;
    color: #0369a1;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.12);
}

.subsidiaria-pill .pill-badge {
    font-size: 0.7rem;
    padding: 2px 7px;
    border-radius: 4px;
}

/* Layout 2 columnas en Configuración */
.config-two-columns {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 30px;
}

@media (max-width: 992px) {
    .config-two-columns {
        grid-template-columns: 1fr;
    }
}

.logo-preview-box {
    background: #f8fafc;
    border: 2px dashed #cbd5e1;
    border-radius: 10px;
    padding: 16px;
    text-align: center;
    margin-top: 10px;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-preview-box img {
    max-height: 80px;
    max-width: 100%;
    object-fit: contain;
}

.empresa-subpane,
.financiero-subpane,
.smtp-subpane {
    display: block;
    animation: fadeInSubpane 0.2s ease;
}

.empresa-subpane.hidden,
.financiero-subpane.hidden,
.smtp-subpane.hidden {
    display: none !important;
}

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

/* ── Modern Global Floating Tooltip Component (Body-attached, Anti-Clipping) ── */
#global-floating-tooltip {
    position: fixed;
    z-index: 9999999;
    pointer-events: none;
    background: #0f172a;
    color: #f8fafc;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 11.5px;
    font-weight: 600;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    width: max-content;
    max-width: 280px;
    white-space: normal;
    line-height: 1.35;
    text-align: center;
    word-break: break-word;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.4), 0 1px 3px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.12);
    opacity: 0;
    transform: translateY(4px) scale(0.96);
    transition: opacity 0.12s ease, transform 0.12s cubic-bezier(0.16, 1, 0.3, 1);
    letter-spacing: 0.15px;
    display: none;
}

#global-floating-tooltip.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    display: block;
}

#global-floating-tooltip.tooltip-is-html {
    max-width: 390px;
    width: max-content;
    min-width: 290px;
    text-align: left;
    padding: 10px 12px;
    line-height: 1.4;
    border-radius: 8px;
    background: #0f172a;
    box-shadow: 0 14px 30px -4px rgba(0, 0, 0, 0.65), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

#global-floating-tooltip.tooltip-is-html .tooltip-text {
    display: block;
    width: 100%;
}

#global-floating-tooltip .tooltip-arrow {
    position: absolute;
    width: 0;
    height: 0;
    border-style: solid;
    transform: translateX(-50%);
}

/* Flechita hacia abajo cuando el tooltip está ARRIBA del elemento */
#global-floating-tooltip.arrow-bottom .tooltip-arrow {
    bottom: -5px;
    border-width: 5px 5px 0 5px;
    border-color: #0f172a transparent transparent transparent;
}

/* Flechita hacia arriba cuando el tooltip está DEBAJO del elemento */
#global-floating-tooltip.arrow-top .tooltip-arrow {
    top: -5px;
    border-width: 0 5px 5px 5px;
    border-color: transparent transparent #0f172a transparent;
}

/* --- ESTILOS MODERNOS MODAL AGREGAR BIEN / VEHICULO --- */
#modalAgregarBien .modal-card {
    max-width: 680px !important;
    width: 94vw !important;
    overflow: visible !important;
    max-height: 94vh;
}

#modalAgregarBien .modal-body {
    overflow: visible !important;
}

#modal_bien_search_results {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f8fafc;
}

#modal_bien_search_results::-webkit-scrollbar {
    width: 6px;
}

#modal_bien_search_results::-webkit-scrollbar-track {
    background: #f8fafc;
    border-radius: 8px;
}

#modal_bien_search_results::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 8px;
}

#modal_bien_search_results::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* SweetAlert2 Dialogs por encima de todos los modales y backdrops */
.swal2-container {
    z-index: 99999999 !important;
}

/* ==========================================================================
   ESTILOS PARA MÓDULO DE VENTAS NETSUITE
   ========================================================================== */
.btn-periodo-tab {
    flex: 1;
    border: none;
    background: transparent;
    padding: 6px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #475569;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn-periodo-tab.active {
    background: #ffffff;
    color: #1e293b;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.btn-periodo-tab:hover:not(.active) {
    color: #0f172a;
    background: rgba(255,255,255,0.4);
}

.ventas-kpi-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.ventas-kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(15,23,42,0.06);
}

.badge-doc-tipo {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.badge-subsidiaria {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 7px;
    border-radius: 5px;
    font-size: 0.72rem;
    font-weight: 700;
}

.btn-ns-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: #f1f5f9;
    color: #1e40af;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid #cbd5e1;
    transition: all 0.2s ease;
}
.btn-ns-link:hover {
    background: #e0e7ff;
    color: #3730a3;
    border-color: #a5b4fc;
}

/* ==========================================================================
   NOTAS DE CELDA TIPO EXCEL (NUBE / MINI-CHAT) - MATRIZ DE MOROSIDAD
   ========================================================================== */

.cell-aging-nota {
    position: relative !important;
    transition: background 0.15s ease, box-shadow 0.15s ease;
}

.cell-aging-nota:hover {
    background-color: #f8fafc !important;
}

.cell-aging-nota.has-excel-note {
    background-color: rgba(245, 158, 11, 0.06) !important;
}

.cell-aging-nota.has-excel-note:hover {
    background-color: rgba(245, 158, 11, 0.12) !important;
}

/* Marcador triangular en la esquina superior derecha (Estilo Comentario Excel) */
.excel-corner-triangle {
    position: absolute;
    top: 0;
    right: 0;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 10px 10px 0;
    border-color: transparent #ea580c transparent transparent;
    pointer-events: auto;
    cursor: pointer;
    z-index: 3;
    transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.15s ease;
}

.excel-corner-triangle:hover {
    transform: scale(1.35);
    border-color: transparent #c2410c transparent transparent;
}

/* Botón interactivo de nota dentro de la celda */
.btn-celda-nota {
    opacity: 0;
    visibility: hidden;
    transition: all 0.18s ease;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #475569;
    border-radius: 12px;
    padding: 1px 5px;
    font-size: 0.65rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    line-height: 1.2;
    margin-left: 5px;
    vertical-align: middle;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.cell-aging-nota:hover .btn-celda-nota {
    opacity: 1;
    visibility: visible;
}

.btn-celda-nota.btn-celda-nota-activa {
    opacity: 1 !important;
    visibility: visible !important;
    background: #fef3c7 !important;
    border-color: #fde68a !important;
    color: #92400e !important;
}

.btn-celda-nota.btn-celda-nota-activa:hover {
    background: #fde68a !important;
    color: #78350f !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.2);
}

.btn-celda-nota-vacia:hover {
    background: #e2e8f0;
    color: #0f172a;
    border-color: #94a3b8;
}

.btn-celda-nota .nota-icon {
    font-size: 0.72rem;
}

.btn-celda-nota .nota-badge {
    font-size: 0.65rem;
    font-weight: 800;
    color: #b45309;
}

.btn-celda-nota .nota-plus {
    font-size: 0.72rem;
    font-weight: 800;
    color: #0284c7;
}

/* Modal flotante / Popover de Notas (Mini-Chat) */
.modal-backdrop-notas {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(3px);
    z-index: 11000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeInModalNotas 0.18s ease-out;
}

@keyframes fadeInModalNotas {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-card-notas {
    background: #ffffff;
    width: 520px;
    max-width: 95vw;
    border-radius: 14px;
    box-shadow: 0 20px 45px -5px rgba(15, 23, 42, 0.3), 0 0 0 1px rgba(15, 23, 42, 0.05);
    display: flex;
    flex-direction: column;
    max-height: 88vh;
    overflow: hidden;
    animation: slideUpModalNotas 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUpModalNotas {
    from { transform: translateY(18px) scale(0.97); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-notas-header {
    padding: 14px 18px;
    background: #0f172a;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-notas-icon-box {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
}

.modal-notas-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.2px;
}

.modal-notas-subtitle {
    margin: 2px 0 0 0;
    font-size: 0.74rem;
    color: #94a3b8;
}

.modal-notas-close-btn {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 1.4rem;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
    border-radius: 6px;
    transition: all 0.15s;
}

.modal-notas-close-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.15);
}

/* Barra de contexto de la celda */
.modal-notas-context-bar {
    padding: 10px 18px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.context-pill-cliente {
    font-size: 0.85rem;
    font-weight: 700;
    color: #1e293b;
    word-break: break-word;
}

.context-pill-tags {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.context-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 700;
}

.context-tag-col {
    background: #e0f2fe;
    color: #0369a1;
    border: 1px solid #bae6fd;
}

.context-tag-mes {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

/* Hilo de comentarios (Mini-Chat) */
.modal-notas-body {
    flex: 1;
    padding: 16px 18px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 180px;
    max-height: 360px;
    background: #fdfdfe;
}

.modal-notas-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    text-align: center;
    color: #64748b;
}

.nota-chat-item {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
    transition: all 0.15s ease;
}

.nota-chat-item.nota-chat-mia {
    background: #f8fafc;
    border-color: #cbd5e1;
    border-left: 3px solid #0284c7;
}

.nota-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
    gap: 8px;
}

.nota-chat-author {
    display: flex;
    align-items: center;
    gap: 6px;
}

.nota-chat-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 800;
    flex-shrink: 0;
}

.nota-author-name {
    font-size: 0.80rem;
    font-weight: 700;
    color: #1e293b;
}

.nota-badge-tu {
    font-size: 0.62rem;
    background: #dbeafe;
    color: #1d4ed8;
    padding: 1px 5px;
    border-radius: 4px;
    font-weight: 700;
}

.nota-chat-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nota-timestamp {
    font-size: 0.70rem;
    color: #94a3b8;
    white-space: nowrap;
}

.nota-actions-btns {
    display: flex;
    align-items: center;
    gap: 3px;
}

.btn-nota-action {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.78rem;
    padding: 2px 4px;
    border-radius: 4px;
    transition: background 0.12s;
    line-height: 1;
}

.btn-nota-action:hover {
    background: #e2e8f0;
}

.btn-nota-del:hover {
    background: #fee2e2;
}

.nota-chat-text {
    font-size: 0.82rem;
    color: #334155;
    line-height: 1.45;
    word-break: break-word;
    white-space: pre-wrap;
}

/* Área de edición inline */
.nota-edit-textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #94a3b8;
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 0.80rem;
    font-family: inherit;
    resize: vertical;
}

.btn-nota-save {
    background: #0284c7;
    color: #fff;
    border: none;
    border-radius: 5px;
    font-size: 0.74rem;
    font-weight: 600;
    padding: 4px 10px;
    cursor: pointer;
}

.btn-nota-save:hover {
    background: #0369a1;
}

.btn-nota-cancel {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
    border-radius: 5px;
    font-size: 0.74rem;
    font-weight: 600;
    padding: 4px 8px;
    cursor: pointer;
}

.btn-nota-cancel:hover {
    background: #e2e8f0;
}

/* Footer: Input para nueva nota */
.modal-notas-footer {
    padding: 12px 18px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.modal-notas-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.modal-notas-textarea {
    flex: 1;
    box-sizing: border-box;
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 0.82rem;
    font-family: inherit;
    resize: none;
    min-height: 48px;
    max-height: 90px;
    transition: border-color 0.15s, box-shadow 0.15s;
    background: #ffffff;
}

.modal-notas-textarea:focus {
    border-color: #0284c7;
    outline: none;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.btn-publicar-nota {
    background: #0f172a;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 0 16px;
    height: 48px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    transition: background 0.15s, transform 0.1s;
    flex-shrink: 0;
}

.btn-publicar-nota:hover {
    background: #1e293b;
    transform: translateY(-1px);
}

.btn-publicar-nota:active {
    transform: translateY(0);
}

.modal-notas-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

/* Subtabs de Ventas NetSuite */
.ventas-subtab-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 10px 10px 0 0;
    font-size: 0.88rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    background: #f1f5f9;
    color: #475569;
    transition: all 0.2s ease;
    border-bottom: 3px solid transparent;
}
.ventas-subtab-btn:hover {
    background: #e2e8f0;
    color: #1e293b;
}
.ventas-subtab-btn.active {
    background: #8B1D42;
    color: #ffffff;
    border-bottom: 3px solid #701735;
    box-shadow: 0 4px 12px rgba(139, 29, 66, 0.2);
}

/* Badges de Margen */
.badge-margen-alto {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 800;
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #bbf7d0;
    white-space: nowrap;
}
.badge-margen-medio {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 800;
    background: #fef3c7;
    color: #b45309;
    border: 1px solid #fde68a;
    white-space: nowrap;
}
.badge-margen-bajo {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 800;
    background: #ffedd5;
    color: #c2410c;
    border: 1px solid #fed7aa;
    white-space: nowrap;
}
.badge-margen-negativo {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 800;
    background: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fecaca;
    white-space: nowrap;
}

/* Tarjeta KPI interactiva con glow */
.kpi-card-glow {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.kpi-card-glow:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.12);
}




