/* Referral + Benefits — premium marketplace pages */

.ref-shell {
  --ref-ink: var(--ink, #0f1421);
  --ref-muted: var(--ink-2, #3b4253);
  --ref-faint: var(--ink-3, #6b7280);
  --ref-line: var(--line, #eceef2);
  --ref-surface: var(--surface, #fff);
  --ref-accent: var(--accent, #2563eb);
  --ref-accent-soft: var(--accent-050, #eef4ff);
  --ref-display: var(--font-display, "Hanken Grotesk", system-ui, sans-serif);
  --ref-body: var(--font-body, "Plus Jakarta Sans", system-ui, sans-serif);
  max-width: 1080px;
  margin: 0 auto;
  padding: 30px 28px 72px;
  font-family: var(--ref-body);
}

.ref-shell > * {
  animation: refRise 0.45s ease both;
}
.ref-shell > *:nth-child(1) { animation-delay: 0.02s; }
.ref-shell > *:nth-child(2) { animation-delay: 0.08s; }
.ref-shell > *:nth-child(3) { animation-delay: 0.14s; }
.ref-shell > *:nth-child(4) { animation-delay: 0.2s; }
.ref-shell > *:nth-child(5) { animation-delay: 0.26s; }

@keyframes refRise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .ref-shell > * { animation: none; }
  .benefit-path,
  .ref-copy-btn,
  .ref-process-item { transition: none; }
}

.ref-kicker {
  display: inline-block;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: var(--ref-accent);
  background: var(--ref-accent-soft);
  border-radius: 999px;
  padding: 6px 12px;
}

/* ----- Hero ----- */
.ref-hero {
  display: grid;
  grid-template-columns: 1.35fr 0.9fr;
  gap: 36px;
  align-items: center;
  padding: 8px 0 40px;
  position: relative;
}

.ref-hero::before {
  content: "";
  position: absolute;
  inset: -24px -12% auto;
  height: 220px;
  background:
    radial-gradient(420px 160px at 12% 40%, color-mix(in srgb, var(--ref-accent) 14%, transparent), transparent 70%),
    radial-gradient(380px 140px at 88% 20%, color-mix(in srgb, #0ea5e9 10%, transparent), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.ref-hero-copy,
.ref-hero-panel {
  position: relative;
  z-index: 1;
}

.ref-hero-solo {
  grid-template-columns: 1fr;
  max-width: 720px;
  padding-bottom: 28px;
}

.ref-hero-title {
  font-family: var(--ref-display);
  font-size: clamp(1.85rem, 3.6vw, 2.45rem);
  line-height: 1.18;
  font-weight: 800;
  color: var(--ref-ink);
  letter-spacing: -0.03em;
  margin: 16px 0 14px;
}

.ref-hero-lead {
  font-size: 16px;
  line-height: 1.6;
  color: var(--ref-muted);
  margin: 0;
  max-width: 540px;
}

.ref-hero-panel {
  border: 1px solid var(--ref-line);
  border-radius: var(--radius, 16px);
  background:
    linear-gradient(165deg, color-mix(in srgb, var(--ref-accent) 7%, #fff) 0%, #fff 55%),
    var(--ref-surface);
  padding: 22px;
  box-shadow: var(--shadow-md, 0 4px 14px rgba(16, 20, 33, 0.06));
}

.ref-rate-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.ref-rate {
  padding: 14px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid color-mix(in srgb, var(--ref-line) 80%, transparent);
  text-align: center;
}

.ref-rate-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--ref-faint);
  letter-spacing: 0.02em;
}

.ref-rate-num {
  display: block;
  margin-top: 6px;
  font-family: var(--ref-display);
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--ref-accent);
  line-height: 1;
}

.ref-rate-example {
  margin: 14px 0 0;
  font-size: 13px;
  color: var(--ref-faint);
  text-align: center;
  line-height: 1.45;
}

/* ----- Process ----- */
.ref-process {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin: 0 0 36px;
  border-top: 1px solid var(--ref-line);
  border-bottom: 1px solid var(--ref-line);
}

.ref-process-item {
  padding: 22px 20px 24px;
  position: relative;
}

.ref-process-item + .ref-process-item {
  border-left: 1px solid var(--ref-line);
}

.ref-process-n {
  display: block;
  font-family: var(--ref-display);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--ref-accent);
  margin-bottom: 12px;
}

.ref-process-item h3 {
  font-family: var(--ref-display);
  font-size: 17px;
  font-weight: 800;
  color: var(--ref-ink);
  margin: 0 0 6px;
  letter-spacing: -0.02em;
}

.ref-process-item p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--ref-muted);
}

/* ----- Form / dashboard panel ----- */
.ref-panel {
  border: 1px solid var(--ref-line);
  border-radius: var(--radius, 16px);
  background: var(--ref-surface);
  padding: 28px;
  margin-bottom: 40px;
  box-shadow: var(--shadow-sm, 0 1px 3px rgba(16, 20, 33, 0.06));
}

.ref-create-head {
  margin-bottom: 20px;
}

.ref-create-head h2 {
  font-family: var(--ref-display);
  font-size: 20px;
  font-weight: 800;
  color: var(--ref-ink);
  margin: 0 0 6px;
  letter-spacing: -0.02em;
}

.ref-create-head p {
  margin: 0;
  font-size: 14px;
  color: var(--ref-faint);
}

.ref-create-form label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--ref-muted);
  margin-bottom: 8px;
}

.ref-create-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.ref-create-form input[type="text"] {
  flex: 1;
  min-width: 0;
  height: 48px;
  padding: 0 16px;
  border: 1px solid var(--line-2, #e2e5ea);
  border-radius: 12px;
  font-size: 15px;
  font-family: inherit;
  color: var(--ref-ink);
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.ref-create-form input[type="text"]:focus {
  outline: none;
  border-color: var(--ref-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ref-accent) 18%, transparent);
}

.ref-submit {
  flex-shrink: 0;
  white-space: nowrap;
}

.ref-error {
  color: #dc2626;
  font-size: 13px;
  margin: 10px 0 0;
}

.ref-hint {
  margin: 14px 0 0;
  font-size: 12.5px;
  color: var(--ref-faint);
  line-height: 1.5;
}

.ref-profile {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

.ref-avatar {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  object-fit: cover;
  background: var(--ref-line);
  flex-shrink: 0;
}

.ref-avatar-fallback {
  display: grid;
  place-items: center;
  font-family: var(--ref-display);
  font-size: 22px;
  font-weight: 800;
  color: var(--ref-accent);
  background: var(--ref-accent-soft);
}

.ref-username {
  display: block;
  font-family: var(--ref-display);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ref-ink);
}

.ref-profile-sub {
  margin: 4px 0 0;
  font-size: 13.5px;
  color: var(--ref-faint);
}

.ref-stats-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 22px;
}

.ref-stat {
  padding: 14px 12px;
  border-radius: 12px;
  background: linear-gradient(180deg, #f8f9fb, #f3f5f8);
  text-align: center;
  border: 1px solid transparent;
}

.ref-stat span {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ref-faint);
}

.ref-stat strong {
  display: block;
  margin-top: 6px;
  font-family: var(--ref-display);
  font-size: 17px;
  font-weight: 800;
  color: var(--ref-ink);
  letter-spacing: -0.02em;
}

.ref-links {
  display: grid;
  gap: 14px;
}

.ref-link-block label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--ref-faint);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}

.ref-link-row {
  display: flex;
  gap: 8px;
}

.ref-link-row input {
  flex: 1;
  min-width: 0;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line-2, #e2e5ea);
  border-radius: 11px;
  font-size: 13px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--ref-muted);
  background: #f8f9fb;
}

