/* ==========================================================================
   El Michi — sistema de interfaz
   --------------------------------------------------------------------------
   Idea rectora: "el mostrador". Una herramienta de trabajo, cálida y sólida,
   que se usa parado, con una mano y a veces con las manos ocupadas.

   · Los números mandan: grandes, tabulares, legibles de un vistazo.
   · Una acción principal por pantalla, imposible de errar con el pulgar.
   · Rojo = la marca. Oro = la plata y lo que hay que tocar. Tinta = el resto.
   · Nada se mueve porque sí: cada animación explica de dónde viene algo.

   La paleta está medida sobre el logo de la mascota, no inventada.
   ========================================================================== */

/* ------------------------------------------------------------- tokens ---- */

:root {
  /* marca — medida sobre el logo de la mascota */
  --rojo-100: #FFE4E2;
  --rojo-200: #FFB3AD;
  --rojo-400: #FF5A50;
  --rojo-500: #F80111;   /* el rojo de la gorra */
  --rojo-600: #D70C15;   /* para rellenos: con texto blanco cumple contraste */
  --rojo-700: #A7070F;

  --oro-100: #FFF4CC;
  --oro-200: #FFE68F;
  --oro-400: #FFD633;
  --oro-500: #FDC501;    /* el amarillo de la M y del lettering */
  --oro-600: #E0A800;
  --oro-700: #8F6A00;

  --tinta: #201814;
  --papel: #FFF9F0;

  /* semánticos */
  --ok-500: #1F7A4C;      --ok-100: #DCF2E6;
  --warn-500: #B96908;    --warn-100: #FCEBD2;
  --error-500: #C0281F;   --error-100: #FBE3E1;
  --info-500: #1D6E8E;    --info-100: #DCEEF5;

  /* superficies — modo claro */
  --fondo: #FAF3E8;
  --superficie: #FFFFFF;
  --hundida: #F4EADC;
  --sutil: #FFFBF4;

  --texto: var(--tinta);
  --texto-suave: #6E5F57;
  --texto-tenue: #9A8B82;
  --linea: #E9DCCB;
  --linea-suave: #F3E9DA;

  --sombra-1: 0 1px 2px rgba(32,24,20,.06), 0 1px 1px rgba(32,24,20,.04);
  --sombra-2: 0 2px 6px rgba(32,24,20,.07), 0 6px 16px rgba(32,24,20,.06);
  --sombra-3: 0 8px 20px rgba(32,24,20,.10), 0 18px 44px rgba(32,24,20,.10);
  --sombra-4: 0 20px 44px rgba(32,24,20,.16), 0 40px 90px rgba(32,24,20,.18);
  --sombra-premium: 0 1px 2px rgba(32,24,20,.04), 0 12px 34px rgba(32,24,20,.07);
  --sombra-rojo: 0 6px 16px rgba(215,12,21,.28);
  --sombra-oro: 0 6px 16px rgba(253,197,1,.34);

  /* forma */
  --r-xs: 8px; --r-sm: 12px; --r-md: 16px; --r-lg: 22px; --r-xl: 28px; --r-full: 999px;

  /* ritmo */
  --e1: 4px; --e2: 8px; --e3: 12px; --e4: 16px;
  --e5: 20px; --e6: 24px; --e7: 32px; --e8: 40px; --e9: 56px;

  /* movimiento */
  --sale: cubic-bezier(.32, 0, .67, 0);
  --entra: cubic-bezier(.22, 1, .36, 1);
  --resorte: cubic-bezier(.34, 1.56, .64, 1);
  --v-rapido: 130ms; --v-medio: 220ms; --v-lento: 360ms;

  /* tipografía */
  --fuente: "Plus Jakarta Sans", ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Roboto Mono", Menlo, monospace;

  /* estructura */
  --nav-h: 66px;
  --barra-h: 58px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --ancho-max: 1240px;
}

/* modo oscuro: superficies de café tostado, no gris azulado */
@media (prefers-color-scheme: dark) {
  :root:not([data-tema="claro"]) {
    --fondo: #16100D; --superficie: #211814; --hundida: #100B09; --sutil: #251B16;
    --texto: #FBEFE2; --texto-suave: #BCA99C; --texto-tenue: #8C7A6E;
    --linea: #3A2B23; --linea-suave: #2D211B;
    --rojo-100: #401412; --rojo-200: #5E1D18;
    --oro-100: #3A2B08; --oro-200: #513C0B;
    --ok-100: #102E1F; --warn-100: #38260D; --error-100: #3A1815; --info-100: #102833;
    --sombra-1: 0 1px 2px rgba(0,0,0,.5);
    --sombra-2: 0 2px 8px rgba(0,0,0,.45), 0 8px 20px rgba(0,0,0,.35);
    --sombra-3: 0 10px 26px rgba(0,0,0,.5);
    --sombra-4: 0 24px 60px rgba(0,0,0,.6);
  }
}
:root[data-tema="oscuro"] {
  --fondo: #16100D; --superficie: #211814; --hundida: #100B09; --sutil: #251B16;
  --texto: #FBEFE2; --texto-suave: #BCA99C; --texto-tenue: #8C7A6E;
  --linea: #3A2B23; --linea-suave: #2D211B;
  --rojo-100: #401412; --rojo-200: #5E1D18;
  --oro-100: #3A2B08; --oro-200: #513C0B;
  --ok-100: #102E1F; --warn-100: #38260D; --error-100: #3A1815; --info-100: #102833;
  --sombra-1: 0 1px 2px rgba(0,0,0,.5);
  --sombra-2: 0 2px 8px rgba(0,0,0,.45), 0 8px 20px rgba(0,0,0,.35);
  --sombra-3: 0 10px 26px rgba(0,0,0,.5);
  --sombra-4: 0 24px 60px rgba(0,0,0,.6);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

/* --------------------------------------------------------------- base ---- */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--fuente);
  font-size: 15.5px;
  line-height: 1.5;
  letter-spacing: -.006em;
  color: var(--texto);
  background: var(--fondo);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

h1, h2, h3, h4 { margin: 0; font-weight: 800; line-height: 1.15; letter-spacing: -.025em; }
h1 { font-size: 1.55rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; letter-spacing: -.015em; }
p { margin: 0 0 var(--e3); }
h1, h2 { text-wrap: balance; }
p { text-wrap: pretty; }

