:root {
  --bg: #120F1B;
  --bg-elevated: #1C1830;
  --bg-elevated-2: #241F3D;
  --border: rgba(255,255,255,0.08);
  --text: #F4F2FF;
  --text-muted: #948FB0;
  --accent: #FF3B69;
  --accent-2: #7B5CFF;
  --gradient: linear-gradient(135deg, #FF3B69 0%, #7B5CFF 100%);
  --success: #34D399;
  --gold: #F4B740;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

button { font-family: inherit; cursor: pointer; }

#app { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

/* ---------- Screens ---------- */
.screen {
  display: none;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.screen.active { display: flex; }

.screen-body {
  flex: 1;
  overflow-y: auto;
  padding: 4px 16px 100px;
}

/* ---------- Topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  flex-shrink: 0;
}

.brand { display: flex; align-items: center; gap: 8px; }
.brand-name {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.01em;
}

.pulse-dot {
  position: relative;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
  box-shadow: 0 0 8px var(--accent);
}
.pulse-dot .ring {
  position: absolute; inset: -6px;
  border-radius: 50%;
  border: 1.5px solid var(--accent);
  opacity: 0;
  animation: pulse-ring 1.8s ease-out infinite;
}
.pulse-dot .ring2 { animation-delay: 0.6s; }
@keyframes pulse-ring {
  0% { transform: scale(0.4); opacity: 0.7; }
  100% { transform: scale(2.2); opacity: 0; }
}

.balance-pill {
  display: flex; align-items: center; gap: 5px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 13px;
  color: #FFD166;
}

/* ---------- Home ---------- */
.greeting-row {
  display: flex; align-items: center; gap: 12px;
  margin: 14px 0 22px;
}
.hint-text { color: var(--text-muted); font-size: 13px; }
.greeting-name { font-weight: 600; font-size: 15px; }
/* Баланс на главной живёт в строке приветствия — прижат вправо и крупнее */
.greeting-row .balance-pill { margin-left: auto; }
.balance-lg { font-size: 16px; padding: 9px 15px; gap: 7px; }
.balance-lg svg { width: 17px; height: 17px; }

/* Пульсирующая точка рядом с заголовком The Pulse */
.pulse-dot-title { margin-left: 6px; vertical-align: 0.15em; }

.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--gradient);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600; font-size: 16px; color: #fff;
  flex-shrink: 0;
}
.avatar-lg { width: 56px; height: 56px; font-size: 20px; }
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

.hero-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 30px;
  font-weight: 700;
  margin: 0 0 4px;
  letter-spacing: -0.02em;
}
.hero-subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin: 0 0 18px;
  line-height: 1.4;
}

.hero-card {
  width: 100%;
  display: flex; align-items: center; gap: 14px;
  background: var(--gradient);
  border: none;
  border-radius: var(--radius-lg);
  padding: 20px;
  text-align: left;
  color: #fff;
  margin-bottom: 14px;
  box-shadow: 0 10px 30px -10px rgba(255, 59, 105, 0.5);
}
.hero-card-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: rgba(255,255,255,0.18);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.hero-card-title { font-weight: 700; font-size: 16px; }
.hero-card-sub { font-size: 12.5px; opacity: 0.85; margin-top: 2px; }

.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
.quick-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 10px;
  display: flex; flex-direction: column; gap: 6px;
  color: var(--text);
  text-align: left;
}
.quick-card span { font-weight: 600; font-size: 13px; }
.quick-card small { color: var(--text-muted); font-size: 11px; }
.quick-card svg { color: var(--accent-2); }

.plan-banner {
  width: 100%;
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  color: var(--text);
  margin-bottom: 20px;
}
.plan-banner-label {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  margin-bottom: 8px;
  padding-left: 2px;
}
.plan-banner-title { font-weight: 600; font-size: 14px; }
.plan-banner-sub { color: var(--text-muted); font-size: 12px; margin-top: 2px; }
.badge-free {
  background: rgba(52, 211, 153, 0.15);
  color: var(--success);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 6px;
  letter-spacing: 0.03em;
}

.section-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 600;
  margin: 4px 0 10px;
}

.chip-row {
  display: flex; gap: 8px; overflow-x: auto;
  padding-bottom: 16px;
  scrollbar-width: none;
}
.chip-row::-webkit-scrollbar { display: none; }
.model-chip {
  flex-shrink: 0;
  display: flex; align-items: center; gap: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}
