:root {
  --referral-ink: #10231f;
  --referral-muted: #667680;
  --referral-green: #0f7a61;
  --referral-green-soft: #e8f7f0;
  --referral-line: rgba(16, 35, 31, 0.1);
  --referral-bg: #f6faf8;
}

body.referral-body {
  background: var(--referral-bg);
  color: var(--referral-ink);
  font-family: Roboto, Arial, sans-serif;
}

.referral-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

.referral-topbar {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 22px;
}

.referral-brand {
  align-items: center;
  display: flex;
  gap: 12px;
  min-width: 0;
}

.referral-brand-mark {
  align-items: center;
  background: linear-gradient(135deg, #09221f, #0f7a61);
  border-radius: 12px;
  color: #fff;
  display: inline-flex;
  height: 44px;
  justify-content: center;
  width: 44px;
}

.referral-card {
  background: #fff;
  border: 1px solid var(--referral-line);
  border-radius: 8px;
  box-shadow: 0 18px 55px rgba(16, 35, 31, 0.08);
}

.referral-hero {
  background: linear-gradient(135deg, #09221f 0%, #0f5c50 54%, #21a66e 100%);
  border-radius: 8px;
  color: #fff;
  overflow: hidden;
  padding: 28px;
  position: relative;
}

.referral-hero::after {
  background: rgba(255, 255, 255, 0.12);
  content: "";
  height: 220px;
  position: absolute;
  right: -80px;
  top: -90px;
  transform: rotate(28deg);
  width: 180px;
}

.referral-hero-content {
  max-width: 760px;
  position: relative;
  z-index: 1;
}

.referral-hero-content-wide {
  max-width: none;
}

.referral-hero-dashboard {
  align-items: center;
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1fr) max-content;
}

.referral-hero-dashboard-copy {
  max-width: 760px;
}

.referral-label {
  color: #8bd8b3;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.referral-muted {
  color: var(--referral-muted) !important;
}

.referral-hero .referral-muted {
  color: #f0fff8 !important;
}

.referral-hero-steps {
  counter-reset: referral-step;
  display: grid;
  gap: 10px;
  justify-items: end;
  list-style: none;
  margin: 0;
  padding: 0;
  text-align: right;
}

.referral-hero-content:not(.referral-hero-dashboard) .referral-hero-steps {
  margin-top: 26px;
}

.referral-hero-steps li {
  align-items: center;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  color: #fff;
  counter-increment: referral-step;
  display: inline-flex;
  font-weight: 700;
  gap: 10px;
  justify-content: flex-end;
  min-height: 42px;
  padding: 8px 12px;
}

.referral-hero-steps li::before {
  align-items: center;
  background: #f0fff8;
  border-radius: 999px;
  color: #0f5c50;
  content: counter(referral-step);
  display: inline-flex;
  flex: 0 0 26px;
  font-size: 13px;
  font-weight: 800;
  height: 26px;
  justify-content: center;
  width: 26px;
}

.referral-hero-steps-left {
  justify-items: start;
  text-align: left;
}

.referral-hero-steps-left li {
  justify-content: flex-start;
}

.referral-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(12, 1fr);
}

.referral-col-4 {
  grid-column: span 4;
}

.referral-col-5 {
  grid-column: span 5;
}

.referral-col-7 {
  grid-column: span 7;
}

.referral-col-8 {
  grid-column: span 8;
}

.referral-col-12 {
  grid-column: span 12;
}

.referral-panel {
  padding: 20px;
}

.referral-stat {
  align-items: center;
  display: flex;
  gap: 12px;
}

.referral-stat-icon {
  align-items: center;
  background: var(--referral-green-soft);
  border-radius: 12px;
  color: var(--referral-green);
  display: inline-flex;
  height: 44px;
  justify-content: center;
  width: 44px;
}

