@font-face { font-family: "Barlow Condensed"; font-weight: 600; font-display: swap; src: url(fonts/bc-600.woff2) format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 700; font-display: swap; src: url(fonts/bc-700.woff2) format("woff2"); }

:root {
  --fondo: #0F2430;
  --panel: #183544;
  --linea: #2C4D5E;
  --texto: #F3EDE0;
  --suave: #9DB4BF;
  --tinta: #10202A;
  --ok: #45D19A;
  --mal: #FF6257;
  --aviso: #FFC247;
  --rotulo: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --cuerpo: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
*, *::before, *::after { box-sizing: inherit; }
html { height: 100%; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100%; background: var(--fondo); color: var(--texto);
  font: 16px/1.45 var(--cuerpo);
}
h1, h2, h3 { font-family: var(--rotulo); font-weight: 700; line-height: 1.1; margin: 0; }
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }
p { margin: 0; }
a { color: inherit; }
.suave { color: var(--suave); }
.cargando { padding: 3rem 1rem; text-align: center; color: var(--suave); }
:focus-visible { outline: 3px solid var(--aviso); outline-offset: 2px; }

/* ---------- botones y campos ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 44px; padding: .55rem 1rem; border-radius: 10px; cursor: pointer;
  border: 1.5px solid var(--linea); background: transparent; color: var(--texto);
  font: 600 1rem var(--cuerpo); text-decoration: none; touch-action: manipulation;
}
.btn:hover { border-color: var(--suave); }
.btn.principal { background: var(--texto); border-color: var(--texto); color: var(--tinta); }
.btn.peligro { color: var(--mal); }
.btn.chico { min-height: 36px; padding: .3rem .7rem; font-size: .9rem; }
.btn:disabled { opacity: .5; cursor: default; }

label { display: block; font-weight: 600; margin-bottom: .3rem; }
input[type=text], input[type=password], input[type=date], input[type=number], select {
  width: 100%; min-height: 46px; padding: .5rem .7rem; border-radius: 10px;
  border: 1.5px solid var(--linea); background: var(--fondo); color: var(--texto); font: inherit;
}
.campo { margin-bottom: 1rem; }
.ayuda { font-size: .88rem; color: var(--suave); margin-top: .25rem; }
.opcion {
  display: flex; gap: .7rem; align-items: flex-start; padding: .7rem; margin-bottom: .5rem;
  border: 1.5px solid var(--linea); border-radius: 10px; font-weight: 400; cursor: pointer;
}
.opcion:has(input:checked) { border-color: var(--texto); background: rgba(243, 237, 224, .06); }
.opcion input { margin-top: .25rem; width: 18px; height: 18px; flex: none; }
.opcion b { display: block; }
.casillas { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .4rem; }
.casillas label { display: flex; gap: .5rem; align-items: center; font-weight: 400; margin: 0; padding: .35rem 0; }
.casillas input { width: 18px; height: 18px; }
.muestra { width: 16px; height: 16px; border-radius: 50%; flex: none; display: inline-block; }
.paleta { display: flex; flex-wrap: wrap; gap: .5rem; }
.paleta label { margin: 0; }
.paleta input { position: absolute; opacity: 0; }
.paleta span { display: block; width: 38px; height: 38px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; }
.paleta input:checked + span { border-color: var(--texto); }
.paleta input:focus-visible + span { outline: 3px solid var(--aviso); outline-offset: 2px; }
.error-form { color: var(--mal); font-weight: 600; margin-bottom: .8rem; }

/* ---------- acceso ---------- */
.acceso { max-width: 380px; margin: 0 auto; padding: 12vh 1.25rem 2rem; }
.acceso h1 { font-size: 2.4rem; line-height: 1.02; letter-spacing: .01em; }
.acceso .bajada { color: var(--suave); margin: .3rem 0 2rem; }
.acceso .btn { width: 100%; min-height: 52px; }