.ref-copy-btn {
  flex-shrink: 0;
  height: 44px;
  padding: 0 16px;
  border: none;
  border-radius: 11px;
  background: var(--ref-accent);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
}

.ref-copy-btn:hover {
  background: var(--accent-600, #1d4ed8);
  transform: translateY(-1px);
}

.ref-copy-btn.is-copied {
  background: #059669;
}

.ref-recent {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--ref-line);
}

.ref-recent h3 {
  font-family: var(--ref-display);
  font-size: 14px;
  font-weight: 800;
  margin: 0 0 10px;
  color: var(--ref-ink);
}

.ref-recent ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ref-recent li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--ref-line);
  font-size: 13.5px;
}

.ref-recent li:last-child {
  border-bottom: none;
}

.ref-recent-buyer {
  font-weight: 700;
  color: var(--ref-ink);
}

.ref-recent-meta {
  color: var(--ref-faint);
  text-align: right;
}

.ref-reset {
  margin-top: 18px;
}

.ref-reset-btn {
  width: 100%;
  justify-content: center;
}

/* ----- Board ----- */
.ref-board-head {
  margin-bottom: 18px;
}

.ref-board-head h2 {
  font-family: var(--ref-display);
  font-size: 22px;
  font-weight: 800;
  color: var(--ref-ink);
  letter-spacing: -0.02em;
  margin: 0 0 6px;
}

