#auth-modal {
    --auth-primary: #0f172a;
    --auth-primary-2: #172033;
    --auth-text: #111827;
    --auth-muted: #64748b;
    --auth-soft: #f8fafc;
    --auth-line: #d9e2ee;
    --auth-line-strong: #b9c6d8;
    --auth-accent: #00b894;
    --auth-accent-2: #0ea5e9;
    --auth-danger: #dc2626;
    --auth-success: #15803d;
    padding: 1.25rem;
}

#auth-modal.modal {
    background:
        linear-gradient(135deg, rgba(15, 23, 42, 0.76), rgba(15, 23, 42, 0.58)),
        rgba(15, 23, 42, 0.68);
    backdrop-filter: blur(10px);
}

#auth-modal .modal-content.auth-modal-shell {
    width: min(96vw, 980px);
    max-width: 980px;
    min-height: 620px;
    max-height: calc(100dvh - 2.5rem);
    padding: 0;
    overflow: hidden;
    overscroll-behavior: contain;
    display: grid;
    grid-template-columns: minmax(300px, 0.88fr) minmax(0, 1.12fr);
    border: 1px solid rgba(226, 232, 240, 0.92);
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 28px 70px rgba(2, 8, 23, 0.34);
}

#auth-modal.auth-register-mode .modal-content.auth-modal-shell {
    width: min(97vw, 1020px);
    max-width: 1020px;
    min-height: 660px;
    max-height: calc(100dvh - 1.5rem);
    padding: 0;
}

#auth-modal .auth-brand-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 2rem;
    min-height: 100%;
    padding: 2.4rem;
    color: #ffffff;
    background:
        linear-gradient(135deg, rgba(14, 165, 233, 0.2), rgba(0, 184, 148, 0.18) 42%, rgba(15, 23, 42, 0) 66%),
        linear-gradient(180deg, #111827 0%, #0f172a 100%);
}

#auth-modal .auth-brand-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: linear-gradient(135deg, rgba(0, 0, 0, 0.9), transparent 78%);
    pointer-events: none;
}

#auth-modal .auth-brand-panel > * {
    position: relative;
    z-index: 1;
}

#auth-modal .auth-brand-kicker {
    width: fit-content;
    padding: 0.48rem 0.64rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    line-height: 1;
    text-transform: uppercase;
}

#auth-modal .auth-brand-copy {
    display: grid;
    gap: 1rem;
}

#auth-modal .auth-brand-copy h3 {
    margin: 0;
    max-width: 14ch;
    color: #ffffff;
    font-family: 'Manrope', 'Inter', sans-serif;
    font-size: 2.25rem;
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: 0;
}

#auth-modal .auth-brand-copy p {
    margin: 0;
    max-width: 31rem;
    color: rgba(226, 232, 240, 0.86);
    font-size: 0.98rem;
    line-height: 1.65;
}

#auth-modal .auth-brand-proof {
    display: grid;
    gap: 0.7rem;
}

#auth-modal .auth-proof-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 48px;
    padding: 0.65rem 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
    font-weight: 700;
}

#auth-modal .auth-proof-icon {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    background: rgba(0, 184, 148, 0.16);
    color: #67e8f9;
    font-size: 0.82rem;
}

#auth-modal .auth-brand-signal {
    display: grid;
    grid-template-columns: 0.7fr 1fr 0.52fr;
    gap: 0.55rem;
    align-items: end;
    min-height: 72px;
}

#auth-modal .auth-brand-signal span {
    display: block;
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(103, 232, 249, 0.85), rgba(0, 184, 148, 0.38));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

#auth-modal .auth-brand-signal span:nth-child(1) {
    height: 38px;
}

#auth-modal .auth-brand-signal span:nth-child(2) {
    height: 68px;
}

#auth-modal .auth-brand-signal span:nth-child(3) {
    height: 50px;
}

#auth-modal .auth-form-panel {
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 2.35rem 2.55rem;
    overflow-y: auto;
    overflow-x: hidden;
    border-left: 1px solid #d8e1ed;
    background:
        linear-gradient(180deg, rgba(248, 250, 252, 0.9), rgba(255, 255, 255, 0) 28%),
        #fcfdff;
}

#auth-modal .modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 0 0 1.15rem;
}

#auth-modal .modal-header h2 {
    margin: 0;
    color: var(--auth-primary);
    font-family: 'Manrope', 'Inter', sans-serif;
    font-size: 1.68rem;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: 0;
}

#auth-modal .close-btn.auth-close-btn {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: #64748b;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

