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

#auth-modal {
    padding: 1rem;
}

#auth-modal .modal-content {
    max-width: 560px;
    width: min(94vw, 560px);
    max-height: calc(100dvh - 2rem);
    overflow: hidden;
    overscroll-behavior: contain;
    display: flex;
    flex-direction: column;
}

#auth-modal #auth-form {
    overflow: visible;
}

#auth-modal.auth-register-mode #auth-form {
    max-height: min(62dvh, 560px);
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 0.25rem;
}

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

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

.auth-method-btn {
    border: 1px solid var(--border);
    background: #f8fafc;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    padding: 0.85rem 1rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.auth-method-btn:hover {
    border-color: var(--accent);
    color: var(--primary);
}

.auth-method-btn.active {
    background: rgba(0, 196, 204, 0.08);
    border-color: var(--accent);
    color: var(--primary);
    box-shadow: inset 0 0 0 1px rgba(0, 196, 204, 0.1);
}

.auth-method-btn:disabled {
    border-color: var(--border);
    background: #f8fafc;
    color: #94a3b8;
    cursor: not-allowed;
    box-shadow: none;
}

.password-identifier-switch {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem;
    margin: 0 0 0.85rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #f8fafc;
}

.password-id-btn {
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-muted);
    border-radius: 999px;
    padding: 0.3rem 0.7rem;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.password-id-btn.active {
    background: #ffffff;
    border-color: rgba(0, 196, 204, 0.28);
    color: var(--primary);
}

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

.password-phone-grid {
    margin-top: 0.15rem;
}

.forgot-password-entry {
    display: flex;
    justify-content: flex-end;
    margin: -0.25rem 0 0.95rem;
}

.auth-link-btn {
    border: none;
    background: transparent;
    color: #0f4c5c;
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
}

.auth-link-btn:hover {
    color: var(--primary);
    text-decoration: underline;
}

.forgot-password-panel {
    border: 1px solid #dbe2ea;
    border-radius: var(--radius-sm);
    background: #f8fafc;
    padding: 0.95rem;
    margin: 0 0 1rem;
}

.forgot-password-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.forgot-password-header h3 {
    margin: 0;
    font-size: 0.96rem;
    color: var(--primary);
}

.forgot-password-hint {
    margin: 0.4rem 0 0.8rem;
    color: var(--text-muted);
    font-size: 0.82rem;
    line-height: 1.45;
}

.secondary-submit-btn {
    margin-top: 0.4rem;
}

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

.sms-auth-hint {
    margin: 0 0 1rem;
    color: var(--text-muted);
    font-size: 0.92rem;
    line-height: 1.5;
}

.sms-phone-grid {
    display: grid;
    grid-template-columns: 136px minmax(0, 1fr);
    gap: 0.9rem;
}

.sms-auth-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    font-size: 1rem;
    background: #ffffff;
    transition: border-color 0.2s ease;
}

.sms-auth-group select:focus {
    outline: none;
    border-color: var(--accent);
}

#password-phone-identifier-group select,
#reset-phone-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    font-size: 1rem;
    line-height: 1.2;
    min-height: 48px;
    background: #ffffff;
    transition: border-color 0.2s ease;
}

#password-phone-identifier-group select:focus,
#reset-phone-group select:focus {
    outline: none;
    border-color: var(--accent);
}

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

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

.sms-register-password-hint {
    margin: 0.5rem 0 0;
    color: var(--text-muted);
    font-size: 0.82rem;
    line-height: 1.4;
}

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

.sms-send-btn {
    margin-top: 0;
}

.sms-send-btn[disabled],
#auth-submit-btn[disabled] {
    cursor: not-allowed;
    opacity: 0.72;
}

.sms-send-meta {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.84rem;
    text-align: center;
}

.status-msg {
    margin-top: 1rem;
    text-align: center;
    font-size: 0.87rem;
}

.status-msg.is-info {
    color: #0f4c5c;
}

.status-msg.is-success {
    color: #15803d;
}

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

    #auth-modal .modal-content {
        width: calc(100vw - 1.5rem);
        max-height: calc(100dvh - 1.5rem);
    }

    #auth-modal.auth-register-mode #auth-form {
        max-height: min(68dvh, 540px);
    }

    .sms-phone-grid {
        grid-template-columns: 1fr;
    }

    .password-identifier-switch {
        display: flex;
        width: 100%;
    }

    .password-id-btn {
        flex: 1 1 0;
        text-align: center;
    }

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