:root {
    --primary: #2E8B57;
    --primary-dark: #1e6b47;
    --secondary: #1E90FF;
    --success: #3CB371;
    --danger: #FF6347;
    --warning: #FFA500;
    --info: #17a2b8;
    --info-blue: #007bff; /* NUEVO: Color azul para 'Al Corriente' */
    --light: #f8f9fa;
    --dark: #212529;
    --gray: #6c757d;
    --border-color: #dee2e6; /* MODIFICACIÓN: Nueva variable */
    --border-radius: 12px;
    --box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    transition: color 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
}

body {
    background: linear-gradient(135deg, #1E90FF 0%, #2E8B57 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    transition: padding-top 0.3s ease; /* Transición para padding */
}

.hidden {
    display: none !important;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    color: white;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
    margin-bottom: 20px;
}
.spinner-small {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0, 0, 0, 0.2);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s ease-in-out infinite;
    display: inline-block;
    vertical-align: middle;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.login-container {
    width: 100%;
    max-width: 420px;
    animation: fadeIn 0.5s ease;
    margin-top: 20px;
}

.login-box {
    background: white;
    border-radius: var(--border-radius);
    padding: 40px 30px;
    text-align: center;
    box-shadow: var(--box-shadow);
    transition: var(--transition);
}

    .login-box:hover {
        transform: translateY(-5px);
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    }

.login-logo {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .login-logo img {
        width: 60px;
        height: auto;
    }

.login-box h1 {
    color: var(--dark);
    margin-bottom: 10px;
    font-weight: 700;
}

.login-box p {
    color: var(--gray);
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--dark);
}

input, select, textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    font-size: 16px;
    transition: var(--transition);
}

    input:focus, select:focus, textarea:focus {
        outline: none;
        border-color: var(--primary);
        box-shadow: 0 0 0 3px rgba(46, 139, 87, 0.2);
    }

    input[readonly] {
        background-color: #f8f9fa;
        color: var(--gray);
    }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    font-size: 16px;
    gap: 10px;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

    .btn-primary:hover {
        background: var(--primary-dark);
        transform: translateY(-2px);
    }

.btn-secondary {
    background: var(--light);
    color: var(--dark);
    border: 1px solid #dee2e6;
}

    .btn-secondary:hover {
        background: #e9ecef;
    }

.btn-success {
    background: var(--success);
    color: white;
}

    .btn-success:hover {
        background: #2e9c5f;
    }

.btn-danger {
    background: var(--danger);
    color: white;
}

    .btn-danger:hover {
        background: #e64a2e;
    }

.btn-warning {
    background: var(--warning);
    color: white;
}

    .btn-warning:hover {
        background: #e69500;
    }

.btn-info {
    background: var(--info);
    color: white;
}

    .btn-info:hover {
        background: #138496;
    }

.app-container {
    width: 100%;
    max-width: 1400px;
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
    animation: slideUp 0.5s ease;
    min-height: 80vh;
    display: flex;
    flex-direction: column;
    margin-top: 20px;
}

.app-header {
    background: var(--primary);
    color: white;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

#user-role-display {
    font-size: 14px;
    opacity: 0.8;
}

.app-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

.view {
    animation: fadeIn 0.3s ease;
}

.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.view h2, .view h3 {
    color: var(--dark);
    font-weight: 700;
}

.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

.menu-card {
    background: white;
    border-radius: 12px;
    padding: 25px 20px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    cursor: pointer; /* Manita al pasar el mouse */
    position: relative; /* Necesario para la línea inferior */
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    /* Borde por defecto transparente para evitar saltos */
    border-bottom: 0px solid transparent; 
}

/* Efecto Hover: Levantar tarjeta */
.menu-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

