/* ============== Базовая палитра ============== */
:root {
  --bg: #0a0a0a;
  --bg-soft: #141414;
  --card: #1a1a1a;
  --card-hover: #222;
  --border: #2a2a2a;
  --text: #ffffff;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;
  --accent: #ffffff;
  --accent-soft: rgba(255, 255, 255, 0.08);
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius: 16px;
  --radius-lg: 24px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Подхватываем тему Telegram (light theme = инвертируем) */
body.tg-light {
  --bg: #ffffff;
  --bg-soft: #f5f5f7;
  --card: #ffffff;
  --card-hover: #f9fafb;
  --border: #e5e7eb;
  --text: #0a0a0a;
  --text-muted: #6b7280;
  --text-dim: #9ca3af;
  --accent: #0a0a0a;
  --accent-soft: rgba(0, 0, 0, 0.06);
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }

.app {
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 20px 40px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-height: 100vh;
}

/* ============== Hero ============== */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 0 8px;
  text-align: center;
}

.logo {
  width: 84px;
  height: 64px;
  margin-bottom: 16px;
  filter: drop-shadow(0 8px 24px rgba(255, 255, 255, 0.15));
}

body.tg-light .logo {
  filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.15));
}

body.tg-light .logo-svg polygon { fill: #0a0a0a; }

.logo-svg { width: 100%; height: 100%; }

.brand {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text);
}

.brand-sub {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ============== Card ============== */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-dim);
  flex-shrink: 0;
}
.dot.active { background: var(--success); box-shadow: 0 0 12px rgba(16, 185, 129, 0.6); }
.dot.expired { background: var(--danger); }

.status-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 20px;
}

.metric {
  background: var(--bg-soft);
  border-radius: var(--radius);
  padding: 14px;
}

.metric-label {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.metric-value {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

/* ============== Buttons ============== */
.btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 18px;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  transition: var(--transition);
  -webkit-touch-callout: none;
  user-select: none;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--accent);
  color: var(--bg);
}

.btn-primary:hover { background: var(--card-hover); }

.btn-icon { font-size: 16px; }

/* ============== Actions grid ============== */
.actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.action {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
  text-align: center;
}

.action:active { transform: scale(0.97); background: var(--card-hover); }

.action-icon { font-size: 26px; }

.action-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  line-height: 1.3;
}

/* ============== Section ============== */
.section { display: flex; flex-direction: column; gap: 12px; }

.section-head h2 {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

/* ============== Tariffs ============== */
.tariffs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.tariff {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: var(--transition);
  text-align: left;
}

.tariff:active { transform: scale(0.98); background: var(--card-hover); }

.tariff.popular { border-color: var(--accent); }

.tariff-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.tariff-sub {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.tariff-price {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}

.tariff-price-month {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 4px;
}

.tariff-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 7px;
  background: var(--accent);
  color: var(--bg);
  border-radius: 6px;
  margin-bottom: 10px;
}

/* ============== Footer ============== */
.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-dim);
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.footer-id { font-variant-numeric: tabular-nums; }

/* ============== Loading ============== */
.skeleton {
  background: linear-gradient(90deg, var(--card) 0%, var(--card-hover) 50%, var(--card) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.6s infinite;
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
