:root {
    --payam-bg-gradient: linear-gradient(
        135deg,
        var(--payam-primary-color) 0%,
        var(--payam-primary-color-shade) 100%
    );

    --payam-space-lg: 2rem;
    --payam-space-md: 1rem;
    --payam-space-sm: 0.5rem;
    /* Inner controls (inputs, buttons, selects) share this radius; the card itself
       uses the larger --payam-card-radius so it reads like the wp-login fallback. */
    --payam-border-radius: 0.6875rem;
    --payam-card-radius: 1.125rem;
    /* Focus halo, built from the (admin-customizable) primary color, so both the
       shortcode forms and the wp-login fallback share the same focus language. */
    --payam-focus-ring-color: color-mix(
        in srgb,
        var(--payam-primary-color) 16%,
        transparent
    );

    --payam-fs-base: 1rem;
    --payam-fs-lg: 1.25rem;
    --payam-fs-sm: 0.875rem;

    --payam-transition-duration: 0.2s;

    --payam-container-max-width: calc(100% - 2 * var(--payam-space-lg));
    /* Fixed 396px like the wp-login fallback card (width:100% / max-width:396px), so
       both forms are the same size on desktop; --payam-container-max-width still
       narrows it (with side gutters) on screens too small to hold 396px. The old
       clamp() was viewport-driven (8.75dvw), so on a normal desktop it landed well
       under 396px and never matched the fallback. */
    --payam-container-width: 24.75rem;

    --payam-brand-logo-width: 3rem;
}

.payam-fs-base {
    font-size: var(--payam-fs-base);
}
.payam-fs-lg {
    font-size: var(--payam-fs-lg);
}
.payam-fs-sm {
    font-size: var(--payam-fs-sm);
}

.payam-text-color {
    color: var(--payam-text-color);
}

.payam-text-color-lead {
    color: var(--payam-text-color-lead);
}
.payam-text-color-primary {
    color: var(--payam-primary-color);
}
.payam-text-color-bg {
    color: var(--payam-bg-color);
}

.payam-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
}

/*
 * The login/register switcher forms wrap both .payam-auth-container cards in
 * this extra div (only one is ever visible; the other sits at display:none).
 * Without an explicit width, this div has no CSS at all -- as a flex item of
 * .payam-wrapper it falls back to shrink-to-fit sizing, which resolves
 * against the auth-container's own *preferred* width (its fixed 24.75rem,
 * since percentages don't count toward preferred-width). That fixes this
 * div's width at 24.75rem -- and only then does the auth-container's own
 * `max-width: calc(100% - 2 * var(--payam-space-lg))` get resolved, now
 * against that same 24.75rem instead of .payam-wrapper's real (much wider)
 * width, clamping the card several rem narrower than intended. Giving this
 * div the same `width: 100%` + centering .payam-wrapper already has breaks
 * the circularity: its width becomes definite and independent of its
 * children, so max-width resolves against the real wrapper width again --
 * matching how the standalone (non-switcher) forms already render.
 */
.switcher-form {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
}