/* ---------- estructura ---------- */
.barra-sup {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: .7rem 1rem; border-bottom: 1.5px solid var(--linea);
}
.barra-sup .marca { font: 700 1.5rem var(--rotulo); margin-right: auto; text-decoration: none; display: flex; align-items: center; }
.barra-sup .marca img { height: 68px; max-width: 60vw; object-fit: contain; width: auto; display: block; }
.barra-sup nav { display: flex; gap: .2rem; order: 3; width: 100%; }
.barra-sup nav a { padding: .45rem .8rem; border-radius: 8px; text-decoration: none; font-weight: 600; color: var(--suave); }
.barra-sup nav a.activa { background: var(--panel); color: var(--texto); }
@media (min-width: 720px) { .barra-sup nav { order: 0; width: auto; margin-right: auto; } .barra-sup .marca { margin-right: 1rem; } }
.pagina { max-width: 960px; margin: 0 auto; padding: 1.25rem 1rem 4rem; }
.titulo-pagina { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.vacio { padding: 2.5rem 1rem; text-align: center; color: var(--suave); border: 1.5px dashed var(--linea); border-radius: 12px; }

.evento { background: var(--panel); border-radius: 14px; padding: 1rem; margin-bottom: .8rem; }
.evento.cerrado { background: transparent; border: 1.5px solid var(--linea); }
.evento-cab { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; }
.evento .datos { color: var(--suave); margin-top: .2rem; }
.evento .cifra { font: 700 2rem/1 var(--rotulo); text-align: right; white-space: nowrap; }
.evento .cifra small { display: block; font: 400 .8rem var(--cuerpo); color: var(--suave); margin-top: .2rem; }
.evento .acciones { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .9rem; }
a.evento { display: block; text-decoration: none; }
.chapa { display: inline-block; padding: .1rem .55rem; border-radius: 99px; font-size: .8rem; font-weight: 600; border: 1.5px solid var(--linea); color: var(--suave); }
.chapa.abierto { border-color: var(--ok); color: var(--ok); }
.chapa.pendiente { border-color: var(--aviso); color: var(--aviso); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .6rem .5rem; border-bottom: 1px solid var(--linea); vertical-align: middle; }
th { color: var(--suave); font-weight: 600; font-size: .88rem; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tabla-scroll { overflow-x: auto; }
tr.inactivo td { color: var(--suave); }

/* ---------- ventana modal ---------- */
dialog {
  width: min(520px, calc(100vw - 1.5rem)); max-height: calc(100dvh - 1.5rem); overflow: auto;
  border: 1.5px solid var(--linea); border-radius: 16px; padding: 1.25rem; background: var(--panel); color: var(--texto);
}
dialog::backdrop { background: rgba(5, 14, 20, .75); }
dialog h2 { margin-bottom: 1rem; }
.pie-modal { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1.2rem; }

/* ---------- pantalla de barra ---------- */
.b-cab { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--fondo); padding: .6rem .8rem; border-bottom: 1.5px solid var(--linea); }
.b-cab-1 { display: flex; align-items: center; gap: .6rem; }
.b-cab-1 h1 { font-size: 1.35rem; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.b-volver { width: 40px; height: 40px; border-radius: 10px; border: 1.5px solid var(--linea); display: grid; place-items: center; text-decoration: none; font-size: 1.2rem; flex: none; }
.b-cab-2 { display: flex; justify-content: space-between; gap: 1rem; margin-top: .4rem; font-size: .92rem; color: var(--suave); }
.conexion { display: inline-flex; align-items: center; gap: .4rem; font-weight: 600; }
.conexion::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--ok); }
.conexion.sin { color: var(--aviso); }
.conexion.sin::before { background: var(--aviso); }
.b-cuerpo { padding: .8rem; max-width: 760px; margin: 0 auto; }

.alerta { display: flex; gap: .7rem; align-items: flex-start; padding: .8rem; border-radius: 12px; margin-bottom: .7rem; background: var(--mal); color: var(--tinta); font-weight: 600; }
.alerta.aviso { background: var(--aviso); }
.alerta p { flex: 1; }
.alerta button { background: none; border: 0; font: 700 1.2rem var(--cuerpo); color: inherit; cursor: pointer; padding: 0 .3rem; }