/* LA LÍNEA MÁGICA (Pseudoelemento) */
.menu-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 5px; /* Grosor de la línea */
    background-color: var(--card-color, #2E8B57); /* Usa el color variable o verde por defecto */
    
    /* Animación de expansión desde el centro */
    transform: scaleX(0); 
    transform-origin: center;
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.menu-card:hover::after {
    transform: scaleX(1); /* Expande la línea al 100% */
}

/* Icono: Usa el mismo color variable */
.menu-card .menu-icon {
    font-size: 2.5em;
    margin-bottom: 15px;
    color: var(--card-color, #2E8B57);
    transition: color 0.3s ease;
}

.menu-card h3 {
    margin: 10px 0;
    font-size: 1.1em;
    color: #333;
}

.menu-card p {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 0; /* Ya no hay botón, quitamos margen inferior */
}

.icon-clientes { color: #3498db; }
.icon-usuarios { color: #9b59b6; }
.icon-importar { color: #e74c3c; }
.icon-registrar { color: #2ecc71; }
.icon-colocacion { color: #f39c12; }
.icon-cobranza { color: #16a085; }
.icon-reportes { color: #34495e; }
.icon-reportes-avanzados { color: #8e44ad; }
.icon-configuracion { color: #7f8c8d; }


.status-message {
    padding: 12px 15px;
    border-radius: var(--border-radius);
    margin: 15px 0;
    font-weight: 500;
}

.status-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.status-info {
    background: #cce7ff;
    color: #004085;
    border: 1px solid #b3d7ff;
}

.status-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.auth-status {
    margin-top: 15px;
    padding: 10px;
    border-radius: var(--border-radius);
    text-align: center;
}

.client-table, .user-table, .report-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

    .client-table th, .client-table td, .user-table th, .user-table td, .report-table th, .report-table td {
        padding: 15px;
        text-align: left;
    }

    .client-table tr, .user-table tr, .report-table tr {
        border-bottom: 1px solid var(--border-color);
    }

        .client-table tr:last-child, .user-table tr:last-child, .report-table tr:last-child {
            border-bottom: none;
        }

    .client-table th, .user-table th, .report-table th {
        background: #f8f9fa;
        font-weight: 600;
        color: var(--dark);
    }

    .client-table tr:hover, .user-table tr:hover, .report-table tr:hover {
        background: #f8f9fa;
    }

.action-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: flex-start;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 14px;
}

.credito-info {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 12px;
    margin: 0;
    border: 1px solid #e9ecef;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px 12px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.info-label {
    font-size: 12px;
    color: var(--gray);
    font-weight: 600;
}

.info-value {
    font-weight: 600;
    color: var(--dark);
    text-align: right;
}

.status-liquidado { color: var(--success); }
.status-al-corriente { color: var(--info-blue); }
.status-atrasado { color: var(--warning); }
.status-cobranza { color: var(--danger); }
.status-juridico { color: #B71C1C; }


.filtros-container {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: var(--border-radius);
    margin-bottom: 25px;
    border: 1px solid #dee2e6;
}

.filtros-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
}

.filtros-actions {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.import-section {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: var(--border-radius);
    padding: 20px;
    margin-top: 20px;
}

.import-tabs {
    display: flex;
    margin-bottom: -1px;
    border-bottom: 1px solid #ddd;
}

.import-tab {
    padding: 10px 20px;
    cursor: pointer;
    border-bottom: 3px solid transparent;
}

    .import-tab.active {
        border-bottom-color: var(--primary);
        color: var(--primary);
        font-weight: 600;
    }

.import-tab-content {
    margin-top: 0;
}

.import-section h4, .import-section p {
    margin: 0;
}

.import-section p {
    font-size: 12px;
    color: var(--gray);
    margin-top: 5px;
}

/* Reportes */
.report-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 25px 0;
}

.report-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 25px;
    text-align: center;
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
    border: 1px solid #f0f0f0;
    transition: var(--transition);
}

    .report-card:hover {
        transform: translateY(-3px);
        box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    }

.report-icon {
    font-size: 36px;
    margin-bottom: 15px;
    color: var(--primary);
}

.report-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 5px;
}

.report-label {
    color: var(--gray);
    font-size: 14px;
}

.export-buttons {
    display: flex;
    gap: 10px;
    margin: 20px 0;
    flex-wrap: wrap;
}

/* Reportes Avanzados */
.advanced-filters {
    background: #f8f9fa;
    padding: 20px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    border: 1px solid #dee2e6;
}

.filter-section {
    margin-bottom: 20px;
}

.filter-section-title {
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--dark);
    border-bottom: 2px solid var(--primary);
    padding-bottom: 5px;
}

.date-range {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.search-group {
    display: flex;
    gap: 10px;
}

    .search-group input {
        flex: 1;
    }

/* =============================================
   BARRA DE PROGRESO MEJORADA
   ============================================= */

.processing-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    color: white;
    flex-direction: column;
}

.processing-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
    margin-bottom: 15px;
}

.processing-message {
    font-size: 16px;
    font-weight: 600;
}

.loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

    .loading::after {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 20px;
        height: 20px;
        margin: -10px 0 0 -10px;
        border: 2px solid #f3f3f3;
        border-top: 2px solid var(--primary);
        border-radius: 50%;
        animation: spin 1s linear infinite;
    }

/* =========================================
   CORRECCIÓN FINAL: BOTONES DE CARGA
   ========================================= */

/* 1. El Contenedor (El Botón) */
button.btn-loading, 
.btn.btn-loading {
    display: inline-flex !important; /* Obligatorio para centrar items */
    align-items: center !important;  /* Centrado Vertical perfecto */
    justify-content: center !important; /* Centrado Horizontal */
    gap: 12px !important;            /* Espacio exacto entre bolita y texto */
    
    /* Resetear propiedades que suelen romper la alineación */
    vertical-align: middle !important;
    text-align: center !important;
    
    /* Estética de estado deshabilitado */
    opacity: 0.85;
    cursor: not-allowed !important;
    pointer-events: none; /* Evita doble clic */
}

/* 2. El Elemento Spinner (La bolita) */
.btn-spinner {
    /* Dimensiones fijas e inamovibles */
    width: 18px !important;
    height: 18px !important;
    min-width: 18px !important; /* CRÍTICO: Evita que el texto lo aplaste */
    min-height: 18px !important;
    
    /* Diseño del círculo */
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #ffffff;
    border-radius: 50%;
    
    /* Animación */
    animation: spin 0.8s linear infinite;
    
    /* Limpieza de posicionamiento */
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
    flex-shrink: 0 !important; /* CRÍTICO: Evita deformaciones */
    position: static !important; /* Evita que flote si hay estilos absolute */
}

/* Animación de rotación */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Badges de roles */
.role-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}

.role-super-admin { background: #6f42c1; color: white; }
.role-gerencia { background: #dc3545; color: white; }
.role-administrador { background: #fd7e14; color: white; }
.role-area-comercial { background: #078f67; color: white; }
.role-consulta { background: #6c757d; color: white; }
.role-comisionista { background: #ffc107; color: #000; }
.role-default { background: #adb5bd; color: #000; }

.required {
    color: var(--danger);
    font-weight: bold;
}

.field-note {
    font-size: 12px;
    color: var(--gray);
    margin-top: 5px;
}

/* Mejoras responsive */
@media (max-width: 600px) {
    .app-header, .view-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    .menu-grid, .filtros-grid, .report-grid, .config-grid { /* Añadido .config-grid */
        grid-template-columns: 1fr;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .user-table, .client-table, .report-table {
        display: block;
        overflow-x: auto;
    }

    .date-range {
        grid-template-columns: 1fr;
    }

    .export-buttons {
        flex-direction: column;
    }

    .search-group {
        flex-direction: column;
    }

    .app-content {
        padding: 15px;
    }

    .menu-card {
        padding: 20px;
    }

    .filtros-container {
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .login-box {
        padding: 30px 20px;
    }

    .app-header {
        padding: 15px 20px;
    }

    .btn {
        padding: 10px 16px;
        font-size: 14px;
    }

    .report-card {
        padding: 20px;
    }

    .report-value {
        font-size: 24px;
    }

    .progress-text-fixed {
        font-size: 11px;
        min-width: 120px;
    }
}

/* Animaciones */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.pulse {
    animation: pulse 2s infinite;
}

#view-gestion-clientes .filtros-container {
    position: relative;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

#import-result {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 0.5rem;
    background-color: #f8fafc;
    border: 1px solid var(--border-color);
}

    #import-result.success {
        background-color: #d1fae5;
        border-color: #a7f3d0;
    }

    #import-result.error {
        background-color: #fee2e2;
        border-color: #fecaca;
    }

#import-details {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background-color: white;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    max-height: 200px;
    overflow-y: auto;
}

/* Mejoras para tablas en dispositivos móviles */
@media (max-width: 600px) {
    .client-table, .user-table, .report-table {
        font-size: 14px;
    }

        .client-table th, .client-table td,
        .user-table th, .user-table td,
        .report-table th, .report-table td {
            padding: 10px 8px;
        }

    .action-buttons {
        flex-direction: column;
        gap: 3px;
    }

    .btn-sm {
        padding: 4px 8px;
        font-size: 12px;
    }
}

/* Estilos para formularios en móviles */
@media (max-width: 480px) {
    .form-group {
        margin-bottom: 15px;
    }

    input, select, textarea {
        padding: 10px 12px;
        font-size: 14px;
    }
}

/* Mejoras de accesibilidad */
.btn:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Estados hover mejorados */
.menu-card:hover .menu-icon, .report-card:hover .report-icon {
    transform: scale(1.1);
    transition: transform 0.3s ease;
}

/* Scrollbar personalizado */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 10px;
}

    ::-webkit-scrollbar-thumb:hover {
        background: var(--primary-dark);
    }

/* Mejoras para elementos de formulario */
select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23666' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 12px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* Placeholders mejorados */
::placeholder {
    color: #999;
    opacity: 1;
}

:-ms-input-placeholder {
    color: #999;
}

::-ms-input-placeholder {
    color: #999;
}

.input-error {
    border-color: var(--danger) !important;
    box-shadow: 0 0 0 3px rgba(255, 99, 71, 0.1) !important;
}

.input-success {
    border-color: var(--success) !important;
    box-shadow: 0 0 0 3px rgba(60, 179, 113, 0.1) !important;
}

[data-tooltip] {
    position: relative;
}

    [data-tooltip]:hover::after {
        content: attr(data-tooltip);
        position: absolute;
        bottom: 100%;
        left: 50%;
        transform: translateX(-50%);
        background: var(--dark);
        color: white;
        padding: 5px 10px;
        border-radius: 4px;
        font-size: 12px;
        white-space: nowrap;
        z-index: 1000;
        margin-bottom: 5px;
    }

.filtros-usuarios {
    background: #f8f9fa;
    padding: 20px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    border: 1px solid #dee2e6;
}

.filtros-usuarios-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.filtros-usuarios-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.connection-status.offline {
    background-color: var(--warning);
    color: #333;
    display: flex !important;
}

.connection-status {
    padding: 10px 12px;
    height: 40px; 
    text-align: center;
    font-weight: 600;
    color: white;
    font-size: 14px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    left: 0;
    width: 100%;
    z-index: 10001;
    top: -60px;
    opacity: 0;
    transition: top 0.5s ease, opacity 0.5s ease;
}

.connection-status.online {
    background-color: var(--success);
    color: white;
    display: flex !important;
    top: 0;
    opacity: 1;
    animation: fade-in-out-sutil 4s ease-out forwards; 
}

/* =========================================
   MODALES GLOBALES (EFECTO GLASSMORPHISM)
   ========================================= */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6) !important;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10002;
    animation: fadeIn 0.3s ease;
    /* Efecto cristal en el fondo oscuro */
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.modal-content {
    background: rgba(255, 255, 255, 0.95) !important; /* Casi sólido pero deja pasar luz */
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-radius: 12px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.8);
    width: 95%;
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
    overflow: hidden;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background-color: var(--primary) !important; /* Verde corporativo */
    color: white !important;
    border-bottom: none;
    flex-shrink: 0;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 600;
    color: white !important; /* Fuerza letra blanca */
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 28px;
    font-weight: 300;
    color: white !important;
    opacity: 0.8;
    cursor: pointer;
    padding: 0 5px;
    line-height: 1;
    transition: opacity 0.2s;
}

.modal-close-btn:hover {
    opacity: 1;
}

.modal-body {
    padding: 25px;
    overflow-y: auto;
    flex-grow: 1;
}

.payment-history-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    font-size: 13px;
}

    .payment-history-table th,
    .payment-history-table td {
        padding: 8px 10px;
        border: 1px solid var(--border-color);
        text-align: left;
        vertical-align: top;
    }

    .payment-history-table th {
        background: #f8f9fa;
        position: sticky;
        top: 0;
    }

    .payment-history-table tr:nth-child(even) {
        background: #f8f9fa;
    }
    
    .saldo-discrepancy td {
        background-color: rgba(255, 224, 224, 0.7) !important;
        font-weight: bold;
    }
    .saldo-guardado {
        font-size: 0.9em;
        color: var(--gray);
    }

@media (max-width: 600px) {
    .modal-content {
        width: 95%;
        max-height: 95vh;
    }

    .modal-header, .modal-body {
        padding: 15px;
    }

    .payment-history-table {
        font-size: 11px;
    }

        .payment-history-table th,
        .payment-history-table td {
            padding: 6px;
        }
}

.diagnostic-tool {
    margin-top: 30px;
    padding: 20px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background-color: #f8f9fa;
}

    .diagnostic-tool h3 {
        margin-bottom: 10px;
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .diagnostic-tool p {
        margin-bottom: 15px;
        color: var(--gray);
        font-size: 14px;
    }

.diagnostic-result {
    margin-top: 15px;
    border-top: 1px solid var(--border-color);
    padding-top: 15px;
}

    .diagnostic-result h4 {
        margin-bottom: 10px;
    }

.diagnostico-json-output {
    background-color: #e9ecef;
    border-radius: 4px;
    padding: 10px;
    max-height: 300px;
    overflow-y: auto;
    font-family: monospace;
    font-size: 13px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

#grafico-container {
    position: relative;
    min-height: 450px;
    height: 60vh;
    width: 100%;
    margin: 0 auto;
    padding: 10px;
    box-sizing: border-box;
}

.myChart {
    display: block;
    box-sizing: border-box;
    max-width: 100%;
}

@media (max-width: 992px) {
    #grafico-container {
        min-height: 400px;
        height: 55vh;
    }
}

@media (max-width: 600px) {
    #grafico-container {
        min-height: 350px;
        height: 50vh;
    }

    .view-reportes-graficos .card-body {
        padding: 10px;
    }
}

.comisionista-badge-cliente {
    color: var(--warning);
    font-weight: bold;
    margin-left: 5px;
    font-size: 1.1em;
    cursor: help;
}

/* =============================================
   ESTILOS DE TABLA DE COBRANZA POR RUTA
   (Movido desde app.js)
   ============================================= */

.poblacion-group { 
    margin-bottom: 20px; 
    padding: 15px; 
    background: #fff; 
    border: 1px solid #eee; 
}
.poblacion-group h3 { 
    margin-bottom: 10px; 
    font-size: 1.1em; 
    color: var(--primary); 
    border-bottom: 1px solid #eee; 
    padding-bottom: 5px;
}
.cobranza-ruta-table { 
    width: 100%; 
    border-collapse: collapse; 
    font-size: 0.9em; 
}
.cobranza-ruta-table th, .cobranza-ruta-table td { 
    padding: 6px 4px; 
    border: 1px solid #ddd; 
    text-align: left; 
    vertical-align: middle; 
}
.cobranza-ruta-table thead th { 
    background: #f8f9fa; 
    font-weight: bold; 
}
.cobranza-ruta-table tbody tr:nth-child(even) { 
    background: #f8f9fa; 
}
.cobranza-ruta-table tfoot td { 
    font-weight: bold; 
    background: #e9ecef; 
}

/* --- Estilos para el badge de Estado (Col 2) --- */
.cobranza-ruta-table td:nth-child(2), .cobranza-ruta-table th:nth-child(2) { 
    text-align: center;
    font-size: 0.9em; 
}
.cobranza-ruta-table .info-value {
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
    color: #333;
    background-color: #eee;
    display: inline-block;
    min-width: 60px;
    text-align: center;
}
.cobranza-ruta-table .status-al-corriente { background-color: #d4edda; color: #155724; }
.cobranza-ruta-table .status-atrasado { background-color: #fff3cd; color: #856404; }
.cobranza-ruta-table .status-cobranza { background-color: #f8d7da; color: #721c24; }
.cobranza-ruta-table .status-juridico { background-color: #d6d8db; color: #1b1e21; }
.cobranza-ruta-table .status-liquidado { background-color: #d1ecf1; color: #0c5460; }
.cobranza-ruta-table .status-desconocido { background-color: #e2e3e5; color: #383d41; }
/* --- Fin Estilos Badge --- */


/* --- Selectores nth-child ajustados para 7 columnas --- */
.cobranza-ruta-table td:nth-child(4), .cobranza-ruta-table th:nth-child(4),
.cobranza-ruta-table td:nth-child(5), .cobranza-ruta-table th:nth-child(5) { 
    text-align: right; 
}

.cobranza-ruta-table th:nth-child(6) { text-align: center; width: 120px; }
.cobranza-ruta-table td:nth-child(6) { text-align: center; width: 120px; } 

.cobranza-ruta-table th:last-child, .cobranza-ruta-table td:last-child { 
    text-align: center; 
    width: 60px; 
}

.pago-grupal-input { 
    text-align: right; 
    font-weight: bold; 
    padding: 4px 6px; 
    max-width: 110px; 
} 
.cobranza-ruta-table input[type="checkbox"] { 
    width: 18px; 
    height: 18px; 
}

/* --- Estilos para filas de pago grupal procesadas --- */
tr.pago-registrado-exito { 
    opacity: 0.5; 
    background-color: #d4edda !important; 
}
tr.pago-registrado-exito input { 
    background-color: #c3e6cb !important; 
}
tr.pago-registrado-error { 
    background-color: #f8d7da !important; 
}
tr.pago-registrado-exito td, tr.pago-registrado-error td { 
    text-decoration: line-through; 
}

/* =============================================
   Estilos para Impresión del Reporte Contable
   ============================================= */
@media print {
    body { /* Corrección: Era .body */
        background: none;
        padding: 0;
    }

    .app-container {
        max-width: 100%;
        box-shadow: none;
        border-radius: 0;
        min-height: auto;
        margin-top: 0;
    }
    
    .btn-no-print,
    .app-header,
    .view-header button,
    .filtros-actions,
    .status_reporte_contable, /* ID correcto */
    .advanced-filters,
    .btn-imprimir-reporte-contable,
    .logout-btn, /* ID correcto */
    #logout-btn /* Añadido por si acaso */
    {
        display: none !important;
    }

    .app-content {
        padding: 0;
    }

    .view {
        display: none !important;
        animation: none;
    }

    .view-reporte-contable {
        display: block !important;
    }

    .reporte-contable-wrapper {
        display: block !important;
    }

    /* ID correcto */
    #reporte-contable-contenido { 
        box-shadow: none;
        border: none;
        padding: 0;
    }

    .reporte-contable-tabla {
        font-size: 10px;
        width: 100%;
        border-collapse: collapse;
        margin-bottom: 15px;
        page-break-inside: auto;
    }
    .reporte-contable-tabla th,
    .reporte-contable-tabla td {
        border: 1px solid #ccc;
        padding: 4px;
        text-align: left;
    }
    .reporte-contable-tabla th {
        background-color: #f4f4f4;
    }
    .reporte-contable-tabla tbody tr {
        page-break-inside: avoid;
    }
    .reporte-contable-tabla .monto {
        text-align: right;
        font-family: monospace;
    }
    
    .info-grid {
        background: #f8f9fa !important;
        border: 1px solid #ccc;
    }

    #reporte-contable-footer { /* ID correcto */
        page-break-before: auto;
        page-break-inside: avoid;
        /* FIX: Corrección del error de sintaxis 's' */
    }
}
/* =============================================
   ESTILOS MEJORADOS PARA CONFIGURACIÓN (Poblaciones/Rutas)
   ============================================= */

.configuracion-container {
    background: white;
    border-radius: var(--border-radius);
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    border: 1px solid var(--border-color);
}

.config-tabs {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 25px;
    background: #f8f9fa;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    padding: 0 20px;
}

/* FIX: .tabs y .tab-button (del HTML) vs .config-tabs (del CSS)
   Unificamos para usar los estilos del HTML que ya tienes.
*/
.tabs {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 25px;
    background: #f8f9fa;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    padding: 0 20px;
}

.tab-button {
    padding: 15px 25px;
    cursor: pointer;
    background: none;
    border: none;
    font-size: 16px;
    font-weight: 500;
    color: var(--gray);
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.tab-button.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: white;
    border-radius: 8px 8px 0 0;
}

.tab-button:hover:not(.active) {
    color: var(--primary-dark);
    background: rgba(46, 139, 87, 0.05);
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

.config-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 15px;
}

.config-header h3 {
    margin: 0;
    color: var(--dark);
    font-size: 1.5em;
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-actions {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.search-box {
    position: relative;
    width: 300px;
}

.search-box input {
    padding-left: 40px;
    border-radius: 25px;
    border: 1px solid var(--border-color);
}

.search-box .fas.fa-search {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray);
}

.filter-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-tab {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
}

.filter-tab.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.filter-tab:hover:not(.active) {
    background: #f8f9fa;
    border-color: var(--primary);
}

.office-section {
    margin-bottom: 30px;
    background: #f8f9fa;
    border-radius: var(--border-radius);
    padding: 20px;
}

.office-title {
    color: var(--primary);
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
    font-size: 1.2em;
    font-weight: 600;
}

.poblaciones-grid,
.rutas-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.poblaciones-list,
.rutas-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); 
    gap: 20px;
    padding: 15px 0;
}

.poblacion-card,
.ruta-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    transition: transform 0.2s, box-shadow 0.2s;
}

.poblacion-card:hover,
.ruta-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.ruta-header, 
.poblacion-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.poblacion-nombre {
    margin: 0;
    font-size: 1.1em;
    font-weight: 600;
    color: var(--dark);
    flex: 1;
    line-height: 1.4;
    word-break: break-word;
}

.ruta-actions,
.poblacion-actions {
    display: flex;
    gap: 10px;
    margin-top: auto;
    border-top: 1px solid #eee;
    padding-top: 10px;
}

.ruta-nombre-editable {
    font-weight: bold;
    font-size: 1.1em;
    color: #333;
    word-break: break-word;
}

.ruta-nombre-editable.editing {
    border-color: var(--primary);
    background: #f8f9fa;
    outline: none;
    box-shadow: 0 0 0 3px rgba(46, 139, 87, 0.1);
}

.office-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75em;
    font-weight: bold;
    white-space: nowrap;
    flex-shrink: 0;
}

.office-badge.GDL {
    background: rgba(25, 118, 210, 0.1);
    color: #1976d2;
    border: 1px solid #1976d2;
}

.office-badge.LEON {
    background: rgba(123, 31, 162, 0.1);
    color: #7b1fa2;
    border: 1px solid #7b1fa2;
}

.office-badge.OTROS {
    background: rgba(108, 117, 125, 0.1);
    color: var(--gray);
    border: 1px solid var(--gray);
}

.poblacion-content {
    margin-bottom: 15px;
    flex-grow: 1;
}

.ruta-tag {
    background: rgba(60, 179, 113, 0.1);
    color: var(--success);
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 0.85em;
    border: 1px solid rgba(60, 179, 113, 0.3);
    display: inline-block;
    font-weight: 500;
}

.no-ruta-tag {
    background: rgba(108, 117, 125, 0.1);
    color: var(--gray);
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 0.85em;
    border: 1px dashed var(--gray);
    display: inline-block;
}

.poblacion-actions,
.ruta-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    border-top: 1px solid var(--border-color);
    padding-top: 15px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.btn-asignar-ruta,
.btn-editar-ruta,
.btn-eliminar-poblacion {
    padding: 6px 12px;
    font-size: 0.85em;
    border-radius: 6px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.btn-guardar-ruta,
.btn-cancelar-ruta {
    padding: 6px 10px;
    font-size: 0.8em;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.empty-state,
.error-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray);
    background: white;
    border-radius: var(--border-radius);
    border: 2px dashed var(--border-color);
}

.empty-state i {
    font-size: 3em;
    color: #dee2e6;
    margin-bottom: 20px;
}

.error-state i {
    font-size: 3em;
    color: var(--danger);
    margin-bottom: 20px;
}

.empty-state h3,
.error-state h3 {
    margin-bottom: 15px;
    color: var(--dark);
    font-size: 1.3em;
}

.empty-state p,
.error-state p {
    margin-bottom: 25px;
    font-size: 1em;
    line-height: 1.5;
}

.asignacion-ruta-modal {
    max-width: 500px;
}

.asignacion-ruta-modal p {
    margin-bottom: 20px;
    font-size: 1.1em;
    line-height: 1.5;
    color: var(--dark);
}

@media (max-width: 600px) {
    .configuracion-container {
        padding: 15px;
    }
    
    .tabs { /* Unificado */
        flex-direction: column;
        padding: 0;
    }
    
    .tab-button { /* Unificado */
        padding: 12px 20px;
        border-radius: 0;
        border-bottom: 1px solid var(--border-color);
        margin-bottom: 0;
    }
    
    .tab-button.active { /* Unificado */
        border-radius: 0;
    }
    
    .config-header {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .header-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .search-box {
        width: 100%;
    }
    
    .poblaciones-list,
    .rutas-list {
        grid-template-columns: 1fr;
    }
    
    .poblacion-header,
    .ruta-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    
    .office-badge {
        align-self: flex-start;
    }
    
    .poblacion-actions,
    .ruta-actions {
        justify-content: center;
    }
    
    .btn-asignar-ruta,
    .btn-editar-ruta,
    .btn-eliminar-poblacion {
        flex: 1;
        justify-content: center;
        min-width: 120px;
    }
}

body.has-progress {
    padding-top: calc(60px + 20px) !important;
}
body.has-connection-status:not(.has-progress) {
    padding-top: calc(50px + 20px) !important;
}
body.has-connection-status.has-progress {
    padding-top: calc(60px + 50px + 20px) !important;
}

#progress-container-fixed {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 70px;
    background-color: #ffffff;
    z-index: 9999;
    display: flex; 
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-bottom: 3px solid var(--primary);  
    transform: translateY(-100%);
    transition: transform 0.3s ease-in-out;
    visibility: hidden;
}

#progress-container-fixed.visible {
    transform: translateY(0);
    visibility: visible;
}

#progress-container-fixed.hidden {
    transform: translateY(-100%);
    visibility: hidden;
}

.progress-content-wrapper {
    flex-grow: 1; /* Toma todo el espacio disponible */
    margin-right: 20px; /* Separa del botón de cancelar */
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.progress-text-fixed {
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.progress-bar-background {
    width: 100%;
    height: 10px;
    background-color: #e9ecef;
    border-radius: 5px;
    overflow: hidden;
}

.progress-bar-fixed {
    height: 100%;
    background-color: var(--primary);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 5px;
    background-image: linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);
    background-size: 1rem 1rem;
    animation: progress-bar-stripes 1s linear infinite;
}

.btn-cancelar-carga-fixed {
    background-color: #dc3545;
    color: white;
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    transition: all 0.2s;
    flex-shrink: 0;
}

.btn-cancelar-carga-fixed:hover {
    background-color: #c82333;
    transform: scale(1.1);
}

@keyframes progress-bar-stripes {
    0% { background-position: 1rem 0; }
    100% { background-position: 0 0; }
}

body.has-connection-status #progress-container-fixed {
    top: 50px;
}

#btn-cancelar-carga-fixed {
    background: var(--danger);
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 12px;
    flex-shrink: 0;
    padding: 0; 
}
#btn-cancelar-carga-fixed:hover {
    background: #e64a2e;
    transform: scale(1.1);
}
#btn-cancelar-carga-fixed .fa-times {
    margin: 0;
}

#progress-container-fixed > #btn-cancelar-carga-fixed {
    grid-column: 1;
    align-self: center;
}