.payam-auth-container {
    /* Modern glassy card: a soft primary-tinted glow plus a gentle vertical gradient
       built from the admin bg color, lightly frosted -- the wp-login fallback look,
       adapted to the (customizable) shortcode colors. Kept mostly opaque so the
       floating labels still mask their field borders cleanly. */
    background:
        radial-gradient(125% 125% at 100% 0%,
            color-mix(in srgb, var(--payam-primary-color) 9%, transparent) 0%,
            transparent 46%),
        linear-gradient(158deg,
            color-mix(in srgb, var(--payam-bg-color) 90%, transparent) 0%,
            color-mix(in srgb, var(--payam-bg-color) 97%, transparent) 100%);
    -webkit-backdrop-filter: blur(12px) saturate(1.25);
    backdrop-filter: blur(12px) saturate(1.25);
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;

    color: var(--payam-text-color);

    position: relative;
    /* border-box so the 396px width is the OUTER size -- padding + border live
       inside it -- exactly like the wp-login fallback card (which is border-box via
       its reset). Without this the card was content-box and rendered ~458px wide. */
    box-sizing: border-box;
    max-width: var(--payam-container-max-width);
    width: var(--payam-container-width);
    padding: 2.125rem 1.875rem 1.75rem;
    box-shadow:
        0 24px 50px -26px rgba(31, 39, 51, 0.4),
        inset 0 1px 0 color-mix(in srgb, #fff 35%, transparent);
    border-radius: var(--payam-card-radius);
    border: 1px solid color-mix(in srgb, var(--payam-border-color) 72%, transparent);

    && > * {
        flex: 1 1 100%;
        max-width: 100%;
    }
}

.payam-back-btn {
    position: absolute;
    padding: 0.5rem;
    background: transparent;
    border-radius: 100%;
    border: none;
    aspect-ratio: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    color: var(--payam-text-color);
    font-weight: bold;
    transition: box-shadow 0.4s ease-out;
}

#payam-back-btn:focus,
#payam-back-btn.payam-back-btn:focus-visible {
    outline-width: 0 !important;
}

.payam-login-popup-btn,
.payam-register-popup-btn,
.payam-register-login-popup-btn {
    cursor: pointer;
    background: transparent;
    border: unset;
    outline: unset;
    font-family: inherit;
    display: flex;
}

.switch-to-register,
.switch-to-login {
    cursor: pointer;
    text-decoration: underline;

    &&:hover {
        text-decoration: none;
    }
}

.clicked {
    animation: clicked 0.1s ease-out;
}

button.loading {
    animation: blink 1.8s infinite ease-in-out;
    /* animation: loading 2s infinite; */
    cursor: progress !important;
}

.raise {
    animation: raise 0.7s ease-out;
}

@keyframes blink {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0.3;
    }
}

@keyframes raise {
    0% {
        scale: 0.5;
        opacity: 0;
    }
    85% {
        scale: 1.15;
        opacity: 1;
    }
    92% {
        scale: 0.95;
    }
    97% {
        scale: 1.05;
    }
    100% {
        scale: 1;
    }
}

@keyframes clicked {
    0% {
        transform: translateX("-2px");
        box-shadow: 0 0 10px rgba(0, 0, 0, 0.125);
        transform: scale(1);
    }
    30% {
        transform: translateX("2px");
        box-shadow: 0 0 15px 5px rgba(0, 0, 0, 0.225);
    }
    50% {
        box-shadow: 0 0 15px rgba(0, 0, 0, 0) 0 0 20px rgba(0, 0, 0, 0.3);
        transform: scale(1.1);
    }
    90% {
        transform: translateX("0");
        box-shadow: 0 0 15px rgba(0, 0, 0, 0) 0 0 30px 10px rgba(0, 0, 0, 0.225);
    }
    100% {
        box-shadow: 0 0 36px rgba(0, 0, 0, 0);
        transform: scale(1);
    }
}

.payam-brand {
    text-align: center;
    margin-bottom: var(--payam-space-md);

    img {
        width: var(--payam-brand-logo-width);
        display: inline-flex;
        margin-inline: auto;
        /* aspect-ratio: 1; */
    }
}

.payam-auth-title {
    text-align: center;
    font-size: var(--payam-fs-lg);
    color: var(--payam-text-color);
    font-weight: bold;
    margin-bottom: var(--payam-space-lg);
}

.payam-auth-title:has(+ .payam-auth-desc) {
    margin-bottom: 0;
}

.payam-auth-desc {
    text-align: center;
    font-size: var(--payam-fs-sm);
    color: var(--payam-text-color-lead);
    margin-bottom: var(--payam-space-lg);
}