a { color: var(--rojo-600); text-decoration: none; font-weight: 600; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* La proporción real del archivo siempre gana sobre los atributos del HTML. */
img { max-width: 100%; height: auto; object-fit: contain; }
svg { display: block; max-width: 100%; }

button, input, select, textarea { font: inherit; color: inherit; }

:focus-visible { outline: 3px solid var(--rojo-400); outline-offset: 2px; border-radius: var(--r-xs); }
::selection { background: var(--oro-200); color: var(--tinta); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb {
  background: var(--linea); border-radius: var(--r-full);
  border: 3px solid transparent; background-clip: content-box;
}
::-webkit-scrollbar-track { background: transparent; }

.oculto { display: none !important; }
[hidden] { display: none !important; }
.solo-lectores {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* --------------------------------------------------------- tipografía ---- */

.display { font-size: clamp(2.1rem, 9vw, 2.9rem); font-weight: 800; letter-spacing: -.04em; line-height: 1; }
.plata {
  font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1;
  font-weight: 800; letter-spacing: -.02em;
}
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }

.t-suave { color: var(--texto-suave); }
.t-tenue { color: var(--texto-tenue); }
.t-ok { color: var(--ok-500); }
.t-error { color: var(--error-500); }
.t-warn { color: var(--warn-500); }
.t-rojo { color: var(--rojo-600); }

.chico { font-size: .875rem; }
.mini-txt { font-size: .78rem; }
.micro { font-size: .69rem; letter-spacing: .06em; text-transform: uppercase; font-weight: 800; }
.fuerte { font-weight: 700; }
.recio { font-weight: 800; }
.centro { text-align: center; }
.derecha { text-align: right; }
.nowrap { white-space: nowrap; }
.una-linea { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ------------------------------------------------------------- iconos ---- */

.i { width: 22px; height: 22px; flex: 0 0 auto; }
.i-sm { width: 18px; height: 18px; flex: 0 0 auto; }
.i-lg { width: 26px; height: 26px; flex: 0 0 auto; }
.i-xl { width: 32px; height: 32px; flex: 0 0 auto; }

/* ------------------------------------------------------------ botones ---- */

.btn {
  --btn-fondo: var(--superficie);
  --btn-texto: var(--texto);
  --btn-borde: transparent;
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--e2);
  padding: 0 18px; min-height: 48px;
  border: 1.5px solid var(--btn-borde);
  border-radius: var(--r-md);
  background: var(--btn-fondo); color: var(--btn-texto);
  font-weight: 700; font-size: .94rem; letter-spacing: -.01em;
  cursor: pointer; white-space: nowrap; user-select: none;
  -webkit-tap-highlight-color: transparent;
  text-decoration: none;
  transition: transform var(--v-rapido) var(--entra), background var(--v-rapido) linear,
              border-color var(--v-rapido) linear, box-shadow var(--v-medio) var(--entra),
              opacity var(--v-rapido) linear;
}
.btn:hover { text-decoration: none; }
.btn:active:not(:disabled) { transform: scale(.965); }
.btn:disabled { opacity: .42; cursor: not-allowed; }

.btn-primario { --btn-fondo: var(--rojo-600); --btn-texto: #fff; box-shadow: var(--sombra-rojo); }
.btn-primario:hover:not(:disabled) { --btn-fondo: var(--rojo-700); }
.btn-oro { --btn-fondo: var(--oro-500); --btn-texto: var(--tinta); box-shadow: var(--sombra-oro); }
.btn-oro:hover:not(:disabled) { --btn-fondo: var(--oro-400); }
.btn-borde { --btn-borde: var(--linea); }
.btn-borde:hover:not(:disabled) { --btn-borde: var(--rojo-400); --btn-texto: var(--rojo-600); }
.btn-suave { --btn-fondo: var(--hundida); }
.btn-suave:hover:not(:disabled) { --btn-fondo: var(--linea-suave); }
.btn-fantasma { --btn-fondo: transparent; }
.btn-fantasma:hover:not(:disabled) { --btn-fondo: var(--hundida); }
.btn-peligro { --btn-fondo: var(--error-100); --btn-texto: var(--error-500); }
.btn-peligro:hover:not(:disabled) { --btn-fondo: var(--error-500); --btn-texto: #fff; }

.btn-bloque { width: 100%; }
.btn-xl { min-height: 60px; font-size: 1.06rem; border-radius: var(--r-lg); padding: 0 24px; }
.btn-sm { min-height: 38px; font-size: .84rem; padding: 0 13px; border-radius: var(--r-sm); gap: 6px; }
.btn-icono { width: 48px; padding: 0; }
.btn-icono.btn-sm { width: 38px; }
.btn-icono.btn-xl { width: 60px; }

.btn[data-cargando] { color: transparent !important; pointer-events: none; }
.btn[data-cargando]::after {
  content: ""; position: absolute; inset: 0; margin: auto;
  width: 20px; height: 20px; border-radius: 50%;
  border: 2.5px solid var(--btn-texto); border-top-color: transparent;
  animation: girar .7s linear infinite;
}
@keyframes girar { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------- campos ---- */

.campo { display: block; margin-bottom: var(--e4); }
.campo > .etiqueta {
  display: block; margin-bottom: 7px;
  font-size: .8rem; font-weight: 700; color: var(--texto-suave);
}
.campo .ayuda { display: block; margin-top: 6px; font-size: .78rem; color: var(--texto-tenue); line-height: 1.4; }
.campo .error-txt { display: block; margin-top: 6px; font-size: .8rem; color: var(--error-500); font-weight: 700; }

.entrada, .selector, textarea.entrada {
  width: 100%; padding: 13px 15px; min-height: 50px;
  border: 1.5px solid var(--linea); border-radius: var(--r-md);
  background: var(--superficie); color: var(--texto);
  transition: border-color var(--v-rapido) linear, box-shadow var(--v-rapido) linear;
}
textarea.entrada { min-height: 92px; resize: vertical; line-height: 1.5; }
.entrada::placeholder { color: var(--texto-tenue); }
.entrada:focus, .selector:focus { outline: none; border-color: var(--rojo-500); box-shadow: 0 0 0 4px var(--rojo-100); }
.entrada[aria-invalid="true"] { border-color: var(--error-500); box-shadow: 0 0 0 4px var(--error-100); }

.entrada-plata {
  font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1;
  font-weight: 800; font-size: 1.18rem; letter-spacing: -.02em;
}
.entrada-xl { min-height: 62px; font-size: 1.35rem; font-weight: 800; letter-spacing: -.03em; }

input[type="search"] { -webkit-appearance: none; appearance: none; }
input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }

.selector {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236E5F57' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 9 7 7 7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center; background-size: 18px;
  padding-right: 40px;
}

.con-prefijo { position: relative; display: block; }
.con-prefijo .prefijo {
  position: absolute; left: 15px; top: 50%; transform: translateY(-50%);
  color: var(--texto-tenue); font-weight: 800; pointer-events: none; z-index: 1;
}
.con-prefijo .entrada { padding-left: 33px; }

.interruptor { display: flex; align-items: center; gap: var(--e3); cursor: pointer; padding: var(--e2) 0; font-weight: 600; }
.interruptor input { position: absolute; opacity: 0; width: 0; height: 0; }
.interruptor .pista {
  width: 48px; height: 28px; border-radius: var(--r-full); flex: 0 0 auto;
  background: var(--linea); position: relative;
  transition: background var(--v-medio) var(--entra);
}
.interruptor .pista::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 22px; height: 22px; border-radius: 50%; background: #fff;
  box-shadow: var(--sombra-1);
  transition: transform var(--v-medio) var(--resorte);
}
.interruptor input:checked + .pista { background: var(--ok-500); }
.interruptor input:checked + .pista::after { transform: translateX(20px); }
.interruptor input:focus-visible + .pista { outline: 3px solid var(--rojo-400); outline-offset: 2px; }

.segmentado {
  position: relative; display: flex; gap: 2px; padding: 4px;
  background: var(--hundida); border-radius: var(--r-md);
  overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.segmentado::-webkit-scrollbar { display: none; }
.segmentado button {
  position: relative; z-index: 1; flex: 1 0 auto;
  padding: 9px 15px; border: 0; border-radius: var(--r-sm);
  background: transparent; color: var(--texto-suave);
  font-weight: 700; font-size: .86rem; white-space: nowrap; cursor: pointer;
  transition: color var(--v-rapido) linear;
}
.segmentado button[aria-selected="true"] { color: var(--texto); }
.segmentado .indicador {
  position: absolute; top: 4px; bottom: 4px; left: 0; width: 0;
  border-radius: var(--r-sm); background: var(--superficie);
  box-shadow: var(--sombra-1); z-index: 0; pointer-events: none;
  transition: transform var(--v-medio) var(--entra), width var(--v-medio) var(--entra);
}

.atajos { display: flex; flex-wrap: wrap; gap: 7px; }
.atajos button {
  padding: 8px 14px; border-radius: var(--r-full);
  border: 1.5px solid var(--linea); background: var(--superficie);
  font-size: .84rem; font-weight: 700; cursor: pointer;
  transition: all var(--v-rapido) linear;
}
.atajos button:hover { border-color: var(--rojo-400); background: var(--rojo-100); color: var(--rojo-700); }
.atajos button:active { transform: scale(.94); }

.teclado { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--e2); }
.teclado button {
  min-height: 54px; border-radius: var(--r-md);
  border: 1.5px solid var(--linea); background: var(--superficie);
  font-weight: 800; font-size: 1rem; cursor: pointer;
  font-variant-numeric: tabular-nums;
  transition: all var(--v-rapido) var(--entra);
}
.teclado button:hover { background: var(--oro-100); border-color: var(--oro-400); }
.teclado button:active { transform: scale(.95); }

/* ----------------------------------------------------------- tarjetas ---- */

.tarjeta {
  background: var(--superficie);
  border: 1px solid var(--linea-suave);
  border-radius: var(--r-lg);
  padding: var(--e5);
  box-shadow: var(--sombra-1);
}
.tarjeta:hover { border-color: var(--linea); }
.tarjeta-sm { padding: var(--e4); border-radius: var(--r-md); }
.tarjeta-plana { box-shadow: none; background: var(--sutil); }
.tarjeta-cabecera { display: flex; align-items: center; justify-content: space-between; gap: var(--e3); margin-bottom: var(--e4); }

.rejilla { display: grid; gap: var(--e3); }
.rejilla-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 720px) {
  .rejilla { gap: var(--e4); }
  .rejilla-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .rejilla-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .rejilla-par { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* --------------------------------------------------------- indicadores --- */

.kpi {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: 3px;
  padding: var(--e4) var(--e4) var(--e4) var(--e5);
  background: var(--superficie); border: 1px solid var(--linea-suave);
  border-radius: var(--r-lg); box-shadow: var(--sombra-1);
}
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--rojo-500); }
.kpi-oro::before { background: var(--oro-500); }
.kpi-ok::before { background: var(--ok-500); }
.kpi-info::before { background: var(--info-500); }
.kpi-warn::before { background: var(--warn-500); }

.kpi .kpi-titulo { font-size: .69rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--texto-tenue); }
.kpi .kpi-valor {
  font-size: 1.6rem; font-weight: 800; letter-spacing: -.035em; line-height: 1.1;
  font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1;
}
.kpi .kpi-pie { font-size: .78rem; color: var(--texto-suave); display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.kpi-grande .kpi-valor { font-size: 2.1rem; }

.delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 800; font-size: .78rem; }
.delta .i-sm { width: 14px; height: 14px; }
.delta-sube { color: var(--ok-500); }
.delta-baja { color: var(--error-500); }
.delta-igual { color: var(--texto-tenue); }

/* ----------------------------------------------------------- píldoras ---- */

.pildora {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: var(--r-full);
  font-size: .72rem; font-weight: 800;
  background: var(--hundida); color: var(--texto-suave); white-space: nowrap;
}
.pildora .i-sm { width: 13px; height: 13px; }
.pildora-ok { background: var(--ok-100); color: var(--ok-500); }
.pildora-warn { background: var(--warn-100); color: var(--warn-500); }
.pildora-error { background: var(--error-100); color: var(--error-500); }
.pildora-info { background: var(--info-100); color: var(--info-500); }
.pildora-oro { background: var(--oro-100); color: var(--oro-700); }
.pildora-rojo { background: var(--rojo-100); color: var(--rojo-700); }

/* --------------------------------------------------------- miniaturas ---- */

/*
  Los productos de una despensa no tienen foto. En vez de dejar un hueco gris,
  cada uno recibe una ficha con el color de su rubro y sus iniciales: se
  reconoce de un vistazo y la lista se ve intencional, no vacía.
*/
.mini {
  position: relative;
  width: 46px; height: 46px; flex: 0 0 auto;
  display: grid; place-items: center;
  border-radius: 14px; overflow: hidden;
  font-weight: 800; font-size: .84rem; letter-spacing: -.03em;
  color: #fff; text-transform: uppercase;
  background: linear-gradient(145deg, var(--mini-a, var(--rojo-400)), var(--mini-b, var(--rojo-600)));
  box-shadow: inset 0 -1px 2px rgba(0,0,0,.14), var(--sombra-1);
}
.mini::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(120% 80% at 25% 15%, rgba(255,255,255,.30), transparent 62%);
}
.mini > * { position: relative; z-index: 1; }
.mini-lg { width: 60px; height: 60px; border-radius: 18px; font-size: 1.05rem; }
.mini-sm { width: 36px; height: 36px; border-radius: 11px; font-size: .72rem; }
.mini-xl { width: 88px; height: 88px; border-radius: 24px; font-size: 1.5rem; }

