/* ===========================================================================
   Tienda Los Güeros — hoja única (tienda + panel)
   ---------------------------------------------------------------------------
   Criterio de Apple (skill apple-design), aplicado a una tienda de colonia:

   · Fuente del sistema. En iPhone es SF con su tracking óptico; en Android,
     Roboto. No se descarga ninguna tipografía: la tienda carga rápido en
     datos móviles, que es como la va a abrir el vecino.
   · Claro y oscuro siguen al sistema. Ninguna regla consulta el tema: sólo
     se redefinen tokens en el @media de abajo.
   · Un solo color significa "toca aquí": --accent. Los productos traen su
     propio color en las fotos; la interfaz no compite con ellos.
   · Respuesta en el toque (:active), no al soltar. Movimiento sólo en
     transform/opacity, y todo se apaga con prefers-reduced-motion.
   · Material translúcido sólo en el cromo flotante (barra superior, barra del
     carrito, hoja), nunca apilado sobre otro material.

   Contrastes medidos (WCAG AA): texto secundario 5.07:1 en claro y 5.93:1 en
   oscuro sobre superficie; blanco sobre --accent 4.70:1 en los dos temas.

   Orden: tokens → base → controles → tienda → carrito → pedido → panel.
   ======================================================================== */

:root{
  --bg:#f5f5f7;
  --surface:#ffffff;
  --surface-2:#fbfbfd;
  --fill:rgba(120,120,128,.12);
  --fill-strong:rgba(120,120,128,.2);
  --line:rgba(0,0,0,.08);
  --line-strong:rgba(0,0,0,.14);
  --field-line:#8e8e93;

  --ink:#1d1d1f;
  --ink-2:#424245;
  --ink-3:#6e6e73;

  /* Fondo de botón (blanco encima: 4.70:1) y texto de enlace (5.57:1). */
  --accent:#0071e3;
  --accent-hover:#0077ed;
  --accent-text:#0066cc;
  --accent-soft:rgba(0,113,227,.1);

  --success:#1f7a35;
  --success-soft:rgba(52,199,89,.14);
  --warning:#b25000;
  --warning-soft:rgba(255,149,0,.14);
  --danger:#d70015;
  --danger-soft:rgba(255,59,48,.1);
  --whatsapp:#1a7f4b;

  --seg-thumb:#ffffff;
  --material:rgba(255,255,255,.72);
  --material-strong:rgba(255,255,255,.88);
  --scrim:rgba(0,0,0,.32);

  --shadow-card:0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.04);
  --shadow-float:0 8px 32px rgba(0,0,0,.12), 0 2px 6px rgba(0,0,0,.06);
  --shadow-sheet:0 -8px 40px rgba(0,0,0,.18);

  /* Tonos de las tarjetas sin foto: pasteles que en oscuro se vuelven hondos. */
  --tone-0:#fde8d7; --tone-1:#e3f1df; --tone-2:#e2ecfb;
  --tone-3:#f7e1ec; --tone-4:#fbf1d0; --tone-5:#e7e3f8;
  --tone-ink:rgba(0,0,0,.42);

  --font:-apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display:-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono:ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  --wrap:1180px;
  --r-sm:10px;
  --r:14px;
  --r-lg:20px;
  --r-xl:28px;
  --topbar-h:60px;

  /* Curvas: la de salida rápida para todo lo que el usuario provoca. */
  --ease-out:cubic-bezier(.23,1,.32,1);
  --ease-in-out:cubic-bezier(.65,0,.35,1);

  color-scheme:light dark;
}

/* Oscuro: sigue al sistema salvo que el panel lo fije con data-theme
   ("light" lo apaga aunque el teléfono esté en oscuro; "dark" lo prende).
   Los mismos tokens van dos veces: aquí y en :root[data-theme="dark"]. */
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    --bg:#000000;
    --surface:#1c1c1e;
    --surface-2:#2c2c2e;
    --fill:rgba(120,120,128,.24);
    --fill-strong:rgba(120,120,128,.36);
    --line:rgba(255,255,255,.1);
    --line-strong:rgba(255,255,255,.18);
    --field-line:#7c7c80;

    --ink:#f5f5f7;
    --ink-2:#d1d1d6;
    --ink-3:#98989d;

    --accent:#0071e3;
    --accent-hover:#147ce5;
    --accent-text:#2997ff;
    --accent-soft:rgba(41,151,255,.16);

    --success:#30d158;
    --success-soft:rgba(48,209,88,.16);
    --warning:#ff9f0a;
    --warning-soft:rgba(255,159,10,.16);
    --danger:#ff6961;
    --danger-soft:rgba(255,69,58,.16);
    --whatsapp:#1a7f4b;

    --seg-thumb:#636366;
    --material:rgba(28,28,30,.72);
    --material-strong:rgba(28,28,30,.9);
    --scrim:rgba(0,0,0,.55);

    --shadow-card:none;
    --shadow-float:0 8px 32px rgba(0,0,0,.5);
    --shadow-sheet:0 -8px 40px rgba(0,0,0,.6);

    --tone-0:#3a2a1f; --tone-1:#22301f; --tone-2:#1f2a3a;
    --tone-3:#3a2230; --tone-4:#3a331c; --tone-5:#2a2540;
    --tone-ink:rgba(255,255,255,.5);
  }
}
:root[data-theme="dark"]{
  color-scheme:dark;
  --bg:#000000; --surface:#1c1c1e; --surface-2:#2c2c2e;
  --fill:rgba(120,120,128,.24); --fill-strong:rgba(120,120,128,.36);
  --line:rgba(255,255,255,.1); --line-strong:rgba(255,255,255,.18); --field-line:#7c7c80;
  --ink:#f5f5f7; --ink-2:#d1d1d6; --ink-3:#98989d;
  --accent:#0071e3; --accent-hover:#147ce5; --accent-text:#2997ff; --accent-soft:rgba(41,151,255,.16);
  --success:#30d158; --success-soft:rgba(48,209,88,.16);
  --warning:#ff9f0a; --warning-soft:rgba(255,159,10,.16);
  --danger:#ff6961; --danger-soft:rgba(255,69,58,.16); --whatsapp:#1a7f4b;
  --seg-thumb:#636366; --material:rgba(28,28,30,.72); --material-strong:rgba(28,28,30,.9); --scrim:rgba(0,0,0,.55);
  --shadow-card:none; --shadow-float:0 8px 32px rgba(0,0,0,.5); --shadow-sheet:0 -8px 40px rgba(0,0,0,.6);
  --tone-0:#3a2a1f; --tone-1:#22301f; --tone-2:#1f2a3a; --tone-3:#3a2230; --tone-4:#3a331c; --tone-5:#2a2540;
  --tone-ink:rgba(255,255,255,.5);
}
:root[data-theme="light"]{ color-scheme:light }

/* ---------------------------------------------------------------------------
   Paletas (Ajustes → Colores de la tienda). Sólo redefinen tokens; ninguna
   regla de componente pregunta por la paleta. --topbar-bg/--topbar-ink dejan
   que "Blanco con barra vino" pinte la barra de arriba sin tocar su CSS.
   Contraste medido: blanco sobre cada --accent ≥ 7:1 en claro, ≥ 4.8:1 en
   oscuro; --accent-text sobre --surface ≥ 7:1 en claro.
   ------------------------------------------------------------------------ */

:root[data-palette="vino"]{
  --bg:#f6f4f3; --surface-2:#faf8f7;
  --accent:#7a1f2b; --accent-hover:#8b2534; --accent-text:#7a1f2b; --accent-soft:rgba(122,31,43,.09);
}
:root[data-palette="vino-crema"]{
  --bg:#fbf6ee; --surface:#fffdf9; --surface-2:#fdf8f1;
  --fill:rgba(110,70,40,.08); --fill-strong:rgba(110,70,40,.15);
  --line:rgba(60,30,10,.08); --line-strong:rgba(60,30,10,.14);
  --ink:#2b1b17; --ink-2:#4a3530; --ink-3:#77625a;
  --accent:#6e1b28; --accent-hover:#7f2231; --accent-text:#6e1b28; --accent-soft:rgba(110,27,40,.09);
  --material:rgba(255,253,249,.78); --material-strong:rgba(255,253,249,.92);
  --tone-0:#f6e2d0; --tone-1:#e9ecd6; --tone-2:#efe3d6; --tone-3:#f3dcdc; --tone-4:#f6ecd0; --tone-5:#ece0e8;
}
:root[data-palette="vino-blanco"]{
  --bg:#ffffff; --surface:#ffffff; --surface-2:#f7f5f5;
  --accent:#8e1b32; --accent-hover:#a0223b; --accent-text:#8e1b32; --accent-soft:rgba(142,27,50,.08);
  --topbar-bg:#8e1b32; --topbar-ink:#ffffff; --topbar-field:rgba(255,255,255,.16); --topbar-field-ink:#ffffff;
}

@media (prefers-color-scheme: dark){
  :root[data-palette="vino"]:not([data-theme="light"]),
  :root[data-palette="vino-blanco"]:not([data-theme="light"]){
    --bg:#0c0a0a; --surface:#1c1819; --surface-2:#282223;
    --accent:#b0364a; --accent-hover:#bf4257; --accent-text:#ff8f9f; --accent-soft:rgba(255,143,159,.14);
    --topbar-bg:initial; --topbar-ink:initial; --topbar-field:initial; --topbar-field-ink:initial;
  }
  :root[data-palette="vino-crema"]:not([data-theme="light"]){
    --bg:#110d0b; --surface:#1f1916; --surface-2:#2b2320; --ink:#f6efe8; --ink-2:#dccfc6; --ink-3:#a8988f;
    --fill:rgba(160,130,110,.2); --fill-strong:rgba(160,130,110,.32);
    --line:rgba(255,240,230,.1); --line-strong:rgba(255,240,230,.18);
    --accent:#a93a4c; --accent-hover:#b84659; --accent-text:#f3a1ad; --accent-soft:rgba(243,161,173,.14);
    --material:rgba(31,25,22,.74); --material-strong:rgba(31,25,22,.92);
    --tone-0:#3a2a1f; --tone-1:#2c2c1c; --tone-2:#33271f; --tone-3:#3a2226; --tone-4:#3a321c; --tone-5:#322530;
  }
}
:root[data-palette="vino"][data-theme="dark"],
:root[data-palette="vino-blanco"][data-theme="dark"]{
  --bg:#0c0a0a; --surface:#1c1819; --surface-2:#282223;
  --accent:#b0364a; --accent-hover:#bf4257; --accent-text:#ff8f9f; --accent-soft:rgba(255,143,159,.14);
  --topbar-bg:initial; --topbar-ink:initial; --topbar-field:initial; --topbar-field-ink:initial;
}
:root[data-palette="vino-crema"][data-theme="dark"]{
  --bg:#110d0b; --surface:#1f1916; --surface-2:#2b2320; --ink:#f6efe8; --ink-2:#dccfc6; --ink-3:#a8988f;
  --fill:rgba(160,130,110,.2); --fill-strong:rgba(160,130,110,.32);
  --line:rgba(255,240,230,.1); --line-strong:rgba(255,240,230,.18);
  --accent:#a93a4c; --accent-hover:#b84659; --accent-text:#f3a1ad; --accent-soft:rgba(243,161,173,.14);
  --material:rgba(31,25,22,.74); --material-strong:rgba(31,25,22,.92);
  --tone-0:#3a2a1f; --tone-1:#2c2c1c; --tone-2:#33271f; --tone-3:#3a2226; --tone-4:#3a321c; --tone-5:#322530;
}

