body.auth-modal-open {
    overflow: hidden;
}

#authModal .auth-brand-logo {
    display: flex;
    min-height: 2.75rem;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.25rem;
}

#authModal .auth-brand-logo > a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    max-width: min(14rem, 75%);
}

#authModal .auth-brand-logo-image {
    display: block;
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: 2.75rem;
    object-fit: contain;
}

#authModal .auth-brand-logo-image.theme-logo-dark {
    display: none;
}

html.dark #authModal .auth-brand-logo-image.theme-logo-light,
.dark #authModal .auth-brand-logo-image.theme-logo-light {
    display: none;
}

html.dark #authModal .auth-brand-logo-image.theme-logo-dark,
.dark #authModal .auth-brand-logo-image.theme-logo-dark {
    display: block;
}

#authModal .auth-login-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

#authModal .auth-remember-label {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    color: var(--auth-muted);
    font-size: .875rem;
    line-height: 1.25rem;
    cursor: pointer;
    user-select: none;
}

#authModal .auth-remember-checkbox {
    width: 1rem;
    height: 1rem;
    margin: 0;
    border: 1px solid var(--auth-field-border);
    border-radius: .25rem;
    accent-color: hsl(var(--primary));
    cursor: pointer;
}

#authModal .auth-remember-checkbox:focus-visible {
    outline: 2px solid hsl(var(--primary) / .45);
    outline-offset: 2px;
}

#authModal {
    --auth-overlay: rgba(0, 0, 0, .40);
    --auth-card-bg: hsl(var(--background));
    --auth-card-border: transparent;
    --auth-text: hsl(var(--foreground));
    --auth-muted: hsl(var(--muted-foreground));
    --auth-field-bg: transparent;
    --auth-field-border: hsl(var(--input));
    --auth-soft-bg: hsl(var(--muted) / .50);
    --auth-soft-border: hsl(var(--border));
    --auth-primary-text: var(--theme-primary-text-on-light, hsl(var(--primary)));
    --auth-focus-shadow: 0 0 0 3px hsl(var(--primary) / .20), 0 4px 6px -1px rgba(15, 23, 42, .12);
    --auth-card-shadow: 0 25px 50px -12px rgba(0, 0, 0, .25);
    background-color: var(--auth-overlay) !important;
    background-image: linear-gradient(135deg,
        hsl(var(--primary) / .20),
        rgba(15, 23, 42, .40),
        hsl(var(--primary) / .16)) !important;
    color: var(--auth-text);
}

html.dark #authModal,
.dark #authModal {
    --auth-overlay: rgba(0, 0, 0, .40);
    --auth-card-bg: hsl(var(--background));
    --auth-card-border: transparent;
    --auth-text: hsl(var(--foreground));
    --auth-muted: hsl(var(--muted-foreground));
    --auth-field-bg: transparent;
    --auth-field-border: hsl(var(--input));
    --auth-soft-bg: hsl(var(--muted) / .50);
    --auth-soft-border: hsl(var(--border));
    --auth-primary-text: var(--theme-primary-text-on-dark, hsl(var(--primary)));
    --auth-focus-shadow: 0 0 0 3px hsl(var(--primary) / .24), 0 4px 6px -1px rgba(0, 0, 0, .35);
    --auth-card-shadow: 0 25px 50px -12px rgba(0, 0, 0, .55);
}

body.rb-theme #authModal > .bicrypto-auth-dialog,
#authModal > .bicrypto-auth-dialog {
    width: 95vw !important;
    max-width: min(36rem, calc(100% - 2rem)) !important;
    max-height: 90vh !important;
    background: linear-gradient(to bottom,
        hsl(var(--background)),
        hsl(var(--background) / .95)) !important;
    border: 0 !important;
    border-radius: .75rem !important;
    color: var(--auth-text) !important;
    box-shadow: var(--auth-card-shadow) !important;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    isolation: isolate;
    transition: opacity .2s ease, transform .2s ease;
}

#authModal .auth-modal-orb {
    position: absolute;
    display: block;
    width: 16rem;
    height: 16rem;
    border-radius: 999px;
    background: hsl(var(--primary) / .10);
    filter: blur(64px);
    opacity: 1;
}

#authModal .auth-modal-orb-top {
    top: -6rem;
    left: -6rem;
}

#authModal .auth-modal-orb-bottom {
    right: -6rem;
    bottom: -6rem;
}

html.dark #authModal .auth-modal-orb,
.dark #authModal .auth-modal-orb {
    opacity: 1;
}

