.auth-dialog {
    position: relative;
    width: min(100%, 460px);
    margin: 24px auto;
    padding: 28px;
    border: 1px solid var(--site-line);
    border-radius: var(--site-radius);
    background: #fff;
    color: var(--site-ink);
    box-shadow: 0 20px 64px rgba(20, 40, 62, .22);
}

#register-dialog {
    width: min(100%, 530px);
}

.auth-dialog .mfp-close {
    top: 14px;
    right: 14px;
    width: 36px;
    height: 36px;
    border: 1px solid var(--site-line);
    border-radius: 9px;
    background: var(--site-surface);
    font-size: 0;
    opacity: 1;
}

.auth-dialog .mfp-close::before,
.auth-dialog .mfp-close::after {
    top: 50%;
    left: 50%;
    width: 14px;
    height: 2px;
    border-radius: 1px;
    background-color: var(--site-muted);
    content: "";
}

.auth-dialog .mfp-close::before {
    transform: translate(-50%, -50%) rotate(45deg);
}

.auth-dialog .mfp-close::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

.auth-dialog .mfp-close:hover {
    transform: none;
    background: #e4edf5;
}

.auth-logo {
    display: block;
    width: 135px;
    height: auto;
    margin-bottom: 18px;
}

.auth-dialog h2 {
    margin: 0 34px 18px 0;
    color: var(--site-ink);
    font-size: clamp(23px, 4vw, 29px);
    font-weight: 700;
    line-height: 1.2;
}

.auth-description,
.auth-referral {
    margin: -6px 0 16px;
    color: var(--site-muted);
    font-size: 14px;
    line-height: 1.5;
}

.auth-form {
    display: grid;
    gap: 13px;
    margin: 0;
}

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

.auth-field label {
    display: block;
    margin: 0 0 5px;
    color: var(--site-ink);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
}

.auth-dialog .auth-field input {
    box-sizing: border-box;
    width: 100%;
    height: 44px;
    margin: 0;
    padding: 0 12px;
    border: 1px solid #b9cddd;
    border-radius: 9px;
    background: var(--site-surface);
    box-shadow: none;
    color: var(--site-ink);
    font-size: 16px;
}

.auth-dialog :is(a, button, input):focus-visible {
    outline: 2px solid var(--site-focus);
    outline-offset: 2px;
}

.auth-password {
    position: relative;
}

.auth-dialog .auth-password input {
    padding-right: 46px;
}

.auth-dialog .auth-password-toggle {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 36px;
    height: 36px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--site-muted);
    cursor: pointer;
}

.auth-password-toggle:hover {
    background: #e4edf5;
}

.auth-dialog .auth-button {
    display: flex;
    width: 100%;
    min-height: 43px;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 8px 14px;
    border: 1px solid var(--site-line);
    border-radius: 9px;
    background: #fff;
    color: var(--site-ink);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
    text-align: center;
    cursor: pointer;
}

.auth-dialog .auth-primary {
    border-color: var(--site-blue);
    background: var(--site-blue);
    color: #fff;
}

.auth-dialog .auth-primary:hover {
    background: var(--site-ink);
}

.auth-dialog .auth-secondary:hover {
    background: var(--site-surface);
}

.auth-dialog .auth-primary:disabled {
    opacity: .7;
    cursor: wait;
}

.auth-recover {
    justify-self: end;
    margin-top: -4px;
}

.auth-recover,
.auth-switch a {
    color: var(--site-blue);
    font-size: 14px;
    font-weight: 600;
}

.auth-recover:hover,
.auth-switch a:hover {
    color: var(--site-ink);
    text-decoration: underline;
}

.auth-switch {
    margin: 16px 0 0;
    color: var(--site-muted);
    font-size: 14px;
    line-height: 1.45;
    text-align: center;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 12px 0;
    color: var(--site-muted);
    font-size: 13px;
    line-height: 1.3;
}

.auth-divider::before,
.auth-divider::after {
    flex: 1;
    height: 1px;
    background: var(--site-line);
    content: "";
}

.auth-dialog .auth-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 36px;
    margin: 0;
    color: var(--site-ink);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    cursor: pointer;
}

#register-dialog .auth-checkbox input[type="checkbox"] {
    flex: none;
    width: 18px;
    height: 18px;
    margin: 0;
    padding: 0;
    accent-color: var(--site-blue);
    cursor: pointer;
}

.auth-dialog [hidden],
.auth-dialog .field-validation-valid {
    display: none;
}

.auth-dialog .field-validation-error {
    display: block;
    margin-top: 4px;
    color: #a33b3b;
    font-size: 13px;
    line-height: 1.4;
}

.auth-dialog .auth-field .input-validation-error {
    border-color: #a33b3b;
}

.auth-feedback {
    margin: 0;
    padding: 9px 11px;
    border-radius: 8px;
    background: #fff1f1;
    color: #872f2f;
    font-size: 14px;
    line-height: 1.4;
}

.auth-feedback[data-state="success"] {
    background: #eaf7ef;
    color: #206048;
}

@media (min-width: 540px) {
    #register-dialog .auth-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    #register-dialog .auth-form > :nth-child(n+5) {
        grid-column: 1 / -1;
    }
}

@media (max-width: 539px) {
    .auth-dialog {
        margin: 14px auto;
        padding: 22px 18px;
    }

    .auth-dialog .mfp-close {
        top: 10px;
        right: 10px;
    }
}
