/* ═══════════════════════════════════════════════════════════════════════
   Uved3 — Shell de autenticación (/login, /register, /forgot-password,
   /magic-link). Tarjeta partida: rail + paisaje + formulario.

   Autocontenido: define sus propios tokens (mismos valores que el portal
   público) para no depender de Bootstrap. Alcance: body.auth-app.
   ═══════════════════════════════════════════════════════════════════════ */

.auth-app {
    color-scheme: light;
    accent-color: #4f46e5;

    --ink: #1d1d1f;
    --ink-soft: #424245;
    --muted: #6e6e73;
    --bg: #f4f3f1;
    --surface: rgba(255, 255, 255, .82);
    --surface-solid: #ffffff;
    --border: rgba(0, 0, 0, .09);
    --hairline: rgba(0, 0, 0, .07);
    --primary: #4f46e5;
    --primary-soft: #eef2ff;
    --gold: #b98a4b;

    --field-bg: color-mix(in srgb, var(--ink) 5%, transparent);
    --field-bg-hover: color-mix(in srgb, var(--ink) 7%, transparent);
    --track: color-mix(in srgb, var(--ink) 12%, transparent);

    --font: var(--font-sf-text, -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif);
    --font-display: var(--font-sf-display, 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
    --mono: var(--font-sf-mono, 'JetBrains Mono', ui-monospace, Menlo, Monaco, monospace);

    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font);
    font-synthesis: none;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: clip;
}

/* Oscuro explícito (theme.js siempre resuelve) + respaldo por sistema. */
html[data-bs-theme="dark"] .auth-app {
    color-scheme: dark;
    --ink: #f5f5f7;
    --ink-soft: #c7c7cc;
    --muted: #98989d;
    --bg: #0f0f11;
    --surface: rgba(38, 38, 41, .78);
    --surface-solid: #1c1c1f;
    --border: rgba(255, 255, 255, .11);
    --hairline: rgba(255, 255, 255, .08);
    --primary: #9a92ff;
    --primary-soft: rgba(99, 91, 255, .16);
    --gold: #d8b076;
    --field-bg: color-mix(in srgb, var(--ink) 7%, transparent);
    --field-bg-hover: color-mix(in srgb, var(--ink) 11%, transparent);
    --track: color-mix(in srgb, var(--ink) 16%, transparent);
}

@media (prefers-color-scheme: dark) {
    html:not([data-bs-theme]) .auth-app {
        color-scheme: dark;
        --ink: #f5f5f7;
        --ink-soft: #c7c7cc;
        --muted: #98989d;
        --bg: #0f0f11;
        --surface: rgba(38, 38, 41, .78);
        --surface-solid: #1c1c1f;
        --border: rgba(255, 255, 255, .11);
        --hairline: rgba(255, 255, 255, .08);
        --primary: #9a92ff;
        --primary-soft: rgba(99, 91, 255, .16);
        --gold: #d8b076;
        --field-bg: color-mix(in srgb, var(--ink) 7%, transparent);
        --field-bg-hover: color-mix(in srgb, var(--ink) 11%, transparent);
        --track: color-mix(in srgb, var(--ink) 16%, transparent);
    }
}

.auth-app *,
.auth-app *::before,
.auth-app *::after { box-sizing: border-box; }

.auth-app ::selection { background: color-mix(in srgb, var(--primary) 24%, transparent); }

.auth-app :focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
}

.auth-app [hidden] { display: none !important; }

.auth-app a { color: var(--primary); }

