/* ===== ESTILO BASE ===== */
body {
    font-family: "Poppins", sans-serif;
    background-color: #0b132b;
    color: #fff;
    margin: 0;
    padding: 0;
    height: 100vh;
    width: 100vw;
    overflow: hidden !important; /* BLOQUEO TOTAL DE SCROLL */
    position: relative;
}

/* --- GESTIÓN DE VISTAS --- */
.vista-principal {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    /* CORRECCIÓN: Quitamos scroll y padding excesivo */
    overflow: hidden; 
    padding-bottom: 0; 
    box-sizing: border-box;
    display: flex; /* Para controlar el hijo */
    flex-direction: column;
    
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    
    /* NIVEL 1: Fondo */
    z-index: 1;
}

.vista-principal.activa {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    /* NIVEL 5: La capa activa */
    z-index: 5;
}

#vista-inicio {
    /* Permitir hacer scroll cuando hay muchas tarjetas */
    overflow-y: auto !important; 
    
    display: flex;
    flex-direction: column; /* Apila las cosas una sobre otra */
    align-items: center; /* Centra las tarjetas horizontalmente */
    
    /* ESTA ES LA MAGIA CONTRA EL EMPALME */
    justify-content: flex-start; /* Empieza desde arriba, no las centra a la fuerza */
    gap: 30px; /* Separación garantizada y uniforme entre cada módulo */
    
    /* Espacio arriba y abajo para que respiren las tarjetas y el menú flotante no las tape */
    padding-top: 30px; 
    padding-bottom: 120px; 
    
    width: 100%;
    height: 100%;
}

/* Y para asegurar que cada "wrapper" o contenedor no colapse: */
#kg-wrapper, #deuda-wrapper, #gastos-container {
    width: 100%;
    display: flex;
    justify-content: center; /* Centra el contenido interior */
    flex-shrink: 0; /* EVITA QUE LA TARJETA SE APLASTE A LA FUERZA */
}

#contenido-modulo {
    width: 100%;
    
    /* CAMBIO: Quitamos el límite de ancho para que ocupe toda la pantalla */
    max-width: 100% !important; 
    
    /* CAMBIO: Quitamos el "auto" para que no se centre, sino que se pegue a la izq */
    margin: 0 !important; 
    
    /* Aseguramos cero relleno */
    padding: 0 !important;

    height: 100%; 
    display: flex;
    flex-direction: column;
    overflow: hidden; 
}

/* --- DOCK DE NAVEGACIÓN --- */
.dock-nav {
    position: fixed;
    bottom: 20px;
    left: 20px;
    
    background: rgba(15, 15, 30, 0.9) !important;
    backdrop-filter: blur(10px);
    padding: 10px 15px;
    border-radius: 10px !important;
    border: none !important;
    
    display: flex;
    gap: 10px;
    
    box-shadow: 0 0 15px rgba(0, 200, 255, 0.2) !important;
    
    z-index: 8 !important;
    pointer-events: auto !important;
}

.nav-btn {
    background: transparent;
    border: none;
    color: #888;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 10px;
    transition: all 0.3s ease;
    min-width: 60px;
}

.nav-btn .icono {
    font-size: 1.4rem;
    margin-bottom: 2px;
    transition: transform 0.2s;
}

.nav-btn .label {
    font-size: 0.7rem;
    font-weight: 600;
}

/* Hover */
.nav-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.nav-btn:hover .icono {
    transform: translateY(-3px);
}

/* Activo */
.nav-btn.activo {
    background: transparent !important; 
    color: #00e0ff !important; 
    border: 1px solid #00e0ff !important; 
    box-shadow: 0 0 10px rgba(0, 224, 255, 0.2) !important; 
}

.nav-btn.activo .label {
    font-weight: 800;
}

/* RESPONSIVE */
@media (max-width: 450px) {
    .dock-nav {
        left: 50%;
        transform: translateX(-50%);
        bottom: 15px;
        width: 90%;
        justify-content: space-around;
    }
}

/* =========================================
   REGLAS ANTI-EMPALME (FORZAR COLUMNA DEFINITIVO)
   ========================================= */
#vista-inicio {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 5px !important; /* ANTES ERA 40px, AHORA ES 15px */
    overflow-y: auto !important;
    height: 100% !important;
    padding-top: 5px !important; /* Un poco menos de espacio arriba */
    padding-bottom: 150px !important; 
}

/* Los contenedores invisibles de cada módulo */
#kg-wrapper, #deuda-wrapper, #gastos-container {
    position: relative !important;
    width: 100% !important;
    display: flex !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    height: auto !important;
}

/* LA BALA DE PLATA: Obliga a todas las tarjetas internas a respetar el espacio */
#kg-wrapper > *, #deuda-wrapper > *, #gastos-container > * {
    position: relative !important; 
    top: auto !important;
    bottom: auto !important;
    left: auto !important;
    right: auto !important;
    transform: none !important; /* Evita que salgan volando por márgenes negativos */
    margin: 0 auto !important;
    height: auto !important;
}