{id:59,nombre:"Llave golpe 2-7/16",cant:1,estado:"OK",check:true},{id:60,nombre:"Llave golpe 2-1/2",cant:1,estado:"OK",check:true},{id:61,nombre:"Llave golpe 2-3/16",cant:1,estado:"OK",check:true},{id:62,nombre:"Llave golpe 30mm",cant:1,estado:"OK",check:true},{id:63,nombre:"Llave golpe 41mm",cant:1,estado:"OK",check:true},{id:64,nombre:"Llave golpe 45mm",cant:1,estado:"OK",check:true},{id:65,nombre:"Llave golpe 52mm",cant:1,estado:"OK",check:true},{id:66,nombre:"Llave golpe 55mm",cant:1,estado:"OK",check:true},{id:67,nombre:"Llave golpe 65mm",cant:1,estado:"OK",check:true},{id:68,nombre:"Llave tubo 12",cant:1,estado:"OK",check:true},{id:69,nombre:"Llave tubo 18",cant:1,estado:"OK",check:true},{id:70,nombre:"Llave tubo 24",cant:1,estado:"OK",check:true},{id:71,nombre:"Llave tubo 36",cant:1,estado:"OK",check:true},{id:72,nombre:"Llave mixta 1",cant:1,estado:"OK",check:true},{id:73,nombre:"Llave mixta 1-1/16",cant:1,estado:"OK",check:true},{id:74,nombre:"Llave mixta 1-1/2",cant:1,estado:"OK",check:true},{id:75,nombre:"Llave mixta 1-1/4",cant:1,estado:"OK",check:true},{id:76,nombre:"Llave mixta 1-1/8",cant:1,estado:"OK",check:true},{id:77,nombre:"Llave mixta 1-11/16",cant:1,estado:"OK",check:true},{id:78,nombre:"Llave mixta 1-3/4",cant:1,estado:"OK",check:true},{id:79,nombre:"Llave mixta 1-3/8",cant:1,estado:"OK",check:true},{id:80,nombre:"Llave mixta 1-5/16",cant:1,estado:"OK",check:true},{id:81,nombre:"Llave mixta 1-5/8",cant:1,estado:"OK",check:true},{id:82,nombre:"Llave mixta 1-7/16",cant:1,estado:"OK",check:true},{id:83,nombre:"Llave mixta 1-7/8",cant:1,estado:"OK",check:true},{id:84,nombre:"Llave mixta 15/16",cant:1,estado:"OK",check:true},{id:85,nombre:"Llave mixta 2",cant:1,estado:"OK",check:true},{id:86,nombre:"Llave mixta 2-1/2",cant:1,estado:"OK",check:true},{id:87,nombre:"Llave mixta 2-1/4",cant:1,estado:"OK",check:true},{id:88,nombre:"Llave mixta 2-3/16",cant:1,estado:"OK",check:true},{id:89,nombre:"Llave mixta 2-3/8",cant:1,estado:"OK",check:true},{id:90,nombre:"Llave mixta 30mm",cant:1,estado:"OK",check:true},{id:91,nombre:"Llave mixta 32",cant:1,estado:"OK",check:true},{id:92,nombre:"Llave mixta 36-41",cant:1,estado:"OK",check:true},{id:93,nombre:"Llave mixta 7/8",cant:1,estado:"OK",check:true},{id:94,nombre:"Martillo cincelador",cant:1,estado:"OK",check:true},{id:95,nombre:"Mesa corte tripode",cant:1,estado:"OK",check:true},{id:96,nombre:"Motor-tool",cant:1,estado:"OK",check:true},{id:97,nombre:"Nivel 24",cant:1,estado:"OK",check:true},{id:98,nombre:"Nivel 48",cant:1,estado:"OK",check:true},{id:99,nombre:"Nivel torpedo",cant:1,estado:"OK",check:true},{id:100,nombre:"Pala",cant:1,estado:"OK",check:true},{id:101,nombre:"Parasol",cant:1,estado:"OK",check:true},{id:102,nombre:"Pico",cant:1,estado:"OK",check:true},{id:103,nombre:"Piola",cant:1,estado:"OK",check:true},{id:104,nombre:"Playo comun",cant:1,estado:"OK",check:true},{id:105,nombre:"Playo presion",cant:1,estado:"OK",check:true},{id:106,nombre:"Plomada",cant:1,estado:"OK",check:true},{id:107,nombre:"Prensa manual",cant:1,estado:"OK",check:true},{id:108,nombre:"Punto centro",cant:1,estado:"OK",check:true},{id:109,nombre:"Sacabocados 8",cant:8,estado:"OK",check:true},{id:110,nombre:"Taladro + llave",cant:1,estado:"OK",check:true},{id:111,nombre:"Tecle cadena 2tn",cant:1,estado:"OK",check:true},{id:112,nombre:"Tecle señorita",cant:1,estado:"OK",check:true},{id:113,nombre:"Teflon 5",cant:5,estado:"CONSUMIBLES",check:true},{id:114,nombre:"Termo agua",cant:1,estado:"OK",check:true},{id:115,nombre:"Termo porta electrodos",cant:1,estado:"OK",check:true},{id:116,nombre:"Tijera tool",cant:1,estado:"OK",check:true}];const LS_KEY='FINAL_NOVEDADES_FIX_08_10';let s=localStorage.getItem(LS_KEY);if(s){try{let p=JSON.parse(s);if(p.length>=100)herramientas=p;}catch(e){}}function calcJornada(){let f=document.getElementById('fechaInput').value;if(!f)return null;let i=new Date(f+'T00:00:00');let h=new Date();h.setHours(0,0,0,0);let d=Math.floor((h-i)/86400000);if(d<0)d=0;let c=d%21;let t=c<14;let dt=0,dv=0,fa=0,te="",cl="";if(t){dt=c+1;fa=14-dt;te=`TRABAJANDO DIA ${dt}/14 - Faltan ${fa} para vacaciones`;cl="banner-trab";}else{dv=c-14+1;fa=7-dv;te=`VACACIONES DIA ${dv}/7 - Faltan ${fa} para trabajar`;cl="banner-vac";}return{trabajando:t,diaTrab:dt,diaVac:dv,faltan:fa,texto:te,clase:cl};}function save(){localStorage.setItem(LS_KEY,JSON.stringify(herramientas));localStorage.setItem('camion3606_fecha',document.getElementById('fechaInput').value);}function render(){let f=(document.getElementById('buscar').value||'').toLowerCase();let cont=document.getElementById('lista');cont.innerHTML='';let nov=[];herramientas.forEach((h,idx)=>{if(h.estado!=='OK'&&h.estado!=='CONSUMIBLES')nov.push(Object.assign({},h,{idx:idx}));if(f&&!h.nombre.toLowerCase().includes(f))return;let cc=h.estado==='OK'?'st-OK':'st-MAL';let div=document.createElement('div');div.className='row';div.innerHTML=`
${h.nombre}${h.estado}
`;cont.appendChild(div);});let tf=herramientas.length;let fo=herramientas.filter(x=>x.check).length;let tu=herramientas.reduce((a,b)=>a+b.cant,0);let uo=herramientas.filter(x=>x.check).reduce((a,b)=>a+b.cant,0);document.getElementById('cFilas').innerText=fo;document.getElementById('cFilasDet').innerText=fo+'/'+tf;document.getElementById('cUnid').innerText=uo;document.getElementById('cUnidDet').innerText=uo+'/'+tu;let j=calcJornada();if(j){let b=document.getElementById('vacBanner');b.className='banner '+j.clase;b.innerText=j.texto;document.getElementById('cCiclo').innerText=j.trabajando?j.diaTrab:j.diaVac;document.getElementById('cCicloDet').innerHTML=j.trabajando?`Trab ${j.diaTrab}/14
Faltan ${j.faltan}`:`Vac ${j.diaVac}/7
Faltan ${j.faltan}`;}document.getElementById('novCount').innerText=nov.length;let nl=document.getElementById('novList');if(nov.length===0)nl.innerHTML='
✅ Sin novedades - todo OK
';else nl.innerHTML=nov.map(h=>`
🔸 ${h.nombre} x${h.cant} → ${h.estado}
`).join('');}function solucionar(i){herramientas[i].estado='OK';herramientas[i].check=true;save();render();}function toggleTodo(){let a=herramientas.some(h=>!h.check);herramientas.forEach(h=>h.check=a);save();render();}function marcarIngreso(){herramientas.forEach(h=>h.check=true);save();render();}function marcarSalida(){let f=herramientas.filter(h=>!h.check||(h.estado!=='OK'&&h.estado!=='CONSUMIBLES'));alert('Faltantes: '+f.length+'\n'+f.map(x=>x.nombre+' -> '+x.estado).join('\n'));}function nuevaJornada(){if(confirm('¿NUEVA JORNADA DIA 1?')){let hoy=new Date().toISOString().split('T')[0];document.getElementById('fechaInput').value=hoy;herramientas.forEach(h=>{h.check=true;});save();render();}}function guardarFecha(){save();render();}function buildPDF(){const{jsPDF}=window.jspdf;const pdf=new jsPDF('p','mm','a4');let left=8,right=202,width=right-left;let top=16;let colDescW=150;let xDesc=left,xCant=left+colDescW;function cab(y){pdf.setFillColor(0,0,0);pdf.setTextColor(255,255,255);pdf.rect(left,y,width,13,'F');pdf.setFont('helvetica','bold');pdf.setFontSize(16);pdf.text('DESCRIPCION',xDesc+5,y+9);pdf.text('CANT',xCant+7,y+9);pdf.setTextColor(0,0,0);return y+13;}pdf.setFont('helvetica','bold');pdf.setFontSize(20);pdf.text('HERRAMIENTAS CAMION SUELDA',105,top,{align:'center'});top+=14;top=cab(top);herramientas.forEach((h,i)=>{let rh=12;if(top+rh>285){pdf.addPage();top=10;top=cab(top);}if(i%2==0){pdf.setFillColor(232,232,232);pdf.rect(left,top,width,rh,'F');}pdf.setDrawColor(160,160,160);pdf.rect(left,top,width,rh);pdf.line(xCant,top,xCant,top+rh);pdf.setFont('helvetica','bold');pdf.setFontSize(16);pdf.text(h.nombre.substring(0,42),xDesc+5,top+8.5);pdf.setFontSize(18);pdf.text(String(h.cant),xCant+10,top+8.5,{align:'center'});top+=rh;});return pdf;}function guardarPDF(){let pdf=buildPDF();pdf.save('HERRAMIENTAS.pdf');}async function enviarListadoPDF(){let pdf=buildPDF();let blob=pdf.output('blob');let file=new File([blob],'HERRAMIENTAS.pdf',{type:'application/pdf'});if(navigator.canShare&&navigator.canShare({files:[file]})){try{await navigator.share({files:[file],title:'HERRAMIENTAS'});return;}catch(e){}}window.open(URL.createObjectURL(blob),'_blank');}async function enviarNovedadesImagen(){let novedades=herramientas.filter(h=>h.estado!=='OK'&&h.estado!=='CONSUMIBLES');if(novedades.length===0){alert('Sin novedades');return;}let c=document.getElementById('canvasNov');let ctx=c.getContext('2d');let ancho=1000;let altoCab=220;let altoFila=75;let alto=altoCab+novedades.length*altoFila+40;c.width=ancho;c.height=alto;ctx.fillStyle='#fff';ctx.fillRect(0,0,ancho,alto);ctx.fillStyle='#d32f2f';ctx.font='bold 62px Arial';ctx.textAlign='center';ctx.fillText('⚠️ NOVEDADES',ancho/2,80);ctx.fillStyle='#000';ctx.font='bold 36px Arial';ctx.fillText('CAMION SUELDA - '+novedades.length+' ITEMS',ancho/2,130);let y=altoCab;ctx.fillStyle='#000';ctx.fillRect(20,y-55,ancho-40,55);ctx.fillStyle='#fff';ctx.font='bold 34px Arial';ctx.textAlign='left';ctx.fillText('DESCRIPCION',40,y-15);ctx.textAlign='center';ctx.fillText('CANT',750,y-15);ctx.fillText('ESTADO',900,y-15);novedades.forEach((h,i)=>{let yy=y+i*altoFila;if(i%2==0){ctx.fillStyle='#e8e8e8';ctx.fillRect(20,yy,ancho-40,altoFila);}ctx.strokeStyle='#ccc';ctx.lineWidth=2;ctx.strokeRect(20,yy,ancho-40,altoFila);ctx.beginPath();ctx.moveTo(680,yy);ctx.lineTo(680,yy+altoFila);ctx.stroke();ctx.beginPath();ctx.moveTo(820,yy);ctx.lineTo(820,yy+altoFila);ctx.stroke();ctx.fillStyle='#000';ctx.font='bold 32px Arial';ctx.textAlign='left';ctx.fillText(h.nombre.substring(0,30),35,yy+48);ctx.font='bold 38px Arial';ctx.textAlign='center';ctx.fillText(String(h.cant),750,yy+50);ctx.font='bold 28px Arial';ctx.fillStyle=h.estado=='NO HAY'?'#d32f2f':'#ff6f00';ctx.fillText(h.estado,900,yy+50);});c.toBlob(async(blob)=>{let file=new File([blob],'NOVEDADES_'+novedades.length+'.png',{type:'image/png'});if(navigator.canShare&&navigator.canShare({files:[file]})){try{await navigator.share({files:[file],title:'NOVEDADES CAMION SUELDA',text:'NOVEDADES CAMION SUELDA - '+novedades.length+' ITEMS'});return;}catch(e){}}window.open(URL.createObjectURL(blob),'_blank');},'image/png');}let fg=localStorage.getItem('camion3606_fecha');if(fg)document.getElementById('fechaInput').value=fg;render(); {id:59,nombre:"Llave golpe 2-7/16",cant:1,estado:"OK",check:true},{id:60,nombre:"Llave golpe 2-1/2",cant:1,estado:"OK",check:true},{id:61,nombre:"Llave golpe 2-3/16",cant:1,estado:"OK",check:true},{id:62,nombre:"Llave golpe 30mm",cant:1,estado:"OK",check:true},{id:63,nombre:"Llave golpe 41mm",cant:1,estado:"OK",check:true},{id:64,nombre:"Llave golpe 45mm",cant:1,estado:"OK",check:true},{id:65,nombre:"Llave golpe 52mm",cant:1,estado:"OK",check:true},{id:66,nombre:"Llave golpe 55mm",cant:1,estado:"OK",check:true},{id:67,nombre:"Llave golpe 65mm",cant:1,estado:"OK",check:true},{id:68,nombre:"Llave tubo 12",cant:1,estado:"OK",check:true},{id:69,nombre:"Llave tubo 18",cant:1,estado:"OK",check:true},{id:70,nombre:"Llave tubo 24",cant:1,estado:"OK",check:true},{id:71,nombre:"Llave tubo 36",cant:1,estado:"OK",check:true},{id:72,nombre:"Llave mixta 1",cant:1,estado:"OK",check:true},{id:73,nombre:"Llave mixta 1-1/16",cant:1,estado:"OK",check:true},{id:74,nombre:"Llave mixta 1-1/2",cant:1,estado:"OK",check:true},{id:75,nombre:"Llave mixta 1-1/4",cant:1,estado:"OK",check:true},{id:76,nombre:"Llave mixta 1-1/8",cant:1,estado:"OK",check:true},{id:77,nombre:"Llave mixta 1-11/16",cant:1,estado:"OK",check:true},{id:78,nombre:"Llave mixta 1-3/4",cant:1,estado:"OK",check:true},{id:79,nombre:"Llave mixta 1-3/8",cant:1,estado:"OK",check:true},{id:80,nombre:"Llave mixta 1-5/16",cant:1,estado:"OK",check:true},{id:81,nombre:"Llave mixta 1-5/8",cant:1,estado:"OK",check:true},{id:82,nombre:"Llave mixta 1-7/16",cant:1,estado:"OK",check:true},{id:83,nombre:"Llave mixta 1-7/8",cant:1,estado:"OK",check:true},{id:84,nombre:"Llave mixta 15/16",cant:1,estado:"OK",check:true},{id:85,nombre:"Llave mixta 2",cant:1,estado:"OK",check:true},{id:86,nombre:"Llave mixta 2-1/2",cant:1,estado:"OK",check:true},{id:87,nombre:"Llave mixta 2-1/4",cant:1,estado:"OK",check:true},{id:88,nombre:"Llave mixta 2-3/16",cant:1,estado:"OK",check:true},{id:89,nombre:"Llave mixta 2-3/8",cant:1,estado:"OK",check:true},{id:90,nombre:"Llave mixta 30mm",cant:1,estado:"OK",check:true},{id:91,nombre:"Llave mixta 32",cant:1,estado:"OK",check:true},{id:92,nombre:"Llave mixta 36-41",cant:1,estado:"OK",check:true},{id:93,nombre:"Llave mixta 7/8",cant:1,estado:"OK",check:true},{id:94,nombre:"Martillo cincelador",cant:1,estado:"OK",check:true},{id:95,nombre:"Mesa corte tripode",cant:1,estado:"OK",check:true},{id:96,nombre:"Motor-tool",cant:1,estado:"OK",check:true},{id:97,nombre:"Nivel 24",cant:1,estado:"OK",check:true},{id:98,nombre:"Nivel 48",cant:1,estado:"OK",check:true},{id:99,nombre:"Nivel torpedo",cant:1,estado:"OK",check:true},{id:100,nombre:"Pala",cant:1,estado:"OK",check:true},{id:101,nombre:"Parasol",cant:1,estado:"OK",check:true},{id:102,nombre:"Pico",cant:1,estado:"OK",check:true},{id:103,nombre:"Piola",cant:1,estado:"OK",check:true},{id:104,nombre:"Playo comun",cant:1,estado:"OK",check:true},{id:105,nombre:"Playo presion",cant:1,estado:"OK",check:true},{id:106,nombre:"Plomada",cant:1,estado:"OK",check:true},{id:107,nombre:"Prensa manual",cant:1,estado:"OK",check:true},{id:108,nombre:"Punto centro",cant:1,estado:"OK",check:true},{id:109,nombre:"Sacabocados 8",cant:8,estado:"OK",check:true},{id:110,nombre:"Taladro + llave",cant:1,estado:"OK",check:true},{id:111,nombre:"Tecle cadena 2tn",cant:1,estado:"OK",check:true},{id:112,nombre:"Tecle señorita",cant:1,estado:"OK",check:true},{id:113,nombre:"Teflon 5",cant:5,estado:"CONSUMIBLES",check:true},{id:114,nombre:"Termo agua",cant:1,estado:"OK",check:true},{id:115,nombre:"Termo porta electrodos",cant:1,estado:"OK",check:true},{id:116,nombre:"Tijera tool",cant:1,estado:"OK",check:true}];const LS_KEY='FINAL_NOVEDADES_FIX_08_10';let s=localStorage.getItem(LS_KEY);if(s){try{let p=JSON.parse(s);if(p.length>=100)herramientas=p;}catch(e){}}function calcJornada(){let f=document.getElementById('fechaInput').value;if(!f)return null;let i=new Date(f+'T00:00:00');let h=new Date();h.setHours(0,0,0,0);let d=Math.floor((h-i)/86400000);if(d<0)d=0;let c=d%21;let t=c<14;let dt=0,dv=0,fa=0,te="",cl="";if(t){dt=c+1;fa=14-dt;te=`TRABAJANDO DIA ${dt}/14 - Faltan ${fa} para vacaciones`;cl="banner-trab";}else{dv=c-14+1;fa=7-dv;te=`VACACIONES DIA ${dv}/7 - Faltan ${fa} para trabajar`;cl="banner-vac";}return{trabajando:t,diaTrab:dt,diaVac:dv,faltan:fa,texto:te,clase:cl};}function save(){localStorage.setItem(LS_KEY,JSON.stringify(herramientas));localStorage.setItem('camion3606_fecha',document.getElementById('fechaInput').value);}function render(){let f=(document.getElementById('buscar').value||'').toLowerCase();let cont=document.getElementById('lista');cont.innerHTML='';let nov=[];herramientas.forEach((h,idx)=>{if(h.estado!=='OK'&&h.estado!=='CONSUMIBLES')nov.push(Object.assign({},h,{idx:idx}));if(f&&!h.nombre.toLowerCase().includes(f))return;let cc=h.estado==='OK'?'st-OK':'st-MAL';let div=document.createElement('div');div.className='row';div.innerHTML=`
${h.nombre}${h.estado}
`;cont.appendChild(div);});let tf=herramientas.length;let fo=herramientas.filter(x=>x.check).length;let tu=herramientas.reduce((a,b)=>a+b.cant,0);let uo=herramientas.filter(x=>x.check).reduce((a,b)=>a+b.cant,0);document.getElementById('cFilas').innerText=fo;document.getElementById('cFilasDet').innerText=fo+'/'+tf;document.getElementById('cUnid').innerText=uo;document.getElementById('cUnidDet').innerText=uo+'/'+tu;let j=calcJornada();if(j){let b=document.getElementById('vacBanner');b.className='banner '+j.clase;b.innerText=j.texto;document.getElementById('cCiclo').innerText=j.trabajando?j.diaTrab:j.diaVac;document.getElementById('cCicloDet').innerHTML=j.trabajando?`Trab ${j.diaTrab}/14
Faltan ${j.faltan}`:`Vac ${j.diaVac}/7
Faltan ${j.faltan}`;}document.getElementById('novCount').innerText=nov.length;let nl=document.getElementById('novList');if(nov.length===0)nl.innerHTML='
✅ Sin novedades - todo OK
';else nl.innerHTML=nov.map(h=>`
🔸 ${h.nombre} x${h.cant} → ${h.estado}
`).join('');}function solucionar(i){herramientas[i].estado='OK';herramientas[i].check=true;save();render();}function toggleTodo(){let a=herramientas.some(h=>!h.check);herramientas.forEach(h=>h.check=a);save();render();}function marcarIngreso(){herramientas.forEach(h=>h.check=true);save();render();}function marcarSalida(){let f=herramientas.filter(h=>!h.check||(h.estado!=='OK'&&h.estado!=='CONSUMIBLES'));alert('Faltantes: '+f.length+'\n'+f.map(x=>x.nombre+' -> '+x.estado).join('\n'));}function nuevaJornada(){if(confirm('¿NUEVA JORNADA DIA 1?')){let hoy=new Date().toISOString().split('T')[0];document.getElementById('fechaInput').value=hoy;herramientas.forEach(h=>{h.check=true;});save();render();}}function guardarFecha(){save();render();}function buildPDF(){const{jsPDF}=window.jspdf;const pdf=new jsPDF('p','mm','a4');let left=8,right=202,width=right-left;let top=16;let colDescW=150;let xDesc=left,xCant=left+colDescW;function cab(y){pdf.setFillColor(0,0,0);pdf.setTextColor(255,255,255);pdf.rect(left,y,width,13,'F');pdf.setFont('helvetica','bold');pdf.setFontSize(16);pdf.text('DESCRIPCION',xDesc+5,y+9);pdf.text('CANT',xCant+7,y+9);pdf.setTextColor(0,0,0);return y+13;}pdf.setFont('helvetica','bold');pdf.setFontSize(20);pdf.text('HERRAMIENTAS CAMION SUELDA',105,top,{align:'center'});top+=14;top=cab(top);herramientas.forEach((h,i)=>{let rh=12;if(top+rh>285){pdf.addPage();top=10;top=cab(top);}if(i%2==0){pdf.setFillColor(232,232,232);pdf.rect(left,top,width,rh,'F');}pdf.setDrawColor(160,160,160);pdf.rect(left,top,width,rh);pdf.line(xCant,top,xCant,top+rh);pdf.setFont('helvetica','bold');pdf.setFontSize(16);pdf.text(h.nombre.substring(0,42),xDesc+5,top+8.5);pdf.setFontSize(18);pdf.text(String(h.cant),xCant+10,top+8.5,{align:'center'});top+=rh;});return pdf;}function guardarPDF(){let pdf=buildPDF();pdf.save('HERRAMIENTAS.pdf');}async function enviarListadoPDF(){let pdf=buildPDF();let blob=pdf.output('blob');let file=new File([blob],'HERRAMIENTAS.pdf',{type:'application/pdf'});if(navigator.canShare&&navigator.canShare({files:[file]})){try{await navigator.share({files:[file],title:'HERRAMIENTAS'});return;}catch(e){}}window.open(URL.createObjectURL(blob),'_blank');}async function enviarNovedadesImagen(){let novedades=herramientas.filter(h=>h.estado!=='OK'&&h.estado!=='CONSUMIBLES');if(novedades.length===0){alert('Sin novedades');return;}let c=document.getElementById('canvasNov');let ctx=c.getContext('2d');let ancho=1000;let altoCab=220;let altoFila=75;let alto=altoCab+novedades.length*altoFila+40;c.width=ancho;c.height=alto;ctx.fillStyle='#fff';ctx.fillRect(0,0,ancho,alto);ctx.fillStyle='#d32f2f';ctx.font='bold 62px Arial';ctx.textAlign='center';ctx.fillText('⚠️ NOVEDADES',ancho/2,80);ctx.fillStyle='#000';ctx.font='bold 36px Arial';ctx.fillText('CAMION SUELDA - '+novedades.length+' ITEMS',ancho/2,130);let y=altoCab;ctx.fillStyle='#000';ctx.fillRect(20,y-55,ancho-40,55);ctx.fillStyle='#fff';ctx.font='bold 34px Arial';ctx.textAlign='left';ctx.fillText('DESCRIPCION',40,y-15);ctx.textAlign='center';ctx.fillText('CANT',750,y-15);ctx.fillText('ESTADO',900,y-15);novedades.forEach((h,i)=>{let yy=y+i*altoFila;if(i%2==0){ctx.fillStyle='#e8e8e8';ctx.fillRect(20,yy,ancho-40,altoFila);}ctx.strokeStyle='#ccc';ctx.lineWidth=2;ctx.strokeRect(20,yy,ancho-40,altoFila);ctx.beginPath();ctx.moveTo(680,yy);ctx.lineTo(680,yy+altoFila);ctx.stroke();ctx.beginPath();ctx.moveTo(820,yy);ctx.lineTo(820,yy+altoFila);ctx.stroke();ctx.fillStyle='#000';ctx.font='bold 32px Arial';ctx.textAlign='left';ctx.fillText(h.nombre.substring(0,30),35,yy+48);ctx.font='bold 38px Arial';ctx.textAlign='center';ctx.fillText(String(h.cant),750,yy+50);ctx.font='bold 28px Arial';ctx.fillStyle=h.estado=='NO HAY'?'#d32f2f':'#ff6f00';ctx.fillText(h.estado,900,yy+50);});c.toBlob(async(blob)=>{let file=new File([blob],'NOVEDADES_'+novedades.length+'.png',{type:'image/png'});if(navigator.canShare&&navigator.canShare({files:[file]})){try{await navigator.share({files:[file],title:'NOVEDADES CAMION SUELDA',text:'NOVEDADES CAMION SUELDA - '+novedades.length+' ITEMS'});return;}catch(e){}}window.open(URL.createObjectURL(blob),'_blank');},'image/png');}let fg=localStorage.getItem('camion3606_fecha');if(fg)document.getElementById('fechaInput').value=fg;render();