:root {
  color-scheme: dark;
  --bg: #12070b;
  --bg-soft: #1b0a10;
  --card: #221017;
  --card-2: #2b131c;
  --card-3: #341722;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 92, 122, 0.35);
  --text: #f8eef1;
  --muted: #c9a8b2;
  --hint: #9e7c87;
  --red: #e11d48;
  --red-2: #ff335f;
  --red-3: #ff6b8a;
  --gold: #ffcf5c;
  --green: #34d399;
  --shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
  --radius: 22px;
  --radius-sm: 14px;
  --tg-viewport-height: 100vh;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  background:
    radial-gradient(1000px 600px at 85% -10%, rgba(225, 29, 72, 0.28), transparent 60%),
    radial-gradient(800px 500px at -10% 20%, rgba(120, 20, 45, 0.35), transparent 55%),
    var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  line-height: 1.45;
}

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

.app {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 0 16px calc(104px + env(safe-area-inset-bottom));
}

.profile {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 -16px;
  padding: calc(14px + env(safe-area-inset-top)) 18px 14px;
  background: rgba(18, 7, 11, 0.82);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
}

.avatar {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 16px;
  font-weight: 800;
  font-size: 20px;
  color: #fff;
  background: linear-gradient(135deg, var(--red-2), #8c0f2d);
  box-shadow: 0 8px 22px rgba(225, 29, 72, 0.4);
}

.profile__text {
  flex: 1;
  min-width: 0;
}

.profile__name {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile__username {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
  transition: transform 0.2s ease, color 0.2s ease;
}

.icon-btn:active {
  transform: scale(0.94);
}

.icon-btn.is-spinning svg {
  animation: spin 0.9s linear infinite;
}

.content {
  padding-top: 18px;
}

.bonus-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 207, 92, 0.35);
  border-radius: var(--radius);
  background: linear-gradient(120deg, rgba(255, 207, 92, 0.16), rgba(225, 29, 72, 0.12));
}

.bonus-banner__text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 14px;
}

.bonus-banner__text strong {
  font-size: 15px;
}

.bonus-banner__text span {
  color: var(--muted);
}

.bonus-banner__btn {
  flex: 0 0 auto;
  padding: 10px 16px;
}

.hero {
  padding: 24px 20px;
  border-radius: calc(var(--radius) + 4px);
  background:
    radial-gradient(400px 200px at 100% 0%, rgba(255, 107, 138, 0.35), transparent 70%),
    linear-gradient(150deg, #7f1230, #3a0c1c 70%);
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 107, 138, 0.25);
}

.hero__badge {
  display: inline-block;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  font-size: 12px;
  letter-spacing: 0.02em;
}

.hero h2 {
  margin: 12px 0 8px;
  font-size: 26px;
  line-height: 1.15;
}

.hero p {
  margin: 0;
  color: #ffd9e1;
  font-size: 14px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 4px 0 14px;
}

.section-head h2 {
  margin: 0;
  font-size: 22px;
}

.section-head__emoji {
  font-size: 22px;
}

