/* Tienda en línea y vista dividida — POS-SAAS-0A.5
   Mobile-first (360–430 px). En desktop la tienda se centra a un ancho de
   lectura cómodo; nunca se estira. Barra inferior con safe-area.          */

.main--store { padding: 0; }
.main--store > * { max-width: none; }
/* La tienda muestra su propio aviso de demo arriba; el sello flotante taparía la barra. */
.layout-public .demo-stamp { display: none; }

.store {
  --store-pad: var(--s-4);
  position: relative;
  max-width: 600px;
  margin: 0 auto;
  padding: var(--s-4) var(--store-pad) var(--s-6);
  display: grid;
  gap: var(--s-4);
  min-width: 0;
}
.store.has-bar { padding-bottom: calc(var(--touch-xl) + var(--s-10) + env(safe-area-inset-bottom, 0px)); }

/* ─────────────────────────── Encabezado ─────────────────────────── */

.store-head { display: flex; align-items: center; gap: var(--s-3); }
.store-head__logo { width: 48px; height: 48px; border-radius: 14px; flex: none; }
.store-head__text { flex: 1; min-width: 0; }
.store-head__name { font-size: var(--fs-xl); font-weight: 700; line-height: 1.15; }
.store-head__tagline { color: var(--c-ink-2); font-size: var(--fs-sm); }
.store-notice { display: flex; gap: var(--s-2); align-items: flex-start; padding: var(--s-2) var(--s-3); border-radius: var(--r-md); background: var(--c-surface-2); color: var(--c-ink); font-size: var(--fs-sm); }
.store-notice .icon { width: 18px; height: 18px; flex: none; margin-top: 1px; color: var(--c-ink-2); }

.store-screen { display: grid; gap: var(--s-4); min-width: 0; }
.store-title { font-size: var(--fs-2xl); font-weight: 700; line-height: 1.2; }
.store-title:focus-visible { box-shadow: var(--focus-ring); border-radius: var(--r-sm); }
.store-sub { display: flex; gap: var(--s-2); align-items: center; color: var(--c-ink-2); }
.store-sub .icon { width: 18px; height: 18px; }
.store-intro { display: grid; gap: var(--s-1); }

.store-back { display: inline-flex; align-items: center; gap: var(--s-1); justify-self: start; min-height: var(--touch); padding: 0 var(--s-2) 0 0; border: 0; background: none; color: var(--c-interact-ink); font-weight: 700; }
.store-back__icon { transform: rotate(180deg); }

/* ─────────────────────────── Menú ─────────────────────────── */

.store-cats { display: flex; gap: var(--s-2); overflow-x: auto; margin: 0 calc(-1 * var(--store-pad)); padding: 2px var(--store-pad) 6px; scrollbar-width: none; }
.store-cats::-webkit-scrollbar { display: none; }
.store-cat { display: inline-flex; align-items: center; gap: var(--s-2); flex: none; min-height: var(--touch-lg); padding: 0 var(--s-4); border: 1.5px solid var(--c-line-strong); border-radius: var(--r-pill); background: var(--c-surface); color: var(--c-ink); font-weight: 600; }
.store-cat .icon { width: 18px; height: 18px; color: var(--c-ink-2); }
.store-cat.is-selected { background: var(--c-petrol); border-color: var(--c-petrol); color: var(--c-on-petrol); font-weight: 700; }
.store-cat.is-selected .icon { color: var(--c-on-petrol); }

.store-menu { display: grid; gap: var(--s-5); }
.store-group { display: grid; gap: var(--s-2); }
.store-group__title { font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: .08em; color: var(--c-ink-2); font-weight: 700; }
.store-list { list-style: none; display: grid; gap: var(--s-2); }
.store-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3);
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
}
.store-item__icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--c-surface-2); color: var(--c-petrol); }
.store-item__text { display: grid; gap: 2px; min-width: 0; }
.store-item__name { font-weight: 700; font-size: var(--fs-lg); line-height: 1.25; overflow-wrap: anywhere; }
.store-item__price { font-weight: 600; }
.store-item__hint { font-size: var(--fs-sm); color: var(--c-ink-2); }
.store-item__qty { font-size: var(--fs-sm); font-weight: 700; color: var(--c-petrol); }
.store-item__add { padding: 0 var(--s-4); }
.store-item.is-unavailable { background: var(--c-bg); box-shadow: none; border-style: dashed; }
.store-item.is-unavailable .store-item__icon { background: var(--c-surface-2); color: var(--c-ink-2); }
.store-item.is-unavailable .store-item__price { text-decoration: line-through; color: var(--c-ink-2); }
@media (max-width: 380px) {
  .store-item { grid-template-columns: minmax(0, 1fr) auto; }
  .store-item__icon { display: none; }
  .store-item__add { padding: 0 var(--s-3); }
}

