/* Configuración General y Colores Modernos */
:root {
    --primary: #2ecc71;       /* Verde éxito/dinero */
    --primary-dark: #27ae60;
    --background: #f5f7fa;
    --card-bg: #ffffff;
    --text: #2c3e50;
    --text-light: #7f8c8d;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body { 
    background-color: var(--background); 
    display: flex; 
    justify-content: center; 
    align-items: flex-start; /* ESTA ES LA CLAVE: Alinea arriba en lugar de al centro */
    min-height: 100vh; 
    padding: 5vh 20px 20px 20px; /* Da un 5% de aire arriba para que no toque el techo */
}

/* Contenedor de la Tarjeta de Login */
.login-container {
    background-color: var(--card-bg);
    padding: 40px 30px;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
    width: 100%;
    max-width: 400px; /* Evita que en compu se estire feo */
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    color: var(--primary);
    font-size: 2.2rem;
    margin-bottom: 8px;
}

.login-header p {
    color: var(--text-light);
    font-size: 0.95rem;
}

/* Formularios y Campos de Texto */
.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 600;
}

.input-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(46, 204, 113, 0.15);
}

/* Botón Principal Estilizado */
.btn-primary {
    width: 100%;
    padding: 14px;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin-top: 10px;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
}

/* Links del pie */
.login-footer {
    text-align: center;
    margin-top: 25px;
    font-size: 0.9rem;
}

.login-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.login-footer a:hover {
    text-decoration: underline;
}

.login-footer p {
    margin-top: 10px;
    color: var(--text-light);
}
/* Contenedor de Toasts */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1000;
}

/* Estilo Base del Toast */
.toast {
    background: #333;
    color: white;
    padding: 14px 24px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    box-shadow: 0 5px 15px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    gap: 10px;
    transform: translateY(100px);
    opacity: 0;
    animation: slideIn 0.3s forwards, fadeOut 0.3s 3.7s forwards;
}

/* Colores según el tipo de mensaje */
.toast.success { background-color: var(--primary); }
.toast.error { background-color: #e74c3c; } /* Rojo suave */
.toast.info { background-color: #3498db; }  /* Azul */

/* Animaciones */
@keyframes slideIn {
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    to {
        transform: translateY(-20px);
        opacity: 0;
    }
}

/* Ajuste Responsivo para Celulares */
@media (max-width: 480px) {
    .toast-container {
        right: 20px;
        left: 20px;
        bottom: 20px;
    }
    .toast {
        width: 100%;
    }
}

/* ========================================================
   ESTILOS DEL DASHBOARD Y MODALES
   ======================================================== */



.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #edf2f7;
    padding-bottom: 15px;
}

.dashboard-header h1 {
    font-size: 1.4rem;
    color: var(--text);
}

.badge-periodo {
    background: #e8f8f0;
    color: var(--primary);
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.85rem;
}

/* Tarjeta de Saldo Principal */
.balance-card {
    background: linear-gradient(135deg, var(--primary) 0%, #1abc9c 100%);
    color: white;
    padding: 25px;
    border-radius: 20px;
    box-shadow: 0 10px 20px rgba(46, 204, 113, 0.2);
}

.balance-card p {
    font-size: 0.9rem;
    opacity: 0.9;
}

.balance-card h2 {
    font-size: 2.2rem;
    margin-top: 5px;
    font-weight: 700;
}

/* Secciones y Listas de Movimientos */
.movimientos-section {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-small {
    background: #edf2f7;
    border: none;
    padding: 8px 14px;
    border-radius: 8px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    font-size: 0.85rem;
}

.text-vacio {
    text-align: center;
    color: var(--text-light);
    font-size: 0.9rem;
    margin-top: 20px;
}

/* Estilos de Botones e Iconos Sueltos */
.btn-icon {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: #e74c3c;
    cursor: pointer;
}

/* 🏢 DISEÑO DEL MODAL FLOTANTE (RESPONSIVE) */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5); /* Fondo oscuro semitransparente */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    padding: 20px;
}

/* Clase para abrir el modal desde JS */
.modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 24px;
    width: 100%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal-overlay.open .modal-content {
    transform: scale(1);
}

.modal-icon {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 15px;
}

.modal-content h2 {
    color: var(--text);
    font-size: 1.4rem;
    margin-bottom: 10px;
}

.modal-content p {
    color: var(--text-light);
    font-size: 0.95rem;
    line-height: 1.4;
}

.modal-sugerencia {
    margin-top: 10px;
    background: #f7fafc;
    padding: 12px;
    border-radius: 12px;
    border-left: 4px solid var(--primary);
}

.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 25px;
}


