.referral-how-section {
  --referral-how-text: #252a30;
  --referral-how-muted: #555e69;
  --referral-how-line: rgba(74, 88, 104, .16);
  --referral-how-paper: rgba(255, 255, 255, .82);
  padding: 40px 32px;
  color: var(--referral-how-text);
  background: var(--pearl);
}

.referral-how-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: start;
  gap: 48px;
  width: min(1440px, 100%);
  margin-inline: auto;
}

.referral-how-heading .eyebrow {
  margin: 0 0 18px;
  color: var(--referral-how-muted);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.referral-how-heading h2 {
  max-width: 20ch;
  margin: 0;
  color: var(--referral-how-text);
  font-size: clamp(30px, 3.1vw, 42px);
  font-weight: 600;
  line-height: 1.09;
  letter-spacing: -.045em;
}

.referral-how-heading .lead {
  max-width: 40ch;
  margin: 20px 0 0;
  color: var(--referral-how-muted);
  font-size: 16px;
  line-height: 1.6;
}

.referral-how-steps {
  display: block;
  margin: 0;
  padding: 28px 32px;
  border: 1px solid var(--referral-how-line);
  border-radius: var(--radius-lg);
  background: var(--referral-how-paper);
  list-style: none;
}

.referral-how-steps li {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  padding: 22px 0;
  border-bottom: 1px solid var(--referral-how-line);
}

.referral-how-steps li:first-child { padding-top: 0; }
.referral-how-steps li:last-child { padding-bottom: 0; border-bottom: 0; }

.referral-how-steps strong {
  display: block;
  margin: 0 0 9px;
  color: var(--referral-how-text);
  font-size: 21px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -.025em;
}

.referral-how-steps p {
  margin: 0;
  color: var(--referral-how-muted);
  font-size: 15px;
  line-height: 1.6;
}

html[data-upload120-theme="dark"] .referral-how-section {
  --referral-how-text: #f1f3f7;
  --referral-how-muted: #b0b6c2;
  --referral-how-line: #2a2d35;
  --referral-how-paper: #1a1c22;
  background: #111216;
}

@media (max-width: 850px) {
  .referral-how-section { padding-inline: 24px; }
  .referral-how-layout { grid-template-columns: 1fr; gap: 32px; }
  .referral-how-steps { margin-top: 8px; }
}

@media (max-width: 520px) {
  .referral-how-section { padding: 24px 16px; }
  .referral-how-layout { gap: 24px; }
  .referral-how-steps { padding: 24px 20px; }
}

.referral-rules-section {
  --referral-how-text: #252a30;
  --referral-how-muted: #555e69;
  --referral-how-line: rgba(74, 88, 104, .16);
  --referral-how-paper: rgba(255, 255, 255, .82);
  padding: 56px 32px 72px;
  color: var(--referral-how-text);
  background: var(--pearl);
}

.referral-rules-wrap {
  width: min(1140px, 100%);
  margin-inline: auto;
}

.referral-rules-intro {
  margin-bottom: 24px;
}

.referral-rules-intro .eyebrow {
  margin: 0 0 10px;
  color: var(--referral-how-muted);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.referral-rules-intro h2 {
  margin: 0;
  color: var(--referral-how-text);
  font-size: clamp(30px, 3.1vw, 40px);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -.04em;
}

.referral-criteria-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  align-items: stretch;
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--referral-how-line);
  border-radius: 22px;
  background: var(--referral-how-paper);
  box-shadow: 0 12px 30px rgba(32, 43, 54, .045);
}

.referral-rules-card {
  min-width: 0;
  padding: 30px 32px 26px;
}

.referral-rules-counts {
  border-right: 1px solid var(--referral-how-line);
  background: #edf5fb;
}

.referral-rules-card h3 {
  margin: 0 0 8px;
  color: var(--referral-how-text);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -.025em;
}

