:root{
    --ink:#1b1b1b;
    --muted:#666;
    --line:#666;
    --blue:#0067b8;
    --blue-dark:#005da6;
    --red:#d13438;
    --card:#ffffff;
}

*{margin:0;padding:0;box-sizing:border-box;-webkit-tap-highlight-color:transparent;}

html,body{
    min-height:100%;
    overscroll-behavior:none;
}

body{
    font-family:'Manrope','Segoe UI',-apple-system,BlinkMacSystemFont,Roboto,sans-serif;
    color:var(--ink);
    background:#f7f9fc;
    position:relative;
    min-height:100vh;
    min-height:100dvh;
}

/* Fondo suave tipo wallpaper */
body::before{
    content:'';
    position:fixed;
    inset:-12%;
    z-index:-1;
    background:
        radial-gradient(42% 38% at 18% 22%, rgba(206,222,252,.85), rgba(206,222,252,0) 72%),
        radial-gradient(38% 34% at 82% 30%, rgba(255,226,240,.8), rgba(255,226,240,0) 72%),
        radial-gradient(46% 42% at 70% 88%, rgba(219,236,255,.9), rgba(219,236,255,0) 70%),
        radial-gradient(40% 36% at 12% 82%, rgba(224,243,255,.85), rgba(224,243,255,0) 70%),
        linear-gradient(180deg,#f4f7fd 0%,#fbfaff 55%,#f3f8ff 100%);
    filter:blur(6px);
}

/* ---------------- Loader ---------------- */
#loader{
    position:fixed;
    top:0;left:0;right:0;
    height:3px;
    display:none;
    overflow:hidden;
    background:#d9e7f4;
    z-index:200;
}
#loader::after{
    content:'';
    display:block;
    width:35%;
    height:100%;
    background:var(--blue);
    animation:slide 1.05s ease-in-out infinite;
}
@keyframes slide{
    0%{transform:translateX(-110%);}
    100%{transform:translateX(330%);}
}

/* ---------------- Estructura ---------------- */
.stage{
    min-height:100vh;
    min-height:100dvh;
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    padding:48px 20px 80px;
}

.stack{
    width:100%;
    max-width:440px;
    display:flex;
    flex-direction:column;
}

/* ---------------- Tarjeta ---------------- */
.card{
    width:100%;
    background:var(--card);
    padding:44px 44px 34px;
    box-shadow:0 2px 6px rgba(0,0,0,.13);
    border-radius:2px;
    animation:appear .18s ease;
}

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

.card[hidden]{display:none;}

/* ---------------- Logo ---------------- */
.logo{
    display:flex;
    align-items:center;
    gap:9px;
    margin-bottom:20px;
}
.logo .ms{width:21px;height:21px;flex-shrink:0;}
.logo span{
    font-size:19px;
    font-weight:600;
    letter-spacing:-.4px;
    color:#5e5e5e;
}

h1{
    font-size:24px;
    font-weight:600;
    letter-spacing:-.3px;
    line-height:1.25;
    margin-bottom:14px;
}

/* ---------------- Campos ---------------- */
.field{
    position:relative;
    display:flex;
    align-items:center;
    border-bottom:1px solid var(--line);
    padding:7px 0 6px;
    margin-bottom:4px;
    transition:border-color .12s ease, box-shadow .12s ease;
}

.field:focus-within{
    border-bottom-color:var(--blue);
    box-shadow:0 1px 0 0 var(--blue);
}

.field.has-error{border-bottom-color:var(--red);box-shadow:0 1px 0 0 var(--red);}

.field input{
    width:100%;
    min-width:0;
    border:none;
    outline:none;
    background:transparent;
    font-family:inherit;
    font-size:15px;
    font-weight:400;
    color:var(--ink);
    padding:3px 0;
}

