/* ─────────────────────────────────────────────────────────────────
   Кабинет Foxon — визуальный язык панели Remnawave.

   Палитра взята у панели один в один, потому что именно она делает
   продукт узнаваемым: пользователь ходит между кабинетом, страницей
   подписки и приложением и должен видеть один сервис.

     --bg / --surface / --text / --brand   ← --mantine-color-* панели

   Отступления от панели ровно три, и все ради того, что панель —
   инструмент администратора, а это экран клиента:
     • акцент ярче: #0C8599 на тёмном фоне глохнет, кнопка не читается
       как кнопка;
     • радиусы крупнее (панель: 8px) — на клиентском экране 8px сухо;
     • появился промежуточный слой --surface-2, чтобы карточка
       отделялась от фона, а вложенные блоки — от карточки.

   ШРИФТ СИСТЕМНЫЙ, И ЭТО РЕШЕНИЕ, А НЕ ЭКОНОМИЯ. San Francisco —
   проприетарный шрифт Apple, раздавать его файлом нельзя; зато на
   устройствах Apple он уже стоит и приходит бесплатно через
   -apple-system. Windows получает Segoe UI, Android — Roboto.
   Загрузка — ноль байт, и заодно исчезает внешний запрос за шрифтом,
   который наш же CSP всё равно блокировал (style-src 'self').
   Кабинет открывается как Telegram Mini App: на iPhone он выглядит
   частью системы, а не веб-страницей в рамке.
   ───────────────────────────────────────────────────────────────── */

:root {
  --bg: #161b22;
  --surface: #21262d;
  --surface-2: #1c222b;

  --text: #c9d1d9;
  --text-2: rgba(201, 209, 217, 0.62);
  --text-3: rgba(201, 209, 217, 0.38);

  --line: rgba(201, 209, 217, 0.09);
  --line-strong: rgba(201, 209, 217, 0.16);

  --brand: #0c8599;
  --accent: #22b8cf;
  --accent-hover: #3cc9de;

  --ok: #3fb950;
  --bad: #f85149;
  --warn: #d29922;

  --r: 14px;
  --r-sm: 10px;

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --duration: 180ms;
  --ease: ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
::selection { background: var(--accent); color: #08131a; }

html { color: var(--text); background: var(--bg); }
body {
  font-family: var(--font);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  position: relative;
}
/* Мягкое свечение сверху — единственная вольность против плоской панели.
   Только на первом экране, поэтому фиксировано по высоте. */
body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto 0;
  height: 420px;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(700px circle at 50% -180px, rgba(34, 184, 207, 0.1), transparent 70%);
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; }

.page { min-height: 100vh; display: flex; flex-direction: column; position: relative; z-index: 1; }

/* ── Навигация ────────────────────────────────────────────────── */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
}
.nav-logo { font-size: 1.0625rem; font-weight: 600; letter-spacing: -0.01em; }
.nav-links { display: flex; gap: 0.25rem; }
.nav-links a {
  color: var(--text-2);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.4375rem 0.8125rem;
  border-radius: var(--r-sm);
  transition: all var(--duration) var(--ease);
}
.nav-links a:hover { color: var(--text); background: var(--surface); }

.main { flex: 1; padding: 1.5rem 1.5rem 3rem; max-width: 45rem; margin: 0 auto; width: 100%; }

/* ── Секция-карточка ──────────────────────────────────────────── */
.section {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 1.5rem;
  margin-bottom: 0.875rem;
  transition: border-color var(--duration) var(--ease);
}
.section:hover { border-color: var(--line-strong); }
h2 {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 1.125rem;
}
h3 { font-size: 1rem; font-weight: 600; }

.muted { color: var(--text-2); }
.small { font-size: 0.8125rem; }

/* ── Статус подписки ──────────────────────────────────────────── */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4375rem;
  padding: 0.375rem 0.75rem;
  border-radius: 20px;
  font-size: 0.78125rem;
  font-weight: 600;
  margin-bottom: 1.125rem;
}
.status-badge.active {
  background: rgba(63, 185, 80, 0.12);
  color: var(--ok);
  border: 1px solid rgba(63, 185, 80, 0.25);
}
.status-badge.inactive {
  background: rgba(248, 81, 73, 0.12);
  color: var(--bad);
  border: 1px solid rgba(248, 81, 73, 0.25);
}

