Panel Admin

*{box-sizing:border-box;margin:0;padding:0} #tf-admin-wrap{font-family:-apple-system,BlinkMacSystemFont,’Segoe UI’,sans-serif;min-height:100vh;background:#fdf2f8} /* LOGIN */ #tf-login-wrap{display:flex;align-items:center;justify-content:center;min-height:100vh;background:linear-gradient(135deg,#fce4ec,#f8bbd0)} .tf-login-card{background:#fff;border-radius:20px;padding:48px 40px;width:100%;max-width:420px;box-shadow:0 20px 60px rgba(233,30,99,0.15);text-align:center} .tf-login-logo{font-size:48px;margin-bottom:16px} .tf-login-card h2{font-size:28px;color:#2d3748;margin-bottom:8px;font-weight:700} .tf-login-card > p{color:#718096;font-size:14px;margin-bottom:32px} .tf-form-group{margin-bottom:20px;text-align:left} .tf-form-group label{display:block;font-size:13px;font-weight:600;color:#4a5568;margin-bottom:8px;text-transform:uppercase;letter-spacing:.5px} .tf-form-group input,.tf-form-group select,.tf-form-group textarea{width:100%;padding:12px 16px;border:2px solid #e2e8f0;border-radius:10px;font-size:15px;transition:border-color .2s;outline:none;background:#fff} .tf-form-group input:focus,.tf-form-group select:focus,.tf-form-group textarea:focus{border-color:#e91e63} #tf-login-btn{width:100%;padding:14px;background:linear-gradient(135deg,#e91e63,#c2185b);color:#fff;border:none;border-radius:10px;font-size:16px;font-weight:700;cursor:pointer;transition:transform .1s,box-shadow .2s;letter-spacing:.5px} #tf-login-btn:hover{transform:translateY(-1px);box-shadow:0 6px 20px rgba(233,30,99,.4)} #tf-login-btn:active{transform:translateY(0)} /* DASHBOARD */ #tf-dashboard-wrap{display:none;min-height:100vh;flex-direction:column} .tf-dash-header{background:linear-gradient(135deg,#e91e63,#c2185b);padding:16px 24px;display:flex;align-items:center;justify-content:space-between;box-shadow:0 2px 10px rgba(0,0,0,.15)} .tf-dash-logo{color:#fff;font-size:20px;font-weight:700} .tf-dash-nav{display:flex;gap:8px;flex-wrap:wrap} .tf-dash-nav button{background:rgba(255,255,255,.2);color:#fff;border:1px solid rgba(255,255,255,.3);padding:8px 16px;border-radius:8px;cursor:pointer;font-size:13px;font-weight:600;transition:background .2s} .tf-dash-nav button:hover,.tf-dash-nav button.active{background:rgba(255,255,255,.35)} .tf-logout-btn{background:rgba(0,0,0,.2)!important} .tf-tab-content{padding:24px;max-width:1100px;margin:0 auto;width:100%} .tf-tab-content h2{font-size:24px;color:#2d3748;margin-bottom:20px;font-weight:700} /* PRODUCT LIST */ .tf-prod-table{width:100%;border-collapse:collapse;background:#fff;border-radius:12px;overflow:hidden;box-shadow:0 2px 15px rgba(0,0,0,.08)} .tf-prod-table th{background:#fce4ec;color:#c2185b;font-size:12px;font-weight:700;text-transform:uppercase;letter-spacing:.5px;padding:12px 16px;text-align:left} .tf-prod-table td{padding:12px 16px;border-bottom:1px solid #f7fafc;vertical-align:middle;font-size:14px;color:#4a5568} .tf-prod-table tr:last-child td{border-bottom:none} .tf-prod-table tr:hover td{background:#fff5f7} .tf-prod-img{width:50px;height:50px;object-fit:cover;border-radius:8px;background:#fce4ec} .tf-prod-badge{display:inline-block;padding:3px 10px;border-radius:20px;font-size:11px;font-weight:700;text-transform:uppercase;background:#fce4ec;color:#e91e63} .tf-btn-edit{background:#3182ce;color:#fff;border:none;padding:6px 14px;border-radius:6px;cursor:pointer;font-size:12px;font-weight:600;margin-right:4px} .tf-btn-del{background:#e53e3e;color:#fff;border:none;padding:6px 14px;border-radius:6px;cursor:pointer;font-size:12px;font-weight:600} .tf-empty-state{text-align:center;padding:60px 20px;color:#a0aec0} .tf-empty-state .tf-empty-icon{font-size:60px;margin-bottom:16px} /* ADD FORM */ .tf-form-row{display:grid;grid-template-columns:1fr 1fr;gap:20px;margin-bottom:0} .tf-form-card{background:#fff;border-radius:12px;padding:32px;box-shadow:0 2px 15px rgba(0,0,0,.08)} .tf-form-actions{display:flex;gap:12px;justify-content:flex-end;margin-top:24px} .tf-form-actions button[type=button]{background:#e2e8f0;color:#4a5568;border:none;padding:12px 24px;border-radius:8px;cursor:pointer;font-weight:600} .tf-form-actions button[type=submit]{background:linear-gradient(135deg,#e91e63,#c2185b);color:#fff;border:none;padding:12px 28px;border-radius:8px;cursor:pointer;font-weight:700;font-size:15px} .tf-success-msg{background:#c6f6d5;color:#276749;padding:12px 16px;border-radius:8px;margin-bottom:20px;display:none;font-weight:600} /* STATS */ .tf-stats-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:20px} .tf-stat-card{background:#fff;border-radius:12px;padding:28px;text-align:center;box-shadow:0 2px 15px rgba(0,0,0,.08);border-top:4px solid #e91e63} .tf-stat-icon{font-size:36px;margin-bottom:12px} .tf-stat-value{font-size:48px;font-weight:800;color:#e91e63;line-height:1} .tf-stat-label{font-size:14px;color:#718096;margin-top:8px;font-weight:500} .tf-reset-btn{margin-top:20px;background:#fed7d7;color:#e53e3e;border:none;padding:10px 20px;border-radius:8px;cursor:pointer;font-weight:600} @media(max-width:600px){.tf-form-row{grid-template-columns:1fr}.tf-dash-header{flex-direction:column;gap:12px}.tf-dash-nav{justify-content:center}}

