.auth-page {
    --auth-text: #162033;
    --auth-muted: #667085;
    --auth-border: #d8dee8;
    --auth-surface: #ffffff;
    --auth-surface-muted: #f6f8fb;
    --auth-danger: #b42318;
    --auth-success: #067647;
    min-height: min(720px, 72vh);
    padding: clamp(36px, 6vw, 72px) 20px;
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--primary-color) 5%, transparent), transparent 44%),
        var(--auth-surface-muted);
    color: var(--auth-text);
}

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

.auth-page__container {
    width: min(100%, 520px);
    margin: 0 auto;
}

.auth-page__container--wide {
    width: min(100%, 620px);
}

.auth-panel {
    overflow: hidden;
    border: 1px solid var(--auth-border);
    border-radius: 8px;
    background: var(--auth-surface);
    box-shadow: 0 12px 34px rgba(16, 24, 40, 0.08);
}

.auth-panel--wide {
    width: min(100%, 620px);
    margin-inline: auto;
}

.auth-panel__header {
    padding: 28px 30px 22px;
    border-bottom: 1px solid #e9edf3;
}

.auth-panel__back {
    display: inline-flex;
    min-height: 36px;
    align-items: center;
    gap: 7px;
    margin: -6px 0 14px -8px;
    padding: 5px 8px;
    border-radius: 4px;
    color: var(--auth-muted);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}

.auth-panel__back:hover {
    background: var(--auth-surface-muted);
    color: var(--primary-color);
}

.auth-panel__title {
    margin: 0;
    color: var(--auth-text);
    font-size: clamp(25px, 4vw, 31px);
    font-weight: 750;
    letter-spacing: -0.025em;
    line-height: 1.2;
}

.auth-panel__description {
    max-width: 52ch;
    margin: 8px 0 0;
    color: var(--auth-muted);
    font-size: 15px;
    line-height: 1.55;
}

.auth-panel__body {
    padding: 26px 30px 30px;
}

.auth-panel__footer {
    padding: 16px 30px;
    border-top: 1px solid #e9edf3;
    background: #fbfcfd;
    color: var(--auth-muted);
    font-size: 14px;
    text-align: center;
}

.auth-panel a:not(.auth-panel__back) {
    color: var(--primary-color);
    font-weight: 650;
    text-underline-offset: 3px;
}

.auth-form {
    display: grid;
    gap: 20px;
}

.auth-field {
    min-width: 0;
}

.auth-field__label {
    display: inline-block;
    margin-bottom: 7px;
    color: #344054;
    font-size: 14px;
    font-weight: 650;
    line-height: 1.4;
}

.auth-field__control {
    position: relative;
}

.auth-field__icon {
    position: absolute;
    top: 50%;
    left: 14px;
    z-index: 2;
    color: #667085;
    font-size: 18px;
    transform: translateY(-50%);
    pointer-events: none;
}

.auth-field .form-control {
    width: 100%;
    height: 44px;
    min-height: 44px;
    padding: 0 44px 0 42px;
    border: 1px solid #b9c2cf;
    border-radius: 6px;
    background: var(--auth-surface);
    color: var(--auth-text);
    font-size: 16px;
    line-height: 1.4;
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

.auth-field .form-control::placeholder {
    color: #98a2b3;
}

.auth-field .form-control:focus {
    border-color: var(--primary-color);
    outline: 0;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-color) 16%, transparent);
}

.auth-field .form-control.is-invalid {
    border-color: var(--auth-danger);
}

.auth-field .invalid-feedback {
    display: block;
    margin-top: 6px;
    color: var(--auth-danger);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
}

.auth-password-toggle {
    position: absolute;
    top: 50%;
    right: 4px;
    z-index: 3;
    display: inline-flex;
    width: 38px;
    height: 38px;
    align-items: center;
    justify-content: center;
    transform: translateY(-50%);
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: #475467;
    cursor: pointer;
}

.auth-password-toggle:hover {
    background: var(--auth-surface-muted);
    color: var(--auth-text);
}

.auth-password-toggle:focus-visible,
.auth-panel a:focus-visible,
.auth-submit:focus-visible,
.auth-secondary-action:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--primary-color) 28%, transparent);
    outline-offset: 2px;
}

.auth-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.auth-check {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    gap: 9px;
    color: #475467;
    font-size: 14px;
    cursor: pointer;
}

.auth-check .form-check-input {
    width: 18px;
    height: 18px;
    min-width: 18px;
    min-height: 18px;
    flex: 0 0 18px;
    margin: 0;
    padding: 0;
    border: 1px solid #98a2b3;
    border-radius: 3px;
    appearance: none;
    display: grid;
    place-content: center;
    background: #fff;
    cursor: pointer;
}

.auth-check .form-check-input::before {
    content: "";
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: translateY(-1px) rotate(45deg) scale(0);
    transition: transform 120ms ease;
}

.auth-check .form-check-input:checked {
    border-color: var(--primary-color);
    background-color: var(--primary-color);
}

.auth-check .form-check-input:checked::before {
    transform: translateY(-1px) rotate(45deg) scale(1);
}

.auth-check .form-check-input:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--primary-color) 28%, transparent);
    outline-offset: 2px;
}

.auth-submit,
.auth-secondary-action {
    display: inline-flex;
    height: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 16px;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
    cursor: pointer;
    transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

.auth-submit {
    width: 100%;
    border: 1px solid var(--primary-color);
    background: var(--primary-color);
    color: #fff;
}

.auth-submit:hover {
    border-color: color-mix(in srgb, var(--primary-color) 82%, black);
    background: color-mix(in srgb, var(--primary-color) 82%, black);
}

.auth-submit:disabled,
.auth-secondary-action:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.auth-secondary-action {
    border: 1px solid var(--auth-border);
    background: var(--auth-surface);
    color: #344054;
}

.auth-secondary-action:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.auth-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.auth-actions .auth-submit {
    width: auto;
    flex: 1;
}

.auth-alert {
    padding: 12px 14px;
    border: 1px solid #a6dfc2;
    border-radius: 5px;
    background: #ecfdf3;
    color: var(--auth-success);
    font-size: 14px;
    line-height: 1.5;
}

.auth-text-button {
    min-height: 44px;
    padding: 8px;
    border: 0;
    background: transparent;
    color: var(--primary-color);
    font-size: 14px;
    font-weight: 650;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

@media (max-width: 575.98px) {
    .auth-page {
        min-height: auto;
        padding: 24px 12px 36px;
    }

    .auth-panel {
        border-radius: 6px;
        box-shadow: 0 8px 24px rgba(16, 24, 40, 0.07);
    }

    .auth-panel__header,
    .auth-panel__body {
        padding-inline: 20px;
    }

    .auth-panel__header {
        padding-block: 22px 18px;
    }

    .auth-panel__body {
        padding-block: 22px 24px;
    }

    .auth-panel__footer {
        padding-inline: 20px;
    }

    .auth-options,
    .auth-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .auth-actions .auth-secondary-action,
    .auth-actions .auth-submit {
        width: 100%;
    }
}

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

@supports not (color: color-mix(in srgb, black, white)) {
    .auth-page {
        background: var(--auth-surface-muted);
    }

    .auth-field .form-control:focus,
    .auth-password-toggle:focus-visible,
    .auth-panel a:focus-visible,
    .auth-submit:focus-visible,
    .auth-secondary-action:focus-visible {
        box-shadow: 0 0 0 3px rgba(0, 95, 204, 0.16);
    }
}
