/* Pantallas del local (la tienda). Se carga DESPUÉS de estilos.css y admin.css y reutiliza sus bloques. */

body.local {
  align-items: flex-start;
  /* espacio para que el menú de abajo no tape el final de la página */
  padding-bottom: calc(96px + env(safe-area-inset-bottom));
}

/* Las tarjetas nunca deben ser más anchas que la pantalla, aunque su contenido sea largo */
body.local .panel-contenido > * { min-width: 0; }

/* ---------- Menú de abajo ---------- */
.menu-local {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  display: flex;
  gap: 4px;
  padding: 8px max(8px, calc((100vw - 40rem) / 2)) max(8px, env(safe-area-inset-bottom));
  background: var(--tarjeta);
  border-top: 1px solid var(--borde);
}

.menu-local a {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  padding: 0 2px;
  font-size: 0.8rem; /* son 4 botones: en pantallas angostas la letra es chica para que "Productos" quepa */
  text-align: center;
  border: 2px solid var(--borde);
  border-radius: 12px;
  color: var(--texto);
  font-weight: 700;
  text-decoration: none;
}

@media (min-width: 360px) {
  .menu-local a { font-size: 0.85rem; }
}

@media (min-width: 380px) {
  .menu-local { gap: 6px; padding-left: max(12px, calc((100vw - 40rem) / 2)); padding-right: max(12px, calc((100vw - 40rem) / 2)); }
  .menu-local a { font-size: 0.9rem; }
}

.menu-local a[aria-current="page"] {
  background: var(--boton);
  border-color: var(--boton);
  color: var(--boton-texto);
}

.menu-local a:focus-visible {
  outline: 3px solid var(--enfoque);
  outline-offset: 2px;
}

/* ---------- Campos que estilos.css no cubre ---------- */
select,
textarea {
  width: 100%;
  border: 2px solid var(--borde);
  border-radius: 12px;
  background: var(--tarjeta);
  color: inherit;
  font: inherit;
}

select { min-height: 56px; padding: 0 14px; }
textarea { min-height: 96px; padding: 12px 14px; resize: vertical; }

select:focus-visible,
textarea:focus-visible,
.interruptor:focus-visible {
  outline: 3px solid var(--enfoque);
  outline-offset: 2px;
}

/* ---------- Interruptor (Disponible / En oferta) ---------- */
.interruptor {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  margin-top: 16px;
  padding: 0 14px;
  border: 2px solid var(--borde);
  border-radius: 12px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.interruptor .estado {
  padding: 2px 12px;
  border: 2px solid var(--borde);
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 700;
}

.interruptor[aria-checked="true"] { border-color: var(--exito); }
.interruptor[aria-checked="true"] .estado { border-color: var(--exito); color: var(--exito); }

/* ---------- Abierto / Cerrado ---------- */
.pastilla-grande {
  display: inline-block;
  margin: 12px 0 8px;
  padding: 4px 14px;
  border: 2px solid var(--borde);
  border-radius: 999px;
  font-weight: 700;
}

.pastilla-grande[data-tipo="bien"] { border-color: var(--exito); color: var(--exito); }

/* ---------- Productos ---------- */
.barra-botones {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.barra-botones .boton { flex: 1; }

.categoria-titulo {
  margin: 20px 0 8px;
  font-size: 1.05rem;
  color: var(--suave);
}

.producto {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--borde);
  border-radius: 12px;
}

.producto[data-agotado="true"] .producto-nombre { color: var(--suave); }

.producto-foto {
  width: 72px;
  height: 72px;
  border: 1px solid var(--borde);
  border-radius: 10px;
  background: var(--fondo);
  object-fit: cover;
}

.producto-sin-foto {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--suave);
  font-size: 0.75rem;
  text-align: center;
}

.producto-nombre { margin: 0 0 4px; font-size: 1.1rem; overflow-wrap: anywhere; }
.producto-linea { margin: 0 0 6px; overflow-wrap: anywhere; }
.producto-linea.suave { font-size: 0.9rem; }