.field input::placeholder{color:#7a7a7a;opacity:1;}

.field.with-eye input{padding-right:38px;}

/* ---------------- Ojo ---------------- */
.eye{
    position:absolute;
    right:0;
    top:50%;
    transform:translateY(-50%);
    width:32px;
    height:32px;
    display:flex;
    align-items:center;
    justify-content:center;
    background:transparent;
    border:none;
    cursor:pointer;
    opacity:.65;
    transition:opacity .15s ease;
}
.eye:hover{opacity:1;}
.eye svg{width:20px;height:20px;fill:#3d3d3d;}

.eye .slash{
    position:absolute;
    width:22px;
    height:1.4px;
    background:#3d3d3d;
    transform:rotate(-45deg);
    border-radius:2px;
    transition:opacity .15s ease;
}
.eye.on .slash{opacity:0;}

/* ---------------- Enlaces ---------------- */
.link{
    display:block;
    margin-top:14px;
    font-size:13px;
    font-weight:400;
    color:var(--blue);
    text-decoration:none;
    line-height:1.5;
}
.link:hover{text-decoration:underline;}
.link-strong{font-weight:400;}

/* ---------------- Chip correo ---------------- */
.chip{
    display:inline-flex;
    align-items:center;
    gap:7px;
    max-width:100%;
    margin-bottom:12px;
    padding:3px 0;
    background:transparent;
    border:none;
    font-family:inherit;
    font-size:13px;
    color:var(--ink);
    cursor:pointer;
}
.chip svg{width:15px;height:15px;fill:#4a4a4a;flex-shrink:0;}
.chip span{
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}
.chip:hover span{text-decoration:underline;}

/* ---------------- Error ---------------- */
.err{
    display:none;
    margin-top:12px;
    font-size:13px;
    font-weight:400;
    line-height:1.45;
    color:var(--red);
}
.err.show{display:block;}

/* ---------------- Botones ---------------- */
.actions{
    display:flex;
    justify-content:flex-end;
    gap:8px;
    margin-top:26px;
}

.btn{
    min-width:108px;
    height:32px;
    padding:0 16px;
    border-radius:2px;
    border:1px solid transparent;
    font-family:inherit;
    font-size:15px;
    font-weight:400;
    cursor:pointer;
    transition:background .15s ease, opacity .15s ease, transform .1s ease;
}
.btn:active{transform:translateY(1px);}

.btn-ghost{
    background:#e8e8e8;
    border-color:#d3d3d3;
    color:var(--ink);
}
.btn-ghost:hover{background:#dedede;}

.btn-primary{
    background:var(--blue);
    border-color:var(--blue);
    color:#fff;
}
.btn-primary:hover{background:var(--blue-dark);border-color:var(--blue-dark);}

.btn-primary:disabled{
    opacity:.55;
    cursor:default;
    transform:none;
}

/* ---------------- Opciones ---------------- */
.opt-card{
    width:100%;
    margin-top:10px;
    padding:15px 20px;
    display:flex;
    align-items:center;
    gap:12px;
    background:var(--card);
    border:none;
    border-radius:2px;
    box-shadow:0 2px 6px rgba(0,0,0,.13);
    font-family:inherit;
    font-size:15px;
    color:var(--ink);
    text-align:left;
    cursor:pointer;
    transition:background .15s ease;
}
.opt-card:hover{background:#fafafa;}
.opt-card svg{width:20px;height:20px;fill:#3d3d3d;flex-shrink:0;}

/* ---------------- Legal ---------------- */
.legal{
    position:fixed;
    right:16px;
    bottom:12px;
    display:flex;
    align-items:center;
    gap:22px;
    font-size:12px;
}
.legal a{
    color:#616161;
    text-decoration:none;
}
.legal a:hover{text-decoration:underline;}
.dots{
    background:transparent;
    border:none;
    color:#616161;
    font-size:14px;
    letter-spacing:1px;
    cursor:pointer;
    padding:0;
}

/* ---------------- Responsive ---------------- */
@media (max-width:560px){

    /* Fondo plano blanco, sin wallpaper */
    body{background:#fff;}
    body::before{display:none;}

    /* Pantalla completa: contenido arriba, footer abajo */
    .stage{
        justify-content:flex-start;
        align-items:stretch;
        padding:0;
        min-height:100vh;
        min-height:100dvh;
    }

    .stack{
        max-width:none;
        width:100%;
        flex:0 0 auto;
    }

    /* Tarjeta sin sombra, sin bordes, a sangre */
    .card{
        padding:26px 20px 30px;
        box-shadow:none;
        border-radius:0;
        background:#fff;
    }

    .logo{margin-bottom:20px;}

    h1{
        font-size:26px;
        letter-spacing:-.4px;
        margin-bottom:16px;
    }

    .field{padding:9px 0 7px;}
    .field input{font-size:16px;}

    .link{margin-top:16px;}

    /* Solo "Siguiente", alineado a la derecha, ancho fijo */
    .actions{
        justify-content:flex-end;
        gap:8px;
        margin-top:30px;
    }
    .btn{
        flex:0 0 auto;
        min-width:108px;
        height:33px;
    }

    /* En el paso del correo no hay "Atrás" */
    #paso1 .btn-ghost{display:none;}

    /* Fila de opciones a sangre, con líneas arriba y abajo */
    .opt-card{
        margin-top:0;
        padding:17px 20px;
        border-top:1px solid #e5e5e5;
        border-bottom:1px solid #e5e5e5;
        border-radius:0;
        box-shadow:none;
        background:#fff;
        font-size:16px;
        gap:14px;
    }
    .opt-card:hover{background:#fff;}

    /* Footer al pie de la pantalla */
    .legal{
        position:static;
        margin:auto 0 0;
        padding:18px 20px 24px;
        justify-content:flex-start;
        gap:22px;
        background:#fff;
        font-size:12px;
    }
}

@media (max-height:620px){
    .stage{padding-top:6vh;}
    .card{padding:28px 24px 22px;}
}

@media (prefers-reduced-motion:reduce){
    .card{animation:none;}
}