

:root {
    --danger-bg: var(--danger-soft);
}

body.page-auth {
    margin: 0;
    min-height: 100vh;
    
    min-height: 100svh;
    display: flex;
    
    flex-direction: column;
    background: var(--canvas);
    color: var(--ink);
    font-family: var(--font);
    font-size: var(--fs-md);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.page-auth :focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 3px;
}
.page-auth :focus:not(:focus-visible) { outline: none; }



.auth-shell {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    overflow: hidden;
}


.auth-ambient {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(to right, rgba(11,15,25,.055) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(11,15,25,.055) 1px, transparent 1px);
    background-size: 56px 56px;
    -webkit-mask-image: radial-gradient(ellipse 70% 62% at 50% 38%, #000 0%, transparent 80%);
    mask-image: radial-gradient(ellipse 70% 62% at 50% 38%, #000 0%, transparent 80%);
}

.auth-ambient::after {
    content: "";
    position: absolute;
    top: -80px; left: 50%;
    width: 680px; height: 460px;
    transform: translateX(-50%);
    background: radial-gradient(closest-side, rgba(0,117,255,.12), transparent 72%);
}

.auth-card {
    position: relative;
    width: 100%;
    max-width: 440px;
    padding: 40px 36px 32px;
    border: 1px solid var(--line);
    border-radius: var(--r-xl);
    background: var(--surface);
    box-shadow: var(--shadow-lg);
}

.auth-logo {
    display: inline-block;
    
    align-self: flex-start;
    margin-bottom: 22px;
    line-height: 0;
}
.auth-logo img { width: 44px; height: auto; display: block; }

.auth-card h1 {
    margin: 0 0 6px;
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -.03em;
    line-height: 1.15;
    
    overflow-wrap: break-word;
}

.auth-sub {
    margin: 0 0 28px;
    color: var(--ink-3);
    font-size: var(--fs-md);
}



.auth-alert {
    margin: 0 0 20px;
    padding: 12px 16px;
    border: 1px solid var(--danger-line);
    border-radius: var(--r-md);
    background: var(--danger-bg);
    color: var(--danger);
    font-size: var(--fs-base);
}
.auth-alert p { margin: 0; }
.auth-alert p + p { margin-top: 6px; }


.auth-alert.es-ok {
    border-color: var(--ok-line);
    background: var(--ok-soft);
    color: #0f6a48;
}



.auth-fuerza {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.auth-fuerza__barra {
    flex: 1;
    height: 4px;
    border-radius: var(--r-pill);
    background: var(--surface-3);
    overflow: hidden;
}

.auth-fuerza__barra > span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: var(--r-pill);
    background: var(--ink-4);
    transition: width var(--dur) var(--ease), background-color var(--dur) var(--ease);
}


.auth-fuerza__barra > span[data-nivel="1"] { background: var(--danger); }
.auth-fuerza__barra > span[data-nivel="2"] { background: #d98324; }
.auth-fuerza__barra > span[data-nivel="3"] { background: #4a9d5f; }
.auth-fuerza__barra > span[data-nivel="4"] { background: var(--ok); }

.auth-fuerza__texto {
    flex-shrink: 0;
    min-width: 12ch;
    text-align: right;
    font-size: var(--fs-xs);
    font-weight: 500;
    
    color: var(--ink-3);
}

@media (max-width: 400px) {
    
    .auth-fuerza { flex-direction: column; align-items: stretch; gap: 6px; }
    .auth-fuerza__barra { width: 100%; }
    .auth-fuerza__texto { text-align: left; min-width: 0; }
}



.campo { margin-bottom: 18px; }

.campo label {
    display: block;
    margin-bottom: 7px;
    font-size: var(--fs-base);
    font-weight: 600;
    color: var(--ink-2);
    letter-spacing: -.005em;
}

.campo input[type="text"],
.campo input[type="email"],
.campo input[type="password"] {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    background: var(--surface);
    color: var(--ink);
    font-family: var(--font);
    
    font-size: var(--fs-md);
    outline: none;
    transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.campo input::placeholder { color: var(--ink-4); }

.campo input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 4px rgba(0,117,255,.13);
}

.campo.tiene-error input { border-color: var(--danger-line); }
.campo.tiene-error input:focus { box-shadow: 0 0 0 4px rgba(180,35,24,.10); }

.campo-ayuda,
.campo-error {
    margin: 7px 0 0;
    font-size: var(--fs-sm);
    line-height: 1.45;
}

.campo-ayuda { color: var(--ink-3); }
.campo-error { color: var(--danger); font-weight: 500; }


.campo-url {
    display: flex;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    background: var(--surface);
    transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.campo-url:focus-within {
    border-color: var(--brand);
    box-shadow: 0 0 0 4px rgba(0,117,255,.13);
}
.campo.tiene-error .campo-url { border-color: var(--danger-line); }


.campo-url-base {
    flex: none;
    
    padding: 0 0 0 14px;
    color: var(--ink-3);
    font-size: var(--fs-md);
    font-weight: 500;
    user-select: none;
}

.campo-url input {
    flex: 1;
    min-width: 0;
    padding-left: 1px !important;
    border: 0 !important;
    box-shadow: none !important;
    font-weight: 600;
}


.campo-estado {
    margin: 7px 0 0;
    font-size: var(--fs-sm);
    font-weight: 500;
    min-height: 18px;
}
.campo-estado[data-estado="libre"]   { color: #067647; }
.campo-estado[data-estado="cogido"]  { color: var(--danger); }

.campo-estado[data-estado="mirando"] { color: var(--ink-3); font-weight: 400; }


.campo-password { position: relative; }
.campo-password input { padding-right: 62px; }

.ver-password {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    padding: 7px 11px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--ink-3);
    font-family: var(--font);
    font-size: var(--fs-sm);
    font-weight: 600;
    cursor: pointer;
    transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.ver-password:hover { background: var(--surface-2); color: var(--ink); }


@media (pointer: coarse) {
    .ver-password { min-height: 40px; display: inline-flex; align-items: center; }

    .auth-logo { display: inline-flex; align-items: center; min-height: 40px; }

    
    .auth-extra a { display: inline-flex; align-items: center; min-height: 40px; }
}


.auth-trampa {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}



.auth-submit {
    width: 100%;
    margin-top: 6px;
    padding: 14px 24px;
    border: 0;
    border-radius: var(--r-pill);
    
    background: var(--gradient);
    color: #fff;
    font-family: var(--font);
    font-size: var(--fs-md);
    font-weight: 600;
    letter-spacing: -.01em;
    cursor: pointer;
    box-shadow: var(--shadow-brand);
    transition: transform .18s var(--ease), box-shadow var(--dur) var(--ease);
}

.auth-submit:hover {
    transform: translateY(-1px);
    
    box-shadow: var(--shadow-brand-hover);
}
.auth-submit:active {
    transform: translateY(0) scale(.99);
    box-shadow: var(--shadow-brand-active);
}
.auth-submit[disabled] { opacity: .6; cursor: default; transform: none; }

.auth-legal {
    margin: 12px 4px 0;
    text-align: center;
    color: var(--ink-3);
    font-size: var(--fs-xs);
    line-height: 1.55;
}
.auth-legal span { display: block; margin-top: 3px; }
.auth-legal a {
    color: var(--brand-text);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}





.auth-alt {
    margin: 26px 0 0;
    padding-top: 22px;
    border-top: 1px solid var(--line);
    text-align: center;
    font-size: var(--fs-base);
    line-height: 1.6;
    color: var(--ink-3);
}

.auth-extra {
    margin: 10px 0 0;
    text-align: center;
    font-size: var(--fs-sm);
    line-height: 1.6;
    
    color: var(--ink-3);
}

.auth-alt a,
.auth-extra a {
    color: var(--brand-text);
    font-weight: 600;
    text-decoration: none;
    
    padding: 2px 1px;
    border-radius: 4px;
}
.auth-alt a:hover,
.auth-extra a:hover { text-decoration: underline; text-underline-offset: 3px; }


.auth-extra a {
    color: var(--ink-3);
    font-weight: 500;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    text-decoration-color: var(--ink-4);
}
.auth-extra a:hover { color: var(--brand-text); text-decoration-color: currentColor; }



@media (max-width: 520px) {
    .auth-shell { padding: 0; }

    
    .auth-card {
        max-width: none;
        min-height: 100vh;
        min-height: 100svh;
        padding: 32px 22px calc(32px + env(safe-area-inset-bottom));
        border: 0;
        border-radius: 0;
        box-shadow: none;
        background: transparent;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    .auth-card h1 { font-size: 1.625rem; }
    .auth-sub { margin-bottom: 24px; }
}

@media (prefers-reduced-motion: reduce) {
    .auth-submit,
    .campo input,
    .campo-url { transition: none; }
    .auth-submit:hover { transform: none; }
}