.progress-center-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#progress-text-fixed {
    font-size: 14px;
    color: var(--dark);
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    padding: 0;
}

.progress-bar-wrapper {
    background: #e0e0e0;
    border-radius: 10px;
    height: 8px;
    overflow: hidden;
    margin-top: 5px;
    width: 100%;
    max-width: 400px;
}

#progress-bar-fixed {
    height: 8px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 10px;
    transition: width 0.3s ease, background 0.3s ease;
    width: 0%;
}

.progress-spacer {
    width: 30px; 
    height: 30px;
    flex-shrink: 0;
}

@media (max-width: 600px) {
    body.has-progress {
        padding-top: calc(50px + 20px) !important;
    }
    body.has-connection-status:not(.has-progress) {
        padding-top: calc(40px + 20px) !important;
    }
    body.has-connection-status.has-progress {
        padding-top: calc(50px + 40px + 20px) !important;
    }

    #progress-container-fixed {
        height: 50px;
        padding: 0 10px;
        gap: 10px;
    }
    
    body.has-connection-status #progress-container-fixed {
        top: 40px;
    }

    #btn-cancelar-carga-fixed {
        width: 25px;
        height: 25px;
    }

    .progress-spacer {
        width: 25px;
        height: 25px;
    }

    #progress-text-fixed {
        font-size: 12px;
    }
}

