/* POS Xolotlcalli — móvil primero (390×844) */

:root {
  --fondo: #f4f6f6;
  --tinta: #16302b;
  --primario: #1a535c;
  --acento: #e07a5f;
  --tarjeta: #ffffff;
  --borde: #d8dfdf;
  --alto-tab: 64px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--fondo);
  color: var(--tinta);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

#topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  padding-top: calc(10px + env(safe-area-inset-top));
  background: var(--primario);
  color: #fff;
}

#topbar h1 {
  margin: 0;
  line-height: 0;
}

#topbar h1 img {
  height: 34px;
  display: block;
}

.badge {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: #ffd166;
  color: #5c4300;
  border-radius: 999px;
  padding: 4px 10px;
}

#btn-ajustes {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
}

#btn-ajustes svg { display: block; }

.oculto { display: none; }

#pantalla {
  padding: 16px;
  padding-bottom: calc(var(--alto-tab) + env(safe-area-inset-bottom) + 16px);
  max-width: 640px;
  margin: 0 auto;
}

/* ---- Entradas: dos botonzotes ---- */

.entradas {
  display: grid;
  gap: 16px;
}

.btn-entrada {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 130px;
  border: none;
  border-radius: 18px;
  background: var(--tarjeta);
  border: 2px solid var(--borde);
  font: inherit;
  cursor: pointer;
}

.btn-entrada:active { background: #e8f0ef; }

.btn-entrada .nombre { font-size: 1.15rem; font-weight: 600; }

.btn-entrada .detalle { font-size: 0.85rem; color: #5c6b68; }

.btn-entrada .precio {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--primario);
}

/* ---- Merch: búsqueda + cuadrícula ---- */

#buscador {
  width: 100%;
  min-height: 52px;
  padding: 12px 16px;
  margin-bottom: 14px;
  font: inherit;
  font-size: 1.05rem;
  border: 2px solid var(--borde);
  border-radius: 14px;
  background: var(--tarjeta);
}

#buscador:focus { outline: 3px solid var(--primario); border-color: transparent; }

.cuadricula {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.btn-producto {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  min-height: 96px;
  padding: 12px;
  border: 2px solid var(--borde);
  border-radius: 14px;
  background: var(--tarjeta);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.btn-producto:active { background: #e8f0ef; }

.btn-producto .nombre {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.25;
}

.btn-producto .precio {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--acento);
}

.btn-producto.sin-precio {
  opacity: 0.45;
  cursor: not-allowed;
}

.nota {
  margin-top: 20px;
  font-size: 0.85rem;
  color: #5c6b68;
  text-align: center;
}

/* ---- Feedback al agregar ---- */

@keyframes pop {
  0% { transform: scale(1); }
  40% { transform: scale(0.94); }
  100% { transform: scale(1); }
}

.pop { animation: pop 0.18s ease-out; }

/* ---- Badge del carrito en la tab ---- */

#tabs button { position: relative; }

.badge-cant {
  position: absolute;
  top: 6px;
  right: calc(50% - 26px);
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  background: var(--acento);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  line-height: 20px;
  text-align: center;
  padding: 0 5px;
}

/* ---- Barra "Ver carrito" flotante ---- */

#barra-cobro {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(var(--alto-tab) + env(safe-area-inset-bottom) + 10px);
  z-index: 9;
}

#barra-cobro button {
  width: 100%;
  min-height: 56px;
  border: none;
  border-radius: 14px;
  background: var(--primario);
  color: #fff;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(22, 48, 43, 0.3);
}

body.con-barra #pantalla { padding-bottom: calc(var(--alto-tab) + 90px); }

/* ---- Carrito ---- */

.lineas { display: grid; gap: 10px; }

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

