.auth-dialog {
    width: 100%;
    max-width: none;
    height: 100%;
    max-height: none;
    padding: 10px;
    border: none;
    background: transparent;
    overflow: auto;
}

/* Only on [open], so the UA's `dialog:not([open]){display:none}` still hides it. */
.auth-dialog[open] {
    display: flex;
    justify-content: center;
}

.auth-dialog::backdrop {
    background: rgba(0, 0, 0, 0.15);
}

.auth-dialog__card {
    position: relative;
    margin: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    width: 100%;
    max-width: 540px;
    height: max-content;
    padding: 32px;
    background: #ffffff;
    border-radius: 24px;
}

/* Same veil the login/register pages put over `.login__container`, but keyed off its
   own id so it cannot collide with the `#ajaxloaderwrapper` the tool pages already have. */
#authDialogLoader {
    display: none;
    position: absolute;
    inset: 0;
    align-items: center;
    justify-content: center;
    z-index: 7;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 24px;
}

#authDialogLoader img {
    width: 120px;
}

.auth-dialog__close {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    padding: 0;
    background: none;
    border: none;
    cursor: pointer;
}

.auth-dialog__close img {
    width: 12px;
    height: 12px;
}

.auth-dialog__avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    border-radius: 99px;
    background: linear-gradient(180deg, #e1e2e5 0%, #d0d2d8 100%);
}

.auth-dialog__avatar img {
    width: 40px;
    height: 40px;
}

.auth-dialog__heading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    width: 100%;
    text-align: center;
}

.auth-dialog__title {
    font-size: var(--font-size-h2);
    line-height: 40px;
    font-weight: var(--font-weight-semibold);
    color: var(--color-heading);
}

.auth-dialog__subtitle {
    font-size: var(--font-size-default);
    line-height: 24px;
    color: var(--color-dark-gray);
}

.auth-dialog__subtitle .auth-dialog__switch,
.auth-dialog .link {
    color: var(--color-blue);
    cursor: pointer;
}

/* Sits last in the form, under the password hint / the remember row. */
.auth-dialog__message {
    display: none;
    width: 100%;
    font-size: var(--font-size-xsmall);
    line-height: 16px;
}

.auth-dialog__form {
    padding-top: 20px;
}

.auth-dialog__form .input__container label {
    font-size: var(--font-size-small);
    line-height: 20px;
    font-weight: var(--font-weight-semibold);
    color: var(--color-heading);
}

.auth-dialog__form .input__container .input {
    height: 50px;
    padding: 0 10px;
    border: 1px solid var(--color-light-silver);
    line-height: 20px;
}

.auth-dialog__form .input__container .input[name="password"] {
    padding-right: 40px;
}

.auth-dialog__form .input__container .input::placeholder {
    color: var(--color-sub_label-gray);
}

/* Spans the input box only — 30px is the label (20) plus the field gap (10), so the
   icon stays centred on the input when a validation message grows the container. */
.auth-dialog__form .show_password_toggle {
    top: 30px;
    right: 10px;
    display: flex;
    align-items: center;
    height: 50px;
}

.auth-dialog__form .show_password_toggle img {
    width: 20px;
    height: 20px;
    padding-right: 0;
}

.auth-dialog__form .show_password_toggle span {
    display: none;
}

.auth-dialog .js-auth-error:empty {
    display: none;
}

.auth-dialog__field-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--gap-small);
    width: 100%;
}

.auth-dialog__remember {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: var(--font-size-xsmall);
    line-height: 16px;
    color: var(--color-dark-gray);
    cursor: pointer;
}

.auth-dialog__remember input {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--color-heading);
    cursor: pointer;
}

.auth-dialog__field-info .link {
    font-size: var(--font-size-xsmall);
    line-height: 16px;
}

.auth-dialog__hint {
    font-size: var(--font-size-xsmall);
    line-height: 16px;
    color: var(--color-sub_label-gray);
}

.auth-dialog__captcha:empty {
    display: none;
}

/* Fixed height so the 18px text keeps the buttons at Figma's 40px regardless of
   the 1px border `.btn` adds and the 1.35 body line-height. */
.auth-dialog #auth_dialog_submit,
.auth-dialog .auth-dialog__google {
    height: 40px;
    padding: 10px 30px !important;
    line-height: 20px;
    border-radius: 99px;
}

.auth-dialog__divider {
    display: flex;
    align-items: center;
    gap: 18px;
    width: 100%;
}

.auth-dialog__divider::before,
.auth-dialog__divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--color-light-silver);
}

.auth-dialog__divider span {
    font-size: var(--font-size-small);
    line-height: 20px;
    font-weight: var(--font-weight-light);
    color: var(--color-sub_label-gray);
    white-space: nowrap;
}

.auth-dialog__google {
    color: var(--color-heading) !important;
}

/* Panels: fields shown depend on the mode the dialog was opened in. */
.auth-dialog[data-mode="login"] .auth-dialog__field--register,
.auth-dialog[data-mode="login"] .auth-dialog__field-info--register,
.auth-dialog[data-mode="register"] .auth-dialog__field-info--login {
    display: none;
}

@media (max-width: 768px) {
    .auth-dialog__card {
        gap: 16px;
        padding: 16px;
    }

    .auth-dialog__heading {
        gap: 4px;
    }

    .auth-dialog__title {
        font-size: 30px;
        line-height: 36px;
    }

    .auth-dialog__form {
        gap: 16px;
        padding-top: 16px;
    }

    #authDialogLoader img {
        width: 90px;
    }
}
