/* Escáner KM43 — mismo sistema visual que la app, pensado para un celular
   en el mostrador: pocos elementos, contraste alto, targets grandes. */

@font-face { font-family: 'Blauer'; src: url('../fonts/BlauerNue-Medium.otf') format('opentype'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Blauer'; src: url('../fonts/BlauerNue-Bold.otf')   format('opentype'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Blauer'; src: url('../fonts/BlauerNue-Heavy.otf')  format('opentype'); font-weight: 900; font-display: swap; }
@font-face { font-family: 'SpaceMono'; src: url('../fonts/SpaceMono-Regular.ttf') format('truetype'); font-display: swap; }

:root {
  --ink-2: #070605;
  --surface: #0b0908;
  --cream: #efe2cc;
  --orange-b: #e85015;
  --ember: #b60a01;
  --warm-gray: #97907f;
  --ok: #7bd88f;
  --line: rgba(239, 226, 204, 0.16);
  --line-soft: rgba(239, 226, 204, 0.08);
  --grad-cta: linear-gradient(100deg, #521711 0%, #b60a01 38%, #e85015 100%);
  --display: 'Blauer', system-ui, sans-serif;
  --mono: 'SpaceMono', ui-monospace, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overscroll-behavior: none; }

body {
  background: var(--ink-2);
  color: var(--cream);
  font-family: var(--display);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; border: none; background: none; color: inherit; cursor: pointer; }
input { font-family: inherit; }

.label {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 2.4px;
  text-transform: uppercase;
  color: var(--warm-gray);
}
.mono { font-family: var(--mono); font-size: 11px; color: var(--warm-gray); line-height: 1.6; }

.screen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: max(20px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
  max-width: 520px;
  margin: 0 auto;
}

/* ---------------- login ---------------- */

.login { justify-content: center; gap: 16px; }
.login__logo { width: 128px; align-self: center; margin-bottom: 8px; }
.login__title { font-weight: 900; font-size: 26px; text-align: center; }
.login__sub { text-align: center; margin-bottom: 14px; }

.field { display: block; }
.field .label { display: block; margin-bottom: 7px; }
.input {
  width: 100%;
  height: 54px;
  background: rgba(239, 226, 204, 0.05);
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--cream);
  font-size: 16px; /* 16px o iOS hace zoom al enfocar */
  font-weight: 500;
  padding: 0 15px;
  outline: none;
}
.input:focus { border-color: var(--orange-b); box-shadow: 0 0 0 1px var(--orange-b); }

.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 56px; padding: 0 22px;
  border-radius: 999px; font-size: 16px; font-weight: 500;
}
.btn--primary { background: var(--grad-cta); color: #fff; }
.btn--ghost { border: 1px solid var(--line); color: var(--cream); }
.btn--ok { background: var(--ok); color: #06210d; font-weight: 700; }
.btn:disabled { opacity: 0.5; }
.btn--sm { min-height: 46px; font-size: 14px; }

/* ---------------- cámara ---------------- */

.cam { position: fixed; inset: 0; background: #000; }
.cam__video { width: 100%; height: 100%; object-fit: cover; }
.cam__video--mirror { transform: scaleX(-1); }

.cam__top {
  position: absolute; top: 0; left: 0; right: 0;
  padding: max(14px, env(safe-area-inset-top)) 16px 26px;
  background: linear-gradient(rgba(7,6,5,0.9), transparent);
  display: flex; align-items: center; gap: 12px;
}
.cam__logo { height: 15px; }
.cam__place { font-size: 13px; font-weight: 500; }
.cam__link { margin-left: auto; }

/* marco de encuadre */
.frame {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -54%);
  width: min(74vw, 300px); aspect-ratio: 1;
}
.frame__c { position: absolute; width: 34px; height: 34px; border: 3px solid var(--cream); }
.frame__c--tl { top: 0; left: 0; border-right: 0; border-bottom: 0; border-radius: 14px 0 0 0; }
.frame__c--tr { top: 0; right: 0; border-left: 0; border-bottom: 0; border-radius: 0 14px 0 0; }
.frame__c--bl { bottom: 0; left: 0; border-right: 0; border-top: 0; border-radius: 0 0 0 14px; }
.frame__c--br { bottom: 0; right: 0; border-left: 0; border-top: 0; border-radius: 0 0 14px 0; }
.frame--busy .frame__c { border-color: var(--orange-b); }

.cam__hint {
  position: absolute; left: 0; right: 0;
  bottom: max(34px, env(safe-area-inset-bottom));
  text-align: center; padding: 0 24px;
}
.cam__hint .mono { color: rgba(239, 226, 204, 0.75); }
.cam__manual {
  display: inline-block; padding: 10px 18px; border-radius: 999px;
  border: 1px solid var(--line); background: rgba(7, 6, 5, 0.5);
  color: var(--cream);
}

.cam__error {
  position: absolute; inset: auto 20px max(30px, env(safe-area-inset-bottom));
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 18px;
}

/* ---------------- resultado ---------------- */

.sheet {
  position: fixed; inset: 0; z-index: 20;
  background: var(--ink-2);
  display: flex; flex-direction: column;
  padding: max(22px, env(safe-area-inset-top)) 20px max(22px, env(safe-area-inset-bottom));
  overflow-y: auto;
  animation: rise 0.22s cubic-bezier(0.2, 0.8, 0.3, 1);
}
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }

.verdict { text-align: center; padding: 22px 0 18px; }
.verdict__mark {
  width: 76px; height: 76px; border-radius: 999px; margin: 0 auto 16px;
  display: grid; place-items: center; font-size: 36px; font-weight: 700;
}
.verdict__mark--ok  { background: rgba(123, 216, 143, 0.14); border: 2px solid var(--ok); color: var(--ok); }
.verdict__mark--bad { background: rgba(182, 10, 1, 0.16);   border: 2px solid var(--ember); color: #e8776a; }
.verdict__title { font-weight: 900; font-size: 27px; letter-spacing: -0.4px; }
.verdict__sub { margin-top: 8px; }

.member {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 18px; padding: 16px; margin-bottom: 16px;
}
.member__pic {
  width: 54px; height: 54px; border-radius: 999px; flex: none;
  background: rgba(239,226,204,0.08) center/cover no-repeat;
  border: 1px solid var(--line);
  display: grid; place-items: center; font-weight: 900; font-size: 20px;
}
.member__name { font-weight: 700; font-size: 18px; }
.member__meta { font-family: var(--mono); font-size: 10px; color: var(--warm-gray); margin-top: 5px; letter-spacing: 1px; }

.pick { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.pick__item {
  text-align: left; width: 100%;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  padding: 16px; display: flex; gap: 14px; align-items: center;
}
.pick__item--on { border-color: var(--orange-b); box-shadow: 0 0 0 1px var(--orange-b); }
.pick__item--off { opacity: 0.5; }
.pick__radio {
  width: 22px; height: 22px; border-radius: 999px; flex: none;
  border: 2px solid var(--line); display: grid; place-items: center;
}
.pick__item--on .pick__radio { border-color: var(--orange-b); }
.pick__item--on .pick__radio::after { content: ''; width: 10px; height: 10px; border-radius: 999px; background: var(--orange-b); }
.pick__title { font-weight: 500; font-size: 15px; line-height: 1.35; }
.pick__meta { font-family: var(--mono); font-size: 9.5px; color: var(--warm-gray); margin-top: 5px; letter-spacing: 0.6px; }
.pick__meta--bad { color: #e8776a; }

.sheet__foot { margin-top: auto; padding-top: 18px; display: flex; flex-direction: column; gap: 10px; }

.terms {
  background: rgba(239,226,204,0.04); border: 1px solid var(--line-soft);
  border-radius: 14px; padding: 14px; margin-bottom: 16px;
}

/* ---------------- historial ---------------- */

.list { flex: 1; }
.head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.head__title { font-weight: 900; font-size: 25px; }
.row {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 2px; border-bottom: 1px solid var(--line-soft);
}
.row__main { flex: 1; min-width: 0; }
.row__title { font-weight: 500; font-size: 14.5px; }
.row__sub { font-family: var(--mono); font-size: 9.5px; color: var(--warm-gray); margin-top: 4px; }
.empty { text-align: center; padding: 48px 20px; font-family: var(--mono); font-size: 11px; color: var(--warm-gray); line-height: 1.8; }

.back {
  width: 42px; height: 42px; border-radius: 999px; flex: none;
  border: 1px solid var(--line); display: grid; place-items: center; font-size: 17px;
}

.toast {
  position: fixed; left: 20px; right: 20px; bottom: max(22px, env(safe-area-inset-bottom));
  z-index: 60; background: var(--surface); border: 1px solid var(--line);
  border-left: 3px solid var(--ember); border-radius: 14px; padding: 14px 16px;
  font-size: 14px; font-weight: 500; box-shadow: 0 20px 44px -22px #000;
  animation: rise 0.2s ease;
}
