:root {
    --auth-primary: #2563eb;
    --auth-primary-dark: #1d4ed8;
    --auth-primary-soft: #eff6ff;
    --auth-navy: #0f1f46;
    --auth-navy-light: #172f6b;
    --auth-green: #059669;
    --auth-red: #dc2626;
    --auth-orange: #f59e0b;
    --auth-text: #172033;
    --auth-muted: #68758a;
    --auth-border: #dbe5f1;
    --auth-surface: #ffffff;
    --auth-background: #f2f6fc;
    --auth-radius: 24px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    min-width: 320px;
    min-height: 100%;
}

body,
button,
input {
    font-family: Inter, "Segoe UI", Arial, sans-serif;
}

button,
input {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    cursor: pointer;
}

.auth-page {
    position: relative;
    min-width: 320px;
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    place-items: center;
    overflow-x: hidden;
    color: var(--auth-text);
    background:
        linear-gradient(135deg, #eef4ff 0%, #f8fafc 48%, #eef3fb 100%);
}

.auth-background {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.auth-background__grid {
    position: absolute;
    inset: 0;
    opacity: 0.32;
    background-image:
        linear-gradient(rgba(37, 99, 235, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(37, 99, 235, 0.045) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: linear-gradient(to bottom, black, transparent 92%);
}

.auth-background__light {
    position: absolute;
    width: 420px;
    height: 420px;
    border-radius: 50%;
    filter: blur(14px);
}

.auth-background__light--one {
    top: -180px;
    left: -130px;
    background: rgba(37, 99, 235, 0.13);
}

.auth-background__light--two {
    right: -170px;
    bottom: -220px;
    background: rgba(14, 165, 233, 0.12);
}

.auth-shell {
    position: relative;
    z-index: 1;
    width: min(1120px, calc(100% - 48px));
    margin: auto;
    padding: 28px 0 20px;
}

.auth-card {
    min-height: min(680px, calc(100vh - 94px));
    min-height: min(680px, calc(100dvh - 94px));
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(430px, 0.92fr);
    overflow: hidden;
    background: var(--auth-surface);
    border: 1px solid rgba(204, 216, 231, 0.9);
    border-radius: var(--auth-radius);
    box-shadow:
        0 30px 80px rgba(34, 58, 100, 0.14),
        0 8px 28px rgba(15, 31, 70, 0.08);
}

.auth-brand {
    position: relative;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 30px;
    overflow: hidden;
    padding: 44px 48px 42px;
    color: #ffffff;
    background:
        radial-gradient(circle at 90% 10%, rgba(96, 165, 250, 0.42), transparent 31%),
        radial-gradient(circle at 10% 95%, rgba(14, 165, 233, 0.2), transparent 30%),
        linear-gradient(145deg, var(--auth-navy) 0%, #17387e 57%, #2563eb 130%);
}

.auth-brand::before {
    content: "";
    position: absolute;
    width: 310px;
    height: 310px;
    right: -190px;
    bottom: 72px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 50%;
    box-shadow:
        0 0 0 42px rgba(255, 255, 255, 0.035),
        0 0 0 86px rgba(255, 255, 255, 0.025);
}

.auth-brand__top,
.auth-brand__content,
.auth-features {
    position: relative;
    z-index: 2;
}

.auth-brand__top {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 32px;
}

.platform-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 13px;
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.17);
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.45px;
    backdrop-filter: blur(10px);
}

.platform-badge i {
    font-size: 17px;
}

.company-logo {
    width: min(290px, 76%);
    max-height: 112px;
    object-fit: contain;
    object-position: left center;
    filter: drop-shadow(0 8px 18px rgba(3, 13, 36, 0.16));
}

.auth-brand__content {
    max-width: 485px;
}

.eyebrow {
    display: block;
    margin-bottom: 10px;
    color: var(--auth-primary);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.7px;
}

.eyebrow--light {
    color: #bfdbfe;
}

.eyebrow--danger {
    color: var(--auth-red);
}

.auth-brand h1 {
    max-width: 500px;
    font-size: clamp(30px, 3vw, 43px);
    line-height: 1.12;
    letter-spacing: -1.25px;
}

.auth-brand__content p {
    max-width: 455px;
    margin-top: 20px;
    color: rgba(226, 232, 240, 0.84);
    font-size: 15px;
    line-height: 1.7;
}

.auth-features {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.auth-features span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 13px;
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.085);
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
}

.auth-features i {
    color: #bfdbfe;
    font-size: 17px;
}

.brand-decoration {
    position: absolute;
    top: 40%;
    right: 44px;
    z-index: 1;
    display: grid;
    gap: 8px;
}

.brand-decoration span {
    width: 5px;
    height: 5px;
    display: block;
    background: rgba(255, 255, 255, 0.44);
    border-radius: 50%;
}

.auth-panel {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 44px clamp(36px, 4.1vw, 62px);
    background:
        linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
}

.auth-form-wrap {
    width: 100%;
    max-width: 405px;
}

.mobile-brand {
    display: none;
    align-items: center;
    gap: 12px;
    margin-bottom: 34px;
}

.mobile-brand img {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

.mobile-brand strong,
.mobile-brand span {
    display: block;
}

.mobile-brand strong {
    font-size: 17px;
}

.mobile-brand span {
    margin-top: 3px;
    color: var(--auth-muted);
    font-size: 12px;
}

.auth-header {
    margin-bottom: 30px;
}

.auth-header h2,
.recovery-header h1 {
    color: var(--auth-text);
    font-size: 31px;
    line-height: 1.2;
    letter-spacing: -0.7px;
}

.auth-header p,
.recovery-header p {
    margin-top: 10px;
    color: var(--auth-muted);
    font-size: 14px;
    line-height: 1.65;
}

.auth-form {
    display: grid;
    gap: 20px;
}

.form-field {
    min-width: 0;
}

.form-field label {
    display: inline-block;
    margin-bottom: 9px;
    color: #334155;
    font-size: 13px;
    font-weight: 700;
}

.field-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.forgot-link {
    margin-bottom: 9px;
    color: var(--auth-primary);
    font-size: 12px;
    font-weight: 700;
    transition: color 0.2s ease;
}

.forgot-link:hover {
    color: var(--auth-primary-dark);
    text-decoration: underline;
}

.input-control {
    position: relative;
}

.input-control > i {
    position: absolute;
    top: 50%;
    left: 16px;
    z-index: 2;
    color: #8290a5;
    font-size: 20px;
    transform: translateY(-50%);
    pointer-events: none;
    transition: color 0.2s ease;
}

.input-control input {
    width: 100%;
    height: 52px;
    padding: 0 50px 0 48px;
    color: var(--auth-text);
    background: #f8fafc;
    border: 1px solid var(--auth-border);
    border-radius: 12px;
    outline: none;
    font-size: 14px;
    transition:
        border-color 0.2s ease,
        background 0.2s ease,
        box-shadow 0.2s ease;
}

.input-control input::placeholder {
    color: #9aa6b7;
}

.input-control input:hover {
    border-color: #c5d3e4;
}

.input-control input:focus {
    background: #ffffff;
    border-color: var(--auth-primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.11);
}

.input-control:focus-within > i {
    color: var(--auth-primary);
}

.input-control input.is-valid {
    border-color: var(--auth-green);
    box-shadow: 0 0 0 4px rgba(5, 150, 105, 0.09);
}

.input-control input.is-invalid {
    border-color: var(--auth-red);
    box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.08);
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 8px;
    z-index: 3;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    color: #718096;
    background: transparent;
    border: 0;
    border-radius: 9px;
    transform: translateY(-50%);
    transition:
        color 0.2s ease,
        background 0.2s ease;
}

.password-toggle:hover {
    color: var(--auth-primary);
    background: var(--auth-primary-soft);
}

.password-toggle i {
    font-size: 20px;
}

.caps-warning,
.password-match {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    color: #b45309;
    font-size: 12px;
    font-weight: 600;
}

.caps-warning[hidden],
.password-match[hidden] {
    display: none;
}

.password-match.is-valid {
    color: var(--auth-green);
}

.password-match.is-invalid {
    color: var(--auth-red);
}

.field-help {
    display: block;
    margin-top: 8px;
    color: var(--auth-muted);
    font-size: 11px;
    line-height: 1.5;
}

.auth-submit {
    width: 100%;
    min-height: 52px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 12px 18px;
    color: #ffffff;
    background: linear-gradient(135deg, var(--auth-primary), #1d4ed8);
    border: 0;
    border-radius: 12px;
    box-shadow: 0 11px 24px rgba(37, 99, 235, 0.23);
    font-size: 14px;
    font-weight: 750;
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease,
        filter 0.2s ease;
}

.auth-submit:hover {
    box-shadow: 0 14px 30px rgba(37, 99, 235, 0.3);
    filter: brightness(1.04);
    transform: translateY(-1px);
}

.auth-submit:active {
    transform: translateY(0);
}

.auth-submit:disabled {
    opacity: 0.65;
    cursor: wait;
    box-shadow: none;
    transform: none;
}

.auth-submit i {
    font-size: 19px;
}

.auth-submit--link {
    margin-top: 25px;
}

.security-note {
    display: flex;
    align-items: center;
    gap: 11px;
    margin-top: 28px;
    padding: 14px 15px;
    background: #f8fafc;
    border: 1px solid #e7edf5;
    border-radius: 12px;
}

.security-note > i {
    flex: 0 0 auto;
    color: var(--auth-green);
    font-size: 21px;
}

.security-note strong,
.security-note span {
    display: block;
}

.security-note strong {
    color: #334155;
    font-size: 12px;
}

.security-note span {
    margin-top: 3px;
    color: var(--auth-muted);
    font-size: 11px;
    line-height: 1.45;
}

.auth-copyright {
    position: relative;
    z-index: 2;
    margin-top: 17px;
    color: #748197;
    text-align: center;
    font-size: 11px;
}

/*
|--------------------------------------------------------------------------
| Pantallas de recuperación
|--------------------------------------------------------------------------
*/

.auth-page--recovery {
    padding: 28px 0;
}

.recovery-shell {
    position: relative;
    z-index: 1;
    width: min(500px, calc(100% - 36px));
    margin: auto;
}

.recovery-shell--wide {
    width: min(550px, calc(100% - 36px));
}

.recovery-card {
    position: relative;
    overflow: hidden;
    padding: 32px 38px 30px;
    background: rgba(255, 255, 255, 0.97);
    border: 1px solid rgba(207, 219, 234, 0.95);
    border-radius: 22px;
    box-shadow:
        0 28px 70px rgba(34, 58, 100, 0.14),
        0 6px 22px rgba(15, 31, 70, 0.07);
}

.recovery-card__accent {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: linear-gradient(90deg, #2563eb, #38bdf8, #2563eb);
}

.recovery-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 30px;
}

.recovery-brand img {
    width: 46px;
    height: 46px;
    object-fit: contain;
}

.recovery-brand strong,
.recovery-brand span {
    display: block;
}

.recovery-brand strong {
    font-size: 16px;
}

.recovery-brand span {
    margin-top: 2px;
    color: var(--auth-muted);
    font-size: 11px;
}

.recovery-icon {
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    margin-bottom: 19px;
    color: var(--auth-primary);
    background: var(--auth-primary-soft);
    border: 1px solid #dbeafe;
    border-radius: 16px;
}

.recovery-icon i {
    font-size: 29px;
}

.recovery-icon--success {
    color: var(--auth-green);
    background: #ecfdf5;
    border-color: #d1fae5;
}

.recovery-icon--danger {
    color: var(--auth-red);
    background: #fef2f2;
    border-color: #fee2e2;
}

.recovery-header {
    margin-bottom: 25px;
}

.recovery-header h1 {
    font-size: 27px;
}

.inline-message {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 22px;
    padding: 14px;
    border-radius: 11px;
}

.inline-message--success {
    color: #065f46;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
}

.inline-message > i {
    flex: 0 0 auto;
    margin-top: 1px;
    font-size: 20px;
}

.inline-message strong,
.inline-message span {
    display: block;
}

.inline-message strong {
    margin-bottom: 3px;
    font-size: 12px;
}

.inline-message span {
    font-size: 12px;
    line-height: 1.5;
}

.back-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 23px;
    color: #526177;
    font-size: 12px;
    font-weight: 700;
    transition: color 0.2s ease;
}

.back-link:hover {
    color: var(--auth-primary);
}

.back-link i {
    font-size: 18px;
}

.recovery-security {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin-top: 25px;
    padding-top: 20px;
    color: var(--auth-muted);
    border-top: 1px solid #e8eef6;
    font-size: 11px;
    line-height: 1.55;
}

.recovery-security i {
    flex: 0 0 auto;
    color: var(--auth-primary);
    font-size: 18px;
}

.password-strength {
    margin-top: -9px;
}

.strength-track {
    height: 5px;
    overflow: hidden;
    background: #e8edf5;
    border-radius: 999px;
}

.strength-track span {
    width: 0;
    height: 100%;
    display: block;
    background: var(--auth-red);
    border-radius: inherit;
    transition:
        width 0.25s ease,
        background 0.25s ease;
}

.strength-track span[data-score="3"] {
    background: var(--auth-orange);
}

.strength-track span[data-score="4"],
.strength-track span[data-score="5"] {
    background: var(--auth-green);
}

.password-strength > span {
    display: block;
    margin-top: 7px;
    color: var(--auth-muted);
    font-size: 11px;
}

.password-rules {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 13px;
    margin-top: -8px;
    padding: 14px;
    background: #f8fafc;
    border: 1px solid #e8eef6;
    border-radius: 11px;
}

.password-rules span {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #7b8798;
    font-size: 11px;
}

.password-rules span.is-valid {
    color: var(--auth-green);
    font-weight: 700;
}

.password-rules i {
    font-size: 13px;
}

/*
|--------------------------------------------------------------------------
| Adaptación por altura
|--------------------------------------------------------------------------
| En laptops con poca altura se reducen espacios sin pegar la tarjeta arriba.
*/

@media (min-width: 861px) and (max-height: 760px) {
    .auth-shell {
        padding-top: 18px;
    }

    .auth-card {
        min-height: 610px;
    }

    .auth-brand {
        padding: 34px 42px;
    }

    .auth-brand__top {
        gap: 22px;
    }

    .company-logo {
        max-height: 82px;
    }

    .auth-brand h1 {
        font-size: 34px;
    }

    .auth-brand__content p {
        margin-top: 14px;
    }

    .auth-panel {
        padding-top: 30px;
        padding-bottom: 30px;
    }

    .auth-header {
        margin-bottom: 23px;
    }

    .security-note {
        margin-top: 20px;
    }
}

/*
|--------------------------------------------------------------------------
| Tablet
|--------------------------------------------------------------------------
*/

@media (max-width: 960px) {
    .auth-shell {
        width: min(940px, calc(100% - 32px));
    }

    .auth-card {
        grid-template-columns: minmax(0, 0.9fr) minmax(390px, 1.1fr);
    }

    .auth-brand {
        padding: 38px 34px;
    }

    .auth-features span:nth-child(3) {
        display: none;
    }
}

/*
|--------------------------------------------------------------------------
| Móvil y tablet vertical
|--------------------------------------------------------------------------
*/

@media (max-width: 860px) {
    .auth-page {
        display: block;
    }

    .auth-shell {
        width: min(560px, calc(100% - 30px));
        min-height: 100vh;
        min-height: 100dvh;
        display: flex;
        flex-direction: column;
        justify-content: center;
        padding: 22px 0 16px;
    }

    .auth-card {
        min-height: 0;
        display: block;
        border-radius: 20px;
    }

    .auth-brand {
        display: none;
    }

    .auth-panel {
        padding: 38px 34px 34px;
    }

    .auth-form-wrap {
        max-width: none;
    }

    .mobile-brand {
        display: flex;
    }

    .auth-header h2 {
        font-size: 29px;
    }

    .auth-copyright {
        margin-top: 13px;
    }
}

@media (max-width: 520px) {
    .auth-shell {
        width: min(100% - 22px, 470px);
        padding-top: 11px;
        padding-bottom: 11px;
    }

    .auth-panel {
        padding: 29px 22px 25px;
    }

    .mobile-brand {
        margin-bottom: 26px;
    }

    .mobile-brand img {
        width: 43px;
        height: 43px;
    }

    .auth-header {
        margin-bottom: 24px;
    }

    .auth-header h2,
    .recovery-header h1 {
        font-size: 25px;
    }

    .auth-header p,
    .recovery-header p {
        font-size: 13px;
    }

    .field-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 0;
    }

    .forgot-link {
        order: 2;
        margin-top: -2px;
        margin-bottom: 9px;
    }

    .input-control input {
        height: 50px;
    }

    .security-note {
        align-items: flex-start;
        margin-top: 22px;
    }

    .auth-copyright {
        font-size: 10px;
    }

    .auth-page--recovery {
        padding: 12px 0;
    }

    .recovery-shell,
    .recovery-shell--wide {
        width: min(100% - 22px, 500px);
    }

    .recovery-card {
        padding: 27px 21px 25px;
        border-radius: 18px;
    }

    .recovery-brand {
        margin-bottom: 24px;
    }

    .recovery-icon {
        width: 52px;
        height: 52px;
    }

    .password-rules {
        grid-template-columns: 1fr;
    }
}

/*
|--------------------------------------------------------------------------
| Teléfonos con poca altura
|--------------------------------------------------------------------------
*/

@media (max-width: 860px) and (max-height: 690px) {
    .auth-shell {
        justify-content: flex-start;
    }

    .mobile-brand {
        margin-bottom: 20px;
    }

    .auth-header {
        margin-bottom: 20px;
    }

    .auth-form {
        gap: 16px;
    }

    .security-note {
        margin-top: 18px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}

/*
|--------------------------------------------------------------------------
| Centrado responsive de recuperación de contraseña
|--------------------------------------------------------------------------
| El login móvil ya utiliza un contenedor que ocupa toda la pantalla.
| Estas reglas aplican el mismo comportamiento a:
| - Solicitar enlace.
| - Enlace vencido o utilizado.
| - Crear una nueva contraseña.
|
| Los márgenes automáticos centran el contenido cuando existe espacio.
| Si el formulario es más alto que la pantalla, los márgenes se reducen
| y el documento conserva su desplazamiento vertical sin cortar campos.
*/

@media (max-width: 860px) {
    .auth-page.auth-page--recovery {
        min-height: 100vh;
        min-height: 100dvh;
        display: flex;
        align-items: stretch;
        justify-content: center;
        padding: 14px 0;
        overflow-y: auto;
    }

    .auth-page--recovery .recovery-shell,
    .auth-page--recovery .recovery-shell--wide {
        width: min(500px, calc(100% - 24px));
        min-height: calc(100vh - 28px);
        min-height: calc(100dvh - 28px);
        display: flex;
        flex-direction: column;
        justify-content: center;
        margin: auto;
        padding: 0;
    }

    .auth-page--recovery .recovery-card {
        flex: 0 0 auto;
        width: 100%;
        margin: auto 0 0;
    }

    .auth-page--recovery .auth-copyright {
        flex: 0 0 auto;
        margin: 14px 0 auto;
        padding-bottom: 2px;
    }
}

@media (max-width: 520px) {
    .auth-page.auth-page--recovery {
        padding: 10px 0;
    }

    .auth-page--recovery .recovery-shell,
    .auth-page--recovery .recovery-shell--wide {
        width: min(500px, calc(100% - 20px));
        min-height: calc(100vh - 20px);
        min-height: calc(100dvh - 20px);
    }

    .auth-page--recovery .recovery-card {
        padding: 27px 21px 25px;
    }
}

/*
 * En dispositivos bajos, el formulario completo puede superar la altura
 * disponible. En ese caso empieza arriba y se desplaza normalmente.
 */
@media (max-width: 860px) and (max-height: 720px) {
    .auth-page--recovery .recovery-shell,
    .auth-page--recovery .recovery-shell--wide {
        justify-content: flex-start;
    }

    .auth-page--recovery .recovery-card {
        margin-top: 0;
    }

    .auth-page--recovery .auth-copyright {
        margin-bottom: 0;
    }
}
