/* RusoVPN — кабинет. Идея: подписка = проездной. Карточка статуса — билет,
   его цвет говорит о состоянии (зелёный / янтарный / кирпичный). Всё остальное тихое. */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --paper: #ECEEE8;
  --surface: #FAFBF7;
  --ink: #16222C;
  --ink-2: #56616B;
  --ink-3: #8A939A;
  --line: #CDD2C8;
  --pass: #0F6A4F;
  --pass-press: #0B5440;
  --pass-trial: #B4720C;
  --pass-off: #8E3A30;
  --tg: #2481CC;
  --danger: #B3362B;
  --danger-soft: #F4E1DD;
  --ok-soft: #DCEBE3;

  --f-display: 'Unbounded', 'Golos Text', system-ui, sans-serif;
  --f-body: 'Golos Text', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --f-mono: 'JetBrains Mono', 'SF Mono', Menlo, monospace;

  --r: 6px;
  --r-ticket: 10px;
  --ease: 160ms ease;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #11171C;
    --surface: #182027;
    --ink: #E5E8E2;
    --ink-2: #A3ACB2;
    --ink-3: #6F7A82;
    --line: #2A353D;
    --pass: #17865F;
    --pass-press: #13704F;
    --pass-trial: #C7840F;
    --pass-off: #A4473B;
    --tg: #3A97DE;
    --danger: #E0796D;
    --danger-soft: #3A2220;
    --ok-soft: #173327;
  }
}

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--f-body);
  font-size: 16px;
  line-height: 1.45;
  background: var(--paper);
  color: var(--ink);
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

#app {
  max-width: 460px;
  margin: 0 auto;
  padding: 0 16px 96px;
}

.hidden { display: none !important; }

:focus-visible { outline: 2px solid var(--pass); outline-offset: 2px; }

/* ── Вход ── */
.login-container {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 28px 0 40px;
}

.login-brand { margin-bottom: auto; }

.login-title {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: 0.01em;
}

.login-form { margin-bottom: auto; }

.login-heading {
  font-family: var(--f-display);
  font-weight: 500;
  font-size: 30px;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}

.login-lead {
  color: var(--ink-2);
  margin-bottom: 28px;
}

.input-group { margin-bottom: 14px; }

.input-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-2);
  margin-bottom: 6px;
}

.input {
  width: 100%;
  padding: 13px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  color: var(--ink);
  font: inherit;
  font-size: 17px;
  outline: none;
  transition: border-color var(--ease);
}
.input:focus { border-color: var(--ink); }
.input::placeholder { color: var(--ink-3); }

.input-code {
  font-family: var(--f-mono);
  font-size: 30px;
  letter-spacing: 0.4em;
  text-align: center;
  padding: 12px 0 12px 0.4em;
}

.code-hint { color: var(--ink-2); margin-bottom: 18px; }
.code-email { color: var(--ink); font-weight: 600; }

.error-msg {
  margin-top: 14px;
  padding: 10px 12px;
  border-left: 3px solid var(--danger);
  background: var(--danger-soft);
  color: var(--ink);
  font-size: 15px;
}

/* ── Кнопки ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 18px;
  border: 1px solid transparent;
  border-radius: var(--r);
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  color: var(--ink);
  background: transparent;
  text-decoration: none;
  transition: background var(--ease), border-color var(--ease), color var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:hover { background: var(--pass); color: #fff; }

.btn-green { background: var(--pass); color: #fff; }
.btn-green:hover { background: var(--pass-press); }

.btn-outline { border-color: var(--ink); color: var(--ink); }
.btn-outline:hover { background: var(--ink); color: var(--paper); }

.btn-ghost { border-color: var(--line); color: var(--ink-2); background: var(--surface); }
.btn-ghost:hover { border-color: var(--ink); color: var(--ink); }

.btn-text {
  color: var(--ink-2);
  font-weight: 500;
  padding: 12px 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.btn-text:hover { color: var(--ink); }

.btn-full, .btn-block { width: 100%; display: flex; text-align: center; }
.btn-sm { padding: 8px 12px; font-size: 14px; }

.btn-icon, .btn-back {
  width: 40px; height: 40px;
  padding: 0;
  color: var(--ink-2);
  border-color: var(--line);
}
.btn-icon:hover, .btn-back:hover { color: var(--ink); border-color: var(--ink); }

/* ── Шапка кабинета ── */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 0 18px;
}
.topbar-brand {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 17px;
}