.precio-viejo { color: var(--suave); text-decoration: line-through; }
.precio-oferta { color: var(--exito); font-weight: 700; }

.producto-acciones {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap; /* en pantallas angostas los botones pasan a otra línea */
  gap: 8px;
}

.producto-acciones .boton { flex: 1 1 8rem; padding: 0 12px; }

.foto-previa {
  display: block;
  width: 100%;
  max-height: 220px;
  margin: 0 0 10px;
  border: 1px solid var(--borde);
  border-radius: 12px;
  background: var(--fondo);
  object-fit: cover;
}

.foto-botones { display: flex; gap: 8px; }
.foto-botones .boton { flex: 1; }

.acciones-form {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}

.boton-peligro[data-armado="true"] {
  background: var(--error);
  color: var(--boton-texto);
  border-color: transparent;
}

.fila-categoria {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--borde);
  border-radius: 12px;
}

.fila-categoria .nombre { flex: 1; min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
.fila-categoria .boton { width: auto; flex: none; }

.fila-nueva-categoria { display: flex; gap: 8px; margin-top: 12px; }
.fila-nueva-categoria input { flex: 1; min-width: 0; }
.fila-nueva-categoria .boton { width: auto; flex: none; }

/* ---------- Mi tienda ---------- */
.aviso-suave {
  margin: 12px 0 0;
  padding: 12px 14px;
  border-left: 4px solid var(--boton);
  border-radius: 8px;
  background: var(--fondo);
  font-size: 0.95rem;
}

.boton-enlace {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  text-align: center;
}

.bloque-qr {
  display: grid;
  justify-items: center;
  gap: 12px;
  margin-top: 20px;
}

.imagen-qr {
  width: 240px;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--borde);
  border-radius: 12px;
  background: #ffffff; /* el QR siempre va sobre blanco, también en modo oscuro */
  image-rendering: pixelated;
}

.bloque-qr .boton { width: 100%; }
.bloque-qr .ayuda { text-align: center; }

.foto-cuadrada { max-width: 240px; object-fit: contain; }

/* ---------- Mis números ---------- */
.segmentos {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.segmento {
  flex: 1;
  min-height: 48px;
  padding: 0 8px;
  border: 2px solid var(--borde);
  border-radius: 12px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.segmento[aria-pressed="true"] {
  background: var(--boton);
  border-color: var(--boton);
  color: var(--boton-texto);
}

.segmento:focus-visible {
  outline: 3px solid var(--enfoque);
  outline-offset: 2px;
}

/* Las cifras de dinero no se parten en dos renglones ("Bs" arriba y el número abajo) */
body.local .rejilla .dato:not(.dato-grande) .dato-valor {
  font-size: clamp(1rem, 4.4vw, 1.2rem);
  white-space: nowrap;
}

@media (max-width: 359px) {
  body.local .rejilla { grid-template-columns: 1fr; }
}

#texto-periodo { margin: 10px 0 0; }
.cargando { opacity: 0.5; }

.subtitulo { margin: 20px 0 8px; font-size: 1.05rem; }

.lista-top {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.fila-top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--borde);
  border-radius: 12px;
}

.fila-top .puesto {
  flex: none;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--fondo);
  font-weight: 700;
  font-size: 0.9rem;
}

