/* sonar — серый фон, одно чёрное действие, один шрифт. Сетка 8px. */
:root {
  --bg: #f3f3f3;
  --surface: #ffffff;
  --surface-2: #e9e9e9;
  --ink: #0a0a0a;
  --muted: #6b6b70;
  --faint: #a3a3a8;
  --btn: #000000;
  --btn-ink: #ffffff;
  --warn: #c2410c;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 8px 24px rgba(0, 0, 0, .04);
  --r-sm: 14px;
  --r-lg: 24px;
  --gutter: 24px;
  --col: 400px;
  --top-h: 80px;
  --foot-h: 96px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0b0c; --surface: #161618; --surface-2: #1f1f22; --ink: #f2f2f2;
    --muted: #9a9aa0; --faint: #5f5f66; --btn: #f2f2f2; --btn-ink: #000;
    --warn: #fb923c; --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b0b0c; --surface: #161618; --surface-2: #1f1f22; --ink: #f2f2f2;
  --muted: #9a9aa0; --faint: #5f5f66; --btn: #f2f2f2; --btn-ink: #000;
  --warn: #fb923c; --shadow: none; color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--ink);
  font: 400 16px/1.5 "Inter Tight", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button { font: inherit; color: inherit; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 8px; }

/* ---------- шапка ---------- */
.top { height: var(--top-h); display: flex; align-items: center; justify-content: space-between; padding: 0 var(--gutter); }
.logo { display: inline-flex; align-items: center; height: 40px; color: var(--ink); text-decoration: none; }
/* логотип — контуры, центр картинки = центр знака = середина букв; одинаково во всех браузерах */
.lockup { height: 22px; width: auto; max-width: 60vw; display: block; flex: none; }
.lockup .w-vpn { opacity: .38; }

main { flex: 1; width: 100%; display: flex; flex-direction: column; }

/* ---------- подвал ---------- */
.foot { padding: 24px var(--gutter); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; font-size: 12px; color: var(--muted); text-align: center; }
.foot nav { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px 0; }
.foot a { text-decoration: none; }
.foot a:hover { color: var(--ink); }
.foot .dot { margin: 0 8px; color: var(--faint); }
.foot .copy { color: var(--faint); }

/* ---------- кнопки и ссылки ---------- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  height: 52px; padding: 0 24px; border: 0; border-radius: var(--r-sm);
  background: var(--btn); color: var(--btn-ink); font-size: 16px; font-weight: 500;
  text-decoration: none; cursor: pointer; transition: opacity .15s, transform .15s;
}
.btn:hover { opacity: .88; }
.btn:active { transform: scale(.985); }
.btn svg { width: 18px; height: 18px; }
.btn-ghost { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

.link-muted {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 32px; padding: 0 4px; border: 0; background: none; cursor: pointer;
  color: var(--muted); font-size: 14px; text-decoration: none;
}
.link-muted:hover { color: var(--ink); }

/* ---------- один экран — одно действие ---------- */
.solo {
  width: 100%; max-width: calc(var(--col) + 2 * var(--gutter)); margin: 0 auto; padding: 32px var(--gutter);
  flex: 1; display: flex; flex-direction: column; justify-content: center; text-align: center;
}
.solo h1, .solo .big { font-size: 32px; line-height: 1.15; font-weight: 500; letter-spacing: -.035em; margin: 0 0 8px; }
.solo .big { font-size: 48px; }
.solo .sub { color: var(--muted); font-size: 16px; margin-bottom: 32px; text-wrap: balance; }
.solo .after { margin-top: 16px; }
.solo .gap { margin-top: 40px; }
.price { margin-top: 16px; font-size: 14px; color: var(--muted); }
.price b { color: var(--ink); font-weight: 500; }
.demo { margin-bottom: 16px; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); }
.mini { margin-top: 24px; display: flex; justify-content: center; align-items: center; }
.mini .dot { color: var(--faint); margin: 0 4px; }

/* ---------- вход ---------- */
.qr { width: 200px; height: 200px; margin: 0 auto 32px; }
.qr[hidden] { display: none; }
.qr svg { width: 100%; height: 100%; display: block; }
.qr rect.on { fill: var(--ink); }
.help-body { margin-top: 8px; padding: 16px; border-radius: var(--r-sm); background: var(--surface-2); font-size: 14px; color: var(--muted); text-align: left; }
.help-body .cmd { all: unset; display: block; width: 100%; box-sizing: border-box; margin-top: 8px; cursor: pointer; }
.help-body .cmd:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 10px; }
.help-body code { display: block; padding: 12px; border-radius: 10px; background: var(--surface); color: var(--ink); font: 13px/1.4 ui-monospace, "SF Mono", Menlo, monospace; word-break: break-all; }
.chev { transition: transform .2s; }
[aria-expanded="true"] .chev { transform: rotate(180deg); }