Gestión de Productos

var TF_ADMIN_EMAIL=’lizbethflores.9823@hotmail.com’; var TF_PASS_HASH=’6410917fb752cc2c9fce16f0f41f9f435115d29abe499c3d04994072432b699a’; async function tfLogin(){ var email=document.getElementById(‘tf-admin-email’).value.trim(); var pass=document.getElementById(‘tf-admin-pass’).value; var err=document.getElementById(‘tf-login-err’); err.style.display=’none’; try{ var buf=await crypto.subtle.digest(‘SHA-256′,new TextEncoder().encode(pass)); var hash=Array.from(new Uint8Array(buf)).map(b=>b.toString(16).padStart(2,’0’)).join(»); if(email===TF_ADMIN_EMAIL&&hash===TF_PASS_HASH){ sessionStorage.setItem(‘tf_admin’,’1′); document.getElementById(‘tf-login-wrap’).style.display=’none’; document.getElementById(‘tf-dashboard-wrap’).style.display=’flex’; document.getElementById(‘tf-dashboard-wrap’).style.flexDirection=’column’; tfRenderProds(); }else{err.style.display=’block’;} }catch(e){err.style.display=’block’;} } function tfLogout(){sessionStorage.removeItem(‘tf_admin’);location.reload();} function tfTab(t){ [‘productos’,’agregar’,’stats’].forEach(function(n){ var c=document.getElementById(‘tf-tab-‘+n); var b=document.getElementById(‘tab-btn-‘+n); if(c)c.style.display=n===t?’block’:’none’; if(b){b.classList.remove(‘active’);if(n===t)b.classList.add(‘active’);} }); if(t===’stats’)tfRenderStats(); if(t===’productos’)tfRenderProds(); } function tfGetProds(){try{return JSON.parse(localStorage.getItem(‘tf_productos’)||'[]’);}catch(e){return[];}} function tfSaveProds(arr){localStorage.setItem(‘tf_productos’,JSON.stringify(arr));} function tfRenderProds(){ var prods=tfGetProds(); var wrap=document.getElementById(‘tf-prod-list-wrap’); if(!wrap)return; if(prods.length===0){ wrap.innerHTML=’
📦

No hay productos aún.
¡Agrega el primero haciendo click en Agregar!

‘; return; } var rows=prods.map(function(p,i){ return ‘‘+(p.img?’‘:»)+’ ‘+p.name+’‘+p.cat+’$’+p.price+’‘+p.desc+’‘; }).join(»); wrap.innerHTML=’‘+rows+’
ProductoCategoríaPrecioDescripciónAcciones
‘; } function tfSaveProd(){ var idx=parseInt(document.getElementById(‘tf-edit-idx’).value); var prod={ name:document.getElementById(‘tf-p-name’).value.trim(), cat:document.getElementById(‘tf-p-cat’).value, price:parseFloat(document.getElementById(‘tf-p-price’).value)||0, img:document.getElementById(‘tf-p-img’).value.trim(), desc:document.getElementById(‘tf-p-desc’).value.trim() }; if(!prod.name){alert(‘El nombre es obligatorio’);return;} var prods=tfGetProds(); if(idx>=0){prods[idx]=prod;}else{prods.push(prod);} tfSaveProds(prods); document.getElementById(‘tf-success-msg’).style.display=’block’; setTimeout(function(){document.getElementById(‘tf-success-msg’).style.display=’none’;},3000); tfCancelEdit(); } function tfEditProd(i){ var p=tfGetProds()[i]; document.getElementById(‘tf-edit-idx’).value=i; document.getElementById(‘tf-p-name’).value=p.name; document.getElementById(‘tf-p-cat’).value=p.cat; document.getElementById(‘tf-p-price’).value=p.price; document.getElementById(‘tf-p-img’).value=p.img||»; document.getElementById(‘tf-p-desc’).value=p.desc||»; document.getElementById(‘tf-form-title’).textContent=’Editar Producto’; tfTab(‘agregar’); } function tfDelProd(i){ if(!confirm(‘¿Eliminar este producto?’))return; var prods=tfGetProds();prods.splice(i,1);tfSaveProds(prods);tfRenderProds(); } function tfCancelEdit(){ document.getElementById(‘tf-edit-idx’).value=’-1′; document.getElementById(‘tf-p-name’).value=»; document.getElementById(‘tf-p-price’).value=»; document.getElementById(‘tf-p-img’).value=»; document.getElementById(‘tf-p-desc’).value=»; document.getElementById(‘tf-form-title’).textContent=’Agregar Producto’; tfTab(‘productos’); } function tfRenderStats(){ var cot=parseInt(localStorage.getItem(‘tf_cotizaciones’)||’0′); var prods=tfGetProds().length; var cart=0;try{cart=JSON.parse(localStorage.getItem(‘tf_carrito’)||'[]’).reduce(function(s,i){return s+i.qty;},0);}catch(e){} document.getElementById(‘tf-s-cot’).textContent=cot; document.getElementById(‘tf-s-prod’).textContent=prods; document.getElementById(‘tf-s-cart’).textContent=cart; } function tfResetCot(){if(confirm(‘¿Resetear el contador a 0?’)){localStorage.setItem(‘tf_cotizaciones’,’0′);tfRenderStats();}} // Auto-check session if(sessionStorage.getItem(‘tf_admin’)===’1′){ document.getElementById(‘tf-login-wrap’).style.display=’none’; document.getElementById(‘tf-dashboard-wrap’).style.display=’flex’; document.getElementById(‘tf-dashboard-wrap’).style.flexDirection=’column’; tfRenderProds(); }