/* ============================================================
   Skynet cabinet — тёмная тема (не чёрная) с тёмно-кислотной подсветкой.
   Хотите другой акцент — меняйте только переменные --acid* ниже.
   ============================================================ */
@font-face { font-family: "Space Grotesk"; font-weight: 400; font-display: swap; src: url("/static/fonts/SpaceGrotesk-Regular.ttf") format("truetype"); }
@font-face { font-family: "Space Grotesk"; font-weight: 500; font-display: swap; src: url("/static/fonts/SpaceGrotesk-Medium.ttf") format("truetype"); }
@font-face { font-family: "Space Grotesk"; font-weight: 700; font-display: swap; src: url("/static/fonts/SpaceGrotesk-Bold.ttf") format("truetype"); }

:root {
  --bg: #13141b;
  --bg-side: #101117;
  --card: #1a1c26;
  --card-2: #212433;
  --line: #2a2d3d;
  --line-2: #363a50;
  --text: #eceef6;
  --muted: #8b91a8;
  --acid: #9bdc1b;            /* основной акцент (тёмно-кислотный) */
  --acid-ink: #0f1405;        /* цвет текста на акценте */
  --acid-soft: rgba(155, 220, 27, .12);
  --acid-line: rgba(155, 220, 27, .38);
  --acid-glow: 0 0 0 1px rgba(155, 220, 27, .35), 0 8px 32px -8px rgba(155, 220, 27, .45);
  --err: #ff6b7a;
  --err-soft: rgba(255, 107, 122, .12);
  --ok: #9bdc1b;
  --radius: 18px;
  --side-w: 248px;
  --side-w-min: 78px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); color-scheme: dark; }
body {
  margin: 0; min-height: 100vh; color: var(--text);
  font: 16px/1.5 "Space Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(155, 220, 27, .07), transparent 60%),
    radial-gradient(700px 480px at -5% 105%, rgba(110, 96, 255, .06), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}
a { color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 28px; line-height: 1.15; }
h2 { font-size: 18px; }
p { margin: 0; }
svg.ic { width: 22px; height: 22px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Каркас с сайдбаром ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; width: var(--side-w); flex: none;
  display: flex; flex-direction: column; gap: 6px; padding: 18px 14px;
  background: var(--bg-side); border-right: 1px solid var(--line);
  transition: width .22s ease;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 6px 8px 18px; text-decoration: none; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 12px; flex: none; display: grid; place-items: center;
  background: var(--acid); color: var(--acid-ink); font-weight: 700; font-size: 18px; box-shadow: var(--acid-glow);
}
.brand-name { font-weight: 700; font-size: 18px; white-space: nowrap; }
.brand-name small { display: block; font-size: 12px; font-weight: 400; color: var(--muted); margin-top: -2px; }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a, .side-btn {
  display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 14px;
  color: var(--muted); text-decoration: none; font-weight: 500; white-space: nowrap;
  background: none; border: 0; font-family: inherit; font-size: 16px; cursor: pointer; width: 100%; text-align: left;
  transition: background .15s, color .15s;
}
.nav a:hover, .side-btn:hover { background: var(--card); color: var(--text); }
.nav a.on { background: var(--acid-soft); color: var(--acid); box-shadow: inset 0 0 0 1px var(--acid-line); }
.side-bottom { margin-top: auto; display: flex; flex-direction: column; gap: 4px; }
.side-btn .chev { transition: transform .22s; }

html.sb-collapsed .sidebar { width: var(--side-w-min); }
html.sb-collapsed .brand-name, html.sb-collapsed .lbl { display: none; }
html.sb-collapsed .nav a, html.sb-collapsed .side-btn { justify-content: center; padding: 12px 0; }
html.sb-collapsed .brand { justify-content: center; padding-left: 0; padding-right: 0; }
html.sb-collapsed .side-btn .chev { transform: rotate(180deg); }

.main { flex: 1; min-width: 0; padding: 36px clamp(18px, 4vw, 48px) 60px; }
.page { max-width: 1080px; margin: 0 auto; }
.page-head { margin-bottom: 26px; }
.page-head p { color: var(--muted); margin-top: 6px; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; font-size: 15px; margin-bottom: 14px; }
.back:hover { color: var(--text); }

/* ---------- Карточки и сетка ---------- */
.grid { display: grid; gap: 18px; grid-template-columns: repeat(12, 1fr); }
.col-12 { grid-column: span 12; }
.col-6 { grid-column: span 6; }
.col-4 { grid-column: span 4; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px;
  display: flex; flex-direction: column; gap: 14px; min-width: 0;
}
.card.glow { border-color: var(--acid-line); box-shadow: var(--acid-glow); background:
  radial-gradient(520px 220px at 100% 0%, rgba(155, 220, 27, .10), transparent 70%), var(--card); }
.card-title { display: flex; align-items: center; gap: 12px; }
.card-ico { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; flex: none;
  background: var(--acid-soft); color: var(--acid); box-shadow: inset 0 0 0 1px var(--acid-line); }
.card .sub { color: var(--muted); font-size: 14px; }
.card .push { margin-top: auto; }
.card-link { text-decoration: none; transition: transform .15s, border-color .15s; }
.card-link:hover { transform: translateY(-2px); border-color: var(--acid-line); }

/* ---------- Главная карточка подписки ---------- */
.hero { display: grid; grid-template-columns: 1.1fr 1fr; gap: 28px; align-items: center; }
.hero-days { display: flex; align-items: baseline; gap: 10px; }
.hero-days b { font-size: clamp(56px, 9vw, 88px); line-height: 1; letter-spacing: -.04em; color: var(--text); }
.hero-days span { font-size: 22px; color: var(--muted); }
.hero-state { font-size: clamp(34px, 6vw, 52px); font-weight: 700; line-height: 1.1; }
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 500;
  background: var(--card-2); color: var(--muted); border: 1px solid var(--line-2); width: fit-content; }
.pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.pill.on { color: var(--acid); background: var(--acid-soft); border-color: var(--acid-line); }
.pill.on i { background: var(--acid); box-shadow: 0 0 10px var(--acid); }
.pill.off { color: var(--err); background: var(--err-soft); border-color: rgba(255, 107, 122, .35); }
.pill.off i { background: var(--err); }
.meta { display: flex; flex-wrap: wrap; gap: 8px; }
.actions { display: flex; flex-direction: column; gap: 10px; }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
  padding: 14px 18px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--card-2); color: var(--text);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; text-align: center;
  transition: transform .12s, border-color .15s, background .15s, box-shadow .15s;
}
.btn:hover { border-color: var(--acid-line); background: #272b3d; }
.btn:active { transform: scale(.985); }
.btn.primary { background: var(--acid); color: var(--acid-ink); border-color: var(--acid); box-shadow: var(--acid-glow); }
.btn.primary:hover { background: #aaea2b; }
.btn.danger { color: var(--err); background: var(--err-soft); border-color: rgba(255, 107, 122, .35); }
.btn.danger:hover { background: rgba(255, 107, 122, .2); border-color: var(--err); }
.btn.sm { padding: 9px 14px; font-size: 14px; border-radius: 12px; width: auto; }
.btn[disabled] { opacity: .5; pointer-events: none; }

/* ---------- Формы ---------- */
.field { display: flex; flex-direction: column; gap: 7px; }
.field label { font-size: 14px; color: var(--muted); }
.input-wrap { position: relative; }
.input {
  width: 100%; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line-2); background: #151722; color: var(--text);
  font: inherit; font-size: 16px; /* 16px — чтобы iOS не зумил поле */ transition: border-color .15s, box-shadow .15s;
}
.input:focus { outline: none; border-color: var(--acid); box-shadow: 0 0 0 3px var(--acid-soft); }
.input-wrap .input { padding-right: 48px; }
.eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border: 0; background: none;
  color: var(--muted); cursor: pointer; display: grid; place-items: center; border-radius: 10px; }
.eye:hover { color: var(--text); }
.form { display: flex; flex-direction: column; gap: 14px; }
.alert { padding: 12px 14px; border-radius: 12px; font-size: 14px; border: 1px solid; }
.alert.err { color: var(--err); background: var(--err-soft); border-color: rgba(255, 107, 122, .35); }
.alert.ok { color: var(--acid); background: var(--acid-soft); border-color: var(--acid-line); }
.alert.info { color: var(--muted); background: var(--card-2); border-color: var(--line-2); }

