AGILPainel de Estoques
AGIL Ipameri5 unidadesNunca atualizado
AGILIpameri5 unidades
Exportado em 20/08/2026, 14:0859.388 tn armazenados64.6% ocupação
CAPACIDADE TOTAL
92.000 tn
32.612 tn livre
ESTOQUE TOTAL
59.388 tn
Cap. 92.000 tn • Livre 32.612
TOTAL MILHO
30.362 tn
51.1% do armazém • 1 silos
Milho
TOTAL SOJA
29.026 tn
48.9% do armazém • 4 silos
Soja
% OCUPAÇÃO
64.6%OK
0%70%100%
VISUALIZAÇÃO • NÍVEL DOS GRÃOS
MILHO SOJA
SILO01SOJA
CHEIO
92% • 11.900 tn
SILO02SOJA
CHEIO
92% • 11.900 tn
SILO03SOJA
ESVAZIANDO
22% • 2.800 tn
SILO04SOJA
ESVAZIANDO
19% • 2.426 tn
ARMAZEMMILHO▲ ENCHENDO
75.9% • 30.362 tn / 40.000 tn
ESTOQUES DETALHADOS • AGIL IPAMERI
5 linhas
UnidadeProdutoEstoque (tn)Cap. Silo%
SILO01SOJA11.90013.000
91.5%
SILO02SOJA11.90013.000
91.5%
SILO03SOJA2.80013.000
21.5%
SILO04SOJA2.42613.000
18.7%
ARMAZEMMILHO30.36240.000
75.9%
Estoque (tn)59.388 tn
Estoque total milho30.362 tn
Estoque total soja29.026 tn
Capacidade Total92.000 tn
% Ocupação32.612 tn livre64.6%
AGIL • Painel de Estoques • AGIL Ipameri20/08/2026, 14:08 • 5 unidades
🔒
Painel de auditoria restrito.
AGILArmazéns GT - Visão Geral8 unidades • TODOS
Exportado em 20/08/2026, 14:08566.624 tn armazenados no total73.7% ocupação média
CAPACIDADE TOTAL GT
769.000 tn
202.376 tn livre
ESTOQUE TOTAL GT
566.624 tn
Cap. 769.000 tn
TOTAL MILHO GT
347.088 tn
61.3% do total
TOTAL SOJA GT
219.536 tn
38.7% do total
% OCUPAÇÃO MÉDIA
73.7%ATENÇÃO
RESUMO POR ARMAZÉM • VISÃO GERAL GT
8 armazéns
ArmazémSilosMilho (tn)Soja (tn)Total (tn)Ocup %
AGIL Caldas426.8938.41235.305
56.9%
AGIL Ipameri530.36229.02659.388
64.6%
AGIL Piracanjuba4061.50061.500
96.1%
AGIL Pires133.501033.501
67.0%
AGIL Vianopolis566.796066.796
78.6%
Nutriza574.691074.691
86.9%
Olvego2022.55822.558
22.6%
Serra Branca2114.84598.040212.885
92.6%
Total Geral566.624 tn
Total Milho GT347.088 tn
Total Soja GT219.536 tn
Capacidade Total GT769.000 tn • 73.7% ocupação
AGIL • Painel de Estoques • Visão Geral GT - Todos Armazéns20/08/2026, 14:08 • 8 armazéns
`;C.document.open(),C.document.write(P),C.document.close()}else window.open(_,"_blank")}catch{window.open(_,"_blank")}return setTimeout(()=>URL.revokeObjectURL(_),60000),!0}else{return setTimeout(()=>URL.revokeObjectURL(_),1500),!0}},Hu=()=>{R(e.map((d)=>d.id)),N(!0),w(!0)},Up=(d)=>{if(N(d),d)R(e.map((h)=>h.id));else R([])},Wp=(d,h)=>{if(h){let _=[...S,d];if(R(_),_.length===e.length){}}else{let _=S.filter((z)=>z!==d);R(_)}},Bp=async()=>{let d=new Date().toISOString().slice(0,10);f(!0);try{if(m){y("Gerando visão geral..."),u("Gerando Armazéns GT em alta qualidade (scale 4)...");let h=`Armazens_GT_${d}.png`,{blob:_,url:z}=await Nf("area-exportacao-todos",h);await zf(_,h,z,!0),u(`Exportado: ${h} ✓`)}else{if(S.length===0){u("Selecione ao menos um armazém"),setTimeout(()=>u(null),2500),f(!1);return}for(let h=0;hF.id===_);if(!z)continue;if(y(`Exportando ${h+1}/${S.length}: ${z.nome}`),u(`Exportando ${h+1}/${S.length}: ${z.nome} em alta qualidade...`),t!==_)r(_),await new Promise((F)=>setTimeout(F,850));let _n=z.nome.replace(/\s+/g,"_").replace(/[^A-Za-z0-9_\-]/g,"");let P=`${_n}_${d}.png`;P=P.replace(/AGIL_AGIL_/g,"AGIL_");try{let{blob:F,url:$}=await Nf("area-exportacao",P);await zf(F,P,$,S.length===1),await new Promise((H)=>setTimeout(H,650))}catch(F){console.error("erro export individual",_,F)}}u(`${S.length} armazém(s) exportados ✓`)}}catch(h){console.error(h),u("Erro ao gerar imagem")}finally{f(!1),y(null),w(!1),setTimeout(()=>u(null),3500)}},Fe=(d)=>d<70?"bg-green-500":d<90?"bg-yellow-500":"bg-red-500";return c("div",{className:"min-h-screen bg-[#fcfcfc] text-zinc-900 font-sans antialiased selection:bg-green-100 overflow-x-hidden",children:[o("style",{children:`@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700;800;900&display=swap'); body{font-family: Inter, ui-sans-serif, system-ui} @keyframes fadeIn{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:translateY(0)}} .exportando-alta-qualidade{filter: contrast(1.08) saturate(1.05);} .exportando-alta-qualidade *{ -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; } .exportando-alta-qualidade .text-[10px]{ font-size:12px !important; line-height:1.35 !important; } .exportando-alta-qualidade .text-[11px]{ font-size:13px !important; } .exportando-alta-qualidade .text-[12px]{ font-size:14px !important; } .exportando-alta-qualidade .text-[13px]{ font-size:14.5px !important; } `}),c("div",{className:"lg:hidden sticky top-0 z-40 bg-white border-b border-zinc-200 px-4 py-3 flex items-center justify-between shadow-sm",children:[c("div",{className:"flex items-baseline gap-2",children:[o("span",{className:"font-black text-[#2e7d32] tracking-tight text-xl",children:"AGIL"}),o("span",{className:"font-bold italic text-zinc-900",children:"Painel de Estoques"})]}),o("div",{className:"flex items-center gap-1.5",children:c("button",{onClick:Hu,disabled:i,className:"text-[11px] font-black bg-[#2e7d32] text-white rounded-full px-3 py-1.5 flex items-center gap-1 shadow-sm",children:[i?o(tn,{className:"w-3 h-3 animate-spin"}):o(Xr,{className:"w-3 h-3"})," Exportar"]})})]}),c("div",{className:"flex flex-col lg:flex-row min-h-screen",children:[c("aside",{className:"w-full lg:w-[300px] bg-white border-b lg:border-b-0 lg:border-r border-zinc-200 flex flex-col shrink-0",children:[c("div",{className:"p-5 border-b border-zinc-100",children:[c("div",{className:"flex items-center gap-2",children:[o("div",{className:"w-8 h-8 bg-[#2e7d32] rounded flex items-center justify-center text-white font-black text-[13px]",children:"AG"}),c("div",{children:[o("div",{className:"font-black leading-none text-[#2e7d32]",children:"AGIL"}),o("div",{className:"text-[11px] font-bold tracking-wide text-zinc-500 -mt-0.5",children:"PAINEL DE ESTOQUES"})]})]}),c("div",{className:"mt-5 bg-zinc-50 rounded-xl border border-zinc-200 p-3",children:[o("div",{className:"text-[10px] font-bold tracking-widest text-zinc-500",children:"TOTAL GERAL"}),c("div",{className:"text-2xl font-black tracking-tight",children:[U.totalGeral.toLocaleString("pt-BR")," ",o("span",{className:"text-sm font-bold text-zinc-500",children:"tn"})]}),c("div",{className:"mt-2 grid grid-cols-2 gap-2",children:[c("div",{className:"bg-white rounded-lg border border-zinc-200 p-2",children:[o("div",{className:"text-[9px] font-bold text-zinc-500",children:"MILHO"}),o("div",{className:"text-sm font-black text-[#b5890a]",children:U.totalMilho.toLocaleString("pt-BR")})]}),c("div",{className:"bg-white rounded-lg border border-zinc-200 p-2",children:[o("div",{className:"text-[9px] font-bold text-zinc-500",children:"SOJA"}),o("div",{className:"text-sm font-black text-[#8B7355]",children:U.totalSoja.toLocaleString("pt-BR")})]})]}),o("div",{className:"mt-2 h-2 bg-zinc-200 rounded-full overflow-hidden",children:o("div",{className:`h-full ${Fe(U.ocupMedia)}`,style:{width:`${Math.min(100,U.ocupMedia)}%`}})}),c("div",{className:"mt-1 text-[10px] text-zinc-500 font-semibold",children:[U.ocupMedia.toFixed(1),"% ocupação média • ",U.capTotal.toLocaleString("pt-BR")," cap"]})]})]}),c("div",{className:"p-3 flex-1 overflow-auto",children:[o("div",{className:"text-[10px] font-bold tracking-widest text-zinc-400 px-2 mb-2",children:"ARMAZÉNS (8)"}),o("div",{className:"space-y-2",children:e.map((d)=>{let h=d.silos.reduce((F,$)=>F+$.estoque,0),_=d.silos.reduce((F,$)=>F+($.capacidade||0),0),z=_?h/_*100:0,C=d.id===t,P=Wu[d.id];return c("button",{onClick:()=>zp(d.id),className:`w-full text-left rounded-xl border px-3 py-3 transition-all ${C?"bg-[#e8f5e9] border-[#2e7d32] shadow-sm ring-1 ring-[#2e7d32]/20":"bg-white border-zinc-200 hover:border-zinc-300"} ${C&&k&&L===d.id?"ring-2 ring-green-400":""}`,children:[c("div",{className:"flex items-start justify-between gap-2",children:[o("div",{className:`font-extrabold text-[13px] leading-tight ${C?"text-[#2e7d32]":"text-zinc-800"}`,children:d.nome}),c("div",{className:`text-[10px] font-black px-1.5 py-0.5 rounded ${z>90?"bg-red-100 text-red-700":z>70?"bg-yellow-100 text-yellow-700":"bg-green-100 text-green-700"}`,children:[z.toFixed(0),"%"]})]}),c("div",{className:"mt-1 text-[11px] text-zinc-600 font-semibold",children:[h.toLocaleString("pt-BR")," tn / ",_.toLocaleString("pt-BR")," tn"]}),o("div",{className:"mt-2 h-1.5 bg-zinc-200 rounded-full overflow-hidden",children:o("div",{className:`h-full transition-all ${Fe(z)}`,style:{width:`${Math.min(100,z)}%`}})}),c("div",{className:"mt-1 flex gap-1",children:[d.silos.slice(0,6).map((F)=>o("div",{className:`w-2 h-2 rounded-full ${F.produto==="MILHO"?"bg-[#E9B100]":"bg-[#9C6B3A]"}`},F.id)),d.silos.length>6&&c("span",{className:"text-[9px] text-zinc-400",children:["+",d.silos.length-6]})]}),P&&c("div",{className:"mt-1.5 text-[9px] font-bold text-zinc-500 flex items-center gap-1",children:[P.dataISO===Bu?c("span",{className:"text-green-600",children:["\uD83D\uDFE2 Hoje ",P.hora]}):c("span",{children:["\uD83D\uDD52 ",P.data," ",P.hora]}),c("span",{className:"truncate",children:["• ",ll(P.usuario)]})]}),C&&k&&L===d.id&&o("div",{className:"mt-2 inline-flex items-center gap-1 text-[9px] font-black bg-green-600 text-white px-2 py-0.5 rounded-full",children:"\uD83D\uDD13 Desbloqueado"})]},d.id)})})]})]}),c("main",{className:"flex-1 bg-[#f5f5f4] flex flex-col min-w-0",children:[c("div",{className:"px-4 lg:px-8 py-4 bg-white border-b border-zinc-200 flex flex-wrap items-center justify-between gap-3",children:[c("div",{className:"flex items-center gap-2 text-[12px] text-zinc-500 font-semibold",children:[o("span",{className:"hidden sm:inline",children:"Visualização"}),o("span",{className:"hidden sm:inline text-zinc-300",children:"•"}),o("span",{className:"text-zinc-700 font-bold",children:M.nome}),c("span",{className:"inline-flex items-center ml-2 px-2 py-0.5 rounded-full bg-zinc-100 border border-zinc-200 text-[10px] font-black text-zinc-600",children:[M.silos.length," unidades"]}),rn&&o("span",{id:"badgeAtualizacao",className:`inline-flex items-center ml-2 px-2.5 py-1 rounded-full text-[10px] font-black border ${rn.dataISO===Bu?"bg-green-50 text-green-700 border-green-200":"bg-amber-50 text-amber-700 border-amber-200"}`,children:rn.dataISO===Bu?`✅ Atualizado hoje ${rn.hora} por ${ll(rn.usuario)}`:`⚠️ Última: ${rn.data} ${rn.hora} • ${ll(rn.usuario)}`}),!rn&&o("span",{id:"badgeAtualizacao",className:"inline-flex items-center ml-2 px-2.5 py-1 rounded-full text-[10px] font-bold bg-zinc-50 text-zinc-400 border border-zinc-200",children:"Nunca atualizado"})]}),o("div",{className:"flex items-center gap-2 flex-wrap",children:o("button",{onClick:Hu,disabled:i,className:"inline-flex items-center gap-2 bg-[#2e7d32] hover:bg-[#256628] disabled:bg-[#2e7d32]/60 disabled:cursor-not-allowed text-white font-black text-[13px] tracking-wide px-5 py-2.5 rounded-xl shadow-[0_4px_14px_rgba(46,125,50,0.28)] border border-[#2e7d32] transition-all active:scale-[0.98]",children:i?c(ot,{children:[o(tn,{className:"w-4 h-4 animate-spin"})," ",J||"Gerando..."]}):o(ot,{children:"\uD83D\uDCF8 Exportar Armazéns"})})})]}),c("div",{className:"flex-1 p-3 lg:p-8 bg-[#f5f5f4]",children:[c("div",{id:"area-exportacao",className:"bg-[#ffffff] rounded-[12px] border border-zinc-200 shadow-[0_8px_30px_rgba(0,0,0,0.06)] p-[24px] flex flex-col gap-6",children:[o("div",{className:"pb-5 border-b border-zinc-100",children:c("div",{className:"flex flex-wrap items-end justify-between gap-4",children:[c("div",{children:[c("div",{className:"flex flex-wrap items-baseline gap-3",children:[o("span",{className:"text-[#2e7d32] font-black tracking-tighter leading-none",style:{fontSize:"28px"},children:"AGIL"}),o("span",{className:"font-black italic tracking-tight text-black leading-none",style:{fontSize:"28px"},children:Pp.resto}),c("span",{className:"inline-flex items-center px-3 py-1 rounded-full bg-zinc-50 border border-zinc-200 text-[11px] font-black tracking-wide text-zinc-600 shadow-sm",children:[M.silos.length," unidades"]})]}),c("div",{className:"mt-2 flex flex-wrap items-center gap-2 text-[11px] font-semibold text-zinc-400",children:[c("span",{children:["Exportado em ",_f]}),o("span",{className:"w-1 h-1 rounded-full bg-zinc-300"}),c("span",{children:[We.toLocaleString("pt-BR")," tn armazenados"]}),o("span",{className:"w-1 h-1 rounded-full bg-zinc-300"}),c("span",{className:ue>90?"text-red-600":ue>70?"text-amber-600":"text-green-600",children:[ue.toFixed(1),"% ocupação"]})]})]}),c("div",{className:"text-right",children:[o("div",{className:"text-[10px] font-black tracking-widest text-zinc-400",children:"CAPACIDADE TOTAL"}),c("div",{className:"text-[13px] font-black text-zinc-800",children:[Wn.toLocaleString("pt-BR")," tn"]}),c("div",{className:"text-[10px] font-bold text-zinc-400",children:[ul.toLocaleString("pt-BR")," tn livre"]})]})]})}),c("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-3",children:[c("div",{className:"bg-white border border-zinc-200 rounded-xl p-4 shadow-sm",children:[o("div",{className:"text-[10px] font-black tracking-widest text-zinc-500",children:"ESTOQUE TOTAL"}),c("div",{className:"mt-1 text-[22px] font-black tracking-tight text-zinc-900 leading-none",children:[We.toLocaleString("pt-BR")," ",o("span",{className:"text-[12px] font-bold text-zinc-500",children:"tn"})]}),c("div",{className:"mt-2 text-[11px] font-semibold text-zinc-500",children:["Cap. ",Wn.toLocaleString("pt-BR")," tn • Livre ",ul.toLocaleString("pt-BR")]}),o("div",{className:"mt-2 h-1.5 bg-zinc-200 rounded-full overflow-hidden",children:o("div",{className:`h-full ${Fe(ue)}`,style:{width:`${Math.min(100,ue)}%`}})})]}),c("div",{className:"rounded-xl p-4 shadow-sm border border-[#fde68a]/60",style:{backgroundColor:"#fef9e7"},children:[o("div",{className:"text-[10px] font-black tracking-widest text-[#92400e]",children:"TOTAL MILHO"}),c("div",{className:"mt-1 text-[22px] font-black tracking-tight text-[#78350f] leading-none",children:[Qu.toLocaleString("pt-BR")," ",o("span",{className:"text-[12px] font-bold text-[#a16207]",children:"tn"})]}),c("div",{className:"mt-2 text-[11px] font-bold text-[#a16207]",children:[We?(Qu/We*100).toFixed(1):"0","% do armazém • ",M.silos.filter((d)=>d.produto==="MILHO").length," silos"]}),c("div",{className:"mt-2 flex items-center gap-1.5",children:[o("div",{className:"w-2 h-2 rounded-full bg-[#E9B100] border border-[#ca8a04]"}),o("span",{className:"text-[10px] font-bold text-[#854d0e]",children:"Milho"})]})]}),c("div",{className:"rounded-xl p-4 shadow-sm border border-[#fed7aa]/70",style:{backgroundColor:"#fef3e2"},children:[o("div",{className:"text-[10px] font-black tracking-widest text-[#9c4221]",children:"TOTAL SOJA"}),c("div",{className:"mt-1 text-[22px] font-black tracking-tight text-[#7c2d12] leading-none",children:[Uu.toLocaleString("pt-BR")," ",o("span",{className:"text-[12px] font-bold text-[#9c4221]",children:"tn"})]}),c("div",{className:"mt-2 text-[11px] font-bold text-[#9c4221]",children:[We?(Uu/We*100).toFixed(1):"0","% do armazém • ",M.silos.filter((d)=>d.produto==="SOJA").length," silos"]}),c("div",{className:"mt-2 flex items-center gap-1.5",children:[o("div",{className:"w-2 h-2 rounded-full bg-[#9C6B3A] border border-[#7c3d1a]"}),o("span",{className:"text-[10px] font-bold text-[#7c2d12]",children:"Soja"})]})]}),c("div",{className:"bg-white border border-zinc-200 rounded-xl p-4 shadow-sm",children:[o("div",{className:"text-[10px] font-black tracking-widest text-zinc-500",children:"% OCUPAÇÃO"}),c("div",{className:"mt-1 flex items-baseline gap-2",children:[c("span",{className:"text-[22px] font-black tracking-tight leading-none",children:[ue.toFixed(1),"%"]}),o("span",{className:`text-[10px] font-black px-2 py-0.5 rounded-full text-white ${Fe(ue)}`,children:ue<70?"OK":ue<90?"ATENÇÃO":"CHEIO"})]}),o("div",{className:"mt-3 h-2 bg-zinc-200 rounded-full overflow-hidden",children:o("div",{className:`h-full ${Fe(ue)}`,style:{width:`${Math.min(100,ue)}%`}})}),c("div",{className:"mt-1.5 text-[10px] font-semibold text-zinc-500 flex justify-between",children:[o("span",{children:"0%"}),o("span",{children:"70%"}),o("span",{children:"100%"})]})]})]}),c("div",{className:"rounded-xl border border-zinc-200 bg-white p-4 shadow-sm",children:[c("div",{className:"flex items-center justify-between mb-4",children:[o("div",{className:"text-[11px] font-black tracking-widest text-zinc-500",children:"VISUALIZAÇÃO • NÍVEL DOS GRÃOS"}),c("div",{className:"flex items-center gap-2 text-[10px] font-bold",children:[c("span",{className:"flex items-center gap-1",children:[o("span",{className:"w-2.5 h-2.5 rounded-full bg-[#E9B100] border border-[#ca8a04]"})," MILHO"]}),c("span",{className:"flex items-center gap-1",children:[o("span",{className:"w-2.5 h-2.5 rounded-full bg-[#9C6B3A] border border-[#7c3d1a]"})," SOJA"]})]})]}),o("div",{className:"flex flex-wrap gap-6 lg:gap-8 justify-center lg:justify-start items-end bg-[#fcfcfc] rounded-lg border border-zinc-100 p-4",children:M.silos.map((d)=>{return hp(d)?o(Ry,{silo:d},d.id):o(zy,{silo:d},d.id)})})]}),c("div",{className:"rounded-xl border border-zinc-200 overflow-hidden bg-white shadow-sm",children:[c("div",{className:"bg-[#f8f8f7] px-4 py-3 border-b border-zinc-200 flex items-center justify-between",children:[c("div",{className:"text-[11px] font-black tracking-widest text-zinc-600",children:["ESTOQUES DETALHADOS • ",M.nome.toUpperCase()]}),c("div",{className:"text-[10px] font-bold text-zinc-400",children:[M.silos.length," linhas"]})]}),o("div",{className:"overflow-auto",children:c("table",{className:"w-full text-[13px]",children:[o("thead",{children:c("tr",{className:"bg-[#f3f3f2] text-[11px] tracking-widest text-zinc-500 border-b border-zinc-200",children:[o("th",{className:"text-left font-black px-4 py-2.5",children:"Unidade"}),o("th",{className:"text-left font-black px-3 py-2.5",children:"Produto"}),o("th",{className:"text-right font-black px-3 py-2.5",children:"Estoque (tn)"}),o("th",{className:"text-right font-black px-3 py-2.5",children:"Cap. Silo"}),o("th",{className:"text-right font-black px-4 py-2.5",children:"%"})]})}),o("tbody",{children:M.silos.map((d,h)=>{let _=d.capacidade?d.estoque/d.capacidade*100:0;return c("tr",{className:`border-b border-zinc-100 last:border-0 ${h%2===0?"bg-white":"bg-[#fafaf9]"} hover:bg-zinc-50/80 transition-colors`,children:[o("td",{className:"px-4 py-2.5 font-bold text-zinc-800",children:d.nome}),o("td",{className:"px-3 py-2.5",children:o("span",{className:`text-[10px] font-black px-2.5 py-1 rounded-full border ${d.produto==="MILHO"?"bg-[#fef9c3] text-[#854d0e] border-[#facc15]":"bg-[#f5efe6] text-[#5c3d2e] border-[#d8c3ad]"}`,children:d.produto})}),o("td",{className:"px-3 py-2.5 text-right font-bold text-zinc-900",children:d.estoque.toLocaleString("pt-BR")}),o("td",{className:"px-3 py-2.5 text-right text-zinc-600 font-semibold",children:d.capacidade.toLocaleString("pt-BR")}),o("td",{className:"px-4 py-2.5 text-right",children:c("div",{className:"flex items-center justify-end gap-2.5",children:[c("span",{className:"text-[12px] font-black min-w-[36px]",children:[_.toFixed(1),"%"]}),o("div",{className:"w-14 h-2 bg-zinc-200 rounded-full overflow-hidden border border-zinc-200",children:o("div",{className:`h-full ${Fe(_)}`,style:{width:`${Math.min(100,_)}%`}})})]})})]},d.id)})})]})}),c("div",{className:"bg-[#fafaf8] border-t border-zinc-200 divide-y divide-zinc-200 text-[13px]",children:[c("div",{className:"flex justify-between px-4 py-3",children:[o("span",{className:"font-bold text-zinc-600",children:"Estoque (tn)"}),c("span",{className:"font-black text-zinc-900",children:[We.toLocaleString("pt-BR")," tn"]})]}),c("div",{className:"flex justify-between px-4 py-3",children:[o("span",{className:"font-bold text-[#92400e]",children:"Estoque total milho"}),c("span",{className:"font-black text-[#78350f]",children:[Qu.toLocaleString("pt-BR")," tn"]})]}),c("div",{className:"flex justify-between px-4 py-3",children:[o("span",{className:"font-bold text-[#7c2d12]",children:"Estoque total soja"}),c("span",{className:"font-black text-[#5c2a14]",children:[Uu.toLocaleString("pt-BR")," tn"]})]}),c("div",{className:"flex justify-between px-4 py-3",children:[o("span",{className:"font-bold text-zinc-600",children:"Capacidade Total"}),c("span",{className:"font-black text-zinc-900",children:[Wn.toLocaleString("pt-BR")," tn"]})]}),c("div",{className:"flex justify-between px-4 py-3 items-center bg-white",children:[o("span",{className:"font-bold text-zinc-600",children:"% Ocupação"}),c("span",{className:"flex items-center gap-2",children:[c("span",{className:"text-[11px] font-bold text-zinc-500",children:[ul.toLocaleString("pt-BR")," tn livre"]}),c("span",{className:`font-black px-3 py-1 rounded-full text-white text-xs shadow-sm ${Fe(ue)}`,children:[ue.toFixed(1),"%"]})]})]})]})]}),c("div",{className:"pt-2 flex justify-between items-center text-[10px] font-semibold text-zinc-400",children:[c("span",{children:["AGIL • Painel de Estoques • ",M.nome]}),c("span",{children:[_f," • ",M.silos.length," unidades"]})]})]}),o("div",{id:"painelLogs",className:"mt-6 bg-white rounded-[14px] border border-zinc-200 shadow-[0_8px_24px_rgba(0,0,0,0.04)] p-5",children:!Sp?c("div",{style:{textAlign:"center",padding:"28px",background:"#f9fafb",borderRadius:"12px",border:"2px dashed #d1d5db"},children:[o("div",{style:{fontSize:"28px",marginBottom:"8px"},children:"\uD83D\uDD12"}),o("div",{style:{fontWeight:700,marginBottom:"14px"},children:"Painel de auditoria restrito."}),c("div",{className:"flex gap-2 justify-center max-w-[360px] mx-auto",children:[c("div",{className:"relative flex-1",children:[o("input",{type:$u?"text":"password",value:wf,onChange:(d)=>{if(Vu(d.target.value),tl)Jt(null)},onKeyDown:Fp,placeholder:"Senha de administrador",className:`w-full border rounded-xl px-4 py-2.5 pr-10 text-[13px] font-semibold bg-white focus:outline-none focus:ring-2 transition ${tl?"border-red-300 focus:ring-red-200":"border-zinc-300 focus:ring-zinc-900/10 focus:border-zinc-900"}`}),o("button",{type:"button",onClick:()=>kf(!$u),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 rounded-lg hover:bg-zinc-100 text-zinc-500",children:$u?o(lt,{className:"w-4 h-4"}):o(ut,{className:"w-4 h-4"})})]}),c("button",{onClick:Sf,className:"px-4 py-2.5 rounded-xl bg-zinc-900 text-white text-[12px] font-black hover:bg-black transition whitespace-nowrap flex items-center gap-1.5",children:[o(hn,{className:"w-3.5 h-3.5"})," Desbloquear"]})]}),tl&&c("div",{className:"mt-3 inline-flex items-center gap-1.5 text-[11px] font-bold text-red-700 bg-red-50 border border-red-200 rounded-xl px-3 py-2",children:[o(Xt,{className:"w-4 h-4"})," ",tl]}),rl>0&&rl<3&&c("div",{className:"mt-2 text-[10px] font-bold text-zinc-500",children:[rl,"ª tentativa"]})]}):c(ot,{children:[c("div",{className:"flex items-center gap-2 mb-4 flex-wrap",children:[c("div",{className:"flex items-center gap-2",children:[o("div",{className:"w-8 h-8 rounded-lg bg-zinc-900 flex items-center justify-center text-white",children:o(Jr,{className:"w-4 h-4"})}),o("h3",{className:"text-[16px] font-black tracking-tight",children:"\uD83D\uDCCB Controle de Atualizações - Auditoria"}),c("span",{className:"ml-2 text-[10px] font-bold bg-green-50 border border-green-200 text-green-700 px-2 py-1 rounded-full",children:[qe.length," registros • limite 300 • \uD83D\uDD13 Master"]})]}),c("button",{onClick:Dp,className:"ml-auto inline-flex items-center gap-1.5 px-3 py-1.5 rounded-full bg-zinc-100 border border-zinc-200 text-[11px] font-bold hover:bg-zinc-200 transition",children:[o(it,{className:"w-3.5 h-3.5"})," Bloquear Auditoria"]})]}),o("div",{id:"cardsResumo",className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-2 mb-4",children:e.map((d)=>{let h=Wu[d.id],_=new Date().toISOString().slice(0,10),z=new Date;z.setDate(z.getDate()-1);let C=z.toISOString().slice(0,10),P,F,$;if(!h)P="Nunca atualizado",F="#fee2e2",$="#fecaca";else if(h.dataISO===_)P=`\uD83D\uDFE2 Hoje ${h.hora}`,F="#dcfce7",$="#bbf7d0";else if(h.dataISO===C)P=`\uD83D\uDFE1 Ontem ${h.hora}`,F="#fef9c3",$="#fde68a";else P=`\uD83D\uDD34 Há ${Math.floor((Date.now()-h.timestamp)/86400000)}d - ${h.data}`,F="#fee2e2",$="#fecaca";let H=d.id===t;return c("div",{style:{background:F,borderColor:$},className:`p-2.5 rounded-[10px] border shadow-sm ${H?"ring-2 ring-zinc-900 ring-offset-1":""}`,children:[c("div",{className:"font-black text-[11px] tracking-wide text-zinc-900 flex items-center justify-between",children:[o("span",{children:d.id.toUpperCase()}),H&&o("span",{className:"text-[8px] bg-zinc-900 text-white px-1.5 py-0.5 rounded-full",children:"ATUAL"})]}),o("div",{className:"text-[10px] font-bold text-zinc-700 mt-0.5 leading-tight",children:P}),o("div",{className:"text-[9px] text-zinc-600 truncate mt-0.5 font-semibold",children:h?h.usuario:"—"}),o("div",{className:"text-[8px] text-zinc-500 mt-0.5 truncate",children:d.nome})]},d.id)})}),c("div",{className:"flex flex-wrap gap-2 mb-3 items-center",children:[c("div",{className:"flex items-center gap-1.5",children:[o(qr,{className:"w-3.5 h-3.5 text-zinc-500"}),c("select",{id:"filtroArmazemLogs",value:Zt,onChange:(d)=>Ep(d.target.value),className:"px-3 py-2 rounded-lg border border-zinc-300 text-[12px] font-bold bg-white shadow-sm focus:outline-none focus:ring-2 focus:ring-zinc-900/10 focus:border-zinc-900",children:[o("option",{value:"todos",children:"Todos armazéns"}),o("option",{value:"caldas",children:"AGIL Caldas"}),o("option",{value:"ipameri",children:"AGIL Ipameri"}),o("option",{value:"piracanjuba",children:"AGIL Piracanjuba"}),o("option",{value:"pires",children:"AGIL Pires"}),o("option",{value:"vianopolis",children:"AGIL Vianopolis"}),o("option",{value:"nutriza",children:"Nutriza"}),o("option",{value:"olvego",children:"Olvego"}),o("option",{value:"serra",children:"Serra Branca"})]})]}),c("button",{onClick:Ip,className:"inline-flex items-center gap-1.5 px-3.5 py-2 rounded-lg bg-zinc-900 text-white text-[12px] font-black hover:bg-black transition shadow-sm",children:[o(Gr,{className:"w-3.5 h-3.5"})," Exportar CSV em Tabela"]}),c("button",{onClick:$p,className:"inline-flex items-center gap-1.5 px-3.5 py-2 rounded-lg bg-red-50 border border-red-200 text-red-700 text-[12px] font-bold hover:bg-red-100 transition",children:[o(xr,{className:"w-3.5 h-3.5"})," Limpar"]}),c("span",{className:"text-[11px] text-zinc-500 font-semibold ml-1",children:[(Zt==="todos"?qe:qe.filter((d)=>d.armazemId===Zt)).length," registros filtrados • mostrando até 100 • CSV com ; para Excel BR"]})]}),o("div",{className:"bg-white rounded-[12px] border border-zinc-200 overflow-hidden shadow-sm",children:o("div",{className:"max-h-[340px] overflow-y-auto",children:c("table",{className:"w-full text-[11px] border-collapse",children:[o("thead",{className:"bg-[#f9fafb] sticky top-0 z-10",children:c("tr",{children:[o("th",{className:"p-2.5 text-left border-b border-zinc-200 font-black tracking-widest text-[10px] text-zinc-600 w-[110px]",children:"Data/Hora"}),o("th",{className:"p-2.5 text-left border-b border-zinc-200 font-black tracking-widest text-[10px] text-zinc-600 w-[160px]",children:"Armazém / Usuário"}),o("th",{className:"p-2.5 text-left border-b border-zinc-200 font-black tracking-widest text-[10px] text-zinc-600",children:"Alterações Salvas"})]})}),o("tbody",{id:"tbodyLogs",children:(()=>{let d=Zt==="todos"?qe:qe.filter((h)=>h.armazemId===Zt);if(d.length===0)return o("tr",{children:o("td",{colSpan:3,className:"p-6 text-center text-zinc-400 font-bold",children:"Nenhum registro ainda. Salve alguma alteração."})});return d.slice(0,100).map((h)=>c("tr",{className:"border-b border-zinc-100 hover:bg-zinc-50/70",children:[c("td",{className:"p-2 px-3 align-top",children:[o("div",{className:"font-bold text-zinc-900",children:h.data}),o("div",{className:"text-zinc-500 font-semibold text-[10px]",children:h.hora}),o("div",{className:"text-[9px] text-zinc-400 mt-0.5",children:h.dataISO})]}),c("td",{className:"p-2 px-3 align-top",children:[o("div",{className:"font-black text-zinc-900 leading-tight",children:h.armazemNome}),o("div",{className:"text-[10px] font-bold text-zinc-600 mt-0.5 bg-zinc-100 inline-block px-1.5 py-0.5 rounded-full border border-zinc-200",children:ll(h.usuario)})]}),o("td",{className:"p-2 px-3 align-top",children:o("div",{className:"flex flex-col gap-1",children:h.alteracoes.map((_,z)=>o("span",{className:"inline-flex text-[10px] font-semibold leading-snug bg-zinc-50 border border-zinc-200 rounded px-2 py-1",children:_},z))})})]},h.id))})()})]})})}),c("div",{className:"mt-3 text-[10px] text-zinc-400 font-semibold flex items-center gap-2",children:[o("span",{children:"\uD83D\uDDC4️ localStorage: agil_logs • limite 300 • salvo somente ao clicar em Salvar • CSV com BOM UTF-8 e ; separador"}),o("span",{className:"w-1 h-1 rounded-full bg-zinc-300"}),o("span",{children:"Acesso restrito • Logs visíveis apenas para administrador"})]})]})})]})]}),o("aside",{className:"w-full lg:w-[380px] bg-[#fafaf9] border-t lg:border-t-0 lg:border-l border-zinc-200 flex flex-col shrink-0 lg:min-h-screen",children:!k?c("div",{className:"flex-1 flex flex-col items-center justify-start p-5 lg:p-6 bg-gradient-to-b from-zinc-50 to-[#fafaf9] overflow-auto",children:[c("div",{className:"w-full max-w-[360px] bg-white rounded-[24px] border border-zinc-200 shadow-[0_12px_40px_rgba(0,0,0,0.07)] p-6 text-center",children:[c("div",{className:"mx-auto w-[84px] h-[84px] rounded-[22px] bg-zinc-900 flex items-center justify-center shadow-[0_8px_20px_rgba(0,0,0,0.18)] mb-4 relative",children:[o(it,{className:"w-9 h-9 text-white"}),o("div",{className:"absolute -bottom-1 -right-1 w-6 h-6 rounded-full bg-amber-400 border-2 border-white flex items-center justify-center text-[12px]",children:"\uD83D\uDD11"})]}),c("h3",{className:"text-[18px] font-black tracking-tight text-zinc-900 leading-tight",children:["\uD83D\uDD12 ",M.nome," - Acesso Restrito"]}),o("p",{className:"text-[12px] font-bold text-zinc-500 tracking-wide mt-1",children:"Digite a senha exclusiva deste armazém para editar"}),c("div",{className:"mt-6 text-left",children:[c("label",{className:"text-[10px] font-black tracking-widest text-zinc-500 flex items-center gap-1",children:[o(Kt,{className:"w-3 h-3"})," SENHA DO ARMAZÉM"]}),c("div",{className:"mt-2 relative",children:[o("input",{type:Tu?"text":"password",value:V,onChange:(d)=>{if(G(d.target.value),at)Un(null)},onKeyDown:Rp,placeholder:"••••••••",className:`w-full border rounded-xl px-4 py-3 pr-10 text-[13px] font-semibold bg-zinc-50 focus:outline-none focus:ring-2 transition-all ${at?"border-red-300 focus:ring-red-200 focus:border-red-400":"border-zinc-200 focus:ring-[#2e7d32]/20 focus:border-[#2e7d32]"}`}),o("button",{onClick:()=>br(!Tu),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 rounded-lg hover:bg-zinc-100 text-zinc-500","aria-label":"mostrar senha",children:Tu?o(lt,{className:"w-4 h-4"}):o(ut,{className:"w-4 h-4"})})]}),at&&c("div",{className:"mt-3 flex items-start gap-1.5 text-[11px] font-bold text-red-700 bg-red-50 border border-red-200 rounded-xl px-3 py-2.5 leading-snug",children:[o(Xt,{className:"w-4 h-4 mt-0.5 shrink-0"}),o("span",{className:"break-words",children:at})]}),Q>0&&Q<3&&c("div",{className:"mt-2 text-[10px] font-bold text-zinc-500",children:[Q,"ª tentativa"]}),Q>=3&&Q<5&&o("div",{className:"mt-2 text-[10px] font-bold text-zinc-500",children:"Dica: verifique com o administrador a senha deste armazém."}),Q>=5&&o("div",{className:"mt-2 text-[10px] font-bold text-amber-700 bg-amber-50 border border-amber-200 rounded-lg px-2.5 py-2",children:"Após 5 tentativas, contate o administrador para redefinição. Senha master disponível apenas para administração."}),c("button",{onClick:Cf,className:"mt-4 w-full bg-zinc-900 text-white font-black text-[13px] py-3 rounded-xl hover:bg-black transition flex items-center justify-center gap-2 shadow-[0_4px_14px_rgba(0,0,0,0.15)]",children:[o(hn,{className:"w-4 h-4"})," Desbloquear ",M.nome.split(" ").pop()]}),c("div",{className:"mt-3 text-center",children:[o("p",{className:"text-[11px] text-zinc-400 font-medium leading-snug",children:"Cada armazém possui senha própria. Contate o administrador."}),o("p",{className:"mt-1 text-[10px] text-zinc-400 font-medium",children:"Enter para desbloquear • Trocar armazém bloqueia automaticamente"})]})]})]}),c("div",{className:"mt-5 flex items-center gap-2 text-[11px] text-zinc-400 font-semibold",children:[o("div",{className:"w-2 h-2 rounded-full bg-zinc-300"})," Leitura liberada • edição exige senha do armazém"]})]}):c("div",{className:"flex flex-col flex-1 animate-[fadeIn_0.35s_ease-out]",children:[c("div",{className:"p-5 border-b border-zinc-200 bg-white",children:[c("div",{className:"flex items-center justify-between",children:[o("div",{className:"text-[11px] font-black tracking-widest text-zinc-400",children:"EDIÇÃO LIBERADA"}),c("span",{className:"inline-flex items-center gap-1.5 text-[10px] font-black bg-green-600 text-white border border-green-700 px-2.5 py-1 rounded-full shadow-sm",children:[o("span",{className:"w-1.5 h-1.5 rounded-full bg-white animate-pulse"})," Desbloqueado: ",M.nome," ✓"]})]}),o("div",{className:"text-[20px] font-black mt-1 tracking-tight",children:M.nome}),c("div",{className:"text-xs text-zinc-500 font-semibold mt-0.5",children:[M.silos.length," unidades • ",We.toLocaleString("pt-BR")," tn • senha ativa"]}),c("div",{className:"mt-4 bg-[#f6fdf6] border border-green-200 rounded-xl p-3.5 shadow-sm",children:[c("label",{className:"text-[10px] font-black tracking-widest text-green-800 flex items-center gap-1.5",children:[o(Kt,{className:"w-3.5 h-3.5"})," SENHA DESTE ARMAZÉM"]}),c("div",{className:"mt-2 flex gap-2",children:[c("div",{className:"relative flex-1",children:[o("input",{type:Mu?"text":"password",value:vf,onChange:(d)=>hf(d.target.value),className:"w-full border border-green-300 rounded-xl px-3 py-2.5 pr-8 text-[13px] font-mono font-bold bg-white focus:outline-none focus:ring-2 focus:ring-green-200 focus:border-green-500",placeholder:"Nova senha"}),o("button",{onClick:()=>kp(!Mu),className:"absolute right-1.5 top-1/2 -translate-y-1/2 p-1 rounded-lg hover:bg-green-50 text-zinc-500",children:Mu?o(lt,{className:"w-3.5 h-3.5"}):o(ut,{className:"w-3.5 h-3.5"})})]}),c("button",{onClick:Op,className:"px-3.5 py-2.5 rounded-xl bg-zinc-900 text-white text-[11px] font-black flex items-center gap-1.5 hover:bg-black transition whitespace-nowrap",children:[o(Ar,{className:"w-3.5 h-3.5"})," Alterar"]})]}),o("div",{className:"mt-2 text-[10px] font-semibold text-zinc-500 leading-snug",children:"Salvo localmente no navegador • use o ícone de olho para conferir antes de alterar"})]}),c("button",{onClick:Np,className:"mt-4 w-full flex items-center justify-center gap-1.5 text-[11px] font-bold border border-zinc-300 bg-white hover:bg-zinc-50 px-3 py-2.5 rounded-xl transition",children:[o(it,{className:"w-3.5 h-3.5"})," Bloquear ",M.nome.split(" ").pop()]})]}),c("div",{className:"p-5 space-y-6 overflow-auto flex-1",children:[c("div",{className:"bg-white border border-zinc-200 rounded-xl p-4 shadow-sm",children:[o("label",{className:"text-[11px] font-black tracking-widest text-zinc-600",children:"CAPACIDADE TOTAL DO ARMAZÉM (tn)"}),c("div",{className:"mt-2 w-full text-3xl font-black tracking-tight border border-zinc-200 rounded-xl px-4 py-3 bg-zinc-50 text-zinc-900",children:[Wn.toLocaleString("pt-BR")," tn"]}),c("div",{className:"mt-2 text-[10px] font-bold text-zinc-500 flex items-center gap-1",children:[o("span",{className:"w-1.5 h-1.5 rounded-full bg-green-500"})," Soma automática das capacidades dos silos"]}),c("div",{className:"mt-4 space-y-2",children:[o("div",{className:"h-3 bg-zinc-200 rounded-full overflow-hidden",children:o("div",{className:`h-full transition-all ${Fe(ue)}`,style:{width:`${Math.min(100,ue)}%`}})}),c("div",{className:"flex justify-between text-[11px] font-bold",children:[c("span",{className:ue<70?"text-green-600":ue<90?"text-yellow-600":"text-red-600",children:[ue.toFixed(1),"% ocupado"]}),c("span",{className:"text-zinc-500",children:[ul.toLocaleString("pt-BR")," tn livre"]})]}),c("div",{className:"flex gap-2 text-[10px]",children:[c("span",{className:"flex items-center gap-1",children:[o("span",{className:"w-2 h-2 rounded-full bg-green-500"})," <70%"]}),c("span",{className:"flex items-center gap-1",children:[o("span",{className:"w-2 h-2 rounded-full bg-yellow-500"})," 70-90%"]}),c("span",{className:"flex items-center gap-1",children:[o("span",{className:"w-2 h-2 rounded-full bg-red-500"})," >90%"]})]})]})]}),c("div",{children:[c("div",{className:"flex items-center justify-between mb-3",children:[c("div",{className:"text-[11px] font-black tracking-widest text-zinc-600",children:["SILOS / ARMAZÉNS (",M.silos.length,")"]}),o("div",{className:"flex gap-1",children:o("button",{onClick:Tp,className:"text-[11px] font-bold bg-zinc-900 text-white px-2.5 py-1 rounded-full hover:bg-black",children:"+ Adicionar"})})]}),o("div",{className:"space-y-3.5",children:M.silos.map((d)=>{let h=ct(d.status),_=sf[h],z=hp(d);return c("div",{className:"bg-white border border-zinc-200 rounded-xl p-3 shadow-sm",children:[c("div",{className:"flex flex-wrap items-center gap-2",children:[o("span",{className:"text-[16px] leading-none",title:z?"Armazém":"Silo",children:z?"\uD83C\uDFDA️":"\uD83C\uDFD7️"}),o("input",{value:d.nome,onChange:(C)=>dt(d.id,{nome:C.target.value.toUpperCase()}),className:"font-black text-[13px] tracking-wide bg-zinc-50 border border-zinc-200 rounded px-2 py-1 w-[92px] focus:outline-none focus:border-[#2e7d32]",placeholder:"SILO"}),c("select",{value:d.tipo||ft(d.nome),onChange:(C)=>dt(d.id,{tipo:C.target.value}),className:"text-[10px] font-black rounded-full px-2 py-1 border cursor-pointer bg-zinc-50 border-zinc-200",title:"Tipo",children:[o("option",{value:"silo",children:"\uD83C\uDFD7️ SILO"}),o("option",{value:"armazem",children:"\uD83C\uDFDA️ ARMAZÉM"})]}),c("select",{value:d.produto,onChange:(C)=>dt(d.id,{produto:C.target.value}),className:`text-[11px] font-black rounded-full px-2.5 py-1 border cursor-pointer ${d.produto==="MILHO"?"bg-yellow-100 border-yellow-300 text-yellow-800":"bg-[#ede0d2] border-[#d8c3ad] text-[#6b4f35]"}`,children:[o("option",{value:"MILHO",children:"\uD83C\uDF3D MILHO"}),o("option",{value:"SOJA",children:"\uD83E\uDED8 SOJA"})]}),c("select",{value:h,onChange:(C)=>dt(d.id,{status:C.target.value}),className:`text-[11px] font-black rounded-full px-2.5 py-1 border cursor-pointer ${_.select}`,children:[o("option",{value:"vazio",children:"⭕ Vazio"}),o("option",{value:"enchendo",children:"▲ Enchendo"}),o("option",{value:"cheio",children:"■ Cheio"}),o("option",{value:"esvaziando",children:"▼ Esvaziando"})]})]}),c("div",{className:"mt-3 grid grid-cols-2 gap-2",children:[c("div",{children:[o("div",{className:"text-[10px] font-bold text-zinc-500 tracking-wide",children:"ESTOQUE (tn)"}),o("input",{type:"number",value:d.estoque,onChange:(C)=>dt(d.id,{estoque:Number(C.target.value)||0}),className:"mt-1 w-full text-sm font-bold border border-zinc-200 rounded-lg px-2.5 py-2 bg-zinc-50 focus:outline-none focus:border-[#2e7d32]"})]}),c("div",{children:[o("div",{className:"text-[10px] font-bold text-zinc-500 tracking-wide",children:"CAP. SILO (tn)"}),o("input",{type:"number",value:d.capacidade,onChange:(C)=>dt(d.id,{capacidade:Number(C.target.value)||1}),className:"mt-1 w-full text-sm font-bold border border-zinc-200 rounded-lg px-2.5 py-2 bg-zinc-50 focus:outline-none focus:border-[#2e7d32]"})]})]}),c("div",{className:"mt-2.5 flex items-center justify-between",children:[c("div",{className:"flex items-center gap-1.5",children:[c("span",{className:`text-[9px] font-black tracking-widest px-2 py-0.5 rounded-full border flex items-center gap-1 ${_.badge}`,children:[o("span",{children:_.icon})," ",h.toUpperCase()]}),c("span",{className:"text-[10px] text-zinc-500 font-semibold",children:[d.capacidade?(d.estoque/d.capacidade*100).toFixed(1):"0","% • livre ",(d.capacidade-d.estoque).toLocaleString("pt-BR")]})]}),o("button",{onClick:()=>Mp(d.id),className:"text-[11px] font-bold text-red-600 hover:text-red-700 px-2 py-1 rounded",children:"Remover"})]})]},d.id)})})]}),c("div",{className:"flex gap-2",children:[o("button",{onClick:Vp,className:"flex-1 bg-[#2e7d32] text-white font-black text-sm py-3 rounded-xl hover:bg-[#256628] shadow-sm",children:"Salvar"}),o("button",{onClick:()=>{ try{ const b=localStorage.getItem("painel-agil-estoques-v3_backup"); if(b){ localStorage.setItem("painel-agil-estoques-v3", b); } }catch{} window.location.reload(); },className:"flex-1 bg-white border border-zinc-300 font-bold text-sm py-3 rounded-xl hover:bg-zinc-50",children:"Cancelar"})]})]})]})})]}),o("div",{id:"area-exportacao-todos",style:{position:"absolute",left:"-9999px",top:0,width:"1080px",background:"#ffffff",padding:"0"},children:c("div",{className:"bg-white rounded-[12px] border border-zinc-200 shadow-sm p-[24px] flex flex-col gap-6",style:{width:"1024px"},children:[o("div",{className:"pb-5 border-b border-zinc-100",children:c("div",{className:"flex flex-wrap items-end justify-between gap-4",children:[c("div",{children:[c("div",{className:"flex flex-wrap items-baseline gap-3",children:[o("span",{className:"text-[#2e7d32] font-black tracking-tighter leading-none",style:{fontSize:"28px"},children:"AGIL"}),o("span",{className:"font-black italic tracking-tight text-black leading-none",style:{fontSize:"28px"},children:"Armazéns GT - Visão Geral"}),c("span",{className:"inline-flex items-center px-3 py-1 rounded-full bg-zinc-50 border border-zinc-200 text-[11px] font-black tracking-wide text-zinc-600 shadow-sm",children:[e.length," unidades • TODOS"]})]}),c("div",{className:"mt-2 flex flex-wrap items-center gap-2 text-[11px] font-semibold text-zinc-400",children:[c("span",{children:["Exportado em ",new Date().toLocaleString("pt-BR",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit"})]}),o("span",{className:"w-1 h-1 rounded-full bg-zinc-300"}),c("span",{children:[U.totalGeral.toLocaleString("pt-BR")," tn armazenados no total"]}),o("span",{className:"w-1 h-1 rounded-full bg-zinc-300"}),c("span",{className:U.ocupMedia>90?"text-red-600":U.ocupMedia>70?"text-amber-600":"text-green-600",children:[U.ocupMedia.toFixed(1),"% ocupação média"]})]})]}),c("div",{className:"text-right",children:[o("div",{className:"text-[10px] font-black tracking-widest text-zinc-400",children:"CAPACIDADE TOTAL GT"}),c("div",{className:"text-[13px] font-black text-zinc-800",children:[U.capTotal.toLocaleString("pt-BR")," tn"]}),c("div",{className:"text-[10px] font-bold text-zinc-400",children:[(U.capTotal-U.totalGeral).toLocaleString("pt-BR")," tn livre"]})]})]})}),c("div",{className:"grid grid-cols-4 gap-3",children:[c("div",{className:"bg-white border border-zinc-200 rounded-xl p-4 shadow-sm",children:[o("div",{className:"text-[10px] font-black tracking-widest text-zinc-500",children:"ESTOQUE TOTAL GT"}),c("div",{className:"mt-1 text-[22px] font-black tracking-tight text-zinc-900 leading-none",children:[U.totalGeral.toLocaleString("pt-BR")," ",o("span",{className:"text-[12px] font-bold text-zinc-500",children:"tn"})]}),c("div",{className:"mt-2 text-[11px] font-semibold text-zinc-500",children:["Cap. ",U.capTotal.toLocaleString("pt-BR")," tn"]}),o("div",{className:"mt-2 h-1.5 bg-zinc-200 rounded-full overflow-hidden",children:o("div",{className:`h-full ${Fe(U.ocupMedia)}`,style:{width:`${Math.min(100,U.ocupMedia)}%`}})})]}),c("div",{className:"rounded-xl p-4 shadow-sm border border-[#fde68a]/60",style:{backgroundColor:"#fef9e7"},children:[o("div",{className:"text-[10px] font-black tracking-widest text-[#92400e]",children:"TOTAL MILHO GT"}),c("div",{className:"mt-1 text-[22px] font-black tracking-tight text-[#78350f] leading-none",children:[U.totalMilho.toLocaleString("pt-BR")," ",o("span",{className:"text-[12px] font-bold text-[#a16207]",children:"tn"})]}),c("div",{className:"mt-2 text-[11px] font-bold text-[#a16207]",children:[U.totalGeral?(U.totalMilho/U.totalGeral*100).toFixed(1):"0","% do total"]})]}),c("div",{className:"rounded-xl p-4 shadow-sm border border-[#fed7aa]/70",style:{backgroundColor:"#fef3e2"},children:[o("div",{className:"text-[10px] font-black tracking-widest text-[#9c4221]",children:"TOTAL SOJA GT"}),c("div",{className:"mt-1 text-[22px] font-black tracking-tight text-[#7c2d12] leading-none",children:[U.totalSoja.toLocaleString("pt-BR")," ",o("span",{className:"text-[12px] font-bold text-[#9c4221]",children:"tn"})]}),c("div",{className:"mt-2 text-[11px] font-bold text-[#9c4221]",children:[U.totalGeral?(U.totalSoja/U.totalGeral*100).toFixed(1):"0","% do total"]})]}),c("div",{className:"bg-white border border-zinc-200 rounded-xl p-4 shadow-sm",children:[o("div",{className:"text-[10px] font-black tracking-widest text-zinc-500",children:"% OCUPAÇÃO MÉDIA"}),c("div",{className:"mt-1 flex items-baseline gap-2",children:[c("span",{className:"text-[22px] font-black tracking-tight leading-none",children:[U.ocupMedia.toFixed(1),"%"]}),o("span",{className:`text-[10px] font-black px-2 py-0.5 rounded-full text-white ${Fe(U.ocupMedia)}`,children:U.ocupMedia<70?"OK":U.ocupMedia<90?"ATENÇÃO":"CHEIO"})]}),o("div",{className:"mt-3 h-2 bg-zinc-200 rounded-full overflow-hidden",children:o("div",{className:`h-full ${Fe(U.ocupMedia)}`,style:{width:`${Math.min(100,U.ocupMedia)}%`}})})]})]}),c("div",{className:"rounded-xl border border-zinc-200 overflow-hidden bg-white shadow-sm",children:[c("div",{className:"bg-[#f8f8f7] px-4 py-3 border-b border-zinc-200 flex items-center justify-between",children:[o("div",{className:"text-[11px] font-black tracking-widest text-zinc-600",children:"RESUMO POR ARMAZÉM • VISÃO GERAL GT"}),c("div",{className:"text-[10px] font-bold text-zinc-400",children:[e.length," armazéns"]})]}),c("table",{className:"w-full text-[12px]",children:[o("thead",{children:c("tr",{className:"bg-[#f3f3f2] text-[10px] tracking-widest text-zinc-500 border-b border-zinc-200",children:[o("th",{className:"text-left font-black px-4 py-2.5",children:"Armazém"}),o("th",{className:"text-left font-black px-3 py-2.5",children:"Silos"}),o("th",{className:"text-right font-black px-3 py-2.5",children:"Milho (tn)"}),o("th",{className:"text-right font-black px-3 py-2.5",children:"Soja (tn)"}),o("th",{className:"text-right font-black px-3 py-2.5",children:"Total (tn)"}),o("th",{className:"text-right font-black px-4 py-2.5",children:"Ocup %"})]})}),o("tbody",{children:e.map((d,h)=>{let _=d.silos.reduce(($,H)=>$+H.estoque,0),z=d.silos.filter(($)=>$.produto==="MILHO").reduce(($,H)=>$+H.estoque,0),C=d.silos.filter(($)=>$.produto==="SOJA").reduce(($,H)=>$+H.estoque,0),P=Ef(d),F=P?_/P*100:0;return c("tr",{className:`border-b border-zinc-100 ${h%2===0?"bg-white":"bg-[#fafaf9]"}`,children:[o("td",{className:"px-4 py-2.5 font-bold text-zinc-800",children:d.nome}),o("td",{className:"px-3 py-2.5 text-zinc-600 font-semibold",children:d.silos.length}),o("td",{className:"px-3 py-2.5 text-right font-bold text-[#854d0e]",children:z.toLocaleString("pt-BR")}),o("td",{className:"px-3 py-2.5 text-right font-bold text-[#5c3d2e]",children:C.toLocaleString("pt-BR")}),o("td",{className:"px-3 py-2.5 text-right font-black text-zinc-900",children:_.toLocaleString("pt-BR")}),o("td",{className:"px-4 py-2.5 text-right",children:c("div",{className:"flex items-center justify-end gap-2",children:[c("span",{className:"text-[11px] font-black min-w-[36px]",children:[F.toFixed(1),"%"]}),o("div",{className:"w-12 h-2 bg-zinc-200 rounded-full overflow-hidden border border-zinc-200",children:o("div",{className:`h-full ${Fe(F)}`,style:{width:`${Math.min(100,F)}%`}})})]})})]},d.id)})})]}),c("div",{className:"bg-[#fafaf8] border-t border-zinc-200 divide-y divide-zinc-200 text-[13px]",children:[c("div",{className:"flex justify-between px-4 py-3",children:[o("span",{className:"font-bold text-zinc-600",children:"Total Geral"}),c("span",{className:"font-black text-zinc-900",children:[U.totalGeral.toLocaleString("pt-BR")," tn"]})]}),c("div",{className:"flex justify-between px-4 py-3",children:[o("span",{className:"font-bold text-[#92400e]",children:"Total Milho GT"}),c("span",{className:"font-black text-[#78350f]",children:[U.totalMilho.toLocaleString("pt-BR")," tn"]})]}),c("div",{className:"flex justify-between px-4 py-3",children:[o("span",{className:"font-bold text-[#7c2d12]",children:"Total Soja GT"}),c("span",{className:"font-black text-[#5c2a14]",children:[U.totalSoja.toLocaleString("pt-BR")," tn"]})]}),c("div",{className:"flex justify-between px-4 py-3 bg-white",children:[o("span",{className:"font-bold text-zinc-600",children:"Capacidade Total GT"}),c("span",{className:"font-black text-zinc-900",children:[U.capTotal.toLocaleString("pt-BR")," tn • ",U.ocupMedia.toFixed(1),"% ocupação"]})]})]})]}),c("div",{className:"pt-2 flex justify-between items-center text-[10px] font-semibold text-zinc-400",children:[o("span",{children:"AGIL • Painel de Estoques • Visão Geral GT - Todos Armazéns"}),c("span",{children:[new Date().toLocaleString("pt-BR",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit"})," • ",e.length," armazéns"]})]})]})}),l&&o("div",{className:"fixed bottom-4 left-1/2 -translate-x-1/2 bg-zinc-900 text-white text-sm font-bold px-4 py-2.5 rounded-full shadow-xl z-50",children:l}),g&&o("div",{id:"modalExport",style:{display:"flex",position:"fixed",inset:0,background:"rgba(0,0,0,0.7)",zIndex:99999,alignItems:"center",justifyContent:"center",padding:"16px"},onClick:(d)=>{if(d.target===d.currentTarget)w(!1)},children:c("div",{style:{background:"white",borderRadius:"16px",padding:"24px",maxWidth:"420px",width:"100%",boxShadow:"0 20px 50px rgba(0,0,0,0.35)",maxHeight:"90vh",overflowY:"auto"},children:[c("div",{className:"flex items-start justify-between gap-3 mb-3",children:[c("div",{children:[o("h3",{style:{margin:0,fontSize:"18px",fontWeight:900,letterSpacing:"-0.02em"},children:"\uD83D\uDCF8 Exportar Armazéns"}),o("p",{style:{fontSize:"12px",color:"#71717a",marginTop:"4px",fontWeight:600},children:"Selecione quais armazéns exportar em alta qualidade. Cada um gera um arquivo individual com seu nome."})]}),o("button",{onClick:()=>w(!1),className:"w-8 h-8 rounded-full bg-zinc-100 hover:bg-zinc-200 flex items-center justify-center shrink-0",children:o(jr,{className:"w-4 h-4"})})]}),c("label",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"12px",background:m?"#f0fdf4":"#fafafa",border:m?"2px solid #16a34a":"2px solid #e4e4e7",borderRadius:"10px",marginBottom:"10px",cursor:"pointer",transition:"all 0.15s"},className:"hover:shadow-sm",children:[o("input",{type:"checkbox",checked:m,onChange:(d)=>Up(d.target.checked),style:{width:"18px",height:"18px"}}),c("div",{className:"flex-1",children:[c("div",{style:{fontWeight:900,fontSize:"13px",color:m?"#15803d":"#18181b"},className:"flex items-center gap-1.5",children:[m&&o(Zr,{className:"w-4 h-4"})," ✓ TODOS - Armazéns GT (visão geral)"]}),o("div",{style:{fontSize:"11px",color:"#71717a",fontWeight:600,marginTop:"2px"},children:"Gera 1 arquivo: Armazens_GT_YYYY-MM-DD.png com resumo de todos"})]})]}),c("div",{className:"text-[10px] font-black tracking-widest text-zinc-400 px-1 mb-2",children:["ARMAZÉNS INDIVIDUAIS ",m?"(todos marcados)":`(${S.length} selecionados)`]}),o("div",{id:"listaChecks",style:{maxHeight:"260px",overflowY:"auto",display:"grid",gap:"6px",paddingRight:"2px"},children:e.map((d)=>{let h=d.silos.reduce((P,F)=>P+F.estoque,0),_=Ef(d),z=_?h/_*100:0,C=S.includes(d.id);return c("label",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"10px 12px",background:C?"#f8fafc":"white",border:C?"1.5px solid #2e7d32":"1.5px solid #e4e4e7",borderRadius:"10px",cursor:"pointer",opacity:m?0.6:1},className:"hover:border-zinc-300 transition-colors",children:[o("input",{type:"checkbox",checked:C,disabled:m,onChange:(P)=>Wp(d.id,P.target.checked),style:{width:"16px",height:"16px"}}),c("div",{className:"flex-1 min-w-0",children:[o("div",{className:"font-bold text-[13px] text-zinc-900 truncate",children:d.nome}),c("div",{className:"text-[11px] text-zinc-500 font-semibold",children:[h.toLocaleString("pt-BR")," tn • ",z.toFixed(0),"% • ",d.silos.length," unid"]})]}),c("div",{className:`text-[10px] font-black px-2 py-0.5 rounded-full ${z>90?"bg-red-100 text-red-700":z>70?"bg-amber-100 text-amber-700":"bg-green-100 text-green-700"}`,children:[z.toFixed(0),"%"]})]},d.id)})}),c("div",{style:{display:"flex",gap:"8px",marginTop:"18px"},children:[o("button",{onClick:()=>w(!1),disabled:i,style:{flex:1,padding:"12px",border:"1px solid #d4d4d8",borderRadius:"10px",background:"#f4f4f5",fontWeight:700,fontSize:"13px"},className:"hover:bg-zinc-200 disabled:opacity-50",children:"Cancelar"}),o("button",{onClick:Bp,disabled:i||!m&&S.length===0,style:{flex:2,padding:"12px",background:i?"#15803d":"#16a34a",color:"white",border:"none",borderRadius:"10px",fontWeight:900,fontSize:"13px",display:"flex",alignItems:"center",justifyContent:"center",gap:"6px"},className:"hover:bg-[#15803d] disabled:opacity-50",children:i?c(ot,{children:[o(tn,{className:"w-4 h-4 animate-spin"}),J||"Gerando..."]}):c(ot,{children:["\uD83D\uDCF8 Exportar ",m?"Visão GT":`${S.length} selecionado(s)`]})})]}),o("div",{className:"mt-3 text-[10px] text-zinc-400 font-semibold leading-snug text-center",children:"Alta qualidade: scale 4 no mobile, 3 no desktop • Web Share abre direto no celular • Arquivos: AGIL_Nome_YYYY-MM-DD.png ou Armazens_GT_YYYY-MM-DD.png"})]})}),a&&o("div",{id:"modalTipoEscolha",className:"fixed inset-0 z-[99999] flex items-center justify-center p-4",style:{background:"rgba(0,0,0,0.65)"},onClick:(d)=>{if(d.target===d.currentTarget)s(!1)},children:c("div",{className:"bg-white rounded-[16px] p-7 max-w-[380px] w-[92%] shadow-[0_20px_40px_rgba(0,0,0,0.3)] animate-[fadeIn_0.2s_ease-out]",children:[o("h3",{className:"m-0 mb-2 text-[18px] font-bold",children:"Qual tipo de estoque?"}),o("p",{className:"m-0 mb-4 text-[#666] text-[13px] leading-snug",children:"Escolha o tipo para adicionar. Depois você ajusta capacidade, quantidade, produto e status na lista abaixo."}),c("div",{className:"grid gap-2.5",children:[c("button",{onClick:()=>Pf("silo"),className:"flex items-center gap-3 p-4 border-2 border-[#16a34a] bg-[#f0fdf4] rounded-xl cursor-pointer text-left w-full hover:bg-[#dcfce7] transition-colors",children:[o("span",{className:"text-[28px]",children:"\uD83C\uDFD7️"}),c("div",{children:[o("div",{className:"font-bold text-[14px]",children:"SILO"}),o("div",{className:"text-[12px] text-[#666]",children:"Cilíndrico vertical - com pico/vale"})]})]}),c("button",{onClick:()=>Pf("armazem"),className:"flex items-center gap-3 p-4 border-2 border-[#ea580c] bg-[#fff7ed] rounded-xl cursor-pointer text-left w-full hover:bg-[#ffedd5] transition-colors",children:[o("span",{className:"text-[28px]",children:"\uD83C\uDFDA️"}),c("div",{children:[o("div",{className:"font-bold text-[14px]",children:"ARMAZÉM / GRANELEIRO"}),o("div",{className:"text-[12px] text-[#666]",children:"Galpão retangular - topo reto"})]})]})]}),o("button",{onClick:()=>s(!1),className:"mt-4 w-full p-2.5 border-0 bg-[#f3f4f6] rounded-lg cursor-pointer text-[13px] font-semibold hover:bg-zinc-200 transition",children:"Cancelar"})]})})]})}wp.createRoot(document.getElementById("root")).render(o(gp.default.StrictMode,{children:o(yf,{})}));