.ref-board-head p {
  margin: 0;
  font-size: 14px;
  color: var(--ref-faint);
}

.ref-board-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.ref-board-stat {
  padding: 18px 16px;
  border-radius: 14px;
  border: 1px solid var(--ref-line);
  text-align: center;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--ref-accent) 4%, #fff), #fff);
}

.ref-board-stat strong {
  display: block;
  font-family: var(--ref-display);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--ref-accent);
  line-height: 1;
}

.ref-board-stat span {
  display: block;
  margin-top: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ref-faint);
}

.ref-board-cols {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.ref-board-col h3 {
  font-family: var(--ref-display);
  font-size: 14px;
  font-weight: 800;
  margin: 0 0 10px;
  color: var(--ref-ink);
}

.ref-board-col ul {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 300px;
  overflow: auto;
  border: 1px solid var(--ref-line);
  border-radius: 12px;
  background: var(--ref-surface);
}

.ref-board-col li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--ref-line);
  font-size: 13px;
  color: var(--ref-muted);
}

.ref-board-col li span:first-child {
  font-weight: 700;
  color: var(--ref-ink);
}

.ref-board-col li:last-child {
  border-bottom: none;
}

.ref-board-empty {
  color: var(--ref-faint);
  justify-content: center !important;
  font-weight: 500 !important;
}

.ref-board-compact {
  margin-top: 8px;
}

.ref-board-compact .ref-board-stats {
  margin-bottom: 0;
}

.ref-foot {
  margin-top: 28px;
  font-size: 13px;
  color: var(--ref-faint);
  text-align: center;
  line-height: 1.5;
}

.ref-foot a {
  color: var(--ref-accent);
  font-weight: 700;
  text-decoration: none;
}

.ref-foot a:hover {
  text-decoration: underline;
}

/* ----- Shop banner ----- */
.shop-ref-banner {
  margin: 0 0 16px;
  padding: 12px 16px;
  border-radius: 12px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--ref-accent) 12%, transparent), color-mix(in srgb, var(--ref-accent) 4%, transparent));
  border: 1px solid color-mix(in srgb, var(--ref-accent) 22%, transparent);
  font-size: 14px;
  line-height: 1.45;
}

.shop-ref-banner strong {
  color: var(--ref-accent);
}

/* ----- Benefits ----- */
.benefits-paths {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 8px 0 40px;
}

.benefit-path {
  display: flex;
  flex-direction: column;
  min-height: 220px;
  padding: 26px 24px;
  border-radius: var(--radius, 16px);
  border: 1px solid var(--ref-line);
  background: var(--ref-surface);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.18s, transform 0.18s, box-shadow 0.18s;
  box-shadow: var(--shadow-sm, 0 1px 3px rgba(16, 20, 33, 0.05));
}

.benefit-path:hover {
  border-color: color-mix(in srgb, var(--ref-accent) 45%, var(--ref-line));
  transform: translateY(-3px);
  box-shadow: var(--shadow-md, 0 8px 24px rgba(16, 20, 33, 0.08));
}

.benefit-path-accent {
  background:
    linear-gradient(160deg, color-mix(in srgb, var(--ref-accent) 9%, #fff) 0%, #fff 48%);
  border-color: color-mix(in srgb, var(--ref-accent) 28%, var(--ref-line));
}

.benefit-path-tag {
  display: inline-block;
  align-self: flex-start;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ref-accent);
  margin-bottom: 14px;
}

.benefit-path h2 {
  font-family: var(--ref-display);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ref-ink);
  margin: 0 0 10px;
  line-height: 1.25;
}

