/* Lector NFC — identidad TechMarketDigital v1
   Plano, esquinas rectas, sin degradados ni sombras. Amarillo solo como acento. Sin verde. */

:root {
  --negro: #14181B;
  --amarillo: #F2B705;
  --papel: #F2EFE6;
  --azul: #1B3A4B;
  --acero: #7A848C;
  --rojo: #C6362B;

  /* Tema oscuro (fondo principal de la marca) */
  --bg: var(--negro);
  --surface: #1B2024;
  --surface-2: #232A2F;
  --border: #2E363C;
  --text: var(--papel);
  --muted: #9AA3AA;
  --line: var(--acero);
  --accent: var(--amarillo);
  --on-accent: var(--negro);
  --info-bg: var(--azul);
  --on-info: var(--papel);
  --danger: #E0584C;
  --danger-bg: var(--rojo);
  --on-danger: var(--papel);
  color-scheme: dark;

  --font: 'Archivo', system-ui, sans-serif;
  --tab-h: 64px;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: var(--papel);
    --surface: #FAF8F2;
    --surface-2: #E9E5D9;
    --border: #D6D0C1;
    --text: var(--negro);
    --muted: #59626A;
    --danger: var(--rojo);
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: var(--papel);
  --surface: #FAF8F2;
  --surface-2: #E9E5D9;
  --border: #D6D0C1;
  --text: var(--negro);
  --muted: #59626A;
  --danger: var(--rojo);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; border-radius: 0; }
html { -webkit-text-size-adjust: 100%; }
html.big { font-size: 118%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-stretch: 115%;
  font-weight: 400;
  line-height: 1.45;
  min-height: 100dvh;
  padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 16px);
  -webkit-tap-highlight-color: transparent;
}
body.noscroll { overflow: hidden; }
h1, h2, h3 { font-stretch: 118%; font-weight: 800; letter-spacing: -0.5px; line-height: 1.15; margin: 0; }
h1 { font-size: 1.75rem; font-weight: 900; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }
p { margin: 0.35em 0; }
b { font-weight: 700; }
code, .mono { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-stretch: 100%; font-size: 0.85em; }
button, input, select, textarea { font: inherit; font-stretch: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
.center { text-align: center; justify-content: center; }
.grow { flex: 1; min-width: 0; }
.pre { white-space: pre-wrap; }
.break { overflow-wrap: anywhere; }
.err { color: var(--danger); font-weight: 600; }
.i { width: 1.2em; height: 1.2em; flex: none; }
.i.tiny { width: 0.95em; height: 0.95em; vertical-align: -2px; }
.label, .group {
  font-stretch: 115%; font-weight: 500; font-size: 0.75rem;
  text-transform: uppercase; letter-spacing: 1.8px; color: var(--muted);
}
.group { margin: 26px 0 10px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Barra superior ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; text-decoration: none; }
.brand .logo { width: 30px; height: 30px; }
.brand-name { font-stretch: 118%; font-weight: 900; font-size: 1.05rem; letter-spacing: -0.5px; white-space: nowrap; }
.brand-sub { display: block; font-size: 0.66rem; font-weight: 500; letter-spacing: 1.6px; text-transform: uppercase; color: var(--muted); }
.logo .lg-a { fill: var(--text); }
.logo .lg-y { fill: var(--amarillo); }
.top-actions { display: flex; align-items: center; gap: 6px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 9px; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.4px;
  border: 1px solid var(--border); color: var(--muted); white-space: nowrap;
}
.pill.on { color: var(--text); border-color: var(--accent); }
.dot { width: 8px; height: 8px; background: var(--accent); display: inline-block; animation: blink 1.6s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0.25; } }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px;
  background: transparent; border: 1px solid transparent; color: var(--text);
}
.icon-btn:hover { border-color: var(--border); }
.icon-btn.sm { width: 30px; height: 30px; }

/* ---------- Contenido ---------- */
main { max-width: 760px; margin: 0 auto; padding: 16px; }
.view { display: flex; flex-direction: column; gap: 14px; }
.view > .group { margin-bottom: -4px; }
.view-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.view-head p { max-width: 46ch; }

