.auth-page {
    --auth-surface: color-mix(in srgb, var(--bg-color) 97%, var(--main-color) 3%);
    --auth-surface-strong: color-mix(in srgb, var(--bg-color) 91%, var(--main-color) 9%);
    --auth-border: color-mix(in srgb, var(--text-color) 11%, transparent);
    --auth-muted: color-mix(in srgb, var(--text-color) 62%, transparent);
    --auth-shadow: 0 28px 80px rgba(28, 18, 60, .12), 0 4px 16px rgba(28, 18, 60, .05);
    position: relative;
    isolation: isolate;
    display: grid;
    place-items: center;
    min-height: calc(100vh - 18rem);
    padding: clamp(1.25rem, 4vw, 4rem) 1rem;
    color: var(--text-color);
}

.auth-page::before,
.auth-page::after {
    position: absolute;
    z-index: -1;
    width: min(26rem, 70vw);
    aspect-ratio: 1;
    border-radius: 50%;
    content: "";
    pointer-events: none;
    filter: blur(1px);
}

.auth-page::before {
    top: 5%;
    left: 8%;
    background: radial-gradient(circle, color-mix(in srgb, var(--main-color) 15%, transparent), transparent 68%);
}

.auth-page::after {
    right: 7%;
    bottom: 0;
    background: radial-gradient(circle, color-mix(in srgb, #73daca 12%, transparent), transparent 68%);
}

.auth-card {
    width: min(100%, 29rem);
    padding: clamp(1.5rem, 4vw, 2.5rem);
    border: 1px solid var(--auth-border);
    border-radius: 1.5rem;
    background: color-mix(in srgb, var(--auth-surface) 93%, transparent);
    box-shadow: var(--auth-shadow);
    backdrop-filter: blur(16px);
}

.auth-card-wide {
    width: min(100%, 35rem);
}

.auth-header {
    margin-bottom: 1.75rem;
    text-align: center;
}

.auth-brand {
    display: inline-flex;
    align-items: center;
    gap: .65rem;
    margin-bottom: 1.5rem;
    color: var(--text-color);
    font-size: .9rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-decoration: none;
}

.auth-brand:hover {
    color: var(--text-color);
    text-decoration: none;
}

.auth-brand-mark {
    display: grid;
    place-items: center;
    width: 2.55rem;
    height: 2.55rem;
    padding: .32rem;
    border-radius: .85rem;
    border: 1px solid color-mix(in srgb, #1fa6ea 22%, transparent);
    background: color-mix(in srgb, #1fa6ea 8%, var(--bg-color));
    box-shadow: 0 8px 20px color-mix(in srgb, #1fa6ea 18%, transparent);
}

.auth-brand-mark img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.auth-header h1 {
    margin: 0;
    font-size: clamp(1.75rem, 4vw, 2.15rem);
    font-weight: 750;
    letter-spacing: -.035em;
}

.auth-header p {
    margin: .65rem 0 0;
    color: var(--auth-muted);
    font-size: .95rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
}

.auth-field {
    min-width: 0;
}

.auth-field .form-label {
    margin-bottom: .45rem;
    color: var(--text-color);
    font-size: .9rem;
    font-weight: 650;
}

.auth-field .form-control {
    min-height: 3.15rem;
    padding: .75rem .95rem;
    border-color: var(--auth-border);
    border-radius: .85rem;
    background: color-mix(in srgb, var(--bg-color) 92%, transparent);
    font-size: .95rem;
}

.auth-field .form-control:hover:not(:focus) {
    border-color: color-mix(in srgb, var(--text-color) 22%, transparent);
}

.auth-field .form-control::placeholder {
    color: var(--auth-muted);
    opacity: .72;
}

.auth-field .form-text {
    margin-top: .45rem;
    color: var(--auth-muted);
    font-size: .78rem;
    line-height: 1.45;
}

.auth-field-error {
    display: block;
    margin-top: .35rem;
    color: #dc3545;
    font-size: .78rem;
}

.auth-field-error:empty {
    display: none;
}

.auth-field .input-validation-error {
    border-color: #dc3545;
}

.auth-validation-summary {
    margin-bottom: 1rem;
    padding: .8rem .9rem;
    border: 1px solid color-mix(in srgb, #dc3545 30%, transparent);
    border-radius: .8rem;
    background: color-mix(in srgb, #dc3545 7%, transparent);
    color: #b02a37;
    font-size: .85rem;
}

.dark .auth-validation-summary {
    color: #ff9aa5;
}

.auth-validation-summary.validation-summary-valid,
.auth-validation-summary:empty {
    display: none;
}

.auth-validation-summary ul {
    margin: 0;
    padding-left: 1.1rem;
}

.auth-password-field {
    position: relative;
}

.auth-password-field .form-control {
    padding-right: 3.2rem;
}

.auth-password-toggle {
    position: absolute;
    top: 50%;
    right: .45rem;
    display: grid;
    place-items: center;
    width: 2.35rem;
    height: 2.35rem;
    padding: 0;
    transform: translateY(-50%);
    border: 0;
    border-radius: .65rem;
    background: transparent;
    color: var(--auth-muted);
}

.auth-password-toggle:hover,
.auth-password-toggle:focus-visible {
    background: var(--auth-surface-strong);
    color: var(--text-color);
}

.auth-password-toggle:focus-visible {
    outline: 3px solid var(--focus-main-color);
}

.auth-form-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 1.5rem;
}

.auth-form-options .form-check {
    min-height: auto;
    margin: 0;
}

.auth-form-options .form-check-label {
    color: var(--auth-muted);
    font-size: .875rem;
}

.auth-submit {
    min-height: 3.15rem;
    margin-top: .15rem;
    border-radius: .9rem;
    box-shadow: 0 10px 24px color-mix(in srgb, var(--main-color) 22%, transparent);
    font-weight: 700;
}

.auth-submit:hover {
    transform: translateY(-1px);
}

.auth-submit-glow {
    display: inline-flex;
    width: 100%;
    align-items: center;
    justify-content: center;
    padding: .75rem 1rem;
    border: 1px solid var(--main-color);
    background: var(--main-color);
    color: var(--on-main-color);
    text-align: center;
    text-decoration: none;
    transition: transform .18s ease, border-color .18s ease, background-color .18s ease,
        color .18s ease, box-shadow .18s ease;
}

.auth-submit-glow:hover,
.auth-submit-glow:focus-visible {
    border-color: var(--main-deep-color);
    background: var(--main-deep-color);
    color: var(--on-main-color);
    text-decoration: none;
}

.auth-submit-glow:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--main-color) 30%, transparent);
    outline-offset: 3px;
}

.dark .auth-submit-glow {
    border-color: #fff;
    background: #fff;
    color: #181a1b;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, .88),
        0 0 20px rgba(255, 255, 255, .34),
        0 12px 32px rgba(255, 255, 255, .2);
}

.dark .auth-submit-glow:hover,
.dark .auth-submit-glow:focus-visible {
    border-color: #fff;
    background: #fff;
    color: #111;
    outline-color: rgba(255, 255, 255, .72);
    box-shadow: 0 0 0 1px #fff,
        0 0 26px rgba(255, 255, 255, .48),
        0 14px 36px rgba(255, 255, 255, .26);
}

.dark .auth-submit-glow:active {
    border-color: #f2f2f2;
    background: #f2f2f2;
    color: #111;
}

.auth-switch {
    margin: 1.5rem 0 0;
    color: var(--auth-muted);
    font-size: .9rem;
    text-align: center;
}

.auth-switch a {
    font-weight: 650;
    text-decoration: none;
}

.auth-switch a:hover {
    text-decoration: underline;
}

.auth-security-check {
    padding: 1rem;
    border: 1px solid var(--auth-border);
    border-radius: .9rem;
    background: var(--auth-surface-strong);
}

.auth-security-title {
    display: flex;
    align-items: center;
    gap: .45rem;
    margin-bottom: .3rem;
    font-size: .9rem;
    font-weight: 700;
}

.auth-security-check p {
    margin: 0 0 .8rem;
    color: var(--auth-muted);
    font-size: .8rem;
}

.auth-code-field {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: .65rem;
}

.auth-code-button {
    min-width: 7.4rem;
    border-radius: .85rem;
    font-size: .88rem;
    font-weight: 650;
}

.auth-code-button .spinner-border {
    margin-right: .35rem;
}

.auth-turnstile {
    overflow: hidden;
    border-radius: .65rem;
}

.auth-turnstile:not(:empty) {
    margin-top: .75rem;
}

.auth-form-message {
    margin: .45rem 0 0;
    font-size: .8rem;
}

.auth-form-message.is-success {
    color: #198754;
}

.dark .auth-form-message.is-success {
    color: #62c58d;
}

.auth-form-message.is-error {
    color: #dc3545;
}

.auth-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .8rem;
}

.dark .auth-page {
    --auth-shadow: 0 28px 80px rgba(0, 0, 0, .34), 0 4px 16px rgba(0, 0, 0, .16);
}

@media (max-width: 575.98px) {
    .auth-page {
        min-height: auto;
        padding: 1rem 0 .5rem;
    }

    .auth-card {
        padding: 1.35rem 1.15rem;
        border-radius: 1.15rem;
    }

    .auth-header {
        margin-bottom: 1.4rem;
    }

    .auth-brand {
        margin-bottom: 1.15rem;
    }

    .auth-form-grid {
        grid-template-columns: 1fr;
        gap: 1.15rem;
    }

    .auth-code-field {
        grid-template-columns: 1fr;
    }

    .auth-code-button {
        min-height: 2.8rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth-submit,
    .auth-submit-glow {
        transition: none;
    }

    .auth-submit:hover {
        transform: none;
    }
}