.referral-rule-list {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.referral-rule-list li {
  padding: 14px 0;
  border-top: 1px solid var(--referral-how-line);
  color: var(--referral-how-muted);
  font-size: 15px;
  line-height: 1.55;
}

.referral-counts-list li {
  padding-block: 18px;
}

.referral-rules-exclusions .referral-rule-list li {
  padding-block: 17px;
}

html[data-upload120-theme="dark"] .referral-rules-section {
  --referral-how-text: #f1f3f7;
  --referral-how-muted: #b0b6c2;
  --referral-how-line: #2a2d35;
  --referral-how-paper: #1a1c22;
  background: #111216;
}

html[data-upload120-theme="dark"] .referral-rules-counts {
  background: transparent;
}

html[data-upload120-theme="dark"] .referral-criteria-grid {
  box-shadow: none;
}

@media (max-width: 850px) {
  .referral-rules-section { padding-inline: 24px; }
  .referral-criteria-grid { grid-template-columns: 1fr; }
  .referral-rules-counts { border-right: 0; border-bottom: 1px solid var(--referral-how-line); }
  .referral-rules-card { padding: 28px 30px 22px; }
}

@media (max-width: 520px) {
  .referral-rules-section { padding: 24px 16px 40px; }
  .referral-rules-card { padding: 24px 20px 18px; }
  .referral-criteria-grid { border-radius: 20px; }
}

/* Phone layout (Oct 2026): stats stay 3 per row as on desktop, sections use
   the shared phone spacing, and the hero actions are full width. */
@media (max-width: 760px) {
  .referrals-page .referral-info-hero,
  .referrals-page .referrals-tile { padding-block: 32px !important; }
  .referrals-page .referral-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .referrals-page .referral-stats > div { padding: 10px; }
  .referrals-page .referral-stats span { font-size: 12px; overflow-wrap: break-word; hyphens: auto; }
  .referrals-page .referral-stats strong { font-size: 22px; }
  .referrals-page .referral-limit-card { grid-column: 1 / -1; width: 100%; }
  .referrals-page .referral-info-hero .hero-actions { display: grid; grid-template-columns: 1fr; gap: 10px; }
  .referrals-page .referral-info-hero .hero-actions > a { width: 100%; justify-content: center; }
  .referrals-page .referral-actions .small { min-height: 44px; }
}

/* Fewer cards (Oct 2026, both themes): "What you get", the steps and the rules
   read straight on the page with one rule above them. */
.referrals-page :is(.referral-info-card.glass-surface, .referral-how-steps, .referral-criteria-grid) {
  padding-inline: 0;
  border: 0;
  border-top: 1px solid var(--referral-how-line, var(--hairline));
  border-radius: 0;
  background: none;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.referrals-page .referral-info-card.glass-surface::before,
.referrals-page .referral-info-card.glass-surface::after { content: none; }
.referrals-page .referral-criteria-grid { overflow: visible; }
.referrals-page .referral-info-card .referral-rules-grid { gap: 0; }
.referrals-page .referral-info-card .referral-rules-grid > div { padding: 14px 0; border: 0; border-top: 1px solid var(--hairline); border-radius: 0; background: none; }
.referrals-page .referral-info-card .referral-rules-grid > div:first-child { border-top: 0; }
html[data-upload120-theme="dark"] .referrals-page .referral-info-card .referral-rules-grid > div { border-top-color: #2a2d35; background: none; }
html[data-upload120-theme="dark"] .referrals-page .referral-info-card .referral-rules-grid > div:first-child { border-top: 0; }
.referrals-page .referral-rules-counts { padding-left: 0; background: transparent; }
html[data-upload120-theme="dark"] .referrals-page :is(.referral-info-card.glass-surface, .referral-how-steps, .referral-criteria-grid) { border-top-color: #2a2d35; background: none; box-shadow: none; }

/* Plain labels (Oct 2026, both themes): 14px lines, no small caps. */
.referrals-page :is(.referral-rules-grid > div > span, .referral-stats span, .referral-progress-top > span, .referral-limit-card > span) { font-size: 14px; font-weight: 500; letter-spacing: normal; line-height: 1.4; text-transform: none; }
@media (max-width: 760px) {
  .referrals-page .referral-stats span { font-size: 14px; }
}
.referrals-page .referral-criteria-grid > .referral-rules-card { border: 0; border-radius: 0; background: none; box-shadow: none; }
.referrals-page .referral-criteria-grid > .referral-rules-counts { border-right: 1px solid var(--referral-how-line, var(--hairline)); }
html[data-upload120-theme="dark"] body.referrals-page .referral-criteria-grid > .referral-rules-card { border: 0; background: none; box-shadow: none; }
html[data-upload120-theme="dark"] body.referrals-page .referral-criteria-grid > .referral-rules-counts { border-right: 1px solid #2a2d35; }
@media (max-width: 850px) {
  .referrals-page .referral-criteria-grid > .referral-rules-counts { border-right: 0; border-bottom: 1px solid var(--referral-how-line, var(--hairline)); }
  html[data-upload120-theme="dark"] body.referrals-page .referral-criteria-grid > .referral-rules-counts { border-right: 0; border-bottom: 1px solid #2a2d35; }
  .referrals-page .referral-criteria-grid > .referral-rules-exclusions { padding-left: 0; }
}