/* Con foto, la imagen tapa el degradé. El color queda debajo: si la foto
   todavía no llegó, se ve la ficha de siempre en vez de un hueco gris. */
.mini.con-foto img {
  position: absolute; inset: 0; z-index: 2;
  width: 100%; height: 100%;
  object-fit: cover;           /* pisa el `contain` global: acá recortar es lo correcto */
  animation: foto-aparece var(--v-medio) var(--entra);
}
.mini.con-foto::after { z-index: 3; opacity: .35; }

/* Con dibujo: la silueta blanca ocupa poco más de la mitad de la ficha, para
   que respire y se lea igual de bien a 36 que a 130 píxeles. */
.mini .dib {
  position: relative; z-index: 1;
  width: 58%; height: 58%;
  color: #fff;
  opacity: .95;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,.18));
}
.mini-sm .dib { width: 64%; height: 64%; }
@keyframes foto-aparece { from { opacity: 0; } to { opacity: 1; } }

/* ------------------------------------------------------------ caja foto -- */
/*
  El control de foto de la ficha del producto. Cuadrado, porque cuadrado es lo
  que se guarda: lo que Maxi ve acá es exactamente lo que va a ver en la lista.
*/
.fotocaja { display: flex; gap: var(--e4); align-items: flex-start; }
.fotocaja-marco {
  position: relative; flex: 0 0 auto;
  width: 116px; height: 116px;
  display: grid; place-items: center; gap: 4px;
  border-radius: var(--r-lg); overflow: hidden;
  background: var(--hundida);
  border: 1.5px dashed var(--linea);
  color: var(--texto-tenue);
}
.fotocaja-marco[data-tiene] { border-style: solid; border-color: var(--linea-suave); }
.fotocaja-marco img { width: 100%; height: 100%; object-fit: cover; }
.fotocaja-vacia { font-size: .72rem; font-weight: 700; }
.fotocaja-marco[data-subiendo]::after {
  content: ""; position: absolute; inset: 0;
  background: rgba(255,255,255,.55) url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 24 24' fill='none' stroke='%23D70C15' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M12 3a9 9 0 1 0 9 9'/%3E%3C/svg%3E") center / 28px no-repeat;
  animation: girar 900ms linear infinite;
}
.fotocaja-acciones { display: flex; flex-direction: column; gap: var(--e2); flex: 1; min-width: 0; }
.fotocaja-acciones .btn { justify-content: flex-start; }

.foto-visor {
  border-radius: var(--r-lg); overflow: hidden; background: var(--hundida);
}
.foto-visor img { width: 100%; height: auto; display: block; }

/* La miniatura que se puede tocar para ver la foto grande. */
.mini-tocable { cursor: zoom-in; }
.mini-tocable:active { transform: scale(.96); }

.progreso {
  height: 8px; border-radius: var(--r-full); overflow: hidden;
  background: var(--hundida);
}
.progreso-barra {
  height: 100%; border-radius: inherit;
  background: linear-gradient(90deg, var(--oro-500), var(--rojo-500));
  transition: width var(--v-lento) var(--entra);
}

.ficha {
  width: 44px; height: 44px; flex: 0 0 auto;
  display: grid; place-items: center; font-size: 1.25rem;
  background: var(--hundida); border-radius: 14px; color: var(--texto-suave);
}
.ficha-rojo { background: var(--rojo-100); color: var(--rojo-600); }
.ficha-oro { background: var(--oro-100); color: var(--oro-700); }
.ficha-ok { background: var(--ok-100); color: var(--ok-500); }
.ficha-error { background: var(--error-100); color: var(--error-500); }
.ficha-info { background: var(--info-100); color: var(--info-500); }
.ficha-warn { background: var(--warn-100); color: var(--warn-500); }

/* ------------------------------------------------------------- listas ---- */

.lista { display: flex; flex-direction: column; gap: var(--e2); }