.card { background: var(--surface); border: 1px solid var(--border); padding: 16px; }
.card.notice { display: flex; gap: 14px; align-items: flex-start; border-left: 4px solid var(--accent); }
.card.notice > .i { width: 32px; height: 32px; color: var(--accent); }
.sub-card { border: 1px solid var(--border); background: var(--surface-2); padding: 12px; margin-top: 12px; }
.sub-card h3 { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 44px; padding: 0 16px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  font-weight: 600; letter-spacing: 0.2px; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--line); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 800; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; }
.btn.danger { background: var(--danger-bg); border-color: var(--danger-bg); color: var(--on-danger); }
.btn.sm { min-height: 36px; padding: 0 11px; font-size: 0.85rem; }
.btn.big { min-height: 52px; padding: 0 28px; font-size: 1.05rem; }
.danger-text { color: var(--danger) !important; }
.link { background: none; border: 0; padding: 0; color: var(--text); text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 3px; font-weight: 600; }
.row { display: flex; gap: 10px; align-items: center; margin-top: 14px; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.row.center { justify-content: center; }

/* ---------- Escanear ---------- */
.scan-hero { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 28px 0 8px; }
.scan-btn {
  width: 190px; height: 190px; display: grid; place-content: center; justify-items: center; gap: 12px;
  background: var(--surface); border: 2px solid var(--accent); color: var(--text);
  font-stretch: 118%; font-weight: 800; font-size: 1.1rem;
}
.scan-btn .i { width: 64px; height: 64px; color: var(--accent); }
.scan-btn:active { background: var(--surface-2); }
.radar { position: relative; width: 190px; height: 190px; display: grid; place-items: center; }
.radar > .i { width: 64px; height: 64px; color: var(--accent); position: relative; z-index: 1; }
.radar::before { content: ''; position: absolute; inset: 55px; background: var(--surface); border: 2px solid var(--accent); }
.radar i { position: absolute; inset: 55px; border: 2px solid var(--line); animation: pulse 2.4s linear infinite; opacity: 0; }
.radar i:nth-of-type(2) { animation-delay: 0.8s; }
.radar i:nth-of-type(3) { animation-delay: 1.6s; }
@keyframes pulse { 0% { transform: scale(1); opacity: 0.9; } 100% { transform: scale(2.3); opacity: 0; } }
.radar.sm { width: 130px; height: 130px; margin: 6px auto 10px; }
.radar.sm::before, .radar.sm i { inset: 35px; }
.radar.sm > .i { width: 44px; height: 44px; }
.demo { margin-top: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip {
  padding: 8px 13px; background: transparent; border: 1px solid var(--border);
  font-size: 0.86rem; font-weight: 500; white-space: nowrap;
}
.chip:hover { border-color: var(--line); }
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); font-weight: 700; }
.again { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--muted); font-size: 0.85rem; }