/* Interruptor de tema (reutiliza theme-toggle.css). */
.auth-app .theme-switch--floating {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 60;
    background: color-mix(in srgb, var(--surface-solid) 70%, transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* ── Página ──────────────────────────────────────────────────────────── */
.auth-page {
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(16px, 3vw, 42px);
    background:
        radial-gradient(900px 620px at 8% -10%, color-mix(in srgb, var(--primary) 11%, transparent), transparent 62%),
        radial-gradient(820px 620px at 100% 110%, color-mix(in srgb, var(--gold) 9%, transparent), transparent 62%),
        var(--bg);
}

.auth-shell {
    width: min(1120px, 100%);
    min-height: 630px;
    display: grid;
    grid-template-columns: 92px minmax(0, 1.02fr) minmax(0, 1fr);
    background: var(--surface-solid);
    border: 1px solid var(--border);
    border-radius: 28px;
    box-shadow:
        0 0 0 1px color-mix(in srgb, var(--border) 50%, transparent),
        0 34px 90px -44px rgba(0, 0, 0, .55);
    overflow: hidden;
    animation: auth-shell-in .62s cubic-bezier(.22, 1, .36, 1) both;
}

.auth-rail { animation: auth-fade-in .5s .08s both; }
.auth-visual { animation: auth-fade-in .62s .05s both; }
.auth-panel { animation: auth-rise-in .56s .14s both; }

.auth-visual-content > * { animation: auth-rise-in .55s both; }
.auth-visual-content > :nth-child(1) { animation-delay: .24s; }
.auth-visual-content > :nth-child(2) { animation-delay: .3s; }
.auth-visual-content > :nth-child(3) { animation-delay: .36s; }
.auth-visual-content > :nth-child(4) { animation-delay: .42s; }

@keyframes auth-shell-in {
    from { opacity: 0; transform: translateY(18px) scale(.988); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes auth-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes auth-rise-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes auth-astro-float {
    0%, 100% { transform: translateY(0) rotate(-1.2deg) scale(1); }
    50% { transform: translateY(-11px) rotate(1deg) scale(1.015); }
}

/* ── Rail de navegación ──────────────────────────────────────────────── */
.auth-rail {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 26px;
    padding: 22px 10px 18px;
    border-right: 1px solid var(--border);
    background:
        linear-gradient(180deg,
            color-mix(in srgb, var(--surface-solid) 97%, var(--primary) 3%),
            color-mix(in srgb, var(--surface-solid) 99%, transparent));
}

.auth-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 13px;
    background: color-mix(in srgb, var(--surface-solid) 85%, var(--ink) 6%);
    border: 1px solid var(--border);
    box-shadow: 0 6px 16px -12px rgba(0, 0, 0, .55);
    overflow: hidden;
    text-decoration: none;
}

.auth-brand img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 5px;
}

.auth-brand-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: var(--primary);
    font-size: 16px;
    font-weight: 800;
}

.auth-nav {
    display: flex;
    flex-direction: column;
    gap: 7px;
    width: 100%;
}

.auth-nav-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 11px 4px 10px;
    border-radius: 13px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 600;
    line-height: 1.15;
    text-align: center;
    text-decoration: none;
    transition: color 150ms ease, background-color 150ms ease, transform 150ms ease;
}

.auth-nav-item svg {
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
}

.auth-nav-item:hover {
    color: var(--ink);
    background: color-mix(in srgb, var(--ink) 6%, transparent);
}

.auth-nav-item.is-active {
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 10%, transparent);
}

.auth-nav-item.is-active::before {
    content: '';
    position: absolute;
    left: -10px;
    top: 50%;
    width: 3px;
    height: 22px;
    border-radius: 0 3px 3px 0;
    background: var(--primary);
    transform: translateY(-50%);
}

.auth-rail-foot {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.auth-rail-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    color: var(--muted);
    text-decoration: none;
    transition: color 150ms ease, background-color 150ms ease;
}

.auth-rail-link:hover {
    color: var(--ink);
    background: color-mix(in srgb, var(--ink) 6%, transparent);
}

.auth-rail-link svg { width: 18px; height: 18px; }