/* ---------- документы ---------- */
.doc { width: 100%; max-width: calc(720px + 2 * var(--gutter)); margin: 0 auto; padding: 16px var(--gutter) 0; }
.doc-nav { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 24px; }
.doc-nav a { height: 32px; display: inline-flex; align-items: center; padding: 0 12px; border-radius: 999px; font-size: 13px; text-decoration: none; color: var(--muted); }
.doc-nav a[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.doc h1 { font-size: 32px; line-height: 1.15; font-weight: 500; letter-spacing: -.03em; margin: 0 0 8px; }
.doc .meta { color: var(--muted); font-size: 14px; margin-bottom: 24px; }
.card { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 32px; }
.doc h2 { font-size: 17px; font-weight: 500; margin: 32px 0 8px; }
.doc h2:first-child { margin-top: 0; }
.doc p, .doc li { font-size: 15px; line-height: 1.6; }
.doc p { margin-bottom: 8px; }
.doc ol, .doc ul { margin: 0 0 8px; padding-left: 24px; }
.doc li { margin-bottom: 4px; }
.doc .num { display: inline-block; min-width: 32px; color: var(--muted); font-variant-numeric: tabular-nums; }
.doc .todo { background: color-mix(in srgb, var(--warn) 14%, transparent); padding: 0 4px; border-radius: 4px; }

/* ---------- уведомление ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(32px + env(safe-area-inset-bottom)); z-index: 50;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: max-content; max-width: min(calc(100vw - 2 * var(--gutter)), var(--col));
  min-height: 44px; padding: 10px 20px; border-radius: var(--r-sm);
  background: var(--btn); color: var(--btn-ink); font-size: 15px; font-weight: 500; line-height: 1.35; text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
  transform: translate(-50%, 12px); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 600px) { .toast { min-height: 40px; padding: 9px 16px; font-size: 14px; bottom: calc(24px + env(safe-area-inset-bottom)); } }

/* ---------- живой логотип: сигнал расходится волнами ---------- */
.mark .m-dot { transform-box: fill-box; transform-origin: center; animation: m-dot 2.4s ease-in-out infinite; }
.mark .m-w1 { animation: m-wave 2.4s ease-out .25s infinite; }
.mark .m-w2 { animation: m-wave 2.4s ease-out .6s infinite; }
@keyframes m-dot { 0%, 100% { transform: scale(1); } 12% { transform: scale(1.25); } 30% { transform: scale(1); } }
@keyframes m-wave { 0% { opacity: .12; } 18% { opacity: 1; } 55%, 100% { opacity: .12; } }

/* ---------- телефон ---------- */
@media (max-width: 600px) {
  :root { --gutter: 16px; --top-h: 72px; }
  .solo h1 { font-size: 28px; }
  .solo .big { font-size: 44px; }
  .card { padding: 24px 20px; }
  .doc h1 { font-size: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .mark .m-w2 { opacity: .45; }
}
[hidden] { display: none !important; }
.solo .big.big-text { font-size: 32px; }
@media (max-width: 600px) { .solo .big.big-text { font-size: 28px; } }
/* знак Telegram в кнопке: кружок цвета текста кнопки, самолётик — цвета самой кнопки (светлая/тёмная тема сами) */
.btn .tg { width: 22px; height: 22px; flex: none; margin-left: -4px; }
.btn .tg circle { fill: currentColor; }
.btn .tg .plane { fill: var(--btn); }
.btn-ghost .tg .plane { fill: var(--surface); }
/* подвал не прячется под нижней панелью Safari / полоской iPhone */
.foot { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }

/* ---------- кабинет: устройства, оплаты ---------- */
.btn:disabled, .btn.is-busy { opacity: .55; cursor: progress; }
.panel { margin-top: 32px; text-align: left; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 8px 0; }
.panel-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 16px; font-size: 13px; font-weight: 500; color: var(--muted); }
.muted { color: var(--faint); font-weight: 400; }
.rows { list-style: none; margin: 0; padding: 0; }
.row { display: flex; align-items: center; gap: 8px; min-height: 56px; padding: 0 8px 0 16px; border-top: 1px solid var(--surface-2); }
.rows > .row:first-child { border-top: 0; }
.row-empty { color: var(--faint); font-size: 14px; }
.row-main { all: unset; flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; padding: 8px 0; cursor: pointer; }
.row-main:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 8px; }
.row-title { font-size: 15px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub, .row-meta { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-meta { flex: none; }
.row-act { flex: none; height: 32px; padding: 0 12px; border: 0; border-radius: 999px; background: var(--surface-2); color: var(--ink); font-size: 13px; font-weight: 500; cursor: pointer; }
.row-x { flex: none; width: 32px; height: 32px; border: 0; border-radius: 999px; background: none; color: var(--faint); font-size: 13px; cursor: pointer; }
.row-x:hover { color: var(--warn); background: var(--surface-2); }
.row-add { all: unset; box-sizing: border-box; display: block; width: 100%; padding: 14px 16px; border-top: 1px solid var(--surface-2); font-size: 15px; font-weight: 500; cursor: pointer; }
.row-add::before { content: "+"; display: inline-block; width: 20px; color: var(--muted); }
.row-add:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; border-radius: 12px; }

/* ---------- чат поддержки ---------- */
.chat-page, .admin { width: 100%; max-width: calc(560px + 2 * var(--gutter)); margin: 0 auto; padding: 24px var(--gutter); flex: 1; display: flex; flex-direction: column; }
.chat-page h1, .admin h1 { font-size: 32px; line-height: 1.15; font-weight: 500; letter-spacing: -.035em; margin: 0 0 4px; text-align: center; }
.chat-page .sub { color: var(--muted); text-align: center; margin-bottom: 24px; }
.chat { flex: 1; min-height: 280px; max-height: 60dvh; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 16px; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.chat-admin { max-height: 50dvh; border-radius: 0; box-shadow: none; }
.chat-empty { margin: auto; max-width: 280px; text-align: center; color: var(--faint); font-size: 14px; }
.msg { max-width: 82%; padding: 10px 14px; border-radius: 18px; font-size: 15px; line-height: 1.4; }
.msg p { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-out { align-self: flex-end; background: var(--btn); color: var(--btn-ink); border-bottom-right-radius: 6px; }
.msg-in { align-self: flex-start; background: var(--surface-2); border-bottom-left-radius: 6px; }
.msg-time { display: block; margin-top: 4px; font-size: 11px; opacity: .55; }
.composer { display: flex; align-items: flex-end; gap: 8px; margin-top: 12px; }
.composer.is-busy { opacity: .6; pointer-events: none; }
.composer textarea { flex: 1; min-height: 52px; max-height: 160px; resize: none; padding: 14px 16px; border: 0; border-radius: var(--r-sm); background: var(--surface); color: var(--ink); box-shadow: var(--shadow); font: inherit; font-size: 16px; line-height: 1.5; }
.composer textarea:focus { outline: 2px solid var(--ink); outline-offset: 0; }
.send { flex: none; width: 52px; height: 52px; border: 0; border-radius: var(--r-sm); background: var(--btn); color: var(--btn-ink); cursor: pointer; display: grid; place-items: center; }
.send svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- админка ---------- */
.admin { max-width: calc(720px + 2 * var(--gutter)); }
.admin h1 { margin-bottom: 24px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 24px; }
.stat { background: var(--surface); border-radius: var(--r-sm); box-shadow: var(--shadow); padding: 16px; display: flex; flex-direction: column; gap: 2px; }
.stat b { font-size: 24px; font-weight: 500; letter-spacing: -.02em; }
.stat span { font-size: 12px; color: var(--muted); }
.tabs { display: flex; gap: 4px; padding: 4px; margin-bottom: 16px; background: var(--surface-2); border-radius: 999px; align-self: center; }
.tab { height: 36px; padding: 0 16px; border: 0; border-radius: 999px; background: none; color: var(--muted); font-size: 14px; font-weight: 500; cursor: pointer; }
.tab[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.pane > .rows { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 4px 0; }
.pane .panel { margin-top: 16px; padding-bottom: 0; overflow: hidden; }
.pane .panel .composer { margin: 0; padding: 8px; border-top: 1px solid var(--surface-2); }
.pane .panel .composer textarea { box-shadow: none; background: var(--surface-2); }
.search { width: 100%; height: 48px; margin-bottom: 12px; padding: 0 16px; border: 0; border-radius: var(--r-sm); background: var(--surface); color: var(--ink); box-shadow: var(--shadow); font: inherit; font-size: 16px; }
.search:focus { outline: 2px solid var(--ink); }
@media (max-width: 600px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .row-meta { display: none; }
}