.payam-form-group {
    position: relative;
    margin-bottom: var(--payam-space-md);

    .payam-notify {
        display: none;
        font-size: var(--payam-fs-sm);
        margin-block-start: var(--payam-space-sm);
        color: var(--payam-error-color);
        transition: all 0.3s ease;
    }

    label {
        position: absolute;

        inset-inline-start: calc(var(--payam-space-md) - var(--payam-space-sm));
        inset-block-start: var(--payam-space-md);
        padding-inline: var(--payam-space-sm);

        background-color: transparent;
        outline: transparent;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        z-index: 1;

        color: var(--payam-text-color-lead);
        font-size: var(--payam-fs-sm);
        font-weight: 300;

        border-radius: 2rem;

        transition: all var(--payam-transition-duration) ease-out;
    }

    button,
    input,
    textarea {
        font-family: inherit;
    }

    input {
        width: calc(100%);
        max-width: 100%;
        box-sizing: border-box;
        padding-block: var(--payam-space-md);
        padding-inline: var(--payam-space-md);

        color: var(--payam-text-color);
        background-color: var(--payam-bg-color);
        border-radius: var(--payam-border-radius);
        border: 1px solid var(--payam-border-color);
        -webkit-transition: all var(--payam-transition-duration) ease-out;

        font-size: var(--payam-fs-base);
        direction: ltr;

        transition: border-color 0.3s ease;

        outline: none;
        box-shadow: none;
        appearance: none;
    }

    input[type="text"] {
        color: var(--payam-text-color);
    }

    input:-webkit-autofill,
    input:-webkit-autofill:hover,
    input:-webkit-autofill:focus,
    input:-webkit-autofill:active {
        -webkit-box-shadow: 0 0 0 30px var(--payam-bg-color) inset !important;
        -webkit-text-fill-color: var(--payam-text-color) !important;
        border-color: color-mix(
            in srgb,
            var(--payam-primary-color) 20%,
            var(--payam-border-color)
        ) !important;
    }

    input:hover {
        border-color: color-mix(
            in srgb,
            var(--payam-primary-color) 20%,
            var(--payam-border-color)
        );
    }

    input:focus {
        border-color: var(--payam-primary-color);
    }

    input:focus-visible {
        outline: 1px solid var(--payam-primary-color);
        /* outline-offset: 2px; */
    }

    input:active,
    input:valid,
    input:not(:placeholder-shown) {
        outline: none;
        box-shadow: none;
        appearance: none;
        border-color: color-mix(
            in srgb,
            var(--payam-primary-color) 20%,
            var(--payam-border-color)
        );
    }

    input::placeholder {
        font-size: var(--wp-p-fs-label);
        color: transparent;
    }

    input:not(:placeholder-shown):valid,
    .valid {
        border-color: var(--payam-success-color);
        background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" fill="%2328a745" viewBox="0 0 16 16"><path d="M13.485 1.431a.75.75 0 0 1 1.03 1.06l-8 8a.75.75 0 0 1-1.06 0l-4-4a.75.75 0 0 1 1.06-1.06l3.47 3.47 7.5-7.47z"/></svg>');
        background-repeat: no-repeat;
        background-position: calc(100% - var(--payam-space-md)) center;
        background-size: var(--payam-space-md);
    }

    input[type="password"]:not(:placeholder-shown):valid,
    input[name="user_pass"]:not(:placeholder-shown):valid {
        /* background-image: none; */
        background-position: calc(100% - 2.5 * var(--payam-space-md)) center;
    }

    input:not(:placeholder-shown):invalid,
    .invalid {
        border-color: var(--payam-error-color) !important;
        background-image: none !important;
        color: var(--payam-error-color);
    }

    label[for]:has(+ input[required]:not(:placeholder-shown))::after {
        /* color: var(--payam-success-color); */
    }
    label[for]:has(+ input[required])::after {
        content: " * ";
        color: var(--payam-error-color);
        font-weight: bold;
        vertical-align: middle;
    }

    input:not(:placeholder-shown):invalid + .payam-notify,
    input.invalid:has(+ .payam-notify) + .payam-notify {
        display: block;
    }

    label:has(+ input:focus-visible),
    label:has(+ input:not(:placeholder-shown)) {
        inset-block-start: calc(-1 * var(--payam-space-md) + 0.25rem);
        inset-inline-start: var(--payam-space-md);

        background-color: var(--payam-bg-color);
        color: var(--payam-text-color);

        font-weight: 500;
        font-size: calc(0.9 * var(--payam-fs-base));
    }

    label:has(+ input.invalid) {
        color: var(--payam-error-color);
    }

    input[type="number"]::-webkit-outer-spin-button,
    input[type="number"]::-webkit-inner-spin-button {
        -webkit-appearance: none;
        margin: 0;
    }
    input[type="number"] {
        -moz-appearance: textfield;
    }

    input[type="password"],
    input#user_pass {
        padding-inline-start: var(--payam-space-md);
    }
}

