:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #1d2330;
  --muted: #6b7280;
  --line: #e3e6ea;
  --primary: #1f5fbf;
  --ok: #188a4a;
  --ok-bg: #e7f6ee;
  --bad: #b42318;
  --bad-bg: #fdecea;
  --warn-bg: #fff6df;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11151c;
    --card: #1a202a;
    --text: #e8ebf0;
    --muted: #9aa3b2;
    --line: #2b3340;
    --primary: #5b9cff;
    --ok: #4cc584;
    --ok-bg: #16301f;
    --bad: #ff7b6e;
    --bad-bg: #3a1a17;
    --warn-bg: #3a3116;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.4;
}
.wrap { max-width: 520px; margin: 0 auto; padding: 16px; }
.wrap.ancho { max-width: 1100px; }
header.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
header.top h1 { font-size: 1.25rem; margin: 0; }
nav a { color: var(--primary); text-decoration: none; margin-left: 12px; font-size: .9rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.card h2 { font-size: 1.05rem; margin: 0 0 12px; }
.muted { color: var(--muted); font-size: .9rem; }
label { display: block; font-size: .85rem; color: var(--muted); margin: 10px 0 4px; }
input[type=text], input[type=number], input[type=tel] {
  width: 100%; padding: 12px; font-size: 1rem; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text);
}
input.pin { font-size: 2rem; text-align: center; letter-spacing: .4em; font-variant-numeric: tabular-nums; }
button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 16px; font-size: 1rem; font-weight: 600; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card); color: var(--text); cursor: pointer;
  text-decoration: none;
}
button:disabled { opacity: .5; cursor: default; }
button.primario { background: var(--primary); border-color: var(--primary); color: #fff; }
button.chico { padding: 6px 10px; font-size: .85rem; font-weight: 500; }
button.link { background: none; border: none; color: var(--primary); padding: 8px 0; font-weight: 500; }
button.peligro { color: var(--bad); }
.full { width: 100%; }
.fila { display: flex; gap: 10px; }
.fila > * { flex: 1; }
.tomar { display: flex; gap: 10px; margin-top: 10px; }
.tomar > button { min-height: 46px; }
.tomar > button:first-child { flex: 1; }
button.cuadrado { flex: 0 0 46px; width: 46px; padding: 0; }   /* cuadrado: tan ancho como alto */
.grande { padding: 22px 16px; font-size: 1.2rem; border-width: 2px; }
.grande.entrada { border-color: var(--ok); color: var(--ok); }
.grande.salida { border-color: var(--bad); color: var(--bad); }
.grande.sugerido.entrada { background: var(--ok); color: #fff; }
.grande.sugerido.salida { background: var(--bad); color: #fff; }
.msg { padding: 12px 14px; border-radius: 10px; margin: 12px 0 0; font-size: .95rem; }
.msg:empty { display: none; }
.msg.ok { background: var(--ok-bg); color: var(--ok); }
.msg.error { background: var(--bad-bg); color: var(--bad); }
.msg.info { background: var(--warn-bg); }
.camara { position: relative; width: 100%; aspect-ratio: 3 / 4; background: #000; border-radius: 12px; overflow: hidden; }
.camara video, .camara canvas, .camara img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.camara video.espejo { transform: scaleX(-1); }
.ovalo {
  position: absolute; left: 50%; top: 46%; width: 62%; aspect-ratio: 3 / 4; transform: translate(-50%, -50%);
  border: 3px dashed rgba(255,255,255,.7); border-radius: 50%; pointer-events: none;
}
.persona { display: flex; align-items: center; gap: 12px; }
.persona img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; background: var(--line); }
.persona b { font-size: 1.15rem; }
.pin-grande { font-size: 2.6rem; font-weight: 700; letter-spacing: .25em; text-align: center; font-variant-numeric: tabular-nums; margin: 8px 0; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; }
td img.mini { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; }
.tabla { overflow-x: auto; }
.chip { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .78rem; font-weight: 600; }
.chip.entrada { background: var(--ok-bg); color: var(--ok); }
.chip.salida { background: var(--bad-bg); color: var(--bad); }
.oculto { display: none !important; }
.estado { font-size: .85rem; color: var(--muted); margin-top: 8px; min-height: 1.2em; }
.pruebas { border-style: dashed; }