.escanear { width: 100%; min-height: 72px; font: 700 1.6rem var(--rotulo); border-radius: 14px; }
.ticket-estado { padding: 1rem; border-radius: 14px; margin-bottom: .8rem; color: var(--tinta); }
.ticket-estado.ok { background: var(--ok); }
.ticket-estado.mal { background: var(--mal); }
.ticket-estado strong { display: block; font: 700 1.7rem/1.1 var(--rotulo); }
.ticket-estado .fila { display: flex; justify-content: space-between; align-items: center; gap: .8rem; margin-top: .4rem; }
.ticket-estado .btn { border-color: var(--tinta); color: var(--tinta); }
.a-mano { margin: .8rem 0 0; }
.a-mano summary { color: var(--suave); cursor: pointer; padding: .4rem 0; }
.a-mano form { display: flex; gap: .5rem; margin-top: .4rem; }
.a-mano input { text-transform: uppercase; letter-spacing: .08em; }

.tragos { display: grid; grid-template-columns: repeat(2, 1fr); gap: .6rem; margin-top: .8rem; }
@media (min-width: 620px) { .tragos { grid-template-columns: repeat(4, 1fr); } }
.trago {
  position: relative; min-height: 104px; padding: .7rem .7rem 2.2rem; border: 0; border-radius: 14px; cursor: pointer;
  background: var(--c, #F2A93B); color: var(--tinta); text-align: left;
  font: 700 1.55rem/1.02 var(--rotulo); touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  transition: transform .08s;
}
.trago:active { transform: scale(.96); }
.trago .n { position: absolute; left: .7rem; bottom: .5rem; font: 600 1.15rem var(--rotulo); opacity: .75; }
.trago.golpe { animation: golpe .35s; }
@keyframes golpe { 0% { box-shadow: 0 0 0 0 var(--texto); } 100% { box-shadow: 0 0 0 14px transparent; } }
.tragos.espera .trago { opacity: .35; }
@media (prefers-reduced-motion: reduce) { .trago, .trago.golpe { transition: none; animation: none; } }

.recientes { margin-top: 1.6rem; }
.recientes h2 { font-size: 1.1rem; color: var(--suave); margin-bottom: .3rem; }
.recientes li { display: flex; align-items: center; gap: .6rem; padding: .45rem 0; border-bottom: 1px solid var(--linea); }
.recientes ul { list-style: none; margin: 0; padding: 0; }
.recientes .q { flex: 1; min-width: 0; }
.recientes time { color: var(--suave); font-variant-numeric: tabular-nums; }

.escaner { position: fixed; inset: 0; z-index: 50; background: #000; display: flex; flex-direction: column; }
.escaner video { flex: 1; min-height: 0; width: 100%; object-fit: cover; }
.escaner .mira { position: absolute; left: 50%; top: 42%; width: min(64vw, 300px); aspect-ratio: 1; transform: translate(-50%, -50%); border: 4px solid var(--texto); border-radius: 22px; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .45); pointer-events: none; }
.escaner .pie { position: relative; padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom, 0px)); background: var(--fondo); text-align: center; }
.escaner .pie p { margin-bottom: .7rem; }
.escaner .btn { width: 100%; min-height: 52px; }

/* ---------- reporte ---------- */
.cifras { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1rem 1.5rem; margin: 1rem 0 2rem; padding: 1rem 0; border-block: 1.5px solid var(--linea); }
.cifras div b { display: block; font: 700 2.4rem/1 var(--rotulo); }
.cifras div span { color: var(--suave); font-size: .9rem; }
.seccion { margin-bottom: 2.2rem; }
.seccion h2 { margin-bottom: .6rem; }
.barra-fila { display: grid; grid-template-columns: minmax(110px, 190px) 1fr 3.5rem; gap: .7rem; align-items: center; padding: .35rem 0; }
.barra-fila .pista { height: 22px; border-radius: 5px; background: rgba(243, 237, 224, .08); overflow: hidden; }
.barra-fila .relleno { height: 100%; background: var(--c, var(--texto)); border-radius: 5px; min-width: 2px; }
.barra-fila .v { text-align: right; font: 700 1.2rem var(--rotulo); font-variant-numeric: tabular-nums; }
.barra-fila .pct { color: var(--suave); font: 400 .8rem var(--cuerpo); display: block; }

