function CommercialHomeScreen(){const{PageHeader,Badge,Button,ProgressBar}=window.VRticeDesignSystem_d763eb;const{go}=useShell();const P=useProspects();const total=P.length,hot=P.filter(p=>p.total>=80).length,qualified=P.filter(p=>p.stage==='QUALIFIED').length,open=P.filter(p=>!['CUSTOMER','LOST'].includes(p.stage)).length;const lists=[['Alta prioridade sem contato','Score ≥ 80 e nenhuma interação',P.filter(p=>p.total>=80&&p.last==null).slice(0,5)],['Novos qualificados','Empresas que entraram no ICP',P.filter(p=>p.stage==='QUALIFIED').slice(0,5)],['Esfriando','Sem interação há mais de 14 dias',P.filter(p=>p.last>14).slice(0,5)]];const blocks=[{id:'kpis',title:'Indicadores',span:12,node:<div style={cxGrid(180)}><CcPanel title="Empresas prospectadas" gap={4}><span style={{...cxMono,fontSize:28}}>{total}</span><span style={{fontSize:12,color:'var(--text-muted)'}}>contas reais no tenant</span></CcPanel><CcPanel title="Alta prioridade" gap={4}><span style={{...cxMono,fontSize:28}}>{hot}</span><span style={{fontSize:12,color:'var(--text-muted)'}}>score ≥ 80</span></CcPanel><CcPanel title="Qualificados" gap={4}><span style={{...cxMono,fontSize:28}}>{qualified}</span><span style={{fontSize:12,color:'var(--text-muted)'}}>prontos para abordagem</span></CcPanel><CcPanel title="Pipeline aberto" gap={4}><span style={{...cxMono,fontSize:28}}>{open}</span><span style={{fontSize:12,color:'var(--text-muted)'}}>exclui clientes e perdidos</span></CcPanel></div>},...lists.map(([t,s,rows],i)=>({id:'list-'+i,title:t,span:4,node:<CcPanel title={t} sub={s} gap={4}>{rows.length?rows.map(p=><button key={p.id} type="button" className="vx-row" onClick={()=>go('prospect',{id:p.id})} style={{gridTemplateColumns:'1fr auto',padding:'12px 0'}}><span style={{display:'flex',flexDirection:'column',gap:3}}><strong>{p.name}</strong><span style={{fontSize:12,color:'var(--text-muted)'}}>{p.city} - {p.uf} · {p.next}</span></span><ScoreChip v={p.total}/></button>):<span style={{padding:'12px 0',fontSize:13,color:'var(--text-muted)'}}>Nenhum registro nesta lista.</span>}<Button variant="link" onClick={()=>go('prospects')}>Ver todos →</Button></CcPanel>})),{id:'funnel',title:'Composição do funil',span:12,node:<CcPanel title="Composição do funil" sub="Contagem por estágio comercial"><div style={{display:'flex',flexDirection:'column',gap:12}}>{window.VXCommercial.STAGES.map(s=>{const n=P.filter(p=>p.stage===s[0]).length;return <ProgressBar key={s[0]} label={s[1]} valueLabel={String(n)} value={total?n/total*100:0}/>})}</div></CcPanel>}];return <BlockGrid id="commercial-home" blocks={blocks} header={<PageHeader size="lg" eyebrow="COMERCIAL · SALES INTELLIGENCE" title="Visão comercial" description="Inteligência pública transformada em empresas-alvo, prioridades e ações comerciais." actions={<PBtn perm="commercial_intelligence.create" icon="ph-database" onClick={()=>go('prospects')}>Descobrir empresas</PBtn>}/>}/>};window.CommercialHomeScreen=CommercialHomeScreen;