/* =============================================================================
 * iDSYSTEMS · RFID Field — mockup offline (TEMA CLARO)
 * Fondo blanco, logo negro (badge teal de marca). Estética instrumento de campo.
 * ========================================================================== */

:root {
  --bg:        #ffffff;
  --bg-2:      #f4f8f9;
  --panel:     #ffffff;
  --panel-2:   #f5f9fb;
  --line:      #e3edf0;
  --line-soft: rgba(0,70,86,.07);

  --brand:      #0a90ab;   /* teal señal (para contraste sobre blanco) */
  --brand-deep: #006174;   /* teal del logo */
  --near:       #10b489;   /* cerca / encontrado */
  --far:        #dd8b1e;   /* lejos / faltante */
  --unknown:    #7a6bf0;   /* desconocido */
  --danger:     #e5484d;

  --ink:     #0f2830;      /* texto principal (negro azulado) */
  --logo:    #1d1d1b;      /* negro del logo */
  --muted:   #5c757f;
  --muted-2: #9aafb6;

  --sans: 'Proxima Nova','Avenir Next','Segoe UI',system-ui,-apple-system,'Helvetica Neue',Arial,sans-serif;
  --mono: 'SF Mono','JetBrains Mono','Roboto Mono',Consolas,ui-monospace,monospace;

  --r-sm: 10px; --r-md: 16px; --r-lg: 22px; --r-pill: 999px;
  --shell: 480px;
  --tab-h: 68px;
  --shadow: 0 10px 30px -18px rgba(9,53,64,.55);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background:
    radial-gradient(120% 55% at 50% -8%, rgba(10,144,171,.08), transparent 60%),
    radial-gradient(90% 45% at 50% 118%, rgba(0,97,116,.06), transparent 60%),
    var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  letter-spacing: .1px;
}
button { font-family: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }

/* ── App shell ──────────────────────────────────────────────────────────── */
.app {
  max-width: var(--shell);
  height: 100vh;          /* fallback para WebViews viejos (Zebra Enterprise Browser) */
  height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;       /* el scroll vive SOLO en .stage → header y tabs siempre fijos */
  background: var(--bg);
  box-shadow: 0 0 60px -30px rgba(9,53,64,.25);
}