/* ── Строки «ключ — значение» ─────────────────────────────────── */
.info-grid { display: flex; flex-direction: column; margin-bottom: 1.125rem; }
.info-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6875rem 0;
  border-bottom: 1px solid var(--line);
}
.info-item:last-child { border-bottom: none; }
.info-label { font-size: 0.84375rem; color: var(--text-2); }
.info-value { font-size: 0.875rem; font-weight: 500; text-align: right; }

/* ── Кнопки ───────────────────────────────────────────────────── */
.btn {
  display: inline-block;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.6875rem 1.375rem;
  border-radius: var(--r-sm);
  transition: all var(--duration) var(--ease);
}
.btn-primary { background: var(--accent); color: #08131a; }
.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(34, 184, 207, 0.25);
}
.btn-primary:active { transform: none; box-shadow: none; }

.link-btn {
  background: none;
  border: none;
  color: var(--text-2);
  font-family: var(--font);
  font-size: 0.875rem;
  cursor: pointer;
  padding: 0.25rem 0;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color var(--duration) var(--ease);
}
.link-btn:hover { color: var(--accent); }

/* ── Вход ─────────────────────────────────────────────────────── */
.login { display: flex; align-items: center; justify-content: center; padding: 2rem 0; }
.login-card {
  text-align: center;
  max-width: 22rem;
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 2rem 1.75rem;
}
.login-card h1 { font-size: 1.5rem; font-weight: 600; letter-spacing: -0.02em; }
.login-card p { font-size: 0.875rem; color: var(--text-2); margin-top: 0.5rem; }
.login-card .btn { margin-top: 1.25rem; width: 100%; }
.login-alt { margin-top: 1.125rem; }

.email-form { margin-top: 1.125rem; text-align: left; }
.field-label {
  display: block;
  font-size: 0.8125rem;
  color: var(--text-2);
  margin-bottom: 0.4375rem;
}
.email-form input {
  width: 100%;
  padding: 0.6875rem 0.875rem;
  margin-bottom: 0.6875rem;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  /* Не меньше 16px: на iOS поле с мелким шрифтом заставляет браузер
     зумить страницу при фокусе. */
  font-size: 1rem;
  transition: border-color var(--duration) var(--ease);
}
.email-form input:focus { outline: none; border-color: var(--accent); }
.email-form input::placeholder { color: var(--text-3); }
.email-form .btn { width: 100%; margin-top: 0.25rem; }
.email-form .link-btn { display: block; margin: 0.6875rem auto 0; }

.form-msg { font-size: 0.8125rem; margin-top: 0.6875rem; }
.form-msg.error { color: var(--bad); }
.form-msg.ok { color: var(--ok); }

/* ── Подключение ──────────────────────────────────────────────── */
.sub-link {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 0.75rem 0.875rem;
  margin-bottom: 0.75rem;
}
.sub-link code {
  flex: 1;
  min-width: 0;
  font-family: var(--mono);
  font-size: 0.78125rem;
  color: var(--text-2);
  /* Ссылка длинная и без пробелов: без переноса распирает страницу. */
  overflow-wrap: anywhere;
  word-break: break-all;
}
.btn-copy {
  flex-shrink: 0;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.78125rem;
  font-weight: 500;
  padding: 0.5rem 0.8125rem;
  border-radius: 9px;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
}
.btn-copy:hover { background: #2a313b; border-color: var(--accent); color: var(--accent); }

.qr-details { margin-bottom: 1rem; }
.qr-details summary,
.history summary {
  font-size: 0.84375rem;
  color: var(--text-2);
  cursor: pointer;
  padding: 0.4375rem 0;
  list-style: none;
  user-select: none;
}
.qr-details summary::-webkit-details-marker,
.history summary::-webkit-details-marker { display: none; }
.qr-details summary::before,
.history summary::before {
  content: "›";
  display: inline-block;
  margin-right: 0.5rem;
  color: var(--text-3);
  transition: transform var(--duration) var(--ease);
}
details[open] > summary::before { transform: rotate(90deg); }
.qr-details summary:hover,
.history summary:hover { color: var(--text); }
/* Белая подложка обязательна: чёрный код на тёмном фоне камера не берёт. */
.qr {
  display: block;
  margin-top: 0.75rem;
  background: #ffffff;
  padding: 0.75rem;
  border-radius: var(--r-sm);
}

.apps { list-style: none; margin-bottom: 1rem; }
.apps li {
  font-size: 0.84375rem;
  color: var(--text-2);
  padding: 0.375rem 0;
}
.apps li b { font-weight: 600; color: var(--text); }

/* ── История платежей ─────────────────────────────────────────── */
.history-list { list-style: none; margin-top: 0.5rem; }
.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--line);
}
.history-item:last-child { border-bottom: none; }
.history-main { display: flex; flex-direction: column; gap: 0.0625rem; min-width: 0; }
.history-side { display: flex; flex-direction: column; align-items: flex-end; gap: 0.0625rem; }
.history-date { font-size: 0.84375rem; }
.history-plan { font-size: 0.75rem; color: var(--text-3); }
.history-amount { font-size: 0.84375rem; font-weight: 500; white-space: nowrap; }
.history-status { font-size: 0.75rem; color: var(--text-3); }

