:root {
  --bg: #0b0916;
  --bg-2: #120f21;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-2: rgba(255, 255, 255, 0.07);
  --surface-solid: #191430;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #efecff;
  --text-dim: #a49dc4;
  --text-faint: #6f688f;
  --accent: #7c5cff;
  --accent-2: #9d7bff;
  --accent-soft: rgba(124, 92, 255, 0.16);
  --green: #3ecf8e;
  --red: #ff5f6d;
  --amber: #ffb648;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 18px 40px -24px rgba(0, 0, 0, 0.9);
  --nav-h: 68px;
}

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

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  overscroll-behavior-y: none;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(60% 40% at 15% 0%, rgba(124, 92, 255, 0.22), transparent 70%),
    radial-gradient(50% 35% at 95% 10%, rgba(157, 123, 255, 0.14), transparent 70%),
    linear-gradient(180deg, var(--bg-2) 0%, var(--bg) 45%);
  z-index: -1;
  pointer-events: none;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

a {
  color: var(--accent-2);
  text-decoration: none;
}

#app {
  max-width: 520px;
  margin: 0 auto;
  padding: 14px 16px calc(var(--nav-h) + 28px);
  min-height: 100vh;
}

/* ---------- header ---------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(140deg, #3ecf8e, #2aa86f);
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 16px;
  color: #05210f;
  flex: none;
}

.topbar-id {
  min-width: 0;
  flex: 1;
}

.topbar-name {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-sub {
  font-size: 12px;
  color: var(--text-faint);
}

.balance-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px 8px 12px;
  white-space: nowrap;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-weight: 600;
  font-size: 14px;
  flex: none;
}

.balance-pill svg {
  flex: none;
  color: var(--accent-2);
}

/* ---------- generic blocks ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}

.card-hero {
  text-align: center;
  padding: 26px 18px;
  background:
    linear-gradient(160deg, rgba(124, 92, 255, 0.14), rgba(124, 92, 255, 0.02)),
    var(--surface);
}

.hero-icon {
  width: 58px;
  height: 58px;
  margin: 0 auto 14px;
  border-radius: 17px;
  background: var(--accent-soft);
  display: grid;
  place-items: center;
  color: var(--accent-2);
}

.hero-title {
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.hero-text {
  color: var(--text-dim);
  font-size: 13.5px;
  margin: 6px 0 18px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 12px;
}

.section-title .muted {
  margin-left: auto;
  font-weight: 500;
  font-size: 12px;
  color: var(--text-faint);
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  margin: 2px 0 16px;
  letter-spacing: -0.02em;
}

.page-title small {
  display: block;
  font-size: 13px;
  font-weight: 400;
  color: var(--text-dim);
  margin-top: 4px;
  letter-spacing: 0;
}

/* ---------- rows ---------- */

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.row:first-child {
  padding-top: 0;
}

/* последняя строка перед разделителем не дублирует линию */
.row:has(+ .divider),
.row:has(+ .progress) {
  border-bottom: none;
}

.row-icon {
  width: 26px;
  color: var(--text-faint);
  display: grid;
  place-items: center;
  flex: none;
}

.row-label {
  color: var(--text-dim);
}

.row-value {
  margin-left: auto;
  font-weight: 600;
  text-align: right;
}

.row-value small {
  display: block;
  font-weight: 400;
  font-size: 11.5px;
  color: var(--text-faint);
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 18px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.12s ease;
}

.btn:active {
  transform: scale(0.985);
}

.btn[disabled] {
  opacity: 0.5;
  cursor: default;
}