/* Resultado */
.result { border-top: 4px solid var(--line); }
.result.warn { border-top-color: var(--accent); }
.result.danger { border-top-color: var(--rojo); }
.res-head { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.res-emoji { width: 48px; height: 48px; display: grid; place-items: center; background: var(--surface-2); font-size: 1.6rem; }
.res-emoji .i { width: 26px; height: 26px; color: var(--accent); }
.badge { display: inline-block; padding: 1px 6px; font-size: 0.68rem; font-weight: 700; letter-spacing: 1px; background: var(--text); color: var(--bg); vertical-align: 1px; }
.badge.soft { background: var(--surface-2); color: var(--text); letter-spacing: 0.2px; font-weight: 600; }

.banner { display: flex; gap: 12px; padding: 12px 14px; margin-bottom: 12px; }
.banner > .i { width: 22px; height: 22px; margin-top: 2px; }
.banner p { margin: 2px 0 0; }
.banner ul { margin: 8px 0 4px; padding-left: 18px; }
.banner li { margin: 3px 0; }
.banner .link { display: inline-block; margin-top: 6px; color: inherit; }
.banner.ok { background: var(--info-bg); color: var(--on-info); }
.banner.warn { background: var(--surface-2); border-left: 4px solid var(--accent); }
.banner.warn > .i { color: var(--accent); }
.banner.danger { background: var(--danger-bg); color: var(--on-danger); }
.banner.danger .link { text-decoration-color: var(--papel); }

.rec { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.rec:first-of-type { border-top: 0; }
.rec-ic { width: 40px; height: 40px; flex: none; display: grid; place-items: center; background: var(--surface-2); }
.rec-ic .i { color: var(--text); }
.rec-t { margin: 0; font-size: 0.72rem; font-weight: 500; letter-spacing: 1.6px; text-transform: uppercase; color: var(--muted); }
.rec-v { margin: 2px 0 4px; font-size: 1.05rem; font-weight: 600; }
.acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

.tools { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; margin-top: 14px; }
.tool {
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px;
  padding: 11px; background: transparent; border: 1px solid var(--border);
  font-size: 0.82rem; font-weight: 600; text-align: left;
}
.tool:hover { border-color: var(--line); }
.tool .i { color: var(--accent); }

.tech { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 10px; }
.tech summary { cursor: pointer; font-weight: 600; font-size: 0.88rem; color: var(--muted); }
.tech dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 12px 0; font-size: 0.88rem; }
.tech dt { color: var(--muted); }
.tech dd { margin: 0; overflow-wrap: anywhere; }
.hex { margin: 8px 0; font-size: 0.8rem; }
.hex code { display: block; margin-top: 4px; padding: 8px; background: var(--surface-2); overflow-wrap: anywhere; color: var(--muted); }

.ran { list-style: none; margin: 0; padding: 0; }
.ran li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); font-size: 0.9rem; }
.ran li:first-child { border-top: 0; }
.ran li.error { color: var(--danger); }
.ran .st .i { width: 18px; height: 18px; }

/* ---------- Escribir ---------- */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tpl {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  padding: 14px; background: var(--surface); border: 1px solid var(--border); text-align: left;
}
.tpl:hover { border-color: var(--line); }
.tpl:active { background: var(--surface-2); }
.tpl b { font-stretch: 118%; font-weight: 800; letter-spacing: -0.3px; margin-top: 6px; }
.tpl small { color: var(--muted); font-size: 0.8rem; line-height: 1.35; }
.tpl-ic { width: 38px; height: 38px; display: grid; place-items: center; background: var(--surface-2); }
.tpl-ic .i { color: var(--accent); }
.back { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; padding: 4px 0; font-weight: 600; color: var(--muted); align-self: flex-start; }
.form-head { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; }
.clone { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; border-left: 4px solid var(--accent); }
.clone > .i { color: var(--accent); width: 26px; height: 26px; }
.clone .row { margin: 0; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 0.78rem; font-weight: 500; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); }
.field.compact { margin-bottom: 8px; }
.field.compact > span { font-size: 0.7rem; }
input, select, textarea {
  width: 100%; min-height: 46px; padding: 10px 12px;
  background: var(--bg); border: 1px solid var(--border);
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
.inrow { display: flex; gap: 8px; }
.inrow input, .inrow select { flex: 1; min-width: 0; }
.inrow .btn { min-height: 46px; }
.hint { font-size: 0.85rem; color: var(--muted); border-left: 3px solid var(--line); padding-left: 10px; margin: 0 0 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.check { display: flex; align-items: center; gap: 10px; padding: 8px 0; font-weight: 500; }
.check input { width: 20px; height: 20px; min-height: 0; accent-color: var(--amarillo); flex: none; }
.check.danger { color: var(--danger); }
.opts { border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 10px 0; margin: 4px 0; }
.opts summary { display: flex; gap: 8px; align-items: center; font-weight: 600; cursor: pointer; list-style: none; }
.opts summary::-webkit-details-marker { display: none; }
.opts[open] summary { margin-bottom: 8px; }

.meter { background: var(--surface-2); padding: 12px; margin-bottom: 14px; }
.meter-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.meter-top b { font-stretch: 118%; font-weight: 900; font-size: 1.2rem; }
.bars { display: grid; gap: 6px; }
.bar { position: relative; display: flex; justify-content: space-between; padding: 4px 8px; font-size: 0.74rem; background: var(--bg); overflow: hidden; }
.bar span { position: absolute; left: 0; top: 0; bottom: 0; background: var(--line); opacity: 0.35; }
.bar.fits span { background: var(--accent); opacity: 0.5; }
.bar.over { color: var(--danger); }
.bar.over span { background: var(--rojo); width: 100% !important; opacity: 0.25; }
.bar em { position: relative; font-style: normal; font-weight: 600; }

.pending { padding: 10px 0; }
.pending h2 { margin-top: 6px; }
.progress { height: 6px; background: var(--surface-2); margin: 16px 0 4px; }
.progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.3s; }
.done-ic { width: 72px; height: 72px; margin: 10px auto; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); }
.done-ic .i { width: 40px; height: 40px; stroke-width: 3; }

