body { padding-bottom: calc(92px + env(safe-area-inset-bottom)); }

.top {
  position: sticky; top: 0; z-index: 5;
  background: var(--primary); color: var(--on-primary);
  padding: calc(.7rem + env(safe-area-inset-top)) 16px .7rem;
}
.top-row { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; max-width: 560px; margin: 0 auto; }
.top h1 { font-size: 1.1rem; }
.step-label { font-size: .85rem; opacity: .85; white-space: nowrap; }
.bar { height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .25); margin: .55rem auto 0; max-width: 560px; overflow: hidden; }
#barFill { height: 100%; width: 0; background: #fff; border-radius: 4px; transition: width .25s ease; }

main { max-width: 560px; margin: 0 auto; padding: 18px 16px; display: grid; gap: 16px; }
.step { display: grid; gap: 16px; align-content: start; }
.muted { color: var(--muted); }

/* Resultados de búsqueda */
.results { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.results li {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: .75rem .9rem; cursor: pointer; display: grid; gap: .15rem;
}
.results li:active, .results li:focus-visible { border-color: var(--primary); background: var(--primary-soft); outline: none; }
.results .r-name { font-weight: 600; overflow-wrap: anywhere; }
.results .r-group { color: var(--muted); font-size: .85rem; }

/* Confirmación */
.sel { display: grid; gap: .3rem; }
.sel h2 { font-size: 1.25rem; overflow-wrap: anywhere; margin-bottom: .6rem; }
.sel .label { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.sel .grp { margin: 0; font-size: 1.1rem; font-weight: 600; color: var(--primary); }

/* Seriales */
.equip-list { display: grid; gap: 14px; }
.equip { display: grid; gap: .5rem; }
.equip .row { display: flex; gap: 8px; }
.equip .row .input { flex: 1; min-width: 0; text-transform: uppercase; }
.equip .scan { flex: none; width: 52px; padding: 0; }
.equip .scan svg { width: 24px; height: 24px; }
.equip .missing { display: flex; align-items: center; gap: .6rem; min-height: 44px; font-size: .95rem; cursor: pointer; }
.equip .missing input { width: 22px; height: 22px; accent-color: var(--primary); flex: none; }
.equip.is-missing .input { opacity: .45; text-decoration: line-through; }
.equip.is-missing .scan { opacity: .45; pointer-events: none; }
.equip.invalid { border-color: var(--danger); }
.equip h3 { font-size: 1rem; }

/* Foto */
.photo-drop {
  display: grid; place-items: center; min-height: 260px; border-radius: var(--radius);
  border: 2px dashed var(--border); background: var(--surface); color: var(--primary);
  cursor: pointer; overflow: hidden; text-align: center;
}
.photo-drop > span { display: grid; gap: .5rem; justify-items: center; }
.photo-drop img { width: 100%; max-height: 60vh; object-fit: contain; display: block; background: #000; }
.photo-drop.has-photo { border-style: solid; }

/* Sí / No */
.q { font-size: 1.3rem; }
.yesno { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.opt {
  min-height: 64px; border-radius: 14px; border: 2px solid var(--border); background: var(--surface);
  font-size: 1.2rem; font-weight: 700; cursor: pointer;
}
.opt[aria-checked="true"][data-val="yes"] { border-color: var(--ok); background: var(--ok-soft); color: var(--ok); }
.opt[aria-checked="true"][data-val="no"] { border-color: var(--danger); background: var(--danger-soft); color: var(--danger); }

/* Listo */
.done { text-align: center; justify-items: center; padding-top: 2rem; }
.check { width: 84px; height: 84px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); display: grid; place-items: center; }

/* Barra de acciones */
.actions {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex; gap: 12px; justify-content: center;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--surface); border-top: 1px solid var(--border);
}
.actions .btn { flex: 1; max-width: 272px; min-height: 52px; }
.actions .btn-primary { flex: 2; }

/* Escáner */
.scanner { position: fixed; inset: 0; z-index: 20; background: #000; color: #fff; display: flex; flex-direction: column; }
.scanner-head { display: flex; justify-content: space-between; align-items: center; padding: calc(12px + env(safe-area-inset-top)) 16px 12px; }
.scanner-head .btn { background: rgba(255, 255, 255, .15); color: #fff; border-color: transparent; }
#reader { flex: 1; min-height: 0; display: grid; align-content: center; }
#reader video { width: 100% !important; max-height: 70vh; object-fit: cover; }
.scanner-hint { text-align: center; padding: 14px 16px calc(18px + env(safe-area-inset-bottom)); margin: 0; font-size: .95rem; }
