/* ══════════════════════════════════════════
   数据无恙 — Referral page
   ══════════════════════════════════════════ */

.ref-main {
  position: relative;
  min-height: 100vh;
  padding: 64px 20px 60px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ══════ Login view ══════ */

.ref-login {
  position: relative; z-index: 2;
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  padding: 40px 0;
}

.ref-login-card {
  width: 100%; max-width: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  text-align: center;
}

.ref-login-icon {
  width: 64px; height: 64px; border-radius: 18px;
  margin: 0 auto 20px;
  display: flex; align-items: center; justify-content: center;
  background: var(--gradient);
  box-shadow: 0 12px 34px rgba(167,139,250,0.28);
}

.ref-login-card h1 { font-size: 22px; font-weight: 800; letter-spacing: -0.01em; }
.ref-login-sub { font-size: 13px; color: var(--text-dim); margin-top: 8px; margin-bottom: 8px; }

.ref-label {
  display: block; text-align: left;
  font-size: 12px; font-weight: 600; color: var(--text-dim);
  margin: 18px 0 8px;
}
.ref-label-dim, .ref-link-dim { color: var(--text-muted); font-weight: 500; }

.ref-input {
  width: 100%; padding: 13px 15px; border-radius: 12px;
  border: 1px solid var(--border-hover);
  background: rgba(255,255,255,0.03);
  color: var(--text); font-size: 15px;
  outline: none; box-sizing: border-box;
  transition: border-color 0.2s, background 0.2s;
  font-family: inherit;
}
.ref-input::placeholder { color: var(--text-muted); }
.ref-input:focus { border-color: var(--accent-1); background: rgba(167,139,250,0.05); }
.ref-input-code { text-align: center; letter-spacing: 0.4em; font-size: 20px; font-weight: 600; }

.ref-btn {
  width: 100%; margin-top: 18px; padding: 13px 0;
  border: none; border-radius: 12px; cursor: pointer;
  font-size: 14px; font-weight: 700; color: #fff;
  font-family: inherit;
  background: var(--gradient);
  box-shadow: 0 4px 16px rgba(75,90,180,0.3);
  transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
}
.ref-btn:hover:not(:disabled) { transform: translateY(-1px); }
.ref-btn:disabled { background: #2a2d3a; color: var(--text-muted); cursor: not-allowed; box-shadow: none; }

.ref-hint { font-size: 12px; color: var(--text-muted); margin-top: 14px; }

.ref-sub-actions { display: flex; justify-content: space-between; margin-top: 16px; }
.ref-link-btn {
  border: none; background: transparent; cursor: pointer;
  font-size: 13px; font-weight: 600; color: var(--accent-2);
  font-family: inherit; padding: 0;
}
.ref-link-btn:disabled { color: var(--text-muted); cursor: not-allowed; }

.ref-error {
  text-align: left; margin-top: 16px;
  padding: 11px 14px; border-radius: 10px;
  background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.2);
  color: #f87171; font-size: 13px;
}

/* ══════ Dashboard view ══════ */

.ref-dash { position: relative; z-index: 2; }
.ref-dash-inner { max-width: 860px; margin: 0 auto; padding-top: 20px; }

.ref-dash-head { margin-bottom: 24px; }
.ref-dash-head h1 { font-size: 24px; font-weight: 800; letter-spacing: -0.01em; }
.ref-dash-head p { font-size: 13.5px; color: var(--text-dim); margin-top: 6px; }

.ref-code-card {
  background: linear-gradient(135deg, #10231f 0%, #17324f 58%, #1f2937 100%);
  border-radius: var(--radius-lg);
  padding: 24px 28px; margin-bottom: 20px;
  display: flex; align-items: center; justify-content: space-between;
}
.ref-code-label { font-size: 12px; color: #9ca3af; font-weight: 600; margin-bottom: 8px; }
.ref-code-value {
  font-size: 30px; font-weight: 800; color: #f8fafc;
  letter-spacing: 0.15em; font-family: 'JetBrains Mono', monospace;
}
.ref-copy-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 18px; border-radius: 12px; cursor: pointer;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.08); color: #e5e7eb;
  font-size: 13px; font-weight: 600; font-family: inherit;
  transition: all 0.2s;
}
.ref-copy-btn:hover { background: rgba(255,255,255,0.14); }
.ref-copy-btn.copied { background: rgba(16,185,129,0.2); color: #34d399; border-color: rgba(16,185,129,0.3); }

.ref-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px;
}
.ref-stat {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px;
}
.ref-stat-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-dim); font-weight: 600; margin-bottom: 8px;
}
.ref-stat-value { font-size: 20px; font-weight: 800; color: var(--text); }

