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

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

body {
    margin: 0;
    color: #161b22;
    font-family: var(--font-system);
    -webkit-font-smoothing: antialiased;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

:focus-visible {
    outline: 3px solid rgb(181 18 27 / 30%);
    outline-offset: 3px;
}

.login-page {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: clamp(1rem, 3vw, 2.5rem);
    background: #f5f6f7;
}

.access-shell {
    display: grid;
    overflow: hidden;
    width: min(100%, 76rem);
    min-height: min(45rem, calc(100vh - 4rem));
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border: 1px solid #e0e3e6;
    border-radius: 1rem;
    background: #ffffff;
    box-shadow: 0 1.25rem 3.5rem rgb(22 27 34 / 12%);
    animation: interface-enter 500ms ease-out both;
}

.access-context {
    position: relative;
    isolation: isolate;
    display: flex;
    overflow: hidden;
    flex-direction: column;
    padding: clamp(2rem, 4.5vw, 4.25rem);
    color: #ffffff;
    background: linear-gradient(145deg, #7f0d14 0%, #a80f18 50%, #c51622 100%);
}

.access-context::before {
    position: absolute;
    z-index: -2;
    inset: 0;
    opacity: 0.22;
    background:
        linear-gradient(120deg, transparent 0 63%, rgb(255 255 255 / 15%) 63.2% 63.5%, transparent 63.7%),
        radial-gradient(circle at 82% 76%, rgb(255 255 255 / 17%) 0 1px, transparent 1.4px);
    background-size: auto, 1.25rem 1.25rem;
    content: "";
}

.access-context::after {
    position: absolute;
    z-index: -1;
    right: -7rem;
    bottom: -8rem;
    width: 25rem;
    height: 25rem;
    border: 1px solid rgb(255 255 255 / 10%);
    border-radius: 50%;
    box-shadow:
        0 0 0 3.5rem rgb(255 255 255 / 3%),
        0 0 0 7rem rgb(255 255 255 / 2%);
    content: "";
}

.access-brand {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 1.15rem;
}

.access-brand__logo {
    width: 6rem;
    height: 6rem;
    flex: 0 0 auto;
    padding: 0.3rem;
    border-radius: 50%;
    background: #ffffff;
    object-fit: contain;
    box-shadow: 0 0.65rem 1.4rem rgb(82 0 6 / 20%);
}

.access-brand__text strong,
.access-brand__text small {
    display: block;
}

.access-brand__text strong {
    max-width: 18rem;
    font-size: clamp(0.9rem, 1.3vw, 1.08rem);
    font-weight: 850;
    letter-spacing: 0.015em;
    line-height: 1.25;
    text-transform: uppercase;
}

.access-brand__text small {
    margin-top: 0.35rem;
    color: rgb(255 255 255 / 78%);
    font-size: 0.68rem;
    font-weight: 650;
    letter-spacing: 0.055em;
}

.access-context__body {
    position: relative;
    z-index: 1;
    max-width: 32rem;
    margin: auto 0;
    padding: 3.5rem 0;
}

.access-kicker {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    color: rgb(255 255 255 / 88%);
    font-size: 0.69rem;
    font-weight: 850;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.access-kicker::before {
    width: 2rem;
    height: 2px;
    background: #ffffff;
    content: "";
}

.access-context h1 {
    margin: 1.05rem 0 1.25rem;
    font-size: clamp(2.7rem, 4vw, 4.5rem);
    font-weight: 800;
    letter-spacing: -0.055em;
    line-height: 0.98;
}

.access-context__body p {
    max-width: 29rem;
    margin: 0;
    color: rgb(255 255 255 / 86%);
    font-size: 0.94rem;
    line-height: 1.7;
}

.access-modules {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    margin-top: 1.75rem;
}

.access-modules span {
    padding: 0.42rem 0.7rem;
    border: 1px solid rgb(255 255 255 / 28%);
    border-radius: 0.45rem;
    color: #ffffff;
    background: rgb(255 255 255 / 6%);
    font-size: 0.65rem;
    font-weight: 750;
    letter-spacing: 0.08em;
}

.access-context__footer {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    color: rgb(255 255 255 / 68%);
    font-size: 0.67rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.access-form-panel {
    display: grid;
    place-items: center;
    padding: clamp(2rem, 6vw, 5.5rem);
    background: #ffffff;
}

.access-form-wrap {
    width: min(100%, 28rem);
}

.access-form-heading {
    margin-bottom: 1.8rem;
    text-align: center;
}

.access-form-heading__line {
    display: block;
    width: 2.75rem;
    height: 0.22rem;
    margin: 0 auto 1.15rem;
    border-radius: 999px;
    background: #b9000b;
}

.access-form-heading p {
    margin: 0 0 0.45rem;
    color: #b9000b;
    font-size: 0.7rem;
    font-weight: 850;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.access-form-heading h2 {
    margin: 0;
    color: #161b22;
    font-size: clamp(2.1rem, 3.5vw, 2.75rem);
    font-weight: 800;
    letter-spacing: -0.045em;
    line-height: 1.05;
}

.access-form-heading > span:last-child {
    display: block;
    margin-top: 0.65rem;
    color: #66707a;
    font-size: 0.88rem;
}

.form-alert {
    display: grid;
    gap: 0.25rem;
    margin-bottom: 1.25rem;
    padding: 0.8rem 0.95rem;
    border: 1px solid #f5c2c7;
    border-left: 4px solid #b9000b;
    border-radius: 0.5rem;
    color: #7f0d14;
    background: #fff5f5;
    font-size: 0.8rem;
}

.form-alert strong {
    font-size: 0.84rem;
}

.form-alert span {
    color: #9b2a31;
}

.access-form {
    display: grid;
    gap: 1.1rem;
}

.field-group {
    display: grid;
    gap: 0.45rem;
}

.field-group label {
    color: #252b32;
    font-size: 0.78rem;
    font-weight: 750;
}

.field-control {
    position: relative;
}

.field-control__icon {
    position: absolute;
    z-index: 1;
    top: 50%;
    left: 1rem;
    display: grid;
    width: 1.6rem;
    height: 1.6rem;
    place-items: center;
    border-radius: 0.4rem;
    color: #6e7781;
    background: #f0f2f4;
    transform: translateY(-50%);
    pointer-events: none;
    transition: color 180ms ease, background 180ms ease;
}

.field-control__icon svg,
.password-toggle svg {
    width: 0.95rem;
    height: 0.95rem;
    fill: none;
    stroke: currentcolor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.field-control input {
    width: 100%;
    height: 3.5rem;
    padding: 0 3.25rem;
    border: 1px solid #d4d9de;
    border-radius: 0.65rem;
    color: #161b22;
    background: #ffffff;
    transition: border-color 180ms ease, box-shadow 180ms ease;
}

.field-control input::placeholder {
    color: #939ba3;
}

.field-control input:hover {
    border-color: #aab1b8;
}

.field-control input:focus {
    border-color: #b9000b;
    outline: none;
    box-shadow: 0 0 0 4px rgb(181 18 27 / 10%);
}

.field-control:focus-within .field-control__icon {
    color: #ffffff;
    background: #b9000b;
}

.field-control input:-webkit-autofill,
.field-control input:-webkit-autofill:hover,
.field-control input:-webkit-autofill:focus {
    -webkit-text-fill-color: #161b22;
    box-shadow: 0 0 0 1000px #ffffff inset;
    caret-color: #161b22;
    transition: background-color 9999s ease-out;
}

.field-control > .password-toggle {
    position: absolute;
    z-index: 3;
    top: 50%;
    right: 0.65rem;
    display: grid;
    width: 2.35rem;
    min-width: 2.35rem;
    height: 2.35rem;
    min-height: 2.75rem;
    place-items: center;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0.45rem;
    color: #68727c;
    background: transparent;
    box-shadow: none;
    appearance: none;
    -webkit-appearance: none;
    transform: translateY(-50%);
    transition: color 180ms ease, background 180ms ease, transform 180ms ease;
}

.field-control > .password-toggle:hover {
    color: #b9000b;
    background: #fff1f2;
}

.field-control > .password-toggle:active {
    transform: translateY(-50%) scale(0.92);
}

.password-toggle svg {
    position: absolute;
    width: 1.15rem;
    height: 1.15rem;
    transition: opacity 180ms ease, transform 220ms ease;
}

.password-toggle__show {
    opacity: 1;
    transform: scale(1) rotate(0);
}

.password-toggle__hide {
    opacity: 0;
    transform: scale(0.65) rotate(-18deg);
}

.password-toggle[aria-pressed="true"] .password-toggle__show {
    opacity: 0;
    transform: scale(0.65) rotate(18deg);
}

.password-toggle[aria-pressed="true"] .password-toggle__hide {
    opacity: 1;
    transform: scale(1) rotate(0);
}

.access-button {
    position: relative;
    display: flex;
    width: 100%;
    height: 3.4rem;
    align-items: center;
    justify-content: center;
    margin-top: 0.25rem;
    padding: 0 1.2rem;
    overflow: hidden;
    border: 0;
    border-radius: 0.65rem;
    color: #ffffff;
    background: linear-gradient(135deg, #b9000b, #e10613);
    box-shadow: 0 0.55rem 1.25rem rgb(181 18 27 / 16%);
    font-weight: 750;
    transition: transform 180ms ease, box-shadow 180ms ease;
}

.access-button span:last-child {
    position: absolute;
    right: 1.2rem;
    font-size: 1.15rem;
    transition: transform 180ms ease;
}

.access-button:hover {
    box-shadow: 0 10px 25px rgb(181 18 27 / 22%);
    transform: translateY(-1px);
}

.access-button:hover span:last-child {
    transform: translateX(0.2rem);
}

.access-button:active {
    transform: translateY(0);
}

.access-help {
    margin: 1.35rem 0 0;
    color: #78818a;
    font-size: 0.72rem;
    line-height: 1.55;
    text-align: center;
}

.access-help a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding-inline: .75rem;
    border-radius: .5rem;
    color: #a51120;
    font-size: .875rem;
    font-weight: 700;
    text-decoration: none;
}

.access-help a:hover { background: #fff1f2; text-decoration: underline; }
.access-help a:focus-visible { outline: 2px solid #a51120; outline-offset: 2px; }

.login-page.recovery-page {
    display: grid;
    padding: clamp(1rem, 5vw, 3rem);
    background: radial-gradient(ellipse at top, #fbecef, #f5f6f7 65%);
}

.recovery-card {
    width: min(100%, 32rem);
    padding: clamp(1.25rem, 5vw, 2.5rem);
    border: 1px solid #e0e3e6;
    border-top: 5px solid #b90016;
    border-radius: 1rem;
    background: #fff;
    box-shadow: 0 1.25rem 3rem rgb(22 27 34 / 10%);
}

.recovery-logo { display: block; margin: 0 auto 1rem; }
.recovery-card h1 { margin: .5rem 0 0; font-size: clamp(1.6rem, 5vw, 2.25rem); line-height: 1.15; }
.recovery-instructions { margin: 0 0 1.5rem; color: #475569; text-align: center; line-height: 1.55; }
.recovery-card .user-password-field input { padding-inline-end: 12px; }
.recovery-card input[autocomplete="one-time-code"] { text-align: center; letter-spacing: .3em; font-variant-numeric: tabular-nums; }
.recovery-card .field-error:empty { display: none; }
.recovery-card .recovery-submit { display: block; width: 100%; margin-top: 1.25rem; }
.recovery-card .access-help { margin-top: .75rem; }

@keyframes interface-enter {
    from {
        opacity: 0;
        transform: translateY(0.5rem);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media (max-width: 1024px) {
    .access-shell {
        min-height: min(42rem, calc(100vh - 2rem));
    }

    .access-context,
    .access-form-panel {
        padding: 2.5rem;
    }

    .access-context h1 {
        font-size: clamp(2.7rem, 5vw, 3.6rem);
    }
}

@media (max-width: 768px) {
    .login-page {
        display: block;
        padding: 0;
    }

    .access-shell {
        min-height: 100vh;
        grid-template-columns: 1fr;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .access-context {
        min-height: 17rem;
        padding: 1.4rem clamp(1.25rem, 5vw, 2.5rem);
    }

    .access-brand__logo {
        width: 4.5rem;
        height: 4.5rem;
    }

    .access-context__body {
        padding: 2rem 0 1rem;
    }

    .access-kicker {
        font-size: 0.62rem;
    }

    .access-context h1 {
        margin: 0.8rem 0 0;
        font-size: clamp(2.1rem, 8vw, 3rem);
        line-height: 1;
    }

    .access-context h1 br {
        display: none;
    }

    .access-context__body p,
    .access-modules,
    .access-context__footer,
    .access-context::after {
        display: none;
    }

    .access-form-panel {
        min-height: 35rem;
        align-items: start;
        padding: 3rem clamp(1.25rem, 6vw, 3rem) 4rem;
    }
}

@media (max-width: 480px) {
    .access-context {
        min-height: 14.5rem;
    }

    .access-brand {
        gap: 0.8rem;
    }

    .access-brand__logo {
        width: 3.8rem;
        height: 3.8rem;
    }

    .access-brand__text strong {
        max-width: 13rem;
        font-size: 0.78rem;
    }

    .access-brand__text small {
        font-size: 0.58rem;
    }

    .access-context__body {
        padding-top: 1.6rem;
    }

    .access-kicker {
        display: none;
    }

    .access-context h1 {
        font-size: clamp(1.85rem, 9vw, 2.35rem);
    }

    .access-form-panel {
        min-height: 34rem;
        padding: 2.5rem 1.25rem 3rem;
    }

    .access-form-heading h2 {
        font-size: 2rem;
    }
}

@media (max-width: 375px) {
    .access-context {
        min-height: 13.5rem;
    }

    .access-brand__text small {
        display: none;
    }

    .access-form-panel {
        padding-inline: 1rem;
    }

    .field-control input {
        height: 3.4rem;
    }
}

/* Los controles de la aplicación («En línea», «Instalar aplicación», avisos de envío y de versión nueva). En las demás
   pantallas flotan sobre la barra inferior; aquí no hay barra, y en el teléfono flotaban SOBRE el formulario: tapaban el
   borde de «Ingresar» y el pie «Si no puede acceder…», en un teléfono bajo (360×640) incluso al final de la página. Hasta
   768 px van al final de la página, en su sitio. ``body >`` les gana a las reglas de pwa.css, que se carga después. */
@media (max-width: 768px) {
    body > .pwa-controls {
        position: static;
        max-width: none;
        max-height: none;
        overflow: visible;
        justify-items: center;
        padding: 0.9rem 1rem calc(1.1rem + env(safe-area-inset-bottom, 0px));
    }

    body > .pwa-controls .pwa-connection {
        justify-self: center;
    }
}
