:root {
  --verde: #00B060; --verde-osc: #008A4B; --verde-suave: rgba(0,176,96,.14);
  --negro: #0B0F0C; --fondo: #0F1411; --tarjeta: #1A201C; --tarjeta2: #222A25; --borde: #2E3832;
  --texto: #F2F4F7; --suave: #A9B4AD; --amarillo: #FFC107; --rojo: #FF5A4E; --azul: #4DA3FF;
  --radio: 16px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--fondo); color: var(--texto); font-family: 'Poppins', system-ui, sans-serif; font-size: 15px; }
body { min-height: 100vh; min-height: 100dvh; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--verde); }
h1, h2, h3 { margin: 0; font-weight: 700; }
.oculto { display: none !important; }

/* Botones */
.btn { white-space: nowrap; min-height: 48px; padding: 0 18px; border-radius: 14px; border: 1px solid var(--borde); background: var(--tarjeta2); font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.verde { background: var(--verde); border-color: var(--verde); color: #04130A; }
.btn.rojo { background: transparent; border-color: var(--rojo); color: var(--rojo); }
.btn.amarillo { background: var(--amarillo); border-color: var(--amarillo); color: #1B1400; }
.btn.claro { background: transparent; }
.btn.grande { min-height: 56px; font-size: 17px; width: 100%; }
.btn.chico { min-height: 40px; padding: 0 12px; font-size: 14px; border-radius: 12px; }
.btn-icono { width: 44px; height: 44px; border-radius: 22px; border: none; background: transparent; display: inline-flex; align-items: center; justify-content: center; color: var(--texto); }
.btn-icono:hover { background: var(--tarjeta2); }

/* Campos */
label.campo { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--suave); }
.input { min-height: 48px; border-radius: 12px; border: 1px solid var(--borde); background: var(--negro); padding: 0 14px; width: 100%; color: var(--texto); }
.input:focus { outline: 2px solid var(--verde); outline-offset: 0; border-color: transparent; }
.input.grande { min-height: 64px; font-size: 28px; font-weight: 700; }
textarea.input { padding: 12px 14px; min-height: 80px; resize: vertical; }

/* Tarjetas */
.tarjeta { background: var(--tarjeta); border: 1px solid var(--borde); border-radius: var(--radio); padding: 16px; }
.fila { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.lista > .fila { padding: 12px 0; border-bottom: 1px solid var(--borde); }
.lista > .fila:last-child { border-bottom: none; }
.suave { color: var(--suave); }
.chico-txt { font-size: 13px; }
.verde-txt { color: var(--verde); }
.rojo-txt { color: var(--rojo); }
.amarillo-txt { color: var(--amarillo); }
.grueso { font-weight: 700; }
.mono { font-variant-numeric: tabular-nums; }

/* Píldoras */
.pildoras { display: flex; gap: 8px; flex-wrap: wrap; }
.pildora { min-height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--borde); background: var(--tarjeta2); font-weight: 600; }
.pildora.activa { background: var(--verde); border-color: var(--verde); color: #04130A; }

/* Bolas de billar: cada número con su color real; 9 a 15 rayadas */
.bola { --c: var(--verde); width: 44px; height: 44px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; position: relative; flex: none;
  background: radial-gradient(circle at 32% 28%, rgba(255,255,255,.55), rgba(255,255,255,0) 38%), radial-gradient(circle at 50% 50%, transparent 55%, rgba(0,0,0,.35)), var(--c);
  box-shadow: inset -3px -4px 8px rgba(0,0,0,.35); }
.bola.raya { background: radial-gradient(circle at 32% 28%, rgba(255,255,255,.55), rgba(255,255,255,0) 38%), radial-gradient(circle at 50% 50%, transparent 55%, rgba(0,0,0,.35)),
  linear-gradient(#F2F4F7 0 23%, var(--c) 23% 77%, #F2F4F7 77%); }
.bola::after { content: attr(data-n); width: 24px; height: 24px; border-radius: 50%; background: #F2F4F7; color: #0B0F0C; font-weight: 800; font-size: 12px; display: flex; align-items: center; justify-content: center; position: relative; }
.bola.libre { background: radial-gradient(circle at 35% 30%, #5A6560, #2B332E 50%, #121714); }
.bola.pausa { outline: 3px solid var(--amarillo); outline-offset: 2px; }

/* Avisos */
.toast { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: #F2F4F7; color: #0B0F0C; padding: 12px 18px; border-radius: 14px; font-weight: 600; z-index: 100; max-width: calc(100vw - 32px); box-shadow: 0 8px 30px rgba(0,0,0,.4); }
.toast.error { background: var(--rojo); color: #fff; }
.aviso { border-radius: 14px; padding: 12px 14px; font-size: 14px; line-height: 1.4; }
.aviso.amarillo { background: rgba(255,193,7,.12); color: #FFD95A; border: 1px solid rgba(255,193,7,.35); }
.aviso.rojo { background: rgba(255,90,78,.12); color: #FF8A80; border: 1px solid rgba(255,90,78,.35); }
.aviso.verde { background: var(--verde-suave); color: #6FE3A6; border: 1px solid rgba(0,176,96,.35); }

/* Hoja inferior / modal */
.fondo-modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.hoja { background: var(--fondo); border: 1px solid var(--borde); border-radius: 22px 22px 0 0; width: 100%; max-width: 560px; max-height: 92dvh; overflow-y: auto; padding: 20px 20px calc(20px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; }
@media (min-width: 760px) { .fondo-modal { align-items: center; } .hoja { border-radius: 22px; } }
.hoja-titulo { display: flex; justify-content: space-between; align-items: center; }

.cargando { padding: 60px 20px; text-align: center; color: var(--suave); }
.vacio { padding: 24px; text-align: center; color: var(--suave); }

/* Mesa ocupada: se pinta del color de su bola */
.tinte { background: linear-gradient(160deg, color-mix(in srgb, var(--c) 62%, #000), color-mix(in srgb, var(--c) 26%, #000)) !important;
  border-color: color-mix(in srgb, var(--c) 70%, #fff) !important; color: #fff !important; }
.tinte .suave { color: rgba(255,255,255,.78) !important; }
/* Sin zoom al tocar en iPhone: textos de 16px en campos y sin doble toque */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { touch-action: manipulation; }
input, select, textarea, .input, .input.chico-txt { font-size: 16px !important; }
.input.grande { font-size: 28px !important; }
/* Detalle de ventas de cada mesera */
.vt { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 700px) { .vt { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.vt-caja { background: var(--tarjeta2); border-radius: 12px; padding: 8px 10px; display: flex; flex-direction: column; min-width: 0; }
.vt-caja span { font-size: 12px; color: var(--suave); }
.vt-caja b { font-size: 16px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vt-det summary { cursor: pointer; color: var(--verde); font-weight: 600; font-size: 14px; padding: 8px 0; min-height: 40px; display: flex; align-items: center; }
.vt-det[open] summary { margin-bottom: 4px; }
.vt-fila { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--borde); font-size: 14px; flex-wrap: wrap; }
.vt-pago { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.vt-tag { font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 8px; background: var(--tarjeta2); white-space: nowrap; }
.vt-tag.ef { background: var(--verde-suave); color: var(--verde); }
.vt-tag.tr { background: rgba(77,163,255,.15); color: var(--azul); }

/* Mesas de dominó y salones VIP */
.ficha { width: 44px; height: 44px; border-radius: 12px; flex: none; display: inline-flex; background-repeat: no-repeat; background-position: center; background-size: 30px; box-shadow: inset -2px -3px 6px rgba(0,0,0,.25); }
.ficha.domino { background-color: #F2F4F7; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 12h14' stroke='%230B0F0C' stroke-width='1.6'/%3E%3Cg fill='%230B0F0C'%3E%3Ccircle cx='8' cy='6' r='1.6'/%3E%3Ccircle cx='16' cy='8.5' r='1.6'/%3E%3Ccircle cx='8' cy='15.5' r='1.6'/%3E%3Ccircle cx='12' cy='17.5' r='1.6'/%3E%3Ccircle cx='16' cy='19.5' r='1.6'/%3E%3C/g%3E%3C/svg%3E"); }
.ficha.salon { border-radius: 50%; background-color: #E8B931; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 8l4.5 4L12 5l4.5 7L21 8l-2 10H5z' fill='%230B0F0C'/%3E%3C/svg%3E"); }
.ficha:not(.ocupada) { filter: grayscale(1) brightness(.55); }
.ficha.pausa { outline: 3px solid var(--amarillo); outline-offset: 2px; }
.grupo-tit { font-size: 15px; font-weight: 700; color: var(--suave); margin: 6px 0 -4px; }