.topbar {
  flex: none; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: max(14px, env(safe-area-inset-top)) 18px 14px;
  background: var(--bg);
  box-shadow: 0 8px 18px -16px rgba(9,53,64,.5);
}
.logo { height: 22px; width: auto; display: block; }
.logo .lg-brand { fill: var(--brand-deep); }   /* badge teal */
.logo .lg-on    { fill: #fff; }                 /* "iD" dentro del badge */
.logo .lg-ink   { fill: var(--logo); }          /* "SYSTEMS" negro */

/* Status pill */
.pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 12px 7px 10px;
  font-size: 12px; font-weight: 600; letter-spacing: .2px;
  color: var(--muted);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
}
.pill__dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 0 currentColor; }
.pill--connecting { color: var(--muted); }
.pill--live { color: var(--near); border-color: color-mix(in oklab, var(--near) 40%, var(--line)); background: color-mix(in oklab, var(--near) 8%, #fff); }
.pill--demo { color: var(--far); border-color: color-mix(in oklab, var(--far) 40%, var(--line)); background: color-mix(in oklab, var(--far) 8%, #fff); }
.pill--live .pill__dot, .pill--demo .pill__dot { animation: breathe 2.4s ease-in-out infinite; }
/* Llegó una lectura del Bridge: eso —y solo eso— significa que el lector está leyendo. */
.pill--reading { color: #fff; border-color: var(--brand); background: var(--brand); }
.pill--reading .pill__dot { background: #fff; animation: breathe .5s ease-in-out infinite; }
@keyframes breathe { 0%,100% { box-shadow: 0 0 0 0 currentColor; opacity: 1 } 50% { box-shadow: 0 0 0 5px transparent; opacity: .45 } }

/* Aviso de estado del lector: solo aparece cuando algo impide que reporte lecturas. */
.lector { flex: none; margin: 0 18px 4px; padding: 8px 12px; border-radius: var(--r-sm); font-size: 12px;
  color: #8a3b00; background: color-mix(in oklab, var(--far) 14%, #fff);
  border: 1px solid color-mix(in oklab, var(--far) 40%, #fff); }

/* ── Stage / views ──────────────────────────────────────────────────────── */
.stage { flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain; padding: 4px 18px 20px; }
.view { display: none; animation: rise .4s cubic-bezier(.2,.7,.2,1) both; }
.view.is-active { display: block; }
@keyframes rise { from { opacity: 0; transform: translateY(10px) } to { opacity: 1; transform: none } }

.view__head { padding: 16px 2px 18px; }
.eyebrow {
  margin: 0 0 10px; font-size: 11px; font-weight: 700; letter-spacing: 2.4px;
  text-transform: uppercase; color: var(--brand);
  display: inline-flex; align-items: center; gap: 8px;
}
.eyebrow::before { content: ""; width: 22px; height: 2px; background: linear-gradient(90deg, var(--brand), transparent); }
.view__title { margin: 0; font-size: clamp(26px, 7vw, 32px); font-weight: 800; letter-spacing: -.6px; line-height: 1.05; color: var(--ink); }
.view__sub { margin: 8px 0 0; color: var(--muted); font-size: 14.5px; line-height: 1.5; max-width: 34ch; }

/* ── Search ─────────────────────────────────────────────────────────────── */
.search { display: flex; align-items: center; gap: 10px; padding: 0 14px; margin: 4px 0 16px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r-pill); }
.search__ico { width: 18px; height: 18px; fill: var(--muted-2); flex: none; }
.search input { flex: 1; border: 0; background: transparent; color: var(--ink); font-size: 15px; padding: 13px 0; }
.search input::placeholder { color: var(--muted-2); }
.search input:focus { outline: none; }

/* ── Cards (artículos) ──────────────────────────────────────────────────── */
.cards { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.card {
  display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 14px;
  padding: 14px; border-radius: var(--r-md);
  background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow);
  text-align: left; width: 100%; color: inherit;
  transition: transform .12s ease, border-color .2s ease, box-shadow .2s ease;
}
.card:active { transform: scale(.985); }
.card:hover { border-color: color-mix(in oklab, var(--brand) 45%, var(--line)); box-shadow: 0 14px 34px -18px rgba(10,144,171,.5); }
.card__thumb {
  width: 48px; height: 48px; flex: none; border-radius: 12px; overflow: hidden;
  border: 1px solid var(--line); background: var(--panel-2);
}
.card__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card__name { font-weight: 700; font-size: 15.5px; letter-spacing: -.2px; color: var(--ink); }
.card__meta { margin-top: 3px; font-size: 12.5px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; }
.card__meta .sku { color: var(--brand); font-family: var(--mono); font-size: 11.5px; }
.card__go { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%;
  color: var(--muted-2); border: 1px solid var(--line); }
.card__go svg { width: 15px; height: 15px; fill: currentColor; }
.card:hover .card__go { color: var(--brand); border-color: color-mix(in oklab, var(--brand) 45%, var(--line)); }

.empty { text-align: center; color: var(--muted-2); padding: 40px 10px; font-size: 14px; }

/* Artículo con EPC de demo (sin etiqueta real): ningún lector lo puede encontrar. */
.card--notag .card__thumb { opacity: .62; }
.card__warn { color: var(--far); font-weight: 600; }

/* ── Inventario ─────────────────────────────────────────────────────────── */
.inv { display: flex; align-items: center; gap: 20px; padding: 6px 4px 4px; }
.inv__gauge { position: relative; width: 132px; height: 132px; flex: none; }
.ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring__bg { fill: none; stroke: var(--line); stroke-width: 8; }
.ring__fill { fill: none; stroke: var(--brand); stroke-width: 8; stroke-linecap: round;
  stroke-dasharray: 327; stroke-dashoffset: 327;
  transition: stroke-dashoffset .5s cubic-bezier(.2,.7,.2,1), stroke .3s;
  filter: drop-shadow(0 2px 5px rgba(10,144,171,.35)); }
.inv__gaugeText { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.inv__pct { font-size: 30px; font-weight: 800; letter-spacing: -1px; color: var(--ink); }
.inv__pct small { font-size: 15px; color: var(--muted); font-weight: 700; }
.inv__pctLabel { font-size: 10.5px; color: var(--muted); letter-spacing: .3px; }

.inv__stats { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.stat { display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  padding: 10px 14px; border-radius: var(--r-sm); background: var(--panel-2); border: 1px solid var(--line); }
.stat__num { font-family: var(--mono); font-size: 22px; font-weight: 700; }
.stat__lbl { font-size: 12px; color: var(--muted); }
.u-found { color: var(--near); } .u-missing { color: var(--far); } .u-unknown { color: var(--unknown); }

.inv__actions { margin: 18px 0 14px; }

/* Contador crudo de lecturas: diagnóstico permanente de si el Bridge está reportando. */
.rx { margin: 0 0 12px; padding: 8px 12px; border-radius: var(--r-sm); text-align: center;
  font-size: 12.5px; color: var(--muted); background: var(--panel-2); border: 1px solid var(--line); }
.rx b { color: var(--ink); font-size: 14px; }
.rx .mono { font-size: 11px; }
.rx.is-on { color: var(--brand-deep); border-color: color-mix(in oklab, var(--near) 40%, var(--line));
  background: color-mix(in oklab, var(--near) 8%, #fff); }

/* ── Segmented ──────────────────────────────────────────────────────────── */
.seg { display: flex; gap: 4px; padding: 4px; background: var(--panel-2); border: 1px solid var(--line);
  border-radius: var(--r-pill); margin-bottom: 12px; }
.seg__btn { flex: 1; border: 0; background: transparent; color: var(--muted); font-size: 12.5px; font-weight: 600;
  padding: 9px 6px; border-radius: var(--r-pill); transition: color .2s, background .2s; }
.seg__btn.is-on { color: #fff; background: var(--brand); }

/* ── Rows (resultado inventario) ────────────────────────────────────────── */
.rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r-sm);
  background: var(--panel); border: 1px solid var(--line); animation: rise .3s ease both; }
.row__dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.row__thumb { width: 40px; height: 40px; flex: none; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--line); background: var(--panel-2); }
.row__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.row__body { flex: 1; min-width: 0; }
.row__name { display: block; font-weight: 650; font-size: 14px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row__epc { display: block; font-family: var(--mono); font-size: 11px; color: var(--muted-2); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row__chip { font-size: 10.5px; font-weight: 700; letter-spacing: .3px; text-transform: uppercase;
  padding: 4px 9px; border-radius: var(--r-pill); }
.chip-found  { color: var(--near);    background: color-mix(in oklab, var(--near) 12%, #fff);    border: 1px solid color-mix(in oklab, var(--near) 35%, var(--line)); }
.chip-miss   { color: var(--far);     background: color-mix(in oklab, var(--far) 12%, #fff);     border: 1px solid color-mix(in oklab, var(--far) 35%, var(--line)); }
.chip-unk    { color: var(--unknown); background: color-mix(in oklab, var(--unknown) 12%, #fff); border: 1px solid color-mix(in oklab, var(--unknown) 35%, var(--line)); }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  padding: 15px 18px; font-size: 15px; font-weight: 700; letter-spacing: .2px;
  border: 1px solid transparent; border-radius: var(--r-pill); color: var(--ink); background: var(--panel-2);
  transition: transform .1s ease, filter .2s ease, box-shadow .2s; }
.btn:active { transform: scale(.98); }
.btn--primary { color: #fff; background: linear-gradient(180deg, #17a7c4, var(--brand));
  box-shadow: 0 12px 26px -12px rgba(10,144,171,.8), inset 0 1px 0 rgba(255,255,255,.3); }
.btn--primary.is-scanning { color: var(--danger); background: var(--panel); border-color: color-mix(in oklab, var(--danger) 55%, #fff);
  box-shadow: none; }
.btn--danger { color: var(--danger); background: color-mix(in oklab, var(--danger) 8%, #fff); border-color: color-mix(in oklab, var(--danger) 45%, var(--line)); }
.btn--ghost { width: auto; padding: 12px 16px; background: var(--panel-2); border-color: var(--line); color: var(--muted); }

/* ── Bottom tabs ────────────────────────────────────────────────────────── */
.tabs { flex: none; z-index: 20; display: grid; grid-template-columns: 1fr 1fr;
  gap: 6px; padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  background: var(--bg); border-top: 1px solid var(--line);
  box-shadow: 0 -8px 18px -14px rgba(9,53,64,.45); }
.tab { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 10px 4px;
  border: 0; background: transparent; color: var(--muted-2); font-size: 11.5px; font-weight: 600; border-radius: 14px; }
.tab svg { width: 22px; height: 22px; fill: currentColor; transition: transform .2s; }
.tab.is-active { color: var(--brand); }
.tab.is-active svg { transform: translateY(-1px) scale(1.06); filter: drop-shadow(0 4px 8px rgba(10,144,171,.4)); }

/* ═══════════════════════════════════════════════════════════════════════════
 *  RADAR — la pieza distintiva
 * ══════════════════════════════════════════════════════════════════════════ */
.radar { position: fixed; inset: 0; z-index: 60; display: none; flex-direction: column;
  max-width: var(--shell); margin: 0 auto;
  background:
    radial-gradient(120% 70% at 50% 0%, rgba(10,144,171,.08), transparent 55%),
    var(--bg);
  padding-bottom: env(safe-area-inset-bottom); }
.radar.is-open { display: flex; animation: rise .35s ease both; }

.radar__bar { display: grid; grid-template-columns: 40px 1fr 40px; align-items: center;
  padding: max(14px, env(safe-area-inset-top)) 16px 8px; }
.radar__close { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--ink); }
.radar__close svg { width: 20px; height: 20px; }
.radar__crumb { text-align: center; font-size: 12px; font-weight: 700; letter-spacing: 2px;
  text-transform: uppercase; color: var(--muted); }

.radar__hero { flex: 1; display: grid; place-items: center; padding: 8px 20px; }

/* Termómetro de señal. --sig (color) y --prox (0..1) los setea el JS.
 * Sin barrido giratorio a propósito: el RFID no da rumbo y esa animación lo insinuaba. */
.scope { --sig: var(--far); --prox: 0;
  position: relative; width: min(88vw, 380px); display: grid; gap: 18px; justify-items: center; }

/* Tendencia — el dato accionable: ¿subo o bajo? */
.trend { display: flex; align-items: center; gap: 10px; margin: 0; padding: 10px 18px;
  border-radius: var(--r-pill); font-size: 14px; font-weight: 800; letter-spacing: .3px;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--muted);
  transition: color .2s ease, background .2s ease, border-color .2s ease; }
.trend__arrow { font-size: 17px; line-height: 1; transition: transform .2s ease; }
.trend[data-dir="up"] { color: var(--near); background: color-mix(in oklab, var(--near) 12%, #fff);
  border-color: color-mix(in oklab, var(--near) 45%, var(--line)); }
.trend[data-dir="down"] { color: var(--far); background: color-mix(in oklab, var(--far) 12%, #fff);
  border-color: color-mix(in oklab, var(--far) 45%, var(--line)); }
.trend[data-dir="down"] .trend__arrow { transform: rotate(180deg); }
.trend[data-dir="flat"] { color: var(--brand-deep); background: color-mix(in oklab, var(--brand) 8%, #fff);
  border-color: color-mix(in oklab, var(--brand) 35%, var(--line)); }
.trend[data-dir="none"] { animation: idlePulse 2.2s ease-in-out infinite; }
@keyframes idlePulse { 0%,100% { opacity: 1 } 50% { opacity: .72 } }

/* Barra vertical + lectura numérica al costado */
.meter { display: flex; align-items: stretch; gap: 22px; width: 100%; justify-content: center; }
.meter__track { position: relative; width: 74px; height: min(38vh, 260px); border-radius: 18px;
  background: linear-gradient(180deg, var(--panel-2), #fff); border: 1px solid var(--line); overflow: hidden; }
.meter__fill { position: absolute; left: 0; right: 0; bottom: 0; height: calc(var(--prox) * 100%);
  background: linear-gradient(180deg, var(--sig), color-mix(in oklab, var(--sig) 70%, #fff));
  box-shadow: 0 0 26px color-mix(in oklab, var(--sig) 55%, transparent);
  transition: height .12s linear, background .25s ease; }
/* Marca del máximo alcanzado: la referencia para saber si mejoraste respecto a antes. */
.meter__peak { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--ink);
  opacity: .55; transition: bottom .25s ease; }
.meter__peak span { position: absolute; right: 4px; bottom: 3px; font-size: 9.5px; font-weight: 700;
  letter-spacing: .5px; color: var(--ink); white-space: nowrap; }
.meter__side { display: flex; flex-direction: column; justify-content: center; gap: 6px; min-width: 118px; }
.meter__pct { font-size: 54px; font-weight: 800; letter-spacing: -3px; color: var(--ink); line-height: .95; }
.meter__pct small { font-size: 22px; color: var(--muted); letter-spacing: 0; }
.meter__state { font-size: 12.5px; font-weight: 800; letter-spacing: 1.6px; text-transform: uppercase; color: var(--sig); }

.radar__tip { margin: 0; text-align: center; font-size: 12.5px; line-height: 1.45; color: var(--muted); max-width: 300px; }

.scope[data-state="found"] .meter__track { animation: locked .5s ease; }
@keyframes locked { 0% { transform: scale(1) } 40% { transform: scale(1.04) } 100% { transform: scale(1) } }
.scope[data-state="idle"] .meter__fill { background: var(--muted-2); box-shadow: none; }
.scope[data-state="idle"] .meter__pct { color: var(--muted-2); }

.radar__meta { display: flex; align-items: center; justify-content: space-between; gap: 14px;
  margin: 0 20px; padding: 14px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow); }
.radar__thumb { width: 52px; height: 52px; flex: none; border-radius: 12px; overflow: hidden;
  border: 1px solid var(--line); background: var(--panel-2); }
.radar__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.radar__art { flex: 1; min-width: 0; }
.radar__art h2 { margin: 0 0 4px; font-size: 16px; font-weight: 700; color: var(--ink); }
.radar__art p { margin: 0; font-size: 11.5px; color: var(--muted); }
.mono { font-family: var(--mono); }
.radar__signal { text-align: right; flex: none; }
.radar__signalLbl { display: block; font-size: 10px; letter-spacing: 1.5px; color: var(--muted-2); text-transform: uppercase; }
.radar__signal .mono { font-size: 18px; font-weight: 700; color: var(--sig, var(--brand)); }
.radar__rate { display: block; font-size: 10.5px; color: var(--muted-2); margin-top: 2px; }
.radar__footRow .btn--ghost { padding-left: 12px; padding-right: 12px; font-size: 13px; }

.radar__foot { display: flex; flex-direction: column; gap: 10px; padding: 14px 20px calc(18px + env(safe-area-inset-bottom)); }
.radar__footRow { display: flex; gap: 10px; }
.radar__footRow .btn--danger { flex: 1; }
.radar__footRow .btn--ghost { flex: none; }

/* Estado de lectura: dice si están llegando lecturas de ESTE tag. No hay nada que mantener
 * apretado — la app solo escucha lo que el Bridge reporta. */
.radar__lect { display: flex; align-items: center; justify-content: center; gap: 9px; margin: 2px 0 0;
  padding: 12px 14px; border-radius: var(--r-md); background: var(--panel-2);
  border: 1px dashed color-mix(in oklab, var(--brand) 30%, var(--line));
  color: var(--muted); font-size: 13.5px; font-weight: 600; }
.radar__lect::before { content: ''; width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--muted-2); }
.radar__lect.is-on { color: var(--brand-deep); border-style: solid;
  border-color: color-mix(in oklab, var(--near) 45%, var(--line)); background: color-mix(in oklab, var(--near) 8%, #fff); }
.radar__lect.is-on::before { background: var(--near); animation: pulseDot 1s ease-in-out infinite; }
@keyframes pulseDot { 50% { opacity: .25; transform: scale(.75); } }

/* ── Toast ──────────────────────────────────────────────────────────────── */
.toast { position: fixed; left: 50%; bottom: calc(var(--tab-h) + 20px); transform: translate(-50%, 20px);
  z-index: 80; padding: 12px 18px; border-radius: var(--r-pill); font-size: 13.5px; font-weight: 600;
  background: var(--ink); border: 1px solid var(--ink); color: #fff; box-shadow: 0 14px 40px -14px rgba(9,53,64,.55);
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; max-width: 88%; text-align: center; }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ── Top bar: botón asignar ─────────────────────────────────────────────── */
.topbar__right { display: flex; align-items: center; gap: 10px; }
.iconbtn { width: 38px; height: 38px; flex: none; display: grid; place-items: center; border-radius: 12px;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--brand);
  transition: transform .1s ease, border-color .2s; }
.iconbtn svg { width: 20px; height: 20px; fill: currentColor; }
.iconbtn:active { transform: scale(.95); }
.iconbtn:hover { border-color: color-mix(in oklab, var(--brand) 45%, var(--line)); }

/* ── Sheet: asignar etiquetas ───────────────────────────────────────────── */
.sheet { position: fixed; inset: 0; z-index: 60; display: none; flex-direction: column;
  max-width: var(--shell); margin: 0 auto; background: var(--bg); }
.sheet.is-open { display: flex; animation: rise .3s ease both; }
.sheet__bar { flex: none; display: grid; grid-template-columns: 40px 1fr 40px; align-items: center;
  padding: max(14px, env(safe-area-inset-top)) 16px 8px; }
.sheet__body { flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain; padding: 4px 18px 16px; }
.sheet__foot { flex: none; display: flex; padding: 12px 18px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line); box-shadow: 0 -8px 18px -14px rgba(9,53,64,.45); }

.assign__hero { text-align: center; padding: 8px 4px 12px; }
.assign__count { margin: 0 0 8px; font-size: 14px; color: var(--muted); }
.assign__count b { color: var(--ink); font-size: 16px; }
.assign__bar { height: 8px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line);
  overflow: hidden; margin: 0 0 16px; }
.assign__barFill { display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--brand), var(--near)); transition: width .4s cubic-bezier(.2,.7,.2,1); }
.assign__hint { margin: 12px 0 0; font-size: 12.5px; color: var(--muted); min-height: 1.2em; }
.assign__warn { margin: 10px 0 0; padding: 8px 10px; border-radius: var(--r-sm); font-size: 12.5px;
  color: #8a3b00; background: color-mix(in oklab, var(--far) 14%, #fff); border: 1px solid color-mix(in oklab, var(--far) 40%, #fff); }
.sheet__foot .btn { width: 100%; justify-content: center; }

.row__epc--empty { color: var(--muted-2); font-style: italic; font-family: var(--sans); }
.row__x { width: 30px; height: 30px; flex: none; display: grid; place-items: center; border-radius: 50%;
  background: transparent; border: 1px solid var(--line); color: var(--muted-2); }
.row__x svg { width: 15px; height: 15px; }
.row__x:active { transform: scale(.94); }

/* ── Estado del lector (diagnóstico, se abre desde el pill) ─────────────── */
.estado__ok, .estado__bad { padding: 12px 14px; border-radius: var(--r-md); font-size: 13px; margin-bottom: 14px; }
.estado__ok { color: var(--brand-deep); background: color-mix(in oklab, var(--near) 10%, #fff);
  border: 1px solid color-mix(in oklab, var(--near) 40%, var(--line)); }
.estado__bad { color: #8a3b00; background: color-mix(in oklab, var(--far) 12%, #fff);
  border: 1px solid color-mix(in oklab, var(--far) 40%, var(--line)); }
.estado__bad ul { margin: 8px 0 0; padding-left: 18px; }
.estado__bad li { margin-top: 4px; }
.estado__list { display: grid; grid-template-columns: auto 1fr; gap: 0; margin: 0; font-size: 13px; }
.estado__list dt { padding: 8px 0; color: var(--muted); border-bottom: 1px solid var(--line); }
.estado__list dd { padding: 8px 0; margin: 0; text-align: right; font-weight: 600; color: var(--ink);
  border-bottom: 1px solid var(--line); }
.estado__raw { margin: 14px 0 0; padding: 10px; border-radius: var(--r-sm); font-size: 10.5px;
  color: var(--muted); background: var(--panel-2); word-break: break-all; }

/* ── Panel de diagnóstico (?debug=1) ────────────────────────────────────────
 * Log crudo del Bridge para depurar en el handheld, donde no hay devtools. */
.dbg { position: fixed; left: 0; right: 0; bottom: 0; z-index: 90; max-height: 42vh;
  display: flex; flex-direction: column; background: rgba(15,40,48,.96); color: #d7e6ea;
  font: 11px/1.35 var(--mono); border-top: 2px solid var(--brand); }
.dbg.is-min .dbg__list { display: none; }
.dbg__bar { display: flex; align-items: center; gap: 8px; padding: 6px 10px;
  border-bottom: 1px solid rgba(255,255,255,.12); }
.dbg__bar b { color: #fff; letter-spacing: .04em; margin-right: auto; }
.dbg__btn { padding: 4px 9px; border-radius: var(--r-pill); border: 1px solid rgba(255,255,255,.25);
  background: transparent; color: inherit; font: inherit; }
.dbg__list { overflow: auto; padding: 4px 10px calc(6px + env(safe-area-inset-bottom)); margin: 0; list-style: none;
  -webkit-overflow-scrolling: touch; }
.dbg__li { padding: 3px 0; border-bottom: 1px solid rgba(255,255,255,.06); word-break: break-all; }
.dbg__li--rx { color: #8fe3c6; }
.dbg__li--tx { color: #ffd08a; }

/* ── Responsive / accesibilidad ─────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .scope__sweep::before { display: none; }
}

/* ── Pantallas BAJAS (handhelds tipo Zebra WC330) ───────────────────────────
 * Compacta header, títulos y la barra de tabs para que los botones de abajo
 * no se coman el contenido. Se activa por ALTURA disponible, no por ancho. */
@media (max-height: 720px) {
  :root { --tab-h: 56px; }
  .topbar { padding-top: max(8px, env(safe-area-inset-top)); padding-bottom: 8px; }
  .stage { padding-top: 2px; padding-bottom: 14px; }
  .view__head { padding: 8px 2px 10px; }
  .eyebrow { margin-bottom: 6px; }
  .view__title { font-size: clamp(21px, 5.5vw, 26px); }
  .view__sub { font-size: 13px; margin-top: 5px; }
  .search { margin-bottom: 12px; }
  .inv__gauge { width: 108px; height: 108px; }
  .inv__actions { margin: 12px 0 10px; }
  .btn { padding: 12px 16px; font-size: 14px; }

  .tabs { padding-top: 5px; padding-bottom: calc(5px + env(safe-area-inset-bottom));
    background: var(--bg); }
  .tab { padding: 7px 4px; font-size: 11px; gap: 3px; }
  .tab svg { width: 20px; height: 20px; }
}

/* Muy baja (típico apaisado / pantallas chicas): tabs horizontales y menos texto. */
@media (max-height: 520px) {
  :root { --tab-h: 46px; }
  .stage { padding-bottom: 10px; }
  .view__head { padding: 6px 2px 8px; }
  .eyebrow { display: none; }
  .view__sub { display: none; }
  .view__title { font-size: 20px; }
  .inv { gap: 14px; }
  .inv__gauge { width: 92px; height: 92px; }

  .tabs { grid-template-columns: 1fr 1fr; padding: 4px 10px calc(4px + env(safe-area-inset-bottom)); }
  .tab { flex-direction: row; gap: 8px; padding: 8px 4px; }
  .tab svg { width: 18px; height: 18px; }
}

/* El radar en pantallas bajas: el termómetro se acuesta para no comerse el alto. */
@media (max-height: 720px) {
  .scope { gap: 12px; }
  .meter__track { height: min(30vh, 190px); width: 62px; }
  .meter__pct { font-size: 44px; }
  .radar__tip { font-size: 11.5px; }
}
@media (max-height: 560px) {
  .radar__tip { display: none; }
  .trend { padding: 7px 14px; font-size: 13px; }
  .meter { gap: 16px; }
  .meter__track { height: min(26vh, 150px); width: 54px; }
  .meter__pct { font-size: 36px; }
  .meter__side { min-width: 96px; }
  .radar__meta { padding-top: 6px; padding-bottom: 6px; }
}