/* ── Paisaje + ilustración flotante ─────────────────────────────────── */
.auth-visual {
    position: relative;
    margin: 16px 0 16px 16px;
    border-radius: 21px;
    overflow: hidden;
    background-color: #050b1c;
    background-image:
        linear-gradient(180deg,
            color-mix(in srgb, var(--primary) 34%, #030816) 0%,
            color-mix(in srgb, var(--primary) 58%, #030816) 100%),
        url('img/auth-paisaje.svg');
    background-size: cover, cover;
    background-position: center, center;
    background-blend-mode: color, normal;
    display: flex;
    align-items: center;
    justify-content: center;
    isolation: isolate;
}

.auth-visual::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
    background:
        radial-gradient(2px 2px at 18% 14%, rgba(255, 255, 255, .5), transparent 60%),
        radial-gradient(1.5px 1.5px at 33% 27%, rgba(255, 255, 255, .32), transparent 60%),
        radial-gradient(1px 1px at 68% 19%, rgba(255, 255, 255, .4), transparent 60%),
        radial-gradient(1.5px 1.5px at 84% 34%, rgba(255, 255, 255, .28), transparent 60%),
        radial-gradient(1px 1px at 76% 8%, rgba(255, 255, 255, .36), transparent 60%),
        radial-gradient(1px 1px at 49% 9%, rgba(255, 255, 255, .26), transparent 60%),
        linear-gradient(180deg, rgba(2, 6, 14, .04) 0%, rgba(2, 6, 14, .16) 38%, rgba(2, 6, 14, .9) 100%),
        linear-gradient(100deg, rgba(2, 6, 14, .3), transparent 56%);
}

.auth-visual::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
    background:
        radial-gradient(48% 40% at 50% 38%, color-mix(in srgb, var(--primary) 26%, transparent), transparent 72%),
        radial-gradient(32% 24% at 50% 70%, color-mix(in srgb, var(--gold) 20%, transparent), transparent 74%);
    pointer-events: none;
}

.auth-astro-wrap {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.auth-astro-wrap::before {
    content: '';
    position: absolute;
    width: 64%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: radial-gradient(circle,
        color-mix(in srgb, var(--primary) 36%, transparent),
        color-mix(in srgb, var(--primary) 12%, transparent) 48%,
        transparent 72%);
    filter: blur(38px);
    pointer-events: none;
}

.auth-astro-art {
    position: relative;
    flex: 0 0 auto;
    width: min(66%, 312px);
    max-width: 66%;
    min-width: 0;
    aspect-ratio: 438 / 548;
    opacity: .5;
    filter: brightness(.74) saturate(.92) drop-shadow(0 26px 34px rgba(0, 0, 0, .4));
    animation: auth-astro-float 13s ease-in-out infinite;
    transform-origin: 50% 58%;
    will-change: transform;
}

.auth-astro-art img,
.auth-astro-art svg {
    position: relative;
    display: block;
    width: 100%;
    max-width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Repinta la silueta con la gama del sistema: la máscara conserva luces y
   sombras, y el modo «color» toma el tono del primario. */
.auth-astro-art::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg,
        var(--primary),
        color-mix(in srgb, var(--primary) 45%, var(--gold)));
    mix-blend-mode: color;
    opacity: .88;
    -webkit-mask: url('img/astro.svg') center / contain no-repeat;
    mask: url('img/astro.svg') center / contain no-repeat;
    pointer-events: none;
}

.auth-visual-content {
    position: relative;
    z-index: 2;
    width: min(350px, 84%);
    margin: 0 auto;
    padding: 30px 26px;
    text-align: center;
    color: #ffffff;
    text-shadow: 0 2px 22px rgba(0, 0, 0, .85), 0 1px 2px rgba(0, 0, 0, .6);
}

/* Scrim localizado: asegura contraste AA del texto sobre la ilustración. */
.auth-visual-content::before {
    content: '';
    position: absolute;
    inset: -26px -18px;
    z-index: -1;
    border-radius: 40%;
    background:
        radial-gradient(60% 58% at 50% 52%, rgba(3, 8, 20, .62), rgba(3, 8, 20, .3) 62%, transparent 78%);
    filter: blur(10px);
    pointer-events: none;
}

.auth-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    color: rgba(255, 255, 255, .62);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .22em;
    text-transform: uppercase;
}

.auth-kicker::before {
    content: '';
    width: 18px;
    height: 1px;
    background: rgba(255, 255, 255, .45);
}

.auth-visual-title {
    margin: 0;
    color: #ffffff;
    font-size: clamp(1.8rem, 2.2vw, 2.35rem);
    font-weight: 650;
    line-height: 1.04;
    letter-spacing: -.045em;
    text-wrap: balance;
}

