:root {
  --marca: #e8590c;
  --fondo: #f4f5f7;
  --carta: #ffffff;
  --texto: #1d2129;
  --suave: #667085;
  --borde: #e3e6ea;
  --ok: #1a7f37;
  --wa: #1a9e4b;
  --radio: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--fondo); color: var(--texto); font-size: 16px; line-height: 1.4;
  -webkit-text-size-adjust: 100%;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: var(--marca); }

.contenedor { max-width: 1100px; margin: 0 auto; padding: 0 16px; }

/* ---------- Encabezado ---------- */
.cabecera { background: var(--marca); color: #fff; padding: 16px 0 14px; }
.cabecera .contenedor { display: flex; gap: 12px; align-items: center; }
.logo { width: 56px; height: 56px; border-radius: 12px; background: #fff; flex: none; object-fit: contain;
  display: grid; place-items: center; font-weight: 800; color: var(--marca); font-size: 20px; overflow: hidden; }
.logo img { width: 100%; height: 100%; object-fit: contain; }
.cabecera h1 { margin: 0; font-size: 20px; line-height: 1.2; }
.cabecera p { margin: 2px 0 0; opacity: .9; font-size: 14px; }
.aviso { background: #fff7e6; border-bottom: 1px solid #ffe2a8; color: #7a4b00; font-size: 14px; padding: 8px 0; }
.aviso b { color: #5a3700; }

/* ---------- Buscador y categorías ---------- */
.barra { position: sticky; top: 0; z-index: 5; background: var(--fondo); padding: 12px 0 6px; }
.buscador { width: 100%; padding: 12px 14px; border: 1px solid var(--borde); border-radius: var(--radio); background: #fff; font-size: 16px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 10px 0 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--borde); background: #fff; border-radius: 999px; padding: 7px 14px; font-size: 14px; color: var(--texto); }
.chip.activa { background: var(--marca); color: #fff; border-color: var(--marca); }

/* ---------- Productos ---------- */
.grilla { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; padding: 8px 0 120px; }
.prod { background: var(--carta); border: 1px solid var(--borde); border-radius: var(--radio); padding: 10px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.prod .foto { aspect-ratio: 4/3; border-radius: 8px; background: #f0f1f3; display: grid; place-items: center; overflow: hidden; color: #98a2b3; font-weight: 700; font-size: 22px; }
.prod .foto img { width: 100%; height: 100%; object-fit: cover; }
.prod .nombre { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.prod .cod { font-size: 12px; color: var(--suave); }
.prod .precio { font-size: 18px; font-weight: 800; color: var(--texto); margin-top: auto; }
.vacio { text-align: center; color: var(--suave); padding: 40px 0; grid-column: 1 / -1; }

.btn { text-decoration: none; display: inline-block; text-align: center; border: 0; border-radius: 10px; padding: 10px 14px; background: var(--marca); color: #fff; font-weight: 700; }
.btn.sec { background: #fff; color: var(--texto); border: 1px solid var(--borde); }
.btn.wa { background: var(--wa); color: #fff; }
.btn.peligro { background: #fff; color: #b42318; border: 1px solid #f3c1bd; }
.btn.chico { padding: 6px 10px; font-size: 14px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn-ancho { width: 100%; }

.cant { display: flex; align-items: center; justify-content: space-between; border: 1px solid var(--borde); border-radius: 10px; overflow: hidden; }
.cant button { border: 0; background: #f4f5f7; width: 40px; height: 38px; font-size: 20px; font-weight: 700; color: var(--texto); }
.cant span { font-weight: 700; min-width: 30px; text-align: center; }

/* ---------- Carrito ---------- */
.barra-carrito { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--borde); box-shadow: 0 -4px 16px rgba(0,0,0,.06); display: none; }
.barra-carrito.visible { display: block; }
.barra-carrito .contenedor { display: flex; align-items: center; gap: 12px; padding: 0; }
.barra-carrito .resumen { flex: 1; min-width: 0; }
.barra-carrito .resumen b { display: block; font-size: 18px; }
.barra-carrito .resumen small { color: var(--suave); }

.velo { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 20; display: none; }
.velo.visible { display: block; }
.hoja { position: fixed; left: 0; right: 0; bottom: 0; z-index: 21; background: #fff; border-radius: 16px 16px 0 0; max-height: 88vh; overflow-y: auto; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); transform: translateY(105%); transition: transform .2s ease; max-width: 640px; margin: 0 auto; }
.hoja.visible { transform: translateY(0); }
.hoja h2 { margin: 0 0 10px; font-size: 18px; display: flex; justify-content: space-between; align-items: center; }
.cerrar { border: 0; background: #f0f1f3; border-radius: 50%; width: 34px; height: 34px; font-size: 18px; }
.item { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; padding: 10px 0; border-bottom: 1px solid var(--borde); align-items: center; }
.item .n { font-size: 14px; font-weight: 600; }
.item .s { font-size: 13px; color: var(--suave); }
.item .cant { width: 130px; }
.total { display: flex; justify-content: space-between; font-size: 20px; font-weight: 800; padding: 14px 0; }
.campo { display: block; margin: 8px 0; }
.campo span { display: block; font-size: 13px; color: var(--suave); margin-bottom: 4px; }
.campo input, .campo select, .campo textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--borde); border-radius: 10px; background: #fff; }

.pie { text-align: center; color: var(--suave); font-size: 13px; padding: 10px 0 140px; }
.pie a { color: var(--suave); }

@media (min-width: 700px) {
  .cabecera h1 { font-size: 24px; }
  .grilla { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
}