@keyframes fade-in-out-sutil {
  0% { top: 0; opacity: 1; }
  80% { top: 0; opacity: 1; }
  100% { top: -60px; opacity: 0; }
}

/* =============================================
   ESTILOS PARA ACCIONES EN MODAL DE PAGOS
   ============================================= */

/* Contenedor para los botones "Editar/Eliminar Crédito" */
.modal-credit-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end; /* Alinea a la derecha */
    margin: -10px 0 15px 0; /* Espacio arriba/abajo */
}

/* Estilo para los botones de acción en la tabla de pagos */
.payment-history-table .action-buttons-modal {
    display: flex;
    gap: 5px;
    justify-content: center;
}

/* Botones de acción pequeños para el modal */
.btn-modal-action {
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 6px;
}

/* --- Estilos para el Selector de Poblaciones (Pago Grupal) --- */
.poblacion-selector-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); /* Responsivo */
    gap: 15px;
    margin: 15px 0;
}

.poblacion-select-card {
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

/* Estilo cuando está seleccionado */
.poblacion-select-card.selected {
    border-color: var(--primary); /* Tu color verde */
    background-color: #e8f5e9; /* Verde muy clarito */
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.poblacion-select-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.poblacion-select-card input[type="checkbox"] {
    /* Ocultar el checkbox nativo feo, pero mantenerlo funcional */
    position: absolute;
    opacity: 0; 
    cursor: pointer;
    height: 0;
    width: 0;
}

.poblacion-name {
    font-weight: 600;
    color: #333;
    font-size: 0.95rem;
}

.check-icon {
    color: #ccc;
    font-size: 1.2rem;
}

.poblacion-select-card.selected .check-icon {
    color: var(--primary);
    transform: scale(1.1);
}

/* Botón de "Seleccionar Todas" más bonito */
.select-all-container {
    background: #f8f9fa;
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    border: 1px dashed #ccc;
    display: inline-block;
    width: 100%;
}

.custom-check-wrapper {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 5px;
    transition: transform 0.1s ease;
}

.custom-check-wrapper:active {
    transform: scale(0.95); /* Efecto de click */
}

/* Ocultamos el input nativo pero sigue funcionando en el DOM */
.custom-check-wrapper input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

/* El ícono visual (FontAwesome) */
.custom-check-icon {
    font-size: 1.6rem; /* Tamaño grande y fácil de tocar */
    color: #e0e0e0;    /* Color apagado (desactivado) */
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); /* Animación rebote */
}

/* Cuando el input "oculto" está checked, cambiamos el ícono hermano */
.custom-check-wrapper input[type="checkbox"]:checked ~ .custom-check-icon {
    color: #28a745;    /* Verde éxito */
    content: "\f058";  /* Código fa-check-circle solid */
    transform: scale(1.1);
    text-shadow: 0 2px 5px rgba(40, 167, 69, 0.3);
}

/* Estilos específicos para el header "Marcar Todos" */
.header-check-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}
.header-check-wrapper .custom-check-icon {
    font-size: 1.3rem; /* Un poco más pequeño en el header */
}

