﻿/* ── PAGE ── */
.ref-page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 32px 64px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
}

/* ── BACK ── */
.ref-back {
  display: inline-flex; align-items: center; gap: 7px;
  color: var(--text-faint); font-size: 13px; font-weight: 600;
  background: none; border: none; cursor: pointer;
  transition: color 0.2s;
}
.ref-back:hover { color: var(--text); }

/* ── HERO ── */
.ref-hero {
  position: relative; border-radius: 20px; overflow: hidden;
  padding: 40px 44px;
  background: linear-gradient(135deg, #0a2e1a 0%, #0d3d22 50%, #0f4a28 100%);
  border: 1px solid #1a4a2a;
  display: flex; align-items: center; gap: 40px;
}
.ref-hero-noise {
  position: absolute; inset: 0; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  background-size: 200px;
}
.ref-hero-glow {
  position: absolute; right: -60px; top: -60px;
  width: 300px; height: 300px; border-radius: 50%;
  background: radial-gradient(circle, rgba(74,212,118,0.12) 0%, transparent 70%);
  pointer-events: none;
}
.ref-hero-content { position: relative; z-index: 2; flex: 1; }
.ref-hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: #4ad476; color: var(--bg);
  font-size: 10px; font-weight: 800; letter-spacing: 1px;
  padding: 4px 12px; border-radius: 20px; margin-bottom: 14px;
}
.ref-hero-title {
  font-size: 32px; font-weight: 900; color: #fff;
  letter-spacing: -0.5px; line-height: 1.15; margin-bottom: 12px;
}
.ref-hero-title span { color: #4ad476; }
.ref-hero-desc {
  font-size: 14px; color: rgba(255,255,255,0.55);
  line-height: 1.6; max-width: 480px;
}
.ref-hero-stats {
  position: relative; z-index: 2;
  display: flex; flex-direction: column; gap: 12px; flex-shrink: 0;
}
.ref-hero-stat {
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(74,212,118,0.2);
  border-radius: 12px; padding: 14px 20px;
  text-align: center; min-width: 130px;
}
.ref-hero-stat-val { font-size: 26px; font-weight: 900; color: #4ad476; line-height: 1; margin-bottom: 4px; }
.ref-hero-stat-lbl { font-size: 11px; color: rgba(255,255,255,0.4); text-transform: uppercase; letter-spacing: 0.8px; }

/* ── SECTION HDR ── */
.ref-section-hdr {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 700; letter-spacing: 1px;
  color: var(--text-mute); text-transform: uppercase; margin-top: 6px;
}
.ref-section-hdr svg { opacity: 0.5; flex-shrink: 0; }

/* ── STATS GRID ── */
.ref-stats-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
}
.ref-stat-card {
  background: var(--bg-card); border: 1px solid rgba(var(--accent-rgb),0.12);
  border-radius: 14px; padding: 20px 22px;
}
.ref-stat-card-val { font-size: 26px; font-weight: 900; color: var(--text); line-height: 1; margin-bottom: 4px; }
.ref-stat-card-val--green { color: #4ad476; }
.ref-stat-card-val--red   { color: #d4634a; }
.ref-stat-card-lbl { font-size: 11px; color: var(--text-mute); text-transform: uppercase; letter-spacing: 0.8px; }
.ref-stat-card-sub { font-size: 12px; color: var(--text-faint); margin-top: 6px; }

/* ── CODE BLOCK ── */
.ref-code-block {
  background: var(--bg-card); border: 1px solid rgba(var(--accent-rgb),0.12);
  border-radius: 16px; padding: 28px 32px;
  display: flex; align-items: center; gap: 32px;
}
.ref-code-block-left { flex: 1; }
.ref-code-title { font-size: 17px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.ref-code-sub { font-size: 12px; color: var(--text-faint); margin-bottom: 16px; line-height: 1.5; }
.ref-code-input-row { display: flex; gap: 10px; align-items: center; }
.ref-code-input {
  background: #0d1526; border: 1px solid rgba(var(--accent-rgb),0.2);
  border-radius: 10px; padding: 0 16px; height: 42px;
  color: var(--text); font-size: 15px; font-weight: 700;
  letter-spacing: 2px; outline: none; width: 200px;
  transition: border-color 0.2s;
}
.ref-code-input:focus { border-color: rgba(74,212,118,0.4); }
.ref-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 0 20px; height: 42px; border-radius: 10px; border: none;
  font-size: 13px; font-weight: 700; letter-spacing: 0.3px;
  cursor: pointer; white-space: nowrap; transition: opacity 0.2s, transform 0.15s;
}
.ref-btn:hover { opacity: 0.85; transform: translateY(-1px); }
.ref-btn--green { background: linear-gradient(135deg, #4ad476, #2ab856); color: var(--bg); }
.ref-link-row {
  display: flex; align-items: center; gap: 10px;
  background: rgba(0,0,0,0.35); border: 1px dashed rgba(74,212,118,0.35);
  border-radius: 10px; padding: 10px 16px; margin-top: 12px;
}
.ref-link-val {
  flex: 1; font-size: 13px; color: rgba(255,255,255,0.45);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: monospace;
}
.ref-copy-btn {
  background: rgba(74,212,118,0.12); border: 1px solid rgba(74,212,118,0.25);
  color: #4ad476; font-size: 11px; font-weight: 700;
  border-radius: 7px; padding: 5px 14px; cursor: pointer;
  transition: background 0.2s; white-space: nowrap;
}
.ref-copy-btn:hover { background: rgba(74,212,118,0.22); }
.ref-code-right {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 20px 28px;
  background: rgba(74,212,118,0.05);
  border: 1px solid rgba(74,212,118,0.12);
  border-radius: 14px; text-align: center; flex-shrink: 0;
}
.ref-code-right-val { font-size: 38px; font-weight: 900; color: #4ad476; line-height: 1; }
.ref-code-right-lbl { font-size: 11px; color: rgba(255,255,255,0.35); text-transform: uppercase; letter-spacing: 0.8px; max-width: 90px; line-height: 1.3; }

/* ── LEVELS ── */
.ref-levels { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.ref-level {
  background: var(--bg-card); border: 1px solid rgba(var(--accent-rgb),0.12);
  border-radius: 16px; padding: 22px 16px 18px;
  display: flex; flex-direction: column; align-items: center;
  text-align: center; gap: 10px;
  position: relative; overflow: hidden;
  transition: border-color 0.25s, transform 0.2s;
}
.ref-level:hover { transform: translateY(-3px); }
.ref-level--active {
  border-color: #4ad476;
  background: linear-gradient(160deg, #0a2015 0%, var(--bg-card) 60%);
  padding-top: 30px;
}
.ref-level--locked { opacity: 0.55; }
.ref-level-num { font-size: 10px; font-weight: 800; letter-spacing: 1px; color: var(--text-mute); text-transform: uppercase; }
.ref-level--active .ref-level-num { color: #4ad476; }
.ref-level-icon {
  width: 52px; height: 52px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.ref-level-people { font-size: 22px; font-weight: 900; color: var(--text); line-height: 1; }
.ref-level-people span { font-size: 12px; font-weight: 500; color: var(--text-faint); }
.ref-level-pct {
  font-size: 30px; font-weight: 900; line-height: 1;
  background: linear-gradient(135deg, #4ad476, #2ab856);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.ref-level--locked .ref-level-pct { background: none; -webkit-text-fill-color: var(--text-mute); color: var(--text-mute); }
.ref-level-lbl { font-size: 11px; color: var(--text-faint); line-height: 1.4; }
.ref-level-badge {
  position: absolute; top: 0; left: 0; right: 0;
  background: linear-gradient(90deg, #2ab856, #4ad476, #2ab856);
  color: #0a2015;
  font-size: 9px; font-weight: 800; letter-spacing: 1px;
  padding: 5px 0; text-align: center; text-transform: uppercase;
  border-radius: 16px 16px 0 0;
  box-shadow: 0 1px 0 rgba(0,0,0,0.25);
}
.ref-level-lock { position: absolute; top: 12px; right: 12px; color: #2a2a3a; }
.ref-level-progress { width: 100%; height: 4px; background: rgba(255,255,255,0.06); border-radius: 4px; overflow: hidden; margin-top: 4px; }
.ref-level-progress-fill { height: 100%; border-radius: 4px; background: linear-gradient(90deg, #4ad476, #2ab856); }
.ref-level-progress-fill--locked { background: rgba(255,255,255,0.1); }

/* ── HOW IT WORKS ── */
.ref-how { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.ref-how-step {
  background: var(--bg-card); border: 1px solid rgba(var(--accent-rgb),0.12);
  border-radius: 14px; padding: 24px 22px; position: relative; overflow: hidden;
}
.ref-how-num {
  font-size: 56px; font-weight: 900; color: rgba(255,255,255,0.04);
  position: absolute; right: 14px; top: 8px; line-height: 1; pointer-events: none; letter-spacing: -2px;
}
.ref-how-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; margin-bottom: 14px; }
.ref-how-title { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.ref-how-desc { font-size: 12px; color: var(--text-faint); line-height: 1.6; }
.ref-how-desc b { color: var(--text); font-weight: 700; }

/* ── ВВОД ЧУЖОГО РЕФ-КОДА ── */
.ref-apply-card {
  background: linear-gradient(135deg, rgba(74,212,118,0.07) 0%, rgba(232,200,74,0.05) 100%), var(--bg-card);
  border: 1px solid rgba(74,212,118,0.22);
  border-radius: 14px;
  padding: 18px 22px;
  margin-bottom: 32px;
}
.ref-apply-state { display: flex; align-items: center; gap: 18px; }
.ref-apply-left {
  flex: 0 0 auto;
  width: 96px; height: 96px; border-radius: 12px;
  background: rgba(74,212,118,0.12);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  border: 1px solid rgba(74,212,118,0.25);
}
.ref-apply-left--ok { width: 56px; height: 56px; }
.ref-apply-bonus {
  font-size: 28px; font-weight: 900; color: #4ad476; line-height: 1;
  letter-spacing: -1px;
}
.ref-apply-bonus-lbl {
  font-size: 9.5px; font-weight: 700;
  color: rgba(74,212,118,0.85);
  text-transform: uppercase; letter-spacing: 0.4px;
  margin-top: 6px; text-align: center; line-height: 1.3;
}
.ref-apply-mid { flex: 1 1 auto; min-width: 0; }
.ref-apply-title {
  font-size: 15px; font-weight: 700; color: var(--text);
  margin-bottom: 5px;
}
.ref-apply-sub {
  font-size: 12px; color: var(--text-faint);
  line-height: 1.55; margin-bottom: 11px;
}
.ref-apply-sub b { color: var(--text); font-weight: 700; }
.ref-apply-input-row {
  display: flex; gap: 8px; align-items: center; max-width: 480px;
}
.ref-apply-input-row .ref-code-input { flex: 1 1 auto; min-width: 0; }

@media (max-width: 640px) {
  .ref-apply-state { flex-direction: column; align-items: stretch; gap: 14px; }
  .ref-apply-left { flex-direction: row; gap: 12px; width: 100%; height: auto; padding: 12px 16px; }
  .ref-apply-bonus { font-size: 22px; }
  .ref-apply-bonus-lbl { margin-top: 0; text-align: left; flex: 1; }
}

/* ── ВАЖНО ЗНАТЬ ── */
.ref-rules {
  background: var(--bg-card);
  border: 1px solid rgba(var(--accent-rgb),0.12);
  border-radius: 14px;
  padding: 22px 24px 24px;
  margin-bottom: 32px;
}
.ref-rules-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 700; color: var(--text);
  margin-bottom: 16px; letter-spacing: 0.2px;
}
.ref-rules-title svg { color: #e8c84a; }
.ref-rules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 10px 18px;
}
.ref-rule {
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(255,255,255,0.02);
  border-left: 2px solid rgba(232,200,74,0.45);
}
.ref-rule-hd {
  font-size: 13px; font-weight: 700; color: var(--text);
  margin-bottom: 5px;
}
.ref-rule-body {
  font-size: 12px; color: var(--text-faint); line-height: 1.55;
}
.ref-rule-body b { color: var(--text); font-weight: 700; }
.ref-rule-body code {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 11px; color: #e8c84a;
  background: rgba(232,200,74,0.08); padding: 1px 5px; border-radius: 4px;
}

/* ── TOAST ── */
.ref-toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(80px);
  background: rgba(74,212,118,0.15); border: 1px solid #4ad476;
  color: #4ad476; font-size: 13px; font-weight: 700;
  padding: 12px 24px; border-radius: 12px;
  opacity: 0; transition: transform 0.3s, opacity 0.3s;
  z-index: 1000; pointer-events: none;
  display: flex; align-items: center; gap: 8px;
}
.ref-toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* ══════════════════════════════════════════════════════════════
   ПОДЕЛИТЬСЯ ССЫЛКОЙ
══════════════════════════════════════════════════════════════ */
.ref-share-block {
  background: var(--bg-card);
  border: 1px solid rgba(var(--accent-rgb), 0.12);
  border-radius: 14px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 6px;
}
.ref-share-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: stretch;
}
.ref-share-btn {
  flex: 1 1 110px;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(var(--accent-rgb), 0.18);
  background: rgba(var(--accent-rgb), 0.06);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.3px;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.12s, background 0.15s, border-color 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}
.ref-share-btn:hover {
  transform: translateY(-1px);
  background: rgba(var(--accent-rgb), 0.12);
  border-color: rgba(var(--accent-rgb), 0.35);
}
.ref-share-btn[disabled] { opacity: 0.4; cursor: not-allowed; transform: none; }
.ref-share-btn svg { flex-shrink: 0; }

.ref-share-btn--tg { color: #2aabee; border-color: rgba(42,171,238,0.3); background: rgba(42,171,238,0.08); }
.ref-share-btn--tg:hover { background: rgba(42,171,238,0.16); border-color: rgba(42,171,238,0.5); box-shadow: 0 4px 14px rgba(42,171,238,0.2); }
.ref-share-btn--vk { color: #4a76a8; border-color: rgba(74,118,168,0.3); background: rgba(74,118,168,0.08); }
.ref-share-btn--vk:hover { background: rgba(74,118,168,0.16); border-color: rgba(74,118,168,0.5); box-shadow: 0 4px 14px rgba(74,118,168,0.2); }
.ref-share-btn--dc { color: #5865f2; border-color: rgba(88,101,242,0.3); background: rgba(88,101,242,0.08); }
.ref-share-btn--dc:hover { background: rgba(88,101,242,0.16); border-color: rgba(88,101,242,0.5); box-shadow: 0 4px 14px rgba(88,101,242,0.2); }
.ref-share-btn--x  { color: var(--text); border-color: rgba(255,255,255,0.18); background: rgba(255,255,255,0.04); }
.ref-share-btn--x:hover { background: rgba(255,255,255,0.10); border-color: rgba(255,255,255,0.3); }
.ref-share-btn--wa { color: #25d366; border-color: rgba(37,211,102,0.3); background: rgba(37,211,102,0.08); }
.ref-share-btn--wa:hover { background: rgba(37,211,102,0.16); border-color: rgba(37,211,102,0.5); box-shadow: 0 4px 14px rgba(37,211,102,0.2); }
.ref-share-btn--copy { color: var(--accent); }
.ref-share-btn--qr   { color: var(--accent); }

/* ══════════════════════════════════════════════════════════════
   QR-МОДАЛКА
══════════════════════════════════════════════════════════════ */
.ref-qr-overlay {
  position: fixed; inset: 0; z-index: 4000;
  background: rgba(0,0,0,0.72); backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center;
  padding: 24px;
  animation: ref-qr-fade 0.2s ease-out;
}
.ref-qr-overlay.open { display: flex; }
@keyframes ref-qr-fade { from { opacity: 0 } to { opacity: 1 } }

.ref-qr-modal {
  position: relative;
  background: var(--bg-card);
  border: 1px solid rgba(var(--accent-rgb), 0.25);
  border-radius: 18px;
  padding: 26px 26px 22px;
  width: 320px;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.5);
  animation: ref-qr-pop 0.2s ease-out;
}
@keyframes ref-qr-pop { from { transform: scale(0.92); opacity: 0 } to { transform: scale(1); opacity: 1 } }

.ref-qr-close {
  position: absolute; top: 12px; right: 12px;
  width: 28px; height: 28px; border-radius: 8px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--text-dim);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 14px;
  transition: background 0.15s, color 0.15s;
}
.ref-qr-close:hover { background: rgba(255,255,255,0.1); color: var(--text); }

.ref-qr-title {
  font-size: 14px; font-weight: 800; letter-spacing: 0.3px;
  color: var(--text);
}
.ref-qr-img-wrap {
  background: #fff;
  padding: 14px;
  border-radius: 14px;
  line-height: 0;
}
.ref-qr-img-wrap img { display: block; width: 220px; height: 220px; }
.ref-qr-link {
  font-size: 11px; color: var(--text-dim);
  word-break: break-all; text-align: center;
}

/* ══════════════════════════════════════════════════════════════
   ТАБЛИЦА «МОИ РЕФЕРАЛЫ»
══════════════════════════════════════════════════════════════ */
.ref-list-card {
  background: var(--bg-card);
  border: 1px solid rgba(var(--accent-rgb), 0.12);
  border-radius: 14px;
  overflow: hidden;
}
.ref-list-hdr {
  padding: 14px 18px;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  border-bottom: 1px solid rgba(var(--accent-rgb), 0.08);
  background: rgba(var(--accent-rgb), 0.04);
}
.ref-list-title {
  font-size: 14px; font-weight: 800; color: var(--text);
  display: inline-flex; align-items: center; gap: 8px;
}
.ref-list-count {
  font-size: 11px; font-weight: 700;
  color: var(--accent);
  background: rgba(var(--accent-rgb), 0.12);
  border: 1px solid rgba(var(--accent-rgb), 0.25);
  padding: 2px 9px; border-radius: 10px;
}
.ref-list-pill {
  margin-left: auto;
  font-size: 11px; font-weight: 700;
  color: #4ad476;
  background: rgba(74,212,118,0.10);
  border: 1px solid rgba(74,212,118,0.28);
  padding: 5px 11px; border-radius: 10px;
}

.ref-list-table { width: 100%; border-collapse: collapse; }
.ref-list-table th {
  text-align: left;
  font-size: 10px; font-weight: 800; letter-spacing: 0.6px;
  color: var(--text-mute); text-transform: uppercase;
  padding: 12px 18px;
  background: rgba(0,0,0,0.18);
  border-bottom: 1px solid rgba(var(--accent-rgb), 0.06);
}
.ref-list-table th.right { text-align: right; }
.ref-list-table td {
  padding: 13px 18px;
  border-bottom: 1px solid rgba(var(--accent-rgb), 0.05);
  font-size: 13px; color: var(--text); vertical-align: middle;
}
.ref-list-table td.right { text-align: right; font-variant-numeric: tabular-nums; }
.ref-list-table tr:last-child td { border-bottom: none; }
.ref-list-table tr:hover td { background: rgba(var(--accent-rgb), 0.03); }

.ref-row-user { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ref-row-ava {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, rgba(var(--accent-rgb),0.45), rgba(var(--accent-rgb),0.18));
  color: #fff; font-size: 11px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.ref-row-uname {
  font-weight: 700; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ref-row-since {
  font-size: 11px; color: var(--text-mute);
}

.ref-status {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700;
  padding: 3px 9px; border-radius: 999px;
}
.ref-status::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
}
.ref-status--active {
  color: #4ad476;
  background: rgba(74,212,118,0.10);
  border: 1px solid rgba(74,212,118,0.25);
}
.ref-status--active::before { background: #4ad476; box-shadow: 0 0 0 2px rgba(74,212,118,0.25); }
.ref-status--inactive {
  color: var(--text-mute);
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
}
.ref-status--inactive::before { background: var(--text-mute); }

.ref-row-earned { color: #4ad476; font-weight: 700; }
.ref-row-earned.zero { color: var(--text-mute); font-weight: 600; }
.ref-row-earned.neg { color: #d4634a; font-weight: 700; }

.ref-list-empty {
  padding: 38px 18px;
  text-align: center;
  color: var(--text-mute);
  font-size: 13px;
}

@media (max-width: 720px) {
  .ref-list-table th:nth-child(2),
  .ref-list-table td:nth-child(2) { display: none; }
  .ref-share-btn { flex-basis: calc(50% - 6px); }
}