.ref-tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.ref-tab {
  padding: 8px 18px; border-radius: 10px; border: none; cursor: pointer;
  font-size: 13px; font-weight: 500; font-family: inherit;
  color: var(--text-dim); background: rgba(255,255,255,0.04);
  transition: all 0.2s;
}
.ref-tab.is-active { color: #fff; font-weight: 700; background: var(--gradient); }

.ref-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 22px 24px;
}
.ref-card-title { font-size: 14px; font-weight: 700; margin-bottom: 12px; }

.ref-overview-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.ref-ov-label { font-size: 12px; color: var(--text-dim); font-weight: 600; margin-bottom: 4px; }
.ref-ov-value { font-size: 24px; font-weight: 800; color: var(--text); }
.ref-rules { border-top: 1px solid var(--border); margin-top: 20px; padding-top: 16px; }
.ref-rules strong { font-size: 13px; color: var(--text); }
.ref-rules ul { list-style: none; margin-top: 8px; }
.ref-rules li { font-size: 13px; color: var(--text-dim); line-height: 1.9; padding-left: 14px; position: relative; }
.ref-rules li::before { content: "•"; position: absolute; left: 0; color: var(--accent-1); }

.ref-list { display: flex; flex-direction: column; }
.ref-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0; border-bottom: 1px solid var(--border);
}
.ref-row:last-child { border-bottom: none; }
.ref-row-title { font-size: 14px; font-weight: 600; color: var(--text); }
.ref-row-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.ref-row-amount { font-size: 16px; font-weight: 700; color: var(--accent-3); text-align: right; }
.ref-empty { text-align: center; padding: 40px 0; color: var(--text-muted); font-size: 14px; }

.ref-badge {
  display: inline-block; margin-top: 4px; padding: 2px 8px;
  border-radius: 6px; font-size: 11px; font-weight: 600;
}

.ref-withdraw-open {
  width: 100%; padding: 13px 0; border-radius: 12px;
  border: 1px dashed var(--border-hover); background: rgba(255,255,255,0.02);
  color: var(--accent-2); font-size: 14px; font-weight: 600; cursor: pointer;
  font-family: inherit; transition: all 0.2s;
}
.ref-withdraw-open:hover:not(:disabled) { background: rgba(167,139,250,0.06); }
.ref-withdraw-open:disabled { color: var(--text-muted); cursor: not-allowed; }

.ref-withdraw-form h3 { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.ref-form-actions { display: flex; gap: 10px; margin-top: 18px; }
.ref-form-actions .ref-btn { flex: 1; margin-top: 0; }
.ref-btn-ghost {
  padding: 13px 22px; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--border-hover); background: transparent;
  color: var(--text-dim); font-size: 14px; font-weight: 600; font-family: inherit;
}

.ref-msg { padding: 12px 16px; border-radius: 12px; font-size: 13px; font-weight: 600; margin-bottom: 16px; }
.ref-msg-ok { background: rgba(16,185,129,0.12); color: #34d399; border: 1px solid rgba(16,185,129,0.2); }

.ref-spinner {
  display: inline-block; width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.3); border-top-color: #fff;
  border-radius: 50%; animation: ref-spin 0.7s linear infinite;
  vertical-align: -3px;
}
@keyframes ref-spin { to { transform: rotate(360deg); } }

@media (max-width: 720px) {
  .ref-stats { grid-template-columns: 1fr 1fr; }
  .ref-code-value { font-size: 24px; }
  .ref-code-card { padding: 20px; }
}