/* ---------- Ссылка + копирование ---------- */
.linkbox { display: flex; gap: 10px; align-items: stretch; }
.linkbox code { flex: 1; min-width: 0; padding: 13px 14px; border-radius: 14px; background: #151722; border: 1px solid var(--line-2);
  font: 14px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; user-select: all; }
.linkbox .btn { width: auto; flex: none; }

/* ---------- Статистика ---------- */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.stat { background: var(--card-2); border: 1px solid var(--line); border-radius: 16px; padding: 18px; }
.stat span { color: var(--muted); font-size: 14px; }
.stat b { display: block; font-size: 30px; letter-spacing: -.02em; margin-top: 4px; }
.stat.acid b { color: var(--acid); }

/* ---------- Тарифы ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-width: 46px; text-align: center; padding: 9px 14px; border-radius: 12px; border: 1px solid var(--line-2); text-decoration: none; font-weight: 500; }
.chip:hover { border-color: var(--acid-line); }
.chip.on { background: var(--acid); color: var(--acid-ink); border-color: var(--acid); }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.plan { display: flex; flex-direction: column; gap: 4px; text-align: left; padding: 18px; border-radius: 16px; background: var(--card-2);
  border: 1px solid var(--line-2); color: var(--text); font: inherit; cursor: pointer; transition: border-color .15s, transform .12s, box-shadow .15s; }
.plan:hover { border-color: var(--acid); box-shadow: var(--acid-glow); transform: translateY(-2px); }
.plan .name { color: var(--muted); font-size: 14px; }
.plan .price { font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
.plan .per { color: var(--acid); font-size: 13px; }

/* ---------- Устройства ---------- */
.dev-list { display: flex; flex-direction: column; gap: 12px; }
.dev { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 16px; background: var(--card-2); border: 1px solid var(--line); }
.dev-ico { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--acid-soft); color: var(--acid); flex: none; }
.dev-info { flex: 1; min-width: 0; }
.dev-info b { display: block; overflow-wrap: anywhere; }
.dev-info span { display: block; color: var(--muted); font-size: 13px; }
.meter { height: 8px; border-radius: 99px; background: var(--card-2); overflow: hidden; border: 1px solid var(--line); }
.meter i { display: block; height: 100%; background: var(--acid); box-shadow: 0 0 12px var(--acid); border-radius: 99px; }
.empty { text-align: center; color: var(--muted); padding: 26px 10px; }

/* ---------- Вход / регистрация ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 22px 16px; }
.auth-box { width: 100%; max-width: 440px; display: flex; flex-direction: column; gap: 18px; }
.auth-box .brand { justify-content: center; padding: 0; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 5px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; }
.tabs a { text-align: center; padding: 11px; border-radius: 12px; text-decoration: none; color: var(--muted); font-weight: 500; }
.tabs a.on { background: var(--acid-soft); color: var(--acid); box-shadow: inset 0 0 0 1px var(--acid-line); }
.auth .card { padding: 26px; }
.fine { color: var(--muted); font-size: 13px; text-align: center; }
.fine a { color: var(--text); }

/* ---------- Нижняя панель (телефон) ---------- */
.bottomnav { display: none; }
.logout-inline { display: none; }

/* ---------- Диалог подтверждения ---------- */
dialog.confirm { border: 1px solid var(--line-2); border-radius: 20px; background: var(--card); color: var(--text); padding: 26px; width: min(420px, calc(100vw - 32px)); }
dialog.confirm::backdrop { background: rgba(8, 9, 14, .72); backdrop-filter: blur(3px); }
dialog.confirm h3 { margin-bottom: 8px; }
dialog.confirm p { color: var(--muted); margin-bottom: 20px; }
dialog.confirm .row { display: flex; gap: 10px; }

