:root {
  color-scheme: dark;
  --bg: #030504;
  --bg-soft: #07100a;
  --surface: rgba(7, 11, 8, 0.92);
  --surface-2: rgba(10, 15, 11, 0.96);
  --surface-3: rgba(15, 22, 16, 0.98);
  --line: rgba(100, 255, 146, 0.2);
  --line-strong: rgba(125, 255, 150, 0.55);
  --text: #f4f7f3;
  --muted: #96a194;
  --accent: #67ee58;
  --accent-2: #45c63a;
  --accent-soft: rgba(103, 238, 88, 0.15);
  --danger: #ff8f62;
  --success: #8fff7b;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  --glow: 0 0 0 1px rgba(100, 255, 146, 0.15), 0 0 24px rgba(57, 255, 111, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  background:
    radial-gradient(circle at top, rgba(47, 255, 106, 0.12), transparent 28%),
    linear-gradient(180deg, #020403 0%, #000 100%);
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  background:
    radial-gradient(circle at 50% 0%, rgba(63, 255, 111, 0.12), transparent 32%),
    linear-gradient(180deg, #020403 0%, #000 100%);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 25px;
  line-height: 1.08;
  font-weight: 800;
}

h2 {
  font-size: 18px;
  line-height: 1.18;
  font-weight: 700;
}

.app-shell {
  width: min(445px, calc(100% - 24px));
  min-height: 100vh;
  margin: 0 auto;
  padding: calc(40px + env(safe-area-inset-top, 0px)) 17px 22px;
  background: transparent;
}

.topbar {
  display: grid;
  gap: 17px;
  margin-bottom: 14px;
}

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

.brand-lockup {
  display: grid;
  gap: 3px;
}

.brand-mark {
  color: #fff;
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 0;
}

.brand-mark span {
  color: #fff;
}

.brand-mark::first-letter {
  color: var(--accent);
}

.eyebrow {
  color: var(--accent);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.brand-avatar {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(123, 255, 116, 0.12);
  background:
    radial-gradient(circle at 35% 30%, rgba(122, 255, 95, 0.18), transparent 45%),
    rgba(13, 20, 14, 0.96);
  color: #d9e7d8;
  font-size: 19px;
  font-weight: 800;
  box-shadow: var(--glow);
}

.balance-box,
.stat,
.panel,
.program-card,
.modal-card,
.list-item {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(7, 11, 8, 0.96) 0%, rgba(4, 8, 5, 0.98) 100%);
  border: 1px solid rgba(111, 255, 143, 0.16);
  border-radius: 14px;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.03), var(--glow);
}

.balance-box {
  min-height: 116px;
  padding: 30px 20px;
  background:
    linear-gradient(90deg, rgba(4, 8, 5, 0.99) 0%, rgba(4, 8, 5, 0.99) 49%, rgba(4, 13, 7, 0.72) 49%, rgba(3, 7, 5, 0.28) 100%);
}

.balance-box span,
.stat span,
.copy-field span,
label span {
  display: block;
  color: #dfe6de;
  font-size: 13px;
}

.balance-box strong {
  position: relative;
  z-index: 1;
  display: block;
  margin-top: 6px;
  color: var(--accent);
  font-size: 30px;
  line-height: 1;
  font-weight: 800;
}

.balance-globe {
  position: absolute;
  top: -1px;
  right: -1px;
  width: 245px;
  height: 119px;
  pointer-events: none;
  opacity: 1;
  overflow: hidden;
  mix-blend-mode: normal;
}

.balance-globe img {
  width: 245px;
  height: 119px;
  display: block;
  object-fit: cover;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 30px;
}

.tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid rgba(61, 86, 64, 0.5);
  border-radius: 7px;
  background:
    linear-gradient(180deg, rgba(10, 15, 12, 0.96), rgba(2, 5, 3, 0.98));
  color: #d6dbd2;
  font-size: 14px;
  font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.tab.active {
  border-color: rgba(91, 210, 78, 0.86);
  color: #fff;
  box-shadow:
    inset 0 0 0 1px rgba(96, 190, 84, 0.22),
    inset 0 0 18px rgba(38, 148, 42, 0.12),
    0 0 12px rgba(75, 180, 68, 0.2);
}

.tab-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: inherit;
}