.prose {
  margin: 16px 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--muted);
  font-size: 14px;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.card {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

.muted {
  color: var(--muted);
  margin: 0;
  font-size: 14px;
}

.caption {
  margin: 10px 0 0;
  color: var(--hint);
  font-size: 12px;
}

.programs {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 16px 0;
}

.program {
  position: relative;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(160deg, var(--card-2), var(--card));
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.program.is-selected {
  border-color: var(--red-2);
  box-shadow: 0 0 0 1px rgba(255, 51, 95, 0.35), 0 12px 30px rgba(225, 29, 72, 0.18);
}

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

.program__title {
  margin: 0;
  font-size: 17px;
  line-height: 1.25;
}

.program__price {
  flex: 0 0 auto;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(225, 29, 72, 0.18);
  color: var(--red-3);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.program__desc {
  margin: 10px 0 14px;
  color: var(--muted);
  font-size: 13px;
}

.program__actions {
  display: flex;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card-2);
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease, opacity 0.15s ease;
}

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

.btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.btn--primary {
  border-color: transparent;
  background: linear-gradient(135deg, var(--red-2), #a5123a);
  color: #fff;
  box-shadow: 0 10px 24px rgba(225, 29, 72, 0.28);
}

.btn--ghost {
  background: transparent;
}

.btn--gold {
  border-color: rgba(255, 207, 92, 0.4);
  background: linear-gradient(135deg, #f0b429, #b97412);
  color: #2a1600;
}

.btn--wide {
  width: 100%;
}

.btn--small {
  padding: 8px 12px;
  font-size: 12px;
  border-radius: 11px;
}

.balance-card {
  padding: 22px;
  border-radius: calc(var(--radius) + 4px);
  background:
    radial-gradient(420px 220px at 100% 0%, rgba(255, 107, 138, 0.45), transparent 65%),
    linear-gradient(145deg, #8e1335, #350b19 75%);
  border: 1px solid rgba(255, 107, 138, 0.3);
  box-shadow: var(--shadow);
}

.balance-card__label {
  color: #ffd3dd;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.balance-card__value {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 6px;
  font-size: 42px;
  font-weight: 800;
  line-height: 1;
}

.balance-card__star {
  color: var(--gold);
  font-size: 26px;
}

.balance-card__hint {
  margin: 8px 0 0;
  color: #ffd3dd;
  font-size: 13px;
}

.status-card {
  margin-top: 16px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
}

.status-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.status-card__title {
  margin: 0;
  font-size: 18px;
}

.status {
  flex: 0 0 auto;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.status--paid,
.status--completed,
.status--approved {
  background: rgba(52, 211, 153, 0.16);
  color: var(--green);
}

.status--pending {
  background: rgba(255, 207, 92, 0.16);
  color: var(--gold);
}

.status--unpaid,
.status--rejected,
.status--cancelled {
  background: rgba(255, 107, 138, 0.16);
  color: var(--red-3);
}

.status-card__desc {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.status-card__desc--warn {
  color: var(--gold);
}

.crypto-wallet {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
}

.crypto-wallet__head {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.crypto-address {
  display: block;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.3);
  color: var(--gold);
  font-size: 13px;
  overflow-wrap: anywhere;
  user-select: all;
}

.crypto-wallet .btn {
  align-self: flex-start;
}

.rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}

.row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 14px;
}

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

.row span {
  color: var(--muted);
}

.row strong {
  text-align: right;
}

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

.progress__bar {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--red), var(--gold));
  transition: width 0.4s ease;
}

.actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.actions .btn {
  width: 100%;
  min-height: 54px;
  text-align: left;
  justify-content: flex-start;
  white-space: normal;
}

.actions .btn--wide {
  grid-column: 1 / -1;
}

.date-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}

.referral-card {
  margin-top: 16px;
}

.referral-card h3 {
  margin: 0 0 6px;
  font-size: 17px;
}

.referral-card__count {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 14px;
}

.referral-link {
  padding: 12px;
  border: 1px dashed var(--border-strong);
  border-radius: 12px;
  background: var(--bg-soft);
  color: var(--red-3);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.referral-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.referral-actions .btn {
  flex: 1;
}

.info-card {
  display: flex;
  gap: 14px;
  margin-top: 16px;
}

.info-card__icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border-radius: 14px;
  background: rgba(225, 29, 72, 0.16);
  font-size: 20px;
}

.info-card__title {
  margin: 0 0 6px;
  font-size: 16px;
}

.countdown {
  padding: 22px;
  border-radius: calc(var(--radius) + 4px);
  border: 1px solid rgba(255, 107, 138, 0.28);
  background:
    radial-gradient(400px 200px at 50% 0%, rgba(255, 107, 138, 0.3), transparent 70%),
    linear-gradient(160deg, #350b19, #1a080f);
  text-align: center;
  box-shadow: var(--shadow);
}

.countdown__label {
  color: var(--muted);
  font-size: 13px;
}

.countdown__value {
  margin-top: 8px;
  font-size: 34px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.countdown__date {
  margin-top: 8px;
  color: #ffd3dd;
  font-size: 13px;
}

.countdown__stats {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 12px;
}

.countdown__stats strong {
  display: block;
  color: var(--text);
  font-size: 17px;
}

.application-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.application-form__label {
  font-weight: 700;
}

.application-form textarea {
  width: 100%;
  min-height: 140px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  color: var(--text);
  resize: vertical;
}

.application-form textarea:focus {
  outline: none;
  border-color: var(--red-2);
  box-shadow: 0 0 0 3px rgba(255, 51, 95, 0.14);
}

.admin-tabs-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  margin-bottom: 16px;
}

.admin-tabs {
  flex: 1;
  min-width: 0;
  display: flex;
  gap: 8px;
  padding: 4px 2px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 107, 138, 0.45) transparent;
}

.admin-tabs::-webkit-scrollbar {
  height: 5px;
}

.admin-tabs::-webkit-scrollbar-track {
  background: transparent;
}

.admin-tabs::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(255, 107, 138, 0.45);
}

.admin-tabs-nav {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--card);
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.admin-tabs-nav:active {
  transform: scale(0.94);
}

.admin-tab {
  flex: 0 0 auto;
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.admin-tab.is-active {
  border-color: var(--red-2);
  background: rgba(225, 29, 72, 0.18);
  color: var(--text);
}

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

.stat {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
}

.stat__value {
  font-size: 24px;
  font-weight: 800;
  line-height: 1.1;
}

.stat__label {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

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

.chart-card h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.chart {
  width: 100%;
  height: 140px;
  overflow: visible;
}

.chart__grid {
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 1;
}

.chart__tick {
  fill: var(--hint);
  font-size: 8px;
  font-variant-numeric: tabular-nums;
}

.chart__line {
  fill: none;
  stroke: var(--red-3);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart__area {
  fill: rgba(255, 51, 95, 0.14);
  stroke: none;
}

.chart__label {
  fill: var(--hint);
  font-size: 9px;
}

.chart-legend {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  color: var(--hint);
  font-size: 10px;
}

.admin-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}

.admin-form label {
  color: var(--muted);
  font-size: 12px;
}

.admin-form input,
.admin-form select,
.admin-form textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-soft);
  resize: vertical;
}

.admin-form input:focus,
.admin-form select:focus,
.admin-form textarea:focus {
  outline: none;
  border-color: var(--red-2);
}

.admin-form .row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.admin-form__section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.02);
}