/* --- ESTILOS ACORDEÓN POBLACIONES --- */

/* El encabezado gris ahora es clicable */
.group-header-clickable {
    cursor: pointer;
    transition: background-color 0.2s;
    user-select: none; /* Evita que se seleccione el texto al hacer clic rápido */
}

.group-header-clickable:hover {
    background-color: #e2e6ea !important; /* Un poco más oscuro al pasar el mouse */
}

/* Icono de flecha (chevron) */
.toggle-icon {
    margin-right: 10px;
    transition: transform 0.3s ease;
    color: var(--primary);
}

.closed .toggle-icon {
    transform: rotate(-90deg);
}

.closed .group-content-wrapper {
    display: none;
}

/* Cuando el grupo está cerrado, rotamos la flecha */
.poblacion-group.closed .toggle-icon,
.card.closed .toggle-icon {
    transform: rotate(-90deg);
}

/* Ocultar el contenido cuando tiene la clase closed */
.poblacion-group.closed .group-content-wrapper,
.card.closed .group-content-wrapper {
    display: none;
}

/* Ajuste para que el checkbox de "Marcar Todos" no interfiera con el clic del acordeón */
.header-check-wrapper {
    z-index: 2; /* Asegura que esté por encima */
}

/* =========================================
   ESTILOS PARA GESTIÓN DE RUTAS (CORRECCIÓN VISUAL)
   ========================================= */