/*
 * Focus halo -- the same language as the wp-login fallback (a soft 4px ring in the
 * primary color). Declared after the .payam-form-group block so it wins over the
 * `box-shadow: none` that the :valid / :not(:placeholder-shown) states set on a
 * filled field. Covers <select>/<textarea> from payam-custom-form.css too.
 */
.payam-form-group input:focus,
.payam-form-group select:focus,
.payam-form-group textarea:focus {
    border-color: var(--payam-primary-color);
    box-shadow: 0 0 0 4px var(--payam-focus-ring-color);
}

.payam-form-group input:focus-visible,
.payam-form-group select:focus-visible,
.payam-form-group textarea:focus-visible {
    outline: none;
}

html[dir="rtl"],
.rtl {
    input[type="password"],
    input#user_pass,
    input#user_confirm_pass {
        padding-inline-start: calc(3 * var(--payam-space-md));
    }

    .toggle-password {
        left: var(--payam-space-md);
        right: unset;
    }

    input[type="password"]:not(:placeholder-shown):valid,
    input[name="user_pass"]:not(:placeholder-shown):valid {
        /* background-image: none; */
        background-position: calc(100% - var(--payam-space-md)) center;
    }
}

:root {
    --payam-check-size: 0.5rem;
}

.payam-form-group:has(input#user_pass.strong):before {
    position: absolute;
    color: var(--payam-success-color);
    background-color: var(--payam-bg-color);
    width: var(--payam-check-size);
    font-size: var(--payam-check-size);
    inset-inline-end: -0.25rem;
    inset-block-start: 0;
    border-start-end-radius: var(--payam-border-radius);
    border-end-end-radius: var(--payam-border-radius);
    box-sizing: content-box;
    display: flex;
    justify-content: center;
    align-content: center;
}

.payam-form-group:has(input#user_pass.lvl-0):before {
    content: "✓";
    transform: translateY(
        calc(var(--payam-fs-lg) / 2 + var(--payam-check-size) * 2)
    );
    color: var(--payam-text-color-lead);
}
.payam-form-group:has(input#user_pass.lvl-1):before {
    content: "✓";
    transform: translateY(
        calc(var(--payam-fs-lg) / 2 + var(--payam-check-size) * 2)
    );
    color: var(--payam-error-color);
}
.payam-form-group:has(input#user_pass.lvl-2):before {
    content: "✓";
    transform: translateY(
        calc(var(--payam-fs-lg) / 2 + var(--payam-check-size) * 2)
    );
}

.payam-form-group:has(input#user_pass.lvl-3):before {
    content: "✓ ✓";
    transform: translateY(
        calc(var(--payam-fs-lg) / 2 + var(--payam-check-size))
    );
}

.payam-form-group:has(input#user_pass.lvl-4):before {
    content: "✓ ✓ ✓";
    transform: translateY(calc(var(--payam-fs-lg) / 2));
}

