/* ══════════════════════════════════════════════════════════════
   CLUB VICIO — panel de caja
   Misma paleta que la app del cliente, pero esto no se lee: se opera.
   Todo está dimensionado para que un consumo tome menos de 10 segundos
   con la cafetería llena y el cajero apurado.
   ══════════════════════════════════════════════════════════════ */

:root {
  --bg:        #FAF9F5;
  --surface:   #FFFFFF;
  --surface-2: #F1EFE8;
  --line:      #E3DFD5;
  --line-2:    #C9C3B5;
  --ink:       #131209;
  --ink-2:     #55524A;
  --ink-3:     #8B867A;
  --oro:       #8A6A18;
  --oro-vivo:  #C9A227;
  --ok:        #3D6B4E;
  --ok-suave:  #E8EFE9;
  --alerta:    #9C3A26;
  --alerta-bg: #F8EAE6;
  --sombra:    0 1px 2px rgba(19,18,9,.06), 0 12px 32px -20px rgba(19,18,9,.35);

  --f-display: "Bricolage Grotesque", "Helvetica Neue", Arial, sans-serif;
  --f-ui: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #0B0B0A;
    --surface:   #171614;
    --surface-2: #201E1A;
    --line:      #2E2A24;
    --line-2:    #433D33;
    --ink:       #F6F3EC;
    --ink-2:     #ACA69A;
    --ink-3:     #777166;
    --oro:       #E3C05C;
    --oro-vivo:  #E3C05C;
    --ok:        #8FBF9B;
    --ok-suave:  #1C241E;
    --alerta:    #E08A72;
    --alerta-bg: #2B1A15;
    --sombra:    0 1px 2px rgba(0,0,0,.6), 0 12px 32px -20px rgba(0,0,0,.9);
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }

body {
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--f-ui);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-user-select: none; user-select: none;   /* nadie selecciona texto por error al tocar rápido */
  overscroll-behavior: none;
}

.mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.tenue { color: var(--ink-3); }

.pantalla { display: none; min-height: 100dvh; }
.pantalla.activa { display: block; }

.splash { display: none; place-items: center; align-content: center; gap: 24px; min-height: 100dvh; }
.splash.activa { display: grid; }
.cargando {
  width: 24px; height: 24px; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--oro);
  animation: girar .8s linear infinite;
}
@keyframes girar { to { transform: rotate(360deg); } }

.sello, .sello-chico { display: block; border-radius: 50%; }