.fila {
  display: flex; align-items: center; gap: var(--e3);
  width: 100%; padding: var(--e3) var(--e4);
  background: var(--superficie); border: 1px solid var(--linea-suave);
  border-radius: var(--r-md);
  text-align: left; color: inherit; font: inherit;
  transition: transform var(--v-rapido) var(--entra), border-color var(--v-rapido) linear,
              box-shadow var(--v-rapido) linear;
}
button.fila, a.fila { cursor: pointer; }
button.fila:hover, a.fila:hover { border-color: var(--rojo-200); box-shadow: var(--sombra-1); text-decoration: none; }
button.fila:active, a.fila:active { transform: scale(.99); }
.fila-quieta { cursor: default; }
.fila .titulo { font-weight: 700; letter-spacing: -.012em; }
.fila .sub { font-size: .8rem; color: var(--texto-suave); margin-top: 1px; }
.fila .monto { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; letter-spacing: -.02em; }

.operacion-productos {
  display: flex; flex-wrap: wrap; gap: 6px 10px; margin: 7px 0 5px;
}
.operacion-producto {
  display: grid; grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center; gap: 6px; min-width: min(240px, 100%); max-width: 100%;
  padding: 5px 8px 5px 5px; border: 1px solid var(--linea-suave);
  border-radius: 10px; background: var(--sutil); font-size: .78rem;
}
.operacion-producto .mini { width: 28px; height: 28px; border-radius: 8px; }
.operacion-producto strong { color: var(--texto-suave); white-space: nowrap; }

.entra-lista > * { animation: subir-fila var(--v-medio) var(--entra) backwards; }
.entra-lista > *:nth-child(1) { animation-delay: 0ms; }
.entra-lista > *:nth-child(2) { animation-delay: 26ms; }
.entra-lista > *:nth-child(3) { animation-delay: 52ms; }
.entra-lista > *:nth-child(4) { animation-delay: 78ms; }
.entra-lista > *:nth-child(5) { animation-delay: 104ms; }
.entra-lista > *:nth-child(n+6) { animation-delay: 130ms; }
@keyframes subir-fila { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------- tablas ---- */

.tabla-scroll {
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  border-radius: var(--r-md); border: 1px solid var(--linea-suave);
  background: var(--superficie);
}
table.tabla { width: 100%; border-collapse: collapse; font-size: .87rem; min-width: 460px; }
table.tabla th {
  text-align: left; padding: 11px 14px;
  font-size: .68rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  color: var(--texto-tenue); background: var(--sutil);
  border-bottom: 1px solid var(--linea); white-space: nowrap;
}
table.tabla td { padding: 12px 14px; border-bottom: 1px solid var(--linea-suave); }
table.tabla tbody tr:last-child td { border-bottom: 0; }
table.tabla tbody tr:hover { background: var(--sutil); }
table.tabla .num { text-align: right; white-space: nowrap; }

/* --------------------------------------------------------- estructura ---- */

.app { min-height: 100dvh; display: flex; flex-direction: column; }

.barra {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: var(--e3);
  padding: max(var(--safe-t), 8px) var(--e4) 8px;
  min-height: var(--barra-h);
  background: color-mix(in srgb, var(--fondo) 84%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--v-medio) linear;
}
.barra[data-pegada] { border-bottom-color: var(--linea-suave); }
.barra .marca-chica { width: 34px; height: 34px; border-radius: var(--r-full); flex: 0 0 auto; box-shadow: var(--sombra-1); }
.barra .titulo-seccion { font-weight: 800; font-size: 1.06rem; letter-spacing: -.03em; }
.barra-contexto { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.barra-subtitulo { display: none; margin-top: 3px; color: var(--texto-tenue); font-size: .72rem; font-weight: 600; }

.btn-comando {
  display: grid; place-items: center;
  width: 38px; height: 38px; padding: 0;
  border: 1px solid var(--linea); border-radius: var(--r-sm);
  background: var(--superficie); color: var(--texto-suave);
  box-shadow: var(--sombra-1); cursor: pointer;
}
.btn-comando > span, .btn-comando kbd { display: none; }
.btn-comando:active { transform: scale(.96); }

.cabecera-vista {
  display: flex; align-items: flex-end; justify-content: space-between; gap: var(--e4);
  margin-bottom: var(--e5);
}
.cabecera-vista h1 { font-size: clamp(1.65rem, 4vw, 2.25rem); letter-spacing: -.04em; }
.cabecera-bajada { margin: 7px 0 0; color: var(--texto-suave); font-size: .92rem; }

.comando .entrada-comando {
  min-height: 58px; padding-left: 18px; font-size: 1.05rem;
  background: var(--sutil); box-shadow: inset 0 0 0 1px var(--linea-suave);
}
.comando-resultados { max-height: min(54dvh, 520px); overflow-y: auto; padding: 2px; }
.comando-opcion .ficha { transition: transform var(--v-medio) var(--resorte); }
.comando-opcion:hover .ficha { transform: scale(1.08) rotate(-3deg); }
.comando-vacio { display: flex; flex-direction: column; gap: 3px; padding: var(--e7) var(--e4); text-align: center; color: var(--texto-suave); }
.comando-vacio strong { color: var(--texto); }

.contenido {
  flex: 1; width: 100%; max-width: var(--ancho-max); margin: 0 auto;
  padding: var(--e4) var(--e4) calc(var(--nav-h) + var(--safe-b) + var(--e8));
  animation: entrar-seccion var(--v-medio) var(--entra);
}
.contenido > * + * { margin-top: var(--e4); }
@keyframes entrar-seccion { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: end;
  padding-bottom: var(--safe-b);
  background: color-mix(in srgb, var(--superficie) 88%, transparent);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-top: 1px solid var(--linea-suave);
  box-shadow: 0 -6px 24px rgba(32,24,20,.06);
}
.nav a {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  height: var(--nav-h); padding: 6px 2px;
  color: var(--texto-tenue); font-size: .66rem; font-weight: 800;
  text-decoration: none; -webkit-tap-highlight-color: transparent;
  transition: color var(--v-rapido) linear;
}
.nav a:hover { text-decoration: none; }
.nav a[aria-current="page"] { color: var(--rojo-600); }
.nav a .i { transition: transform var(--v-medio) var(--resorte); }
.nav a[aria-current="page"] .i { transform: translateY(-2px) scale(1.06); }

/* la acción principal: sobresale, es la más grande y cae bajo el pulgar */
.nav .accion {
  align-self: center; display: grid; place-items: center;
  width: 58px; height: 58px; margin: 0 auto;
  transform: translateY(-14px);
  border-radius: var(--r-full);
  background: linear-gradient(150deg, var(--rojo-500), var(--rojo-700));
  color: #fff;
  box-shadow: 0 8px 20px rgba(215,12,21,.40), 0 2px 4px rgba(32,24,20,.2);
  border: 3px solid var(--superficie);
  transition: transform var(--v-medio) var(--resorte), box-shadow var(--v-medio) var(--entra);
}
.nav .accion:active { transform: translateY(-14px) scale(.92); }
.nav .accion .i { width: 26px; height: 26px; }
.nav .accion[aria-current="page"] .i { transform: none; }

.nav .globo {
  position: absolute; top: 5px; left: 50%; margin-left: 5px;
  min-width: 18px; height: 18px; padding: 0 5px;
  display: grid; place-items: center;
  background: var(--rojo-500); color: #fff; border-radius: var(--r-full);
  font-size: .62rem; font-weight: 800; border: 2px solid var(--superficie);
  animation: latir 2.4s var(--entra) infinite;
}
@keyframes latir { 0%, 88%, 100% { transform: scale(1); } 92% { transform: scale(1.18); } }

.lateral { display: none; }

@media (min-width: 1040px) {
  .app { flex-direction: row; }
  .nav { display: none; }
  .lateral {
    display: flex; flex-direction: column; gap: 2px;
    width: 244px; flex: 0 0 244px;
    height: 100dvh; position: sticky; top: 0;
    padding: var(--e5) var(--e3) var(--e4);
    background: var(--superficie); border-right: 1px solid var(--linea-suave);
    overflow-y: auto;
  }
  .lateral .marca { display: flex; align-items: center; gap: var(--e3); padding: 0 var(--e3) var(--e6); }
  .lateral .marca img { width: 42px; height: 42px; border-radius: var(--r-full); box-shadow: var(--sombra-1); }
  .lateral .marca b { font-size: 1.05rem; letter-spacing: -.03em; display: block; }
  .lateral .marca small { color: var(--texto-tenue); font-size: .68rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
  .lateral a {
    display: flex; align-items: center; gap: var(--e3);
    padding: 11px var(--e3); border-radius: var(--r-md);
    color: var(--texto-suave); font-weight: 700; font-size: .92rem; text-decoration: none;
    transition: background var(--v-rapido) linear, color var(--v-rapido) linear;
  }
  .lateral a:hover { background: var(--hundida); color: var(--texto); text-decoration: none; }
  .lateral a[aria-current="page"] { background: var(--rojo-100); color: var(--rojo-700); }
  .lateral a[aria-current="page"] .i { color: var(--rojo-500); }
  .lateral .globo {
    margin-left: auto; min-width: 21px; height: 21px; padding: 0 6px;
    display: grid; place-items: center;
    background: var(--rojo-500); color: #fff; border-radius: var(--r-full);
    font-size: .68rem; font-weight: 800;
  }
  .lateral .grupo {
    margin-top: var(--e4); padding: 0 var(--e3) 6px;
    font-size: .64rem; font-weight: 800; letter-spacing: .1em;
    text-transform: uppercase; color: var(--texto-tenue);
  }
  .lateral .pie { margin-top: auto; padding-top: var(--e4); }
  .columna { flex: 1; min-width: 0; display: flex; flex-direction: column; }
  .contenido { padding: var(--e6) var(--e7) var(--e9); }
  .barra { padding: var(--e4) var(--e7); }
  .barra .marca-chica { display: none; }
  .barra-subtitulo { display: block; }
  .btn-comando {
    display: flex; align-items: center; justify-content: flex-start; gap: var(--e2);
    width: 218px; padding: 0 9px 0 12px;
  }
  .btn-comando > span { display: block; flex: 1; text-align: left; font-size: .8rem; font-weight: 700; }
  .btn-comando kbd {
    display: block; padding: 3px 7px; border: 1px solid var(--linea);
    border-radius: 7px; background: var(--hundida); color: var(--texto-tenue);
    font: 700 .68rem var(--fuente);
  }
}

/* -------------------------------------------------------- hojas modales -- */

.velo {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: flex-end; justify-content: center;
  background: rgba(20, 12, 9, .48);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  animation: velo-entra var(--v-medio) ease;
}
@keyframes velo-entra { from { opacity: 0; } to { opacity: 1; } }
.velo[data-cerrando] { animation: velo-sale var(--v-rapido) ease forwards; }
@keyframes velo-sale { to { opacity: 0; } }
@media (min-width: 700px) { .velo { align-items: center; padding: var(--e5); } }

.hoja {
  position: relative; width: 100%; max-width: 560px;
  max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--superficie);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: var(--e3) var(--e5) calc(var(--e5) + var(--safe-b));
  box-shadow: var(--sombra-4);
  animation: hoja-sube var(--v-lento) var(--entra);
}
@media (min-width: 700px) {
  .hoja { border-radius: var(--r-xl); padding-top: var(--e5); animation: hoja-escala var(--v-medio) var(--entra); }
}
@keyframes hoja-sube { from { transform: translateY(100%); } to { transform: none; } }
@keyframes hoja-escala { from { transform: scale(.94); opacity: 0; } to { transform: none; opacity: 1; } }
.velo[data-cerrando] .hoja { animation: hoja-baja var(--v-rapido) var(--sale) forwards; }
@keyframes hoja-baja { to { transform: translateY(30px); opacity: 0; } }

.hoja-ancha { max-width: 860px; }
.hoja .tirador { width: 42px; height: 4px; border-radius: var(--r-full); background: var(--linea); margin: 0 auto var(--e4); }
@media (min-width: 700px) { .hoja .tirador { display: none; } }

.hoja-cabecera { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--e3); margin-bottom: var(--e4); }
.hoja-acciones { display: flex; gap: var(--e2); margin-top: var(--e5); }
.hoja-acciones .btn { flex: 1; }

/* -------------------------------------------------------------- avisos --- */

.avisos {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--nav-h) + var(--safe-b) + 14px);
  z-index: 200; width: min(94vw, 470px);
  display: flex; flex-direction: column; gap: var(--e2); pointer-events: none;
}
@media (min-width: 1040px) { .avisos { bottom: 22px; } }