.referral-btn {
  align-items: center;
  border: 0;
  border-radius: 8px;
  display: inline-flex;
  font-weight: 700;
  gap: 8px;
  justify-content: center;
  min-height: 42px;
  padding: 10px 16px;
  text-decoration: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.referral-btn:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

.referral-btn-primary {
  background: var(--referral-green);
  color: #fff;
}

.referral-btn-ghost {
  background: var(--referral-green-soft);
  color: var(--referral-green);
}

.referral-input,
.referral-select {
  background-color: #fff;
  border: 1px solid var(--referral-line);
  border-radius: 8px;
  font: inherit;
  line-height: 20px;
  min-height: 42px;
  padding: 10px 12px;
  width: 100%;
}

.referral-select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--referral-green) 50%), linear-gradient(135deg, var(--referral-green) 50%, transparent 50%);
  background-position: calc(100% - 18px) 18px, calc(100% - 12px) 18px;
  background-repeat: no-repeat;
  background-size: 6px 6px, 6px 6px;
  height: 42px;
  padding-right: 34px;
  -webkit-appearance: none;
}

.referral-input:focus,
.referral-select:focus {
  border-color: var(--referral-green);
  box-shadow: 0 0 0 4px rgba(15, 122, 97, 0.12);
  outline: none;
}

.referral-table {
  margin: 0;
  width: 100%;
}

.referral-table-actions {
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 8px;
  justify-content: flex-end;
  white-space: nowrap;
}

.referral-table-actions .referral-btn {
  min-height: 38px;
  padding: 8px 10px;
}

.referral-table th {
  color: var(--referral-muted);
  font-size: 12px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.referral-code-url {
  background: #f8fbfa;
  border: 1px solid var(--referral-line);
  border-radius: 8px;
  color: var(--referral-ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  overflow-wrap: anywhere;
  padding: 9px 10px;
}

.referral-usage-line {
  white-space: nowrap;
}

.min-w-0 {
  min-width: 0;
}

.referral-badge {
  align-items: center;
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 700;
  gap: 5px;
  padding: 5px 9px;
}

.referral-badge-nowrap {
  white-space: nowrap;
}

.referral-badge svg,
.referral-badge i {
  align-self: center;
  display: inline-flex;
  flex: 0 0 auto;
  height: 1em;
  line-height: 1;
}

.referral-badge-success {
  background: #e6f7ee;
  color: #0d6d45;
}

.referral-badge-warning {
  background: #fff7e7;
  color: #946200;
}

.referral-badge-muted {
  background: #edf1f3;
  color: #61717c;
}

.referral-alert {
  border-radius: 8px;
  display: none;
  margin-top: 12px;
  padding: 12px 14px;
}

.referral-alert.is-visible {
  animation: referral-slide 0.22s ease;
  display: block;
}

.referral-alert-success {
  background: #e6f7ee;
  color: #0d6d45;
}

.referral-alert-error {
  background: #fff0f0;
  color: #9a2626;
}

.referral-impersonation-toast {
  background: #fff4e5;
  border: 1px solid rgba(199, 111, 0, 0.22);
  border-radius: 8px;
  box-shadow: 0 14px 30px rgba(24, 48, 45, 0.12);
  color: #6d3d00;
  cursor: pointer;
  margin-bottom: 18px;
  padding: 14px 16px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.referral-impersonation-toast:hover,
.referral-impersonation-toast:focus {
  box-shadow: 0 18px 36px rgba(24, 48, 45, 0.16);
  outline: 0;
  transform: translateY(-1px);
}

.referral-impersonation-icon {
  align-items: center;
  background: #ffe1b3;
  border-radius: 999px;
  display: inline-flex;
  flex: 0 0 auto;
  height: 38px;
  justify-content: center;
  width: 38px;
}

.referral-loading {
  opacity: 0.62;
  pointer-events: none;
  position: relative;
}

.referral-loading::after {
  animation: referral-spin 0.7s linear infinite;
  border: 3px solid rgba(15, 122, 97, 0.2);
  border-top-color: var(--referral-green);
  border-radius: 999px;
  content: "";
  height: 22px;
  position: absolute;
  right: 12px;
  top: 12px;
  width: 22px;
}

.referral-modal {
  border: 0;
  border-radius: 8px;
}

@keyframes referral-slide {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@media (max-width: 900px) {
  .referral-col-4,
  .referral-col-5,
  .referral-col-7,
  .referral-col-8 {
    grid-column: span 12;
  }

  .referral-hero-dashboard {
    align-items: start;
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .referral-topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .referral-hero {
    padding: 22px;
  }

  .referral-hero-steps {
    justify-items: start;
    text-align: left;
  }

  .referral-hero-steps li {
    justify-content: flex-start;
  }
}