/* ---------------------------------------------------------------------------
   Base
   ------------------------------------------------------------------------ */

/* `hidden` tiene que ganar siempre: si no, cualquier regla con display
   (.btn, .toggle-row, .notice…) vuelve a mostrar lo que el HTML o el JS
   escondieron — pasó con el botón de cámara donde no hay lector de códigos. */
[hidden]{ display:none !important }

*,*::before,*::after{ box-sizing:border-box }
/* scrollbar-gutter: al abrir la hoja se bloquea el scroll y, sin reservar el
   hueco de la barra, toda la página brincaba 15 px a la derecha. */
html{ -webkit-text-size-adjust:100%; scroll-padding-top:calc(var(--topbar-h) + 64px); scrollbar-gutter:stable; background:var(--bg) }
body{
  margin:0; background:var(--bg); color:var(--ink);
  font:400 1.0625rem/1.47 var(--font);
  letter-spacing:-.011em;
  -webkit-font-smoothing:antialiased; -moz-osx-font-smoothing:grayscale;
  -webkit-tap-highlight-color:transparent;
}

/* Tracking por tamaño (skill §15): cerrado en lo grande, casi 0 en el cuerpo. */
h1,h2,h3{ font-family:var(--font-display); margin:0 0 .4em; color:var(--ink); text-wrap:balance }
h1{ font-size:clamp(2rem, 1.4rem + 2.6vw, 3.25rem); line-height:1.06; font-weight:700; letter-spacing:-.028em }
h2{ font-size:clamp(1.375rem, 1.2rem + .8vw, 1.75rem); line-height:1.14; font-weight:700; letter-spacing:-.022em }
h3{ font-size:1.0625rem; line-height:1.3; font-weight:600; letter-spacing:-.016em }
p{ margin:0 0 1em }
p:last-child{ margin-bottom:0 }
a{ color:var(--accent-text); text-decoration:none }
a:hover{ text-decoration:underline; text-underline-offset:3px }
img{ max-width:100%; display:block }
/* Tamaño por defecto de los íconos de icon(); las reglas de cada componente
   (.btn svg, .perks svg…) son más específicas y lo sobrescriben. */
.ico{ width:1.25em; height:1.25em; flex:none; vertical-align:-.2em }
small,.small{ font-size:.8125rem; letter-spacing:-.004em }
.muted{ color:var(--ink-3) }
.mono{ font-family:var(--mono); font-variant-numeric:tabular-nums; letter-spacing:0 }
.num{ font-variant-numeric:tabular-nums }
.nowrap{ white-space:nowrap }

:focus-visible{ outline:3px solid var(--accent-soft); outline-offset:2px; box-shadow:0 0 0 1px var(--accent); border-radius:6px }

.sr-only{ position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; border:0 }
.skip-link{ position:absolute; left:-9999px; top:8px; z-index:200; background:var(--surface); color:var(--ink); padding:.7rem 1rem; border-radius:var(--r-sm); box-shadow:var(--shadow-float) }
.skip-link:focus{ left:8px }

.wrap{ width:min(100% - 2rem, var(--wrap)); margin-inline:auto }
@media (min-width:48rem){ .wrap{ width:min(100% - 3rem, var(--wrap)) } }

/* ---------------------------------------------------------------------------
   Controles
   ------------------------------------------------------------------------ */

.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:.5rem;
  min-height:44px; padding:0 1.25rem;
  border:0; border-radius:980px; cursor:pointer;
  font:600 1rem/1 var(--font); letter-spacing:-.01em; text-decoration:none; white-space:nowrap;
  transition:transform 120ms var(--ease-out), background-color 150ms ease, opacity 150ms ease;
  touch-action:manipulation; user-select:none;
}
.btn:hover{ text-decoration:none }
/* La respuesta vive en el toque (skill §1): se hunde al presionar, no al soltar. */
.btn:active{ transform:scale(.97) }
.btn[disabled],.btn.is-busy{ opacity:.5; pointer-events:none }