/* ========================================================
   ESTILOS PARA EL AVATAR DINÁMICO
   ======================================================== */

.user-profile-box {
    display: flex;
    align-items: center;
    gap: 15px; /* Separa el círculo del texto de bienvenida */
}

.avatar-circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%); /* Azul moderno por defecto */
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.3rem;
    font-weight: bold;
    text-transform: uppercase;
    box-shadow: 0 4px 10px rgba(52, 152, 219, 0.3);
    overflow: hidden; /* Corta la imagen en los bordes si el usuario sube una */
    user-select: none;
}

.avatar-circle img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Hace que la foto no se deforme */
}
/* ========================================================
   ESTILOS DE LOS MOVIMIENTOS E ITEMS INDIVIDUALES
   ======================================================== */

.lista-movimientos {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 10px;
}

.movimiento-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
    padding: 14px 16px;
    border-radius: 14px;
    transition: transform 0.2s;
}

.movimiento-item:hover {
    transform: translateY(-2px);
}

.movimiento-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.movimiento-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1rem;
}

.movimiento-icon.gasto { background: #fde8e8; color: #e74c3c; }
.movimiento-icon.ingreso { background: #e1f7ec; color: #2ecc71; }

.movimiento-info h4 {
    font-size: 0.95rem;
    color: var(--text);
    margin-bottom: 2px;
}

.movimiento-info small {
    color: var(--text-light);
    font-size: 0.8rem;
}

.movimiento-acciones {
    display: flex;
    align-items: center;
    gap: 15px;
}

.movimiento-monto {
    font-weight: 700;
    font-size: 1rem;
}

.movimiento-monto.gasto { color: #e74c3c; }
.movimiento-monto.ingreso { color: #2ecc71; }

.btn-delete {
    background: none;
    border: none;
    color: #cbd5e1;
    cursor: pointer;
    font-size: 0.95rem;
    transition: color 0.2s;
}

.btn-delete:hover {
    color: #e74c3c; /* Se pone rojo al pasar el dedo o mouse */
}
/* ========================================================
   ESTILOS DE RENDIMIENTO Y FORMULARIO FLOTANTE
   ======================================================== */

.resumen-financiero-box {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* El Sueldo Destacado */
.indicador-destacado.sueldo-base {
    background: #e1f7ec;
    border: 2px solid var(--primary);
    padding: 20px;
    border-radius: 18px;
    text-align: center;
}

.indicador-destacado.sueldo-base p {
    color: var(--primary-dark);
    font-weight: bold;
    font-size: 0.95rem;
    margin-bottom: 5px;
}

.indicador-destacado.sueldo-base h3 {
    font-size: 1.8rem;
    color: #1b5e20;
    font-weight: 800;
}

/* Las dos tarjetitas de abajo */
.fila-mini-indicadores {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.mini-card {
    background: #f8fafc;
    padding: 15px;
    border-radius: 16px;
    text-align: center;
    border: 1px solid #e2e8f0;
}

.mini-card p {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-bottom: 4px;
}

.mini-card span {
    font-size: 1.1rem;
    font-weight: 700;
}

.mini-card.gasto span { color: #e74c3c; }
.mini-card.disponible { background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%); }
.mini-card.disponible p { color: #cbd5e1; }
.mini-card.disponible span { color: white; }

/* Formulario moderno dentro del Modal */
.text-left { text-align: left !important; }

.select-modern {
    width: 100%;
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 15px 0;
    font-size: 0.9rem;
    color: var(--text);
    cursor: pointer;
}

.checkbox-group input {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.modal-actions-horizontal {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.btn-small.primary {
    background: var(--primary);
    color: white;
}
/* ========================================================
   ESTILOS DEL AUMENTO DE SUELDO
   ======================================================== */
.sueldo-header {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-bottom: 5px;
}

.sueldo-header p {
    margin-bottom: 0 !important; /* Corregimos el margen anterior */
}

.btn-icon-small {
    background: rgba(46, 204, 113, 0.2);
    color: #1b5e20;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
}

.btn-icon-small:hover {
    background: #2ecc71;
    color: white;
    transform: scale(1.1);
}

.leyenda-aumento {
    display: block;
    margin-top: 10px;
    font-size: 0.8rem;
    color: #27ae60;
    font-weight: 600;
}

.vista-previa-aumento {
    background: #f8fafc;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    font-size: 0.9rem;
    margin: 15px 0;
    color: var(--text-light);
}

.vista-previa-aumento strong {
    color: var(--primary);
    font-size: 1.3rem;
    display: block;
    margin-top: 5px;
}
/* Estilo para el selector de la máquina del tiempo */
.select-historico {
    border: none;
    outline: none;
    cursor: pointer;
    font-family: inherit;
    appearance: none; /* Quita la flechita fea por defecto en celulares */
    -webkit-appearance: none;
    text-align: center;
}
.select-historico:hover {
    background: #d4f0e2; /* Un verde un poquito más oscuro al pasar el mouse */
}

/* Contenedor que alinea input y botón */
.input-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* ==========================================
   NUEVO ESTILO PARA EL BOTÓN DE IA
   ========================================== */
.btn-ia {
    /* Degradado moderno */
    background: linear-gradient(135deg, #8e44ad, #3498db); 
    color: white;
    border: none;
    
    /* Tamaño fijo para que quede un cuadradito perfecto */
    width: 42px; 
    height: 42px;
    border-radius: 10px; /* Bordes un poco más redondeados */
    
    display: flex;
    align-items: center;
    justify-content: center;
    
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(142, 68, 173, 0.3); /* Sombrita sutil */
    transition: all 0.3s ease;
}

.btn-ia i {
    font-size: 1.1rem; /* Tamaño de icono ajustado */
}

.btn-ia:hover {
    /* Efecto al pasar el mouse */
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 10px rgba(142, 68, 173, 0.5);
    background: linear-gradient(135deg, #9b59b6, #2980b9);
}

.btn-ia:active {
    transform: scale(0.95);
}

/* Ajuste fino para el contenedor y el input */
.input-group {
    display: flex;
    gap: 8px;
    align-items: stretch; /* Hace que el botón y el input tengan la misma altura */
    width: 100%;
}

#descGasto {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 10px;
    outline: none;
    transition: border-color 0.3s;
}

#descGasto:focus {
    border-color: #8e44ad; /* El input se pinta de violeta al hacerle clic */
}
/* ==========================================
   ESTILOS PARA LOS MODALES (Ventanas emergentes)
   ========================================== */
.modal {
    display: none; /* Oculto por defecto */
    position: fixed; /* Se fija a la pantalla completa */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6); /* Fondo oscuro transparente */
    z-index: 1000; /* Asegura que esté por encima de todo */
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(3px); /* Efecto moderno de desenfoque en el fondo */
}

/* La clase que le agregamos desde JavaScript para mostrarlo */
.modal.open {
    display: flex;
}

.modal-content {
    background-color: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    width: 90%;
    max-width: 400px;
    animation: aparecerModal 0.3s ease-out; /* Animación suave al entrar */
}

/* Efecto de caída suave al abrir el modal */
@keyframes aparecerModal {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
/* ==========================================
   ESTILOS PARA LA LISTA DE AUTOCOMPLETADO
   ========================================== */
.custom-datalist {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    
    /* Le damos un blanco puro pero lo despegamos con la sombra */
    background-color: #ffffff; 
    
    /* 1. Borde un poquito más oscuro para delimitar bien la caja */
    border: 1px solid #a0aec0; 
    
    /* 2. Sombra mucho más pronunciada (más oscura y difuminada) */
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.25); 
    
    border-radius: 8px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    margin-top: 5px;
}

.custom-option {
    padding: 10px 15px;
    cursor: pointer;
    color: #2c3e50;
    font-size: 0.95rem;
    border-bottom: 1px solid #f1f2f6;
    transition: background 0.2s, color 0.2s;
}

.custom-option:last-child {
    border-bottom: none;
}

.custom-option:hover {
    background-color: #f8f9fa;
    color: #27ae60; /* Se pinta del verde de tu diseño al pasar el mouse */
    font-weight: bold;
}
/* Estilo para el botón de editar */
.btn-edit {
    color: #3498db;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    margin-right: 12px; /* Separación con el tachito de basura */
    transition: transform 0.2s, color 0.2s;
}

.btn-edit:hover {
    color: #2980b9;
    transform: scale(1.1);
}
/* Aplicamos esto a todos los campos del formulario para que se vean iguales */
.form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 14px;
    box-sizing: border-box; /* Importante: esto evita que el padding rompa el diseño */
    margin-bottom: 10px;
}
/* Estilos para el fondo dinámico */
.monto-input {
    transition: background-color 0.3s ease; /* Transición suave */
}

.bg-gasto {
    background-color: #fdeaea !important; /* Rojo muy clarito */
    border-color: #e74c3c !important;
}

.bg-ingreso {
    background-color: #e8f8f0 !important; /* Verde muy clarito */
    border-color: #27ae60 !important;
}
.btn-primary {
    background-color: #27ae60;
    color: white;
    padding: 10px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}
.btn-secondary {
    background-color: #bdc3c7 !important;
    color: white !important;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.3s;
}
/* Asegura que los botones se vean bien */
.btn-primary:hover { background: #219150 !important; }
.btn-secondary:hover {
    background-color: #aeb6bc !important;
}

/* El campo de monto con color dinámico */
.monto-input { transition: background-color 0.3s ease; }
.bg-gasto { background-color: #fdeaea !important; border-color: #e74c3c !important; }
.bg-ingreso { background-color: #e8f8f0 !important; border-color: #27ae60 !important; }

/* Contenedor de botones para que ocupen el mismo espacio */
.modal-actions-container {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

/* Estilo base para ambos botones */
.btn-unificado {
    flex: 1; /* Esto hace que ambos ocupen exactamente el 50% del ancho */
    padding: 12px;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.2s;
}

/* Guardar (Verde) */
.btn-save {
    background-color: #27ae60;
    color: white;
}
.btn-save:hover { background-color: #219150; }

/* Cancelar (Gris Moderno) */
.btn-cancel {
    background-color: #e0e0e0;
    color: #444;
}
.btn-cancel:hover { background-color: #d0d0d0; }
/* 1. Un poquito más de ancho para que respire */
.dashboard-container {
    width: 95%; /* Usa casi todo el ancho disponible */
    max-width: 600px; /* Aumentado de 500px a 600px */
    background: var(--card-bg);
    min-height: 90vh;
    border-radius: 24px;
    padding: 25px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* 2. Reparación del ítem: evita que el texto rompa el diseño */
.movimiento-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
    padding: 14px 16px;
    border-radius: 14px;
    margin-bottom: 12px;
    gap: 10px; /* Espacio entre el texto y el número */
}

.movimiento-info {
    flex: 1; /* Esto hace que el texto ocupe todo el espacio sobrante */
    min-width: 0; /* Vital: permite que el texto se trunque si es muy largo */
    display: flex;
    align-items: center;
    gap: 12px;
}

.movimiento-info h4 {
    white-space: nowrap; /* Evita que el título se rompa en dos líneas */
    overflow: hidden;
    text-overflow: ellipsis; /* Pone "..." si el texto es muy largo */
    font-size: 0.95rem;
}

.movimiento-acciones {
    flex-shrink: 0; /* Evita que los botones se achiquen */
    display: flex;
    align-items: center;
    gap: 10px;
}
@media (max-width: 360px) {
    .dashboard-container { padding: 15px; }
    .movimiento-monto { font-size: 0.9rem; }
    .movimiento-info h4 { font-size: 0.85rem; }
}

/* Contenedor de las pestañas */
.tabs-container {
    display: flex;
    gap: 8px;
    margin-bottom: 25px;
    background: #f1f5f9; /* Fondo gris muy clarito */
    padding: 6px;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
}

.tab-btn {
    flex: 1;
    padding: 12px;
    border: none;
    background: transparent;
    font-weight: 700;
    color: #94a3b8; /* Gris suave para inactivos */
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.tab-btn.active {
    background: white;
    color: var(--primary);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); /* Sombra elegante */
}

.tab-content { 
    display: none !important; 
    min-height: 320px; /* Evita que la tarjeta se encoja al vaciarse */
}

.tab-content.active { 
   display: block !important; 
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}
/* ========================================================
   MODO OSCURO
   ======================================================== */
/* 1. Cambio de las variables base */
body.dark-mode {
    --background: #121212;
    --card-bg: #1e1e1e;
    --text: #e0e0e0;
    --text-light: #9ca3af;
}

/* 2. Adaptación de tarjetas y modales */
body.dark-mode .dashboard-container,
body.dark-mode .modal-content,
body.dark-mode .custom-datalist {
    background-color: var(--card-bg);
    box-shadow: 0 15px 35px rgba(0,0,0,0.5);
    border: 1px solid #333;
}

/* 3. Adaptación de items, inputs y pestañas */
body.dark-mode .movimiento-item,
body.dark-mode .mini-card,
body.dark-mode .vista-previa-aumento,
body.dark-mode .form-control,
body.dark-mode .tabs-container {
    background-color: #2a2a2a;
    color: var(--text);
    border-color: #444;
}

body.dark-mode .tab-btn.active {
    background-color: #1e1e1e;
    color: var(--primary);
}

body.dark-mode select.select-historico {
    color: var(--text);
}

/* 4. Suavizar los colores de los inputs de montos */
body.dark-mode .bg-gasto { background-color: #3a1c1c !important; border-color: #e74c3c !important; color: white; }
body.dark-mode .bg-ingreso { background-color: #1a3324 !important; border-color: #27ae60 !important; color: white; }

/* 5. Estilo del botón Luna/Sol */
.btn-theme {
    background: none;
    border: none;
    font-size: 1.3rem;
    color: var(--text-light);
    cursor: pointer;
    transition: transform 0.3s, color 0.3s;
}
.btn-theme:hover { transform: scale(1.1); }
body.dark-mode .btn-theme { color: #f1c40f; /* Amarillo tipo Sol */ }

/* ========================================================
   SWITCH TIPO iOS PARA MODO OSCURO
   ======================================================== */
.ios-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}

/* Ocultamos el checkbox real */
.ios-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

/* El fondo del switch */
.ios-switch .slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #cbd5e1; /* Gris clarito por defecto */
    transition: .4s;
    border-radius: 34px;
}

/* El círculo blanco interior */
.ios-switch .slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* Cuando está activado (Modo Oscuro) */
.ios-switch input:checked + .slider {
    background-color: var(--primary); /* Se pone de tu verde principal */
}

/* Mueve el círculo a la derecha */
.ios-switch input:checked + .slider:before {
    transform: translateX(22px);
}

/* Ajuste del fondo cuando la página ya está oscura pero lo querés apagar */
body.dark-mode .ios-switch .slider {
    background-color: #555;
}
body.dark-mode .ios-switch input:checked + .slider {
    background-color: var(--primary);
}
/* ========================================================
   CORRECCIONES VISUALES PARA MODO OSCURO
   ======================================================== */

/* Apagar el verde brillante de la tarjeta de Sueldo */
body.dark-mode .indicador-destacado.sueldo-base {
    background-color: #16291d; /* Un verde súper oscuro y elegante */
    border: 1px solid #1e4d2e;
}

/* Cambiar el texto de esa tarjeta para que se lea bien */
body.dark-mode .indicador-destacado.sueldo-base h3 {
    color: #2ecc71; /* El monto en verde vibrante */
}
body.dark-mode .indicador-destacado.sueldo-base p,
body.dark-mode .leyenda-aumento {
    color: #8fbc8f; /* Texto secundario en verde agua apagado */
}

/* Arreglar los botones redonditos (el avioncito de mail y el gráfico de aumento) */
body.dark-mode .btn-icon-small {
    background-color: #1e4d2e !important;
    color: #2ecc71 !important;
}

/* Oscurecer las mini-cards (Gastos y Saldo) */
body.dark-mode .mini-card {
    background-color: #1e1e1e;
    border-color: #333;
}
body.dark-mode .mini-card.disponible {
    background: linear-gradient(135deg, #1c2833 0%, #151e27 100%);
    border: 1px solid #2c3e50;
}
body.dark-mode .tabs-container {
    background: #121212;
    border-color: #333;
}
/* ========================================================
   FIX PARA EL SELECTOR DE PERIODOS (MODO OSCURO)
   ======================================================== */
body.dark-mode select.select-historico,
body.dark-mode select.badge-periodo {
    background-color: #1e1e1e; /* Fondo oscuro para el botón */
    color: #e0e0e0; /* Texto claro */
    border: 1px solid #444;
}

/* Forzamos el fondo de la lista que se despliega */
body.dark-mode select.select-historico option,
body.dark-mode select.badge-periodo option {
    background-color: #2a2a2a; /* Un gris un poco más claro para diferenciar */
    color: #e0e0e0;
}
/* ========================================================
   ESTILOS DE METAS Y BARRAS DE PROGRESO
   ======================================================== */
.meta-card {
    background: var(--card-bg);
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    transition: 0.3s;
}
body.dark-mode .meta-card { 
    border-color: #333; 
    background-color: #2a2a2a; 
}

.meta-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.meta-titulo { 
    font-weight: 700; 
    color: var(--text); 
    font-size: 1.1rem;
}
.meta-porcentaje { 
    font-weight: 700; 
    color: var(--primary); 
    background: rgba(46, 204, 113, 0.1);
    padding: 4px 8px;
    border-radius: 8px;
}

.progress-bar-bg {
    width: 100%;
    height: 14px;
    background-color: #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
}
body.dark-mode .progress-bar-bg { background-color: #444; }

.progress-bar-fill {
    height: 100%;
    background-color: var(--primary);
    border-radius: 10px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.meta-montos {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-light);
    font-weight: 500;
}
/* ========================================================
   ESTILOS DE LOS BOTONES DE CABECERA (INFO Y SALIR)
   ======================================================== */
.header-actions {
    display: flex;
    align-items: center;
    gap: 15px; /* Espacio entre los botones */
}

/* Opcional: una línea vertical sutil para separar el switch de los botones */
.header-divisor {
    width: 1px;
    height: 24px;
    background-color: #e2e8f0;
    margin: 0 5px;
}
body.dark-mode .header-divisor {
    background-color: #444;
}

/* Estilo base para los iconos clicables */
.action-icon {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%; /* Por si le queremos poner un fondito al pasar el mouse */
    transition: all 0.2s ease;
}

/* Botón de Información (Azul) */
.info-icon {
    color: #3498db; /* Azul lindo */
}
.info-icon:hover {
    color: #2980b9; /* Azul un poco más oscuro al pasar el mouse */
    background-color: rgba(52, 152, 219, 0.1); /* Fondito azul muy transparente */
}

/* Botón de Cerrar Sesión (Gris, pasa a rojo al hacer hover) */
.logout-icon {
    color: var(--text-light); /* Gris por defecto */
}
.logout-icon:hover {
    color: #e74c3c; /* Rojo al pasar el mouse para indicar "Peligro/Salir" */
    background-color: rgba(231, 76, 60, 0.1);
}

/* Ajustes para Modo Oscuro */
body.dark-mode .info-icon {
    color: #5dade2; /* Un azul un poco más claro para que resalte en oscuro */
}
body.dark-mode .logout-icon {
    color: #a0aec0;
}
body.dark-mode .logout-icon:hover {
    color: #ff6b6b;
}