.btn-ghost {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-soft {
  background: var(--accent-soft);
  color: var(--accent-2);
  border: 1px solid rgba(124, 92, 255, 0.25);
}

.btn-danger {
  background: rgba(255, 95, 109, 0.14);
  color: var(--red);
  border: 1px solid rgba(255, 95, 109, 0.25);
}

.btn-sm {
  width: auto;
  padding: 9px 14px;
  font-size: 13px;
  border-radius: 11px;
}

.btn-row {
  display: flex;
  gap: 8px;
}

.btn-row .btn {
  flex: 1;
}

/* ---------- badges ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--text-dim);
}

.badge-green {
  background: rgba(62, 207, 142, 0.14);
  color: var(--green);
}

.badge-red {
  background: rgba(255, 95, 109, 0.14);
  color: var(--red);
}

.badge-amber {
  background: rgba(255, 182, 72, 0.14);
  color: var(--amber);
}

.badge-accent {
  background: var(--accent-soft);
  color: var(--accent-2);
}

/* ---------- announce ---------- */

.announce {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: rgba(255, 182, 72, 0.08);
  border: 1px solid rgba(255, 182, 72, 0.2);
  color: #f3d9a8;
  font-size: 12.5px;
  font-style: italic;
  margin-bottom: 12px;
}

.announce svg {
  flex: none;
  color: var(--amber);
}

/* ---------- tariffs ---------- */

.tariff {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 14px;
  margin-bottom: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.tariff:active {
  background: var(--surface-2);
}

.tariff.is-best {
  border-color: rgba(124, 92, 255, 0.45);
  background: linear-gradient(140deg, rgba(124, 92, 255, 0.12), rgba(124, 92, 255, 0.02));
}

.tariff-main {
  flex: 1;
  min-width: 0;
}

.tariff-name {
  font-weight: 600;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.tariff-meta {
  font-size: 12.5px;
  color: var(--text-faint);
  margin-top: 3px;
}

.tariff-price {
  text-align: right;
  flex: none;
}

.tariff-price b {
  font-size: 17px;
}

.tariff-price small {
  display: block;
  font-size: 11px;
  color: var(--text-faint);
}

.tariff-price .old {
  text-decoration: line-through;
  color: var(--text-faint);
  font-size: 12px;
}

/* ---------- payment methods ---------- */

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.method {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.method:active,
.method.is-active {
  border-color: rgba(124, 92, 255, 0.5);
  background: var(--accent-soft);
}

.method-icon {
  color: var(--accent-2);
}

.method-title {
  font-weight: 600;
  font-size: 13.5px;
}

.method-sub {
  font-size: 11.5px;
  color: var(--text-faint);
  line-height: 1.3;
}

/* ---------- inputs ---------- */

.input,
.textarea,
.select {
  width: 100%;
  padding: 13px 14px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--border);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease;
}

.input::placeholder,
.textarea::placeholder {
  color: var(--text-faint);
}

.input:focus,
.textarea:focus,
.select:focus {
  border-color: rgba(124, 92, 255, 0.55);
}

.input-code {
  text-align: center;
  letter-spacing: 3px;
  font-weight: 600;
  text-transform: uppercase;
}

.textarea {
  min-height: 96px;
  resize: vertical;
}

.field {
  margin-bottom: 10px;
}

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

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

.chip {
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 13px;
  cursor: pointer;
}

.chip.is-active {
  background: var(--accent-soft);
  border-color: rgba(124, 92, 255, 0.45);
  color: var(--accent-2);
  font-weight: 600;
}

/* ---------- FAQ ---------- */

.faq-item {
  border-bottom: 1px solid var(--border);
}

.faq-item:last-child {
  border-bottom: none;
}

.faq-q {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 14px 0;
  background: none;
  border: none;
  text-align: left;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.faq-q .chev {
  margin-left: auto;
  color: var(--text-faint);
  transition: transform 0.2s ease;
  flex: none;
}

.faq-item.is-open .chev {
  transform: rotate(180deg);
}

.faq-a {
  display: none;
  padding: 0 0 14px 36px;
  font-size: 13.5px;
  color: var(--text-dim);
}

.faq-item.is-open .faq-a {
  display: block;
}

/* ---------- support chat ---------- */

.chat {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 50vh;
  overflow-y: auto;
  padding-right: 4px;
  margin-bottom: 12px;
}

.msg {
  max-width: 85%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 13.5px;
  white-space: pre-wrap;
  word-break: break-word;
}

.msg-user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-bottom-right-radius: 4px;
}

.msg-admin {
  align-self: flex-start;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.msg-time {
  display: block;
  font-size: 10.5px;
  opacity: 0.6;
  margin-top: 4px;
}

.ticket {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 12px 0;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.ticket:last-child {
  border-bottom: none;
}

.ticket-main {
  min-width: 0;
  flex: 1;
}

.ticket-subject {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ticket-last {
  font-size: 12px;
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- referral ---------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.stat {
  padding: 14px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  text-align: center;
}

.stat b {
  display: block;
  font-size: 18px;
}

.stat span {
  font-size: 11px;
  color: var(--text-faint);
}

.copy-field {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.22);
  border: 1px dashed var(--border-strong);
  font-size: 12.5px;
  word-break: break-all;
  cursor: pointer;
}

.copy-field svg {
  flex: none;
  color: var(--accent-2);
}

/* ---------- QR ---------- */

.qr-box {
  display: grid;
  place-items: center;
  padding: 14px;
  background: #fff;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}

.qr-box img {
  width: 100%;
  max-width: 220px;
  display: block;
}

/* ---------- progress ---------- */

.progress {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  margin-top: 8px;
}

.progress > i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

/* ---------- bottom nav ---------- */

.nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex;
  background: rgba(13, 11, 26, 0.92);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  z-index: 40;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: none;
  color: var(--text-faint);
  font-size: 10.5px;
  cursor: pointer;
  position: relative;
  padding: 0;
}

.nav-item.is-active {
  color: var(--accent-2);
}

.nav-item.is-active::before {
  content: '';
  position: absolute;
  top: 6px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent-2);
}

.nav-badge {
  position: absolute;
  top: 6px;
  left: 50%;
  margin-left: 9px;
  min-width: 15px;
  height: 15px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: grid;
  place-items: center;
}

/* ---------- sheet / modal ---------- */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 3, 10, 0.7);
  backdrop-filter: blur(3px);
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade 0.18s ease;
}

.sheet {
  width: 100%;
  max-width: 520px;
  background: var(--surface-solid);
  border-radius: 22px 22px 0 0;
  border-top: 1px solid var(--border-strong);
  padding: 10px 16px calc(20px + env(safe-area-inset-bottom));
  max-height: 88vh;
  overflow-y: auto;
  animation: slide-up 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

.sheet-grip {
  width: 38px;
  height: 4px;
  border-radius: 999px;
  background: var(--border-strong);
  margin: 4px auto 14px;
}

.sheet-title {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 4px;
}

.sheet-sub {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 16px;
}

@keyframes slide-up {
  from {
    transform: translateY(24px);
    opacity: 0;
  }
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-h) + 18px);
  transform: translateX(-50%);
  max-width: 88vw;
  padding: 12px 18px;
  border-radius: 14px;
  background: #241d42;
  border: 1px solid var(--border-strong);
  font-size: 13.5px;
  z-index: 80;
  animation: fade 0.15s ease;
  box-shadow: var(--shadow);
}

.toast-error {
  background: #3a1723;
  border-color: rgba(255, 95, 109, 0.35);
  color: #ffd3d7;
}

.toast-ok {
  background: #12301f;
  border-color: rgba(62, 207, 142, 0.3);
  color: #c7f5e0;
}

/* ---------- misc ---------- */

.empty {
  text-align: center;
  padding: 34px 16px;
  color: var(--text-faint);
  font-size: 13.5px;
}

.empty svg {
  margin-bottom: 10px;
  opacity: 0.5;
}

.skeleton {
  border-radius: var(--radius);
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 37%, var(--surface) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s infinite;
  height: 96px;
  margin-bottom: 12px;
}

@keyframes shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: 0 0;
  }
}

.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 8px;
}

.app-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 6px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--text);
}

.hint {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 8px;
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 14px 0;
}

.center {
  text-align: center;
}