#authModal.flex > .bicrypto-auth-dialog {
    animation: auth-card-enter .2s ease-out both;
}

#authModal .auth-panel:not(.hidden) {
    animation: auth-panel-enter .2s ease-out both;
}

@keyframes auth-card-enter {
    from { opacity: 0; transform: translateY(10px) scale(.985); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes auth-panel-enter {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

#authModal .auth-content,
#authModal .auth-security-wrap {
    position: relative;
    z-index: 1;
}

#authModal #loginTitle {
    color: var(--auth-text) !important;
    letter-spacing: 0;
}

#authModal #forgotTitle,
#authModal #resetTitle,
#authModal #registerTitle {
    background-image: linear-gradient(to right, var(--auth-primary-text), hsl(var(--primary) / .70));
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent !important;
    -webkit-text-fill-color: transparent;
    letter-spacing: 0;
}

#authModal .text-muted-foreground {
    color: var(--auth-muted) !important;
}

#authModal .text-primary {
    color: var(--auth-primary-text) !important;
}

#authModal .auth-close {
    display: inline-flex;
    width: 1.5rem;
    height: 1.5rem;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: .25rem;
    background: transparent;
    color: var(--auth-muted);
    opacity: .70;
    transition: color .18s ease, opacity .18s ease, background .18s ease;
}

#authModal .auth-close:hover,
#authModal .auth-close:focus {
    color: var(--auth-text);
    opacity: 1;
    outline: 0;
}

#authModal .auth-field {
    position: relative;
}

#authModal .auth-field-select::after {
    position: absolute;
    right: .85rem;
    top: 50%;
    width: .5rem;
    height: .5rem;
    border-right: 2px solid var(--auth-muted);
    border-bottom: 2px solid var(--auth-muted);
    content: "";
    pointer-events: none;
    transform: translateY(-65%) rotate(45deg);
    transition: border-color .18s ease;
}

#authModal .auth-field-select:focus-within::after {
    border-color: var(--auth-primary-text);
}

#authModal .auth-input-shell {
    border: 1px solid var(--auth-field-border);
    background: var(--auth-field-bg);
    border-radius: .375rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .05);
    transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

#authModal .auth-soft-panel {
    border: 1px solid var(--auth-soft-border);
    background: var(--auth-soft-bg);
    border-radius: .5rem;
    box-shadow: none;
}

#authModal .auth-input-shell {
    display: flex;
    min-height: 3rem;
    align-items: center;
    padding: .75rem .75rem .75rem 2.5rem;
}

#authModal .auth-input-shell.has-action {
    padding-right: 2.5rem;
}

#authModal .auth-input-shell.has-select {
    padding-right: 2.35rem;
}

html.dark #authModal .auth-input-shell,
.dark #authModal .auth-input-shell {
    box-shadow: 0 1px 2px rgba(0, 0, 0, .24);
}

#authModal .auth-input-shell:hover {
    border-color: hsl(var(--primary) / .38);
}

.dark #authModal .auth-input-shell:hover {
    border-color: hsl(var(--primary) / .46);
}

#authModal .auth-input-shell:focus-within {
    border-color: var(--auth-primary-text);
    box-shadow: var(--auth-focus-shadow);
    transform: translateY(-4px);
}

html.dark #authModal .auth-input-shell:focus-within,
.dark #authModal .auth-input-shell:focus-within {
    border-color: var(--auth-primary-text);
}

#authModal :is(#registerPanel, #forgotPanel, #resetPanel) .auth-input-shell {
    border-radius: .5rem;
}

#authModal :is(#registerPanel, #forgotPanel, #resetPanel) .auth-input-shell:focus-within {
    box-shadow: 0 0 0 2px hsl(var(--primary) / .20), 0 4px 6px -1px rgba(15, 23, 42, .10);
    transform: none;
}

body.rb-theme #authModal input.auth-input,
body.rb-theme #authModal select.auth-input,
#authModal .auth-input {
    width: 100%;
    min-width: 0;
    min-height: 0 !important;
    height: 1.5rem;
    margin: 0;
    padding: 0;
    border: 0;
    border-color: transparent !important;
    border-radius: 0 !important;
    outline: 0;
    background: transparent !important;
    color: var(--auth-text) !important;
    caret-color: var(--auth-text);
    font-size: 1rem;
    line-height: 1.5rem;
    box-shadow: none !important;
}

#authModal .auth-input::placeholder {
    color: var(--auth-muted);
    opacity: .82;
}

#authModal .auth-select {
    cursor: pointer;
    appearance: none;
}

#authModal .auth-select option {
    background: #ffffff;
    color: #111827;
}