/* 1. El Contenedor (Grid) */
.rutas-list {
    display: grid;
    /* Esto asegura que las tarjetas tengan un ancho mínimo decente y no se aplasten */
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); 
    gap: 20px;
    padding: 20px 0;
}

/* 2. La Tarjeta (Card) */
.ruta-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px; /* Bordes redondeados igual que Poblaciones */
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    justify-content: space-between; /* Empuja el footer hacia abajo */
    min-height: 150px; /* Altura mínima para uniformidad */
    transition: transform 0.2s, box-shadow 0.2s;
}

.ruta-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* 3. Encabezado de la Tarjeta (Nombre + Badge) */
.ruta-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.ruta-nombre-editable {
    font-weight: 700;
    font-size: 1.1rem;
    color: #333;
    text-transform: uppercase;
    line-height: 1.2;
    margin-right: 10px;
    /* Evita que nombres largos rompan el diseño */
    word-break: break-word; 
}

/* Estilo cuando estás editando el nombre */
.ruta-nombre-editable.editing {
    border-bottom: 2px solid var(--primary);
    background-color: #f0f8ff;
    padding: 2px 4px;
    outline: none;
}

/* 4. Footer de Acciones (Botones) */
.ruta-actions {
    display: flex;
    gap: 10px; /* Espacio entre los botones */
    margin-top: auto; /* Se asegura de estar al fondo de la tarjeta */
    padding-top: 15px;
    border-top: 1px solid #f0f0f0; /* La línea divisoria sutil */
}

/* Botón Principal (Editar/Guardar) - Ocupa el espacio disponible */
.ruta-actions .btn-editar-ruta,
.ruta-actions .btn-guardar-ruta,
.ruta-actions .btn-cancelar-ruta {
    flex: 1; /* Crece para llenar el espacio */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

/* Botón Eliminar (Basurero) - Se mantiene cuadrado/pequeño a la derecha */
.ruta-actions .btn-outline-danger {
    flex: 0 0 40px; /* Ancho fijo */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Badge de Oficina (GDL/LEON) - Reutilizando estilos existentes pero asegurando consistencia */
.office-badge {
    font-size: 0.75rem;
    padding: 4px 8px;
    border-radius: 12px;
    font-weight: bold;
    text-transform: uppercase;
    border: 1px solid #ccc;
    white-space: nowrap; 
}

/* =======================================================
   CORRECCIÓN VISUAL: GESTIÓN DE RUTAS Y BOTONES FALTANTES
   ======================================================= */

/* 1. Definir los estilos de botones "Outline" que faltaban */
.btn-outline-info {
    background: transparent;
    color: var(--info);
    border: 1px solid var(--info);
}
.btn-outline-info:hover {
    background: var(--info);
    color: white;
}

.btn-outline-danger {
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
}
.btn-outline-danger:hover {
    background: var(--danger);
    color: white;
}

.btn-outline-success {
    background: transparent;
    color: var(--success);
    border: 1px solid var(--success);
}
.btn-outline-success:hover {
    background: var(--success);
    color: white;
}

.btn-outline-secondary {
    background: transparent;
    color: var(--gray);
    border: 1px solid var(--gray);
}
.btn-outline-secondary:hover {
    background: var(--gray);
    color: white;
}

/* 2. Arreglar el Grid de Rutas (Para que no se aplasten los textos) */
.rutas-list {
    display: grid;
    /* Ancho mínimo de 280px por tarjeta para que quepan los textos */
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); 
    gap: 20px;
    padding: 15px 0;
}

/* 3. Arreglar la Tarjeta de Ruta */
.ruta-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 140px; /* Altura uniforme */
    transition: transform 0.2s, box-shadow 0.2s;
}