/* Barra «Ver pedido»: fija en la página; pegada al fondo del teléfono en la vista dividida. */
.store-bar {
  position: fixed;
  left: 50%;
  bottom: calc(var(--s-4) + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 20;
  width: min(568px, calc(100% - 2 * var(--s-4)));
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-height: var(--touch-xl);
  padding: 0 var(--s-5);
  border: 0;
  border-radius: var(--r-lg);
  background: var(--c-primary-strong);
  color: var(--c-on-primary);
  font-weight: 700;
  font-size: var(--fs-lg);
  box-shadow: var(--shadow-3);
}
.store-bar__label { flex: 1; display: flex; gap: var(--s-2); flex-wrap: wrap; text-align: left; }
.store-bar__count { font-weight: 600; }
.store-bar__count::before { content: "·"; margin-right: var(--s-2); }
.store--embedded .store-bar { position: sticky; left: auto; transform: none; bottom: var(--s-3); width: 100%; margin-top: calc(-1 * var(--s-2)); }
.store--embedded.has-bar { padding-bottom: var(--s-4); }

/* ─────────────────────────── Carrito ─────────────────────────── */

.store-lines .lines { border: 1px solid var(--c-line); border-radius: var(--r-lg); background: var(--c-surface); overflow: hidden; }
.store-lines .line:last-child { border-bottom: 0; }
.store-line .line__controls { flex-wrap: nowrap; }
/* En teléfonos angostos «Opciones/Nota» queda como icono (su nombre accesible se conserva). */
@media (max-width: 440px) {
  .store-line .line__edit { width: var(--touch); padding: 0; }
  .store-line .line__edit span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
.store--embedded .store-line .line__edit { width: var(--touch); padding: 0; }
.store--embedded .store-line .line__edit span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.store-cta { width: 100%; justify-content: center; }

/* ─────────────────────────── Datos y pago ─────────────────────────── */

.store-form { display: grid; gap: var(--s-5); }
.store-step { display: grid; gap: var(--s-3); margin: 0; padding: var(--s-4); border: 1px solid var(--c-line); border-radius: var(--r-lg); background: var(--c-surface); min-width: 0; }
.store-step__title { display: flex; align-items: center; gap: var(--s-2); padding: 0; font-weight: 700; font-size: var(--fs-lg); }
.store-step__n { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--c-ink); color: var(--c-on-fill); font-size: var(--fs-sm); }
.store-estimate { display: flex; align-items: center; gap: var(--s-2); color: var(--c-ink-2); font-weight: 600; }
.store-estimate .icon { width: 18px; height: 18px; }
.store-sample { justify-self: start; min-height: var(--touch); padding: 0 var(--s-3); color: var(--c-interact-ink); }
.store-delivery-fields { display: grid; gap: var(--s-3); }
.field__req { font-weight: 400; color: var(--c-ink-2); font-size: var(--fs-sm); }
.field__error { color: var(--c-danger); font-weight: 600; font-size: var(--fs-sm); }
.field__error:empty { display: none; }
.input[aria-invalid="true"] { border-color: var(--c-danger); box-shadow: 0 0 0 1px var(--c-danger); }
.store-form .input { font-size: 16px; min-height: var(--touch-lg); } /* ≥ 16 px: sin zoom automático en iOS */
.store-errors { color: var(--c-danger); font-weight: 700; }
.store-errors:empty { display: none; }

.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-2); }
.choice-list { display: grid; gap: var(--s-2); }
.choice {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-height: var(--touch-xl);
  padding: var(--s-3);
  border: 1.5px solid var(--c-line-strong);
  border-radius: var(--r-md);
  background: var(--c-surface);
  cursor: pointer;
}
.choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.choice > .icon { width: 24px; height: 24px; flex: none; color: var(--c-ink-2); }
.choice__text { display: grid; gap: 2px; min-width: 0; font-size: var(--fs-sm); color: var(--c-ink-2); }
.choice__text strong { font-size: var(--fs-md); color: var(--c-ink); }
.choice:has(input:checked) { background: var(--c-selected-bg); border-color: var(--c-petrol); box-shadow: inset 0 0 0 1px var(--c-petrol); }
.choice:has(input:checked) > .icon { color: var(--c-petrol); }
.choice:has(input:focus-visible) { box-shadow: var(--focus-ring); }
@media (max-width: 380px) { .choice-grid { grid-template-columns: 1fr; } }

.store-summary { padding: var(--s-4); border-radius: var(--r-lg); background: var(--c-surface); border: 1px solid var(--c-line); }

/* ─────────────────────────── Seguimiento ─────────────────────────── */