/* ── Билет (статус подписки) ── */
.status-card {
  --pass-c: var(--pass);
  position: relative;
  background: var(--pass-c);
  color: #fff;
  border-radius: var(--r-ticket);
  margin-bottom: 24px;
  overflow: hidden;
}
.status-card:has(.badge-trial) { --pass-c: var(--pass-trial); }
.status-card:has(.badge-expired) { --pass-c: var(--pass-off); }

.status-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 18px 16px;
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.status-email {
  opacity: 0.8;
  text-transform: none;
  letter-spacing: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge {
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 8px;
  border: 1px solid rgba(255,255,255,0.55);
  border-radius: 3px;
  white-space: nowrap;
}

/* перфорация между корешком и телом билета */
.status-balance-row {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 18px 18px 20px;
  border-top: 2px dashed rgba(255,255,255,0.35);
}
.status-balance-row::before,
.status-balance-row::after {
  content: '';
  position: absolute;
  top: -10px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--paper);
}
.status-balance-row::before { left: -9px; }
.status-balance-row::after { right: -9px; }

.balance-block { display: flex; flex-direction: column; gap: 4px; }
.balance-right { align-items: flex-end; text-align: right; }

.balance-label {
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.8;
}

.balance-days {
  font-family: var(--f-display);
  font-weight: 500;
  font-size: 40px;
  line-height: 1;
  letter-spacing: -0.03em;
}

.status-card:has(.badge-expired) .balance-days { font-size: 24px; letter-spacing: -0.01em; }

.balance-value {
  font-family: var(--f-display);
  font-weight: 400;
  font-size: 20px;
  line-height: 1.2;
}

/* ── Активация роутера ── */
.oem-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-ticket);
  padding: 18px;
  margin-bottom: 24px;
}
.oem-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 10px; }
.oem-card-title { font-weight: 600; }
.oem-card-chip {
  font-family: var(--f-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--ink-2);
}
.oem-card-serial { font-family: var(--f-mono); font-size: 13px; color: var(--ink-2); margin-bottom: 12px; }
.oem-bundle-banner { border-left: 3px solid var(--pass); background: var(--ok-soft); padding: 8px 12px; font-size: 14px; font-weight: 500; margin-bottom: 12px; }
.oem-card-rows { display: flex; justify-content: space-between; margin-bottom: 14px; gap: 10px; font-size: 14px; }
.oem-card-rows .row { flex: 1; }
.oem-card-rows .row-label { font-family: var(--f-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); }
.oem-card-rows .row-value { font-weight: 600; margin-top: 2px; }
.oem-card-price { font-family: var(--f-display); font-size: 26px; text-align: center; margin: 6px 0 4px; }
.oem-card-period { text-align: center; color: var(--ink-2); font-size: 13px; margin-bottom: 14px; }
.oem-card-btn {
  display: block; width: 100%;
  padding: 13px;
  font: inherit; font-weight: 600;
  border: 0; border-radius: var(--r);
  cursor: pointer;
  margin-bottom: 8px;
  background: var(--pass); color: #fff;
}
.oem-card-btn:hover { background: var(--pass-press); }
.oem-card-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.oem-card-btn:last-child { margin-bottom: 0; }
.oem-card-active { border-color: var(--pass); }
.oem-card-note { margin-top: 8px; font-size: 13px; color: var(--ink-2); text-align: center; }
.oem-card-note a { color: var(--ink); }
.oem-card-error { margin-top: 8px; padding: 8px 10px; border-left: 3px solid var(--danger); background: var(--danger-soft); font-size: 14px; display: none; }

.oem-plans { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0 14px; }
.oem-plan {
  position: relative;
  padding: 10px 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r);
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: var(--ink);
}
.oem-plan:hover { border-color: var(--ink-2); }
.oem-plan.selected { border-color: var(--pass); box-shadow: inset 0 0 0 1px var(--pass); }
.oem-plan-label { font-size: 13px; color: var(--ink-2); }
.oem-plan-price { font-family: var(--f-display); font-size: 17px; margin-top: 2px; }
.oem-plan-discount {
  position: absolute; top: -9px; right: 8px;
  background: var(--ink); color: var(--paper);
  font-family: var(--f-mono); font-size: 10px;
  padding: 2px 6px; border-radius: 3px;
}
.oem-plan-permonth { font-size: 11px; color: var(--ink-3); margin-top: 1px; }