.ruta-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* 4. Arreglar los Botones (Alineación y Estiramiento) */
.ruta-actions {
    display: flex;
    gap: 10px;
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid #f0f0f0;
    
    /* ESTA ES LA CLAVE DEL ARREGLO VISUAL: */
    align-items: center; /* Evita que los botones se estiren hacia arriba */
    flex-wrap: nowrap;   /* Mantiene los botones en una sola línea */
}

/* El botón de editar ocupa el espacio restante */
.ruta-actions .btn-editar-ruta,
.ruta-actions .btn-guardar-ruta {
    flex: 1; 
    justify-content: center;
}

/* El botón de cancelar ocupa espacio */
.ruta-actions .btn-cancelar-ruta {
    flex: 1;
    justify-content: center;
}

/* El botón de eliminar se queda pequeño a la derecha */
.ruta-actions .btn-outline-danger {
    width: 38px;
    height: 38px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    flex-shrink: 0; /* No permitimos que se aplaste */
}

/* Ajuste del título para que no rompa la tarjeta */
.ruta-nombre-editable {
    font-size: 1.1rem;
    font-weight: 700;
    color: #333;
    line-height: 1.3;
    margin-right: 10px;
    word-break: break-word; /* Rompe palabras largas si es necesario */
}

/* Corrección Visual Específica para Rutas */
.ruta-actions {
    display: flex;
    gap: 10px;
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid #f0f0f0;
    align-items: center; /* ESTO EVITA QUE SE ESTIREN HACIA ARRIBA */
}