.dark #authModal .auth-select option {
    background: #111827;
    color: #f9fafb;
}

#authModal .auth-input:focus::placeholder {
    opacity: .58;
}

#authModal .auth-icon {
    position: absolute;
    left: .75rem;
    top: 50%;
    width: 1.25rem;
    height: 1.25rem;
    color: var(--auth-muted);
    pointer-events: none;
    transform: translateY(-50%);
    transition: color .18s ease, opacity .18s ease;
}

#authModal .auth-field:focus-within .auth-icon {
    color: var(--auth-primary-text);
}

.dark #authModal .auth-field:focus-within .auth-icon {
    color: var(--auth-primary-text);
}

#authModal .auth-password-toggle {
    position: absolute;
    right: .75rem;
    top: 50%;
    display: inline-flex;
    width: 1.25rem;
    height: 1.25rem;
    align-items: center;
    justify-content: center;
    color: var(--auth-muted);
    transform: translateY(-50%);
    transition: color .18s ease;
}

#authModal .auth-password-toggle:hover,
#authModal .auth-password-toggle:focus {
    color: var(--auth-primary-text);
    outline: 0;
}

#authModal .auth-password-toggle:focus-visible,
#authModal .auth-close:focus-visible,
#authModal .text-primary:focus-visible {
    border-radius: .35rem;
    box-shadow: 0 0 0 3px hsl(var(--primary) / .22);
    outline: 0;
}

#authModal .auth-password-toggle svg,
#authModal .auth-submit-icon,
#authModal .auth-security-icon svg {
    width: 1.25rem;
    height: 1.25rem;
}

#authModal .auth-submit {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    border: 0;
    border-radius: .375rem;
    background: hsl(var(--primary));
    padding: .75rem 1rem;
    color: hsl(var(--primary-foreground));
    font-size: 1rem;
    font-weight: 500;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .08);
    min-height: 3rem;
    transition: background .18s ease, opacity .18s ease, box-shadow .18s ease;
}

#authModal .auth-submit-gradient {
    background-image: linear-gradient(to right, hsl(var(--primary)), hsl(var(--primary) / .90));
    box-shadow: 0 8px 20px hsl(var(--primary) / .18);
}

#authModal .auth-submit:hover {
    background-color: hsl(var(--primary) / .90);
    box-shadow: 0 2px 5px rgba(15, 23, 42, .12);
}

#authModal .auth-submit-gradient:hover {
    background-image: linear-gradient(to right, hsl(var(--primary) / .90), hsl(var(--primary)));
    box-shadow: 0 10px 24px hsl(var(--primary) / .22);
}

#authModal .auth-submit:focus-visible {
    box-shadow: 0 0 0 3px var(--auth-card-bg), 0 0 0 6px hsl(var(--primary) / .28), 0 12px 30px hsl(var(--primary) / .26);
    outline: 0;
}

#authModal .auth-submit:disabled {
    cursor: not-allowed;
    opacity: .5;
}

#authModal .submit-loader:not(.hidden) {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
}

#authModal .submit-loader::before {
    width: 1rem;
    height: 1rem;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 999px;
    content: "";
    animation: auth-spin .7s linear infinite;
}

@keyframes auth-spin {
    to { transform: rotate(360deg); }
}

#authModal .auth-message {
    border-radius: .5rem;
    padding: 1rem;
    font-size: .875rem;
    box-shadow: none;
}

#authModal .auth-message-success {
    border: 1px solid rgba(16, 185, 129, .30);
    background: linear-gradient(to bottom, rgba(16, 185, 129, .16), rgba(5, 150, 105, .08));
    color: rgb(5, 150, 105);
}

.dark #authModal .auth-message-success {
    color: rgb(110, 231, 183);
}

#authModal .auth-message-error {
    border: 1px solid rgba(239, 68, 68, .30);
    background: linear-gradient(to bottom, rgba(239, 68, 68, .14), rgba(220, 38, 38, .08));
    color: rgb(220, 38, 38);
}

.dark #authModal .auth-message-error {
    color: rgb(252, 165, 165);
}

#authModal .auth-soft-panel {
    padding: .75rem;
    background: var(--auth-soft-bg);
    border-color: var(--auth-soft-border);
}

#authModal .auth-password-meter {
    height: .35rem;
    overflow: hidden;
    border-radius: 999px;
    background: var(--auth-soft-border);
}

#authModal .auth-password-meter-bar {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: hsl(var(--primary));
    transition: width .2s ease, background .2s ease;
}

