/* app.css — Zanaves account, mobile-first.
   Словарь компонентов из cabinet/css/app.css (card, btn, field, sheet, pill,
   skeleton, toast, shake), перекрашенный в teal, плюс экраны выдачи ключа
   (steps, choice, node-list, segmented, banner, instruction, animated-qr). */

/* ===== LAYOUT ===== */
#app{
  width:100%; max-width:520px; margin:0 auto;
  min-height:100vh; min-height:100dvh;       /* dvh: stable centering on mobile */
  padding:
    calc(env(safe-area-inset-top) + 16px)
    calc(env(safe-area-inset-right) + 16px)
    calc(env(safe-area-inset-bottom) + 24px)
    calc(env(safe-area-inset-left) + 16px);
  display:flex; flex-direction:column;
}
.screen{ flex:1; display:flex; flex-direction:column; min-height:0; }
.screen__body{ flex:1; }
/* Centred auth screens: logo + card sit dead-centre of the viewport. The
   footer hint is pulled out of the centring flow (absolute, pinned bottom) so
   it never pushes the logo/buttons off-centre — same on mobile and desktop. */
.screen--center{ position:relative; }
.screen--center .screen__body{ display:flex; flex-direction:column; justify-content:center; gap:18px; }
.screen--center .foot-hint{
  position:absolute; left:0; right:0; bottom:0; margin:0;
}
.screen__foot{
  position:sticky; bottom:0; padding-top:14px;
  background:linear-gradient(180deg, transparent, var(--tg-bg) 38%); margin-top:14px;
}

/* ===== BRAND ===== */
.brand{ display:flex; align-items:center; justify-content:center; gap:12px; }
.brand--stack{ flex-direction:column; gap:14px; }
.brand-text{ display:flex; flex-direction:column; align-items:center; }
.brand-word{ font-family:var(--font-display); font-weight:800; font-size:30px; line-height:1; letter-spacing:-.02em; color:var(--text-1); }
.brand-sub{ font-size:10px; letter-spacing:.2em; line-height:1; margin-top:6px; }

.appbar{ display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:16px; }
.appbar__brand{ display:flex; align-items:center; gap:9px; }
.appbar__word{ font-family:var(--font-display); font-weight:800; font-size:26px; line-height:1; letter-spacing:-.02em; color:var(--text-1); }
.appbar__actions{ display:flex; align-items:center; gap:8px; }

/* link-button (icon) in the app bar */
.iconbtn{
  width:40px; height:40px; border-radius:var(--r-md); border:1px solid var(--border);
  background:var(--glass); color:var(--text-2); display:grid; place-items:center; cursor:pointer;
}
.iconbtn:hover{ background:var(--surface-2); color:var(--text-1); }

/* ===== CARD ===== */
.card{
  background:var(--glass); border:1px solid var(--border); border-radius:var(--r-lg);
  backdrop-filter:blur(10px); -webkit-backdrop-filter:blur(10px); padding:18px;
}
.card + .card{ margin-top:14px; }
.card--link{ cursor:pointer; transition:.16s; }
.card--link:hover{ border-color:var(--border-2); background:var(--glass-strong); }
.card__title{ font-family:var(--font-display); font-weight:700; font-size:16px; color:var(--text-1); margin:0; }
.card__desc{ color:var(--text-2); font-size:13.5px; margin:6px 0 0; line-height:1.5; }
.card__head{ display:flex; align-items:center; justify-content:space-between; gap:10px; }

.card--soon{ opacity:.72; }
.card--soon .card__title::after{
  content:"скоро"; margin-left:8px; font-size:10px; font-weight:700; letter-spacing:.12em;
  text-transform:uppercase; color:var(--text-3); vertical-align:middle;
  border:1px solid var(--border-2); border-radius:var(--r-pill); padding:2px 8px;
}

/* ===== SUBSCRIPTION HERO ===== */
.sub-card{
  background:
    radial-gradient(140% 120% at 85% -20%, var(--accent-glow), transparent 55%),
    var(--glass-strong);
  border:1px solid var(--border-2);
}
.sub-card__count{ font-family:var(--font-display); font-weight:800; font-size:26px; letter-spacing:-.01em; color:var(--text-1); margin:12px 0 2px; }
.sub-card__sub{ color:var(--text-2); font-size:13.5px; }

