/* ===== App del cliente ===== */
:root {
  --brand: #FF4B2B;
  --ink: #1c1c1e;
  --muted: #6e6e73;
  --line: #ececf0;
  --bg: #f6f6f8;
  --card: #fff;
  --ok: #1a8a4a;
  --warn: #b26a00;
  --err: #c62828;
  --info: #1f63c7;
  --radius: 16px;
  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { scroll-behavior: smooth; scroll-padding-top: 110px; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(var(--nav-h) + var(--safe-b) + 90px);
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3 { line-height: 1.2; }
button { font: inherit; color: inherit; }
input, textarea, select {
  font: inherit; width: 100%; padding: 12px 14px; border: 1.5px solid var(--line);
  border-radius: 12px; background: #fff; color: var(--ink); outline: none; transition: border-color .15s;
}
input:focus, textarea:focus, select:focus { border-color: var(--brand); }
[hidden] { display: none !important; }

.page { max-width: 640px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.m0 { margin: 0; }
.grow { flex: 1; min-width: 0; }
.center { display: block; text-align: center; margin: 14px auto; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* Barra superior */
.topbar {
  position: sticky; top: 0; z-index: 30; height: 56px; display: flex; align-items: center; gap: 10px;
  padding: 0 16px; background: rgba(255,255,255,.92); backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 800; font-size: 20px; letter-spacing: -.3px; display: flex; align-items: center; gap: 8px; color: var(--brand); }
.brand-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 20%, transparent); }
.city { margin-left: auto; font-size: 13px; color: var(--muted); font-weight: 600; }
.topbar-title { font-weight: 700; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { width: 40px; height: 40px; margin-left: -8px; display: grid; place-items: center; border-radius: 50%; }
.icon-btn:active { background: var(--line); }

/* Portada */
.hero { padding: 18px 0 8px; }
.hero h1 { margin: 0 0 12px; font-size: 24px; letter-spacing: -.4px; }
.search { position: relative; }
.search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { padding-left: 42px; border-radius: 14px; background: #fff; border-color: transparent; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.notice { background: color-mix(in srgb, var(--brand) 10%, #fff); border: 1px solid color-mix(in srgb, var(--brand) 25%, #fff); padding: 12px 14px; border-radius: 12px; margin: 10px 0; font-size: 14px; }

.cats { display: flex; gap: 10px; overflow-x: auto; padding: 12px 16px 6px; margin: 0 -16px; scrollbar-width: none; }
.cats::-webkit-scrollbar { display: none; }
.cat { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 6px; width: 70px; }
.cat-ic { width: 60px; height: 60px; border-radius: 18px; background: #fff; display: grid; place-items: center; font-size: 28px; box-shadow: 0 1px 3px rgba(0,0,0,.06); transition: transform .15s; }
.cat small { font-size: 12px; font-weight: 600; color: var(--muted); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 70px; }
.cat.on .cat-ic { background: var(--brand); box-shadow: 0 6px 16px color-mix(in srgb, var(--brand) 35%, transparent); }
.cat.on small { color: var(--ink); }
.cat:active .cat-ic { transform: scale(.94); }

.sec-title { font-size: 18px; margin: 20px 0 10px; }
.hscroll { display: flex; gap: 12px; overflow-x: auto; margin: 0 -16px; padding: 2px 16px 8px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.hscroll::-webkit-scrollbar { display: none; }
.hscroll .cc { flex: 0 0 78%; scroll-snap-align: start; }
.clist { display: grid; gap: 12px; }
@media (min-width: 560px) { .clist { grid-template-columns: 1fr 1fr; } .hscroll .cc { flex-basis: 46%; } }

/* Tarjeta de local */
.cc { position: relative; display: block; background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.06); transition: transform .15s; }
.cc:active { transform: scale(.985); }
.cc-cover { height: 120px; background-size: cover; background-position: center; display: grid; place-items: center; }
.cc-cover span { font-size: 46px; font-weight: 800; color: rgba(255,255,255,.9); }
.cc-closed { position: absolute; top: 10px; left: 10px; background: rgba(0,0,0,.72); color: #fff; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 99px; }
.cc.is-closed .cc-cover { filter: grayscale(.9) brightness(.9); }
.cc-body { display: flex; gap: 10px; padding: 10px 12px 12px; align-items: flex-start; }
.cc-logo { width: 48px; height: 48px; border-radius: 12px; object-fit: cover; margin-top: -30px; border: 3px solid #fff; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.12); }
.cc-info h3 { margin: 0; font-size: 16px; }
.cc-info p { margin: 2px 0 6px; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cc-info { min-width: 0; flex: 1; }
.cc-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; color: var(--muted); font-weight: 600; }

/* Página del local */
.store-cover { height: 200px; margin: 0 -16px; background-size: cover; background-position: center; }
.store-head { position: relative; background: #fff; margin: -28px -16px 0; border-radius: 22px 22px 0 0; padding: 18px 16px 8px; }
.store-logo { width: 72px; height: 72px; border-radius: 18px; object-fit: cover; margin-top: -54px; border: 4px solid #fff; box-shadow: 0 4px 12px rgba(0,0,0,.14); background: #fff; }
.store-head h1 { margin: 8px 0 4px; font-size: 24px; }
.store-head p { margin: 4px 0; }
.store-meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 6px; }
.store-meta span { background: var(--bg); padding: 5px 10px; border-radius: 99px; font-size: 13px; font-weight: 600; }
.tabs { position: sticky; top: 56px; z-index: 20; display: flex; gap: 6px; overflow-x: auto; background: #fff; margin: 0 -16px; padding: 8px 16px 10px; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { flex: 0 0 auto; padding: 7px 14px; border-radius: 99px; font-size: 14px; font-weight: 600; color: var(--muted); }
.tabs a.on { background: var(--ink); color: #fff; }
.menu-sec { padding-top: 2px; }
.prod {
  width: 100%; display: flex; gap: 12px; align-items: center; text-align: left; background: #fff; border: 0;
  padding: 14px; margin-bottom: 10px; border-radius: var(--radius); box-shadow: 0 1px 3px rgba(0,0,0,.05); cursor: pointer;
}
.prod:active { transform: scale(.99); }
.prod:disabled { cursor: default; opacity: .75; }
.prod h3 { margin: 0 0 4px; font-size: 15px; }
.prod p { margin: 0 0 6px; font-size: 13px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.prod-info { flex: 1; min-width: 0; }
.prod img { width: 88px; height: 88px; object-fit: cover; border-radius: 12px; flex: 0 0 auto; }
.in-cart { color: var(--brand); }

/* Hoja inferior */
.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 60; animation: fade .2s; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 61; max-width: 640px; margin: 0 auto; background: #fff;
  border-radius: 22px 22px 0 0; overflow: hidden; animation: up .25s cubic-bezier(.2,.8,.2,1); max-height: 90vh; overflow-y: auto;
  padding-bottom: var(--safe-b);
}
.sheet-img { width: 100%; height: 220px; object-fit: cover; }
.sheet-body { padding: 18px 16px 20px; }
.sheet-body h3 { margin: 0 0 4px; font-size: 20px; }
.sheet-actions { display: flex; gap: 12px; margin-top: 16px; align-items: center; }
@keyframes up { from { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }

.qty { display: flex; align-items: center; background: var(--bg); border-radius: 12px; }
.qty button { width: 42px; height: 46px; border: 0; background: none; font-size: 22px; font-weight: 700; cursor: pointer; color: var(--brand); }
.qty span { min-width: 22px; text-align: center; font-weight: 700; }
.qty-sm button { width: 32px; height: 34px; font-size: 18px; }

/* Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 13px 20px; border-radius: 14px;
  border: 0; font-weight: 700; font-size: 15px; cursor: pointer; transition: transform .1s, opacity .15s;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 6px 18px color-mix(in srgb, var(--brand) 30%, transparent); }
.btn-light { background: #fff; border: 1.5px solid var(--line); }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 12px; font-size: 13px; border-radius: 10px; }
.btn[aria-disabled="true"], .btn:disabled { opacity: .45; pointer-events: none; box-shadow: none; }
.link { background: none; border: 0; color: var(--brand); font-weight: 700; cursor: pointer; font-size: 14px; padding: 6px; }
.link.danger { color: var(--err); }

/* Barra de carrito */
.cart-bar {
  position: fixed; left: 16px; right: 16px; bottom: calc(var(--nav-h) + var(--safe-b) + 10px); z-index: 40; max-width: 608px; margin: 0 auto;
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 16px; background: var(--brand); color: #fff; font-weight: 700;
  box-shadow: 0 10px 26px color-mix(in srgb, var(--brand) 40%, transparent); animation: up .3s;
}
.cart-bar span:nth-child(2) { flex: 1; }
.cb-qty { background: rgba(255,255,255,.25); min-width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; font-size: 14px; }
.sticky-cta { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + var(--safe-b)); z-index: 40; padding: 12px 16px; background: linear-gradient(transparent, var(--bg) 30%); }
.sticky-cta > * { max-width: 608px; margin: 0 auto; display: flex; }

/* Tarjetas genéricas */
.card { background: #fff; border-radius: var(--radius); padding: 16px; margin: 12px 0; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.card-title { font-size: 16px; margin: 0 0 8px; }
.lbl { display: block; font-size: 13px; font-weight: 700; margin: 12px 0 6px; }
.radio { display: flex; align-items: center; gap: 10px; padding: 12px; border: 1.5px solid var(--line); border-radius: 12px; margin-bottom: 8px; cursor: pointer; font-weight: 600; }
.radio input { width: 20px; height: 20px; accent-color: var(--brand); margin: 0; }
.radio:has(input:checked) { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 6%, #fff); }
.bank { background: var(--bg); padding: 12px; border-radius: 12px; font-size: 14px; margin: 8px 0; white-space: pre-line; }
.map-wrap { position: relative; margin-top: 12px; }
.map { height: 240px; border-radius: 14px; overflow: hidden; background: #e9eef2; z-index: 1; }
.map-gps { position: absolute; bottom: 10px; left: 10px; z-index: 5; box-shadow: 0 2px 8px rgba(0,0,0,.15); }

.line { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.line:last-child { border-bottom: 0; }
.line-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.line-nota { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.line-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.totals .row-between { padding: 4px 0; }
.totals .total, .row-between.total { font-weight: 800; font-size: 17px; padding-top: 8px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 10px 0; }
.item-row { padding: 6px 0; align-items: flex-start; }

/* Alertas y etiquetas */
.alert { padding: 12px 14px; border-radius: 12px; margin: 12px 0; font-size: 14px; }
.alert-ok { background: #e7f6ed; color: var(--ok); }
.alert-warn { background: #fff4e0; color: var(--warn); }
.alert-err { background: #fdecea; color: var(--err); }
.badge { display: inline-block; padding: 3px 9px; border-radius: 99px; font-size: 12px; font-weight: 700; margin-top: 4px; }
.badge-warn { background: #fff4e0; color: var(--warn); }
.badge-info { background: #e8f0fc; color: var(--info); }
.badge-brand { background: color-mix(in srgb, var(--brand) 14%, #fff); color: var(--brand); }
.badge-ok { background: #e7f6ed; color: var(--ok); }
.badge-err { background: #fdecea; color: var(--err); }
.badge-muted { background: var(--bg); color: var(--muted); }

.empty { text-align: center; color: var(--muted); padding: 30px 10px; }
.empty-state { text-align: center; padding: 50px 10px; }
.empty-state .big { font-size: 64px; }
.empty-state h2 { margin: 10px 0 6px; }
.empty-state .btn { margin-top: 16px; }
.page-title { font-size: 24px; margin: 18px 0 6px; }

/* Seguimiento */
.status-card { text-align: center; padding: 24px 16px; }
.status-emoji { font-size: 56px; animation: pop .4s; }
.status-card h2 { margin: 8px 0 4px; font-size: 22px; }
.status-card[data-estado="pendiente"] .status-emoji { animation: pulse 1.6s infinite; }
@keyframes pop { from { transform: scale(.5); opacity: 0; } }
@keyframes pulse { 50% { transform: scale(1.12); } }
.steps { list-style: none; padding: 0; margin: 20px 0 0; display: flex; justify-content: space-between; position: relative; }
.steps::before { content: ""; position: absolute; top: 7px; left: 10%; right: 10%; height: 3px; background: var(--line); }
.steps li { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.steps li span { width: 17px; height: 17px; border-radius: 50%; background: var(--line); border: 3px solid #fff; box-shadow: 0 0 0 1px var(--line); z-index: 1; }
.steps li.done span { background: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.steps li small { font-size: 11px; color: var(--muted); font-weight: 600; }
.steps li.done small { color: var(--ink); }

.order-row { display: flex; align-items: center; gap: 12px; }
.order-ic { width: 48px; height: 48px; border-radius: 12px; background-size: cover; background-position: center; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 20px; flex: 0 0 auto; }

/* Navegación inferior */
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: flex; background: rgba(255,255,255,.96); backdrop-filter: blur(12px); border-top: 1px solid var(--line);
}
.bottomnav a { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: 11px; font-weight: 600; }
.bottomnav svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.bottomnav a.on { color: var(--brand); }
.nav-count { position: absolute; top: 6px; left: calc(50% + 6px); background: var(--brand); color: #fff; font-size: 11px; min-width: 18px; height: 18px; border-radius: 9px; display: grid; place-items: center; padding: 0 5px; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + var(--safe-b) + 84px); transform: translateX(-50%); z-index: 90;
  background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 12px; font-size: 14px; font-weight: 600;
  box-shadow: 0 8px 24px rgba(0,0,0,.2); max-width: 90vw; animation: up .25s;
}

.install-bar {
  position: fixed; left: 12px; right: 12px; top: 64px; z-index: 70; max-width: 616px; margin: 0 auto; display: flex; align-items: center; gap: 10px;
  background: #fff; padding: 10px 12px; border-radius: 16px; box-shadow: 0 10px 30px rgba(0,0,0,.18); animation: fade .3s;
}
.install-bar img { width: 40px; height: 40px; border-radius: 10px; }
.install-bar div { flex: 1; min-width: 0; }
.install-bar small { display: block; font-size: 12px; color: var(--muted); }
.install-bar button { border: 0; background: var(--brand); color: #fff; font-weight: 700; padding: 8px 14px; border-radius: 10px; cursor: pointer; }
.install-bar .x { background: none; color: var(--muted); font-size: 22px; padding: 0 4px; }