.auth-visual-text {
    margin: 12px auto 0;
    max-width: 30ch;
    color: rgba(255, 255, 255, .74);
    font-size: 13px;
    line-height: 1.55;
    text-wrap: pretty;
}

.auth-legal {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 26px;
    color: rgba(255, 255, 255, .45);
    font-size: 10px;
}

.auth-legal a {
    color: inherit;
    text-decoration: none;
    transition: color 150ms ease;
}

.auth-legal a:hover { color: rgba(255, 255, 255, .9); }

.auth-legal span { opacity: .5; }

/* ── Panel de formulario ─────────────────────────────────────────────── */
.auth-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    padding: clamp(30px, 4vw, 52px) clamp(26px, 3.6vw, 46px);
}

.auth-switch {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: clamp(22px, 3.5vw, 40px);
    color: var(--muted);
    font-size: 11px;
    line-height: 1.4;
}

.auth-switch a {
    color: var(--primary);
    font-weight: 650;
    text-decoration: none;
}

.auth-switch a:hover { text-decoration: underline; text-underline-offset: 2px; }

.auth-panel-title {
    margin: 0;
    color: var(--ink);
    font-family: var(--font-display);
    font-size: clamp(1.35rem, 1.8vw, 1.7rem);
    font-weight: 650;
    line-height: 1.1;
    letter-spacing: -.04em;
}

.auth-panel-text {
    margin: 7px 0 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.55;
    max-width: 42ch;
}

/* ── Alertas ─────────────────────────────────────────────────────────── */
.auth-alert {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin-top: 16px;
    padding: 11px 13px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: color-mix(in srgb, var(--ink) 4%, transparent);
    color: var(--ink-soft);
    font-size: 12px;
    line-height: 1.5;
}

.auth-alert svg {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    margin-top: 1px;
}