.model-chip .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.mini-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex; flex-direction: column; gap: 4px;
  color: var(--text);
  text-align: left;
}
.mini-card span { font-weight: 600; font-size: 13px; margin-top: 4px; }
.mini-card small { color: var(--text-muted); font-size: 11px; }
.mini-card svg { color: var(--gold); }

/* ---------- Segmented control ---------- */
.segmented {
  display: flex;
  gap: 6px;
  padding: 4px 16px 14px;
  overflow-x: auto;
  flex-shrink: 0;
  scrollbar-width: none;
}
.segmented::-webkit-scrollbar { display: none; }
.seg-btn {
  display: flex; align-items: center; gap: 6px;
  flex-shrink: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 9px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.seg-btn.active {
  background: rgba(255, 59, 105, 0.12);
  border-color: rgba(255, 59, 105, 0.4);
  color: var(--text);
}
.seg-badge {
  background: rgba(123, 92, 255, 0.16);
  color: var(--accent-2);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 999px;
  margin-left: -1px;
}

/* ---------- Create panes ---------- */
.create-pane {
  display: none;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  padding: 0 16px 16px;
}
.create-pane.active { display: flex; }

/* Фото/видео — обычная страница со скролом (у чата свой внутренний скрол) */
.create-pane[data-pane="photo"],
.create-pane[data-pane="video"] {
  overflow-y: auto;
  padding-bottom: 24px;
}
.create-pane[data-pane="photo"] > *,
.create-pane[data-pane="video"] > * {
  flex-shrink: 0;
}
.create-pane[data-pane="voice"] .empty-state { margin: auto; }

.gen-hero { margin-bottom: 14px; }
.gen-hero-title { font-family: 'Space Grotesk', sans-serif; font-weight: 600; font-size: 19px; }
.gen-hero-sub { color: var(--text-muted); font-size: 13px; margin-top: 2px; }

.gen-input {
  width: 100%;
  min-height: 110px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  padding: 14px;
  font-size: 14px;
  font-family: inherit;
  resize: none;
  margin-bottom: 12px;
}
.gen-input::placeholder { color: var(--text-muted); }
.gen-input:disabled { opacity: 0.5; }

.soon-note {
  background: rgba(123, 92, 255, 0.1);
  border: 1px solid rgba(123, 92, 255, 0.3);
  color: #C6BBFF;
  font-size: 12.5px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  line-height: 1.4;
}

.gen-btn {
  background: var(--gradient);
  border: none;
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  padding: 14px;
  border-radius: var(--radius-md);
}
.gen-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---------- Поля выбора (модель, формат) ---------- */
.gen-field {
  padding: 0 0 10px;
}
.gen-field-head {
  display: flex; align-items: center; gap: 5px;
  color: var(--accent-2);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  margin-bottom: 6px;
  padding-left: 2px;
}
.gen-select {
  width: 100%;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
}
.gen-select option {
  background: var(--bg-elevated);
  color: var(--text);
}

/* Переключатель из двух вариантов (формат, звук) */
.choice-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.choice-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.choice-btn svg { color: var(--text-muted); }
.choice-btn.active {
  background: rgba(255, 59, 105, 0.12);
  border-color: rgba(255, 59, 105, 0.4);
  color: var(--text);
}
.choice-btn.active svg { color: var(--accent); }

/* Ползунок (длительность). Заливку до бегунка красит JS через inline-background */
.range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 5px;
  margin: 8px 0 0;
  border-radius: 999px;
  background: var(--bg-elevated-2);
  outline: none;
}
.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--gradient);
  border: 2px solid var(--bg);
  cursor: pointer;
}
.range::-moz-range-thumb {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
  cursor: pointer;
}
/* ---------- Результат генерации ---------- */
.gen-result { padding-top: 16px; }
.gen-result-head {
  color: var(--accent-2);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  margin-bottom: 6px;
  padding-left: 2px;
}
.gen-result-list {
  display: flex; flex-direction: column;
  gap: 10px;
}
.gen-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.gen-card img,
.gen-card video {
  width: 100%;
  display: block;
}
.gen-card-wait {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 120px;
  padding: 24px 16px;
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
}
.gen-card-msg {
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  padding: 24px 16px;
}
.gen-card-msg.error { color: #FF6B6B; }

/* Медиа с кнопкой скачивания поверх (в результатах и в Работах) */
.media-wrap { position: relative; }
.media-wrap img { cursor: zoom-in; }
.media-download {
  position: absolute; top: 8px; right: 8px;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  padding: 0;
  cursor: pointer;
}

/* ---------- Просмотр во весь экран ---------- */
.lightbox {
  position: fixed; inset: 0;
  height: 100vh;
  height: 100dvh; /* в Telegram WebView обычная vh больше видимой области — низ уходит за экран */
  z-index: 100;
  background: rgba(0, 0, 0, 0.92);
  display: flex; align-items: center; justify-content: center;
}
.lightbox[hidden] { display: none; }
.lightbox-body {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  /* сверху/снизу — под safe-area и под кнопки, чтобы картинка целиком влезала */
  padding: calc(14px + env(safe-area-inset-top)) 12px calc(16px + env(safe-area-inset-bottom));
  box-sizing: border-box;
}
.lightbox-body img,
.lightbox-body video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: var(--radius-sm);
}
/* Кнопки поверх фото, по верхним углам */
.lightbox-icon {
  position: absolute;
  top: calc(14px + env(safe-area-inset-top));
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  z-index: 2;
}
.lightbox-download { left: 14px; }
.lightbox-close { right: 14px; }
.gen-spinner {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 2.5px solid var(--bg-elevated-2);
  border-top-color: var(--accent);
  animation: gen-spin 0.8s linear infinite;
}
@keyframes gen-spin {
  to { transform: rotate(360deg); }
}