.btn--primary{ background:var(--accent); color:#fff }
.btn--primary:hover{ background:var(--accent-hover); color:#fff }
.btn--secondary{ background:var(--fill); color:var(--ink) }
.btn--secondary:hover{ background:var(--fill-strong); color:var(--ink) }
.btn--plain{ background:transparent; color:var(--accent-text); padding:0 .5rem; min-height:36px }
.btn--danger{ background:var(--danger-soft); color:var(--danger) }
.btn--whatsapp{ background:var(--whatsapp); color:#fff }
.btn--whatsapp:hover{ color:#fff; filter:brightness(1.06) }
.btn--lg{ min-height:52px; padding:0 1.6rem; font-size:1.0625rem }
.btn--sm{ min-height:34px; padding:0 .9rem; font-size:.875rem }
.btn--block{ width:100% }
.btn svg{ width:1.15em; height:1.15em; flex:none }

.icon-btn{
  position:relative; display:inline-grid; place-items:center;
  width:44px; height:44px; border:0; border-radius:50%;
  background:var(--fill); color:var(--ink); cursor:pointer;
  transition:transform 120ms var(--ease-out), background-color 150ms ease;
}
.icon-btn:hover{ background:var(--fill-strong); text-decoration:none }
.icon-btn:active{ transform:scale(.92) }
.icon-btn svg{ width:22px; height:22px }

.field{ display:block; margin-bottom:1rem }
.field__label{ display:block; font-size:.875rem; font-weight:600; margin-bottom:.4rem; color:var(--ink) }
.field__help{ display:block; font-size:.8125rem; color:var(--ink-3); margin-top:.35rem }
.field__optional{ font-weight:400; color:var(--ink-3) }

input[type=text],input[type=tel],input[type=email],input[type=number],input[type=password],
input[type=search],input[type=file],select,textarea{
  width:100%; min-height:44px; padding:.65rem .85rem;
  font:400 1.0625rem/1.3 var(--font); letter-spacing:-.011em; color:var(--ink);
  background:var(--surface); border:1px solid var(--field-line); border-radius:var(--r-sm);
  transition:border-color 150ms ease, box-shadow 150ms ease;
}
/* iOS hace zoom si el campo tiene menos de 16 px: 17 px (1.0625rem) lo evita. */
input:focus,select:focus,textarea:focus{ outline:none; border-color:var(--accent); box-shadow:0 0 0 4px var(--accent-soft) }
input::placeholder,textarea::placeholder{ color:var(--ink-3); opacity:1 }
textarea{ resize:vertical; min-height:5.5rem }
input[type=file]{ padding:.55rem; font-size:.9375rem }
input[type=checkbox],input[type=radio]{ accent-color:var(--accent); width:20px; height:20px; margin:0; flex:none }

.row-2{ display:grid; gap:0 1rem }
@media (min-width:36rem){ .row-2{ grid-template-columns:1fr 1fr } }

/* Control segmentado (iOS): dos o tres opciones excluyentes. Son radios de
   verdad, así que funciona sin JavaScript y con teclado. */
.segmented{
  display:grid; grid-auto-columns:1fr; grid-auto-flow:column; gap:2px;
  padding:2px; border-radius:11px; background:var(--fill);
}
.segmented label{ position:relative; display:block; cursor:pointer }
.segmented input{ position:absolute; inset:0; opacity:0; width:100%; height:100%; margin:0; cursor:pointer }
.segmented span{
  display:flex; align-items:center; justify-content:center; gap:.4rem;
  min-height:40px; padding:.35rem .6rem; border-radius:9px;
  font-size:.9375rem; font-weight:600; color:var(--ink-2); text-align:center; line-height:1.2;
  transition:background-color 180ms var(--ease-out), color 180ms ease, box-shadow 180ms ease;
}
/* --seg-thumb y no --surface: en oscuro la superficie es MÁS oscura que el
   riel, y la opción elegida parecía hundida. iOS usa un gris más claro. */
.segmented input:checked + span{ background:var(--seg-thumb); color:var(--ink); box-shadow:0 1px 3px rgba(0,0,0,.12), 0 0 0 .5px rgba(0,0,0,.04) }
@media (max-width:25rem){ .segmented span{ font-size:.875rem; gap:.3rem; padding-inline:.4rem } }
.segmented input:focus-visible + span{ box-shadow:0 0 0 3px var(--accent-soft), 0 0 0 1px var(--accent) }
.segmented input:disabled + span{ opacity:.4; cursor:not-allowed }

/* Pastillas de estado: color por significado, nunca de adorno. */
.pill{
  display:inline-flex; align-items:center; gap:.35rem;
  padding:.2rem .65rem; border-radius:980px;
  font-size:.8125rem; font-weight:600; line-height:1.4; white-space:nowrap;
  background:var(--fill); color:var(--ink-2);
}
.pill--accent{ background:var(--accent-soft); color:var(--accent-text) }
.pill--success{ background:var(--success-soft); color:var(--success) }
.pill--warning{ background:var(--warning-soft); color:var(--warning) }
.pill--danger{ background:var(--danger-soft); color:var(--danger) }
.pill--neutral{ background:var(--fill); color:var(--ink-2) }
.pill__dot{ width:7px; height:7px; border-radius:50%; background:currentColor }

.notice{
  display:flex; gap:.75rem; align-items:flex-start;
  padding:.85rem 1rem; border-radius:var(--r); margin:0 0 1rem;
  font-size:.9375rem; line-height:1.45;
  background:var(--fill); color:var(--ink);
}
.notice--error{ background:var(--danger-soft); color:var(--danger) }
.notice--success{ background:var(--success-soft); color:var(--success) }
.notice--warning{ background:var(--warning-soft); color:var(--warning) }
.notice--info{ background:var(--accent-soft); color:var(--accent-text) }
.notice a{ color:inherit; text-decoration:underline }
.notice svg{ width:20px; height:20px; flex:none; margin-top:1px }

.card{ background:var(--surface); border-radius:var(--r-lg); box-shadow:var(--shadow-card) }
@media (prefers-color-scheme: dark){ .card{ border:0 } }

/* Aviso flotante (toast): aparece desde abajo, de donde está el pulgar. */
.toast{
  position:fixed; left:50%; bottom:calc(20px + env(safe-area-inset-bottom)); z-index:120;
  max-width:min(92vw, 420px); padding:.8rem 1.1rem; border-radius:16px;
  background:var(--material-strong); color:var(--ink);
  -webkit-backdrop-filter:blur(20px) saturate(180%); backdrop-filter:blur(20px) saturate(180%);
  box-shadow:var(--shadow-float); font-size:.9375rem; font-weight:500;
  transform:translate(-50%, 16px); opacity:0; pointer-events:none;
  transition:transform 360ms var(--ease-out), opacity 240ms ease;
}
.toast.is-visible{ transform:translate(-50%, 0); opacity:1 }
body.has-cartbar .toast{ bottom:calc(92px + env(safe-area-inset-bottom)) }

/* ---------------------------------------------------------------------------
   Barra superior (material translúcido; el contenido pasa por debajo)
   ------------------------------------------------------------------------ */

.topbar{
  position:sticky; top:0; z-index:60;
  background:var(--topbar-bg, var(--material)); color:var(--topbar-ink, var(--ink));
  -webkit-backdrop-filter:blur(20px) saturate(180%); backdrop-filter:blur(20px) saturate(180%);
  /* Borde de luz en vez de línea dura (skill §12): se nota sólo sobre contenido. */
  box-shadow:0 .5px 0 var(--line-strong);
}
.topbar__inner{ display:flex; align-items:center; gap:.75rem; min-height:var(--topbar-h) }
/* Marca: el nombre en texto, o el logo si se subió uno en Ajustes. */
.brand{ display:flex; align-items:center; color:var(--ink); font-family:var(--font-display); font-weight:700; font-size:1.1875rem; letter-spacing:-.028em; white-space:nowrap; flex:none }
.brand:hover{ text-decoration:none; color:var(--ink) }
.brand__text{ overflow:hidden; text-overflow:ellipsis; max-width:60vw }
/* Alto fijo y ancho libre: un logo horizontal y uno cuadrado caben igual. */
.brand__logo{ display:block; height:32px; width:auto; max-width:180px; object-fit:contain }
@media (max-width:40rem){ .brand__logo{ height:28px; max-width:150px } }
.topbar .brand,.topbar .brand:hover{ color:var(--topbar-ink, var(--ink)) }
.topbar .search input{ background:var(--topbar-field, var(--fill)); color:var(--topbar-field-ink, var(--ink)) }
.topbar .search input::placeholder,.topbar .search svg{ color:var(--topbar-field-ink, var(--ink-3)); opacity:.8 }
.topbar .search input:focus{ background:var(--surface); color:var(--ink) }
.topbar .cart-btn{ background:var(--topbar-field, var(--fill)); color:var(--topbar-ink, var(--ink)) }
.topbar__search{ flex:1; max-width:520px; margin-inline:auto }
.search{ position:relative }
.search svg{ position:absolute; left:.8rem; top:50%; width:18px; height:18px; transform:translateY(-50%); color:var(--ink-3); pointer-events:none }
.search input{
  min-height:38px; padding:.45rem .9rem .45rem 2.4rem; border:0; border-radius:12px;
  background:var(--fill); font-size:1rem;
}
.search input:focus{ box-shadow:0 0 0 4px var(--accent-soft); background:var(--surface) }
.topbar__actions{ display:flex; align-items:center; gap:.5rem; margin-left:auto }
.cart-btn{ position:relative }
.badge{
  position:absolute; top:-3px; right:-3px; min-width:20px; height:20px; padding:0 6px;
  display:grid; place-items:center; border-radius:10px;
  background:var(--accent); color:#fff; font-size:.75rem; font-weight:700; letter-spacing:0;
  box-shadow:0 0 0 2px var(--bg);
}
.badge[hidden]{ display:none }
.badge.is-bump{ animation:bump 420ms var(--ease-out) }
@keyframes bump{ 0%{ transform:scale(1) } 30%{ transform:scale(1.28) } 100%{ transform:scale(1) } }

@media (max-width:40rem){
  .topbar__inner{ flex-wrap:wrap; padding-block:.5rem; gap:.5rem }
  .topbar__search{ order:3; flex-basis:100%; max-width:none }
  :root{ --topbar-h:52px }
}

/* ---------------------------------------------------------------------------
   Portada de la tienda
   ------------------------------------------------------------------------ */

.hero{ padding-block:clamp(1.1rem, .8rem + 2.5vw, 3rem) clamp(.75rem, .6rem + 1vw, 1.5rem) }
.hero__eyebrow{ display:flex; flex-wrap:wrap; gap:.5rem; margin-bottom:1rem }
.hero h1{ max-width:16ch; margin-bottom:.2em; font-size:clamp(1.75rem, 1.3rem + 2.2vw, 3rem) }
@media (max-width:40rem){ .hero__lead{ font-size:1rem } }

/* Estado de la tienda en una línea: punto de color + "Abierto ahora · cierra
   a las 11 p. m." + el horario. El color dice el estado; el texto también. */
.status{ display:flex; flex-wrap:wrap; align-items:baseline; gap:.15rem .5rem; margin:.9rem 0 0; font-size:.9375rem; color:var(--ink-2) }
.status__dot{ width:9px; height:9px; border-radius:50%; background:currentColor; align-self:center; flex:none }
.status strong{ font-weight:600 }
.status--open .status__dot,.status--open strong{ color:var(--success) }
.status--closed .status__dot,.status--closed strong{ color:var(--warning) }
.status--paused .status__dot,.status--paused strong{ color:var(--danger) }
.status__hours{ color:var(--ink-3) }
.status__note{ margin:.2rem 0 0; font-size:.875rem; color:var(--ink-3) }
/* Con portada: texto e imagen lado a lado; en el celular la imagen va abajo,
   ancho completo, para que el nombre y el "abierto" se lean primero. */
.hero--img{ display:grid; gap:1.5rem; align-items:center }
@media (min-width:56rem){ .hero--img{ grid-template-columns:minmax(0,1fr) minmax(0,1.05fr); gap:2.5rem } }
.hero__media{ margin:0; border-radius:var(--r-xl); overflow:hidden; background:var(--surface-2); aspect-ratio:16 / 10; box-shadow:var(--shadow-card) }
.hero__media img{ width:100%; height:100%; object-fit:cover }
.hero__lead{ font-size:clamp(1.0625rem, 1rem + .35vw, 1.3125rem); line-height:1.4; color:var(--ink-3); max-width:40ch; letter-spacing:-.016em }
/* Envío, recoger y pago: chips en una fila que se desliza en el celular, en
   vez de una lista de cuatro renglones que empujaba los productos. */
.perks{ display:flex; gap:.5rem; margin:1rem 0 0; padding:0 0 2px; list-style:none; font-size:.875rem; color:var(--ink-2);
  overflow-x:auto; scrollbar-width:none; -webkit-overflow-scrolling:touch }
.perks::-webkit-scrollbar{ display:none }
.perks li{ flex:none; display:flex; align-items:center; gap:.4rem; padding:.4rem .75rem; border-radius:980px; background:var(--fill); white-space:nowrap }
.perks svg{ width:17px; height:17px; color:var(--accent-text); flex:none }
@media (min-width:48rem){ .perks{ flex-wrap:wrap; overflow:visible } }

.last-order{
  display:flex; align-items:center; justify-content:space-between; gap:1rem; flex-wrap:wrap;
  padding:.9rem 1.1rem; margin-bottom:1rem; border-radius:var(--r);
  background:var(--accent-soft); color:var(--ink);
}
.last-order a{ font-weight:600 }

/* Pasillos: fila deslizable, pegada bajo la barra superior. */
/* Fondo sólido: con el degradado a transparente de antes, las esquinas y los
   botones de las tarjetas se asomaban bajo la fila al bajar (el "recuadro"
   raro que se veía en el celular). */
.aisles{
  position:sticky; top:var(--topbar-h); z-index:50;
  background:var(--bg); box-shadow:0 .5px 0 var(--line);
  padding-block:.55rem .6rem;
}
@media (max-width:40rem){ .aisles{ top:calc(var(--topbar-h) + 50px) } }
/* app.js mide el alto real de la barra superior (en el celular son dos
   renglones y cambia con el tamaño de letra del teléfono): sin rendija
   ni encimado entre las dos barras. */
.aisles{ top:var(--sticky-top, var(--topbar-h)) }
@media (max-width:40rem){ .aisles{ top:var(--sticky-top, calc(var(--topbar-h) + 50px)) } }
.aisles__scroll{ display:flex; gap:.5rem; overflow-x:auto; scrollbar-width:none; -webkit-overflow-scrolling:touch; scroll-snap-type:x proximity; padding-bottom:2px }
.aisles__scroll::-webkit-scrollbar{ display:none }
.chip{
  flex:none; scroll-snap-align:start;
  display:inline-flex; align-items:center; gap:.35rem; min-height:36px; padding:0 1rem;
  border-radius:980px; background:var(--surface); color:var(--ink);
  font-size:.9375rem; font-weight:500; white-space:nowrap;
  box-shadow:inset 0 0 0 1px var(--line-strong);
  transition:background-color 150ms ease, color 150ms ease, transform 120ms var(--ease-out);
}
.chip:hover{ text-decoration:none; background:var(--fill) }
.chip:active{ transform:scale(.96) }
.chip[aria-current="page"],.chip.is-active{ background:var(--ink); color:var(--bg); box-shadow:none }
.chip__count{ font-size:.8125rem; opacity:.6; font-variant-numeric:tabular-nums }

.section-title{ display:flex; align-items:baseline; justify-content:space-between; gap:1rem; margin:2rem 0 1rem }
.section-title h2{ margin:0 }
.section-title .muted{ font-size:.9375rem }
.results-title{ font-size:clamp(1.5rem, 1.2rem + 1vw, 2rem); margin:0 }

/* Riel de destacados: desliza con el dedo y se detiene en cada tarjeta. */
.rail{ display:grid; grid-auto-flow:column; grid-auto-columns:calc((100% - 2rem - 1.8rem) / 2.3); gap:.9rem; overflow-x:auto; scroll-snap-type:x mandatory; scrollbar-width:none; padding-bottom:4px; margin-inline:-1rem; padding-inline:1rem; scroll-padding-inline:1rem }
.rail::-webkit-scrollbar{ display:none }
.rail > *{ scroll-snap-align:start }
@media (min-width:48rem){ .rail{ grid-auto-columns:200px; margin-inline:0; padding-inline:0 } }

/* En el teléfono, tres por fila: caben dos filas en la primera pantalla en
   vez de una. Las tarjetas chicas aprietan el texto y el botón se queda en "+". */
.grid{ display:grid; grid-template-columns:repeat(3, minmax(0, 1fr)); gap:1rem .6rem }
@media (min-width:30rem){ .grid{ grid-template-columns:repeat(auto-fill, minmax(140px, 1fr)); gap:1.25rem .9rem } }
@media (min-width:48rem){ .grid{ grid-template-columns:repeat(auto-fill, minmax(190px, 1fr)); gap:1.75rem 1.25rem } }

/* Tarjeta de supermercado (tipo Walmart), no de tienda de moda: sin caja ni
   sombra; la foto es el recuadro, y abajo precio → nombre → presentación. */
.product{ position:relative; display:flex; flex-direction:column; min-width:0 }
.product__link{ display:flex; flex-direction:column; color:inherit; flex:1; border-radius:var(--r) }
.product__link:hover{ text-decoration:none }
.product__link:active .product__media{ transform:scale(.985) }
.product__media{ position:relative; aspect-ratio:1; background:var(--surface-2); overflow:hidden; border-radius:var(--r);
  transition:transform 160ms var(--ease-out) }
/* Fotos de la tienda (tomadas en el pasillo, con su fondo): llenan el recuadro, sin marco blanco. */
.product__media img{ width:100%; height:100%; object-fit:cover; display:block }
/* Fotos de estudio (Open Food Facts, fondo blanco): enteras, sobre blanco. */
.product__media.is-packshot{ background:#fff }
.product__media.is-packshot img{ object-fit:contain; padding:8% }
.product__tile{
  width:100%; height:100%; display:grid; place-items:center;
  font:700 clamp(1.8rem, 1.4rem + 1.4vw, 2.6rem)/1 var(--font-display); letter-spacing:-.04em; color:var(--tone-ink);
}
.tone-0{ background:var(--tone-0) } .tone-1{ background:var(--tone-1) } .tone-2{ background:var(--tone-2) }
.tone-3{ background:var(--tone-3) } .tone-4{ background:var(--tone-4) } .tone-5{ background:var(--tone-5) }
.product__flag{ position:absolute; top:.5rem; left:.5rem }
.product__body{ display:flex; flex-direction:column; gap:.1rem; padding:.55rem .1rem 0 }
.product__price{ font-size:1.1875rem; font-weight:800; letter-spacing:-.025em; font-variant-numeric:tabular-nums; color:var(--ink); line-height:1.2 }
.product__price small{ font-size:.8125rem; font-weight:600; color:var(--ink-3); letter-spacing:0 }
.product__name{ font-size:.9375rem; font-weight:400; line-height:1.3; letter-spacing:-.008em; margin:0; color:var(--ink);
  display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden }
.product__unit{ font-size:.8125rem; color:var(--ink-3) }
.product.is-out .product__media{ opacity:.45 }
.product.is-hidden{ display:none }

/* "+ Agregar": capa del tamaño exacto de la foto (aspect-ratio 1, mismo
   ancho) para pegar el botón a su esquina sin meter formularios dentro del
   enlace. La capa no recibe toques; sólo el botón. */
.product__add{ position:absolute; top:0; left:0; right:0; aspect-ratio:1; pointer-events:none;
  display:flex; align-items:flex-end; justify-content:flex-end; padding:.45rem }
.product__add > *{ pointer-events:auto }
.add{ margin:0 }
.add-btn{
  display:inline-flex; align-items:center; gap:.2rem; height:32px; padding:0 .75rem 0 .55rem; border:0; border-radius:980px;
  background:var(--surface); color:var(--accent-text); font:600 .875rem/1 var(--font); letter-spacing:-.01em; white-space:nowrap;
  box-shadow:0 1px 2px rgba(0,0,0,.12), 0 2px 8px rgba(0,0,0,.08); cursor:pointer;
  transition:transform 120ms var(--ease-out), background-color 150ms;
}
.add-btn:hover{ text-decoration:none; background:var(--surface-2) }
.add-btn:active{ transform:scale(.94) }
.add-btn svg{ width:17px; height:17px; stroke-width:2.2 }
.add-btn.is-busy{ opacity:.6 }
.add-btn--qty{ padding:0 .8rem; background:var(--accent); color:#fff; font-variant-numeric:tabular-nums }
.add-btn--qty:hover{ background:var(--accent-hover) }
/* En la tarjeta el contador es una píldora blanca chica, no el control grande. */
.stepper.stepper--card{ height:32px; background:var(--surface); box-shadow:0 1px 2px rgba(0,0,0,.12), 0 2px 8px rgba(0,0,0,.08) }
.stepper.stepper--card button{ width:32px; height:32px; color:var(--accent-text) }
.stepper.stepper--card button svg{ width:16px; height:16px; stroke-width:2.2 }
.stepper.stepper--card .stepper__qty{ min-width:1.3rem; font-size:.875rem }
.stepper.stepper--bulk .stepper__qty{ min-width:3.4rem; font-size:.8125rem }

@media (max-width:29.99rem){
  .rail{ grid-auto-columns:calc((100% - 2rem - 1.8rem) / 3.25); gap:.6rem }
  .product__body{ padding-top:.4rem }
  .product__price{ font-size:1rem }
  .product__price small{ font-size:.6875rem }
  .product__name{ font-size:.8125rem; line-height:1.25 }
  .product__unit{ font-size:.75rem }
  .product__tile{ font-size:1.5rem }
  .product__flag{ top:.3rem; left:.3rem; font-size:.6875rem; padding:.1rem .4rem }
  .product__add{ padding:.3rem }
  .add-btn{ height:30px; min-width:30px; padding:0; justify-content:center }
  .add-btn > span{ display:none }
  .add-btn--qty{ padding:0 .55rem; font-size:.75rem }
  .stepper.stepper--card{ height:30px }
  .stepper.stepper--card button{ width:28px; height:30px }
  .stepper.stepper--card .stepper__qty{ min-width:1rem; font-size:.8125rem }
}
.stepper{
  display:inline-flex; align-items:center; gap:0; height:38px; border-radius:980px;
  background:var(--fill);
}
.stepper form{ margin:0; display:contents }
.stepper button{
  width:38px; height:38px; border:0; border-radius:50%; background:transparent; color:var(--ink);
  display:grid; place-items:center; cursor:pointer; transition:transform 120ms var(--ease-out), background-color 150ms;
}
.stepper button:hover{ background:var(--fill) }
.stepper button:active{ transform:scale(.88) }
.stepper button svg{ width:18px; height:18px }
.stepper__qty{ min-width:1.6rem; text-align:center; font-weight:700; font-variant-numeric:tabular-nums; font-size:.9375rem }

.empty{ text-align:center; padding:3rem 1rem; color:var(--ink-3) }
.empty svg{ width:44px; height:44px; margin:0 auto 1rem; color:var(--ink-3); opacity:.6 }
.empty h2,.empty h3{ color:var(--ink) }

.closed{
  display:flex; gap:.9rem; align-items:center; padding:1rem 1.2rem; border-radius:var(--r-lg);
  background:var(--warning-soft); color:var(--ink); margin-bottom:1rem;
}
.closed strong{ color:var(--warning) }

/* Barra flotante del carrito (móvil y escritorio): aparece al agregar algo. */
.cartbar{
  position:fixed; left:50%; bottom:calc(14px + env(safe-area-inset-bottom)); z-index:70;
  width:min(100% - 1.5rem, 560px);
  display:flex; align-items:center; gap:.9rem; padding:.55rem .55rem .55rem 1.1rem;
  border-radius:22px; color:var(--ink);
  background:var(--material-strong);
  -webkit-backdrop-filter:blur(24px) saturate(180%); backdrop-filter:blur(24px) saturate(180%);
  box-shadow:var(--shadow-float), inset 0 .5px 0 rgba(255,255,255,.4);
  transform:translate(-50%, 140%); transition:transform 420ms var(--ease-out);
}
.cartbar.is-visible{ transform:translate(-50%, 0) }
/* Con la hoja abierta la barra sobra: el carrito ya está en pantalla. */
body.sheet-open .cartbar{ transform:translate(-50%, 140%) }
.cartbar__info{ flex:1; min-width:0; line-height:1.2 }
.cartbar__info strong{ display:block; font-size:1.0625rem; font-variant-numeric:tabular-nums; letter-spacing:-.02em }
.cartbar__info span{ font-size:.8125rem; color:var(--ink-3) }

/* ---------------------------------------------------------------------------
   Hoja del carrito (sheet)
   ---------------------------------------------------------------------------
   Móvil: sube desde abajo, se agarra del "grabber" y se cierra arrastrando;
   app.js sigue el dedo 1:1 y suelta con la velocidad del gesto. Escritorio:
   panel lateral que entra y sale por la derecha — el mismo camino de ida y
   de vuelta (skill §7).
   ------------------------------------------------------------------------ */

.scrim{
  position:fixed; inset:0; z-index:90; background:var(--scrim);
  opacity:0; transition:opacity 320ms ease; pointer-events:none;
}
.scrim.is-open{ opacity:1; pointer-events:auto }

.sheet{
  position:fixed; z-index:100; left:0; right:0; bottom:0;
  max-height:min(88vh, 88dvh); display:flex; flex-direction:column;
  background:var(--surface); color:var(--ink);
  border-radius:var(--r-xl) var(--r-xl) 0 0; box-shadow:var(--shadow-sheet);
  transform:translateY(105%); visibility:hidden;
  transition:transform 440ms var(--ease-out), visibility 0s linear 440ms;
  will-change:transform; touch-action:pan-y;
}
.sheet.is-open{ transform:translateY(0); visibility:visible; transition:transform 440ms var(--ease-out), visibility 0s }
.sheet.is-dragging{ transition:none }
.sheet__grab{ padding:.55rem 0 .15rem; cursor:grab; touch-action:none; flex:none }
.sheet__grab::before{ content:""; display:block; width:38px; height:5px; margin:0 auto; border-radius:3px; background:var(--fill-strong) }
.sheet__head{ display:flex; align-items:center; justify-content:space-between; gap:1rem; padding:.35rem 1.25rem .75rem; flex:none; touch-action:none }
.sheet__head h2{ margin:0; font-size:1.375rem }
/* El contenido llega de /carrito?parcial=1; su contenedor no debe romper el
   flex de la hoja, así que se "disuelve" y sus hijos son hijos de .sheet. */
.sheet__content{ display:contents }
.sheet__body{ overflow-y:auto; overscroll-behavior:contain; padding:0 1.25rem; flex:1; -webkit-overflow-scrolling:touch }
.sheet__foot{ flex:none; padding:1rem 1.25rem calc(1rem + env(safe-area-inset-bottom)); border-top:.5px solid var(--line-strong); background:var(--surface) }

@media (min-width:48rem){
  .sheet{
    left:auto; top:0; width:420px; max-height:none; height:100%;
    border-radius:var(--r-xl) 0 0 var(--r-xl); transform:translateX(105%); touch-action:auto;
  }
  .sheet.is-open{ transform:translateX(0) }
  .sheet__grab{ display:none }
  .sheet__head{ padding-top:1.25rem }
}

/* El mismo parcial fuera de la hoja: la página /carrito. */
.cart-page{ max-width:640px; overflow:hidden }
.cart-page .sheet__body{ padding:.5rem 1.25rem }
.cart-page .sheet__foot{ padding-bottom:1.25rem; background:transparent }

.lines{ list-style:none; margin:0; padding:0 }
.line{ display:grid; grid-template-columns:56px 1fr auto; gap:.85rem; align-items:center; padding:.8rem 0; border-bottom:.5px solid var(--line-strong) }
.line:last-child{ border-bottom:0 }
.line__thumb{ width:56px; height:56px; border-radius:12px; overflow:hidden; background:var(--surface-2) }
/* Igual que en la tarjeta: la foto del pasillo llena el cuadro, sin marco
   blanco; sólo la foto de estudio (is-packshot) va entera sobre blanco. */
.line__thumb img{ width:100%; height:100%; object-fit:cover; display:block }
.line__thumb.is-packshot{ background:#fff }
.line__thumb.is-packshot img{ object-fit:contain; padding:4px }
.line__thumb .product__tile{ font-size:1.05rem }
.line__name{ font-size:.9375rem; font-weight:600; line-height:1.25; margin:0 }
.line__meta{ font-size:.8125rem; color:var(--ink-3) }
.line__right{ display:flex; flex-direction:column; align-items:flex-end; gap:.35rem }
.line__total{ font-weight:600; font-variant-numeric:tabular-nums; font-size:.9375rem }
.line .stepper{ height:32px }
.line .stepper button{ width:32px; height:32px }

.totals{ display:grid; gap:.35rem; margin:0 0 1rem; font-size:.9375rem }
.totals > div{ display:flex; justify-content:space-between; gap:1rem }
.totals dt{ color:var(--ink-3) }
.totals dd{ margin:0; font-variant-numeric:tabular-nums; font-weight:500 }
.totals .is-total{ padding-top:.5rem; margin-top:.25rem; border-top:.5px solid var(--line-strong); font-size:1.125rem }
.totals .is-total dt{ color:var(--ink); font-weight:600 }
.totals .is-total dd{ font-weight:700; letter-spacing:-.02em }
.totals .is-free dd{ color:var(--success); font-weight:600 }

.progress-free{ margin:0 0 1rem; font-size:.875rem; color:var(--ink-2) }
.progress-free__bar{ height:6px; border-radius:3px; background:var(--fill); overflow:hidden; margin-top:.4rem }
.progress-free__bar span{ display:block; height:100%; background:var(--success); border-radius:3px; transition:width 400ms var(--ease-out) }

/* ---------------------------------------------------------------------------
   Páginas interiores: carrito, pedido, estado
   ------------------------------------------------------------------------ */

.page{ padding-block:clamp(1.25rem, .8rem + 2vw, 2.5rem) clamp(3rem, 2rem + 4vw, 5rem) }
.page__head{ margin-bottom:1.5rem }
.page__head p{ color:var(--ink-3); margin:0 }
.back{ display:inline-flex; align-items:center; gap:.25rem; font-size:.9375rem; margin-bottom:.75rem }
.back svg{ width:18px; height:18px }

.layout-2{ display:grid; gap:1.25rem; align-items:start }
@media (min-width:60rem){ .layout-2{ grid-template-columns:minmax(0,1fr) 380px; gap:2rem } .layout-2 > aside{ position:sticky; top:calc(var(--topbar-h) + 1rem) } }

/* Grupo estilo Ajustes de iOS: título fuera, tarjeta redondeada dentro. */
.group{ margin-bottom:1.5rem }
.group__title{ font-size:.8125rem; font-weight:600; text-transform:uppercase; letter-spacing:.02em; color:var(--ink-3); margin:0 0 .5rem .25rem }
.group__card{ background:var(--surface); border-radius:var(--r-lg); padding:1.1rem 1.1rem .1rem; box-shadow:var(--shadow-card) }
.group__foot{ font-size:.8125rem; color:var(--ink-3); margin:.5rem .25rem 0 }

/* Opciones de pago/entrega como filas tocables de lista. */
.choices{ display:grid; gap:.6rem; margin-bottom:1rem }
.choice{
  display:flex; align-items:flex-start; gap:.8rem; padding:.9rem 1rem; cursor:pointer;
  border-radius:var(--r); background:var(--surface-2); box-shadow:inset 0 0 0 1px var(--line-strong);
  transition:box-shadow 150ms ease, background-color 150ms ease;
}
.choice:has(input:checked){ box-shadow:inset 0 0 0 2px var(--accent); background:var(--surface) }
.choice:has(input:disabled){ opacity:.45; cursor:not-allowed }
.choice input{ margin-top:2px }
.choice__title{ display:flex; align-items:center; gap:.45rem; font-weight:600; font-size:1rem }
.choice__title .ico{ color:var(--ink-3) }
.choice__text{ display:block; font-size:.875rem; color:var(--ink-3); margin-top:.1rem }
.choice__price{ margin-left:auto; font-weight:600; font-variant-numeric:tabular-nums; white-space:nowrap; padding-left:.5rem }

.group__card .segmented{ margin-bottom:1rem }

.quote{ display:flex; align-items:center; justify-content:space-between; gap:.75rem; flex-wrap:wrap; margin:0 0 1rem; padding:.8rem 1rem; border-radius:var(--r); background:var(--fill) }
.quote__value{ font-weight:700; font-variant-numeric:tabular-nums }
.quote.is-ok{ background:var(--success-soft) }
.quote.is-ok .quote__value{ color:var(--success) }
.quote.is-error{ background:var(--danger-soft); color:var(--danger) }

.summary{ padding:1.25rem }
.summary h2{ font-size:1.25rem; margin-bottom:1rem }
.summary .lines{ max-height:280px; overflow-y:auto; margin-bottom:1rem }
.summary .line{ grid-template-columns:44px 1fr auto; padding:.55rem 0 }
.summary .line__thumb{ width:44px; height:44px; border-radius:10px }
.summary__legal{ font-size:.8125rem; color:var(--ink-3); margin:.75rem 0 0; text-align:center }

/* Estado del pedido */
.status-hero{ text-align:center; padding:1.75rem 1.25rem 1.5rem }
.status-hero__icon{ width:64px; height:64px; margin:0 auto 1rem; display:grid; place-items:center; border-radius:50%; background:var(--accent-soft); color:var(--accent-text) }
.status-hero__icon svg{ width:34px; height:34px }
.status-hero__icon.is-success{ background:var(--success-soft); color:var(--success) }
.status-hero__icon.is-warning{ background:var(--warning-soft); color:var(--warning) }
.status-hero__icon.is-neutral{ background:var(--fill); color:var(--ink-3) }
.status-hero h1{ font-size:clamp(1.625rem, 1.3rem + 1.4vw, 2.25rem); margin-bottom:.3em }
.status-hero p{ color:var(--ink-3); max-width:36ch; margin-inline:auto }
.status-hero__cta{ margin-top:1.25rem }
.line--text{ grid-template-columns:1fr auto }
.totals--spaced{ margin-top:.75rem }
.folio{ display:inline-flex; align-items:center; gap:.5rem; margin-top:1rem; padding:.4rem .9rem; border-radius:980px; background:var(--fill); font-family:var(--mono); font-weight:600; font-size:.9375rem; letter-spacing:.04em }

/* Línea de tiempo: cada paso se enciende al alcanzarlo. */
.steps{ list-style:none; margin:0; padding:.25rem 0; display:grid }
.step{ position:relative; display:grid; grid-template-columns:28px 1fr; gap:.85rem; padding-bottom:1.1rem }
.step:last-child{ padding-bottom:0 }
.step::before{ content:""; position:absolute; left:13px; top:28px; bottom:0; width:2px; background:var(--line-strong) }
.step:last-child::before{ display:none }
.step__dot{ width:28px; height:28px; border-radius:50%; display:grid; place-items:center; background:var(--fill); color:var(--ink-3); position:relative; z-index:1 }
.step__dot svg{ width:16px; height:16px }
.step__title{ font-weight:600; font-size:.9375rem; margin:.2rem 0 0; color:var(--ink-3) }
.step__text{ font-size:.8125rem; color:var(--ink-3); margin:0 }
.step.is-done .step__dot{ background:var(--success); color:#fff }
.step.is-done::before{ background:var(--success) }
.step.is-done .step__title{ color:var(--ink) }
.step.is-current .step__dot{ background:var(--accent); color:#fff; box-shadow:0 0 0 5px var(--accent-soft) }
.step.is-current .step__title{ color:var(--ink) }

.bank{ display:grid; gap:0; margin:0 0 1rem; border-radius:var(--r); overflow:hidden; background:var(--surface-2); box-shadow:inset 0 0 0 1px var(--line-strong) }
.bank > div{ display:flex; align-items:center; justify-content:space-between; gap:.75rem; padding:.75rem 1rem; border-bottom:.5px solid var(--line-strong) }
.bank > div:last-child{ border-bottom:0 }
.bank dt{ font-size:.875rem; color:var(--ink-3) }
.bank dd{ margin:0; display:flex; align-items:center; gap:.5rem; font-weight:600; font-variant-numeric:tabular-nums; text-align:right; word-break:break-all }
.bank .mono{ font-size:.9375rem }
/* En teléfono la CLABE (18 dígitos) + "Copiar" no caben junto a la etiqueta:
   la etiqueta sube y el número queda entero en su renglón, nunca partido. */
@media (max-width: 34rem){
  .bank > div{ flex-wrap:wrap; row-gap:.125rem }
  .bank dt{ flex-basis:100% }
  .bank dd{ flex:1; justify-content:space-between; text-align:left; word-break:normal; white-space:nowrap }
}

.stack{ display:grid; gap:1.25rem }
.panel{ background:var(--surface); border-radius:var(--r-lg); padding:1.25rem; box-shadow:var(--shadow-card) }
.panel > h2{ font-size:1.1875rem; margin-bottom:.85rem }
.kv{ display:grid; gap:.4rem; margin:0; font-size:.9375rem }
.kv > div{ display:flex; justify-content:space-between; gap:1rem }
.kv dt{ color:var(--ink-3) }
.kv dd{ margin:0; text-align:right; font-weight:500 }

.prose{ max-width:65ch }
.prose h2{ margin-top:1.75rem }
.prose ul,.prose ol{ padding-left:1.25rem }

/* Pie */
.footer{ padding-block:2.5rem calc(6rem + env(safe-area-inset-bottom)); color:var(--ink-3); font-size:.8125rem; border-top:.5px solid var(--line-strong); margin-top:2rem }
.footer__inner{ display:flex; flex-wrap:wrap; gap:.75rem 1.5rem; justify-content:space-between }
.footer a{ color:var(--ink-2) }
.footer__name{ color:var(--ink) }
.footer__links{ display:flex; flex-wrap:wrap; gap:.5rem 1.25rem }
.footer__credit{ flex-basis:100%; margin:.25rem 0 0; font-size:.75rem }

/* Error */
.error-page{ text-align:center; max-width:32rem; margin:0 auto; padding-block:4rem }
.error-page__code{ font-size:5rem; font-weight:800; letter-spacing:-.05em; line-height:1; color:var(--fill-strong); margin-bottom:.5rem }
.error-page p{ color:var(--ink-3) }
.error-page__actions{ display:flex; flex-wrap:wrap; gap:.6rem; justify-content:center; margin-top:1.5rem }

/* ---------------------------------------------------------------------------
   Panel de la tienda
   ------------------------------------------------------------------------ */

body.is-centered{ display:grid; place-items:center; min-height:100vh; min-height:100dvh; padding:1.25rem }
.centered-main{ width:min(100%, 24rem) }
.login{ background:var(--surface); border-radius:var(--r-xl); padding:2rem 1.5rem; box-shadow:var(--shadow-float) }
.login__title{ text-align:center; font-size:1.5rem; margin-bottom:.25rem }
.login__sub{ text-align:center; color:var(--ink-3); margin-bottom:1.5rem; font-size:.9375rem }
.login__form .btn{ margin-top:.5rem }
.login__back{ text-align:center; margin:1.25rem 0 0; font-size:.9375rem }
/* Clases que usa setup-admin.php (heredado de rfs). */
.alert{ padding:.85rem 1rem; border-radius:var(--r); margin:0 0 1rem; font-size:.9375rem }
.alert--error{ background:var(--danger-soft); color:var(--danger) }
.alert--success{ background:var(--success-soft); color:var(--success) }
.alert--warning{ background:var(--warning-soft); color:var(--warning) }

.admin-bar{
  position:sticky; top:0; z-index:60; background:var(--material);
  -webkit-backdrop-filter:blur(20px) saturate(180%); backdrop-filter:blur(20px) saturate(180%);
  box-shadow:0 .5px 0 var(--line-strong);
}
.admin-bar__inner{ display:flex; align-items:center; gap:1rem; min-height:56px; flex-wrap:wrap; padding-block:.4rem }
.admin-nav{ display:flex; gap:.25rem; overflow-x:auto; scrollbar-width:none; flex:1 }
.admin-nav::-webkit-scrollbar{ display:none }
.admin-nav a{ display:inline-flex; align-items:center; gap:.4rem; padding:.45rem .85rem; border-radius:980px; color:var(--ink-2); font-size:.9375rem; font-weight:500; white-space:nowrap }
.admin-nav a:hover{ background:var(--fill); text-decoration:none }
.admin-nav a[aria-current="page"]{ background:var(--ink); color:var(--bg) }
.admin-nav .badge{ position:static; box-shadow:none; height:18px; min-width:18px; font-size:.6875rem }
.admin-user{ display:flex; align-items:center; gap:.5rem; font-size:.875rem; color:var(--ink-3) }
.admin-user form{ margin:0 }
@media (max-width:48rem){ .admin-user__name{ display:none } }

.admin-main{ padding-block:1.5rem 4rem }
.admin-head{ display:flex; align-items:flex-end; justify-content:space-between; gap:1rem; flex-wrap:wrap; margin-bottom:1.25rem }
.admin-head h1{ font-size:clamp(1.625rem, 1.3rem + 1vw, 2rem); margin:0 }
.admin-head p{ margin:.25rem 0 0; color:var(--ink-3) }
.admin-head__actions{ display:flex; gap:.5rem; flex-wrap:wrap }

.stats{ display:grid; grid-template-columns:repeat(auto-fit, minmax(150px, 1fr)); gap:.75rem; margin-bottom:1.25rem }
.stat{ background:var(--surface); border-radius:var(--r-lg); padding:1rem 1.1rem; box-shadow:var(--shadow-card) }
.stat__label{ font-size:.8125rem; color:var(--ink-3) }
.stat__value{ font-size:1.75rem; font-weight:700; letter-spacing:-.03em; font-variant-numeric:tabular-nums; line-height:1.15 }
.stat.is-alert .stat__value{ color:var(--warning) }

.tabs{ display:flex; gap:.4rem; overflow-x:auto; scrollbar-width:none; margin-bottom:1rem; padding-bottom:2px }
.tabs::-webkit-scrollbar{ display:none }
.toolbar{ display:flex; gap:.6rem; flex-wrap:wrap; align-items:center; margin-bottom:1rem }
.toolbar .search{ flex:1 1 220px; max-width:360px }
.toolbar .grow{ flex:1 1 200px; width:auto }
.group__card > .toolbar{ margin-bottom:1rem }
.toolbar select{ width:auto; min-height:38px; padding:.4rem 2rem .4rem .75rem; font-size:.9375rem; border-radius:12px }

.list{ background:var(--surface); border-radius:var(--r-lg); box-shadow:var(--shadow-card); overflow:hidden }
.list__row{ display:grid; grid-template-columns:auto 1fr auto; gap:.25rem 1rem; align-items:center; padding:.9rem 1.1rem; border-bottom:.5px solid var(--line-strong); color:var(--ink) }
.list__row:last-child{ border-bottom:0 }
a.list__row:hover{ background:var(--surface-2); text-decoration:none }
.list__main{ min-width:0 }
.list__title{ font-weight:600; display:flex; align-items:center; gap:.5rem; flex-wrap:wrap }
.list__sub{ font-size:.875rem; color:var(--ink-3); white-space:nowrap; overflow:hidden; text-overflow:ellipsis }
.list__aside{ text-align:right; font-variant-numeric:tabular-nums }
.list__aside strong{ display:block; font-size:1.0625rem }
.list__aside span{ font-size:.8125rem; color:var(--ink-3) }
.list__lead{ width:40px; height:40px; border-radius:12px; display:grid; place-items:center; background:var(--fill); color:var(--ink-2) }
.list__lead svg{ width:20px; height:20px }
.list__row.is-new{ animation:flash 1.6s ease }
@keyframes flash{ 0%,40%{ background:var(--accent-soft) } 100%{ background:transparent } }

.table-wrap{ background:var(--surface); border-radius:var(--r-lg); box-shadow:var(--shadow-card); overflow-x:auto }
.table{ width:100%; border-collapse:collapse; font-size:.9375rem }
.table th,.table td{ padding:.7rem .9rem; text-align:left; border-bottom:.5px solid var(--line-strong); vertical-align:middle }
.table th{ font-size:.75rem; font-weight:600; color:var(--ink-3); text-transform:uppercase; letter-spacing:.03em; white-space:nowrap }
.table tr:last-child td{ border-bottom:0 }
.table .num{ text-align:right }
.table__product{ display:flex; align-items:center; gap:.75rem; min-width:220px }
.table__thumb{ width:44px; height:44px; flex:none; border-radius:10px; overflow:hidden; background:var(--surface-2) }
.table__thumb img{ width:100%; height:100%; object-fit:contain; padding:4px; background:#fff }
.table__thumb .product__tile{ font-size:.95rem }
.table tr.is-off td{ opacity:.55 }
.quick{ display:flex; gap:.35rem; flex-wrap:wrap }
.quick form{ margin:0 }

.pager{ display:flex; justify-content:center; align-items:center; gap:1rem; margin-top:1rem; font-size:.9375rem; color:var(--ink-3) }

.order-grid{ display:grid; gap:1.25rem; align-items:start }
@media (min-width:62rem){ .order-grid{ grid-template-columns:minmax(0,1fr) 360px } }
/* En una sola columna (celular y tableta) el botón que mueve el pedido
   quedaba después de todo el detalle y el historial, a casi dos pantallas.
   Las dos columnas se "disuelven" y los paneles se reordenan: primero lo que
   se necesita para decidir (el comprobante) y la acción; el historial al final. */
@media (max-width:61.99rem){
  .order-grid > .stack{ display:contents }
  .o-proof{ order:-3 }
  .o-next{ order:-2 }
  .o-uber{ order:-1 }
  .o-history{ order:10 }
}
.actions{ display:grid; gap:.6rem }
.actions form{ margin:0 }
.actions--after{ margin-top:1rem }
.notice--after{ margin:1rem 0 0 }
.kv dd.is-gain{ color:var(--success) }
.kv dd.is-loss{ color:var(--warning) }
summary.btn{ list-style:none }
summary.btn::-webkit-details-marker{ display:none }
.proof{ border-radius:var(--r); max-height:520px; width:auto; margin:0 auto; background:var(--surface-2) }
.events{ list-style:none; margin:0; padding:0; font-size:.875rem }
.events li{ display:flex; gap:.75rem; padding:.45rem 0; border-bottom:.5px solid var(--line) }
.events li:last-child{ border-bottom:0 }
.events time{ color:var(--ink-3); font-variant-numeric:tabular-nums; white-space:nowrap; min-width:5.5rem }
.hint{ font-size:.8125rem; color:var(--ink-3); margin:.35rem 0 0 }

.new-order{
  /* Oculto por encima del borde: -100% de su alto más su propio "top". Con
     un porcentaje solo, se asomaba bajo la barra aunque no hubiera nada. */
  position:fixed; top:68px; left:50%; z-index:80; transform:translate(-50%, calc(-100% - 90px));
  display:flex; align-items:center; gap:.75rem; padding:.7rem .7rem .7rem 1.1rem; border-radius:18px;
  background:var(--material-strong); -webkit-backdrop-filter:blur(20px) saturate(180%); backdrop-filter:blur(20px) saturate(180%);
  box-shadow:var(--shadow-float); font-weight:600; transition:transform 420ms var(--ease-out);
}
.new-order.is-visible{ transform:translate(-50%, 0) }

.form-grid{ display:grid; gap:1.25rem; align-items:start }
@media (min-width:62rem){
  .form-grid{ grid-template-columns:minmax(0,1fr) 320px }
  /* El botón de guardar acompaña al formulario largo en vez de quedarse arriba. */
  .form-grid > aside{ position:sticky; top:76px }
}
.toggle-row{ display:flex; align-items:center; justify-content:space-between; gap:1rem; padding:.2rem 0 1rem; cursor:pointer }
.toggle-row span{ display:block }
.toggle-row > span:first-child > .ico{ color:var(--ink-3); margin-right:.2rem }
.toggle-row small{ display:block; color:var(--ink-3) }

/* Interruptor iOS: un checkbox real con piel de switch. */
.switch{ position:relative; flex:none; width:51px; height:31px }
.switch input{ position:absolute; inset:0; opacity:0; width:100%; height:100%; margin:0; cursor:pointer; z-index:1 }
.switch span{ position:absolute; inset:0; border-radius:16px; background:var(--fill-strong); transition:background-color 200ms ease }
.switch span::after{ content:""; position:absolute; top:2px; left:2px; width:27px; height:27px; border-radius:50%; background:#fff; box-shadow:0 3px 8px rgba(0,0,0,.15), 0 1px 1px rgba(0,0,0,.16); transition:transform 260ms var(--ease-out) }
.switch input:checked + span{ background:#34c759 }
.switch input:checked + span::after{ transform:translateX(20px) }
.switch input:focus-visible + span{ box-shadow:0 0 0 3px var(--accent-soft), 0 0 0 1px var(--accent) }

.preview-img{ width:100%; aspect-ratio:1; border-radius:var(--r); overflow:hidden; background:var(--surface-2); margin-bottom:.75rem }
.preview-img--wide{ aspect-ratio:16 / 10; display:grid; place-items:center }
.preview-img--wide img{ object-fit:cover !important; padding:0 !important }
.brand-preview{ display:flex; align-items:center; min-height:64px; padding:.75rem 1rem; margin-bottom:.75rem; border-radius:var(--r); background:var(--surface-2) }
.brand-preview img{ height:36px; width:auto; max-width:100% }
.brand-preview .brand__text{ font-family:var(--font-display); font-weight:700; font-size:1.25rem; letter-spacing:-.028em }
.preview-img img{ width:100%; height:100%; object-fit:contain; padding:8%; background:#fff }
.photo-credit{ margin:-.25rem 0 .75rem }

/* Código de barras: campo + Buscar + cámara en un renglón. */
.barcode__row{ display:flex; gap:.5rem }
.barcode__row input{ flex:1; min-width:0; font-variant-numeric:tabular-nums; letter-spacing:.02em }
.barcode__row .btn{ flex:none; min-height:44px }
.btn--icon{ width:44px; padding:0; justify-content:center }
.btn--icon .ico{ margin:0 }
.barcode__status{ display:flex; gap:.6rem; align-items:flex-start; margin-top:.6rem; padding:.7rem .85rem; border-radius:var(--r-sm); font-size:.875rem; line-height:1.4; background:var(--surface-2); color:var(--ink-2) }
.barcode__status .ico{ width:18px; height:18px; flex:none; margin-top:1px }
.barcode__status.is-found{ background:var(--success-soft); color:var(--success) }
.barcode__status.is-missing{ background:var(--warning-soft); color:var(--warning) }
.barcode__status.is-error{ background:var(--danger-soft); color:var(--danger) }
.barcode__status a{ color:inherit; text-decoration:underline; font-weight:600 }
.barcode__status.is-busy::before{ content:""; width:14px; height:14px; flex:none; margin-top:2px; border-radius:50%; border:2px solid currentColor; border-right-color:transparent; animation:spin 700ms linear infinite }
@keyframes spin{ to{ transform:rotate(360deg) } }
/* Rellenado por la búsqueda: un destello suave para ver qué cambió. */
.is-autofilled{ animation:autofill 1.2s var(--ease-out) }
@keyframes autofill{ from{ box-shadow:0 0 0 4px var(--success-soft); border-color:var(--success) } }
.barcode__camera{ position:relative; margin-top:.75rem; border-radius:var(--r); overflow:hidden; background:#000; aspect-ratio:4 / 3 }
.barcode__camera video{ width:100%; height:100%; object-fit:cover; display:block }
.barcode__aim{ position:absolute; left:12%; right:12%; top:38%; bottom:38%; border:2px solid rgba(255,255,255,.9); border-radius:10px; box-shadow:0 0 0 999px rgba(0,0,0,.35) }
.barcode__camera .btn{ position:absolute; left:50%; bottom:.75rem; transform:translateX(-50%) }

/* ---------------------------------------------------------------------------
   Panel en el celular: barra de pestañas abajo, al alcance del pulgar, con
   el botón de escanear grande al centro (como las apps de compras). Arriba
   sólo queda la marca y "Salir"; en computadora no cambia nada.
   ------------------------------------------------------------------------ */

.admin-nav__scan .ico{ width:18px; height:18px }
.tabbar{ display:none }

@media (max-width:47.99rem){
  .admin-nav{ display:none }
  .admin-bar__inner{ justify-content:space-between; min-height:52px }
  .admin-main{ padding-bottom:calc(96px + env(safe-area-inset-bottom)) }

  .tabbar{
    display:grid; grid-template-columns:repeat(5, 1fr); align-items:end;
    position:fixed; left:0; right:0; bottom:0; z-index:70;
    padding:0 .25rem env(safe-area-inset-bottom);
    background:var(--material-strong);
    -webkit-backdrop-filter:blur(20px) saturate(180%); backdrop-filter:blur(20px) saturate(180%);
    box-shadow:0 -.5px 0 var(--line-strong);
  }
  .tabbar a{
    display:flex; flex-direction:column; align-items:center; gap:2px;
    min-height:56px; padding:.45rem 0 .4rem; color:var(--ink-3);
    font-size:.6875rem; font-weight:600; letter-spacing:0;
    transition:color 150ms ease;
  }
  .tabbar a:hover{ text-decoration:none }
  .tabbar a[aria-current="page"]{ color:var(--accent) }
  .tabbar a:active .tabbar__ico,.tabbar a:active .tabbar__scan-btn{ transform:scale(.9) }
  .tabbar__ico{ position:relative; display:grid; place-items:center; width:28px; height:26px; transition:transform 120ms var(--ease-out) }
  .tabbar__ico .ico{ width:24px; height:24px }
  .tabbar__ico .badge{ position:absolute; top:-4px; right:-10px; box-shadow:0 0 0 2px var(--surface); height:17px; min-width:17px; font-size:.625rem }

  /* El botón del centro sobresale de la barra: siempre a la vista. */
  .tabbar__scan{ color:var(--ink-2) !important }
  .tabbar__scan-btn{
    display:grid; place-items:center; width:56px; height:56px; margin-top:-22px; margin-bottom:1px;
    border-radius:50%; background:var(--accent); color:#fff;
    box-shadow:0 0 0 4px var(--bg), 0 6px 16px rgba(0,113,227,.35);
    transition:transform 120ms var(--ease-out);
  }
  .tabbar__scan-btn .ico{ width:28px; height:28px; stroke-width:2 }

  /* Lo que flota abajo sube por encima de la barra. */
  .is-admin .toast{ bottom:calc(84px + env(safe-area-inset-bottom)) }
  .new-order{ top:60px }

  .admin-head__actions{ width:100% }
  .admin-head__actions .btn{ flex:1 }
}

/* Productos en el celular: tarjetas en vez de una tabla de 640 px. */
@media (max-width:47.99rem){
  .table--cards thead{ display:none }
  .table--cards,.table--cards tbody{ display:block }
  .table--cards tr{
    /* Cuatro columnas: los botones (fila 2) ocupan las dos últimas y el
       precio (fila 1) sólo la última, así el nombre no se encoge al ancho
       que dejan los botones. */
    display:grid; grid-template-columns:auto minmax(0,1fr) auto auto;
    grid-template-areas:"prod prod prod price" "stock cat act act";
    gap:.5rem .6rem; align-items:center; padding:.8rem .9rem;
    border-bottom:.5px solid var(--line-strong);
  }
  .table--cards tr:last-child{ border-bottom:0 }
  .table--cards td{ display:block; padding:0; border:0 }
  .table--cards .c-prod{ grid-area:prod; min-width:0 }
  .table--cards .c-price{ grid-area:price; font-size:1rem }
  .table--cards .c-stock{ grid-area:stock }
  .table--cards .c-cat{ grid-area:cat; color:var(--ink-3); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; min-width:0 }
  .table--cards .c-act{ grid-area:act }
  .table--cards .table__product{ min-width:0 }
  .table--cards .table__product strong{ display:inline }
  .table-wrap:has(.table--cards){ overflow-x:visible }
}

/* ---------------------------------------------------------------------------
   Alta exprés (/admin/escanear)
   ------------------------------------------------------------------------ */

.scan__head{ align-items:center }
.scan__stage{ margin-bottom:.75rem }
.scan__camera{ position:relative; overflow:hidden; border-radius:var(--r-lg); background:#000; aspect-ratio:3 / 4; max-height:62vh; width:100% }
@media (min-width:48rem){ .scan__camera{ aspect-ratio:16 / 9; max-height:none } }
.scan__camera video{ position:absolute; inset:0; width:100%; height:100%; object-fit:cover }
/* El recuadro marca la franja que se lee (la misma que recorta ZXing). */
.scan__aim{ position:absolute; left:7%; right:7%; top:30%; bottom:30%; border-radius:14px; box-shadow:0 0 0 999px rgba(0,0,0,.42); border:2px solid rgba(255,255,255,.92) }
.scan__laser{ position:absolute; left:6%; right:6%; top:50%; height:2px; background:#ff3b30; box-shadow:0 0 12px 2px rgba(255,59,48,.6); animation:laser 1.6s ease-in-out infinite alternate }
@keyframes laser{ from{ transform:translateY(-28px) } to{ transform:translateY(28px) } }
.scan__hint{ position:absolute; left:0; right:0; bottom:1rem; margin:0; text-align:center; color:#fff; font-size:.9375rem; font-weight:600; text-shadow:0 1px 3px rgba(0,0,0,.6) }
.scan__torch{ position:absolute; top:.75rem; right:.75rem; width:44px; height:44px; border:0; border-radius:50%; display:grid; place-items:center; background:rgba(0,0,0,.45); color:#fff; cursor:pointer }
.scan__torch.is-on{ background:#fff; color:#000 }
.scan__torch .ico{ width:22px; height:22px }
/* Mismo tamaño que la cámara: al encenderse, la página no brinca. */
.scan__nocam{ display:grid; justify-items:center; align-content:center; gap:.75rem; text-align:center; padding:1.5rem 1.25rem; border-radius:var(--r-lg);
  background:var(--surface); box-shadow:var(--shadow-card); color:var(--ink-3); aspect-ratio:3 / 4; max-height:62vh; width:100% }
@media (min-width:48rem){ .scan__nocam{ aspect-ratio:16 / 9; max-height:none } }
.scan__nocam > .ico{ width:44px; height:44px; color:var(--accent) }
.scan__nocam p{ margin:0; max-width:32ch }
.scan__manual{ display:flex; gap:.5rem; margin-bottom:1.25rem }
.scan__manual input{ flex:1; min-width:0; font-variant-numeric:tabular-nums }
.scan__manual .btn{ flex:none; min-height:44px }

.scan-card{ background:var(--surface); border-radius:var(--r-lg); box-shadow:var(--shadow-card); padding:1rem 1rem .25rem; margin-bottom:1.25rem }
.scan-card__top{ display:flex; gap:1rem; align-items:flex-start; margin-bottom:1rem }
.scan-card__photo{ position:relative; flex:none; width:112px; aspect-ratio:1; border-radius:var(--r); overflow:hidden; background:var(--surface-2); display:grid; place-items:center }
.scan-card__photo img{ position:absolute; inset:0; width:100%; height:100%; object-fit:contain; padding:6%; background:#fff }
.scan-card__nophoto{ display:grid; justify-items:center; gap:.25rem; font-size:.75rem; color:var(--ink-3) }
.scan-card__nophoto .ico{ width:24px; height:24px }
.scan-card__meta{ display:flex; flex-direction:column; align-items:flex-start; gap:.4rem; min-width:0 }
.scan-card__badge{ margin:0; font-weight:700; font-size:1.0625rem; letter-spacing:-.02em }
.scan-card__code{ margin:0; font-size:.8125rem; color:var(--ink-3); font-variant-numeric:tabular-nums; letter-spacing:.03em }
.scan-card__shoot{ position:relative; cursor:pointer }
.scan-card__shoot input{ position:absolute; inset:0; opacity:0; width:100%; height:100%; cursor:pointer }
.scan-card__shoot .ico{ width:16px; height:16px }
.scan-card__row{ gap:0 .75rem }
@media (max-width:35.99rem){ .scan-card__row{ grid-template-columns:1fr 1fr } }
.money-input{ position:relative; display:block }
.money-input > span{ position:absolute; left:.85rem; top:50%; transform:translateY(-50%); color:var(--ink-3); font-weight:600; pointer-events:none }
.money-input input{ padding-left:1.6rem; font-weight:700; font-size:1.25rem; font-variant-numeric:tabular-nums }
.scan-card__msg{ margin:-.25rem 0 1rem; padding:.6rem .8rem; border-radius:var(--r-sm); font-size:.875rem; background:var(--surface-2); color:var(--ink-2) }
.scan-card__msg.is-info{ background:var(--accent-soft); color:var(--accent-text) }
.scan-card__msg.is-warning{ background:var(--warning-soft); color:var(--warning) }
.scan-card__msg.is-error{ background:var(--danger-soft); color:var(--danger) }
.scan-card__actions{ display:grid; grid-template-columns:auto 1fr; gap:.6rem; margin-bottom:.75rem }
.scan-card__full{ display:block; text-align:center; font-size:.875rem; margin:0 0 .75rem }

.scan__list{ margin:0; padding:0; list-style:none }
.scan__item{ display:grid; grid-template-columns:auto 1fr auto; gap:.75rem; align-items:center; padding:.7rem 1rem; border-bottom:.5px solid var(--line-strong) }
.scan__item:last-child{ border-bottom:0 }
.scan__item-text{ display:grid; min-width:0 }
.scan__item-text strong{ overflow:hidden; text-overflow:ellipsis; white-space:nowrap }
.scan__warn{ color:var(--warning) }

/* ---------------------------------------------------------------------------
   Ficha del producto (hoja alta en el celular, ventana centrada en computadora)
   ------------------------------------------------------------------------ */

.sheet.sheet--product{ max-height:min(94vh, 94dvh); height:min(94vh, 94dvh) }
.sheet--product .sheet__grab{ position:absolute; top:0; left:0; right:0; z-index:3 }
.sheet--product .sheet__grab::before{ background:rgba(255,255,255,.85); box-shadow:0 0 0 .5px rgba(0,0,0,.15) }
.sheet__close{ position:absolute; top:.7rem; right:.7rem; z-index:4; width:38px; height:38px; background:var(--material-strong);
  -webkit-backdrop-filter:blur(12px); backdrop-filter:blur(12px) }
.sheet--product [data-psheet-content]{ display:block; overflow-y:auto; overscroll-behavior:contain; -webkit-overflow-scrolling:touch; flex:1;
  border-radius:inherit; padding-bottom:env(safe-area-inset-bottom) }
@media (min-width:48rem){
  .sheet.sheet--product{
    left:50%; top:50%; right:auto; bottom:auto; width:min(760px, 100% - 3rem); height:auto; max-height:min(88vh, 860px);
    border-radius:var(--r-xl); transform:translate(-50%, -46%) scale(.97); opacity:0;
    transition:transform 360ms var(--ease-out), opacity 200ms ease, visibility 0s linear 360ms;
  }
  .sheet.sheet--product.is-open{ transform:translate(-50%, -50%); opacity:1; transition:transform 360ms var(--ease-out), opacity 200ms ease, visibility 0s }
  .sheet--product .sheet__grab{ display:none }
}

.pd__media{ position:relative; aspect-ratio:1; max-height:52vh; width:100%; background:var(--surface-2); overflow:hidden }
.pd__media img{ width:100%; height:100%; object-fit:cover; display:block }
.pd__media.is-packshot{ background:#fff }
.pd__media.is-packshot img{ object-fit:contain; padding:6% }
.pd__media .product__tile{ font-size:4rem }
.pd__body{ padding:1rem 1.25rem .5rem }
.pd__price{ margin:0; font-size:1.75rem; font-weight:800; letter-spacing:-.03em; font-variant-numeric:tabular-nums }
.pd__price small{ font-size:1rem; font-weight:600; color:var(--ink-3); letter-spacing:0 }
.pd__name{ margin:.15rem 0 .1rem; font-size:1.25rem; font-weight:600; letter-spacing:-.02em; line-height:1.25 }
.pd__unit{ margin:0; color:var(--ink-3); font-size:.9375rem }
.pd__desc{ margin:.6rem 0 0; color:var(--ink-2); font-size:.9375rem }
.pd__form{ margin-top:1.1rem }
.pd__form .field__label{ margin-bottom:.5rem }
.pd__submit{ display:flex; justify-content:space-between; align-items:center; gap:1rem; margin-top:1rem; padding-inline:1.25rem }
.pd__total{ font-variant-numeric:tabular-nums; font-weight:700 }
/* En el teléfono la foto + la rueda empujaban "Agregar" a y≈1000 en una
   pantalla de 844: medido en producción, quedaba fuera. El botón se pega
   abajo mientras el formulario está a la vista, y la foto cede altura. */
@media (max-width:47.99rem){
  .pd__media{ max-height:40vh }
  .pd__submit{ position:sticky; bottom:calc(.75rem + env(safe-area-inset-bottom)); z-index:4;
    box-shadow:0 0 0 .6rem var(--surface), 0 -.6rem 1.2rem .6rem var(--surface) }
}
.pd__hint{ margin:.6rem 0 0; font-size:.8125rem; color:var(--ink-3) }
.pd__presets{ display:flex; gap:.5rem; flex-wrap:wrap; margin-top:.75rem }
.pd__presets .chip{ min-height:34px; padding:0 .9rem; font-size:.875rem; cursor:pointer; border:0 }
.pd__presets .chip.is-on{ background:var(--ink); color:var(--bg); box-shadow:none }
.pd__similar{ padding:1.25rem 1.25rem 1.5rem; border-top:.5px solid var(--line); margin-top:1rem }
.pd__similar h3{ font-size:1.0625rem; margin:0 0 .85rem }
.pd__similar .rail{ margin-inline:-1.25rem; padding-inline:1.25rem; scroll-padding-inline:1.25rem }
.page-product .pd{ background:var(--surface); border-radius:var(--r-xl); overflow:hidden; overflow:clip; box-shadow:var(--shadow-card); max-width:760px; margin:0 auto 2rem }
@media (min-width:48rem){
  .pd{ display:grid; grid-template-columns:minmax(0, 1fr) minmax(0, 1fr); align-items:start }
  .pd__media{ max-height:none; height:100% }
  .pd__similar{ grid-column:1 / -1 }
}

/* Cantidad por pieza: − número + grande. */
.stepper.stepper--lg{ height:48px; background:var(--fill) }
.stepper.stepper--lg button{ width:48px; height:48px }
.stepper.stepper--lg input{ width:3.2rem; min-height:0; height:48px; padding:0; border:0; background:transparent; text-align:center;
  font:700 1.125rem/1 var(--font); font-variant-numeric:tabular-nums; -moz-appearance:textfield }
.stepper.stepper--lg input::-webkit-inner-spin-button,.stepper.stepper--lg input::-webkit-outer-spin-button{ -webkit-appearance:none; margin:0 }
.stepper.stepper--lg input:focus{ box-shadow:none }

/* Rueda de gramos (tipo selector de iOS). app.js la construye sobre el
   <select>: cada valor mide 44 px y la franja del centro es la elegida. */
.pd__select{ font-size:1.0625rem }
.wheel{ position:relative; height:176px; border-radius:var(--r); background:var(--fill); overflow:hidden; touch-action:pan-y }
.wheel__list{ height:100%; margin:0; padding:66px 0; list-style:none; overflow-y:auto; scroll-snap-type:y mandatory;
  scrollbar-width:none; -webkit-overflow-scrolling:touch; overscroll-behavior:contain }
.wheel__list::-webkit-scrollbar{ display:none }
.wheel__list li{ height:44px; display:grid; place-items:center; scroll-snap-align:center; font-size:1.0625rem; color:var(--ink-3);
  font-variant-numeric:tabular-nums; cursor:pointer; transition:color 120ms, transform 120ms }
.wheel__list li.is-sel{ color:var(--ink); font-size:1.375rem; font-weight:700 }
.wheel::before{ content:""; position:absolute; left:.5rem; right:.5rem; top:66px; height:44px; border-radius:10px;
  background:var(--surface); box-shadow:0 1px 3px rgba(0,0,0,.1); pointer-events:none; z-index:0 }
.wheel__list{ position:relative; z-index:1 }
.wheel::after{ content:""; position:absolute; inset:0; pointer-events:none; z-index:2;
  background:linear-gradient(var(--fill-mask, var(--surface)) 0, transparent 34%, transparent 66%, var(--fill-mask, var(--surface)) 100%); opacity:.85 }
.wheel__price{ position:absolute; right:1.1rem; top:66px; height:44px; display:flex; align-items:center; z-index:3; pointer-events:none;
  font-size:.875rem; font-weight:600; color:var(--accent-text); font-variant-numeric:tabular-nums }

/* Claro / oscuro del panel: un solo botón que da la vuelta Auto → Claro → Oscuro. */
.icon-btn--sm{ width:36px; height:36px }
.icon-btn--sm svg{ width:19px; height:19px }
.theme-btn .ico{ display:none }
.theme-btn[data-mode="auto"] .theme-btn__auto,.theme-btn[data-mode="light"] .theme-btn__light,.theme-btn[data-mode="dark"] .theme-btn__dark{ display:block }
.theme-btn:not([data-mode]) .theme-btn__auto{ display:block }

/* Selector de paleta en Ajustes. */
.palettes{ display:grid; grid-template-columns:repeat(auto-fill, minmax(140px, 1fr)); gap:.75rem; margin-bottom:.9rem }
.palette{ position:relative; display:grid; gap:.45rem; cursor:pointer }
.palette input{ position:absolute; opacity:0; pointer-events:none }
.palette__swatch{ display:grid; grid-template-columns:2fr 1fr 1fr; height:64px; border-radius:var(--r); overflow:hidden;
  box-shadow:inset 0 0 0 1px var(--line-strong); background:var(--sw-bg) }
.palette__swatch i:nth-child(1){ background:var(--sw-bg) }
.palette__swatch i:nth-child(2){ background:var(--sw-accent) }
.palette__swatch i:nth-child(3){ background:#fff; box-shadow:inset 1px 0 0 var(--line) }
.palette__name{ font-size:.875rem; font-weight:500; text-align:center }
.palette input:checked + .palette__swatch{ box-shadow:0 0 0 3px var(--accent), inset 0 0 0 1px var(--line-strong) }
.palette input:focus-visible + .palette__swatch{ box-shadow:0 0 0 3px var(--accent-soft), 0 0 0 1px var(--accent) }

/* Buscar fotos por código, en lote. */
.fill{ display:grid; gap:.75rem 1.25rem; margin-bottom:1.25rem; grid-template-columns:1fr }
@media (min-width:44rem){ .fill{ grid-template-columns:1fr auto; align-items:center } .fill__progress{ grid-column:1 / -1 } }
.fill h2{ display:flex; align-items:center; gap:.5rem; font-size:1.0625rem; margin:0 0 .25rem }
.fill h2 .ico{ width:20px; height:20px; color:var(--accent) }
.fill p{ margin:0; color:var(--ink-3); font-size:.875rem }
.fill progress{ width:100%; height:8px; appearance:none; -webkit-appearance:none; border:0; border-radius:4px; overflow:hidden; background:var(--fill) }
.fill progress::-webkit-progress-bar{ background:var(--fill) }
.fill progress::-webkit-progress-value{ background:var(--accent); transition:width 300ms var(--ease-out) }
.fill progress::-moz-progress-bar{ background:var(--accent) }

.report{ display:grid; gap:.75rem; margin-bottom:1.5rem }
.report ul{ margin:.5rem 0 0; padding-left:1.1rem; font-size:.875rem }

.cat-row{ display:grid; grid-template-columns:1fr 90px auto auto; gap:.5rem; align-items:center; padding:.6rem 1rem; border-bottom:.5px solid var(--line-strong) }
.cat-row:last-child{ border-bottom:0 }
.cat-row form{ display:contents }
.cat-row input{ min-height:38px; padding:.4rem .7rem; font-size:1rem }
/* Ancho fijo: "10 prod." y "7 prod." no deben hacer que el campo del nombre
   de una fila sea más corto que el de la de al lado. */
.cat-row__count{ min-width:4.5rem; text-align:right }
@media (max-width:40rem){ .cat-row{ grid-template-columns:1fr 70px; } .cat-row .cat-row__count{ display:none } }

/* ---------------------------------------------------------------------------
   Preferencias del sistema (skill §14)
   ------------------------------------------------------------------------ */

@media (prefers-reduced-motion: reduce){
  *,*::before,*::after{ animation-duration:1ms !important; animation-iteration-count:1 !important; scroll-behavior:auto !important }
  .btn,.icon-btn,.chip,.stepper button{ transition:none }
  .btn:active,.icon-btn:active,.chip:active,.stepper button:active{ transform:none }
  /* La hoja y la barra no se deslizan: aparecen con un fundido corto. */
  .sheet,.cartbar,.toast,.new-order{ transition:opacity 200ms ease, visibility 0s linear 200ms }
  .sheet,.sheet.is-open{ transform:none }
  .sheet{ opacity:0 }
  .sheet.is-open{ opacity:1; transition:opacity 200ms ease, visibility 0s }
  .cartbar,.cartbar.is-visible{ transform:translateX(-50%) }
  .cartbar{ opacity:0; pointer-events:none }
  .cartbar.is-visible{ opacity:1; pointer-events:auto }
  .new-order,.new-order.is-visible{ transform:translateX(-50%) }
  .new-order{ opacity:0 } .new-order.is-visible{ opacity:1 }
}

@media (prefers-reduced-transparency: reduce){
  .topbar,.admin-bar,.cartbar,.toast,.new-order{ background:var(--surface); -webkit-backdrop-filter:none; backdrop-filter:none }
}

@media (prefers-contrast: more){
  :root{ --line:rgba(0,0,0,.3); --line-strong:rgba(0,0,0,.45); --ink-3:var(--ink-2) }
  .product,.panel,.group__card,.list,.table-wrap,.stat{ box-shadow:inset 0 0 0 1px var(--line-strong) }
}

@media print{
  .topbar,.aisles,.cartbar,.sheet,.scrim,.footer,.btn{ display:none !important }
  body{ background:#fff }
}