#auth-modal .close-btn.auth-close-btn:hover,
#auth-modal .close-btn.auth-close-btn:focus-visible {
    border-color: var(--auth-line);
    background: #f8fafc;
    color: var(--auth-primary);
    transform: translateY(-1px);
    outline: none;
}

#auth-modal .auth-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
    margin: 0 0 1rem;
    padding: 0;
    border: 1px solid #c9d4e3;
    border-radius: 7px;
    background: #f6f8fb;
    overflow: hidden;
}

#auth-modal .tab-btn {
    position: relative;
    min-height: 44px;
    padding: 0.6rem 0.8rem;
    border: 0;
    border-right: 1px solid #d8e1ed;
    border-radius: 0;
    background: transparent;
    color: #667387;
    font-size: 0.9rem;
    font-weight: 800;
    line-height: 1.15;
    cursor: pointer;
    transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

#auth-modal .tab-btn::after {
    display: none;
}

#auth-modal .tab-btn:last-child {
    border-right: 0;
}

#auth-modal .tab-btn:hover,
#auth-modal .tab-btn:focus-visible {
    color: var(--auth-primary);
    outline: none;
}

#auth-modal .tab-btn.active {
    background: #ffffff;
    color: var(--auth-primary);
    box-shadow: inset 0 -2px 0 var(--auth-primary);
}

#auth-modal .auth-method-switch {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.7rem;
    margin: 0 0 1.25rem;
}

#auth-modal .auth-method-btn {
    min-height: 50px;
    padding: 0.76rem 0.9rem;
    border: 1px solid #cbd7e6;
    border-radius: 6px;
    background: #fbfdff;
    color: #667387;
    font-size: 0.9rem;
    font-weight: 800;
    line-height: 1.2;
    cursor: pointer;
    transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

#auth-modal .auth-method-btn:hover,
#auth-modal .auth-method-btn:focus-visible {
    border-color: #7f93ad;
    color: var(--auth-primary);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.07);
    transform: translateY(-1px);
    outline: none;
}

#auth-modal .auth-method-btn.active {
    border-color: #00b894;
    background: #f5fffb;
    color: var(--auth-primary);
    box-shadow: inset 0 0 0 1px rgba(0, 184, 148, 0.22);
}

#auth-modal .auth-method-btn:disabled {
    border-color: var(--auth-line);
    background: #f8fafc;
    color: #9aa8bd;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

#auth-modal #auth-form {
    min-height: 0;
    overflow: visible;
}

#auth-modal.auth-register-mode #auth-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 1rem;
    align-items: start;
    max-height: none;
    overflow: visible;
    padding-right: 0;
}

#auth-modal.auth-register-mode #username-group {
    order: 1;
}

#auth-modal.auth-register-mode #role-group {
    order: 2;
}

#auth-modal.auth-register-mode #email-group {
    order: 3;
    grid-column: 1 / -1;
}

#auth-modal.auth-register-mode #sms-auth-group,
#auth-modal.auth-register-mode #forgot-password-entry,
#auth-modal.auth-register-mode #forgot-password-panel,
#auth-modal.auth-register-mode #password-recovery-panel,
#auth-modal.auth-register-mode #auth-submit-btn,
#auth-modal.auth-register-mode #auth-status,
#auth-modal.auth-register-mode #auth-error {
    grid-column: 1 / -1;
}

#auth-modal.auth-register-mode #sms-auth-group {
    order: 3;
}

#auth-modal.auth-register-mode #password-group {
    order: 4;
}

#auth-modal.auth-register-mode #confirm-password-group {
    order: 5;
}

#auth-modal.auth-register-mode #forgot-password-entry,
#auth-modal.auth-register-mode #forgot-password-panel,
#auth-modal.auth-register-mode #password-recovery-panel {
    order: 8;
}

#auth-modal.auth-register-mode #auth-submit-btn,
#auth-modal.auth-register-mode #auth-status,
#auth-modal.auth-register-mode #auth-error {
    order: 10;
}

#auth-modal.auth-register-mode #sms-auth-group:not(.hidden) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(128px, max-content);
    column-gap: 0.75rem;
    row-gap: 0.85rem;
    align-items: end;
    margin-bottom: 1rem;
    overflow: visible;
}

#auth-modal.auth-register-mode #sms-auth-group:has(#sms-code-group.hidden) {
    grid-template-columns: minmax(0, 1fr) minmax(128px, max-content);
}

#auth-modal.auth-register-mode #sms-auth-group .sms-phone-grid {
    display: grid;
    grid-template-columns: minmax(108px, 0.42fr) minmax(160px, 1fr);
    gap: 0.75rem;
    min-width: 0;
}