.auth-alert--error {
    border-color: color-mix(in srgb, #dc2626 34%, var(--border));
    background: color-mix(in srgb, #dc2626 9%, transparent);
    color: color-mix(in srgb, #dc2626 72%, var(--ink));
}

.auth-alert--success {
    border-color: color-mix(in srgb, #15803d 30%, var(--border));
    background: color-mix(in srgb, #15803d 9%, transparent);
    color: color-mix(in srgb, #15803d 70%, var(--ink));
}

.auth-alert--warning {
    border-color: color-mix(in srgb, var(--gold) 40%, var(--border));
    background: color-mix(in srgb, var(--gold) 12%, transparent);
    color: color-mix(in srgb, var(--gold) 74%, var(--ink));
}

html[data-bs-theme="dark"] .auth-alert--error { color: #ff9c9c; }
html[data-bs-theme="dark"] .auth-alert--success { color: #8ee2a6; }
html[data-bs-theme="dark"] .auth-alert--warning { color: #efc78f; }

/* ── Formulario ──────────────────────────────────────────────────────── */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 22px;
}

.auth-form--compact {
    gap: 11px;
    margin-top: 18px;
}

.auth-form--compact .auth-input input { height: 44px; }

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.auth-field-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.auth-label-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.auth-field label,
.auth-label-row label {
    color: var(--ink);
    font-size: 11px;
    font-weight: 650;
    letter-spacing: .01em;
}

.auth-label-link {
    color: var(--muted);
    font-size: 10px;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
}

.auth-label-link:hover { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; }

.auth-input {
    position: relative;
    display: flex;
    align-items: center;
}

.auth-input > svg {
    position: absolute;
    left: 14px;
    z-index: 2;
    width: 17px;
    height: 17px;
    color: var(--muted);
    pointer-events: none;
    transition: color 150ms ease;
}

.auth-input input {
    width: 100%;
    height: 46px;
    padding: 0 46px 0 42px;
    border: 1px solid transparent;
    border-radius: 11px;
    background: var(--field-bg);
    color: var(--ink);
    font: inherit;
    font-size: 13px;
    outline: none;
    transition: border-color 150ms ease, background-color 150ms ease, box-shadow 150ms ease;
}

.auth-input input::-webkit-outer-spin-button,
.auth-input input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.auth-input input::placeholder { color: color-mix(in srgb, var(--muted) 82%, transparent); }

.auth-input input:hover { background: var(--field-bg-hover); }

.auth-input input:focus {
    border-color: color-mix(in srgb, var(--primary) 58%, transparent);
    background: var(--surface-solid);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 14%, transparent);
}

.auth-input:focus-within > svg { color: var(--primary); }

.auth-input input[type='password'] { letter-spacing: .08em; }
.auth-input input[type='password']::placeholder { letter-spacing: 0; }

/* Select del formulario (tipo de documento) */
.auth-input select {
    width: 100%;
    height: 46px;
    padding: 0 38px 0 42px;
    border: 1px solid transparent;
    border-radius: 11px;
    background: var(--field-bg);
    color: var(--ink);
    font: inherit;
    font-size: 13px;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    transition: border-color 150ms ease, background-color 150ms ease, box-shadow 150ms ease;
}

.auth-input select:hover { background: var(--field-bg-hover); }

.auth-input select:focus {
    border-color: color-mix(in srgb, var(--primary) 58%, transparent);
    background: var(--surface-solid);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 14%, transparent);
}

.auth-input select:invalid {
    color: color-mix(in srgb, var(--muted) 82%, transparent);
}

.auth-input .auth-select-chevron {
    left: auto;
    right: 13px;
    width: 14px;
    height: 14px;
    color: var(--muted);
    pointer-events: none;
}

.auth-eye {
    position: absolute;
    right: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    transition: color 150ms ease, background-color 150ms ease;
}

.auth-eye:hover {
    color: var(--ink);
    background: color-mix(in srgb, var(--ink) 7%, transparent);
}

.auth-eye svg { width: 17px; height: 17px; }
.auth-eye .auth-eye-off,
.auth-eye.is-visible .auth-eye-on { display: none; }
.auth-eye.is-visible .auth-eye-off { display: block; }

/* Casilla de términos / recordatorio */
.auth-check {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.5;
}

.auth-check input {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    margin: 1px 0 0;
    accent-color: var(--primary);
}

.auth-check a {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
}

.auth-check a:hover { text-decoration: underline; text-underline-offset: 2px; }

/* Enlace con apariencia de texto dentro de párrafos y casillas */
.auth-inline-link {
    border: 0;
    background: none;
    padding: 0;
    font: inherit;
    color: var(--primary);
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}

.auth-inline-link:hover { text-decoration: underline; text-underline-offset: 2px; }

.auth-submit {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    height: 47px;
    margin-top: 4px;
    padding: 0 18px;
    border: 1px solid transparent;
    border-radius: 11px;
    background: var(--primary);
    color: var(--primary-foreground, #ffffff);
    font: inherit;
    font-size: 13px;
    font-weight: 650;
    cursor: pointer;
    overflow: hidden;
    transition: transform 150ms ease, filter 150ms ease, box-shadow 150ms ease;
}

.auth-submit::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(105deg, rgba(255, 255, 255, .16), transparent 42%);
    pointer-events: none;
}

.auth-submit:hover {
    filter: brightness(1.06);
    transform: translateY(-1px);
    box-shadow: 0 14px 28px -18px color-mix(in srgb, var(--primary) 70%, transparent);
}

.auth-submit:active { transform: translateY(0); }
.auth-submit svg { width: 17px; height: 17px; position: relative; z-index: 1; }
.auth-submit span { position: relative; z-index: 1; }

/* En oscuro el primario es claro: el texto del botón debe ser oscuro. */
html[data-bs-theme="dark"] .auth-submit { color: #0b1220; }
@media (prefers-color-scheme: dark) {
    html:not([data-bs-theme]) .auth-submit { color: #0b1220; }
}

/* Enlace secundario bajo el formulario */
.auth-alt {
    margin: 16px 0 0;
    color: var(--muted);
    font-size: 11px;
    text-align: center;
}

.auth-alt a {
    color: var(--primary);
    font-weight: 650;
    text-decoration: none;
}

.auth-alt a:hover { text-decoration: underline; text-underline-offset: 2px; }

.auth-note {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 10.5px;
    line-height: 1.55;
    text-align: center;
}

.auth-terms-note {
    margin: 16px 0 0;
    color: var(--muted);
    font-size: 10.5px;
    line-height: 1.55;
}

.auth-terms-note a {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
}

.auth-terms-note a:hover { text-decoration: underline; text-underline-offset: 2px; }

/* ── Verificación de certificaciones ─────────────────────────────────── */
.auth-code-input input {
    font-family: var(--mono);
    letter-spacing: .04em;
    text-transform: uppercase;
}

.auth-result {
    margin-top: 18px;
    padding: 15px;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: color-mix(in srgb, var(--ink) 3%, transparent);
    animation: auth-rise-in .35s both;
}

.auth-result--valid {
    border-color: color-mix(in srgb, #15803d 28%, var(--border));
    background: color-mix(in srgb, #15803d 8%, transparent);
}

.auth-result--invalid {
    border-color: color-mix(in srgb, #dc2626 28%, var(--border));
    background: color-mix(in srgb, #dc2626 8%, transparent);
}

.auth-result-status {
    display: flex;
    align-items: center;
    gap: 10px;
}

.auth-result-icon {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    line-height: 1;
    background: #15803d;
}

.auth-result--invalid .auth-result-icon { background: #dc2626; }

.auth-result-status strong {
    display: block;
    color: var(--ink);
    font-family: var(--font-display);
    font-size: 14.5px;
    font-weight: 650;
    letter-spacing: -.015em;
}

.auth-result--valid .auth-result-status strong { color: #15803d; }
.auth-result--invalid .auth-result-status strong { color: #b91c1c; }

.auth-result-type {
    margin: 2px 0 0;
    color: var(--muted);
    font-size: 11px;
}

.auth-result-institution {
    margin: 10px 0 0;
    color: var(--primary);
    font-size: 11px;
    font-weight: 600;
}

.auth-result-details {
    display: grid;
    margin: 10px 0 0;
}

.auth-result-details > div {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 7px 0;
    border-top: 1px solid var(--border);
    font-size: 12px;
}

.auth-result-details dt {
    margin: 0;
    color: var(--muted);
    font-weight: 600;
}

.auth-result-details dd {
    margin: 0;
    color: var(--ink);
    text-align: right;
}

.auth-result-details code {
    color: var(--primary);
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: .03em;
    word-break: break-all;
}

.auth-result-text {
    margin: 10px 0 0;
    color: var(--ink-soft);
    font-size: 12px;
    line-height: 1.55;
}

.auth-result-note {
    margin: 10px 0 0;
    padding: 9px 11px;
    border: 1px solid color-mix(in srgb, var(--gold) 40%, var(--border));
    border-radius: 10px;
    background: color-mix(in srgb, var(--gold) 12%, transparent);
    color: color-mix(in srgb, var(--gold) 74%, var(--ink));
    font-size: 11px;
    line-height: 1.5;
}

.auth-result-consulted {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 10px;
}

.auth-privacy {
    margin: 18px 0 0;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 10.5px;
    line-height: 1.5;
    text-align: center;
}

html[data-bs-theme="dark"] .auth-result--valid .auth-result-status strong { color: #8ee2a6; }
html[data-bs-theme="dark"] .auth-result--invalid .auth-result-status strong { color: #ff9c9c; }
html[data-bs-theme="dark"] .auth-result-note { color: #efc78f; }

/* ── Invitación a crear cuenta ───────────────────────────────────────── */
.auth-signup {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 20px;
    padding: 14px 15px;
    border: 1px solid var(--border);
    border-radius: 13px;
    background:
        linear-gradient(135deg,
            color-mix(in srgb, var(--primary) 6%, transparent),
            color-mix(in srgb, var(--ink) 4%, transparent));
    transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.auth-signup:hover {
    border-color: color-mix(in srgb, var(--primary) 34%, var(--border));
    box-shadow: 0 12px 26px -24px color-mix(in srgb, var(--primary) 65%, transparent);
    transform: translateY(-1px);
}

.auth-signup-copy { min-width: 0; }

.auth-signup-kicker {
    display: block;
    color: var(--muted);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .16em;
    text-transform: uppercase;
}

.auth-signup strong {
    display: block;
    margin-top: 3px;
    color: var(--ink);
    font-size: 12px;
    font-weight: 700;
}

.auth-signup p {
    margin: 3px 0 0;
    max-width: 38ch;
    color: var(--muted);
    font-size: 10.5px;
    line-height: 1.45;
}

.auth-signup-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    color: var(--primary);
    font-size: 11px;
    font-weight: 650;
    text-decoration: none;
    white-space: nowrap;
}

.auth-signup-link svg {
    width: 14px;
    height: 14px;
    transition: transform 160ms ease;
}

.auth-signup-link:hover { text-decoration: underline; text-underline-offset: 2px; }
.auth-signup-link:hover svg { transform: translateX(2px); }

/* ── Pie ─────────────────────────────────────────────────────────────── */
.auth-foot {
    margin-top: 26px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 10px;
    line-height: 1.5;
    text-align: center;
}

/* ── Política de contraseñas ─────────────────────────────────────────── */
.auth-rules {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
    margin-top: 8px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: color-mix(in srgb, var(--ink) 3%, transparent);
}

.auth-rule {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--muted);
    font-size: 10.5px;
    line-height: 1.5;
}

.auth-rule::before {
    content: '○';
    font-size: 10px;
    line-height: 1;
    color: var(--muted);
}

.auth-rule.is-ok { color: color-mix(in srgb, #15803d 74%, var(--ink)); }
.auth-rule.is-ok::before { content: '✓'; color: #15803d; }
html[data-bs-theme="dark"] .auth-rule.is-ok { color: #8ee2a6; }

.auth-hint {
    margin: 0;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.5;
}

.auth-hint.is-ok { color: color-mix(in srgb, #15803d 74%, var(--ink)); }
.auth-hint.is-bad { color: color-mix(in srgb, #dc2626 74%, var(--ink)); }
html[data-bs-theme="dark"] .auth-hint.is-ok { color: #8ee2a6; }
html[data-bs-theme="dark"] .auth-hint.is-bad { color: #ff9c9c; }

/* ── Diálogo de términos (nativo) ────────────────────────────────────── */
.auth-dialog {
    width: min(520px, calc(100vw - 32px));
    max-height: min(78vh, 620px);
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--surface-solid);
    color: var(--ink);
    box-shadow: 0 34px 90px -34px rgba(0, 0, 0, .55);
    font-family: var(--font);
}

.auth-dialog::backdrop {
    background: rgba(10, 10, 14, .55);
    backdrop-filter: blur(3px);
}

.auth-dialog-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.auth-dialog-head h3 {
    margin: 0;
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 650;
    letter-spacing: -.02em;
}

.auth-dialog-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
}

.auth-dialog-close:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 6%, transparent); }

.auth-dialog-body {
    padding: 18px 20px 22px;
    overflow-y: auto;
    max-height: calc(min(78vh, 620px) - 62px);
    color: var(--ink-soft);
    font-size: 12.5px;
    line-height: 1.65;
}

.auth-dialog-body p { margin: 0 0 12px; }
.auth-dialog-body p:last-child { margin-bottom: 0; }

.auth-dialog-foot {
    padding: 12px 20px;
    border-top: 1px solid var(--line, #e4e7e2);
    display: flex;
    justify-content: flex-end;
}
.auth-dialog-more {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
}
.auth-dialog-more:hover { text-decoration: underline; }
.auth-dialog-more svg { width: 14px; height: 14px; }

/* ── Foco visible ────────────────────────────────────────────────────── */
.auth-nav-item:focus-visible,
.auth-rail-link:focus-visible,
.auth-brand:focus-visible,
.auth-submit:focus-visible,
.auth-eye:focus-visible,
.auth-label-link:focus-visible,
.auth-signup-link:focus-visible,
.auth-alt a:focus-visible,
.auth-dialog-close:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 1023px) {
    .auth-shell {
        grid-template-columns: 1fr;
        max-width: 540px;
        min-height: 0;
        border-radius: 24px;
    }

    .auth-rail {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 12px 16px;
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }

    .auth-brand { width: 38px; height: 38px; border-radius: 11px; }

    .auth-nav {
        flex-direction: row;
        width: auto;
        gap: 4px;
    }

    .auth-nav-item {
        flex-direction: row;
        gap: 6px;
        padding: 8px 10px;
        font-size: 10px;
        border-radius: 9px;
    }

    .auth-nav-item svg { width: 16px; height: 16px; }
    .auth-nav-item.is-active::before { display: none; }

    .auth-rail-foot { margin-top: 0; }
    .auth-visual { display: none; }

    .auth-panel { padding: 30px 28px 28px; }

    .auth-switch { margin-bottom: 24px; }
}

@media (max-width: 520px) {
    .auth-page { padding: 0; align-items: stretch; }

    .auth-shell {
        min-height: 100vh;
        border: 0;
        border-radius: 0;
        max-width: none;
        box-shadow: none;
    }

    .auth-rail { padding: 12px 14px; }
    .auth-nav-item span { display: none; }
    .auth-nav-item { padding: 8px; }
    /* Reserva el hueco del interruptor de tema flotante */
    .auth-rail { padding-right: 108px; }
    .auth-panel { padding: 26px 22px 30px; justify-content: flex-start; }
    .auth-switch { justify-content: flex-start; }
    .auth-signup { flex-direction: column; align-items: flex-start; gap: 10px; }
    .auth-signup-link { white-space: normal; }
    .auth-app .theme-switch--floating { top: 10px; right: 10px; }
    .auth-field-row { grid-template-columns: 1fr; gap: 11px; }
}

@media (max-width: 380px) {
    .auth-signup { padding: 12px; }
    .auth-visual-title { font-size: 1.6rem; }
}

@media (max-height: 860px) and (min-width: 1024px) {
    .auth-page { padding-block: 16px; }
    .auth-shell { min-height: 0; }
    .auth-panel { padding-block: 26px; }
    .auth-switch { margin-bottom: 18px; }
    .auth-form { gap: 11px; margin-top: 16px; }
    .auth-form--compact { gap: 8px; margin-top: 14px; }
    .auth-form--compact .auth-input input { height: 42px; }
    .auth-astro-art { width: min(58%, 260px); }
}

@media (prefers-reduced-motion: reduce) {
    .auth-submit,
    .auth-eye { transition: none; }
    .auth-shell,
    .auth-rail,
    .auth-visual,
    .auth-panel,
    .auth-visual-content > *,
    .auth-astro-art {
        animation: none !important;
    }
    .auth-submit:hover,
    .auth-signup:hover { transform: none; }
}

/* ═══════════════════════════════════════════════════════════════════════
   Integración con Tekmer (templates/header.php y footer.php compartidos).
   El shell se monta sobre un contenedor .auth-app dentro del <main> público,
   por lo que se neutraliza el flujo del documento y se oculta el pie público
   (se incluye solo por sus scripts globales: Bootstrap, consentimiento…).
   ═══════════════════════════════════════════════════════════════════════ */
.auth-app {
    flex: 1 0 auto;
    width: 100%;
}

.auth-app .zen-auth-footer-wrap { display: none; }

/* Encabezado de nivel 1 para lectores de pantalla cuando el paisaje se oculta. */
.auth-sr-only {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* La ilustración externa conserva la proporción 438×548 del arte original. */
.auth-astro-art img,
.auth-astro-art svg {
    display: block;
}

/* Aviso de enlace mágico en desarrollo: el enlace no debe parecer un botón. */
.auth-alert .auth-alert-link {
    color: inherit;
    font-weight: 650;
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* Contraste AA de los enlaces legales sobre el paisaje (texto pequeño). */
.auth-legal { color: rgba(255, 255, 255, .74); }
.auth-legal a:hover,
.auth-legal a:focus-visible { color: #ffffff; }