#authModal .auth-password-meter-bar[data-score="0"] {
    width: 0;
    background: #94a3b8;
}

#authModal .auth-password-meter-bar[data-score="1"] {
    width: 20%;
    background: #ef4444;
}

#authModal .auth-password-meter-bar[data-score="2"] {
    width: 40%;
    background: #f59e0b;
}

#authModal .auth-password-meter-bar[data-score="3"] {
    width: 60%;
    background: #eab308;
}

#authModal .auth-password-meter-bar[data-score="4"] {
    width: 80%;
    background: hsl(var(--primary));
}

#authModal .auth-password-meter-bar[data-score="5"] {
    width: 100%;
    background: #10b981;
}

#authModal .auth-password-strength {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: .65rem;
    color: var(--auth-muted);
}

#authModal .auth-password-strength.hidden,
#authModal .auth-password-meter.hidden {
    display: none !important;
}

#authModal .auth-password-rules {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .35rem .75rem;
    margin: .65rem 0 0;
}

#authModal .auth-password-rules.hidden {
    display: none !important;
}

#authModal .auth-password-rule {
    display: flex;
    align-items: center;
    gap: .4rem;
    min-width: 0;
}

#authModal .auth-password-rule span {
    width: .35rem;
    height: .35rem;
    flex: 0 0 auto;
    border-radius: 999px;
    background: #94a3b8;
}

#authModal .auth-password-rule.is-met {
    color: rgb(5, 150, 105) !important;
}

.dark #authModal .auth-password-rule.is-met {
    color: rgb(110, 231, 183) !important;
}

#authModal .auth-password-rule.is-met span {
    background: rgb(16, 185, 129);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, .12);
}

#authModal .auth-security-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    color: var(--auth-muted);
    font-size: .75rem;
    text-align: center;
}

#authModal .auth-security-wrap {
    border-top: 0;
}

#authModal .auth-security-item {
    display: inline-flex;
    min-width: 0;
    align-items: center;
    justify-content: center;
    gap: .5rem;
}

#authModal .auth-security-item span {
    min-width: 0;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

#authModal .auth-security-icon {
    display: flex;
    width: 2rem;
    height: 2rem;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: hsl(var(--primary) / .10);
    color: var(--auth-primary-text);
}

#authModal .auth-security-divider {
    width: 1px;
    height: 1rem;
    background: var(--auth-soft-border);
}

.dark #authModal .auth-security-divider {
    background: rgba(255, 255, 255, .10);
}

#authModal .auth-input:disabled {
    cursor: not-allowed;
    opacity: .62;
}

#authModal input:-webkit-autofill,
#authModal input:-webkit-autofill:hover,
#authModal input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--auth-text) !important;
    box-shadow: 0 0 0 1000px var(--auth-field-bg) inset !important;
    transition: background-color 9999s ease-in-out 0s;
}

html.dark #authModal input:-webkit-autofill,
html.dark #authModal input:-webkit-autofill:hover,
html.dark #authModal input:-webkit-autofill:focus,
.dark #authModal input:-webkit-autofill,
.dark #authModal input:-webkit-autofill:hover,
.dark #authModal input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--auth-text) !important;
}

@media (max-width: 640px) {
    #authModal {
        padding: 0 !important;
        align-items: center;
    }

    body.rb-theme #authModal > .bicrypto-auth-dialog,
    #authModal > .bicrypto-auth-dialog {
        width: 95vw !important;
        max-height: 90vh !important;
    }

    #authModal .auth-modal-scroll {
        max-height: 90vh !important;
        padding-top: 0 !important;
        padding-bottom: 2rem !important;
    }

    #authModal .auth-content {
        padding: 2rem !important;
    }

    #authModal .auth-security-wrap {
        padding: .5rem 2rem 2rem !important;
    }

    #authModal #loginTitle,
    #authModal #forgotTitle,
    #authModal #resetTitle,
    #authModal #registerTitle {
        font-size: 1.875rem !important;
        line-height: 2.25rem !important;
    }

    #authModal .auth-security-row {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: .75rem;
        text-align: center;
    }

    #authModal .auth-security-item {
        flex-direction: column;
        gap: .35rem;
    }

    #authModal .auth-security-item span {
        font-size: .75rem;
    }

    #authModal .auth-security-divider {
        display: none;
    }

    #authModal .auth-password-rules {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    #authModal.flex > .bicrypto-auth-dialog,
    #authModal .auth-panel:not(.hidden),
    #authModal .submit-loader::before {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
    }

    #authModal *,
    #authModal *::before,
    #authModal *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
    }
}