.track-ok { display: flex; gap: var(--s-3); align-items: flex-start; padding: var(--s-4); border-radius: var(--r-lg); background: var(--c-secondary-soft); }
.track-ok > .icon { width: 32px; height: 32px; flex: none; color: var(--c-secondary-ink); }
.track-facts { display: grid; grid-template-columns: auto 1fr; gap: var(--s-1) var(--s-4); margin: 0; padding: var(--s-4); border: 1px solid var(--c-line); border-radius: var(--r-lg); background: var(--c-surface); }
.track-facts dt { color: var(--c-ink-2); font-weight: 600; }
.track-facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.track { list-style: none; display: grid; gap: 0; padding: var(--s-2) var(--s-4); border: 1px solid var(--c-line); border-radius: var(--r-lg); background: var(--c-surface); }
.track__step { position: relative; display: flex; align-items: center; gap: var(--s-3); min-height: 52px; color: var(--c-ink-2); font-weight: 600; }
.track__step:not(:last-child)::after { content: ""; position: absolute; left: 13px; top: 38px; height: 28px; width: 2px; background: var(--c-line-strong); }
.track__step.is-done:not(:last-child)::after { background: var(--c-secondary-ink); }
.track__dot { display: grid; place-items: center; width: 28px; height: 28px; flex: none; border-radius: 50%; border: 2px solid var(--c-line-strong); background: var(--c-surface); z-index: 1; }
.track__dot .icon { width: 16px; height: 16px; stroke-width: 3; }
.track__step.is-done { color: var(--c-ink); }
.track__step.is-done .track__dot { background: var(--c-secondary-ink); border-color: var(--c-secondary-ink); color: var(--c-on-fill); }
.track__step.is-current { color: var(--c-ink); font-weight: 700; font-size: var(--fs-lg); }
.track__step.is-current .track__dot { border: 8px solid var(--c-primary-strong); }
.track__cancel { display: flex; align-items: center; gap: var(--s-2); min-height: 52px; color: var(--c-danger); font-weight: 700; }
.track-status { color: var(--c-ink-2); font-weight: 600; }
.store-wa { display: flex; gap: var(--s-2); align-items: center; padding: var(--s-3); border-radius: var(--r-md); border: 1px dashed var(--c-line-strong); color: var(--c-ink-2); font-size: var(--fs-sm); }
.store-wa strong { color: var(--c-ink); }

.store-foot { display: grid; gap: var(--s-2); justify-items: center; padding-top: var(--s-4); border-top: 1px solid var(--c-line); text-align: center; }
.store-foot__back { display: inline-flex; align-items: center; gap: 6px; min-height: var(--touch); font-weight: 600; }
.store-foot__sign { font-size: var(--fs-xs); color: var(--c-ink-2); }

/* ─────────────────────────── Vista dividida ─────────────────────────── */

.main--split { padding: var(--s-5) var(--s-6) 72px; }
.main--split > * { max-width: none; }
.split-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-4); }
.split-head__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); }
.split { display: grid; grid-template-columns: 420px minmax(0, 1fr); gap: var(--s-6); align-items: start; margin-top: var(--s-5); }
.split__phone { display: grid; gap: var(--s-2); justify-items: center; position: sticky; top: var(--s-4); }
.split__caption { display: flex; align-items: center; gap: var(--s-2); color: var(--c-ink-2); font-weight: 700; font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: .08em; }
.split__caption .icon { width: 18px; height: 18px; }
.phone {
  position: relative;
  width: 404px;
  height: min(820px, calc(100vh - 150px));
  min-height: 560px;
  padding: 12px;
  border-radius: 44px;
  background: var(--c-ink);
  box-shadow: var(--shadow-3);
}
.phone__notch { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); width: 96px; height: 22px; border-radius: 12px; background: #08172C; z-index: 2; }
.phone__screen { height: 100%; overflow-y: auto; overflow-x: hidden; border-radius: 34px; background: var(--c-bg); scrollbar-width: thin; }
.phone__screen:focus-visible { box-shadow: var(--focus-ring); }
.phone__screen .store { padding-top: 44px; }
.split__kitchen { min-width: 0; }
.kds-host--compact .kds { margin-top: var(--s-4); }
.kds-host--compact .kds-grid { grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }
@media (max-width: 1180px) {
  .split { grid-template-columns: 1fr; }
  .split__phone { position: static; }
}
@media (max-width: 480px) {
  .phone { width: 100%; padding: 8px; border-radius: 28px; }
  .phone__screen { border-radius: 22px; }
  .main--split { padding: var(--s-4); }
}

/* Menú lateral: accesos a la tienda y a la vista dividida. */
.nav__store { display: grid; gap: 2px; }
