:root {
  --rojo: #e8231b; --rojo-osc: #c41a12; --amarillo: #ffc21a; --rojo-suave: #fff1ee;
  --tinta: #1c1c28; --gris: #6b6f80; --linea: #ececf2; --fondo: #f6f6f9; --papel: #fff;
  --verde: #12a150; --verde-suave: #e8f7ef; --ambar: #b26b00; --ambar-suave: #fff6e5;
  --radio: 16px; --sombra: 0 6px 24px rgba(28, 28, 40, .08);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; color: var(--tinta); background: var(--fondo); line-height: 1.45; }
a { color: inherit; }
img { max-width: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #2563eb; outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Barra superior */
.top { position: sticky; top: 0; z-index: 20; background: var(--papel); border-bottom: 1px solid var(--linea); }
.top-in { max-width: 980px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 12px; }
.marca { display: flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 800; font-size: 22px; letter-spacing: -.5px; color: var(--rojo); }
.marca img { border-radius: 10px; object-fit: contain; }
.top .derecha { margin-left: auto; font-size: 14px; color: var(--gris); }
.volver { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--fondo); display: grid; place-items: center; text-decoration: none; font-size: 20px; }

.envoltura { max-width: 980px; margin: 0 auto; padding: 16px; }

/* Portada */
.hero { background: linear-gradient(135deg, #e8231b 0%, #ff6a1a 70%, #ffb21a 100%); color: #fff; border-radius: 24px; padding: 26px 22px; margin-bottom: 18px; position: relative; overflow: hidden; }
.hero h1 { margin: 0 0 6px; font-size: clamp(24px, 5vw, 34px); line-height: 1.1; letter-spacing: -.6px; }
.hero p { margin: 0; opacity: .95; max-width: 520px; }
.hero { padding-right: 150px; }
.hero .hero-logo { position: absolute; right: 10px; bottom: 8px; width: 140px; filter: drop-shadow(0 6px 14px rgba(0,0,0,.25)); }
@media (max-width: 560px) { .hero { padding-right: 22px; padding-bottom: 120px; } .hero .hero-logo { width: 120px; right: 12px; bottom: 6px; } }
.buscar { display: flex; align-items: center; gap: 8px; background: var(--papel); border-radius: 14px; padding: 4px 6px 4px 14px; margin-top: 16px; max-width: 520px; box-shadow: var(--sombra); }
.buscar input { border: 0; outline: 0; flex: 1; padding: 10px 0; font-size: 16px; background: transparent; color: var(--tinta); }
.titulo-sec { font-size: 19px; margin: 22px 0 12px; letter-spacing: -.3px; }
.grilla { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.local { display: flex; gap: 14px; background: var(--papel); border-radius: var(--radio); padding: 14px; text-decoration: none; box-shadow: var(--sombra); border: 1px solid transparent; transition: transform .15s, border-color .15s; }
.local:hover { border-color: #ffd3c9; transform: translateY(-2px); }
.local.cerrado { opacity: .62; }
.local .logo { width: 74px; height: 74px; border-radius: 14px; flex: none; object-fit: cover; background: var(--rojo-suave); display: grid; place-items: center; font-size: 34px; }
.local h3 { margin: 0 0 2px; font-size: 17px; }
.local .cat { color: var(--gris); font-size: 14px; }
.local .datos { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; font-size: 13px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; background: var(--fondo); font-weight: 600; font-size: 13px; }
.chip.ok { background: var(--verde-suave); color: var(--verde); }
.chip.no { background: #f1f1f4; color: var(--gris); }
.vacio { text-align: center; color: var(--gris); padding: 40px 10px; }

/* Carta */
.cab-local { background: var(--papel); border-radius: var(--radio); padding: 16px; display: flex; gap: 14px; align-items: center; box-shadow: var(--sombra); }
.cab-local .logo { width: 64px; height: 64px; border-radius: 14px; object-fit: cover; background: var(--rojo-suave); display: grid; place-items: center; font-size: 30px; flex: none; }
.cab-local h1 { margin: 0; font-size: 22px; letter-spacing: -.4px; }
.cab-local p { margin: 2px 0 0; color: var(--gris); font-size: 14px; }
.aviso-cerrado { margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: var(--ambar-suave); color: var(--ambar); font-weight: 600; }
.cats { position: sticky; top: 61px; z-index: 15; background: var(--fondo); display: flex; gap: 8px; overflow-x: auto; padding: 12px 0; scrollbar-width: none; }
.cats::-webkit-scrollbar { display: none; }
.cats a { flex: none; padding: 8px 14px; border-radius: 999px; background: var(--papel); text-decoration: none; font-weight: 600; font-size: 14px; border: 1px solid var(--linea); }
.cats a.activa { background: var(--tinta); color: #fff; border-color: var(--tinta); }
.cat-titulo { font-size: 18px; margin: 18px 0 10px; scroll-margin-top: 120px; }
.prods { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 10px; }
.prod { background: var(--papel); border-radius: 14px; padding: 14px; display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--linea); }
.prod .info { flex: 1; min-width: 0; }
.prod h3 { margin: 0; font-size: 16px; }
.prod .pres { color: var(--gris); font-size: 13.5px; }
.prod .desc { color: var(--gris); font-size: 13.5px; margin: 4px 0 0; }
.prod .precio { font-weight: 800; margin-top: 6px; }
.cant { display: flex; align-items: center; gap: 6px; flex: none; }
.cant button { width: 38px; height: 38px; border-radius: 12px; border: 0; font-size: 20px; font-weight: 700; background: var(--rojo); color: #fff; display: grid; place-items: center; }
.cant button.menos { background: var(--fondo); color: var(--tinta); }
.cant span { min-width: 22px; text-align: center; font-weight: 800; }

.barra-carrito { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--fondo) 30%); }
.barra-carrito button { width: 100%; max-width: 948px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 0; border-radius: 16px; padding: 15px 18px; background: var(--rojo); color: #fff; font-weight: 800; font-size: 16px; box-shadow: 0 8px 24px rgba(255, 75, 43, .35); }
.barra-carrito .n { background: rgba(255, 255, 255, .25); border-radius: 8px; padding: 2px 9px; }
body.con-barra { padding-bottom: 90px; }

/* Hoja de pedido */
.hoja { position: fixed; inset: 0; z-index: 50; background: var(--fondo); overflow-y: auto; -webkit-overflow-scrolling: touch; }
.hoja-cab { position: sticky; top: 0; z-index: 5; background: var(--papel); border-bottom: 1px solid var(--linea); }
.hoja-cab .top-in { justify-content: flex-start; }
.hoja-cab h2 { margin: 0; font-size: 18px; }
.pasos { display: flex; gap: 6px; margin-left: auto; }
.pasos i { width: 26px; height: 6px; border-radius: 3px; background: var(--linea); }
.pasos i.on { background: var(--rojo); }
.hoja-cuerpo { max-width: 620px; margin: 0 auto; padding: 16px 16px 120px; }
.caja { background: var(--papel); border-radius: var(--radio); padding: 16px; margin-bottom: 14px; box-shadow: var(--sombra); }
.caja h3 { margin: 0 0 12px; font-size: 16px; }
.linea { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; font-size: 15px; }
.linea small { color: var(--gris); display: block; }
.linea.total { border-top: 1px dashed var(--linea); margin-top: 6px; padding-top: 12px; font-weight: 800; font-size: 18px; }
.campo { margin-bottom: 12px; }
.campo label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 5px; }
.campo input, .campo textarea, .campo select { width: 100%; padding: 12px 13px; border-radius: 12px; border: 1.5px solid #dcdce4; background: #fff; font-size: 16px; }
.campo input:focus, .campo textarea:focus { border-color: var(--rojo); outline: 0; box-shadow: 0 0 0 3px rgba(255, 75, 43, .15); }
.campo .ayuda { font-size: 13px; color: var(--gris); margin-top: 4px; }
.mapa { height: 260px; border-radius: 14px; overflow: hidden; border: 1px solid var(--linea); background: #e9ecef; position: relative; z-index: 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 14px; padding: 14px 18px; font-weight: 800; font-size: 16px; background: var(--rojo); color: #fff; text-decoration: none; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.sec { background: var(--fondo); color: var(--tinta); }
.btn.linea-b { background: #fff; color: var(--tinta); border: 1.5px solid #dcdce4; }
.btn.ancho { width: 100%; }
.btn-ubic { width: 100%; margin-bottom: 10px; background: var(--verde-suave); color: var(--verde); }
.msg { padding: 12px 14px; border-radius: 12px; font-weight: 600; font-size: 15px; margin-bottom: 12px; }
.msg.mal { background: #fdecea; color: #b42318; }
.msg.ok { background: var(--verde-suave); color: var(--verde); }
.msg.info { background: var(--ambar-suave); color: var(--ambar); }
.pie-hoja { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: var(--papel); border-top: 1px solid var(--linea); padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
.pie-hoja .in { max-width: 588px; margin: 0 auto; display: flex; gap: 10px; }
.pie-hoja .btn { flex: 1; }

.qr { text-align: center; }
.qr img { width: 250px; max-width: 80%; border-radius: 12px; border: 1px solid var(--linea); background: #fff; padding: 8px; }
.qr .monto { font-size: 32px; font-weight: 900; letter-spacing: -1px; margin: 8px 0 0; }
.qr .titular { color: var(--gris); font-size: 14px; }
.pasos-pago { margin: 12px 0 0; padding-left: 20px; font-size: 14.5px; }
.pasos-pago li { margin-bottom: 4px; }
.subir { display: block; border: 2px dashed #f3b2a6; background: var(--rojo-suave); border-radius: 14px; padding: 18px; text-align: center; cursor: pointer; font-weight: 700; color: var(--rojo-osc); }
.subir input { display: none; }
.subir img { max-height: 220px; border-radius: 10px; display: block; margin: 0 auto 8px; }

/* Seguimiento */
.seg-cab { text-align: center; padding: 8px 0 4px; }
.seg-cab .ico { font-size: 46px; }
.seg-cab h1 { margin: 6px 0 4px; font-size: 24px; letter-spacing: -.5px; }
.seg-cab p { margin: 0; color: var(--gris); }
.etapas { list-style: none; display: flex; padding: 0; margin: 18px 0 14px; counter-reset: e; }
.etapas li { flex: 1; text-align: center; font-size: 12.5px; color: var(--gris); position: relative; padding-top: 32px; counter-increment: e; }
.etapas li::before { content: counter(e); position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 26px; height: 26px; border-radius: 50%; background: #d9d9e0; color: #fff; font-weight: 800; font-size: 13px; line-height: 26px; z-index: 1; }
.etapas li::after { content: ""; position: absolute; top: 12px; left: -50%; width: 100%; height: 3px; background: #d9d9e0; }
.etapas li:first-child::after { display: none; }
.etapas li.hecho, .etapas li.actual { color: var(--tinta); font-weight: 700; }
.etapas li.hecho::before, .etapas li.hecho::after, .etapas li.actual::after { background: var(--verde); }
.etapas li.actual::before { background: var(--rojo); box-shadow: 0 0 0 5px rgba(255, 75, 43, .2); }
.mapa-seg { height: 320px; }
.pin { font-size: 0; }
.pin span { display: block; width: 34px; height: 34px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); border: 3px solid #fff; box-shadow: 0 3px 8px rgba(0,0,0,.35); }
.pin-casa span { background: var(--rojo); }
.pin-local span { background: var(--tinta); }
.pin i { position: absolute; left: 0; right: 0; top: 7px; text-align: center; font-style: normal; font-size: 15px; line-height: 1; }
.moto { width: 46px; height: 46px; border-radius: 50%; background: #fff; border: 3px solid var(--rojo); box-shadow: 0 4px 12px rgba(0,0,0,.35); display: flex; align-items: center; justify-content: center; font-size: 23px; }
.det { font-size: 14.5px; }
.det .linea { font-size: 14.5px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