/* ---------- QR-код ---------- */
.btn.qr { width: auto; flex: none; padding-left: 16px; padding-right: 16px; }
.btn.qr svg.ic { width: 20px; height: 20px; }
.btn-row { display: flex; gap: 10px; align-items: stretch; }
.btn-row > .btn:first-child { flex: 1 1 0; min-width: 0; }
.linkbtns { display: flex; gap: 10px; flex: none; }
.linkbtns .btn { width: auto; }
dialog.qr { border: 1px solid var(--line-2); border-radius: 22px; background: var(--card); color: var(--text); padding: 24px;
  width: min(360px, calc(100vw - 32px)); text-align: center; }
dialog.qr[open] { animation: qr-in .18s ease-out; }
dialog.qr::backdrop { background: rgba(8, 9, 14, .72); backdrop-filter: blur(3px); }
dialog.qr h3 { margin-bottom: 16px; }
.qr-box { width: min(280px, 100%); margin: 0 auto; border-radius: 20px; overflow: hidden; line-height: 0;
  box-shadow: 0 0 0 1px var(--acid-line), 0 10px 40px -12px rgba(155, 220, 27, .35); }
.qr-box svg { width: 100%; height: auto; display: block; }
.qr-hint { color: var(--muted); font-size: 14px; margin: 16px 0 18px; }
@keyframes qr-in { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }

/* ---------- Адаптив ---------- */
@media (max-width: 980px) {
  .col-4 { grid-column: span 6; }
  .col-4:last-child:nth-child(odd) { grid-column: span 12; }
  .hero { grid-template-columns: 1fr; gap: 20px; }
}
@media (max-width: 820px) {
  .sidebar { display: none; }
  .main { padding: 22px 16px calc(96px + env(safe-area-inset-bottom)); }
  h1 { font-size: 24px; }
  .grid { gap: 14px; }
  .col-6, .col-4 { grid-column: span 12; }
  .card { padding: 20px; }
  .bottomnav {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); background: rgba(16, 17, 23, .94); backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
  }
  .bottomnav a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 4px; border-radius: 14px; text-decoration: none; color: var(--muted); font-size: 12px; font-weight: 500; }
  .bottomnav a.on { color: var(--acid); background: var(--acid-soft); }
  .logout-inline { display: block; text-align: center; margin-top: 22px; }
  .linkbox { flex-direction: column; }
  .linkbox .btn { width: 100%; }
  .linkbtns { width: 100%; }
  .linkbtns .btn:first-child { flex: 1; }
  .linkbtns .btn.qr { width: auto; }
  .dev { flex-wrap: wrap; }
  .dev-info { flex-basis: calc(100% - 64px); }
  .dev form { width: 100%; }
  .dev .btn { width: 100%; }
  .stats { gap: 10px; }
  .stat { padding: 14px; }
  .stat b { font-size: 24px; }
}
@media (max-width: 380px) { .plans { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.linklike { background: none; border: 0; color: var(--muted); font: inherit; font-size: 14px; cursor: pointer; text-decoration: underline; }

.auth-links { display: flex; flex-direction: column; gap: 10px; width: 100%; margin-top: 4px; }
.auth-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.auth-tile {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  height: 56px; padding: 0 12px; border-radius: 18px;
  background: var(--card-2); border: 1px solid var(--line-2);
  color: var(--text); font-size: 15px; font-weight: 600; text-decoration: none; white-space: nowrap;
  transition: border-color .15s, background .15s, transform .1s;
}
.auth-tile:hover { border-color: var(--acid-line); background: #272b3d; }
.auth-tile:active { transform: scale(.98); }
.auth-ic {
  width: 22px; height: 22px; flex: none;
  fill: none; stroke: var(--acid); stroke-width: 2.6;
  stroke-linecap: round; stroke-linejoin: round;
}

.legal { max-width: 720px; margin: 0 auto; padding: 24px 18px 48px; line-height: 1.6; color: var(--text); }
.legal h1 { font-size: 26px; margin: 12px 0 8px; }
.legal h2 { font-size: 17px; margin: 24px 0 6px; }
.legal p { color: var(--muted); margin: 0 0 8px; }
.legal a { color: var(--acid); }
.legal-back { color: var(--muted); text-decoration: none; font-size: 14px; }
.legal-note { margin-top: 12px; }