.auth-card, .auth-dialog {
    --auth-header-top: 28px;
    --auth-motion: 160ms ease-out;
}
.auth-card {
    --brand-control-height: 44px;
    --brand-control-padding: 10px 20px;
    --brand-control-font-size: 16px;
    --brand-button-height: 44px;
    --brand-button-padding: 10px 20px;
}
.auth-card__header { margin-bottom: 24px; }
.auth-card h1:focus { outline: none; }
.auth-card .form-group { margin-bottom: 16px; }
.auth-card .invalid-feedback,
.auth-card .help-block-error,
.auth-card .has-error .help-block,
.auth-card .alert-danger { color: var(--brand-error); }
.auth-card label { color: inherit; font-weight: 400; }
.auth-card .iti { width: 100%; }
.auth-card .iti input.iti__tel-input { display: block; }
.auth-card .iti__selected-country { align-items: center; }
.auth-card .iti__selected-dial-code {
    display: flex;
    align-items: center;
    align-self: stretch;
    line-height: 1;
}

.auth-card .iti--allow-dropdown .iti__country-container:not(:has(+ input:is(:disabled, [readonly])))
    .iti__selected-country:where(:hover, :focus-visible, [aria-expanded="true"]):not([aria-disabled="true"]) {
    background: #edf3fe;
    color: var(--brand-primary);
    outline-offset: -2px;
}

/* The fullscreen picker is appended to the document body by intl-tel-input. */
body:has(.auth-card .iti__selected-country[aria-expanded="true"]) > .iti--fullscreen-popup {
    --iti-mobile-popup-margin: clamp(12px, 4vw, 24px);
    background: rgb(35 49 78 / 22%);
}

:is(.auth-card .iti--inline-dropdown, body:has(.auth-card .iti__selected-country[aria-expanded="true"]) > .iti--fullscreen-popup) .iti__dropdown-content {
    padding: 6px;
    overflow: hidden;
    border: 1px solid #e2e7ef;
    border-radius: var(--brand-button-radius);
    background: #fff;
    box-shadow: 0 8px 24px rgb(26 44 78 / 14%);

    & .iti__search-input {
        flex: none;
        width: 100%;
        height: 44px;
        margin: 0 0 6px;
        padding: 10px 12px;
        border: 1px solid var(--brand-border);
        border-radius: var(--brand-button-radius);
        background: #fff;
        color: #202124;
        font: 400 16px/22px Roboto, sans-serif;
    }

    & .iti__search-input:focus {
        outline: none;
        border-color: var(--brand-primary);
    }

    & .iti__country-list {
        min-height: 0;
        margin: 0;
        padding: 0;
        overflow-y: auto;
        overscroll-behavior: contain;
        white-space: normal;
    }

    & .iti__country {
        gap: 8px;
        min-height: 44px;
        padding: 8px 12px;
        border-radius: var(--brand-button-radius);
        color: #202124;
        font: 500 14px/1.35 Roboto, sans-serif;
    }

    & .iti__country:is(:hover, .iti__highlight, .iti__active) {
        background: #edf3fe;
        color: var(--brand-primary);
    }

    & :is(.iti__country-name, .iti__flag-box) { margin-inline: 0; }
    & .iti__country-name { min-width: 0; overflow-wrap: anywhere; }
    & .iti__flag-box { flex: none; }
    & .iti__dial-code {
        flex: none;
        margin-inline-start: auto;
        color: #656e81;
        font-variant-numeric: tabular-nums;
    }
    & .iti__country:is(:hover, .iti__highlight, .iti__active) .iti__dial-code { color: inherit; }
}

