/* =====================================================================
   v3 · Clave del equipo, QR, WhatsApp, barra inferior móvil
   ===================================================================== */
.clave-picker { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); padding: 12px; display: grid; gap: 14px; }
.clave-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.clave-tabs button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface); color: var(--mut); font: 600 12px var(--font); cursor: pointer; transition: .25s var(--ease); }
.clave-tabs button svg { width: 20px; height: 20px; }
.clave-tabs button:hover { color: var(--ink); border-color: var(--line-2); }
.clave-tabs button.is-active { background: var(--acc); border-color: var(--acc); color: var(--acc-ink); transform: translateY(-1px); box-shadow: 0 8px 20px -10px var(--acc); }
.clave-pane { display: none; animation: fade .35s var(--ease); }
.clave-picker[data-tipo="ninguna"] [data-cp="ninguna"], .clave-picker[data-tipo="patron"] [data-cp="patron"], .clave-picker[data-tipo="pin"] [data-cp="pin"], .clave-picker[data-tipo="texto"] [data-cp="texto"] { display: block; }
.clave-foot { display: flex; align-items: center; gap: 6px; }
.patron-wrap { display: grid; grid-template-columns: minmax(0, 240px) 1fr; gap: 16px; align-items: center; }
.patron-pad { position: relative; aspect-ratio: 1; width: 100%; max-width: 260px; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); border-radius: calc(var(--r) + 4px); background: radial-gradient(circle at 50% 0%, var(--acc-soft), transparent 70%), var(--bg); border: 1px solid var(--line); touch-action: none; user-select: none; -webkit-user-select: none; cursor: crosshair; outline: none; }
.patron-pad:focus-visible { box-shadow: 0 0 0 3px var(--acc-soft); }
.patron-lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.patron-lines polyline, .patron-lines line { fill: none; stroke: var(--acc); stroke-width: 9; stroke-linecap: round; stroke-linejoin: round; opacity: .75; }
.patron-lines line { opacity: 0; stroke-dasharray: 2 14; transition: opacity .15s; }
.pdot { position: relative; display: grid; place-items: center; }
.pdot i { width: 18px; height: 18px; border-radius: 50%; background: var(--line-2); transition: .25s var(--ease); }
.pdot b { position: absolute; font: 800 13px var(--display); color: var(--acc-ink); pointer-events: none; }
.pdot.on i { width: 34px; height: 34px; background: var(--acc); box-shadow: 0 0 0 7px var(--acc-soft); }
.pdot.first i { box-shadow: 0 0 0 7px var(--acc-soft), 0 0 0 12px color-mix(in srgb, var(--acc) 18%, transparent); }
.pdot.pop i { animation: pdot .35s var(--ease); }
@keyframes pdot { 50% { transform: scale(1.35); } }
.patron-side { display: grid; gap: 10px; justify-items: start; }
.patron-seq { font: 700 18px var(--display); }
.pin-wrap { display: grid; gap: 12px; justify-items: center; }
.pin-len { width: 100%; justify-content: center; }
.pin-input { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; }
.pin-input.show { position: static; opacity: 1; pointer-events: auto; width: 100%; max-width: 280px; height: auto; text-align: center; font: 700 26px ui-monospace, Consolas, monospace; letter-spacing: .3em; }
.pin-boxes { display: flex; gap: 8px; cursor: text; }
.pin-boxes i { width: 44px; height: 54px; border-radius: 12px; border: 1.5px solid var(--line-2); background: var(--surface); display: grid; place-items: center; font: 800 24px ui-monospace, Consolas, monospace; font-style: normal; color: var(--ink); transition: .2s var(--ease); }
.pin-boxes i.on { border-color: var(--acc); background: var(--acc-soft); animation: pdot .3s var(--ease); }
.pin-boxes i.cur { border-color: var(--acc); box-shadow: 0 0 0 3px var(--acc-soft); }
.keypad { display: grid; grid-template-columns: repeat(3, 72px); gap: 8px; }
.keypad button { height: 54px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 700 22px var(--display); cursor: pointer; display: grid; place-items: center; transition: .15s; }
.keypad button:active { transform: scale(.94); background: var(--surface-3); }
.keypad button.ok { background: var(--acc); color: var(--acc-ink); border-color: var(--acc); }
.keypad svg { width: 22px; height: 22px; }
.pin-show { display: inline-flex; gap: 4px; }
.pin-show i { font-style: normal; min-width: 26px; height: 32px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); display: grid; place-items: center; font: 800 16px ui-monospace, Consolas, monospace; }
.clave-box { margin-top: 10px; padding: 12px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px dashed var(--line-2); display: flex; gap: 14px; align-items: center; flex-wrap: wrap; animation: fade .3s; }
@media (max-width: 560px) {
  .patron-wrap { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .patron-side { justify-items: center; }
  .patron-pad { max-width: 280px; }
  .clave-tabs span { font-size: 11px; }
  .keypad { grid-template-columns: repeat(3, minmax(64px, 1fr)); width: 100%; max-width: 300px; }
  .keypad button { height: 58px; }
}

/* QR */
.qr-card { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center; }
.qr-box { width: 132px; height: 132px; padding: 8px; background: #fff; border-radius: 14px; display: grid; place-items: center; box-shadow: 0 10px 30px -14px rgba(0,0,0,.4); position: relative; overflow: hidden; }
.qr-box img, .qr-box canvas { width: 100% !important; height: auto !important; display: block; }
.qr-box:not(.is-ready)::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(0,0,0,.06) 50%, transparent 70%); animation: shimmer 1.2s infinite; }
.qr-box.is-ready { animation: qrIn .6s var(--ease); }
@keyframes qrIn { from { transform: scale(.85) rotate(-4deg); opacity: 0; filter: blur(4px); } }
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.qr-actions { display: flex; flex-wrap: wrap; gap: 6px; }
@media (max-width: 420px) { .qr-card { grid-template-columns: 1fr; justify-items: center; text-align: center; } .qr-actions { justify-content: center; } }

