.auth-dialog {
    width: 100%;
    max-width: none;
    height: 100%;
    max-height: none;
    padding: 24px 16px;
    border: none;
    background: transparent;
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}

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

/* Only the dialog scrolls while it is open, not the page behind it. The padding takes the
   hidden scrollbar's place (measured in auth-dialogs.js) so the page doesn't shift. */
html:has(.auth-dialog[open]) {
    overflow: hidden;
    padding-right: var(--auth-dialog-scrollbar, 0px);
}

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

.auth-dialog__card {
    position: relative;
    margin: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    width: 100%;
    max-width: 460px;
    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: 24px;
    height: 24px;
}

.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-h4);
    line-height: 28px;
    font-weight: var(--font-weight-semibold);
    color: var(--color-heading);
}

.auth-dialog__subtitle {
    font-size: var(--font-size-xsmall);
    line-height: 18px;
    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 field / the remember row. */
.auth-dialog__message {
    display: none;
    width: 100%;
    font-size: var(--font-size-xsmall);
    line-height: 16px;
}

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

.auth-dialog__form .input__container {
    gap: 6px;
}

.auth-dialog__form .input__container label {
    font-size: var(--font-size-small);
    line-height: 20px;
    font-weight: var(--font-weight-medium);
    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 — 26px is the label (20) plus the field gap (6), so the
   icon stays centred on the input when a validation message grows the container. */
.auth-dialog__form .show_password_toggle {
    top: 26px;
    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 {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    margin: 0;
    appearance: none;
    background: #ffffff center / 10px no-repeat;
    border: 1.2px solid var(--color-light-silver);
    border-radius: 5px;
    cursor: pointer;
}

.auth-dialog__remember input:checked {
    background-color: var(--color-dark-gray);
    background-image: url("../../img/checkbox-icon.svg");
    border-color: var(--color-dark-gray);
}

.auth-dialog__remember input:focus-visible {
    outline: 2px solid var(--color-blue);
    outline-offset: 2px;
}

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

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

.auth-dialog__actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

/* 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;
}

/* `.btn-dark` draws a black ring; the Figma button is flat. */
.auth-dialog #auth_dialog_submit {
    border-color: transparent !important;
}

.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-minimum);
    line-height: 20px;
    font-weight: var(--font-weight-medium);
    color: var(--color-sub_label-gray);
    white-space: nowrap;
}

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

/* google.svg pads its glyph inside a 24px box: drawn at 24 the "G" is Figma's 20px,
   and the negative margin keeps its layout box at 20. */
.auth-dialog__google img {
    width: 24px;
    height: 24px;
    max-width: none;
    max-height: none;
    margin: -2px;
}

/* 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="register"] .auth-dialog__field-info--login {
    display: none;
}

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

    #authDialogLoader img {
        width: 90px;
    }
}