.tab-icon svg {
  width: 18px;
  height: 18px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.section-head {
  display: grid;
  gap: 8px;
  margin-bottom: 20px;
}

.section-head p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

.section-head.compact {
  margin-bottom: 12px;
}

.program-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
}

.program-card {
  display: grid;
  gap: 15px;
  padding: 16px;
  border-radius: 12px;
}

.program-card header,
.list-item header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.program-card h2 {
  font-size: 17px;
}

.copy-title {
  display: inline;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 800;
  text-align: left;
}

.copy-title:active {
  color: var(--accent);
}

.program-card small {
  font-size: 12px;
}

.program-card p,
.subtext,
.list-item small {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(80, 255, 90, 0.08);
  border: 1px solid rgba(122, 255, 95, 0.1);
  color: var(--accent);
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}

.primary-button,
.secondary-button,
.primary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 14px;
  border-radius: 7px;
  border: 1px solid rgba(91, 205, 76, 0.78);
  text-decoration: none;
  font-weight: 800;
}

.primary-button,
.primary-link {
  color: #ffffff;
  background:
    linear-gradient(180deg, rgba(14, 22, 15, 0.96), rgba(3, 7, 4, 0.98));
  box-shadow:
    inset 0 0 0 1px rgba(92, 170, 80, 0.18),
    inset 0 0 22px rgba(34, 142, 38, 0.08),
    0 0 10px rgba(56, 165, 50, 0.16);
}

.primary-button:hover,
.primary-link:hover {
  filter: brightness(1.05);
}

.secondary-button {
  border: 1px solid rgba(95, 115, 98, 0.26);
  background: rgba(13, 18, 14, 0.85);
  color: #f2f5f1;
}

.program-action {
  position: relative;
  justify-content: center;
  min-height: 48px;
  font-size: 14px;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.22);
  border-color: rgba(104, 219, 88, 0.9);
  background:
    linear-gradient(90deg, rgba(79, 179, 65, 0.88) 0%, rgba(54, 139, 45, 0.58) 48%, rgba(8, 22, 10, 0.36) 100%),
    linear-gradient(180deg, rgba(201, 255, 187, 0.14) 0%, rgba(255, 255, 255, 0) 42%);
  box-shadow:
    inset 0 1px 0 rgba(205, 255, 190, 0.22),
    inset 0 -1px 0 rgba(21, 72, 18, 0.45),
    0 0 0 1px rgba(67, 160, 55, 0.38),
    0 0 12px rgba(63, 170, 57, 0.18);
}

.program-action .action-arrow {
  position: absolute;
  right: 10px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background:
    linear-gradient(180deg, rgba(43, 87, 38, 0.46), rgba(6, 16, 7, 0.66));
  border: 1px solid rgba(111, 190, 98, 0.12);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 0 8px rgba(55, 145, 50, 0.08);
}