/* ---------- Listas ---------- */
.seg { display: flex; border: 1px solid var(--border); }
.seg button { flex: 1; padding: 10px 6px; background: transparent; border: 0; border-right: 1px solid var(--border); font-weight: 600; font-size: 0.86rem; color: var(--muted); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--text); color: var(--bg); }
.search { display: flex; align-items: center; gap: 10px; padding: 0 12px; background: var(--surface); border: 1px solid var(--border); }
.search:focus-within { border-color: var(--accent); }
.search .i { color: var(--muted); }
.search input { border: 0; background: transparent; padding: 10px 0; }
.list { display: flex; flex-direction: column; border: 1px solid var(--border); background: var(--surface); }
.row-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 12px 14px; background: transparent; border: 0; border-top: 1px solid var(--border); text-align: left;
}
.row-item:first-child { border-top: 0; }
button.row-item:hover { background: var(--surface-2); }
.row-item b { display: block; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-item small { display: block; color: var(--muted); font-size: 0.82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ri-ic { width: 38px; height: 38px; flex: none; display: grid; place-items: center; background: var(--surface-2); }
.ri-ic.emoji { font-size: 1.3rem; }
.ri-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.ri-meta small { font-size: 0.74rem; }
.risk-dot { width: 10px; height: 10px; display: inline-block; }
.risk-dot.warn { background: var(--amarillo); }
.risk-dot.danger { background: var(--rojo); }
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 34px 16px; border: 1px dashed var(--border); color: var(--muted); }
.empty .i { width: 34px; height: 34px; color: var(--line); margin-bottom: 4px; }
.empty b { color: var(--text); font-stretch: 118%; font-weight: 800; }
.empty p { max-width: 40ch; margin: 0; }

.row-item.auto { gap: 8px; }
.row-item.auto.off { opacity: 0.55; }
.plain { background: none; border: 0; padding: 0; text-align: left; }
.mini-icons { display: flex; gap: 6px; margin-top: 6px; color: var(--accent); }
.mini-icons .i { width: 15px; height: 15px; }

.switch { position: relative; display: inline-block; width: 46px; height: 26px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; min-height: 0; }
.switch span { position: absolute; inset: 0; background: var(--surface-2); border: 1px solid var(--border); transition: background 0.15s; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; background: var(--muted); transition: transform 0.15s; }
.switch input:checked + span { background: var(--accent); border-color: var(--accent); }
.switch input:checked + span::after { transform: translateX(20px); background: var(--negro); }

/* Editor de automatización */
.linkbox { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 12px; border: 1px dashed var(--border); margin-bottom: 8px; }
.linkbox.ok { border-style: solid; border-color: var(--accent); }
.linkbox > .i { color: var(--accent); }
.actions-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.act-ed { border: 1px solid var(--border); padding: 10px; background: var(--surface-2); }
.act-h { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.act-h > .i { color: var(--accent); }
.stack > .field:last-of-type { margin-bottom: 8px; }

/* ---------- Inventario ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--border); background: var(--surface); }
.stats > div { padding: 12px 10px; border-right: 1px solid var(--border); }
.stats > div:last-child { border-right: 0; }
.stats b { display: block; font-stretch: 118%; font-weight: 900; font-size: 1.6rem; line-height: 1; }
.stats small { font-size: 0.72rem; color: var(--muted); letter-spacing: 0.4px; }
.stats .alert b { color: var(--danger); }
.inv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.inv-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); padding: 0; text-align: left; overflow: hidden; }
.inv-card:hover { border-color: var(--line); }
.inv-card .thumb { width: 100%; aspect-ratio: 4 / 3; height: auto; }
.inv-body { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px 12px; min-width: 0; }
.inv-body b { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inv-body small { color: var(--muted); font-size: 0.78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inv-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }
.inv-foot .i { color: var(--accent); }
.thumb { width: 64px; height: 64px; object-fit: cover; flex: none; display: block; background: var(--surface-2); }
.thumb.ph { display: grid; place-items: center; color: var(--line); }
.thumb.ph .i { width: 28px; height: 28px; }
.item-mini { display: flex; gap: 12px; align-items: flex-start; }
.status { display: inline-block; padding: 2px 7px; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase; }
.s-disponible { background: var(--azul); color: var(--papel); }
.s-prestado { border: 1px solid var(--amarillo); color: var(--text); }
.s-reparacion { background: var(--acero); color: var(--negro); }
.s-baja { border: 1px solid var(--border); color: var(--muted); }
.s-vencido { background: var(--rojo); color: var(--papel); }
.photo-pick { display: grid; place-items: center; gap: 6px; aspect-ratio: 16 / 9; border: 1px dashed var(--border); background: var(--surface-2); color: var(--muted); cursor: pointer; overflow: hidden; margin-bottom: 14px; font-weight: 600; }
.photo-pick img { width: 100%; height: 100%; object-fit: cover; }
.photo-pick .i { width: 32px; height: 32px; }
.hero-img { width: 100%; max-height: 260px; object-fit: cover; display: block; margin-bottom: 12px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 14px 0; }
.kv dt { color: var(--muted); font-size: 0.85rem; }
.kv dd { margin: 0; }
.timeline { list-style: none; padding: 0; margin: 8px 0 0; border-left: 2px solid var(--border); }
.timeline li { padding: 4px 0 8px 12px; font-size: 0.9rem; }
.timeline small { display: block; color: var(--muted); font-size: 0.75rem; }
.item-detail h3 { margin-top: 18px; }

/* ---------- Hoja inferior ---------- */
.sheet { position: fixed; inset: 0; z-index: 50; display: none; }
.sheet.open { display: block; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(20, 24, 27, 0.72); animation: fade 0.15s ease-out; }
.sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 92dvh; overflow-y: auto;
  background: var(--surface); border-top: 4px solid var(--accent);
  padding: 22px 16px calc(22px + env(safe-area-inset-bottom));
  animation: up 0.2s ease-out;
}
@media (min-width: 720px) {
  .sheet-panel { left: 50%; right: auto; width: 640px; transform: translateX(-50%); bottom: 24px; max-height: 88dvh; animation: fade 0.15s ease-out; }
}
.sheet-grip { display: none; }
.sheet-x { position: absolute; top: 10px; right: 10px; }
.sheet-title { margin: 0 44px 8px 0; font-size: 1.35rem; }
@keyframes up { from { transform: translateY(24px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
.qr-box { display: grid; place-items: center; margin: 14px 0; }
.qr-box canvas { width: min(280px, 80vw); height: auto; image-rendering: pixelated; border: 1px solid var(--border); }
.menu { display: flex; flex-direction: column; border: 1px solid var(--border); margin-top: 12px; }
.menu button { display: flex; gap: 12px; align-items: center; padding: 13px 14px; background: transparent; border: 0; border-top: 1px solid var(--border); text-align: left; }
.menu button:first-child { border-top: 0; }
.menu button:hover { background: var(--surface-2); }
.menu small { display: block; color: var(--muted); font-size: 0.8rem; }
.menu .i { color: var(--accent); }
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; margin-bottom: 14px; }
.emo { height: 44px; font-size: 1.35rem; background: var(--surface-2); border: 2px solid transparent; }
.emo.on { border-color: var(--accent); }

/* Ajustes */
.set-group { border: 1px solid var(--border); margin-top: 12px; }
.set-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; background: transparent; border: 0; border-top: 1px solid var(--border); text-align: left; cursor: pointer; }
.set-group > .set-row:first-child { border-top: 0; }
.set-row small { display: block; color: var(--muted); font-size: 0.8rem; font-weight: 400; }
.set-row select { width: auto; min-height: 38px; }
.about { display: flex; gap: 14px; align-items: center; margin-top: 18px; padding: 14px; background: var(--negro); color: var(--papel); }
.about .logo { width: 44px; height: 44px; flex: none; }
.about .logo .lg-a { fill: var(--papel); }
.about b { display: block; font-stretch: 118%; font-weight: 900; }
.about small { display: block; font-size: 0.78rem; color: #B5BCC2; }
.about .slogan { color: var(--amarillo); font-weight: 600; margin-top: 2px; }

/* Ayuda */
.help-body { margin-top: 14px; }
.antenna { display: flex; gap: 18px; align-items: center; margin-top: 14px; }
.phone-svg { width: 120px; flex: none; }
.ph-body { fill: var(--surface-2); stroke: var(--line); stroke-width: 2; }
.ph-cam { fill: var(--bg); }
.ph-lens { fill: var(--surface-2); stroke: var(--line); }
.ph-zone { fill: var(--amarillo); opacity: 0.85; }
.ph-pulse { fill: none; stroke: var(--amarillo); stroke-width: 2; transform-box: fill-box; transform-origin: center; animation: pulse 1.8s linear infinite; }
.buy { display: grid; gap: 10px; }
.buy > div { border-left: 4px solid var(--accent); background: var(--surface-2); padding: 10px 12px; }
.buy p { margin: 4px 0 0; font-size: 0.9rem; }
.diag { display: flex; flex-direction: column; border: 1px solid var(--border); }
.diag-row { display: flex; gap: 12px; align-items: center; padding: 11px 12px; border-top: 1px solid var(--border); }
.diag-row:first-child { border-top: 0; }
.diag-row small { display: block; color: var(--muted); }
.diag-row .i { color: var(--muted); }
.diag-row.ok .i { color: var(--accent); }
.diag-row.bad .i { color: var(--danger); }
.guide { padding-left: 20px; }
.guide li { margin: 8px 0; }

/* Bienvenida */
.onboard { text-align: center; padding: 10px 4px 0; }
.ob-ic { width: 96px; height: 96px; margin: 8px auto 16px; display: grid; place-items: center; background: var(--negro); }
.ob-ic .i { width: 48px; height: 48px; color: var(--amarillo); }
.ob-ic .logo { width: 72px; height: 72px; }
.ob-ic .logo .lg-a { fill: var(--papel); }
.onboard h2 { font-size: 1.5rem; font-weight: 900; }
.onboard p { max-width: 40ch; margin: 10px auto; }
.dots { display: flex; justify-content: center; gap: 6px; margin: 18px 0 4px; }
.dots i { width: 22px; height: 4px; background: var(--border); }
.dots i.on { background: var(--accent); }

/* ---------- Barra de pestañas ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--bg); border-top: 1px solid var(--border);
}
.tab {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  background: none; border: 0; color: var(--muted); font-size: 0.68rem; font-weight: 600; letter-spacing: 0.2px;
}
.tab .i { width: 22px; height: 22px; }
.tab[aria-current="page"] { color: var(--text); }
.tab[aria-current="page"]::before { content: ''; position: absolute; top: -1px; left: 22%; right: 22%; height: 3px; background: var(--accent); }
.tab[aria-current="page"] .i { color: var(--accent); }
@media (min-width: 760px) {
  .tabbar { left: 50%; right: auto; width: 760px; transform: translateX(-50%); border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
}

/* ---------- Aviso ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 14px); z-index: 60;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  max-width: min(92vw, 460px); padding: 12px 16px;
  background: var(--papel); color: var(--negro); font-weight: 600; font-size: 0.92rem;
  border-left: 4px solid var(--acero); transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.ok { border-left-color: var(--amarillo); }
.toast.error { border-left-color: var(--rojo); }
:root[data-theme="light"] .toast { background: var(--negro); color: var(--papel); }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .toast { background: var(--negro); color: var(--papel); } }

@media (max-width: 420px) {
  h1 { font-size: 1.5rem; }
  .view-head { flex-direction: column; }
  .view-head .btn { align-self: stretch; }
  .stats b { font-size: 1.3rem; }
  .grid3 { grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
  .antenna { flex-direction: column; text-align: center; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .radar i { opacity: 0.3; }
}