.payam-login-popup,
.payam-register-popup,
.payam-register-login-popup {
    /*
     * Measure the card's side gutters against the viewport, not against a
     * percentage of its parent.
     *
     * The default is `calc(100% - 2 * var(--payam-space-lg))`, and `100%` there
     * means "of .payam-wrapper". Inline that is the page column and everything is
     * fine, but inside this overlay the wrapper is shrink-to-fit (it has to be --
     * see the note on .payam-wrapper below), so its width comes *from* the card:
     * the card's preferred 24.75rem, since percentages do not count toward
     * preferred width. The max-width then resolved against that same 24.75rem and
     * clamped the card to 20.75rem -- every popup form rendered 4rem narrower
     * than the identical inline one.
     *
     * `vw` does not depend on the containing block, so the circularity is gone
     * and the wrapper can stay shrink-to-fit. Same defect .switcher-form had in
     * 03ec089, but it cannot be fixed the same way here: giving this wrapper a
     * definite width would cover the click-to-close filter.
     */
    --payam-container-max-width: calc(100vw - 2 * var(--payam-space-lg));

    /*
     * The mobile :root override further down cannot reach the card here -- this
     * selector declares the same property closer to it, so it wins whatever the
     * media query says. The overlay needs its own value anyway: it is
     * position:fixed over the whole viewport, with no theme column to inherit
     * edge spacing from, so unlike the inline card it does need a gutter. Just a
     * much smaller one than 2rem.
     */
    @media (max-width: 600px) {
        --payam-container-max-width: calc(100vw - 2 * var(--payam-space-md));
    }

    display: none;
    position: fixed;
    inset: 0;
    z-index: 100;
    /* display: flex; */
    justify-content: center;

    /*
     * flex-start, not center. A centred flex item that outgrows its container
     * overflows in BOTH directions, and the part above the top edge cannot be
     * scrolled to -- there is no scroll position before the start. Measured with
     * the profile open at 375x480: the card is 583px tall, sat at top: -51px, and
     * 51px of it was permanently unreachable.
     *
     * The wrapper below gets `margin-block: auto` instead, which still centres
     * the card whenever there is room and simply collapses to 0 when there is
     * not -- so the card can never start above the viewport.
     */
    align-items: flex-start;

    /* Backstop for the case the capped card still cannot fit (very short
       viewport, large font). `contain` keeps the page behind from scrolling with
       it, which is what makes a dialog feel like a dialog. */
    overflow-y: auto;
    overscroll-behavior: contain;

    .payam-popup-filter {
        /* fixed, not absolute: an absolutely positioned child of a scrolling
           container scrolls away with the content, which would leave the lower
           part of a scrolled overlay unfiltered -- and unclickable for closing. */
        position: fixed;
        inset: 0;
        background-color: rgba(255, 255, 255, 0.8);
        -webkit-backdrop-filter: blur(0.5rem) saturate(20%);
        backdrop-filter: blur(0.5rem) saturate(20%);

        z-index: 101;
    }

    /*
     * `width: auto` is deliberate and must stay. This wrapper sits at z-index 120,
     * above .payam-popup-filter, and the filter is what the JS binds the
     * click-to-close handler to. A full-width wrapper covers the filter to the
     * left and right of the card, so clicking beside the form stops closing the
     * popup -- it reads as a broken dialog. Shrink-to-fit keeps the wrapper no
     * wider than the card, leaving the rest of the overlay clickable.
     *
     * The narrow-card bug this used to cause is fixed at its source instead: see
     * the --payam-container-max-width override on the overlay above.
     */
    .payam-wrapper {
        position: relative;
        z-index: 120;
        width: auto;
        height: fit-content;

        /* auto on the block axis: centres while there is free space, collapses
           to 0 when there is not. See the note on align-items above. */
        margin: auto var(--payam-space-sm);
    }

    /*
     * The card never grows past the viewport; it scrolls inside itself instead.
     *
     * This is what the profile needed: it is the tallest thing either popup can
     * hold (583px against a 480px-tall phone in landscape or a small window), and
     * without a cap the overflow went off both edges with the top unreachable.
     *
     * The vh line is a fallback for browsers without dvh; dvh is what tracks
     * mobile browser chrome collapsing as the user scrolls, so the card does not
     * jump when the address bar hides.
     */
    .payam-auth-container {
        /* space-sm, matching the wrapper's own inline margin: a bigger reserve
           would start capping cards that fit perfectly well. The auto block
           margins split whatever is left, so the gutter lands evenly. */
        max-height: calc(100vh - 2 * var(--payam-space-sm));
        max-height: calc(100dvh - 2 * var(--payam-space-sm));
        overflow-y: auto;
        overscroll-behavior: contain;
    }
}

