/* Мобильный кабинет — тёмная тема, референс: карточки + сетка 2×N */
:root {
  --bg-0: #0a0e1a;
  --bg-1: #12182a;
  --bg-glow: #1e1040;
  --card: rgba(22, 28, 48, 0.72);
  --card-border: rgba(255, 255, 255, 0.08);
  --text: #f2f4f8;
  --text-muted: rgba(242, 244, 248, 0.62);
  --primary-from: #3b5bfd;
  --primary-to: #7c3aed;
  --outline: rgba(255, 255, 255, 0.14);
  --radius: 16px;
  --radius-sm: 12px;
  --max-w: 420px;
  --font: "Inter", "Manrope", system-ui, -apple-system, sans-serif;
  --icon-green: #34d399;
  --icon-purple: #a78bfa;
  --icon-orange: #fb923c;
  --icon-pink: #f472b6;
  --icon-blue: #60a5fa;
}

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

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg-0);
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  justify-content: center;
  padding: 0 16px 32px;
}

/* Фон: градиент + мягкое пятно */
.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, var(--bg-glow), transparent 60%),
    radial-gradient(ellipse 60% 40% at 100% 50%, rgba(59, 91, 253, 0.12), transparent),
    linear-gradient(180deg, var(--bg-1) 0%, var(--bg-0) 45%, #080b14 100%);
}

.app {
  width: 100%;
  max-width: var(--max-w);
  padding-top: 20px;
}

.hidden {
  display: none !important;
}

/* Шапка */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand__logo {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.brand__name {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.btn-exit {
  background: transparent;
  border: 1px solid var(--outline);
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
}

.btn-exit:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.28);
}

/* Карточки */
.card {
  background: var(--card);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 12px;
}

.card--id {
  text-align: center;
  padding: 20px 18px;
}

.id-big {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

.id-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.card__title {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

/* Подписка */
.sub-empty__text {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 16px;
  line-height: 1.4;
}

.sub-active .sub-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  margin-bottom: 8px;
}

.sub-active .sub-row span:first-child {
  color: var(--text-muted);
}

.sub-active .autorenew {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--card-border);
}

.autorenew__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.autorenew__label {
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.hint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid var(--outline);
  font-size: 0.65rem;
  color: var(--text-muted);
  cursor: help;
}

.hint[title]:hover {
  color: var(--text);
}

.sub-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.sub-chips .chip {
  flex: 1;
  min-width: 0;
  text-align: center;
}

/* Кнопки */
.btn-primary {
  display: block;
  width: 100%;
  border: none;
  border-radius: 14px;
  padding: 14px 18px;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg, var(--primary-from), var(--primary-to));
  box-shadow: 0 4px 24px rgba(59, 91, 253, 0.35);
}

.btn-primary:hover {
  filter: brightness(1.05);
}

.btn-primary:active {
  transform: scale(0.99);
}

.chip {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--card-border);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 0.8rem;
  font-family: inherit;
  cursor: pointer;
}

.chip:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Баланс */
.balance__label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.balance__value {
  font-size: 1.65rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Сетка 2 × N */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

.tile {
  aspect-ratio: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  cursor: pointer;
  font-family: inherit;
  color: var(--text);
  padding: 8px;
  transition: background 0.15s, border-color 0.15s;
}

.tile:hover {
  background: rgba(32, 40, 64, 0.85);
  border-color: rgba(255, 255, 255, 0.12);
}

.tile__icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tile__text {
  font-size: 0.72rem;
  text-align: center;
  line-height: 1.2;
  color: var(--text-muted);
}

/* Широкая кнопка настройки */
.tile-wide {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  margin-bottom: 16px;
}

.tile-wide:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

.tile-wide__icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--icon-purple);
}

/* Футер кабинета */
.tg-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 8px 0 4px;
}

.tg-status__ok {
  color: #4ade80;
  font-size: 1.1rem;
  line-height: 1;
}

.canary {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 8px;
}

.canary a {
  color: #93c5fd;
  text-decoration: none;
}

.canary a:hover {
  text-decoration: underline;
}

/* --- Экран входа --- */
.auth-hero {
  text-align: center;
  margin-bottom: 24px;
}

.auth-hero__logo {
  width: 56px;
  height: 56px;
  margin: 0 auto 12px;
}

.auth-hero h1 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 6px;
}

.auth-hero p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.btn-telegram {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(36, 161, 222, 0.45);
  background: linear-gradient(180deg, rgba(36, 161, 222, 0.2), rgba(20, 80, 120, 0.25));
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  margin-bottom: 8px;
}

.btn-telegram:hover {
  background: linear-gradient(180deg, rgba(36, 161, 222, 0.28), rgba(20, 80, 120, 0.32));
}

.hint-sm {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 20px;
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin: 20px 0 16px;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--card-border);
}

.tabs {
  display: flex;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 16px;
}

.tab {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 10px 8px;
  border-radius: 10px;
  cursor: pointer;
}

.tab[aria-selected="true"] {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.field {
  margin-bottom: 12px;
}

.field label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.field input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
}

.field input::placeholder {
  color: rgba(255, 255, 255, 0.28);
}

.field input:focus {
  outline: none;
  border-color: rgba(124, 58, 237, 0.55);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

.forgot {
  font-size: 0.8rem;
  text-align: right;
  margin: -4px 0 12px;
}

.forgot a {
  color: #93c5fd;
  text-decoration: none;
}

.forgot a:hover {
  text-decoration: underline;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin: 8px 0 16px;
}

.check input {
  margin-top: 2px;
  accent-color: var(--primary-to);
}

.check a {
  color: #93c5fd;
  text-decoration: none;
}

.check a:hover {
  text-decoration: underline;
}

.support-link {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 20px;
}

.support-link a {
  color: #93c5fd;
  text-decoration: none;
}

/* Переключатель (автопродление) */
.switch {
  position: relative;
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: none;
  cursor: pointer;
  padding: 2px;
  flex-shrink: 0;
}

.switch::after {
  content: "";
  display: block;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transform: translateX(0);
  transition: transform 0.2s;
}

.switch[aria-checked="true"] {
  background: linear-gradient(90deg, var(--primary-from), var(--primary-to));
}

.switch[aria-checked="true"]::after {
  transform: translateX(20px);
}

/* Плашка демо */
.demo-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--card-border);
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  z-index: 10;
}

.demo-bar label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

/* Отступ снизу под demo-bar */
body.has-demo {
  padding-bottom: 56px;
}

/* Stub страница */
.stub-page {
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
}

.stub-page a {
  color: #93c5fd;
  margin-top: 16px;
}