.aviso {
  display: flex; align-items: center; gap: var(--e3);
  padding: 13px var(--e4); border-radius: var(--r-md);
  background: var(--tinta); color: var(--papel);
  box-shadow: var(--sombra-3);
  font-weight: 700; font-size: .9rem; pointer-events: auto;
  animation: aviso-entra var(--v-lento) var(--resorte);
}
@keyframes aviso-entra { from { opacity: 0; transform: translateY(18px) scale(.94); } to { opacity: 1; transform: none; } }
.aviso-ok { background: var(--ok-500); color: #fff; }
.aviso-error { background: var(--error-500); color: #fff; }
.aviso-warn { background: var(--oro-500); color: var(--tinta); }
.aviso[data-saliendo] { animation: aviso-sale var(--v-rapido) var(--sale) forwards; }
@keyframes aviso-sale { to { opacity: 0; transform: translateY(12px) scale(.96); } }

/* ------------------------------------------------------------- estados --- */

.vacio { text-align: center; padding: var(--e9) var(--e4); }
.vacio .simbolo {
  width: 92px; height: 92px; margin: 0 auto var(--e4);
  display: grid; place-items: center;
  background: var(--hundida); border-radius: var(--r-full); color: var(--texto-tenue);
}
.vacio .simbolo .i { width: 40px; height: 40px; }
.vacio h3 { margin-bottom: var(--e2); }
.vacio p { color: var(--texto-suave); max-width: 34ch; margin-inline: auto; }

.cargando { display: grid; place-items: center; padding: var(--e9); }
.giro { width: 32px; height: 32px; border-radius: 50%; border: 3px solid var(--linea); border-top-color: var(--rojo-500); animation: girar .75s linear infinite; }

.esqueleto {
  border-radius: var(--r-xs);
  background: linear-gradient(100deg, var(--hundida) 30%, var(--sutil) 50%, var(--hundida) 70%);
  background-size: 220% 100%;
  animation: brillo 1.5s ease-in-out infinite;
}
@keyframes brillo { from { background-position: 180% 0; } to { background-position: -20% 0; } }
.esq-linea { height: 13px; margin-bottom: 8px; }
.esq-fila { height: 70px; border-radius: var(--r-md); margin-bottom: var(--e2); }
.esq-kpi { height: 100px; border-radius: var(--r-lg); }

/* ------------------------------------------------------------- señales --- */

.senal {
  display: flex; gap: var(--e3); align-items: flex-start;
  padding: var(--e4);
  background: var(--superficie);
  border: 1px solid var(--linea-suave); border-left: 4px solid var(--texto-tenue);
  border-radius: var(--r-md);
}
.senal .icono { color: var(--texto-tenue); margin-top: 1px; }
.senal .titulo { font-weight: 800; letter-spacing: -.015em; }
.senal .detalle { font-size: .85rem; color: var(--texto-suave); margin-top: 2px; line-height: 1.45; }
.senal-bien { border-left-color: var(--ok-500); }
.senal-bien .icono { color: var(--ok-500); }
.senal-atencion { border-left-color: var(--oro-500); }
.senal-atencion .icono { color: var(--warn-500); }
.senal-mal { border-left-color: var(--error-500); }
.senal-mal .icono { color: var(--error-500); }
.senal-info { border-left-color: var(--info-500); }
.senal-info .icono { color: var(--info-500); }

/* ------------------------------------------------------ flujo pedidos --- */

.flujo-pedido { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.flujo-pedido > div { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.flujo-pedido > div::before {
  content: ""; position: absolute; top: 17px; left: calc(-50% + 18px); right: calc(50% + 18px);
  height: 2px; background: var(--linea); z-index: 0;
}
.flujo-pedido > div:first-child::before { display: none; }
.flujo-pedido > div.hecho::before, .flujo-pedido > div.actual::before { background: var(--ok-500); }
.flujo-pedido span {
  position: relative; z-index: 1; width: 36px; height: 36px; display: grid; place-items: center;
  border-radius: 50%; border: 2px solid var(--linea); background: var(--superficie); color: var(--texto-tenue);
}
.flujo-pedido .hecho span { background: var(--ok-500); border-color: var(--ok-500); color: #fff; }
.flujo-pedido .actual span { background: var(--oro-500); border-color: var(--oro-500); color: var(--tinta); box-shadow: 0 0 0 5px var(--oro-100); }
.flujo-pedido small { color: var(--texto-tenue); font-size: .66rem; font-weight: 800; }
.flujo-pedido .actual small { color: var(--texto); }
.pedido-cancelado { display: flex; align-items: center; justify-content: center; gap: var(--e2); padding: var(--e3); border-radius: var(--r-md); background: var(--error-100); color: var(--error-500); font-weight: 800; }

/* ------------------------------------------------------------ gráficos --- */

.grafico { width: 100%; overflow: visible; }
.grafico text { fill: var(--texto-tenue); font-family: var(--fuente); font-size: 10.5px; font-weight: 700; }
.grafico .rejilla-l { stroke: var(--linea-suave); stroke-width: 1; }
.grafico .eje { stroke: var(--linea); stroke-width: 1; }
.grafico .barra { fill: url(#deg-rojo); transition: opacity var(--v-rapido) linear; }
.grafico .barra:hover { opacity: .82; }
.grafico .barra-oro { fill: url(#deg-oro); }
.grafico .linea { fill: none; stroke: var(--rojo-500); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.grafico .linea-2 { fill: none; stroke: var(--ok-500); stroke-width: 2; stroke-dasharray: 5 5; stroke-linecap: round; }
.grafico .area { fill: url(#deg-area); }
.grafico .punto { fill: var(--rojo-500); stroke: var(--superficie); stroke-width: 2; }
.grafico .valor { fill: var(--texto); font-weight: 800; font-size: 10px; }

.barra-progreso { height: 7px; background: var(--hundida); border-radius: var(--r-full); overflow: hidden; }
.barra-progreso > i {
  display: block; height: 100%; border-radius: var(--r-full);
  background: linear-gradient(90deg, var(--rojo-500), var(--oro-500));
  transition: width var(--v-lento) var(--entra);
}

/* ------------------------------------------------------------- ticket ---- */

.ticket {
  display: flex; flex-direction: column;
  background: var(--superficie); border: 1px solid var(--linea-suave);
  border-radius: var(--r-lg); box-shadow: var(--sombra-2); overflow: hidden;
}
.ticket-tapa {
  display: flex; align-items: center; gap: var(--e2);
  padding: var(--e3) var(--e4);
  background: var(--tinta); color: var(--papel);
}
.ticket-tapa .cuenta { font-size: .76rem; opacity: .75; font-weight: 700; }
.ticket-tapa .btn { --btn-fondo: transparent; --btn-texto: var(--papel); min-height: 34px; }
.ticket-tapa .btn:hover { --btn-fondo: rgba(255,255,255,.14); }

.ticket-lineas { max-height: 44dvh; overflow-y: auto; overscroll-behavior: contain; padding: var(--e2); display: flex; flex-direction: column; gap: 6px; }

.renglon {
  display: grid;
  /* Los controles van en su propia fila, a lo ancho. Cuando compartían fila con
     el importe, los botones se le montaban encima y tapaban el precio. */
  grid-template-columns: 42px minmax(0,1fr) auto;
  grid-template-areas:
    "mini nombre monto"
    "mini pasos pasos";
  gap: 4px var(--e3); align-items: center;
  padding: var(--e2) var(--e3); border-radius: var(--r-md);
  background: var(--sutil);
  animation: renglon-entra var(--v-lento) var(--resorte);
}
@keyframes renglon-entra { from { opacity: 0; transform: translateX(-14px) scale(.97); } to { opacity: 1; transform: none; } }
.renglon .mini { grid-area: mini; width: 42px; height: 42px; border-radius: 12px; }
.renglon .nombre { grid-area: nombre; font-weight: 700; font-size: .9rem; letter-spacing: -.012em; }
.renglon .monto {
  grid-area: monto; align-self: start;
  font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em;
  white-space: nowrap;
}
.renglon .pasos { grid-area: pasos; display: flex; align-items: center; gap: 5px; min-width: 0; }
/* El «1 un × $1.850» cede primero: si no entra, se corta con puntos suspensivos
   en vez de empujar a los botones fuera del renglón. */
.renglon .pasos .detalle {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.renglon .pasos button {
  width: 30px; height: 30px; flex: 0 0 auto;
  display: grid; place-items: center;
  border-radius: 9px; border: 1.5px solid var(--linea);
  background: var(--superficie); cursor: pointer; color: var(--texto);
  transition: all var(--v-rapido) var(--entra);
}
.renglon .pasos button:hover { border-color: var(--rojo-400); color: var(--rojo-600); }
.renglon .pasos button:active { transform: scale(.9); }
.renglon .pasos .i-sm { width: 15px; height: 15px; }
.renglon .pasos .cant {
  width: 56px; text-align: center; padding: 4px 2px; border: 0; background: transparent;
  font-weight: 800; font-size: .88rem; font-variant-numeric: tabular-nums;
}
.renglon .pasos .cant:focus { outline: none; background: var(--superficie); border-radius: 8px; }
.renglon .quitar { border-color: transparent !important; color: var(--texto-tenue) !important; }
.renglon .quitar:hover { background: var(--error-100) !important; color: var(--error-500) !important; }

.ticket-vacio { padding: var(--e8) var(--e4); text-align: center; }
.ticket-vacio .simbolo {
  width: 72px; height: 72px; margin: 0 auto var(--e3);
  display: grid; place-items: center; border-radius: var(--r-full);
  background: var(--hundida); color: var(--texto-tenue);
}
.ticket-vacio .simbolo .i { width: 32px; height: 32px; }

.ticket-pie {
  padding: var(--e4); background: var(--sutil);
  border-top: 2px dashed var(--linea);
  display: flex; flex-direction: column; gap: var(--e3);
}
.ticket-pie .renglon-total { display: flex; justify-content: space-between; align-items: baseline; }
.ticket-pie .renglon-total.grande .valor {
  font-size: 2rem; font-weight: 800; letter-spacing: -.04em; font-variant-numeric: tabular-nums;
}
.ticket-pie .pista { font-size: .82rem; color: var(--texto-suave); text-align: center; margin: 0; }

/* borde inferior dentado, como un ticket de verdad */
.ticket::after {
  content: ""; display: block; height: 9px; flex: 0 0 auto;
  background: radial-gradient(circle at 6px -1px, transparent 6.5px, var(--sutil) 7px) 0 0 / 14px 9px repeat-x;
}

/* ------------------------------------------------------------ mostrador -- */

.mostrador { display: grid; gap: var(--e4); }
.mostrador-vista { min-width: 0; }
@media (min-width: 1040px) {
  .mostrador { grid-template-columns: minmax(0, 1fr) 396px; align-items: start; }
  .mostrador .columna-ticket { position: sticky; top: calc(var(--barra-h) + var(--e5)); }
}

.buscador { position: relative; }
.buscador .entrada {
  padding-left: 46px; padding-right: 54px;
  min-height: 56px; font-size: 1.02rem; font-weight: 600;
  border-radius: var(--r-lg); box-shadow: var(--sombra-1);
}
.buscador .lupa { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--texto-tenue); pointer-events: none; }
.buscador .escanear {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; display: grid; place-items: center;
  border: 0; border-radius: var(--r-md);
  background: var(--oro-500); color: var(--tinta); cursor: pointer;
  transition: transform var(--v-rapido) var(--entra), background var(--v-rapido) linear;
}
.buscador .escanear:hover { background: var(--oro-400); }
.buscador .escanear:active { transform: translateY(-50%) scale(.9); }

.resultados { display: flex; flex-direction: column; gap: var(--e2); max-height: 52dvh; overflow-y: auto; }
.resultados:empty { display: none; }

.sugerido {
  display: flex; align-items: center; gap: var(--e3);
  width: 100%; padding: var(--e3);
  border: 1px solid var(--linea-suave); border-radius: var(--r-md);
  background: var(--superficie); cursor: pointer; text-align: left; color: inherit; font: inherit;
  transition: all var(--v-rapido) var(--entra);
}
.sugerido:hover { border-color: var(--rojo-400); box-shadow: var(--sombra-1); }
.sugerido:active { transform: scale(.985); }
.sugerido[data-sin-stock] { opacity: .62; }

.accesos { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: var(--e2); }
.acceso {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  padding: var(--e4) var(--e2);
  border: 1px solid var(--linea-suave); border-radius: var(--r-md);
  background: var(--superficie); cursor: pointer; color: var(--texto-suave);
  font-size: .78rem; font-weight: 700; text-decoration: none;
  transition: all var(--v-rapido) var(--entra);
}
.acceso:hover { border-color: var(--rojo-200); color: var(--texto); transform: translateY(-2px); box-shadow: var(--sombra-1); text-decoration: none; }
.acceso:active { transform: scale(.96); }
.acceso .i { color: var(--rojo-500); }

.ticket-flotante {
  position: fixed; left: var(--e3); right: var(--e3);
  bottom: calc(var(--nav-h) + var(--safe-b) + var(--e3)); z-index: 48;
  display: flex; align-items: center; gap: var(--e2);
  padding: 8px; border: 1px solid color-mix(in srgb, var(--linea) 70%, transparent);
  border-radius: var(--r-lg);
  background: color-mix(in srgb, var(--superficie) 92%, transparent);
  backdrop-filter: blur(18px) saturate(170%); -webkit-backdrop-filter: blur(18px) saturate(170%);
  box-shadow: var(--sombra-3); animation: hoja-sube var(--v-lento) var(--entra);
}
.ticket-flotante[hidden] { display: none; }
.ticket-flotante-resumen {
  min-width: 0; flex: 1; display: flex; align-items: center; gap: 9px;
  padding: 0; border: 0; background: transparent; color: inherit; text-align: left; cursor: pointer;
}
.ticket-flotante-resumen > span:not(.ficha) { min-width: 0; display: flex; flex-direction: column; }
.ticket-flotante-resumen span span { color: var(--texto-suave); font-size: .72rem; font-weight: 700; }
.ticket-flotante-resumen strong { line-height: 1.15; }
.mostrador-vista:has(.ticket-flotante:not([hidden])) { padding-bottom: 88px; }
@media (min-width: 1040px) { .ticket-flotante { display: none !important; } }

/* ------------------------------------------------------------ escáner ---- */

.escaner { position: fixed; inset: 0; z-index: 150; background: #000; display: flex; flex-direction: column; }
.escaner video { flex: 1; width: 100%; height: 100%; object-fit: cover; }
.escaner .mira {
  position: absolute; top: 44%; left: 50%; transform: translate(-50%, -50%);
  width: min(80vw, 330px); height: 200px; border-radius: var(--r-lg);
  box-shadow: 0 0 0 100vmax rgba(0,0,0,.62);
}
.escaner .mira::before, .escaner .mira::after {
  content: ""; position: absolute; width: 34px; height: 34px; border: 3px solid var(--oro-500);
}
.escaner .mira::before { top: -2px; left: -2px; border-right: 0; border-bottom: 0; border-radius: var(--r-md) 0 0 0; }
.escaner .mira::after { bottom: -2px; right: -2px; border-left: 0; border-top: 0; border-radius: 0 0 var(--r-md) 0; }
.escaner .rayo {
  position: absolute; left: 50%; top: 44%;
  width: min(76vw, 310px); height: 2px;
  background: var(--rojo-500); box-shadow: 0 0 14px 2px var(--rojo-500);
  animation: barrer 1.9s ease-in-out infinite;
}
@keyframes barrer {
  0%, 100% { transform: translate(-50%, -88px); }
  50% { transform: translate(-50%, 88px); }
}
.escaner .pie {
  padding: var(--e5) var(--e4) calc(var(--e5) + var(--safe-b));
  background: #000; color: #fff; text-align: center;
  display: flex; flex-direction: column; gap: var(--e3);
}

/* --------------------------------------------------------- carga rápida -- */

.progreso-carga {
  display: flex; align-items: center; gap: var(--e4);
  padding: var(--e4) var(--e5); border-radius: var(--r-lg);
  background: linear-gradient(130deg, var(--oro-500), var(--oro-400) 60%, var(--oro-200));
  color: var(--tinta); box-shadow: var(--sombra-2);
}
.progreso-carga .cifra { font-size: 2.2rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -.04em; }
.progreso-carga .racha { font-size: .84rem; font-weight: 700; opacity: .78; }

/* --------------------------------------------------------------- utils --- */

.hilera { display: flex; align-items: center; gap: var(--e3); }
.hilera-sep { justify-content: space-between; }
.hilera-envuelve { flex-wrap: wrap; }
.crece { flex: 1; min-width: 0; }
.pila { display: flex; flex-direction: column; gap: var(--e3); }
.mt-0 { margin-top: 0 !important; }
.mt-2 { margin-top: var(--e2) !important; }
.mt-3 { margin-top: var(--e3) !important; }
.mt-4 { margin-top: var(--e4) !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-2 { margin-bottom: var(--e2) !important; }
.mb-3 { margin-bottom: var(--e3) !important; }
.mb-4 { margin-bottom: var(--e4) !important; }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }

details > summary {
  cursor: pointer; font-weight: 700; padding: var(--e3) 0;
  list-style: none; display: flex; align-items: center; gap: var(--e2);
  color: var(--texto-suave);
}
details > summary::-webkit-details-marker { display: none; }
details > summary::after {
  content: ""; width: 8px; height: 8px; margin-left: auto;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(45deg); transition: transform var(--v-medio) var(--entra);
}
details[open] > summary::after { transform: rotate(-135deg); }

/* ------------------------------------------------------------ imprimir --- */

@media print {
  .barra, .nav, .lateral, .avisos, .btn, .velo { display: none !important; }
  body { background: #fff; color: #000; }
  .contenido { padding: 0; max-width: none; }
  .tarjeta, .ticket { box-shadow: none; border: 1px solid #ddd; }
}

/* ==========================================================================
   Anuncios — lo que la vitrina tiene para decir
   Los estilos se pintan con la paleta del negocio, no con imágenes: si Maxi
   cambia el color de la marca en Apariencia, las placas cambian con él. Y no
   hay nada que se pixele ni que haya que rediseñar para el celular.
   ========================================================================== */

.anuncio {
  max-width: 980px;
  margin: var(--e5) auto 0;
  padding: 0 var(--e4);
  animation: subir-fila var(--v-lento) var(--entra) backwards;
}

.anuncio-caja {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: var(--r-xl);
  box-shadow: var(--sombra-2);
  color: var(--anuncio-tinta, #fff);
  background: var(--anuncio-fondo, var(--rojo-600));
  text-decoration: none;
}
a.anuncio-caja { transition: transform var(--v-medio) var(--entra), box-shadow var(--v-medio) var(--entra); }
a.anuncio-caja:hover { transform: translateY(-2px); box-shadow: var(--sombra-3); }

/* Las motas del fondo. Son manchas suaves, no un dibujo: acompañan al texto
   en vez de pelearse con él. */
.anuncio-caja::before {
  content: "";
  position: absolute; inset: 0;
  background:
    radial-gradient(38% 60% at 12% 18%, var(--anuncio-mota) 0 40%, transparent 62%),
    radial-gradient(30% 55% at 88% 26%, var(--anuncio-mota) 0 38%, transparent 60%),
    radial-gradient(26% 46% at 24% 88%, var(--anuncio-mota) 0 42%, transparent 64%),
    radial-gradient(22% 40% at 74% 84%, var(--anuncio-mota) 0 40%, transparent 62%);
  pointer-events: none;
}
/* la misma tela que el encabezado, para que sea la misma casa */
.anuncio-caja::after {
  content: "";
  position: absolute; inset: 0;
  background: url("/assets/ui/textura.png?v=8") center / 128px repeat;
  opacity: .5; mix-blend-mode: overlay; pointer-events: none;
}

.anuncio-texto {
  position: relative; z-index: 1;
  padding: var(--e8) var(--e5);
  text-align: center;
}
.anuncio-titulo {
  margin: 0;
  font-size: clamp(1.6rem, 6.4vw, 3rem);
  font-weight: 800;
  line-height: 1.04;
  letter-spacing: -.04em;
  text-transform: uppercase;
  text-wrap: balance;
}
/* El resaltador: el título va sobre una banda de color, como en las placas
   hechas a mano. Se corta solo en varias líneas. */
.anuncio-titulo mark {
  background: var(--anuncio-marca);
  color: var(--anuncio-marca-tinta);
  padding: .08em .38em .14em;
  border-radius: var(--r-full);
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
.anuncio-bajada {
  position: relative;
  margin: var(--e4) auto 0;
  max-width: 46ch;
  font-size: clamp(.94rem, 2.6vw, 1.1rem);
  font-weight: 700;
  opacity: .94;
  text-wrap: pretty;
}

/* La placa subida: se respeta la imagen y punto, sin motas ni tela encima. */
.anuncio-foto img { display: block; width: 100%; height: auto; }
.anuncio-caja:has(.anuncio-foto) { background: none; box-shadow: var(--sombra-2); }
.anuncio-caja:has(.anuncio-foto)::before,
.anuncio-caja:has(.anuncio-foto)::after { display: none; }

/* --- estilos --------------------------------------------------------- */

.anuncio[data-estilo="ofertas"] {
  --anuncio-fondo: linear-gradient(150deg, var(--rojo-500), var(--rojo-700));
  --anuncio-mota: rgba(255,255,255,.12);
  --anuncio-marca: var(--oro-500);
  --anuncio-marca-tinta: #2A1C00;
}
.anuncio[data-estilo="novedad"] {
  --anuncio-fondo: linear-gradient(150deg, var(--oro-400), var(--oro-600));
  --anuncio-tinta: #2A1C00;
  --anuncio-mota: rgba(255,255,255,.34);
  --anuncio-marca: var(--rojo-600);
  --anuncio-marca-tinta: #fff;
}
.anuncio[data-estilo="frescos"] {
  --anuncio-fondo: linear-gradient(150deg, #4E9E4A, #2C6B3B);
  --anuncio-mota: rgba(255,255,255,.16);
  --anuncio-marca: #F5E14B;
  --anuncio-marca-tinta: #1E4A28;
}
.anuncio[data-estilo="noche"] {
  --anuncio-fondo: linear-gradient(150deg, #2C2320, #14100E);
  --anuncio-mota: rgba(255,255,255,.08);
  --anuncio-marca: var(--oro-500);
  --anuncio-marca-tinta: #241A00;
}
.anuncio[data-estilo="limpio"] {
  --anuncio-fondo: var(--superficie);
  --anuncio-tinta: var(--texto);
  --anuncio-mota: rgba(0,0,0,.03);
  --anuncio-marca: var(--rojo-100);
  --anuncio-marca-tinta: var(--rojo-700);
}
.anuncio[data-estilo="limpio"] .anuncio-caja { border: 1px solid var(--linea); }
.anuncio[data-estilo="limpio"] .anuncio-caja::after { opacity: .28; mix-blend-mode: normal; }

/* --- productos colgados ---------------------------------------------- */

.anuncio-productos {
  display: grid; gap: var(--e2);
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  margin-top: calc(var(--e4) * -1);
  padding: 0 var(--e3);
}
.anuncio-item {
  position: relative; z-index: 2;
  display: flex; align-items: center; gap: var(--e3);
  padding: var(--e3);
  background: var(--superficie);
  border: 1px solid var(--linea-suave);
  border-radius: var(--r-lg);
  box-shadow: var(--sombra-2);
}
.anuncio-item[data-agotado] { opacity: .6; }
.anuncio-item .mini { width: 52px; height: 52px; border-radius: 14px; }
.anuncio-item .nombre { font-weight: 800; line-height: 1.2; font-size: .92rem; }
.anuncio-item .precio {
  font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums;
}
.anuncio-item .precio small { font-size: .68rem; color: var(--texto-tenue); }
.anuncio-item .btn { flex: 0 0 auto; }
.anuncio-item .cat-pasos { flex: 0 0 auto; width: 110px; }

/* --- avisos cortos ---------------------------------------------------- */

.avisos-tira { position: relative; z-index: 5; }
.aviso-tira {
  display: flex; align-items: center; justify-content: center; gap: var(--e2);
  padding: 9px var(--e4);
  font-size: .84rem; font-weight: 700; line-height: 1.3;
  text-align: center;
  background: var(--aviso-fondo, var(--tinta));
  color: var(--aviso-tinta, var(--papel));
}
.aviso-tira .i { flex: 0 0 auto; opacity: .8; }
.aviso-tira[data-estilo="ofertas"] { --aviso-fondo: var(--rojo-600); --aviso-tinta: #fff; }
.aviso-tira[data-estilo="novedad"] { --aviso-fondo: var(--oro-500); --aviso-tinta: #2A1C00; }
.aviso-tira[data-estilo="frescos"] { --aviso-fondo: #2C6B3B; --aviso-tinta: #fff; }
.aviso-tira[data-estilo="noche"]   { --aviso-fondo: #1B1512; --aviso-tinta: #FBEFE2; }
.aviso-tira[data-estilo="limpio"]  { --aviso-fondo: var(--hundida); --aviso-tinta: var(--texto); }

@media (min-width: 640px) {
  .anuncio-texto { padding: var(--e9) var(--e7); }
}

/* La vista previa del panel: la placa se ve chica, con su propio marco. */
.anuncio-vista {
  border-radius: var(--r-lg);
  background: var(--hundida);
  padding: var(--e3) 0;
  overflow: hidden;
}
.anuncio-vista .anuncio { margin-top: 0; padding: 0 var(--e3); }
.anuncio-vista .anuncio-texto { padding: var(--e6) var(--e4); }
.anuncio-vista .aviso-tira { border-radius: var(--r-sm); margin: 0 var(--e3); }

/* La muestra de cada estilo en el selector. */
.muestra-estilo {
  height: 34px; border-radius: var(--r-sm);
  background: var(--anuncio-fondo, var(--rojo-600));
  box-shadow: inset 0 -1px 3px rgba(0,0,0,.14);
}
.muestra-estilo[data-estilo="ofertas"] { --anuncio-fondo: linear-gradient(150deg, var(--rojo-500), var(--rojo-700)); }
.muestra-estilo[data-estilo="novedad"] { --anuncio-fondo: linear-gradient(150deg, var(--oro-400), var(--oro-600)); }
.muestra-estilo[data-estilo="frescos"] { --anuncio-fondo: linear-gradient(150deg, #4E9E4A, #2C6B3B); }
.muestra-estilo[data-estilo="noche"]   { --anuncio-fondo: linear-gradient(150deg, #2C2320, #14100E); }
.muestra-estilo[data-estilo="limpio"]  { --anuncio-fondo: var(--superficie); box-shadow: inset 0 0 0 1px var(--linea); }