.admin-form__section h4 {
  margin: 0;
  font-size: 14px;
}

.admin-form__section .muted {
  margin: 0;
}

.broadcast-media {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.broadcast-media__preview {
  width: 100%;
  max-height: 260px;
  border-radius: 12px;
  object-fit: contain;
  background: #000;
}

.broadcast-estimate {
  padding: 12px;
  border: 1px dashed var(--border-strong);
  border-radius: 12px;
  background: rgba(225, 29, 72, 0.08);
  font-weight: 700;
  text-align: center;
}

.broadcast-actions,
.broadcast-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.broadcast-actions .btn {
  flex: 1;
}

.broadcast-actions .btn--primary {
  flex: 2;
}

.broadcast-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.broadcast-status {
  color: var(--red-3);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.broadcast-preview {
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 120px;
  overflow: hidden;
}

.broadcast-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--card-2);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.broadcast-toggle input {
  width: auto;
  margin: 0;
  accent-color: var(--red-2);
}

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
}

.pager__label {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.list-item {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-soft);
  font-size: 13px;
}

.list-item__top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.list-item__muted {
  margin-top: 4px;
  color: var(--hint);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.tabbar {
  position: fixed;
  left: 50%;
  bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 30;
  display: flex;
  width: min(calc(100% - 24px), 736px);
  transform: translateX(-50%);
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: rgba(26, 9, 16, 0.92);
  backdrop-filter: blur(18px);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}

.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 4px;
  border: 0;
  border-radius: 18px;
  background: transparent;
  color: var(--hint);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease;
}

.tab.is-active {
  color: #fff;
  background: linear-gradient(135deg, rgba(225, 29, 72, 0.35), rgba(140, 15, 45, 0.35));
}

.gate,
.fatal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(18, 7, 11, 0.95);
  backdrop-filter: blur(10px);
}

.gate__card,
.fatal__card {
  width: min(100%, 380px);
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  text-align: center;
  box-shadow: var(--shadow);
}

.gate__title,
.fatal h1 {
  margin: 16px 0 8px;
  font-size: 20px;
}

.gate__text,
.fatal p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.fatal__icon {
  font-size: 42px;
}

.spinner {
  width: 42px;
  height: 42px;
  margin: 0 auto;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--red-2);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.skeleton {
  height: 92px;
  border-radius: var(--radius);
  background: linear-gradient(
    100deg,
    rgba(255, 255, 255, 0.04) 20%,
    rgba(255, 255, 255, 0.1) 40%,
    rgba(255, 255, 255, 0.04) 60%
  );
  background-size: 220% 100%;
  animation: shimmer 1.4s infinite;
}

.state {
  padding: 24px 16px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-soft);
  text-align: center;
  color: var(--muted);
}

.state__icon {
  font-size: 26px;
}

.state__title {
  margin-top: 8px;
  color: var(--text);
  font-weight: 700;
}

.state__text {
  margin: 6px 0 12px;
  font-size: 13px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom));
  z-index: 60;
  max-width: calc(100% - 32px);
  padding: 12px 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(43, 19, 28, 0.96);
  box-shadow: var(--shadow);
  font-size: 13px;
  transform: translate(-50%, 12px);
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

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

@media (max-width: 420px) {
  .actions {
    grid-template-columns: 1fr;
  }

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

  .balance-card__value {
    font-size: 36px;
  }
}