/* ===== PILLS ===== */
.pill{
  display:inline-flex; align-items:center; gap:7px; font-size:12.5px; font-weight:700; letter-spacing:.02em;
  padding:5px 12px; border-radius:var(--r-pill); color:var(--text-2); background:var(--glass); border:1px solid var(--border);
}
.pill::before{ content:""; width:7px; height:7px; border-radius:50%; background:currentColor; }
.pill--on   { background:rgba(61,220,151,.16); color:var(--connected); border:none; }
.pill--trial{ background:rgba(45,212,196,.16); color:var(--accent-bright); border:none; }
.pill--off  { background:rgba(226,98,92,.16);  color:var(--danger);    border:none; }

/* ===== BUTTONS ===== */
.btn{
  font-family:var(--font-body); font-weight:700; font-size:15px; border-radius:var(--r-md);
  padding:13px 18px; min-height:48px; border:1px solid transparent; cursor:pointer;
  display:inline-flex; align-items:center; justify-content:center; gap:9px; transition:.16s;
  text-decoration:none; -webkit-tap-highlight-color:transparent;
}
.btn--block{ width:100%; }
.btn--primary{
  background:var(--accent); color:var(--on-acc); border-color:rgba(95,230,217,.45);
  box-shadow:0 10px 28px -12px var(--accent-glow);
}
.btn--primary:hover{ background:#3fe0d0; }
.btn--primary:active{ filter:brightness(.96); }
.btn--ghost{ background:var(--glass-strong); color:var(--text-1); border-color:var(--border-2); }
.btn--ghost:hover{ background:var(--surface-2); }
.btn--danger{ background:rgba(226,98,92,.14); color:var(--danger); border-color:rgba(226,98,92,.4); }
.btn--danger:hover{ background:rgba(226,98,92,.22); }
.btn--sm{ min-height:38px; padding:8px 14px; font-size:13px; }
.btn:disabled{ opacity:.5; cursor:not-allowed; filter:none; }

/* ===== FORM FIELDS ===== */
.field{ display:flex; flex-direction:column; gap:7px; }
.field label{ color:var(--text-3); font-size:12px; font-weight:600; letter-spacing:.06em; }
.field input{
  background:var(--bg-900); border:1px solid var(--border); border-radius:var(--r-md); color:var(--text-1);
  font-family:var(--font-body); font-size:16px; padding:13px 14px; width:100%; outline:none;
  transition:border-color .18s, box-shadow .18s;
}
.field input:focus{ border-color:var(--accent); box-shadow:0 0 0 3px rgba(45,212,196,.18); }
.field--code input{ font-family:var(--font-mono); text-align:center; letter-spacing:.5em; font-size:22px; padding-left:.5em; }
.form-err{ color:var(--danger); font-size:13px; margin:8px 0 0; min-height:18px; }

/* ===== ROWS ===== */
.row{ display:flex; align-items:center; gap:12px; padding:12px 0; border-top:1px solid var(--border); }
.row:first-of-type{ border-top:none; padding-top:6px; }
.row__icon{ flex:0 0 auto; width:36px; height:36px; display:grid; place-items:center; border-radius:var(--r-md); background:var(--glass-strong); color:var(--text-2); font-size:18px; }
.row__main{ flex:1; min-width:0; }
.row__title{ font-size:14.5px; font-weight:600; color:var(--text-1); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.row__sub{ font-size:12.5px; color:var(--text-3); margin-top:2px; }
.row__action{ flex:0 0 auto; }
.kv-val{ font-family:var(--font-mono); color:var(--text-1); font-size:13.5px; }

/* ===== SHEET ===== */
.sheet-overlay{
  position:fixed; inset:0; z-index:1000; background:rgba(2,12,16,.66);
  backdrop-filter:blur(8px); -webkit-backdrop-filter:blur(8px);
  display:flex; align-items:flex-end; justify-content:center; animation:fade .2s ease both;
}
.sheet{
  width:100%; max-width:520px; background:var(--surface-1); border:1px solid var(--border-2);
  border-bottom:none; border-radius:var(--r-xl) var(--r-xl) 0 0; box-shadow:0 -20px 60px rgba(2,12,16,.7);
  padding:10px 20px calc(env(safe-area-inset-bottom) + 22px); max-height:92vh; overflow-y:auto;
  animation:sheet-up .26s cubic-bezier(.22,.8,.3,1) both;
}
.sheet__grab{ width:40px; height:4px; border-radius:999px; background:var(--border-3); margin:6px auto 14px; }
.sheet__title{ font-family:var(--font-display); font-weight:800; font-size:19px; text-align:center; margin:0 0 4px; }
.sheet__desc{ text-align:center; color:var(--text-2); font-size:13.5px; margin:0 0 18px; line-height:1.5; }
@media (min-width:600px){
  .sheet-overlay{ align-items:center; }
  .sheet{ border-radius:var(--r-xl); border-bottom:1px solid var(--border-2); }
  .sheet__grab{ display:none; }
}

/* ===== QR ===== */
.qr-wrap{ display:flex; justify-content:center; margin:0 0 14px; }
.qr-box{ background:#fff; padding:14px; border-radius:var(--r-md); line-height:0; position:relative; }
.qr-box svg{ display:block; }
.qr-anim-badge{
  position:absolute; top:8px; right:8px; background:rgba(3,17,15,.78); color:#eafbf8;
  font-size:10px; font-weight:700; letter-spacing:.08em; padding:3px 7px; border-radius:999px;
  display:flex; align-items:center; gap:5px;
}
.qr-anim-badge .dot{ width:6px; height:6px; border-radius:50%; background:var(--accent); animation:pulse 1s infinite; }
@keyframes pulse{ 0%,100%{opacity:1} 50%{opacity:.3} }

/* ===== KEY BLOCK ===== */
.keybox{
  display:flex; align-items:center; gap:10px; background:var(--bg-900); border:1px solid var(--border);
  border-radius:var(--r-md); padding:12px 14px; margin-bottom:10px;
}
.keybox__val{ flex:1; min-width:0; font-family:var(--font-mono); font-size:12.5px; color:var(--text-1); word-break:break-all; max-height:84px; overflow:auto; }

/* ===== SEGMENTED (choose path: scan / config) ===== */
.seg{ display:flex; gap:6px; background:var(--bg-900); border:1px solid var(--border); border-radius:var(--r-md); padding:4px; margin:0 0 14px; }
.seg button{
  flex:1; border:none; background:transparent; color:var(--text-2); font-family:var(--font-body);
  font-weight:700; font-size:13px; padding:9px 10px; border-radius:9px; cursor:pointer; transition:.14s;
}
.seg button[aria-selected="true"]{ background:var(--accent); color:var(--on-acc); }

/* ===== CHOICE CARDS (which app) ===== */
.choice{ display:flex; flex-direction:column; gap:12px; }
.choice__opt{
  display:flex; align-items:center; gap:14px; text-align:left; width:100%;
  background:var(--glass); border:1px solid var(--border); border-radius:var(--r-lg); padding:16px; cursor:pointer; transition:.16s;
}
.choice__opt:hover{ border-color:var(--border-2); background:var(--glass-strong); }
.choice__opt[aria-selected="true"]{ border-color:var(--accent); box-shadow:0 0 0 3px rgba(45,212,196,.16); }
.choice__logo{ flex:0 0 auto; width:46px; height:46px; border-radius:var(--r-md); display:grid; place-items:center; background:var(--surface-2); font-size:22px; }
.choice__main{ flex:1; min-width:0; }
.choice__name{ font-weight:800; font-size:15px; color:var(--text-1); display:flex; align-items:center; gap:8px; }
.choice__tag{ font-size:10px; font-weight:700; letter-spacing:.08em; text-transform:uppercase; color:var(--accent); background:rgba(45,212,196,.14); border-radius:999px; padding:2px 8px; }
.choice__desc{ font-size:12.5px; color:var(--text-3); margin-top:3px; line-height:1.45; }

/* ===== NODE LIST ===== */
.node{
  display:flex; align-items:center; gap:12px; width:100%; text-align:left;
  background:var(--glass); border:1px solid var(--border); border-radius:var(--r-md); padding:13px 14px; cursor:pointer; transition:.16s; margin-bottom:10px;
}
.node:hover{ border-color:var(--border-2); }
.node[aria-selected="true"]{ border-color:var(--accent); box-shadow:0 0 0 3px rgba(45,212,196,.16); }
.node__flag{ font-size:24px; flex:0 0 auto; }
.node__main{ flex:1; min-width:0; }
.node__name{ font-weight:700; font-size:14.5px; color:var(--text-1); display:flex; align-items:center; gap:8px; }
.node__best{ font-size:10px; font-weight:700; letter-spacing:.06em; text-transform:uppercase; color:var(--on-acc); background:var(--accent); border-radius:999px; padding:2px 7px; }
.caps{ display:flex; gap:6px; margin-top:6px; flex-wrap:wrap; }
.cap-badge{ display:inline-flex; align-items:center; gap:4px; font-size:11px; color:var(--text-3); }
.cap-dot{ width:7px; height:7px; border-radius:50%; }

/* ===== STEPS (numbered instructions) ===== */
.steps{ list-style:none; margin:14px 0 0; padding:0; display:flex; flex-direction:column; gap:12px; }
.steps li{ display:flex; align-items:flex-start; gap:12px; font-size:13.5px; line-height:1.5; color:var(--text-2); }
.steps b{
  flex:0 0 auto; width:24px; height:24px; border-radius:8px; display:grid; place-items:center;
  font-size:12px; font-weight:800; color:var(--accent); background:rgba(45,212,196,.14); border:1px solid var(--border-2);
}
.steps .plus{ font-family:var(--font-mono); color:var(--accent-bright); font-weight:700; }

/* wizard step header (1 / 4 …) */
.wiz-head{ display:flex; align-items:center; gap:10px; margin-bottom:14px; }
.wiz-back{ border:none; background:var(--glass); color:var(--text-2); width:34px; height:34px; border-radius:var(--r-md); cursor:pointer; font-size:18px; }
.wiz-back:hover{ color:var(--text-1); background:var(--surface-2); }
.wiz-prog{ font-size:12px; color:var(--text-3); font-weight:600; letter-spacing:.06em; }
.wiz-title{ font-family:var(--font-display); font-weight:800; font-size:21px; margin:0 0 4px; }
.wiz-sub{ color:var(--text-2); font-size:13.5px; margin:0 0 18px; line-height:1.5; }

/* download links grid */
.dl-grid{ display:grid; grid-template-columns:1fr 1fr; gap:10px; margin:4px 0 16px; }
.dl{ display:flex; align-items:center; gap:9px; border:1px solid var(--border); border-radius:var(--r-md); padding:11px 12px; color:var(--text-1); text-decoration:none; font-size:13.5px; font-weight:600; background:var(--glass); transition:.14s; }
.dl:hover{ border-color:var(--border-2); background:var(--glass-strong); }
.dl span{ font-size:18px; }

/* PWA / push banner */
.banner{
  display:flex; align-items:center; gap:12px; border:1px solid var(--border-2); border-radius:var(--r-lg);
  padding:14px 16px; background:radial-gradient(120% 120% at 0% 0%, rgba(45,212,196,.1), transparent 60%), var(--glass);
}
.banner__icon{ flex:0 0 auto; width:38px; height:38px; border-radius:var(--r-md); display:grid; place-items:center; background:rgba(45,212,196,.14); color:var(--accent); font-size:20px; }
.banner__icon svg{ width:20px; height:20px; }
/* gold "attention" variant — key-expiry notifications banner */
.banner--gold{ border-color:var(--warning); background:radial-gradient(120% 120% at 0% 0%, rgba(226,178,60,.14), transparent 60%), var(--glass); }
.banner--gold .banner__icon--gold{ background:rgba(226,178,60,.16); color:var(--warning); }
.banner__main{ flex:1; min-width:0; }
.banner__title{ font-weight:700; font-size:14px; color:var(--text-1); }
.banner__desc{ font-size:12px; color:var(--text-3); margin-top:2px; }

/* plans */
.plan{
  display:flex; align-items:flex-start; gap:12px; width:100%; text-align:left; cursor:pointer;
  border:1px solid var(--border); border-radius:var(--r-lg); padding:16px; background:var(--glass); transition:.16s; margin-bottom:10px;
}
.plan[aria-selected="true"]{ border-color:var(--accent); box-shadow:0 0 0 3px rgba(45,212,196,.16); }
.plan__main{ flex:1; }
.plan__title{ font-weight:800; font-size:15px; color:var(--text-1); }
.plan__price{ font-family:var(--font-display); font-weight:800; font-size:18px; color:var(--accent-bright); }
.plan__desc{ font-size:12.5px; color:var(--text-3); margin-top:3px; }

/* toggle switch */
.switch{ position:relative; width:46px; height:28px; flex:0 0 auto; }
.switch input{ opacity:0; width:0; height:0; }
.switch .track{ position:absolute; inset:0; background:var(--surface-3); border:1px solid var(--border); border-radius:999px; transition:.18s; cursor:pointer; }
.switch .track::before{ content:""; position:absolute; left:3px; top:3px; width:20px; height:20px; border-radius:50%; background:var(--text-2); transition:.18s; }
.switch input:checked + .track{ background:rgba(45,212,196,.3); border-color:var(--accent); }
.switch input:checked + .track::before{ transform:translateX(18px); background:var(--accent); }

/* ===== SKELETON / SPINNER ===== */
.skeleton{ background:linear-gradient(90deg,var(--surface-2),var(--surface-3),var(--surface-2)); background-size:200% 100%; animation:shimmer 1.4s infinite; border-radius:var(--r-sm); }
@keyframes shimmer{ 0%{background-position:200% 0} 100%{background-position:-200% 0} }
.spinner{ display:inline-block; width:18px; height:18px; border:2px solid rgba(45,212,196,.25); border-top-color:var(--accent); border-radius:50%; animation:spin .7s linear infinite; flex-shrink:0; }
.spinner--lg{ width:34px; height:34px; border-width:3px; }
@keyframes spin{ to{ transform:rotate(360deg); } }
.wait{ display:flex; flex-direction:column; align-items:center; gap:14px; text-align:center; color:var(--text-2); font-size:14px; padding:8px 0; }

/* ===== ANIMATIONS ===== */
.rise{ animation:rise .6s cubic-bezier(.22,.8,.3,1) both; }
@keyframes rise{ from{opacity:0;transform:translateY(16px)} to{opacity:1;transform:translateY(0)} }
@keyframes fade{ from{opacity:0} to{opacity:1} }
@keyframes sheet-up{ from{transform:translateY(24px);opacity:.6} to{transform:translateY(0);opacity:1} }
@keyframes shake{ 0%,100%{transform:translateX(0)} 20%{transform:translateX(-8px)} 40%{transform:translateX(8px)} 60%{transform:translateX(-6px)} 80%{transform:translateX(6px)} }
.shake{ animation:shake .4s cubic-bezier(.36,.07,.19,.97) both; }

/* ===== TOAST ===== */
#toast-root{
  position:fixed; left:50%; bottom:calc(env(safe-area-inset-bottom) + 20px); transform:translateX(-50%);
  z-index:2000; display:flex; flex-direction:column; align-items:center; gap:8px; pointer-events:none;
  width:calc(100% - 32px); max-width:480px;
}
.toast{
  background:var(--surface-2); border:1px solid var(--border-2); border-radius:var(--r-md); color:var(--text-1);
  font-size:13.5px; padding:12px 18px; box-shadow:0 8px 24px rgba(2,12,16,.45); opacity:0; transform:translateY(10px);
  transition:opacity .22s, transform .22s; pointer-events:auto; text-align:center;
}
.toast.show{ opacity:1; transform:translateY(0); }
.toast--error{ border-color:rgba(226,98,92,.5); color:var(--danger); }

/* ===== STATE / FOOT ===== */
.state{ text-align:center; padding:40px 16px; color:var(--text-2); }
.state p{ margin:0 0 16px; }
.foot-hint{ text-align:center; font-size:13px; color:var(--text-3); margin-top:18px; }
.foot-hint a{ color:var(--accent-bright); text-decoration:none; font-weight:600; }
.foot-hint a:hover{ text-decoration:underline; }
.section-cap{ margin:22px 0 10px; }

/* dev brand toggle removed (single teal brand) */

/* scrollbars */
::-webkit-scrollbar{ width:8px; height:8px; }
::-webkit-scrollbar-track{ background:transparent; }
::-webkit-scrollbar-thumb{ background:var(--border-2); border-radius:999px; }
::-webkit-scrollbar-thumb:hover{ background:var(--border-3); }