#auth-modal.auth-register-mode #sms-auth-group .form-group,
#auth-modal.auth-register-mode #sms-auth-group .sms-send-row {
    margin-bottom: 0;
}

#auth-modal.auth-register-mode #sms-auth-group .sms-send-row {
    align-self: end;
    gap: 0.25rem;
    margin-top: 0;
    min-width: 128px;
    position: relative;
    z-index: 2;
    pointer-events: auto;
}

#auth-modal.auth-register-mode #sms-auth-group .sms-send-btn {
    width: 100%;
    min-width: 128px;
    min-height: 49px;
    padding: 0.72rem 0.85rem;
    font-size: 0.86rem;
    margin-top: 0;
    white-space: nowrap;
    pointer-events: auto;
}

#auth-modal.auth-register-mode #sms-auth-group #sms-code-group {
    grid-column: 1 / -1;
}

#auth-modal.auth-register-mode #sms-auth-group .sms-send-meta {
    font-size: 0.72rem;
    line-height: 1.2;
}

#auth-modal.auth-register-mode .auth-tabs {
    margin-bottom: 1rem;
}

#auth-modal.auth-register-mode .auth-method-switch {
    margin-bottom: 1rem;
}

#auth-modal.auth-register-mode #auth-form > .form-group {
    margin-bottom: 1rem;
}

#auth-modal .form-group {
    margin-bottom: 1rem;
}

#auth-modal .form-group label {
    display: block;
    margin: 0 0 0.48rem;
    color: #334155;
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.035em;
    line-height: 1.25;
    text-transform: uppercase;
}

#auth-modal .form-group input,
#auth-modal .form-group select,
#auth-modal #password-phone-identifier-group select,
#auth-modal #reset-phone-group select,
#auth-modal .sms-auth-group select {
    width: 100%;
    min-height: 49px;
    padding: 0.78rem 0.88rem;
    border: 1px solid #b7c5d8 !important;
    border-radius: 6px;
    background: #ffffff;
    color: #111827;
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.25;
    box-shadow: inset 0 1px 0 rgba(15, 23, 42, 0.03);
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

#auth-modal .form-group input::placeholder {
    color: #7f8ca3;
    font-weight: 400;
}

#auth-modal .form-group input:hover,
#auth-modal .form-group select:hover,
#auth-modal #password-phone-identifier-group select:hover,
#auth-modal #reset-phone-group select:hover,
#auth-modal .sms-auth-group select:hover {
    border-color: #7f93ad !important;
}

#auth-modal .form-group input:focus,
#auth-modal .form-group select:focus,
#auth-modal #password-phone-identifier-group select:focus,
#auth-modal #reset-phone-group select:focus,
#auth-modal .sms-auth-group select:focus {
    border-color: #0ea5e9 !important;
    box-shadow: inset 0 0 0 1px rgba(14, 165, 233, 0.45), 0 0 0 3px rgba(14, 165, 233, 0.1);
    outline: none;
}

#auth-modal #role {
    width: 100% !important;
    padding: 0.78rem 0.9rem !important;
    border: 1px solid #b7c5d8 !important;
    border-radius: 6px !important;
}

#auth-modal .password-identifier-switch {
    display: inline-grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    align-items: center;
    gap: 0.25rem;
    width: 100%;
    padding: 0.22rem;
    margin: 0 0 0.8rem;
    border: 1px solid #cbd7e6;
    border-radius: 6px;
    background: #f6f8fb;
}

#auth-modal .password-id-btn {
    min-height: 32px;
    padding: 0.36rem 0.72rem;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    color: #667387;
    font-size: 0.76rem;
    font-weight: 800;
    line-height: 1.2;
    text-align: center;
    cursor: pointer;
    transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

#auth-modal .password-id-btn:hover,
#auth-modal .password-id-btn:focus-visible {
    color: var(--auth-primary);
    outline: none;
}

#auth-modal .password-id-btn.active {
    border-color: rgba(0, 184, 148, 0.42);
    background: #ffffff;
    color: var(--auth-primary);
    box-shadow: inset 0 0 0 1px rgba(0, 184, 148, 0.12);
}

#auth-modal .password-id-btn:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

#auth-modal .password-phone-grid {
    margin-top: 0.12rem;
}

#auth-modal .forgot-password-entry {
    display: flex;
    justify-content: flex-end;
    margin: -0.12rem 0 0.95rem;
}

#auth-modal .auth-link-btn {
    border: none;
    background: transparent;
    color: #075985;
    font-size: 0.82rem;
    font-weight: 800;
    line-height: 1.25;
    cursor: pointer;
    padding: 0;
    text-decoration: none;
}