.toggle-password {
    position: absolute;
    inset-block-start: 0;
    transform: translateY(var(--payam-fs-lg));
    right: var(--payam-space-md);
    left: unset;
    cursor: pointer;
    line-height: 0;
    color: var(--payam-text-color-lead);
}

.toggle-link {
    font-size: var(--payam-fs-sm);
    color: var(--payam-text-color);
    text-align: center;
    margin-top: var(--payam-space-md);
    cursor: pointer;
    user-select: none;

    a {
        color: var(--payam-primary-color);
        text-decoration: underline;
    }
    a:hover {
        text-decoration: double;
    }
}

button.submit-btn,
.submit-btn {
    width: 100%;
    padding-block: var(--payam-space-md);
    padding-inline: var(--payam-space-md);

    background: var(--payam-bg-gradient);
    /* Soft, reasonable lift -- a low-opacity tint of the primary, not a full-color glow. */
    -webkit-box-shadow: 0 8px 18px -10px color-mix(in srgb, var(--payam-primary-color) 45%, transparent);
    box-shadow: 0 8px 18px -10px color-mix(in srgb, var(--payam-primary-color) 45%, transparent);
    color: var(--payam-bg-color);
    border: none;
    border-radius: var(--payam-border-radius);
    font-size: var(--payam-fs-base);
    cursor: pointer;
    font-weight: bold;
    transition: filter var(--payam-transition-duration) ease-in,
        box-shadow var(--payam-transition-duration) ease-in,
        transform 0.08s ease-in;
}

button.submit-btn:hover {
    filter: brightness(1.05);
    -webkit-box-shadow: 0 12px 22px -10px color-mix(in srgb, var(--payam-primary-color) 55%, transparent);
    box-shadow: 0 12px 22px -10px color-mix(in srgb, var(--payam-primary-color) 55%, transparent);
}

button.submit-btn:active {
    transform: translateY(1px);
}

.submit-btn#logout {
    max-width: fit-content;
    padding-inline: var(--payam-space-lg);
    margin-inline: auto;
}

.payam-form-group.column-half {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    margin-bottom: var(--payam-space-md);
    font-size: var(--payam-fs-base);
}
@media (min-width: 576px) {
    /*
     * A half-width group only shrinks to 50% when it actually has a half-width
     * neighbour immediately before or after it. Some layouts render a lone
     * .column-half -- the OTP login shows only "Forgot password", the register form
     * only "Already registered?", and "Not registered?" drops out when registration
     * is closed -- and a lone half at 50% would leave dead space beside it, so it
     * falls back to the container's default full width.
     */
    .payam-form-group.column-half:has(+ .payam-form-group.column-half),
    .payam-form-group.column-half + .payam-form-group.column-half {
        flex: 1 1 50%;
        max-width: 50%;
        justify-content: space-between;
    }
}
#otp_code {
    letter-spacing: 0.5rem;
    font-family: monospace;
    text-align: center;
}
.payam-form-group.otp-timer {
    font-size: var(--payam-fs-sm);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    line-height: 1rem;
    min-height: 2lh;

    && > * {
        margin-block: 0;
    }

    && #otp-timer-end {
        display: none;
        margin-inline: auto;
        color: var(--payam-primary-color);
    }
}

.register-terms {
    font-size: var(--payam-fs-sm);

    a {
        color: var(--payam-primary-color);
    }
}

.popup-container {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #55555599;
    /* padding: var(--payam-space-md); */
    backdrop-filter: blur(4px);

    .popup-content {
        width: min(100%, 35rem);
        border-radius: var(--payam-border-radius);
        border: 1px solid var(--payam-border-color);
        box-shadow: var(--wp--preset--shadow--natural);
        background: var(--payam-bg-color);
        padding: var(--payam-space-lg);
        margin: var(--payam-space-sm);
        z-index: 100;
        animation: raise 0.3s ease-in;
        max-height: 80%;
        overflow-y: auto;
    }

    .close-btn {
        cursor: pointer;
        width: 1rem;
        height: 1rem;
        aspect-ratio: 1;
    }
}