.linea-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.linea-info .nombre { font-weight: 600; font-size: 0.95rem; line-height: 1.2; }
.linea-info .sub { font-size: 0.9rem; color: #5c6b68; }

.stepper { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }

.stepper button {
  width: 46px;
  height: 46px;
  border: 2px solid var(--borde);
  border-radius: 12px;
  background: var(--fondo);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.stepper button:active { background: #e8f0ef; }
.stepper b { min-width: 32px; text-align: center; font-size: 1.15rem; }

.totales {
  margin: 16px 0 4px;
  padding: 14px;
  background: var(--tarjeta);
  border: 2px solid var(--borde);
  border-radius: 14px;
}

.tot { display: flex; justify-content: space-between; font-size: 1.3rem; }
.tot b { font-size: 1.6rem; color: var(--primario); }
.propina-est { margin-top: 6px; color: #5c6b68; display: flex; justify-content: space-between; }
.comision { margin-top: 6px; color: #8a1f1f; display: flex; justify-content: space-between; font-size: 0.9rem; }

#pantalla h2 { font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.04em; color: #5c6b68; margin: 18px 0 8px; }

.opciones { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
  min-height: 52px;
  padding: 8px 16px;
  border: 2px solid var(--borde);
  border-radius: 14px;
  background: var(--tarjeta);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.chip.sel {
  border-color: var(--primario);
  background: var(--primario);
  color: #fff;
}

#nota {
  width: 100%;
  min-height: 50px;
  margin-top: 16px;
  padding: 12px 16px;
  font: inherit;
  border: 2px solid var(--borde);
  border-radius: 14px;
  background: var(--tarjeta);
}

.btn-cobrar {
  width: 100%;
  min-height: 64px;
  margin-top: 16px;
  border: none;
  border-radius: 16px;
  background: #1a7a4a;
  color: #fff;
  font: inherit;
  font-size: 1.25rem;
  font-weight: 800;
  cursor: pointer;
}

.btn-cobrar:disabled { background: #a9bcb6; cursor: not-allowed; }
.btn-cobrar:not(:disabled):active { background: #16693f; }

.pista { text-align: center; color: #5c6b68; font-size: 0.9rem; margin-top: 8px; }

/* ---- Confirmación ---- */

.confirmacion { text-align: center; padding-top: 12px; }
.palomita { font-size: 3.2rem; }
.cobrado { font-size: 2.6rem; font-weight: 800; color: var(--primario); margin-top: 4px; }
.confirmacion .det { color: #5c6b68; margin-top: 4px; }

.propina-box {
  margin: 18px auto 0;
  max-width: 260px;
  padding: 14px;
  border-radius: 16px;
  background: #fff4d6;
  color: #5c4300;
  font-size: 0.95rem;
}

.propina-box b { font-size: 1.6rem; }

.confirmacion .folio { margin-top: 14px; color: #5c6b68; font-size: 0.85rem; }
.confirmacion .folio code { font-size: 0.95rem; color: var(--tinta); }

/* ---- Corte del día ---- */

.corte-caja {
  display: grid;
  gap: 8px;
  padding: 14px;
  background: var(--tarjeta);
  border: 2px solid var(--borde);
  border-radius: 14px;
}

.corte-fila {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 1.05rem;
}

.corte-fila b { font-size: 1.15rem; }

.corte-fila.comision-dia { margin-top: -4px; font-size: 0.85rem; color: #8a1f1f; }
.corte-fila.comision-dia b { font-size: 0.85rem; color: #8a1f1f; }

.corte-total { padding-top: 8px; border-top: 2px solid var(--borde); }
.corte-total b { font-size: 1.5rem; color: var(--primario); }

.corte-propina b {
  padding: 2px 10px;
  border-radius: 8px;
  background: #fff4d6;
  color: #5c4300;
}

.corte-caja .vacio { padding: 8px 0; }

/* ---- Corte: export ---- */

.export-caja {
  padding: 14px;
  background: var(--tarjeta);
  border: 2px solid var(--borde);
  border-radius: 14px;
}

.export-caja > p:first-child { margin: 0 0 12px; font-size: 1.05rem; }

.export-botones { display: flex; gap: 10px; }

.btn-export {
  flex: 1;
  min-height: 56px;
  border: none;
  border-radius: 14px;
  background: var(--primario);
  color: #fff;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-export.sec { background: var(--tarjeta); color: var(--primario); border: 2px solid var(--primario); }
.btn-export:disabled { background: #a9bcb6; color: #fff; border: none; cursor: not-allowed; }
.btn-export:not(:disabled):active { opacity: 0.85; }

.export-caja .pista { margin-bottom: 0; }

.linea-info .nombre code { font-size: 0.8rem; word-break: break-all; }

.re-botones { display: flex; gap: 6px; flex-shrink: 0; }

.re-descarga {
  min-height: 46px;
  padding: 0 14px;
  border: 2px solid var(--borde);
  border-radius: 12px;
  background: var(--fondo);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}

.re-descarga:active { background: #e8f0ef; }

/* ---- Caja y cierre de turno ---- */

.fila-dato { display: flex; justify-content: space-between; padding: 2px 0; }
.fila-dato.fuerte { border-top: 2px solid var(--borde); margin-top: 6px; padding-top: 8px; }
.fila-dato.fuerte b { font-size: 1.3rem; color: var(--primario); }
.fila-dato.rojo b { color: #8a1f1f; }

.mov-caja { margin: 6px 0 0; font-size: 0.9rem; color: var(--tinta); }
.mov-caja span { color: #5c6b68; }

.btn-export.ancho { width: 100%; margin-top: 10px; }

.conteo-lista { margin: 10px 0; }
.conteo-lista .linea { padding: 8px 12px; }

.campo-mini {
  width: 92px;
  min-height: 46px;
  padding: 8px;
  font: inherit;
  text-align: center;
  border: 2px solid var(--borde);
  border-radius: 10px;
  background: var(--fondo);
  flex-shrink: 0;
}

.cierre-card {
  padding: 16px;
  background: var(--tarjeta);
  border: 2px solid var(--borde);
  border-radius: 16px;
}

.cierre-titulo { margin: 0; font-weight: 800; font-size: 1.1rem; }
.cierre-sub { margin: 2px 0 12px; font-size: 0.8rem; color: #5c6b68; word-break: break-all; }

.cierre-ok {
  margin: 0 0 12px;
  padding: 12px;
  border-radius: 12px;
  background: #e3f4e8;
  color: #14532d;
  font-weight: 700;
  text-align: center;
  font-size: 1.05rem;
}

.cierre-mal {
  margin: 0 0 8px;
  padding: 12px;
  border-radius: 12px;
  background: #fde8e8;
  color: #8a1f1f;
  font-weight: 700;
  text-align: center;
}

.cierre-det { margin: 2px 0 8px; color: #8a1f1f; font-size: 0.95rem; }

/* ---- Inventario ---- */

#buscador-inv {
  width: 100%;
  min-height: 52px;
  padding: 12px 16px;
  margin-bottom: 12px;
  font: inherit;
  font-size: 1.05rem;
  border: 2px solid var(--borde);
  border-radius: 14px;
  background: var(--tarjeta);
}

#buscador-inv:focus { outline: 3px solid var(--primario); border-color: transparent; }

.inv-stock { font-size: 0.9rem; color: #5c6b68; }
.inv-stock b.rojo { color: #8a1f1f; }

.inv-foto {
  width: 46px;
  height: 46px;
  object-fit: cover;
  border-radius: 10px;
  flex-shrink: 0;
}

.campo-mini.ancha { width: 130px; }

.todos-linea .sub b { color: var(--tinta); }

.fila-inv {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.btn-producto img.foto {
  width: 100%;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
}

/* ---- Equipo: estadísticas por colaborador ---- */

.periodo {
  padding: 8px 10px;
  border: 2px solid var(--borde);
  border-radius: 12px;
}

.periodo.actual {
  border-color: var(--primario);
  background: #e8f0ef;
}

.periodo-rango { font-size: 0.8rem; font-weight: 700; color: #5c6b68; }
.periodo.actual .periodo-rango { color: var(--primario); }

.periodo-datos {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.periodo-datos b {
  font-size: 1.15rem;
  padding: 0 8px;
  border-radius: 8px;
  background: #fff4d6;
  color: #5c4300;
}

/* ---- Ajustes: perfiles y cuenta de administrador ---- */

.campo {
  width: 100%;
  min-height: 52px;
  margin-bottom: 10px;
  padding: 12px 16px;
  font: inherit;
  font-size: 1.05rem;
  border: 2px solid var(--borde);
  border-radius: 14px;
  background: var(--fondo);
}

.campo:focus { outline: 3px solid var(--primario); border-color: transparent; }

.export-caja > .btn-export { width: 100%; }

.export-caja.separa { margin-top: 12px; }

.re-descarga.peligro {
  border-color: #8a1f1f;
  background: #fde8e8;
  color: #8a1f1f;
}

.tag-admin {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--primario);
  color: #fff;
  border-radius: 999px;
  padding: 2px 8px;
  vertical-align: middle;
}

p.separa { margin: 12px 0 8px; }

.aviso {
  padding: 12px 16px;
  border-radius: 14px;
  background: #e3f4e8;
  color: #14532d;
  font-weight: 600;
}

.error {
  padding: 20px;
  border-radius: 14px;
  background: #fde8e8;
  color: #8a1f1f;
  font-weight: 600;
}

.vacio {
  grid-column: 1 / -1;
  text-align: center;
  color: #5c6b68;
  padding: 24px 0;
}

/* ---- Tabs inferiores ---- */

#tabs {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  height: calc(var(--alto-tab) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--tarjeta);
  border-top: 1px solid var(--borde);
}

#tabs button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: none;
  background: none;
  font: inherit;
  font-size: 1.3rem;
  color: #7a8a87;
  cursor: pointer;
}

#tabs button span { font-size: 0.75rem; font-weight: 600; }

#tabs button.activo { color: var(--primario); }
