.sp-referral-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: var(--sp-badge-height);
  padding: 0.32rem var(--sp-badge-padding-x);
  border-radius: var(--sp-badge-radius);
  border: 1px solid rgba(255, 122, 26, 0.28);
  background: linear-gradient(135deg, rgba(115, 48, 16, 0.52) 0%, rgba(255, 122, 26, 0.16) 100%);
  color: #ffe8d4;
  font-size: var(--sp-badge-font-size);
  font-weight: 600;
  cursor: pointer;
  transition: transform var(--sp-quick-transition), box-shadow var(--sp-standard-transition), border-color var(--sp-quick-transition);
}

.sp-referral-pill:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22);
  border-color: rgba(255, 163, 102, 0.45);
}

.sp-referral-pill-icon {
  font-size: 0.95rem;
}

.sp-sidebar-link.sp-referral-link-active,
.sp-referral-pill.is-active {
  border-color: rgba(255, 122, 26, 0.42);
  box-shadow: 0 0 0 1px rgba(255, 122, 26, 0.16), 0 10px 30px rgba(255, 122, 26, 0.14);
}

#modal-referrals {
  width: min(96vw, 1180px);
  max-width: 1180px;
  max-height: min(90vh, 920px);
}

.sp-referral-modal-body {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 1.3rem;
  align-items: start;
}

.sp-referral-section {
  display: grid;
  gap: 0.9rem;
  padding: 1.35rem;
  border-radius: 24px;
  background:
    radial-gradient(circle at top left, rgba(255, 122, 26, 0.08), transparent 34%),
    linear-gradient(180deg, rgba(18, 19, 28, 0.96) 0%, rgba(10, 11, 18, 0.96) 100%);
  border: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.16);
}

.sp-referral-link-section {
  grid-column: span 7;
}

.sp-referral-email-section {
  grid-column: span 5;
}

.sp-referral-stats-section,
.sp-referral-rewards-section {
  grid-column: span 6;
}

.sp-referral-section-heading h3 {
  margin: 0;
  font-size: 1.45rem;
  line-height: 1.15;
  color: #fff8f1;
}

.sp-referral-section-heading {
  display: grid;
  gap: 0.35rem;
}

.sp-referral-section .sp-form-footnote {
  margin: 0;
  color: var(--sp-text-muted);
  line-height: 1.65;
}

.sp-referral-link-shell,
.sp-referral-email-form {
  display: grid;
  gap: 0.9rem;
}

.sp-referral-link-shell {
  padding: 1rem;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(10, 8, 12, 0.88), rgba(14, 12, 18, 0.84));
  border: 1px solid rgba(255, 168, 104, 0.16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.sp-referral-link-input {
  width: 100%;
  min-height: 54px;
  padding: 0.95rem 1.05rem;
  border-radius: 18px;
  border: 1px solid rgba(255, 239, 225, 0.14);
  background: linear-gradient(180deg, rgba(8, 10, 16, 0.98), rgba(12, 13, 20, 0.98));
  color: var(--sp-text);
  font-size: 0.95rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.sp-referral-link-actions,
.sp-referral-email-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: flex-end;
}

.sp-referral-email-form {
  margin-top: 0.15rem;
}

.sp-referral-email-form .sp-form-field,
.sp-referral-link-shell .sp-form-field {
  margin-bottom: 0;
}

.sp-referral-email-form input {
  min-height: 54px;
  border-radius: 18px;
}

.sp-referral-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.9rem;
}

.sp-referral-stat-card {
  display: grid;
  gap: 0.45rem;
  padding: 1.05rem 1rem;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(20, 21, 31, 0.98) 0%, rgba(12, 13, 21, 0.96) 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.sp-referral-stat-card--highlight {
  border-color: rgba(255, 122, 26, 0.32);
  background:
    radial-gradient(circle at top right, rgba(255, 122, 26, 0.12), transparent 38%),
    linear-gradient(180deg, rgba(26, 18, 17, 0.98) 0%, rgba(16, 13, 17, 0.96) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 20px 38px rgba(255, 122, 26, 0.1);
}

.sp-referral-stat-label {
  color: var(--sp-text-muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.sp-referral-stat-value {
  color: #fff7ef;
  font-size: clamp(1.55rem, 2vw, 2rem);
  line-height: 1;
}

.sp-referral-rewards-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.sp-referral-reward-item {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-height: 100%;
  padding: 1.1rem 1.1rem;
  border-radius: 22px;
  background:
    radial-gradient(circle at top left, rgba(255, 122, 26, 0.1), transparent 40%),
    linear-gradient(135deg, rgba(42, 18, 11, 0.92) 0%, rgba(16, 17, 25, 0.98) 100%);
  border: 1px solid rgba(255, 140, 68, 0.2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.sp-referral-reward-item strong {
  color: #ffbe87;
  font-size: 1.08rem;
}

.sp-referral-reward-item span {
  color: var(--sp-text-soft);
  line-height: 1.6;
}

.sp-referral-email-section::before,
.sp-referral-link-section::before {
  content: "";
  display: block;
  width: 56px;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 122, 26, 0.95), rgba(255, 196, 140, 0.7));
  box-shadow: 0 0 20px rgba(255, 122, 26, 0.22);
}

@media (max-width: 1100px) {
  .sp-referral-link-section,
  .sp-referral-email-section,
  .sp-referral-stats-section,
  .sp-referral-rewards-section {
    grid-column: span 12;
  }

  .sp-referral-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 780px) {
  #modal-referrals {
    width: min(96vw, 720px);
  }

  .sp-referral-modal-body {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .sp-referral-section {
    padding: 1.1rem;
    border-radius: 20px;
  }

  .sp-referral-rewards-list,
  .sp-referral-stats-grid {
    grid-template-columns: 1fr;
  }

  .sp-referral-link-actions,
  .sp-referral-email-actions {
    justify-content: stretch;
  }

  .sp-referral-link-actions .sp-btn,
  .sp-referral-email-actions .sp-btn {
    width: 100%;
  }

  .sp-referral-section-heading h3 {
    font-size: 1.25rem;
  }
}