/* WhatsApp */
.wa-box { display: grid; gap: 10px; }
.wa-tpls { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.wa-tpls::-webkit-scrollbar { display: none; }
.wa-tpls button { flex: none; border: 1px solid var(--line); background: var(--surface-2); color: var(--mut); border-radius: 999px; padding: 6px 12px; font: 600 12px var(--font); cursor: pointer; transition: .2s; }
.wa-tpls button.is-active { background: #25D366; border-color: #25D366; color: #06210F; }
.wa-box textarea { min-height: 96px; font-size: 13px; }

/* SUNAT en desarrollo */
.dev-badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font: 700 11px var(--font); letter-spacing: .04em; text-transform: uppercase; color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); }
.dev-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: blink 1.4s infinite; }
@keyframes blink { 50% { opacity: .2; } }
.is-disabled { opacity: .55; pointer-events: none; filter: grayscale(.4); }

/* Escáner */
.scan-view { position: relative; aspect-ratio: 1; max-width: 340px; margin: 0 auto 12px; border-radius: 20px; overflow: hidden; background: #000; }
.scan-view video { width: 100%; height: 100%; object-fit: cover; }
.scan-view::after { content: ""; position: absolute; inset: 18%; border: 3px solid var(--acc-vivo); border-radius: 18px; box-shadow: 0 0 0 999px rgba(0,0,0,.35); }
.scan-view .laser { position: absolute; left: 18%; right: 18%; height: 2px; background: var(--acc-vivo); box-shadow: 0 0 12px var(--acc-vivo); top: 20%; animation: laser 2s ease-in-out infinite alternate; z-index: 2; }
@keyframes laser { to { top: 80%; } }

/* Barra inferior móvil */
.tabbar { display: none; }
@media (max-width: 1024px) {
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 40; height: 64px; padding: 0 6px; border-radius: 22px; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4); border: 1px solid var(--line); box-shadow: 0 18px 40px -16px rgba(0,0,0,.55); animation: tabIn .6s var(--ease) both; }
  @keyframes tabIn { from { transform: translateY(120%); } }
  .tabbar a, .tabbar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--mut); font: 600 10.5px var(--font); text-decoration: none; background: none; border: 0; cursor: pointer; position: relative; -webkit-tap-highlight-color: transparent; isolation: isolate; }
  .tabbar svg { width: 22px; height: 22px; transition: transform .3s var(--ease); }
  .tabbar .is-active { color: var(--acc); }
  .tabbar .is-active::before { content: ""; position: absolute; top: 7px; width: 40px; height: 30px; border-radius: 10px; background: var(--acc-soft); z-index: -1; animation: fade .3s; }
  .tabbar a:active svg, .tabbar button:active svg { transform: scale(.85); }
  .tabbar .fab { margin-top: -26px; }
  .tabbar .fab span.f { width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; background: var(--acc); color: var(--acc-ink); box-shadow: 0 12px 26px -8px var(--acc), 0 0 0 5px var(--bg); transition: transform .3s var(--ease); }
  .tabbar .fab:active span.f { transform: scale(.9) rotate(90deg); }
  .tabbar .fab svg { width: 26px; height: 26px; }
  .tabbar .badge-n { position: absolute; top: 6px; left: calc(50% + 4px); min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 800; display: grid; place-items: center; }
  .content { padding-bottom: calc(100px + env(safe-area-inset-bottom)) !important; }
  .toasts { bottom: calc(86px + env(safe-area-inset-bottom)) !important; }
  .topbar .hide-mobile { display: none !important; }
  body.no-tabbar .tabbar { display: none; }
  body.no-tabbar .content { padding-bottom: 110px !important; }
}
@media (max-width: 720px) {
  .topbar { gap: 6px; }
  .page-head h1 { font-size: 22px; }
  .kanban { scroll-snap-type: x mandatory; }
  .kanban .k-col { scroll-snap-align: start; }
  input, select, textarea { font-size: 16px; }
}
@media (max-width: 1024px) { .tabbar { transition: transform .35s var(--ease); } body.nav-open .tabbar { transform: translateY(150%); } }
.pin-boxes { width: 100%; max-width: 330px; justify-content: center; }
.pin-boxes i { flex: 1 1 0; min-width: 0; max-width: 46px; }
.clave-box[hidden] { display: none; }
@media (max-width: 720px) { .page-head .actions { flex-wrap: wrap; } .page-head .actions > .dropdown { flex: 1; } .page-head .actions > .dropdown > .btn { width: 100%; } }
@media (max-width: 720px) { .page-head .actions > *, .page-head .actions .btn { flex: 1 1 auto; } }
/* Marca Celufix */
.brand-mark.is-logo { background: none; padding: 0; overflow: visible; }
.brand-mark.is-logo::after { display: none; }
.brand-mark.is-logo .cfx-logo { width: 100%; height: 100%; display: block; filter: drop-shadow(0 6px 14px color-mix(in srgb, var(--acc-vivo) 45%, transparent)); }
.cfx-logo .cfx-bolt { transform-origin: 34px 32px; animation: cfxBolt 4.5s var(--ease) infinite 1.2s; }
@keyframes cfxBolt { 0%, 86%, 100% { transform: none; } 90% { transform: scale(1.18) rotate(-6deg); } 94% { transform: scale(.94); } }
.brand-fx { font-weight: inherit; background: linear-gradient(90deg, var(--acc-vivo), var(--cyan-vivo)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-name { display: block; }
/* Suscripciones y planes */
.sus-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 16px; padding: 10px 14px; border-radius: var(--r); background: color-mix(in srgb, var(--acc) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--acc) 35%, var(--line)); font-size: 14px; font-weight: 600; animation: fade-up .5s var(--ease) both; }
.sus-bar > .ico { color: var(--acc); }
.sus-bar span { flex: 1; min-width: 180px; }
.sus-bar.is-urgent { background: color-mix(in srgb, var(--danger) 12%, var(--surface)); border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
.sus-bar.is-urgent > .ico { color: var(--danger); }
.planes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.plan-card { position: relative; display: flex; flex-direction: column; transition: transform .4s var(--ease), border-color .3s; }
.plan-card:hover { transform: translateY(-4px); }
.plan-card.is-featured { border-color: var(--acc); box-shadow: 0 20px 40px -24px var(--acc); background: linear-gradient(180deg, var(--acc-soft), var(--surface) 45%); }
.plan-card.is-off { opacity: .6; }
.plan-card h2, .plan-card h3 { font: 800 22px var(--display); margin: 0 0 6px; }
.plan-tag { position: absolute; top: 14px; right: 14px; padding: 3px 10px; border-radius: 999px; background: var(--acc); color: var(--acc-ink); font-size: 11px; font-weight: 700; }
.plan-price { font: 800 34px var(--display); letter-spacing: -.03em; margin: 4px 0 8px; }
.plan-price small { font-size: 15px; margin-right: 4px; color: var(--mut); }
.plan-price span { font-size: 14px; font-weight: 600; color: var(--mut); }
.plan-feat { list-style: none; padding: 0; margin: 12px 0 14px; display: grid; gap: 8px; font-size: 14px; flex: 1; }
.plan-feat li { display: flex; gap: 8px; align-items: center; }
.plan-feat .ico { width: 16px; height: 16px; color: var(--acc); }
.sus-hero { background: radial-gradient(500px 220px at 100% 0, var(--acc-soft), transparent 70%), var(--surface); }
.sus-plan { font: 800 34px var(--display); letter-spacing: -.03em; margin: 2px 0 0; }
.sus-days { text-align: center; padding: 12px 18px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line); }
.sus-days b { display: block; font: 800 34px/1 var(--display); color: var(--acc); }
.sus-days span { font-size: 12px; color: var(--mut); }
.sus-uso { display: grid; gap: 14px; margin-top: 22px; }
.progress { height: 8px; border-radius: 8px; background: var(--surface-3); overflow: hidden; margin-top: 6px; }
.progress i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--acc), var(--cyan)); transform-origin: left; animation: grow-x 1.1s var(--ease) both; }
.progress.is-full i { background: var(--danger); }
@keyframes grow-x { from { transform: scaleX(0); } }
.soporte-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 16px; padding: 10px 14px; border-radius: var(--r); background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--warn) 16%, var(--surface)) 0 12px, color-mix(in srgb, var(--warn) 9%, var(--surface)) 12px 24px); border: 1px solid color-mix(in srgb, var(--warn) 45%, var(--line)); font-size: 14px; }
.soporte-bar > .ico { color: var(--warn); }
.soporte-bar span { flex: 1; min-width: 200px; }
.cron-cmd { display: block; padding: 10px 12px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--line); font: 12px/1.5 ui-monospace, Consolas, monospace; word-break: break-all; }
/* App instalable */
.install-card { display: flex; align-items: center; gap: 12px; margin: 0 0 16px; padding: 12px 14px; border-radius: calc(var(--r) + 2px); background: linear-gradient(120deg, var(--acc-soft), color-mix(in srgb, var(--cyan) 12%, var(--surface))); border: 1px solid color-mix(in srgb, var(--acc) 30%, var(--line)); animation: fade-up .5s var(--ease) both; }
.install-card[hidden] { display: none; }
.install-card img { border-radius: 12px; flex: none; }
.install-card b { display: block; font-size: 14px; }
.install-card span { font-size: 12.5px; color: var(--mut); }
html.is-app .pwa-only-browser { display: none !important; }
html.is-app .topbar { padding-top: max(10px, env(safe-area-inset-top)); }