.auth-card .brand-button[type=submit],
.auth-card .brand-button.btn-block { display: flex; width: 100%; text-transform: none; font-size: 16px; }
.auth-card__links { text-align: center; margin-top: 16px; }
.auth-card__muted { color: #656e81; }
.auth-card #login-method-tabs { display: flex; gap: 6px; padding-bottom: 5px; margin: 0 0 18px; }
.auth-card #login-method-tabs > li { flex: 1; margin: 0; text-align: center; }
.auth-card #login-method-tabs a { margin: 0; border: 0; border-radius: var(--brand-button-radius); color: inherit; }
.auth-card #login-method-tabs a.active { background: #e7eefc; color: var(--brand-primary); font-weight: 600; }
.auth-card #login-method-tabs a:hover { background: #edf3fe; color: var(--brand-primary); }
.auth-card :is(#login-method-email, #login-method-phone, #phone-login-step-code) { animation: auth-content-in var(--auth-motion); }
.auth-card__social { margin-top: 26px; }
.auth-card__divider { display: flex; gap: 12px; align-items: center; justify-content: center; text-align: center; color: #656e81; }
.auth-card__divider::before, .auth-card__divider::after { content: ""; flex: 1; height: 1px; background: #dde2e9; }
.auth-card.brand-controls .auth-clients {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 56px));
    gap: clamp(6px, 2.5vw, 14px);
    margin-bottom: 0;
}
.auth-card .auth-clients a.auth-link {
    display: grid; place-items: center; width: 100%; height: 54px; padding: 4px;
    border: 1px solid #e2e7ef; border-radius: var(--brand-button-radius); background: #f8faff;
}
.auth-card .auth-clients .auth-link img { display: block; width: 30px; height: 30px; max-width: 100%; }
.auth-card .auth-clients .auth-link:hover { border-color: var(--brand-primary); background: #edf3fe; }
.auth-card :is(button, a):is(:focus, :active),
.auth-dialog__close:is(:focus, :active) {
    outline: none;
    box-shadow: none;
}
.auth-card :is(button, a):focus-visible,
.auth-dialog__close:focus-visible {
    outline: 2px solid var(--brand-focus);
    outline-offset: 2px;
}
.auth-card .brand-input-icon { right: 16px; }
.auth-card .brand-input-with-icon:where(:focus-within, :has(.iti__selected-country[aria-expanded="true"])) {
    --auth-field-accent: var(--brand-primary);
}

.auth-card .brand-input-with-icon:where(.has-error *, :has(input:not(.iti__search-input):is(:invalid, .is-invalid, [aria-invalid="true"]))) {
    --auth-field-accent: var(--brand-error);
}

.auth-card.brand-controls .brand-input-with-icon input:not(.iti__search-input) {
    border-color: var(--auth-field-accent, var(--brand-border));
    transition: border-color var(--auth-motion);
}

.auth-card.brand-controls .brand-input-with-icon :is(.brand-input-icon, .brand-password-toggle) {
    color: var(--auth-field-accent, #68717d);
    transition: color var(--auth-motion);
}

.auth-card.brand-controls .brand-input-with-icon .brand-password-toggle:hover {
    color: var(--auth-field-accent, var(--brand-primary));
}

.auth-dialog {
    box-sizing: border-box;
    width: min(calc(100vw - 24px), 480px);
    width: min(calc(100dvw - 24px), 480px);
    max-width: none;
    max-height: calc(100dvh - 24px);
    padding: 0;
    border: 0;
    border-radius: 20px;
    background: #fff;
    color: #303544;
    box-shadow: 0 12px 34px rgb(26 44 78 / 24%);
    overflow: hidden;
    opacity: 0;
    transform: translateY(8px) scale(.99);
    transition: opacity var(--auth-motion), transform var(--auth-motion),
        display var(--auth-motion) allow-discrete, overlay var(--auth-motion) allow-discrete;
}
.auth-dialog[open] { opacity: 1; transform: none; }
.auth-dialog::backdrop { background: transparent; backdrop-filter: blur(0); transition: background-color var(--auth-motion), backdrop-filter var(--auth-motion), display var(--auth-motion) allow-discrete, overlay var(--auth-motion) allow-discrete; }
.auth-dialog[open]::backdrop { background: rgb(35 49 78 / 22%); backdrop-filter: blur(3px); }
@starting-style {
    .auth-dialog[open] { opacity: 0; transform: translateY(8px) scale(.99); }
    .auth-dialog[open]::backdrop { background: transparent; backdrop-filter: blur(0); }
}
/* Content behind the dialog must not widen the mobile viewport. */
html:has(.auth-dialog[open]) { overflow-x: clip; }
body:has(.auth-dialog[open]) { overflow: hidden; }
.auth-dialog > .auth-dialog__close { position: absolute; z-index: 1; top: var(--auth-header-top); right: 16px; }
.auth-dialog__status, .auth-dialog > p:has(a:not([hidden])) { min-height: 96px; padding: 38px 64px 24px 24px; margin: 0; }
.auth-dialog > p:has(a[hidden]) { display: none; }
.auth-dialog__frame { display: block; width: 100%; max-height: calc(100dvh - 24px); border: 0; }
.auth-dialog__frame[hidden] { display: none; }
body.auth-frame { margin: 0; background: #fff; }
.auth-frame .auth-card { width: 100%; margin: 0; border-radius: 0; box-shadow: none; animation: auth-content-in var(--auth-motion); }
@keyframes auth-content-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
    .auth-card, .auth-dialog { --auth-motion: 0ms; }
}