/* ── Привязка Telegram ── */
.tg-card {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 16px;
  margin-bottom: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-ticket);
}
.tg-card-icon { color: var(--tg); flex-shrink: 0; line-height: 0; }
.tg-card-icon svg { width: 28px; height: 28px; }
.tg-card-content { flex: 1; min-width: 0; }
.tg-card-title { font-weight: 600; margin-bottom: 10px; }
.tg-card-desc { display: none; }
.tg-card-btn { background: var(--tg); color: #fff; padding: 9px 14px; font-size: 15px; }
.tg-card-btn:hover { background: var(--tg); filter: brightness(1.08); color: #fff; }

.tg-float {
  position: fixed;
  left: 12px; right: 12px; bottom: 12px;
  max-width: 436px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px 10px 14px;
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--r-ticket);
  font-size: 15px;
  z-index: 100;
}
@media (prefers-color-scheme: dark) {
  .tg-float { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
  .tg-float-close { color: var(--ink); }
}
.tg-float > svg { color: var(--tg); flex-shrink: 0; }
.tg-float > span { flex: 1; }
.tg-float .btn-primary { background: var(--tg); color: #fff; }
.tg-float-close {
  background: none; border: 0;
  color: var(--paper); opacity: 0.6;
  font-size: 22px; line-height: 1;
  width: 32px; height: 32px;
  cursor: pointer;
}
.tg-float-close:hover { opacity: 1; }

/* ── Промокод ── */
.promo-section { margin-bottom: 28px; }
.promo-row { display: flex; gap: 8px; }
.input-promo {
  font-family: var(--f-mono);
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.input-promo::placeholder { text-transform: none; letter-spacing: 0; font-family: var(--f-body); }
.btn-promo { flex-shrink: 0; padding: 0 18px; }
.promo-result { margin-top: 8px; padding: 8px 12px; font-size: 14px; border-left: 3px solid; }
.promo-result.success { border-color: var(--pass); background: var(--ok-soft); }
.promo-result.error { border-color: var(--danger); background: var(--danger-soft); }

/* ── Меню кабинета: список, а не плитки ── */
.actions-grid {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--line);
}
.action-card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 17px 2px;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line);
  font: inherit;
  font-size: 17px;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.action-card::after {
  content: '→';
  margin-left: auto;
  color: var(--ink-3);
  transition: transform var(--ease), color var(--ease);
}
.action-card:hover::after { transform: translateX(3px); color: var(--ink); }
.action-icon { color: var(--ink-2); line-height: 0; }
.action-icon svg { width: 20px; height: 20px; }
.action-label { font-weight: 500; }

/* ── Внутренние страницы ── */
.page-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 0 22px;
}
.page-header h2 {
  font-family: var(--f-display);
  font-weight: 500;
  font-size: 21px;
  letter-spacing: -0.01em;
}

.page-desc { color: var(--ink-2); margin-bottom: 16px; }

.warning-banner {
  border-left: 3px solid var(--pass-trial);
  background: var(--surface);
  padding: 10px 12px;
  font-size: 15px;
  margin-bottom: 16px;
}

/* Платформы и приложения */
.platform-list { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.platform-card, .app-list-item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 16px 2px;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line);
  font: inherit;
  font-size: 17px;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.platform-icon { color: var(--ink-2); line-height: 0; width: 28px; display: flex; justify-content: center; }
.platform-icon svg { width: 22px; height: 22px; }
.platform-name { flex: 1; font-weight: 500; }
.platform-arrow, .app-arrow { color: var(--ink-3); line-height: 0; }
.platform-card:hover .platform-arrow, .app-list-item:hover .app-arrow { color: var(--ink); }

#apps-list { border-top: 1px solid var(--line); }
.app-num { font-family: var(--f-mono); font-size: 13px; color: var(--ink-3); width: 20px; }
.app-name-row { flex: 1; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.app-name-text { font-weight: 500; }
.badge-rec {
  font-family: var(--f-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--pass);
  border: 1px solid currentColor;
  padding: 1px 6px;
  border-radius: 3px;
}

/* Инструкция: настоящая последовательность шагов */
.instruction-step {
  position: relative;
  padding: 0 0 26px 40px;
  border-left: 1px solid var(--line);
  margin-left: 13px;
}
.instruction-step:last-child { border-left-color: transparent; }
.step-title { font-weight: 600; font-size: 17px; margin-bottom: 12px; line-height: 28px; }
.step-number {
  position: absolute;
  left: -14px; top: 0;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  background: var(--ink); color: var(--paper);
  border-radius: 50%;
  font-family: var(--f-mono);
  font-size: 13px;
}
.step-body { margin-bottom: 10px; }

.key-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 8px 8px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
}
.key-text {
  flex: 1;
  min-width: 0;
  font-family: var(--f-mono);
  font-size: 13px;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hint-text { color: var(--ink-2); font-size: 15px; margin: 4px 0 10px; }
.route-section { margin-top: 16px; }
.route-desc { color: var(--ink-2); font-size: 15px; margin-bottom: 10px; }

/* ── Оформление подписки ── */
.tariff {
  border-top: 1px solid var(--ink);
  margin-bottom: 20px;
}
.tariff-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.tariff-name { color: var(--ink-2); }
.tariff-price {
  font-family: var(--f-display);
  font-weight: 500;
  font-size: 24px;
  letter-spacing: -0.02em;
}
.tariff-note { font-size: 14px; color: var(--pass); margin-left: 8px; font-family: var(--f-body); letter-spacing: 0; }

.topup-amounts { display: grid; gap: 10px; }
.topup-amount-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 100%;
  padding: 15px;
  background: var(--pass);
  color: #fff;
  border: 0;
  border-radius: var(--r);
  font: inherit;
  cursor: pointer;
  transition: background var(--ease);
}
.topup-amount-btn:hover { background: var(--pass-press); }
.topup-sum { font-size: 17px; font-weight: 600; }
.topup-days { font-size: 13px; opacity: 0.8; }

/* «i» — пояснение по тапу */
.info {
  margin-top: 14px;
  font-size: 14px;
  color: var(--ink-2);
}
.info summary {
  list-style: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  border: 1px solid var(--line);
  border-radius: 50%;
  font-family: var(--f-mono);
  font-size: 13px;
  cursor: pointer;
}
.info summary::-webkit-details-marker { display: none; }
.info[open] summary { border-color: var(--ink); color: var(--ink); }
.info p { margin-top: 10px; }

/* ── Рефералы ── */
.ref-card { margin-bottom: 20px; }
.ref-desc { font-size: 17px; margin-bottom: 18px; }
.ref-desc strong { font-family: var(--f-display); font-weight: 500; }
.ref-label { font-size: 14px; color: var(--ink-2); margin-bottom: 6px; }
.ref-link-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 8px 8px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
}
.ref-link-text {
  flex: 1; min-width: 0;
  font-family: var(--f-mono);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ref-share-row { display: flex; gap: 8px; margin-top: 10px; }
.ref-share-row .btn { flex: 1; }
.ref-qr { margin-top: 14px; text-align: center; }
.ref-qr img { width: 220px; height: 220px; background: #fff; padding: 10px; border-radius: var(--r); }
.ref-qr-hint { font-size: 14px; color: var(--ink-2); margin-top: 8px; }
.ref-stats-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-top: 22px;
  border-top: 1px solid var(--line);
}
.ref-stat { padding: 14px 0 0; display: flex; flex-direction: column; gap: 2px; }
.ref-stat + .ref-stat { padding-left: 16px; border-left: 1px solid var(--line); }
.ref-stat-num { font-family: var(--f-display); font-weight: 500; font-size: 28px; line-height: 1.1; }
.ref-stat-label { font-size: 14px; color: var(--ink-2); }
.ref-item {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
}
.ref-date { color: var(--ink-3); font-family: var(--f-mono); font-size: 13px; }
.empty-text { color: var(--ink-3); padding: 16px 0; }

/* ── Настройки ── */
.settings-section { margin-bottom: 28px; }
.settings-title {
  font-family: var(--f-mono);
  font-size: 12px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  margin-bottom: 8px;
}
.server-list { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.server-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 2px;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line);
  font: inherit;
  font-size: 17px;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.server-item.active { font-weight: 600; }
.server-item .check { color: var(--pass); font-weight: 700; }

.success-text { color: var(--pass); font-weight: 500; }
.tg-hint-text { color: var(--ink-2); font-size: 15px; margin-bottom: 10px; }

/* ── Тост ── */
.toast {
  position: fixed;
  bottom: 84px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--paper);
  padding: 10px 18px;
  border-radius: var(--r);
  font-size: 15px;
  font-weight: 500;
  z-index: 1000;
  animation: toastIn 0.2s ease;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.page { animation: pageIn 0.18s ease; }
@keyframes pageIn { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ── v3.26.0: оплата двумя способами, блок «VPN не активен», вход без регистрации ── */
.pay-way { font-family: var(--f-display); font-weight: 500; font-size: 18px; margin: 22px 0 6px; }
.tariff-link { color: inherit; text-decoration: none; }
.tariff-link:hover .tariff-price { color: var(--pass); }
.pay-cta { border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin-bottom: 20px; display: grid; gap: 10px; }
.pay-cta-title { font-weight: 600; }
.pay-cta-note { font-size: 14px; color: var(--ink-2); }
.login-new { margin-top: 18px; }
.login-new a { color: inherit; }

/* Плавающая плашка Telegram не закрывает последние пункты меню */
body:has(.tg-float:not(.hidden)) #app { padding-bottom: 96px; }
