/* Pass · diseño "Nativa": claro, listas agrupadas, letra del sistema, acento violeta. */
:root {
  --bg: #f2f2f7; --card: #fff; --ink: #000; --dim: #6c6c70; --faint: #8e8e93; --sep: #e3e3e8;
  --ac: #7c3aed; --ac-soft: #ede9fe; --ac-hover: #f7f5ff; --warn: #c2410c; --red: #dc2626; --ok: #16a34a;
  --side: #ececf0; --line: #d4d4d8;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  --st: env(safe-area-inset-top, 0px); --sb: env(safe-area-inset-bottom, 0px);
  --sl: env(safe-area-inset-left, 0px); --sr: env(safe-area-inset-right, 0px);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: var(--font);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; }
body { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .55; cursor: default; }
:focus-visible { outline: 2px solid var(--ac); outline-offset: 2px; }
svg { display: block; }

/* ---------- bloqueo y creación ---------- */
.lock { min-height: 100dvh; max-width: 400px; margin: 0 auto; display: flex; flex-direction: column; align-items: center;
  text-align: center; padding: calc(64px + var(--st)) 24px calc(28px + var(--sb)); background: #fff; }
body[data-view="lock"], body[data-view="setup"] { background: #fff; overflow: auto; }
.lk-ico { width: 80px; height: 80px; border-radius: 18px; box-shadow: 0 14px 30px -12px rgba(91, 33, 182, .55); }
.lock h1 { font-size: 22px; font-weight: 600; margin: 20px 0 6px; letter-spacing: -.01em; }
.lock p { margin: 0; font-size: 15px; color: var(--dim); line-height: 1.4; }
.fid { background: none; border: 0; color: var(--ac); margin: 36px 0 18px; padding: 8px; }
.fid svg { width: 64px; height: 64px; }
.fid.scan svg { animation: fidp .45s cubic-bezier(.23, 1, .32, 1) infinite alternate; }
@keyframes fidp { from { transform: scale(1); opacity: 1; } to { transform: scale(.88); opacity: .55; } }
@media (prefers-reduced-motion: reduce) { .fid.scan svg { animation: none; opacity: .6; } }
.lk-form { width: 100%; margin-top: 28px; display: flex; flex-direction: column; gap: 10px; }
.lk-form input { width: 100%; padding: 14px; border-radius: 12px; border: 0; background: #eeeef3; font-size: 17px; outline: none; }
.lk-form input:focus { box-shadow: 0 0 0 2px var(--ac); }
.lock .fid + .err { margin-bottom: 8px; }
.lock > .pill { margin-top: auto; }
.pill { width: 100%; padding: 14px; border-radius: 14px; border: 0; background: var(--ac); color: #fff; font-weight: 600; font-size: 16px;
  transition: transform .1s ease-out; }
.pill:active:not(:disabled) { transform: scale(.98); }
.link { margin-top: 14px; background: none; border: 0; color: var(--ac); font-weight: 500; font-size: 15px; padding: 6px; }
.err { min-height: 20px; color: var(--red); font-size: 14px; line-height: 1.35; }

/* ---------- estructura ---------- */
.app { height: 100dvh; display: flex; }
.col { flex: 1; min-width: 0; height: 100dvh; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.side { display: none; }
.app:not(.wide) .pane { display: none; }
.app:not(.wide).on-pane .list { display: none; }
.app:not(.wide).on-pane .pane { display: block; }
.pane { background: var(--bg); }
.inner { padding-bottom: calc(32px + var(--sb)); }
.pad-b { height: calc(24px + var(--sb)); }

/* ---------- lista ---------- */
.nav { position: sticky; top: 0; z-index: 5; padding: calc(10px + var(--st)) calc(16px + var(--sr)) 8px calc(16px + var(--sl));
  background: rgba(242, 242, 247, .92); -webkit-backdrop-filter: blur(20px) saturate(1.6); backdrop-filter: blur(20px) saturate(1.6); }
.r { display: flex; align-items: center; justify-content: space-between; }
.lt { font-size: 32px; font-weight: 700; letter-spacing: -.02em; }
.na { display: flex; gap: 8px; }
.ib, .add { width: 34px; height: 34px; border-radius: 50%; border: 0; background: rgba(124, 58, 237, .12); color: var(--ac);
  display: grid; place-items: center; padding: 0; }
.ib svg { width: 19px; height: 19px; } .add svg { width: 18px; height: 18px; }
.status { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-height: 22px; margin-top: 2px; font-size: 12.5px; color: var(--dim); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex: none; }
.dot.busy { background: #f59e0b; } .dot.off { background: var(--faint); } .dot.bad { background: var(--red); }
.qw { position: relative; margin-top: 8px; }
.qw svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--faint); pointer-events: none; }
.q { width: 100%; padding: 9px 10px 9px 32px; border-radius: 10px; border: 0; background: #e3e3e8; font-size: 16px; outline: none; -webkit-appearance: none; appearance: none; }
.q::placeholder { color: var(--faint); }
.q:focus { box-shadow: 0 0 0 2px var(--ac); }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 10px 0 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; padding: 7px 13px; border-radius: 999px; border: 0; background: #fff; font-size: 14px; font-weight: 500;
  box-shadow: 0 0 0 .5px rgba(0, 0, 0, .1); }
.chip.on { background: var(--ac); color: #fff; }
.gh { display: flex; justify-content: space-between; padding: 18px calc(30px + var(--sr)) 6px calc(30px + var(--sl)); font-size: 12.5px;
  color: var(--dim); text-transform: uppercase; letter-spacing: .02em; }
.grp { margin: 0 calc(16px + var(--sr)) 0 calc(16px + var(--sl)); background: var(--card); border-radius: 12px; overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 12px; border: 0; background: none; text-align: left; position: relative; }
.row + .row::before { content: ""; position: absolute; top: 0; left: 56px; right: 0; height: .5px; background: var(--sep); }
.row:active, .row:hover { background: var(--ac-hover); }
.row.on { background: var(--ac-soft); }
.t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.n, .u { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .n { font-size: 16px; }
.row .u { font-size: 13px; color: var(--dim); margin-top: 1px; }
.chev { color: #c4c4c7; font-size: 22px; line-height: 1; }
.warnd { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #f59e0b; margin-left: 6px; vertical-align: 2px; }
.av { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; color: #fff; font-size: 12.5px; font-weight: 600; flex: none; }
.av.big { width: 64px; height: 64px; border-radius: 16px; font-size: 22px; margin: 0 auto 10px; }
.c0 { background: #e11d74; } .c1 { background: #7c3aed; } .c2 { background: #2563eb; } .c3 { background: #0891b2; }
.c4 { background: #059669; } .c5 { background: #d97706; } .c6 { background: #dc2626; } .c7 { background: #4f46e5; }
.empty { padding: 48px 32px; text-align: center; color: var(--dim); font-size: 15px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.empty .pill { max-width: 280px; margin-top: 12px; }

/* ---------- detalle y formularios ---------- */
.nb { position: sticky; top: 0; z-index: 5; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: 44px;
  padding: calc(4px + var(--st)) calc(8px + var(--sr)) 4px calc(8px + var(--sl));
  background: rgba(242, 242, 247, .92); -webkit-backdrop-filter: blur(20px) saturate(1.6); backdrop-filter: blur(20px) saturate(1.6); }
.nb b { font-size: 16px; font-weight: 600; }
.nb-r { justify-self: end; }
.nbb { background: none; border: 0; color: var(--ac); font-size: 17px; padding: 8px; }
.nbb.strong { font-weight: 600; }
.dh { text-align: center; padding: 8px 16px 18px; }
.dh h2 { font-size: 21px; font-weight: 600; margin: 0; }
.dh p { margin: 3px 0 0; font-size: 14px; color: var(--dim); }
.grp.d, .pad { margin-bottom: 16px; }
.pad { margin-left: calc(16px + var(--sl)); margin-right: calc(16px + var(--sr)); }
.it { display: block; padding: 10px 14px; position: relative; }
.it + .it::before, .grp .act + .act::before, .it + .act::before { content: ""; position: absolute; top: 0; left: 14px; right: 0; height: .5px; background: var(--sep); }
.l { font-size: 13px; color: var(--dim); }
.v { font-size: 16px; margin-top: 2px; }
.v.us { overflow-wrap: anywhere; }
.v.pw { font-family: var(--mono); font-size: 15.5px; word-break: break-all; }
.v.d { letter-spacing: 2px; font-family: var(--font); }
.v.nt { font-size: 15px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.v.w { color: var(--ac); overflow-wrap: anywhere; }
.v.old { color: var(--warn); }
.v small { font-size: 13px; }
.fr { display: flex; align-items: center; gap: 12px; }
.fr > div, .fr > label { flex: 1; min-width: 0; }
.tx { background: none; border: 0; color: var(--ac); font-weight: 500; font-size: 15px; padding: 6px 0; flex: none; text-decoration: none; }
.tx.sm { font-size: 12.5px; padding: 0 0 0 4px; }
.tx.red, .act.red { color: var(--red); }
.act { display: block; width: 100%; text-align: center; padding: 13px; border: 0; background: var(--card); color: var(--ac); font-weight: 500; font-size: 16px; position: relative; }
.act:active { background: var(--ac-hover); }
.it input, .it select, .it textarea { display: block; width: 100%; border: 0; padding: 2px 0 0; background: none; font-size: 16px; outline: none; }
.it input.mono { font-family: var(--mono); font-size: 15.5px; }
.it textarea { resize: vertical; line-height: 1.45; }
.it select { -webkit-appearance: none; appearance: none; }
.it:focus-within .l { color: var(--ac); }
.it[hidden] { display: none; }
.note { margin: 6px calc(30px + var(--sr)) 14px calc(30px + var(--sl)); font-size: 14px; color: var(--dim); line-height: 1.45; }
.inner > .err { margin: 0 30px; }
.foot { margin: 8px 30px 0; font-size: 12.5px; color: var(--faint); line-height: 1.45; text-align: center; }
.only-m { }

/* ---------- Mac y pantallas anchas ---------- */
.app.wide .side { display: flex; flex-direction: column; gap: 1px; width: 220px; flex: none; height: 100dvh; overflow-y: auto;
  background: var(--side); border-right: .5px solid var(--line); padding: calc(18px + var(--st)) 10px 14px; }
.side-t { font-size: 22px; font-weight: 700; padding: 0 10px 10px; letter-spacing: -.01em; }
.sh { font-size: 11.5px; font-weight: 600; color: var(--faint); padding: 8px 10px 4px; }
.fb { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px; border-radius: 7px; border: 0; background: none;
  font-size: 14px; text-align: left; }
.fb span { margin-left: auto; color: var(--faint); font-size: 13px; }
.fb svg { width: 15px; height: 15px; color: var(--ac); }
.fb:hover { background: rgba(0, 0, 0, .04); }
.fb.on { background: var(--ac); color: #fff; }
.fb.on span { color: rgba(255, 255, 255, .78); }
.side-b { margin-top: auto; padding-top: 16px; }
.side-b p { margin: 6px 10px 0; font-size: 11.5px; color: var(--faint); }
.app.wide .list { width: 360px; flex: none; background: #fff; border-right: .5px solid var(--line); }
.app.wide .list .nav { background: rgba(255, 255, 255, .92); }
.app.wide .top-r, .app.wide .chips { display: none; }
.app.wide .list .grp { margin: 0 8px; border-radius: 10px; }
.app.wide .list .gh { padding: 16px 20px 4px; }
.app.wide .pane { background: #f5f5f7; }
.app.wide .pane .inner { max-width: 520px; margin: 0 auto; padding-top: 8px; }
.app.wide .only-m { visibility: hidden; }
.pane-empty { height: 100%; justify-content: center; }

/* ---------- aviso ---------- */
.toast { position: fixed; left: 50%; bottom: calc(24px + var(--sb)); transform: translate(-50%, 12px); opacity: 0; z-index: 50;
  background: rgba(28, 28, 30, .94); color: #fff; padding: 11px 18px; border-radius: 999px; font-size: 14.5px; font-weight: 500;
  pointer-events: none; max-width: calc(100vw - 32px); text-align: center; transition: opacity .2s ease-out, transform .2s ease-out; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
