body {
    margin:0;
    background:#0c0f14;
    font-family:system-ui;
    color:white;
}

/* HEADER */
/* HEADER — FINTECH PREMIUM */
.header-fintech {
    text-align:center;
    padding:14px 10px;                /* 🔥 Más delgado */
    background:#12161d;
    border-bottom:1px solid #222;     /* Línea más fina */
    backdrop-filter: blur(4px);       /* Efecto vidrio suave */
}

.header-fintech h1 {
    margin:0;
    font-size:30px;                   /* 🔥 Más elegante */
    color:#ff36c9;
    font-weight:700;
    letter-spacing:0.5px;
}

.header-fintech h2 {
    margin-top:4px;
    font-size:15px;                   /* 🔥 Más compacto */
    color:#9aa0ae;
}


.container {
    width:92%;
    max-width:480px;
    margin:auto;
    margin-top: -10px;   /* 🔥 Sube todo el bloque hacia el encabezado */
}


/* FORMULARIO */
.card-form {
    background: rgba(255, 255, 255, 0.06);   /* Efecto vidrio */
    backdrop-filter: blur(12px);
    padding:22px;
    border-radius:18px;
    margin-top:12px;                         /* 🔥 Mucho más cerca del header */
    border:1px solid rgba(255,255,255,0.08);
    box-shadow: 0 8px 16px rgba(0,0,0,0.35); /* efecto flotante */
}



.titulo-form {
    text-align:center;
    color:cyan;
    font-size:26px;
    margin-top: 0px;     /* 🔥 Ahora pega al bloque hacia arriba */
    margin-bottom:16px;
}


label {
    color:white;
    margin-top:12px;
    display:block;
}

/* INPUT WRAPPER */
.input-wrapper {
    display:flex;
    align-items:center;
    background:#0f1218;
    border:1px solid #333;
    padding:10px 14px;
    border-radius:10px;
    margin-top:6px;
}

.input-wrapper span {
    margin-right:6px;
    font-size:22px;
    color:#00c46a;
}

input {
    width:100%;
    border:none;
    background:transparent;
    color:white;
    font-size:18px;
    outline:none;
}

.btn {
    width:100%;
    margin-top:18px;
    padding:14px;
    border-radius:12px;
    font-size:20px;
    font-weight:bold;
    cursor:pointer;
    border:none;
}

.add { background:#00c46a; color:#000; }
.save { background:#4da9ff; color:#fff; }

/* LISTA */
.subtitulo {
    text-align:center;
    color:cyan;
    background:#2a2f3a;
    padding:10px;
    border-radius:10px;
    font-size:24px;
}

.card-compra {
    background:#151a22;
    border:1px solid #333;
    padding:18px;
    border-radius:14px;
    margin-top:14px;
}

/* INFO LÍMITE */
.info-limite {
    text-align:center;
    color:#bbb;
    margin-top:10px;
}

/* ALERTA RIESGO */
.alerta-riesgo {
    text-align:center;
    font-size:18px;
    padding:12px;
    margin-top:14px;
    border-radius:12px;
    font-weight:bold;
}

.alerta-verde { background:#00c46a33; border:1px solid #00c46a; color:#00c46a; }
.alerta-amarilla { background:#f2c74433; border:1px solid #f2c744; color:#f2c744; }
.alerta-roja { background:#ff3b3b33; border:1px solid #ff3b3b; color:#ff3b3b; }

/* RECOMENDACIÓN */
.recomendacion {
    text-align:center;
    margin-top:10px;
    color:white;
    font-size:16px;
}

/* GRAFICO */
.grafico-container {
    width: 100%;
    height: 350px;   /* 🔥 Altura obligatoria para que Chart.js pueda renderizar */
    margin-top: 20px;
    position: relative;
}


/* ADVERTENCIA FINTECH PREMIUM */
.recomendacion {
    margin-top: 16px;
    padding: 18px;
    border-radius: 18px;
    font-size: 18px;
    text-align: center;

    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(8px);

    border: 2px solid transparent;
    box-shadow: none;

    animation: fadeIn 0.4s ease;

    /* 🔥 Esto asegura que el cuadro NO tape el gráfico */
    width: 100%;
}


/* Glow dinámico */
.reco-verde {
    border-color: #00c46a;
    box-shadow: 0 0 12px #00c46a55;
}

.reco-amarilla {
    border-color: #f2c744;
    box-shadow: 0 0 12px #f2c74455;
}

.reco-roja {
    border-color: #ff3b3b;
    box-shadow: 0 0 12px #ff3b3b66;
}

/* Animación */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ================================
   HEADER MÁS FINO — SOLO EN MÓVIL
   ================================ */
@media (max-width: 600px) {

    .header-fintech {
        padding: 10px 8px;       /* 🔥 más fino en vertical */
    }

    .header-fintech h1 {
        font-size: 26px;         /* más compacto */
    }

    .header-fintech h2 {
        font-size: 13px; 
        margin-top: 2px;
    }
}

/* =============================
   FIX FINTECH — MÓVIL DESAJUSTADO
   ============================= */
@media (max-width: 600px) {

    /* Fuerza que todo ocupe el 100% del ancho disponible */
    .container, 
    .card-form,
    .titulo-box,
    #listaCompras,
    .card-compra,
    .grafico-container {
        width: 100% !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    /* Los inputs no deben achicarse */
    .input-wrapper {
        width: 100% !important;
    }

    input {
        width: 100% !important;
    }

    /* El bloque "Compras registradas" y "Gastos a 12 meses" debe ser full width */
    .subtitulo {
        width: 100% !important;
        max-width: 100% !important;
        text-align: center;
    }
}

/* =====================================
   FIX DEFINITIVO DE DESBORDE EN MÓVIL
   ===================================== */
html, body {
    width: 100%;
    overflow-x: hidden !important;
}

/* Todo dentro del contenedor vuelve al flujo normal */
.container {
    width: 100% !important;
    max-width: 480px;
    margin: 0 auto;
    padding: 0;
}

/* Evita que cualquier cosa sobrepase ancho */
* {
    box-sizing: border-box;
}

/* Elimina cualquier expansión lateral de inputs o wrappers */
.input-wrapper,
.card-form,
.card-compra,
.titulo-box,
#listaCompras {
    max-width: 100% !important;
    width: 100% !important;
    overflow-x: hidden !important;
}

/* Flex containers nunca deben empujar hacia afuera */
.input-wrapper {
    display: flex;
    flex-wrap: nowrap;
}

/* Evita que el span $ agrande todo */
.input-wrapper span {
    flex-shrink: 0;
}

/* Garantiza que los inputs nunca fuerzan overflow */
input {
    width: 100%;
    min-width: 0 !important;
}

/* Elimina cualquier margen que empuje hacia la derecha */
.card-form,
.card-compra {
    margin-left: 0 !important;
    margin-right: 0 !important;
}