/* Цвет несёт смысл только там, где он есть: успех и отказ. Промежуточные
   статусы намеренно нейтральны — «ждём» это не тревога. */
.status-paid { color: var(--ok); }
.status-failed,
.status-expired,
.status-refunded { color: var(--bad); }

/* ── Тарифы ───────────────────────────────────────────────────── */
.plans h2 { margin-bottom: 1.25rem; }
.plans-grid { display: flex; flex-direction: column; gap: 0.875rem; }
.plan-card {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 1.5rem;
  transition: all var(--duration) var(--ease);
}
.plan-card:hover { border-color: var(--accent); }
.plan-name { font-size: 1rem; font-weight: 600; margin-bottom: 0.5rem; }
.plan-price { font-size: 1.75rem; font-weight: 600; letter-spacing: -0.02em; }
.plan-currency { font-size: 0.875rem; font-weight: 400; color: var(--text-2); }
.plan-features { list-style: none; margin: 0.875rem 0 1.25rem; }
.plan-features li {
  font-size: 0.84375rem;
  color: var(--text-2);
  padding: 0.1875rem 0;
}
.plan-features li::before { content: "· "; color: var(--text-3); }

/* ── Оплата ───────────────────────────────────────────────────── */
.payment-card {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 1.5rem;
}
.payment-card .btn { margin-top: 1.125rem; }
.payment-card .muted.small { margin-top: 0.6875rem; }

/* ── Тост ─────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.6875rem 1.25rem;
  border-radius: var(--r-sm);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  color: var(--text);
  font-size: 0.875rem;
  z-index: 100;
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
}
.toast.hidden { opacity: 0; transform: translateX(-50%) translateY(1rem); pointer-events: none; }
.toast.error { border-color: var(--bad); }
.toast.success { border-color: var(--ok); }

/* Утилита. Тост прячется по-своему (см. .toast.hidden выше) — там нужна
   анимация, а не снятие с потока. */
.hidden { display: none; }

/* ── Подвал ───────────────────────────────────────────────────── */
.footer { padding: 1.5rem; border-top: 1px solid var(--line); }
.footer-links { list-style: none; display: flex; justify-content: center; gap: 1.375rem; }
.footer-links li a {
  font-size: 0.78125rem;
  color: var(--text-3);
  transition: color var(--duration) var(--ease);
}
.footer-links li a:hover { color: var(--accent); }
.footer-links li:not(:last-child)::after {
  content: "";
  display: inline-block;
  width: 2px;
  height: 2px;
  background: var(--text-3);
  border-radius: 50%;
  margin-left: 1.375rem;
  vertical-align: middle;
}

/* ── Телефон ──────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .main { padding: 1.25rem 1rem 3rem; }
  .nav { padding: 1rem; }
  .section, .plan-card, .payment-card { padding: 1.1875rem; }
  /* Метка над значением: справа вплотную длинные строки вроде
     «05.08.2026 · 1 месяц · 1.00 USDT» ломаются некрасиво. */
  .info-item { flex-direction: column; align-items: flex-start; gap: 0.125rem; }
  .info-value { text-align: left; }
  /* Кнопка рядом с длинной ссылкой сжимает её в пару символов. */
  .sub-link { flex-direction: column; align-items: stretch; }
  .btn-copy { width: 100%; }
}