/* ── Acceso ── */
.lienzo {
  max-width: 420px; margin: 0 auto; min-height: 100dvh;
  padding: max(24px, env(safe-area-inset-top)) 22px calc(28px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 22px;
}
.centrado { justify-content: center; }
.acceso-marca { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
h1 { font-family: var(--f-display); font-weight: 800; font-size: 34px; letter-spacing: -.03em; line-height: 1; }
.lema { color: var(--ink-2); font-size: 15px; }

.formulario { display: flex; flex-direction: column; gap: 14px; }
.campo { display: flex; flex-direction: column; gap: 6px; }
.campo > span { font-size: 12.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); }
input {
  font-family: var(--f-ui); font-size: 16px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: 14px; width: 100%;
  -webkit-user-select: text; user-select: text;
}
input:focus { outline: 0; border-color: var(--oro); box-shadow: 0 0 0 3px color-mix(in srgb, var(--oro) 22%, transparent); }

/* ── Botones ── */
.boton {
  font-family: var(--f-ui); font-size: 16px; font-weight: 600;
  border-radius: 12px; padding: 15px 18px; border: 1px solid transparent;
  cursor: pointer; width: 100%; transition: transform .08s, opacity .15s;
}
.boton:active { transform: scale(.985); }
.boton:focus-visible { outline: 2px solid var(--oro); outline-offset: 3px; }
.boton[disabled] { opacity: .4; cursor: not-allowed; }
.primario { background: var(--ink); color: var(--bg); }
.primario.grande { padding: 20px; font-size: 18px; letter-spacing: -.01em; }
.borde { background: transparent; border-color: var(--line-2); color: var(--ink); }
.borde.claro { border-color: rgba(255,255,255,.5); color: #fff; }
.texto { background: none; border: 0; color: var(--ink-2); font-size: 14px; font-weight: 500; padding: 10px; width: auto; }

.aviso {
  background: var(--alerta-bg); color: var(--alerta);
  border-left: 3px solid var(--alerta); border-radius: 0 8px 8px 0;
  padding: 12px 14px; font-size: 15px; line-height: 1.45;
}
.pista { font-size: 13.5px; color: var(--ink-3); }
.pista strong { color: var(--ink); font-weight: 600; }

/* ── Marco de la caja ── */
.marco {
  max-width: 460px; margin: 0 auto; min-height: 100dvh;
  padding: max(16px, env(safe-area-inset-top)) 18px calc(16px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 16px;
}
.barra { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.barra-marca { display: flex; align-items: center; gap: 10px; }
.barra-marca div { display: flex; flex-direction: column; line-height: 1.25; }
.barra-marca strong { font-size: 15px; letter-spacing: -.01em; }
.barra-marca span { font-size: 12.5px; }

/* ── Cobro ── */
.cobro { display: flex; flex-direction: column; gap: 14px; }
.monto-etq { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); text-align: center; }
.monto {
  display: flex; align-items: baseline; justify-content: center; gap: 8px;
  font-family: var(--f-display); font-weight: 800;
  font-size: clamp(46px, 13vw, 60px); line-height: 1; letter-spacing: -.04em;
}
.monto .moneda { font-size: .42em; font-weight: 600; color: var(--ink-3); letter-spacing: 0; }
.monto .mono { font-variant-numeric: tabular-nums; }

.teclado { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tecla {
  font-family: var(--f-display); font-weight: 700; font-size: 26px;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: 14px;
  padding: 0; height: 62px; cursor: pointer;
  transition: background .1s, transform .06s;
}
.tecla:active { background: var(--surface-2); transform: scale(.96); }
.tecla:focus-visible { outline: 2px solid var(--oro); outline-offset: 2px; }
.tecla.sec { font-size: 22px; color: var(--ink-2); background: var(--surface-2); }

/* ── Historial ── */
.historial { margin-top: auto; border-top: 1px solid var(--line); padding-top: 10px; }
.historial-cab {
  width: 100%; display: flex; justify-content: space-between; align-items: center;
  background: none; border: 0; padding: 10px 2px; cursor: pointer;
  font-family: var(--f-ui); font-size: 13.5px; color: var(--ink-2);
}
.historial-cab:focus-visible { outline: 2px solid var(--oro); outline-offset: 2px; }
.lista { display: flex; flex-direction: column; gap: 1px; background: var(--line); border-radius: 10px; overflow: hidden; max-height: 40vh; overflow-y: auto; }
.fila {
  background: var(--surface); display: grid; grid-template-columns: 1fr auto auto;
  gap: 12px; align-items: baseline; padding: 11px 13px; font-size: 14px;
}
.fila b { font-weight: 600; }
.fila .hora { font-family: var(--f-mono); font-size: 12px; color: var(--ink-3); }
.fila .pts { font-family: var(--f-mono); font-size: 13px; color: var(--oro); font-weight: 600; }
.vacio { background: var(--surface); padding: 20px; text-align: center; font-size: 14px; color: var(--ink-3); }

/* ── Novedades ── */
.nov-fila {
  background: var(--surface);
  display: grid; grid-template-columns: 1fr auto;
  gap: 10px; align-items: flex-start;
  padding: 11px 13px; font-size: 14px;
}
/* La franja dorada marca lo que todavía no se leyó. Se apaga sola al
   cerrar la lista: es una señal de "esto es nuevo", no un estado. */
.nov-fila.nueva { box-shadow: inset 3px 0 0 var(--oro-vivo); }
.nov-texto { min-width: 0; display: grid; gap: 2px; }
.nov-texto b { font-weight: 600; }
.nov-texto span { font-size: 13px; color: var(--ink-2); line-height: 1.4; }
.nov-fila .hora { font-family: var(--f-mono); font-size: 12px; color: var(--ink-3); white-space: nowrap; }

/* ── Escáner ── */
.hoja-llena { position: fixed; inset: 0; z-index: 70; background: #000; display: flex; flex-direction: column; }
.escaner { position: relative; flex: 1; overflow: hidden; }
#video { width: 100%; height: 100%; object-fit: cover; }
.mira {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  width: min(66vw, 260px); aspect-ratio: 1; pointer-events: none;
}
.mira span { position: absolute; width: 36px; height: 36px; border: 3px solid #E3C05C; }
.mira span:nth-child(1) { top: 0; left: 0; border-right: 0; border-bottom: 0; border-radius: 8px 0 0 0; }
.mira span:nth-child(2) { top: 0; right: 0; border-left: 0; border-bottom: 0; border-radius: 0 8px 0 0; }
.mira span:nth-child(3) { bottom: 0; left: 0; border-right: 0; border-top: 0; border-radius: 0 0 0 8px; }
.mira span:nth-child(4) { bottom: 0; right: 0; border-left: 0; border-top: 0; border-radius: 0 0 8px 0; }

.escaner-pie {
  background: #000; color: #fff; padding: 20px 22px calc(24px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 10px; align-items: center; text-align: center;
}
.escaner-monto { font-size: 15px; color: rgba(255,255,255,.75); }
.escaner-monto strong { color: #E3C05C; font-weight: 600; }
.escaner-pista { font-size: 14px; color: rgba(255,255,255,.6); min-height: 1.4em; }
.escaner-pie .boton { max-width: 300px; }

/* ── Código a mano ── */
.hoja { position: fixed; inset: 0; z-index: 60; display: grid; align-items: end; }
.hoja-fondo { position: absolute; inset: 0; background: rgba(0,0,0,.55); }
.hoja-panel {
  position: relative; background: var(--surface); border-radius: 20px 20px 0 0;
  padding: 12px 22px calc(24px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 12px;
  max-width: 460px; margin: 0 auto; width: 100%;
  animation: subir .22s cubic-bezier(.2,.8,.3,1);
}
@keyframes subir { from { transform: translateY(100%) } to { transform: none } }
.hoja-asa { width: 38px; height: 4px; border-radius: 999px; background: var(--line-2); margin: 0 auto 6px; }
.hoja-panel h2 { font-family: var(--f-display); font-weight: 800; font-size: 21px; letter-spacing: -.02em; }
.codigo {
  font-family: var(--f-mono); font-size: 34px; font-weight: 600;
  text-align: center; letter-spacing: .18em; padding: 16px 10px;
}

/* ── Confirmación ── */
.listo { background: var(--bg); align-items: center; justify-content: center; }
.listo-caja {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 28px 24px calc(28px + env(safe-area-inset-bottom));
  max-width: 420px; width: 100%; text-align: center;
}
.tilde { width: 74px; height: 74px; margin-bottom: 6px; }
.tilde svg { width: 100%; height: 100%; fill: none; stroke: var(--ok); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.tilde circle { opacity: .28; }
.tilde path { stroke-dasharray: 40; stroke-dashoffset: 40; animation: trazar .35s .1s ease-out forwards; }
@keyframes trazar { to { stroke-dashoffset: 0 } }

.listo-cliente { font-size: 17px; color: var(--ink-2); }
.listo-puntos {
  font-family: var(--f-display); font-weight: 800;
  font-size: clamp(58px, 18vw, 76px); line-height: 1; letter-spacing: -.045em;
  color: var(--oro); font-variant-numeric: tabular-nums;
}
.listo-puntos small { font-family: var(--f-ui); font-size: .22em; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.listo-detalle { font-size: 15px; color: var(--ink-2); margin-bottom: 14px; text-wrap: balance; }
.listo-caja .boton { max-width: 340px; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ══════════════════════════════════════════════════════════════
   ENTREGA DE PREMIOS
   ══════════════════════════════════════════════════════════════ */

.separador-caja {
  display: flex; align-items: center; gap: 12px;
  font-size: 12.5px; color: var(--ink-3); margin: 2px 0;
}
.separador-caja::before, .separador-caja::after {
  content: ""; flex: 1; height: 1px; background: var(--line);
}

.fila-canje {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px 15px;
  margin-bottom: 8px;
}

.canje-nombre { font-weight: 600; font-size: 16px; color: var(--ink); line-height: 1.3; }
.canje-puntos { font-size: 13px; color: var(--ink-2); margin-top: 3px; }

.sin-canjes {
  color: var(--ink-2);
  font-size: 15px;
  line-height: 1.5;
  padding: 16px 2px;
}

.boton.chico {
  width: auto;
  min-height: 44px;
  padding: 0 20px;
  font-size: 15px;
  white-space: nowrap;
  flex: 0 0 auto;
}

/* ══════════════════════════════════════════════════════════════
   RESERVAS EN CAJA
   ══════════════════════════════════════════════════════════════ */

.globo {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  margin-left: 6px;
  border-radius: 999px;
  background: var(--alerta);
  color: var(--bg);
  font-family: var(--f-mono);
  font-size: 11.5px;
  font-weight: 600;
  vertical-align: 1px;
}

.reserva {
  background: var(--surface);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px;
}
.reserva.resuelta { opacity: .55; }

.reserva-datos { flex: 1; min-width: 0; }

.reserva-quien {
  font-weight: 600;
  font-size: 15px;
  line-height: 1.3;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}
.reserva-tel { font-family: var(--f-mono); font-size: 12px; color: var(--ink-3); font-weight: 500; }

.reserva-cuando { font-size: 13px; color: var(--ink-2); margin-top: 3px; }
.reserva-nota   { font-size: 12.5px; color: var(--ink-2); margin-top: 4px; font-style: italic; }
.reserva-pie    { font-size: 11.5px; color: var(--ink-3); margin-top: 4px; }

.reserva-acciones {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
  align-items: stretch;
}
.reserva-acciones .boton { width: auto; }
.reserva-acciones .texto { font-size: 12.5px; padding: 4px 6px; }

.reserva-sello {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-3);
  flex-shrink: 0;
  padding-top: 3px;
}

/* El historial de caja limita la altura; con reservas conviene más aire */
#lista-pendientes, #lista-agenda { max-height: 52vh; }

/* ── Campanita de avisos ── */
.barra-acciones { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }

.campana {
  background: none;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 7px;
  color: var(--ink-3);
  cursor: pointer;
  display: grid;
  place-items: center;
}
.campana:hover { color: var(--ink-2); }
.campana:focus-visible { outline: 2px solid var(--oro); outline-offset: 2px; }
.campana.activa { color: var(--oro); border-color: var(--line); background: var(--surface-2); }

/* Cuando entra una reserva, el encabezado late unos segundos */
@keyframes latido-aviso {
  0%, 100% { background: transparent; }
  50%      { background: var(--alerta-bg); }
}
.historial-cab.late { animation: latido-aviso 2.4s ease-in-out infinite; border-radius: 8px; }

@media (prefers-reduced-motion: reduce) {
  .historial-cab.late { animation: none; background: var(--alerta-bg); border-radius: 8px; }
}

/* Una reserva que se cayó se lee de un vistazo, sin tener que leerla */
.reserva.caida .reserva-quien,
.reserva.caida .reserva-cuando { text-decoration: line-through; }
.reserva.caida .reserva-sello  { color: var(--alerta); }

/* ── Selector de día de la agenda ──
   Una mesa confirmada para otro día tiene que poder mirarse. */
.dias {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 2px 10px;
}
.dia-flecha {
  font: inherit;
  font-size: 20px;
  line-height: 1;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  cursor: pointer;
}
.dia-flecha:hover { border-color: var(--oro); }
.dia-nombre {
  flex: 1;
  text-align: center;
  font-weight: 600;
  font-size: 14.5px;
  text-transform: capitalize;
}
.dias .boton.texto.chico { width: auto; min-height: 34px; padding: 0 10px; font-size: 13px; }

/* Un mensaje que confirma algo no puede leerse igual que uno que avisa
   de un problema. Sin esto, «Reserva confirmada» salía en rojo. */
.aviso.bien {
  background: rgba(61, 107, 78, .14);
  border-left-color: var(--ok, #3D6B4E);
  color: var(--ink);
}