.fila-top .nombre { flex: 1; min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
.fila-top .cifras { flex: none; display: grid; justify-items: end; font-size: 0.9rem; }

.saldo-grande {
  margin: 12px 0 0;
  font-size: 2rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.saldo-grande[data-nivel="alerta"],
.saldo-grande[data-nivel="bloqueado"] { color: var(--error); }

.movimiento {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--borde);
  border-radius: 12px;
}

.movimiento-texto,
.movimiento-monto { display: grid; gap: 2px; font-size: 0.95rem; }
.movimiento-texto { min-width: 0; overflow-wrap: anywhere; }
.movimiento-monto { flex: none; justify-items: end; text-align: right; }

.monto[data-signo="mas"] { color: var(--exito); }
.monto[data-signo="menos"] { color: var(--error); }

/* ---------- Pedidos en vivo ---------- */
a.boton {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.boton-peligro {
  background: var(--error);
  color: var(--boton-texto);
}

.aviso-sonido {
  margin: 12px 0;
  background: var(--error);
  color: var(--boton-texto);
}

#boton-sonido { margin: 12px 0 0; width: 100%; }

.grupo-titulo { margin: 20px 0 8px; font-size: 1.05rem; }

.pedido {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--borde);
  border-radius: 12px;
}

.pedido[data-urgente="true"] { border: 3px solid var(--error); }

.pedido p { margin: 0; }

.pedido-cabecera { display: grid; gap: 6px; }
.pedido-titulo { margin: 0; font-size: 1.15rem; overflow-wrap: anywhere; }
.pedido .pastillas { margin: 0; }

.pedido-items {
  margin: 0;
  padding: 10px 12px;
  list-style: none;
  border-radius: 12px;
  background: var(--fondo);
  font-weight: 600;
}

.pedido-items li { margin: 2px 0; overflow-wrap: anywhere; }
.nota-linea { display: block; font-weight: 400; font-size: 0.9rem; }

.pedido-plata { display: grid; gap: 4px; }
.pedido-aviso { font-weight: 700; }
.pedido .aviso { color: var(--error); font-weight: 700; }
.hecho { color: var(--exito); font-weight: 700; }
.motero-linea { font-weight: 600; }
.motero-linea[data-buscando="true"] { color: var(--suave); }
.enlace { color: var(--boton); font-weight: 700; }

.contacto { display: grid; gap: 8px; }
.fila-botones { display: flex; gap: 8px; }
.fila-botones .boton { flex: 1; }

.acciones-pedido { display: grid; gap: 10px; }
.tiempos-titulo { font-weight: 600; margin-bottom: 6px !important; }

.segmentos-pedido { flex-wrap: wrap; margin-top: 0; }
.segmentos-pedido .segmento { flex: 1 1 3.8rem; padding: 0 4px; }

.rechazo { display: grid; gap: 10px; }
.rechazo label { margin: 0; }
.motivos { display: flex; flex-wrap: wrap; gap: 8px; }
.motivos .segmento { flex: 1 1 auto; font-size: 0.9rem; }

.comprobante { display: grid; gap: 10px; }
.comprobante-imagen {
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 12px;
  background: var(--fondo);
}

/* ---------- Pedido manual ---------- */
#boton-manual { margin: 12px 0 0; }

.lista-manual {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  max-height: 60vh;
  overflow-y: auto;
}

.linea-manual {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--borde);
  border-radius: 12px;
}

.linea-manual[data-elegido="true"] { border: 2px solid var(--boton); }

.linea-manual-texto { display: grid; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.linea-manual-precio { font-size: 0.95rem; }

.cantidad { flex: none; display: flex; align-items: center; gap: 6px; }

.boton-cantidad {
  width: 48px;
  height: 48px;
  border: 2px solid var(--borde);
  border-radius: 12px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 1.5rem;
  font-weight: 700;
  cursor: pointer;
}

.boton-cantidad:disabled { opacity: 0.35; cursor: default; }
.boton-cantidad:focus-visible { outline: 3px solid var(--enfoque); outline-offset: 2px; }

.cantidad-numero { min-width: 2ch; text-align: center; font-weight: 700; font-size: 1.15rem; }

.resumen-manual { margin-top: 12px; }
.resumen-total { margin: 10px 0 0; font-size: 1.15rem; font-weight: 700; }

@media (max-width: 359px) {
  .boton-cantidad { width: 44px; height: 44px; }
}