#auth-modal .auth-link-btn:hover,
#auth-modal .auth-link-btn:focus-visible {
    color: #047857;
    text-decoration: underline;
    outline: none;
}

#auth-modal .forgot-password-panel,
#auth-modal .password-recovery-panel {
    margin: 0 0 1rem;
    padding: 1rem;
    border: 1px solid #cbd7e6;
    border-radius: 6px;
    background: linear-gradient(180deg, #ffffff, #f8fafc);
    box-shadow: inset 3px 0 0 rgba(14, 165, 233, 0.5);
}

#auth-modal .forgot-password-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.55rem;
}

#auth-modal .forgot-password-header h3 {
    margin: 0;
    color: var(--auth-primary);
    font-size: 1rem;
    font-weight: 800;
}

#auth-modal .forgot-password-hint,
#auth-modal .password-recovery-hint {
    margin: 0 0 0.9rem;
    color: var(--auth-muted);
    font-size: 0.88rem;
    line-height: 1.5;
}

#auth-modal.auth-password-recovery-mode .auth-brand-copy h3 {
    max-width: 15ch;
}

#auth-modal.auth-password-recovery-mode .auth-tabs,
#auth-modal.auth-password-recovery-mode #auth-method-switch,
#auth-modal.auth-password-recovery-mode #username-group,
#auth-modal.auth-password-recovery-mode #email-group,
#auth-modal.auth-password-recovery-mode #sms-auth-group,
#auth-modal.auth-password-recovery-mode #role-group,
#auth-modal.auth-password-recovery-mode #password-group,
#auth-modal.auth-password-recovery-mode #confirm-password-group,
#auth-modal.auth-password-recovery-mode #forgot-password-entry,
#auth-modal.auth-password-recovery-mode #forgot-password-panel,
#auth-modal.auth-password-recovery-mode #auth-submit-btn {
    display: none !important;
}

#auth-modal.auth-password-recovery-mode #password-recovery-panel {
    display: block !important;
}

#auth-modal .sms-auth-group {
    margin-bottom: 1rem;
}

#auth-modal .sms-phone-grid {
    display: grid;
    grid-template-columns: 130px minmax(0, 1fr);
    gap: 0.85rem;
}

#auth-modal #auth-form input:disabled,
#auth-modal #auth-form select:disabled {
    background: #f1f5f9;
    color: #94a3b8;
    cursor: not-allowed;
}

#auth-modal #auth-form input:disabled::placeholder {
    color: #94a3b8;
}

#auth-modal .sms-send-row {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 0.25rem 0 1rem;
}

#auth-modal .submit-btn {
    width: 100%;
    min-height: 51px;
    margin-top: 0.75rem;
    padding: 0.82rem 1rem;
    border: 1px solid transparent;
    border-radius: 6px;
    background: var(--auth-primary);
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 800;
    line-height: 1.2;
    cursor: pointer;
    box-shadow: 0 12px 22px rgba(15, 23, 42, 0.16);
    transition: background-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease, border-color 0.18s ease;
}

#auth-modal .submit-btn:hover,
#auth-modal .submit-btn:focus-visible {
    border-color: rgba(14, 165, 233, 0.2);
    background: #111f37;
    box-shadow: 0 16px 30px rgba(15, 23, 42, 0.22);
    transform: translateY(-1px);
    outline: none;
}

#auth-modal .submit-btn.secondary-submit-btn,
#auth-modal .submit-btn.sms-send-btn {
    margin-top: 0.4rem;
    background: #ffffff;
    color: var(--auth-primary);
    border-color: var(--auth-line-strong);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

#auth-modal .submit-btn.secondary-submit-btn:hover,
#auth-modal .submit-btn.secondary-submit-btn:focus-visible,
#auth-modal .submit-btn.sms-send-btn:hover,
#auth-modal .submit-btn.sms-send-btn:focus-visible {
    background: #f8fafc;
    border-color: rgba(14, 165, 233, 0.48);
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.12);
}

#auth-modal .submit-btn[disabled],
#auth-modal .sms-send-btn[disabled],
#auth-modal #auth-submit-btn[disabled] {
    cursor: not-allowed;
    opacity: 0.68;
    transform: none;
    box-shadow: none;
}

#auth-modal .sms-send-meta {
    margin: 0;
    color: var(--auth-muted);
    font-size: 0.82rem;
    line-height: 1.3;
    text-align: center;
}

#auth-modal .status-msg,
#auth-modal .error-msg {
    margin: 0.9rem 0 0;
    padding: 0.78rem 0.9rem;
    border-radius: 8px;
    font-size: 0.86rem;
    font-weight: 700;
    line-height: 1.4;
    text-align: left;
}

