/* POS web: impresión, cajón, visor, firma, báscula, cámara, bloqueo y temporadas (pos-perifericos.js). Ventanas compactas de una línea por dato, como las de Windows. */

/* ---------- formularios de configuración ---------- */
.per-form { display: block; }
.per-fila { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 4px 12px; align-items: center; padding: 5px 0; border-bottom: 1px solid var(--borde); }
.per-et { font-size: 13px; font-weight: 700; color: var(--suave); }
.per-ctl { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; min-width: 0; }
.per-ctl .campo { flex: 1 1 200px; min-width: 0; }
.per-ctl .btn { min-height: 36px; }
.per-ctl .per-mm { flex: 0 0 84px; width: 84px; }
.per-chk { display: flex; gap: 8px; align-items: flex-start; min-height: 32px; padding: 4px 0; font-size: 13.5px; line-height: 1.3; cursor: pointer; flex: 1 1 100%; }
.per-chk input { width: 20px; height: 20px; flex: none; margin: 1px 0 0; accent-color: var(--primario); }
.per-disp { flex: 1 1 180px; min-width: 0; overflow-wrap: anywhere; font-weight: 600; font-size: 13.5px; }
.per-peq { font-size: 12px; color: var(--suave); }
.per-nota { margin: 6px 0; padding: 6px 10px; font-size: 12.5px; line-height: 1.35; color: var(--suave); background: var(--superficie2); border-radius: 7px; }
.per-nota.mal { color: var(--peligro); }
.per-pruebas { margin-top: 10px; padding: 8px 0 2px; }
.per-pruebas > b { font-size: 13px; }
.per-botones { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.per-botones .btn { min-height: 38px; }
.per-res { margin: 8px 0 0; min-height: 1.3em; font-size: 13px; font-weight: 600; color: var(--suave); }
.per-res.ok { color: var(--exito); }
.per-res.mal { color: var(--peligro); }
.celular .per-fila { grid-template-columns: minmax(0, 1fr); gap: 2px; padding: 6px 0; }
.celular .per-ctl .campo { flex-basis: 100%; }
.celular .per-ctl .per-mm { flex-basis: 84px; }

/* ---------- vista previa del ticket (papel claro, letra oscura) ---------- */
.per-vista { background: #e7ebe8; border-radius: 6px; padding: 10px; max-height: 62vh; overflow: auto; }
.per-hoja { box-sizing: content-box; --cols: 42; width: calc(var(--cols) * 1ch); max-width: none; margin: 0 auto; padding: 12px 10px 14px; background: #fff; color: #1b1e19; font: 12.5px/1.25 Consolas, "Courier New", "Roboto Mono", monospace; box-shadow: 0 1px 6px rgba(0, 0, 0, .25); }
.per-hoja .r { white-space: pre; overflow: hidden; }
.per-hoja .lg { margin: 0 0 1.25em; }
.per-hoja .lg img { display: inline-block; max-width: 100%; height: auto; image-rendering: pixelated; }
.celular .per-hoja { font-size: 11px; }

/* ---------- firma ---------- */
.per-firma { position: relative; height: clamp(160px, 38vh, 260px); background: #fff; border: 2px dashed var(--btn); border-radius: 8px; overflow: hidden; }
.per-firma canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
.per-firma-linea { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); text-align: center; color: #9aa7a1; font-size: 22px; letter-spacing: 1px; pointer-events: none; }

/* ---------- cámara ---------- */
.per-cam { position: relative; background: #000; border-radius: 8px; overflow: hidden; aspect-ratio: 4 / 3; max-height: 52vh; width: 100%; margin: 0 auto; }
.per-cam video { width: 100%; height: 100%; object-fit: cover; display: block; }
.per-cam-mira { position: absolute; left: 12%; right: 12%; top: 32%; bottom: 32%; border: 2px solid rgba(255, 255, 255, .85); border-radius: 8px; box-shadow: 0 0 0 9999px rgba(0, 0, 0, .28); pointer-events: none; }
.per-cam-mira::after { content: ""; position: absolute; left: 6%; right: 6%; top: 50%; height: 2px; background: #ff4d4d; opacity: .85; }

/* ---------- bloqueo por inactividad ---------- */
.per-bloqueo { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 16px; background: rgba(8, 14, 12, .94); backdrop-filter: blur(6px); }
.per-bloqueo-caja { width: min(380px, 100%); background: var(--superficie); border: 1px solid var(--btn); border-radius: 12px; padding: 18px 18px 14px; text-align: center; box-shadow: 0 16px 48px rgba(0, 0, 0, .5); }
.per-bloqueo-ico svg { width: 44px; height: 44px; fill: none; stroke: var(--primario); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.per-bloqueo-caja h2 { margin: 6px 0 4px; font-size: 18px; }
.per-bloqueo-caja p { margin: 0 0 10px; color: var(--suave); font-size: 13.5px; }
.per-bloqueo-caja .per-botones { justify-content: center; }

/* ---------- temporadas ---------- */
.per-banda { flex: none; height: 28px; display: flex; align-items: center; justify-content: center; gap: 14px; padding: 0 10px; color: #fff; font-weight: 700; font-size: 13px; letter-spacing: .2px; overflow: hidden; white-space: nowrap; text-shadow: 0 1px 2px rgba(0, 0, 0, .45); }
.per-banda-txt { overflow: hidden; text-overflow: ellipsis; }
.per-banda-ad { font-size: 15px; letter-spacing: 6px; }
.celular .per-banda { height: 22px; font-size: 12px; } .celular .per-banda-ad { display: none; }
@media (max-height: 420px) { .per-banda { display: none; } }
.per-cae { position: fixed; inset: 0; z-index: 4; overflow: hidden; pointer-events: none; }
.per-cae span { position: absolute; top: -40px; will-change: transform; animation: perCae linear infinite; }
@keyframes perCae { from { transform: translate3d(0, -6vh, 0) rotate(0deg); } 50% { transform: translate3d(18px, 55vh, 0) rotate(180deg); } to { transform: translate3d(-6px, 112vh, 0) rotate(360deg); } }
.lineas-caja.con-cartel { position: relative; }
.per-cartel { position: absolute; inset: 0 34px 0 0; display: none; place-items: center; pointer-events: none; color: var(--texto); padding: 8px; }
.celular .per-cartel { inset: 0; }
.con-cartel.sin-lineas .per-cartel { display: grid; }
.con-cartel.sin-lineas .vacio { visibility: hidden; }
.per-cartel svg { max-width: min(100%, 460px); max-height: 100%; width: auto; height: auto; }
@media (max-height: 520px) { html:not(.con-escala) .per-cartel { display: none !important; } .con-cartel.sin-lineas .vacio { visibility: visible; } }
.per-mece { transform-origin: 88px 150px; animation: perMece 3.4s ease-in-out infinite alternate; }
@keyframes perMece { from { transform: rotate(-5deg); } to { transform: rotate(3deg); } }
.per-late { animation: perLate 1.6s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: center; }
@keyframes perLate { from { opacity: .6; } to { opacity: 1; } }
.per-luces > * { animation: perLuz 1.2s ease-in-out infinite alternate; }
.per-luces > :nth-child(3n) { animation-delay: .35s; } .per-luces > :nth-child(3n+1) { animation-delay: .7s; } .per-luces > :nth-child(5n) { animation-duration: 1.7s; }
@keyframes perLuz { from { opacity: .35; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .per-cae { display: none; } .per-mece, .per-late, .per-luces > * { animation: none; } }

/* ---------- iPad, Android y teclado en pantalla ---------- */
.capa { padding-bottom: calc(12px + var(--per-teclado, 0px)); }
@media (pointer: coarse) {
  .campo, select.campo, input.campo, textarea.campo { font-size: 16px; }   /* con menos de 16 px, Safari en iPad y iPhone agranda la pantalla al tocar un campo */
  .per-chk { min-height: 40px; }
}
@media (max-width: 300px) { .per-hoja { font-size: 8.5px; } .per-firma-linea { font-size: 16px; } }
