html, body { height: 100%; }
body { overscroll-behavior: none; }
#app { max-width: 560px; margin: 0 auto; min-height: 100%; display: flex; flex-direction: column;
  padding: env(safe-area-inset-top, 0px) max(16px, env(safe-area-inset-left, 0px)) 0 max(16px, env(safe-area-inset-right, 0px)); }

/* Pantallas de acceso */
.gate { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 20px; padding-block: 24px; }
.gate img.logo { width: 132px; height: auto; align-self: center; background: #fff; border-radius: 22px; padding: 12px; }
.gate h1 { text-align: center; }
.gate .sub { text-align: center; color: var(--muted); }
.codeinput { text-align: center; font-size: 1.6rem !important; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; }
.msg { padding: 12px 14px; border-radius: var(--radius-sm); font-weight: 600; font-size: .92rem; }
.msg.bad { background: var(--bad-bg); color: var(--bad); } .msg.warn { background: var(--warn-bg); color: var(--warn); } .msg.info { background: var(--info-bg); color: var(--info); }

.pindots { display: flex; justify-content: center; gap: 14px; min-height: 22px; }
.pindots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--brand); }
.pindots i.on { background: var(--brand); }
.pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 320px; width: 100%; margin: 0 auto; }
.pad button { height: 64px; border-radius: 18px; border: 1.5px solid var(--line); background: var(--surface); font-size: 1.5rem; font-weight: 700; }
.pad button:active { background: var(--brand-soft); }
.pad button.fn { font-size: 1rem; color: var(--muted); }

/* Encabezado y resumen */
.top { position: sticky; top: 0; z-index: 20; background: var(--bg); padding: 12px 0 8px; display: flex; flex-direction: column; gap: 10px;
  padding-top: calc(12px + env(safe-area-inset-top, 0px)); margin-top: calc(-1 * env(safe-area-inset-top, 0px)); }
.top .brand { display: flex; align-items: center; gap: 10px; }
.top .brand img { width: 40px; height: 40px; object-fit: contain; background: #fff; border-radius: 10px; padding: 2px; }
.top .brand .t1 { font-weight: 800; line-height: 1.15; } .top .brand .t2 { font-size: .8rem; color: var(--muted); }
.netchip { border: 0; cursor: pointer; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: var(--surface); border: 1.5px solid var(--line); border-radius: 14px; padding: 10px 8px; text-align: center; }
.stat b { display: block; font-size: 1.6rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat span { font-size: .72rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.stat.sel { border-color: var(--brand); background: var(--brand-soft); }
.stat.sel span { color: var(--brand-ink); }
.list { display: flex; flex-direction: column; gap: 8px; padding-bottom: calc(110px + env(safe-area-inset-bottom, 0px)); }
.wrow { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; width: 100%; text-align: left; }
.wrow:active { background: var(--surface2); }
.wrow .nm { font-weight: 700; line-height: 1.2; } .wrow .sb { font-size: .8rem; color: var(--muted); }
.wrow.yo .avatar { background: var(--btn-bg); color: var(--btn-fg); }

.bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; padding: 10px max(16px, env(safe-area-inset-right, 0px)) calc(10px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  background: linear-gradient(to top, var(--bg) 70%, transparent); }
.bar .in { max-width: 560px; margin: 0 auto; display: flex; gap: 10px; }
.bar .btn.lg { flex: 1; }

/* Cámara */
.cam { position: fixed; inset: 0; overflow: hidden; z-index: 80; background: #000; color: #fff; display: flex; flex-direction: column; }
.cam video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.cam .ring { position: absolute; left: 50%; top: 44%; width: min(72vw, 330px); aspect-ratio: 3 / 4; transform: translate(-50%, -50%); border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, .8); box-shadow: 0 0 0 150vmax rgba(0, 0, 0, .58); transition: border-color .15s; pointer-events: none; }
.cam.found .ring { border-color: #5DC169; } .cam.fail .ring { border-color: #FF6B5E; }
.cam .hd { position: relative; z-index: 2; display: flex; align-items: center; gap: 10px; padding: calc(12px + env(safe-area-inset-top, 0px)) 14px 10px; background: linear-gradient(rgba(0, 0, 0, .65), transparent); }
.cam .hd .ttl { flex: 1; font-weight: 800; }
.cam .seg { display: flex; background: rgba(255, 255, 255, .18); border-radius: 12px; padding: 3px; }
.cam .seg button { border: 0; background: transparent; color: #fff; font-weight: 700; padding: 6px 12px; border-radius: 9px; font-size: .85rem; }
.cam .seg button.on { background: #fff; color: #0b2a12; }
.cam .x { border: 0; width: 40px; height: 40px; border-radius: 50%; background: rgba(255, 255, 255, .2); color: #fff; font-size: 1.3rem; }
.cam .ft { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; padding: 16px 16px calc(18px + env(safe-area-inset-bottom, 0px)); background: linear-gradient(transparent, rgba(0, 0, 0, .75)); display: flex; flex-direction: column; gap: 10px; align-items: center; text-align: center; }
.cam .status { font-size: 1.1rem; font-weight: 700; min-height: 1.6em; }
.cam .res { position: absolute; left: 14px; right: 14px; top: 50%; transform: translateY(-50%); z-index: 4; border-radius: 22px; padding: 22px 18px; text-align: center; box-shadow: 0 10px 40px rgba(0, 0, 0, .5); animation: pop .18s ease-out; }
.cam .res.ok { background: #1E7A2E; } .cam .res.warn { background: #8F5200; } .cam .res.bad { background: #A3261E; }
.cam .res .big { font-size: 1.7rem; font-weight: 800; line-height: 1.15; margin-top: 4px; }
.cam .res .kind { font-size: 1rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; opacity: .92; }
.cam .res .tm { font-size: 2.2rem; font-weight: 800; font-variant-numeric: tabular-nums; margin-top: 6px; }
.cam .dots { display: flex; gap: 8px; justify-content: center; }
.cam .dots i { width: 14px; height: 14px; border-radius: 50%; background: rgba(255, 255, 255, .3); }
.cam .dots i.on { background: #5DC169; }
.cam .last { font-size: .85rem; opacity: .85; }
.cam .btn { background: rgba(255, 255, 255, .15); border-color: transparent; color: #fff; }