.benefit-path p {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ref-muted);
  flex: 1;
}

.benefit-path-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 20px;
  font-size: 13.5px;
  font-weight: 800;
  color: var(--ref-accent);
}

.benefits-rules {
  margin-bottom: 36px;
  padding: 32px 0 8px;
  border-top: 1px solid var(--ref-line);
}

.benefits-rules-head {
  text-align: center;
  max-width: 520px;
  margin: 0 auto 28px;
}

.benefits-rules-head h2 {
  font-family: var(--ref-display);
  font-size: clamp(1.35rem, 2.8vw, 1.7rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ref-ink);
  margin: 14px 0 8px;
}

.benefits-rules-head p {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ref-faint);
}

.benefits-rules-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.benefits-rules-grid li {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding: 20px 18px;
  border: 1px solid var(--ref-line);
  border-radius: 14px;
  background:
    linear-gradient(165deg, color-mix(in srgb, var(--ref-accent) 5%, #fff) 0%, #fff 42%);
}

.benefits-rule-n {
  display: block;
  font-family: var(--ref-display);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: var(--ref-accent);
  margin-bottom: 14px;
}

.benefits-rules-grid strong {
  display: block;
  font-family: var(--ref-display);
  font-size: 15.5px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ref-ink);
  margin-bottom: 8px;
  line-height: 1.3;
}

.benefits-rules-grid p {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--ref-muted);
  flex: 1;
}

.benefits-rules-grid code {
  font-size: 11.5px;
  padding: 1px 5px;
  border-radius: 5px;
  background: #f1f4f8;
  color: var(--ref-ink);
  border: 1px solid var(--ref-line);
  word-break: break-all;
}

.cart-checkout-referral {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0 0;
  font-size: 14px;
  color: var(--ref-muted);
}

.cart-checkout-referral strong {
  color: #059669;
}

@media (max-width: 980px) {
  .benefits-rules-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
}

@media (max-width: 860px) {
  .ref-hero {
    grid-template-columns: 1fr;
    gap: 22px;
    padding-bottom: 28px;
  }

  .ref-hero-panel {
    max-width: 420px;
  }
}

@media (max-width: 720px) {
  .ref-shell {
    padding: 22px 16px 56px;
  }

  .ref-hero-title {
    font-size: 1.7rem;
  }

  .ref-hero-lead {
    font-size: 15px;
  }

  .ref-process,
  .ref-board-cols,
  .benefits-paths {
    grid-template-columns: 1fr;
  }

  .ref-process-item + .ref-process-item {
    border-left: none;
    border-top: 1px solid var(--ref-line);
  }

  .ref-stats-row {
    grid-template-columns: 1fr;
  }

  .ref-create-row {
    flex-direction: column;
  }

  .ref-submit {
    width: 100%;
    justify-content: center;
  }

  .ref-panel {
    padding: 20px;
  }

  .benefit-path {
    min-height: 0;
  }

  .benefits-rules {
    padding-top: 24px;
  }

  .benefits-rules-head {
    margin-bottom: 18px;
    text-align: left;
  }

  .benefits-rules-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .benefits-rules-grid li {
    padding: 16px 14px;
  }

  .benefits-rules-grid strong {
    font-size: 14px;
  }

  .benefits-rules-grid p {
    font-size: 12.5px;
  }
}

@media (max-width: 480px) {
  .benefits-rules-grid {
    grid-template-columns: 1fr;
  }

  .benefits-rules-grid li {
    display: grid;
    grid-template-columns: 36px 1fr;
    grid-template-rows: auto auto;
    column-gap: 10px;
    row-gap: 4px;
    align-items: start;
    padding: 14px 14px;
  }

  .benefits-rule-n {
    grid-row: 1 / span 2;
    margin: 2px 0 0;
    font-size: 11px;
  }

  .benefits-rules-grid strong {
    margin-bottom: 0;
  }

  .benefits-rules-grid p {
    grid-column: 2;
  }
}