/* Forzar altura uniforme en las tarjetas */
.ruta-card {
    min-height: 140px; 
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Asegurar que el título no rompa el diseño */
.ruta-nombre-editable {
    font-weight: 700;
    font-size: 1.1rem;
    color: #333;
    text-transform: uppercase;
    word-break: break-word;
    margin-right: 10px;
    line-height: 1.2;
}

/* --- ESTILOS GESTIÓN DE CLIENTES (TABLA MEJORADA) --- */

/* Columna Cliente */
.client-name {
    font-weight: 700;
    color: #0056b3;
    font-size: 1.1em;
    margin-bottom: 2px;
}
.client-curp {
    font-family: 'Courier New', monospace; /* Fuente monoespaciada para leer mejor letras/números */
    font-size: 1.15em; /* Más grande como pediste */
    font-weight: 600;
    color: #333;
    background-color: #f4f6f8;
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
    margin: 4px 0;
    border: 1px solid #e1e4e8;
}
.client-meta {
    font-size: 0.9em;
    color: #666;
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Columna Ubicación */
.location-header {
    font-weight: 600;
    color: #2c3e50;
}
.address-box {
    margin-top: 5px;
    background-color: #fff;
    border: 1px solid #eee;
    border-left: 3px solid #17a2b8; /* Borde de color para resaltar */
    padding: 6px 8px;
    border-radius: 4px;
    font-size: 0.85em;
    color: #555;
    line-height: 1.3;
    max-width: 250px; /* Evita que se estire demasiado */
}

/* Tarjeta de Crédito (Mini Dashboard) */
.credit-card-mini {
    background-color: #fff;
    border: 1px solid #dfe6ed;
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    min-width: 280px;
}

.credit-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 6px;
    margin-bottom: 6px;
}

.credit-grid {
    display: grid;
    grid-template-columns: 1fr 1fr; /* Dos columnas */
    gap: 5px 15px;
    font-size: 0.85em;
}

.data-row {
    display: flex;
    justify-content: space-between;
}
.lbl { color: #888; font-weight: 500; }
.val { color: #333; font-weight: 600; text-align: right; }

/* Sección Aval */
.aval-section {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px dashed #ddd;
    font-size: 0.8em;
}
.aval-title {
    font-size: 0.9em;
    font-weight: 700;
    color: #666;
    margin-bottom: 2px;
    display: block;
}

/* Badges y Botones */
.badge-status {
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.75em;
    font-weight: 700;
    text-transform: uppercase;
}
/* Colores de estado */
.st-al-corriente { background: #d4edda; color: #155724; }
.st-atrasado { background: #fff3cd; color: #856404; }
.st-vencido { background: #f8d7da; color: #721c24; }
.st-liquidado { background: #e2e3e5; color: #383d41; }

/* Notificaciones */
.badge-notif {
    position: absolute; top: -5px; right: -5px;
    background: red; color: white; border-radius: 50%;
    width: 20px; height: 20px; font-size: 0.75rem; font-weight: bold;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid white;
}
.notif-dropdown {
    position: absolute; top: 40px; right: 0; width: 320px;
    background: white; border: 1px solid #ccc; box-shadow: 0 5px 15px rgba(0,0,0,0.15);
    z-index: 2000; border-radius: 8px; overflow: hidden;
}
.notif-header { background: #f1f3f5; padding: 12px; font-weight: bold; border-bottom: 1px solid #dee2e6; color: #333; }
.notif-body { max-height: 300px; overflow-y: auto; }

/* Calendario */
.calendar-grid {
    display: grid; 
    grid-template-columns: repeat(7, 1fr); 
    gap: 5px;
    margin-top: 10px;
}
.cal-header { 
    font-weight: bold; text-align: center; padding: 8px; 
    background: #e9ecef; border-radius: 4px; font-size: 0.9em;
}
.cal-day {
    background: #fff; border: 1px solid #e9ecef; border-radius: 4px;
    height: 80px; padding: 5px; position: relative; cursor: pointer;
    transition: background 0.2s;
}
.cal-day:hover { background-color: #f1f3f5; border-color: #ced4da; }
.day-num { font-weight: bold; font-size: 0.9em; color: #495057; }
.dots-container { 
    display: flex; flex-wrap: wrap; gap: 3px; margin-top: 5px; justify-content: center; 
}
.cal-dot { 
    width: 8px; height: 8px; border-radius: 50%; 
}

/* --- LOADER GALAXY (Sistema Solar) - CENTRADO INFALIBLE --- */
.loader-galaxy-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.galaxy-system {
    position: relative;
    width: 120px;
    height: 120px;
    margin-bottom: 20px;
}

/* El texto del porcentaje en el centro (Centrado con Flexbox) */
.galaxy-center-text {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 24px;
    color: #333;
    z-index: 10;
    margin: 0;
}

/* Órbitas (Anillos) centradas con margin auto, sin translate */
.galaxy-orbit {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    margin: auto; /* Esto garantiza el centro perfecto */
    border: none;
    border-radius: 50%;
}

/* Solo usamos rotate, ya no necesitamos translate */
.orbit-1 { width: 100%; height: 100%; animation: spin 4s linear infinite; }
.orbit-2 { width: 75%; height: 75%; animation: spin 3s linear infinite reverse; }
.orbit-3 { width: 50%; height: 50%; animation: spin 2s linear infinite; }

/* Planetas (Círculos iguales) */
.galaxy-orbit::before {
    content: '';
    position: absolute;
    top: -6px; /* Posición en el borde superior de la órbita */
    left: 50%;
    width: 12px;
    height: 12px;
    background-color: #0d6efd;
    border-radius: 50%;
    transform: translateX(-50%); /* Centra la bolita en el borde */
    box-shadow: 0 0 10px rgba(13, 110, 253, 0.5);
}

/* Colores diferentes para cada planeta */
.orbit-1::before { background-color: #2E8B57; } /* Verde */
.orbit-2::before { background-color: #0dcaf0; } /* Cyan */
.orbit-3::before { background-color: #6610f2; } /* Morado */

/* Texto de estado debajo */
.galaxy-status-text {
    font-size: 1.1em;
    color: #666;
    font-weight: 500;
    text-align: center;
    animation: pulseText 1.5s infinite ease-in-out;
}

/* La animación ahora es mucho más limpia */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulseText {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* =========================================
   ESTILOS PARA EVIDENCIA FOTOGRÁFICA
   ========================================= */

/* --- 1. Cuadrícula de fotos (Dentro del Formulario de Edición) --- */
.fotos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    margin-top: 15px;
}

.foto-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    aspect-ratio: 1 / 1;
    border: 1px solid #ddd;
    background: #f8f9fa;
}

.foto-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: zoom-in;
    transition: transform 0.2s;
}

.foto-item img:hover {
    transform: scale(1.05);
}

.btn-eliminar-foto {
    position: absolute;
    top: 5px; right: 5px;
    background: rgba(220, 53, 69, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px; height: 24px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    font-size: 14px;
    z-index: 10;
}

/* --- 2. Miniatura en la Tabla de Clientes --- */
.tabla-foto-mini {
    width: 50px;
    height: 50px;
    border-radius: 8px; /* Bordes redondeados */
    object-fit: cover;
    border: 2px solid #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    cursor: zoom-in;
    margin-right: 8px;
    vertical-align: middle;
    transition: transform 0.2s;
    background-color: #eee;
}

.tabla-foto-mini:hover {
    transform: scale(1.8); /* Efecto lupa al pasar mouse */
    z-index: 100;
    position: relative;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

/* --- 3. Visor de Foto Grande (Lightbox) --- */
.lightbox-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.9);
    z-index: 10060; /* Encima de todo */
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: zoom-out;
}

.lightbox-img {
    max-width: 90%;
    max-height: 90%;
    border-radius: 4px;
    box-shadow: 0 0 20px rgba(255,255,255,0.2);
    animation: zoomIn 0.2s ease-out;
}

@keyframes zoomIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* --- 4. Cámara --- */
.camera-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: #000;
    z-index: 10050;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.camera-video-container {
    width: 100%;
    max-width: 600px;
    position: relative;
    background: #000;
}

#camera-stream {
    width: 100%;
    height: auto;
    border-radius: 8px;
}

.camera-actions {
    margin-top: 20px;
    display: flex;
    gap: 20px;
}

.btn-shutter {
    width: 60px; height: 60px;
    border-radius: 50%;
    background: white;
    border: 4px solid rgba(255,255,255,0.3);
    cursor: pointer;
}
.evidencia-controls {
    display: flex; gap: 10px; margin-bottom: 10px;
}

/* =========================================
   SEMÁFORO DE ACTIVIDAD (Gestión Usuarios)
   ========================================= */
.telemetry-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px; /* Espacio entre punto, texto e icono */
    padding: 4px 10px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 20px; /* Forma de píldora */
    font-size: 0.85rem;
    color: #555;
    white-space: nowrap;
}

/* 1. Base del punto */
.status-dot-base {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
    border: 1px solid rgba(0,0,0,0.1);
}

/* 2. Estados de conexión por tiempo */
.dot-pulse-green {
    background-color: #28a745; /* Verde: < 15 min */
    border-color: #1e7e34;
    box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.7);
    animation: pulse-green 2s infinite;
}

.dot-yellow {
    background-color: #ffc107; /* Amarillo: < 1 hora */
    border-color: #d39e00;
}

.dot-orange {
    background-color: #fd7e14; /* Naranja: < 2 horas */
    border-color: #e26105;
}

.dot-gray {
    background-color: #6c757d; /* Gris: > 2 horas (Offline) */
    border-color: #545b62;
}

/* Animación de latido suave */
@keyframes pulse-green {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(40, 167, 69, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(40, 167, 69, 0); }
}

.net-icon { font-size: 1.1em; }
.net-wifi { color: #0d6efd; }
.net-data { color: #fd7e14; }

/* =========================================
   EFECTO GLASSMORPHISM PARA RESULTADOS DE BÚSQUEDA
   ========================================= */
#gasto-search-results {
    position: absolute;
    top: 100%; /* Empieza justo debajo de la barra */
    left: 0;
    width: 100%;
    z-index: 9999;
    max-height: 280px;
    overflow-y: auto;
    
    /* El efecto Cristal (Glassmorphism) */
    background-color: rgba(255, 255, 255, 0.7) !important; /* 70% opaco */
    backdrop-filter: blur(12px); /* Desenfoca el fondo */
    -webkit-backdrop-filter: blur(12px); /* Soporte Safari */
    
    /* Estética de tarjeta flotante */
    border-radius: 0 0 12px 12px;
    box-shadow: 0 15px 30px rgba(0,0,0,0.15);
    border: 1px solid rgba(255,255,255,0.8);
    border-top: none;
    
    /* Obliga a los items a apilarse en bloque */
    display: block; 
}

.search-result-item {
    display: block;
    width: 100%;
    padding: 15px 20px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    background-color: transparent; /* Hereda el cristal del padre */
    color: var(--dark);
    text-decoration: none;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background-color: rgba(46, 139, 87, 0.15) !important; /* Resalte verde semitransparente */
    padding-left: 25px; /* Efecto deslizamiento moderno */
}

.search-result-item strong {
    display: block;
    font-size: 1.1em;
    color: var(--primary);
    margin-bottom: 4px;
}

.search-result-item small {
    display: block;
    color: var(--gray);
    font-size: 0.85em;
    font-weight: 500;
}


/* =========================================
   SOLUCIÓN INFALIBLE PARA ALINEACIÓN DE BOTONES (SPINNER)
   ========================================= */

/* Solo afectará a los botones que tengan la clase .btn-loading */
.btn-loading {
    display: inline-grid !important;  /* Grid es perfecto para alinear al centro */
    grid-auto-flow: column;           /* Pone el círculo al lado del texto */
    align-items: center !important;   /* Centro vertical matemático */
    justify-content: center !important; /* Centro horizontal */
    gap: 12px !important;             /* Espacio exacto */
    
    opacity: 0.85;
    cursor: not-allowed !important;
    pointer-events: none;
}

.btn-spinner {
    display: block !important;
    width: 18px !important;
    height: 18px !important;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 !important;
    padding: 0 !important;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

input[name="com-color-radio"]:checked + .color-circle {
    transform: scale(1.3);
    box-shadow: 0 0 0 2px white, 0 0 0 4px var(--dark);
}




