.auth-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s, visibility 0.25s;
}

.auth-modal-overlay.open {
    opacity: 1;
    visibility: visible;
}

.auth-modal {
    background: var(--white);
    border-radius: var(--radius);
    width: 100%;
    max-width: 420px;
    padding: 32px 28px 28px;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    transform: translateY(16px) scale(0.98);
    transition: transform 0.25s;
    max-height: 90vh;
    overflow-y: auto;
}

.auth-modal-overlay.open .auth-modal {
    transform: translateY(0) scale(1);
}

.auth-modal-close {
    position: absolute;
    top: 14px;
    right: 16px;
    width: 32px;
    height: 32px;
    border: none;
    background: #F3F4F6;
    border-radius: 50%;
    font-size: 22px;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.auth-modal-close:hover {
    background: var(--green-light);
    color: var(--green);
}

.auth-modal-title {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 4px;
    padding-right: 32px;
}

.auth-modal-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 24px;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.auth-field label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.auth-field input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-family: inherit;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.auth-field input:focus {
    outline: none;
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(0, 168, 89, 0.15);
}

.auth-field input.erro {
    border-color: #EF4444;
}

.auth-erro {
    font-size: 13px;
    color: #DC2626;
    background: #FEF2F2;
    padding: 10px 12px;
    border-radius: 8px;
    margin: 0;
}

.btn-modal-submit {
    width: 100%;
    padding: 14px;
    font-size: 15px;
    margin-top: 4px;
}

.btn-modal-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.auth-modal-switch {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    color: var(--text-muted);
}

.auth-link-btn {
    background: none;
    border: none;
    color: var(--green);
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    font-family: inherit;
    padding: 0;
    text-decoration: underline;
}

.auth-link-btn:hover {
    color: var(--green-dark);
}

body.modal-open {
    overflow: hidden;
}

@media (max-width: 768px) {
    .auth-modal-overlay {
        align-items: flex-end;
        padding: 0;
    }

    .auth-modal {
        max-width: 100%;
        border-radius: 20px 20px 0 0;
        padding: 24px 20px max(20px, env(safe-area-inset-bottom));
        max-height: 92vh;
    }

    .auth-modal-title {
        font-size: 20px;
    }

    .auth-field input {
        font-size: 16px; /* evita zoom no iOS */
    }
}