.range-value {
  margin-top: 6px;
  padding-left: 2px;
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ---------- Upload (photo) ---------- */
.upload-field { padding: 0 0 10px; }
.upload-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 6px;
  padding-left: 2px;
}
.upload-head-title {
  display: flex; align-items: center; gap: 5px;
  color: var(--accent-2);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}
/* Бейдж со значением справа от подписи (счётчик загрузок, длительность) */
.field-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 8px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}
.field-badge.full { color: var(--success); }
.upload-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.upload-slot {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.upload-slot img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.upload-slot-remove {
  position: absolute; top: 3px; right: 3px;
  width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  padding: 0;
  cursor: pointer;
}
.upload-add {
  border: 1px dashed var(--border);
  background: var(--bg-elevated);
  color: var(--accent-2);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.upload-empty {
  border: 1px dashed var(--border);
  background: transparent;
  opacity: 0.4;
}
.upload-hint {
  color: var(--text-muted);
  font-size: 11px;
  margin-top: 6px;
  padding-left: 2px;
}

/* ---------- Chat ---------- */
.chat {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 10px;
}

.msg {
  max-width: 82%;
  padding: 10px 13px;
  border-radius: 16px;
  font-size: 14.5px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.msg.user {
  align-self: flex-end;
  background: var(--gradient);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.msg.assistant {
  align-self: flex-start;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  border-bottom-left-radius: 4px;
}
.msg.assistant.loading { color: var(--text-muted); font-style: italic; }
.msg.error {
  align-self: center;
  background: transparent;
  color: #FF6B6B;
  font-size: 12.5px;
  text-align: center;
}

.input-bar {
  display: flex; align-items: flex-end; gap: 8px;
  padding-top: 8px;
  flex-shrink: 0;
}
.prompt-input {
  flex: 1;
  resize: none;
  max-height: 100px;
  padding: 10px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 14.5px;
  font-family: inherit;
  line-height: 1.3;
}
.prompt-input:focus { outline: 1.5px solid var(--accent-2); }
.send-btn {
  flex-shrink: 0;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--gradient);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
}
.send-btn:disabled { opacity: 0.5; }
.send-btn svg { transform: translateX(-1px); }

/* ---------- Works / History ---------- */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
  color: var(--text-muted);
  padding: 60px 20px;
}
.empty-state svg { color: var(--text-muted); opacity: 0.5; margin-bottom: 14px; }
.empty-title { font-weight: 600; font-size: 15px; color: var(--text); margin-bottom: 4px; }
.empty-sub { font-size: 13px; }

.works-list { display: flex; flex-direction: column; gap: 10px; }
.work-item {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
}
.work-item-top {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 6px;
}
.work-item-model {
  font-size: 11px; font-weight: 700;
  color: var(--accent-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.work-item-time { font-size: 11px; color: var(--text-muted); }
.work-item-media {
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 8px;
  background: var(--bg);
}
.work-item-media img,
.work-item-media video {
  width: 100%;
  display: block;
}
.work-item-prompt { font-size: 13.5px; font-weight: 500; }
.work-item-params {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 8px;
}
.work-param {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-elevated-2);
  border-radius: 999px;
  padding: 3px 8px;
}
.work-param b { color: var(--text); font-weight: 600; }

/* ---------- Plans ---------- */
.plans-list { display: flex; flex-direction: column; gap: 14px; margin-top: 14px; }
.plan-card {
  position: relative;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
}
.plan-card.popular { border-color: var(--accent-2); }
.plan-popular-badge {
  position: absolute; top: -10px; left: 18px;
  background: var(--gradient);
  color: #fff;
  font-size: 10.5px; font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
}
.plan-card-top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.plan-card-name {
  display: flex; align-items: center; gap: 8px;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600; font-size: 16px;
}
.plan-dot { width: 10px; height: 10px; border-radius: 50%; }
.plan-price { text-align: right; }
.plan-price-main { font-weight: 700; font-size: 17px; }
.plan-price-stars { font-size: 11.5px; color: var(--text-muted); display: flex; align-items: center; gap: 3px; justify-content: flex-end; margin-top: 2px; }

.plan-features { list-style: none; padding: 0; margin: 0 0 16px; display: flex; flex-direction: column; gap: 7px; }
.plan-features li { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); }
.plan-features svg { color: var(--success); flex-shrink: 0; }

.plan-select-btn {
  width: 100%;
  background: var(--bg-elevated-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 600;
  font-size: 13.5px;
  padding: 12px;
  border-radius: var(--radius-sm);
}
.plan-card.popular .plan-select-btn { background: var(--gradient); border: none; color: #fff; }

/* ---------- Profile ---------- */
.profile-hero {
  display: flex; align-items: center; gap: 14px;
  margin: 8px 0 18px;
}
.profile-name { font-weight: 700; font-size: 17px; }
.profile-username { color: var(--text-muted); font-size: 13px; margin-top: 2px; }

.stats-row {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 10px; margin-bottom: 16px;
}
.stat-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  color: var(--text); /* карточка баланса — <button>: без этого браузер красит текст в чёрный */
}
.stat-card svg { color: var(--gold); }
.stat-value { font-weight: 700; font-size: 16px; }
.stat-label { font-size: 11px; color: var(--text-muted); }

.premium-banner {
  width: 100%;
  display: flex; align-items: center; gap: 12px;
  background: linear-gradient(135deg, #F4B740, #FF3B69);
  border: none; border-radius: var(--radius-lg);
  padding: 16px; color: #fff; margin-bottom: 20px;
}
.premium-icon {
  width: 40px; height: 40px; border-radius: 10px;
  background: rgba(255,255,255,0.2);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.list-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  overflow: hidden;
}
.list-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 14px;
  font-size: 13.5px;
  border-bottom: 1px solid var(--border);
}
.list-row:last-child { border-bottom: none; }
.list-row-value { color: var(--text-muted); }
.list-row-btn {
  width: 100%; background: none; border: none; color: var(--text);
  font-family: inherit;
}
.list-row-btn svg { color: var(--text-muted); }

/* ---------- Top up ---------- */
.topbar-back { gap: 4px; }
.back-btn {
  background: none; border: none; color: var(--text);
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; margin-right: 4px; flex-shrink: 0;
}

.balance-hero {
  background: var(--gradient);
  border-radius: var(--radius-lg);
  padding: 20px;
  color: #fff;
  margin: 8px 0 18px;
  box-shadow: 0 10px 30px -10px rgba(255, 59, 105, 0.5);
}
.balance-hero-label { font-size: 13px; opacity: 0.85; margin-bottom: 6px; }
.balance-hero-value {
  display: flex; align-items: center; gap: 8px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 30px; font-weight: 700;
}

.amount-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}
.amount-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 13px 6px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
}
.amount-btn.active {
  background: rgba(255, 59, 105, 0.12);
  border-color: var(--accent);
  color: var(--text);
}

.custom-amount { color: var(--text); }
.custom-amount::placeholder { color: var(--text-muted); }

.receive-row {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.receive-value {
  display: flex; align-items: center; gap: 5px;
  font-weight: 700; font-size: 16px;
  color: #FFD166;
}

/* ---------- Bottom nav ---------- */
.bottom-nav {
  display: flex;
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
  flex-shrink: 0;
  position: relative;
  z-index: 2;
  /* max(): в Telegram WebView env(safe-area) часто = 0, поэтому гарантируем
     минимум 18px снизу, чтобы вкладки не липли к краю экрана */
  padding: 10px 6px max(18px, env(safe-area-inset-bottom));
}
.nav-btn {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: none; border: none;
  color: var(--text-muted);
  padding: 6px 2px;
  font-size: 10.5px;
  font-weight: 500;
  border-radius: 10px;
}
.nav-btn.active { color: var(--accent); }