/* ---------- tickets ---------- */
.hoja { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; margin-top: 1rem; }
.tk { background: #fff; color: #111; border-radius: 10px; padding: .6rem; text-align: center; break-inside: avoid; }
.tk svg { width: 100%; height: auto; display: block; }
.tk .ev { font: 700 1rem/1.1 var(--rotulo); }
.tk .cod { font: 700 1.25rem var(--rotulo); letter-spacing: .12em; }
.tk .vale { font-size: .75rem; color: #444; }
.tk .qr { position: relative; }
.tk .iso { position: absolute; left: 50%; top: 50%; width: 26%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; background: #fff; display: grid; place-items: center; overflow: hidden; }
.tk .iso img { width: 78%; height: 78%; object-fit: contain; display: block; }
.tk .nombre { display: block; width: 86%; max-height: 3rem; object-fit: contain; margin: .3rem auto 0; }
.tk.usado { opacity: .35; }

/* ---------- avisos flotantes ---------- */
#toasts { position: fixed; left: 0; right: 0; bottom: calc(1rem + env(safe-area-inset-bottom, 0px)); z-index: 80; display: flex; flex-direction: column; align-items: center; gap: .4rem; pointer-events: none; padding: 0 1rem; }
.toast { background: var(--texto); color: var(--tinta); font-weight: 600; padding: .65rem 1rem; border-radius: 10px; max-width: 480px; }
.toast.mal { background: var(--mal); }

/* ---------- impresión ---------- */
@media print {
  :root { --fondo: #fff; --panel: #fff; --texto: #111; --suave: #555; --linea: #bbb; padding: 0; }
  body { background: #fff; color: #111; font-size: 11pt; }
  .barra-sup, .no-imprimir, #toasts { display: none !important; }
  .pagina { max-width: none; padding: 0; }
  .barra-fila .pista { background: #eee; }
  .barra-fila .pista, .barra-fila .relleno, .tk, .tk .iso { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .seccion { break-inside: avoid; }
  /* Tickets: 4 columnas x 4 filas = 16 por hoja A4 */
  .hoja { grid-template-columns: repeat(4, 1fr); gap: 2.5mm; margin-top: 0; }
  .tk { border: 1px dashed #999; border-radius: 0; opacity: 1 !important; height: 62mm; padding: 2mm 2mm 1.5mm;
        display: flex; flex-direction: column; align-items: center; justify-content: space-between; overflow: hidden; }
  .tk .ev { font-size: 10pt; line-height: 1.1; }
  .tk .qr { width: 37mm; }
  .tk .cod { font-size: 11pt; line-height: 1.1; letter-spacing: .1em; }
  .tk .vale { font-size: 7pt; line-height: 1.1; }
  .tk .nombre { width: 80%; max-height: 6mm; margin: 0 auto; }
}
@page { size: A4; margin: 8mm; }

/* ---------- venta en el lugar ---------- */
.modos { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-top: .6rem; background: var(--panel); padding: 4px; border-radius: 12px; }
.modos button { min-height: 42px; border: 0; border-radius: 9px; background: transparent; color: var(--suave); font: 700 1.15rem var(--rotulo); cursor: pointer; touch-action: manipulation; }
.modos button.activo { background: var(--texto); color: var(--tinta); }
.venta { background: var(--panel); border-radius: 14px; padding: .8rem; }
.venta-imp { display: flex; justify-content: space-between; align-items: center; gap: .5rem; font-size: .9rem; color: var(--suave); margin-bottom: .6rem; }
.venta-imp b { color: var(--texto); font-weight: 600; }
.carrito { list-style: none; margin: 0 0 .5rem; padding: 0; }
.carrito li { display: flex; align-items: center; gap: .5rem; padding: .3rem 0; border-bottom: 1px solid var(--linea); font-weight: 600; }
.carrito .q { flex: 1; min-width: 0; }
.carrito .btn { min-width: 44px; font-size: 1.2rem; }
.metodos { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; margin: .6rem 0; }
.metodos .btn { padding: .5rem .3rem; }
.btn.elegido { background: var(--ok); border-color: var(--ok); color: var(--tinta); }
.cobrar-fila { display: flex; gap: .5rem; }
.cobrar-fila .cobrar { flex: 1; min-height: 58px; font: 700 1.45rem var(--rotulo); }
.trago .en-carrito { position: absolute; top: .45rem; right: .45rem; min-width: 2.1rem; height: 2.1rem; padding: 0 .45rem; border-radius: 99px;
  background: var(--tinta); color: var(--texto); display: grid; place-items: center; font: 700 1.2rem var(--rotulo); }
.btn.ancho { width: 100%; }
.barra-fila .det { grid-column: 1 / -1; margin-top: -.35rem; font-size: .8rem; color: var(--suave); }
tr.total td { font-weight: 700; border-top: 1.5px solid var(--suave); }

/* ---------- gráficos del reporte ---------- */
.dona-wrap { display: flex; flex-wrap: wrap; gap: 1.5rem 2.5rem; align-items: center; }
.dona { width: 220px; height: 220px; flex: none; }
.dona-n { fill: var(--texto); font: 700 44px var(--rotulo); }
.dona-t { fill: var(--suave); font: 13px var(--cuerpo); }
.dona-tabla { flex: 1; min-width: 280px; }
.leyenda { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; margin-bottom: .6rem; font-size: .88rem; color: var(--suave); }
.leyenda i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: .4rem; vertical-align: -1px; }
.ap-fila { display: grid; grid-template-columns: minmax(90px, 160px) 1fr auto; gap: .2rem .8rem; align-items: center; padding: .45rem 0; }
.ap-pista { display: flex; gap: 2px; height: 22px; }
.ap-seg { height: 100%; min-width: 3px; border-radius: 0; }
.ap-seg:first-child { border-radius: 4px 0 0 4px; }
.ap-seg:last-child { border-radius: 0 4px 4px 0; }
.ap-seg:only-child { border-radius: 4px; }
.ap-v { text-align: right; font: 700 1.15rem var(--rotulo); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ap-det { grid-column: 2 / -1; font-size: .8rem; color: var(--suave); margin-top: -.1rem; }
.graf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 2.5rem; padding-top: 1.2rem; border-top: 1.5px solid var(--linea); }
.graf-grid .sub { margin: -.2rem 0 .6rem; font-size: .9rem; }
@media (max-width: 760px) { .graf-grid { grid-template-columns: 1fr; } .ap-det { grid-column: 1 / -1; } }
@media print {
  .dona-n { fill: #111; } .dona path { stroke: #fff; }
  .ap-seg, .leyenda i, .muestra { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .graf-grid { break-inside: avoid; }
}
.cifras .dinero b { font-size: 1.9rem; white-space: nowrap; }
.nom-trago { display: inline-flex; align-items: center; gap: .45rem; }
@media (max-width: 760px) {
  .ap-fila { grid-template-columns: 1fr auto; }
  .ap-nom { grid-column: 1; }
  .ap-v { grid-column: 2; grid-row: 1; }
  .ap-pista { grid-column: 1 / -1; }
  .dona { margin: 0 auto; }
}
.matriz th.grupo { text-align: center; color: var(--texto); border-left: 1.5px solid var(--linea); }
.matriz th.sub-c { font-size: .78rem; white-space: nowrap; }
.matriz th.sub-c i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: .3rem; }
.matriz th.sub-c:nth-child(odd), .matriz td.ini { border-left: 1.5px solid var(--linea); }
.matriz td, .matriz th { padding-left: .6rem; padding-right: .6rem; }
.matriz .cero { color: var(--suave); opacity: .6; }
@media print { .matriz th.sub-c i { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }
.mi-caja section { margin-bottom: 1.6rem; }
.mi-caja h2 { font-size: 1.4rem; margin-bottom: .6rem; }
.mi-caja .ap-fila { grid-template-columns: 1fr auto; }
.mi-caja .ap-nom { grid-column: 1; }
.mi-caja .ap-v { grid-column: 2; grid-row: 1; }
.mi-caja .ap-pista { grid-column: 1 / -1; }
.mi-caja .ap-det { grid-column: 1 / -1; }
.modos { grid-template-columns: repeat(3, 1fr); }
.modos button { font-size: 1.05rem; padding: 0 .2rem; }
.tabla-tragos-ev th, .tabla-tragos-ev td { padding: .35rem .4rem; }
.tabla-tragos-ev .cen { text-align: center; width: 4.5rem; }
.tabla-tragos-ev input { width: 22px; height: 22px; }
.tabla-tragos-ev .pr { width: 7.5rem; }
.tabla-tragos-ev .pr input { width: 100%; min-height: 38px; padding: .3rem .5rem; }
.trago .precio { position: absolute; right: .7rem; bottom: .55rem; font: 600 .95rem var(--rotulo); opacity: .8; }
.carrito .sub-t { color: var(--suave); font-weight: 400; white-space: nowrap; }