#auth-modal .status-msg {
    border: 1px solid rgba(14, 165, 233, 0.26);
    background: rgba(14, 165, 233, 0.08);
    color: #075985;
}

#auth-modal .status-msg.is-info {
    border-color: rgba(14, 165, 233, 0.26);
    color: #075985;
}

#auth-modal .status-msg.is-success {
    border-color: rgba(21, 128, 61, 0.26);
    background: rgba(22, 163, 74, 0.08);
    color: var(--auth-success);
}

#auth-modal .error-msg {
    border: 1px solid rgba(220, 38, 38, 0.22);
    background: rgba(220, 38, 38, 0.07);
    color: var(--auth-danger);
}

#auth-modal .auth-form-panel::-webkit-scrollbar,
#auth-modal.auth-register-mode #auth-form::-webkit-scrollbar {
    width: 8px;
}

#auth-modal .auth-form-panel::-webkit-scrollbar-thumb,
#auth-modal.auth-register-mode #auth-form::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.45);
    border-radius: 8px;
}

@media (max-width: 840px) {
    #auth-modal {
        padding: 0.8rem;
    }

    #auth-modal .modal-content.auth-modal-shell,
    #auth-modal.auth-register-mode .modal-content.auth-modal-shell {
        width: calc(100vw - 1.6rem);
        max-width: none;
        min-height: 0;
        max-height: calc(100dvh - 1.6rem);
        grid-template-columns: 1fr;
    }

    #auth-modal .auth-brand-panel {
        min-height: auto;
        padding: 1.05rem 1.15rem;
        gap: 0.85rem;
    }

    #auth-modal .auth-brand-copy {
        gap: 0.42rem;
    }

    #auth-modal .auth-brand-copy h3 {
        max-width: 100%;
        font-size: 1.15rem;
        line-height: 1.18;
    }

    #auth-modal .auth-brand-copy p {
        max-width: 100%;
        font-size: 0.86rem;
        line-height: 1.45;
    }

    #auth-modal .auth-brand-proof {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.45rem;
    }

    #auth-modal .auth-proof-item {
        min-height: 40px;
        padding: 0.48rem;
        gap: 0.45rem;
        font-size: 0.74rem;
        line-height: 1.15;
    }

    #auth-modal .auth-proof-icon {
        width: 26px;
        height: 26px;
        flex-basis: 26px;
        font-size: 0.72rem;
    }

    #auth-modal .auth-brand-kicker,
    #auth-modal .auth-brand-signal {
        display: none;
    }

    #auth-modal .auth-form-panel {
        padding: 1.2rem;
        max-height: min(66dvh, 620px);
    }

    #auth-modal .modal-header {
        margin-bottom: 1rem;
    }

    #auth-modal .modal-header h2 {
        font-size: 1.45rem;
    }

    #auth-modal.auth-register-mode #auth-form {
        display: block;
        max-height: none;
        overflow: visible;
        padding-right: 0;
    }

    #auth-modal.auth-register-mode #sms-auth-group:not(.hidden) {
        display: block;
    }

    #auth-modal.auth-register-mode #sms-auth-group .sms-phone-grid {
        display: grid;
    }

    #auth-modal.auth-register-mode #sms-auth-group .sms-send-row {
        margin: 0.25rem 0 1rem;
    }

    #auth-modal.auth-register-mode #sms-auth-group .sms-send-btn {
        width: 100%;
    }

    #auth-modal .auth-method-switch,
    #auth-modal .sms-phone-grid {
        grid-template-columns: 1fr;
    }

    #auth-modal .password-identifier-switch {
        display: grid;
        width: 100%;
    }
}

@media (max-width: 520px) {
    #auth-modal .auth-brand-panel {
        display: flex;
        padding: 0.9rem 1rem;
        gap: 0.5rem;
    }

    #auth-modal .auth-brand-copy h3 {
        font-size: 1rem;
        line-height: 1.2;
    }

    #auth-modal .auth-brand-copy p,
    #auth-modal .auth-brand-proof {
        display: none;
    }

    #auth-modal .auth-form-panel {
        max-height: min(72dvh, 620px);
        padding: 1.05rem;
    }

    #auth-modal .auth-tabs {
        grid-template-columns: 1fr;
    }

    #auth-modal .auth-method-switch {
        gap: 0.55rem;
    }

    #auth-modal .forgot-password-header {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (prefers-reduced-motion: reduce) {
    #auth-modal *,
    #auth-modal *::before,
    #auth-modal *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
