// Caririaçu Guincho — Login Screen const { useState: useStateL, useEffect: useEffectL } = React; const LoginScreen = ({ onLogin }) => { const [email, setEmail] = useStateL(''); const [pass, setPass] = useStateL(''); const [loading, setLoading] = useStateL(false); const [err, setErr] = useStateL(''); const [isMobile, setIsMobile] = useStateL(window.innerWidth < 768); useEffectL(() => { const h = () => setIsMobile(window.innerWidth < 768); window.addEventListener('resize', h); return () => window.removeEventListener('resize', h); }, []); const handleLogin = async () => { if (!email || !pass) { setErr('Informe e-mail e senha.'); return; } setLoading(true); setErr(''); const { error } = await auth.signIn(email.trim(), pass); setLoading(false); if (error) { const msg = error.message?.includes('Invalid login') ? 'E-mail ou senha inválidos' : (error.message || 'Erro ao entrar'); setErr(msg); return; } showToast('Bem-vindo!', 'success'); if (onLogin) onLogin(); }; const handleForgot = async () => { if (!email) { setErr('Informe seu e-mail no campo acima primeiro.'); return; } const { error } = await sb.auth.resetPasswordForEmail(email.trim()); if (error) showToast(error.message, 'error'); else showToast('Link de recuperação enviado para seu e-mail!', 'success'); }; return (