.hidden {
    display: none;
}

#toast-notification {
    display: none; /* Hidden by default */
    position: fixed;
    inset-inline-start: var(--payam-space-lg);
    inset-block-start: var(--payam-space-lg);
    height: fit-content;
    width: fit-content;
    max-width: calc(100% - 3 * var(--payam-space-lg));
    margin: auto;

    padding: 15px 20px;
    border-radius: 4px;
    color: #fff;
    font-family: sans-serif;
    font-size: 14px;
    z-index: 9999; /* Ensure it stays on top */
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    cursor: pointer; /* Indicates it can be clicked to dismiss */
}

/* Success State (Green) */
.toast-success {
    background-color: var(--payam-success-color);
}

/* Error State (Red) */
.toast-error {
    background-color: var(--payam-error-color);
}

/* Info State (Red) */
.toast-info {
    background-color: var(--payam-info-color);
}

#otp-timer-counter {
    display: inline-block;
    width: 5ch; /* 5 کاراکتر عرض ثابت */
    text-align: center;
    font-family: monospace; /* برای نمایش دقیق عرض با توجه به کاراکترها */
}

button#otp-timer-end {
    background: transparent;
    border: 0;
    color: var(--payam-primary-color);
    text-decoration: underline;
    cursor: pointer;
}

/* Responsive: Full width on mobile screens */
@media (max-width: 600px) {

    /*
     * --payam-space-lg is a desktop gutter (2rem), and the card's default
     * max-width spends it on both sides. On a 320px phone that is 64px -- a fifth
     * of the screen -- and the card came out 224px wide, which is what made the
     * mobile form read as narrow and stretched-out: the same fields in less
     * width means more wrapping and a taller card.
     *
     * Inline, the card needs no gutter of its own at all. It sits in the theme's
     * content column, which already provides the page's edge spacing; adding a
     * second gutter inside it just double-counts. Let it fill the column.
     *
     * Measured with headless Chromium at 320/360/375/414/480px -- see the popup
     * override below for the overlay, which has no theme column to inherit from.
     */
    :root {
        --payam-container-max-width: 100%;
    }

    #toast-notification {
        inset: 0;
        display: none;
        justify-items: center;
        border-radius: 0;
        text-align: center;
    }
}

/* --------------- */
/* --- Captcha --- */
/* --------------- */

.payam-captcha-challenge {
    display: flex;
    align-items: center;
    gap: var(--payam-space-sm);
    margin-bottom: var(--payam-space-sm);
    position: relative;
}

.payam-captcha-image {
    display: block;
    height: 61px;
    width: auto;
    border: 1px solid var(--payam-border-color, #ddd);
    border-radius: var(--payam-border-radius);
    background: #fff;
}

.payam-captcha-question {
    display: inline-block;
    padding: 0.75rem 1rem;
    border: 1px solid var(--payam-border-color, #ddd);
    border-radius: var(--payam-border-radius);
    font-family: monospace;
    font-size: var(--payam-fs-lg);
    letter-spacing: 0.2em;
    direction: ltr;
    user-select: none;
}

button.payam-captcha-refresh {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    background: transparent;
    border: 0;
    color: var(--payam-primary-color);
    cursor: pointer;
    transition: transform var(--payam-transition-duration);
    position: absolute;
    right: -1rem;
    background: var(--payam-bg-color);
    border-radius: 100%;
    color: var(--payam-text-color);
    border-left: 1px solid var(--payam-border-color);
}

button.payam-captcha-refresh:hover {
    transform: rotate(-45deg);
}

.payam-captcha-answer {
    direction: ltr;
    text-align: center;
}

.payam-captcha-v3 {
    display: none;
}

.payam-captcha-builtin > label {
    display: none;
}

.payam-captcha-builtin {
    display: flex;
    gap: var(--payam-space-md);
}

.payam-captcha-builtin .payam-captcha-challenge {
    margin-bottom: unset;
}