.program-action .action-arrow svg {
  width: 13px;
  height: 13px;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.finance-grid {
  grid-template-columns: 1fr 1fr;
}

.stat {
  min-height: 116px;
  padding: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.stat-copy {
  min-width: 0;
}

.stat strong {
  display: block;
  margin-top: 10px;
  font-size: 22px;
  font-weight: 800;
}

.stat-icon {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: rgba(57, 255, 111, 0.08);
  border: 1px solid rgba(122, 255, 95, 0.14);
  color: var(--accent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.stat-icon svg {
  width: 24px;
  height: 24px;
}

.panel {
  padding: 18px;
  margin-bottom: 12px;
  border-radius: 20px;
}

.list {
  display: grid;
  gap: 10px;
}

.list:empty::before {
  content: "Пока пусто";
  display: block;
  padding: 8px 0 4px;
  color: var(--muted);
}

.list-item {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: 18px;
}

.link-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.link-stats span {
  display: grid;
  gap: 2px;
  min-height: 54px;
  padding: 9px 10px;
  border: 1px solid rgba(83, 111, 87, 0.28);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(10, 14, 11, 0.94), rgba(4, 7, 5, 0.96));
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.link-stats strong {
  color: #f7fff5;
  font-size: 22px;
  line-height: 1;
}

.terms-box {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid rgba(126, 196, 112, 0.24);
  border-radius: 12px;
  background: rgba(60, 130, 50, 0.07);
}

.terms-box strong {
  color: #f7fff5;
  font-size: 13px;
}

.terms-box span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.status {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.status.pending {
  color: #ffc56a;
}

.status.approved {
  color: var(--accent);
}

.status.rejected {
  color: #ff8575;
}

.events-panel {
  min-height: 360px;
}

.compact-event-list {
  gap: 8px;
}

.compact-event-list .list-item {
  gap: 7px;
  padding: 12px;
  border-radius: 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03), var(--glow);
}

.compact-event-list .list-item header {
  align-items: center;
}

.compact-event-list strong {
  font-size: 15px;
  line-height: 1.15;
}

.compact-event-list .subtext {
  font-size: 12px;
  line-height: 1.3;
}

.compact-event-list .event-type {
  min-height: 25px;
  padding: 3px 8px;
  font-size: 10px;
}

.event-type {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.event-type.registration {
  color: #a7c6ff;
  background: rgba(62, 105, 255, 0.12);
}

.event-type.first_deposit {
  color: #8fff7b;
  background: rgba(63, 255, 123, 0.12);
}

.event-type.reward {
  color: #ffb357;
  background: rgba(255, 160, 62, 0.12);
}

.event-type.qualification_check {
  color: #e0b5ff;
  background: rgba(190, 96, 255, 0.12);
}

.money-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.money-row span {
  display: grid;
  gap: 2px;
  padding: 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 12px;
}

.money-row strong {
  color: var(--text);
  font-size: 14px;
}

.info-grid {
  display: grid;
  gap: 10px;
}

.info-grid > div {
  display: grid;
  gap: 4px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
}

.info-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.info-grid p {
  color: var(--text);
  line-height: 1.45;
}

.copy-field {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-bottom: 12px;
}

.copy-field span {
  grid-column: 1 / -1;
}

.copy-field button {
  display: grid;
  place-items: center;
  min-width: 52px;
  min-height: 46px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid rgba(122, 255, 95, 0.35);
  background: rgba(10, 18, 11, 0.98);
  color: #f7fff6;
  font-weight: 800;
  box-shadow: var(--glow);
}

.copy-field button svg {
  width: 20px;
  height: 20px;
}

.referral-box {
  margin-bottom: 14px;
}

.copy-field button:hover {
  border-color: rgba(122, 255, 95, 0.7);
}

.text-link {
  color: #dcf5da;
  font-weight: 700;
  overflow-wrap: anywhere;
  text-decoration: none;
}

.text-link:hover {
  color: #fff;
}

input,
textarea {
  width: 100%;
  border: 1px solid rgba(112, 151, 118, 0.18);
  border-radius: 14px;
  background: rgba(10, 15, 11, 0.96);
  color: var(--text);
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

input {
  min-height: 46px;
  padding: 0 14px;
}

textarea {
  resize: vertical;
  min-height: 170px;
  padding: 14px;
  line-height: 1.45;
}

input:focus,
textarea:focus {
  border-color: rgba(122, 255, 95, 0.65);
  box-shadow: 0 0 0 3px rgba(122, 255, 95, 0.1);
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(8px);
}

.modal-card {
  position: relative;
  display: grid;
  gap: 14px;
  width: min(420px, 100%);
  padding: 18px;
}

.icon-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(120, 145, 122, 0.2);
  border-radius: 50%;
  background: rgba(15, 20, 16, 0.92);
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  width: min(420px, calc(100% - 32px));
  padding: 13px 16px;
  border-radius: 14px;
  background: rgba(12, 18, 13, 0.97);
  border: 1px solid rgba(122, 255, 95, 0.2);
  color: #fff;
  box-shadow: var(--shadow), var(--glow);
}

.form-error {
  margin: 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 103, 78, 0.08);
  border: 1px solid rgba(255, 103, 78, 0.18);
  color: #ff9f86;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
}

.primary-link {
  width: 100%;
  margin-top: 4px;
}

.primary-link svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.hidden {
  display: none !important;
}

@media (min-width: 720px) {
  .app-shell {
    width: min(445px, calc(100% - 24px));
  }

}

@media (max-width: 520px) {
  .app-shell {
    width: min(445px, calc(100% - 24px));
    margin: 0 auto;
    min-height: 100vh;
    padding: calc(40px + env(safe-area-inset-top, 0px)) 17px 22px;
  }

  .tabs {
    grid-template-columns: 1fr 1fr;
  }

  .money-row,
  .finance-grid {
    grid-template-columns: 1fr;
  }

  .copy-field {
    grid-template-columns: 1fr;
  }
}
