/* referrals.html: the application form, sign-in and the referrer dashboard. Uses the tokens in style.css. */

.ref-page .doc-head h1 span {
  white-space: nowrap;
}

.ref-head-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px !important;
}

.ref-signed-in .ref-head-cta {
  display: none;
}

.ref-layout {
  display: grid;
  grid-template-columns: minmax(0, 44rem) minmax(0, 400px);
  justify-content: space-between;
  gap: clamp(40px, 6vw, 88px);
  align-items: start;
}

.ref-signed-in .ref-panel {
  display: none;
}

.ref-signed-in .ref-layout {
  grid-template-columns: minmax(0, 44rem);
}

/* ───────── explanation ───────── */

.ref-steps {
  counter-reset: step;
  list-style: none;
  padding-left: 0 !important;
  gap: 14px !important;
}

.ref-steps li {
  position: relative;
  padding-left: 44px;
  counter-increment: step;
}

.ref-steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: -1px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--fill);
  box-shadow: inset 0 0 0 1px var(--line-strong);
  color: var(--text);
  font: 650 0.875rem/1 var(--font-round);
}

.ref-example th[scope="row"] {
  color: var(--text);
  font-weight: 500;
}

.ref-example .num,
.ref-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ref-example td[data-earn] {
  color: var(--text);
  font-weight: 650;
}

.ref-was {
  margin-left: 4px;
  color: var(--text-3);
  font-weight: 400;
  text-decoration: line-through;
}

/* ───────── the panel (apply, sign in) ───────── */

.ref-panel {
  position: sticky;
  top: calc(var(--nav-h) + 28px);
  padding: clamp(20px, 3vw, 28px);
  border-radius: 24px;
  border: 1px solid var(--line);
  background: var(--surface);
}

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

.ref-form h2,
.ref-done h2 {
  font-size: 1.5rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.ref-form h3,
.ref-dashboard h3 {
  font-size: 1.0625rem;
  font-weight: 650;
}

.ref-field {
  display: grid;
  gap: 6px;
}

.ref-label {
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 600;
}

.ref-optional {
  color: var(--text-3);
  font-weight: 400;
}

.ref-hint {
  margin-top: -6px;
  color: var(--text-3);
  font-size: 0.8125rem;
  line-height: 1.45;
}

.ref-form input[type="text"],
.ref-form input[type="email"],
.ref-form textarea,
.ref-copy-row input {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border: 0;
  border-radius: 12px;
  background: var(--bg);
  box-shadow: inset 0 0 0 1px var(--line-strong);
  color: var(--text);
  font: 400 1rem/1.4 var(--font);
  resize: vertical;
}

.ref-form textarea.is-short {
  resize: none;
  white-space: nowrap;
  overflow: hidden;
}

.ref-form input:focus,
.ref-form textarea:focus,
.ref-copy-row input:focus {
  outline: none;
  box-shadow: inset 0 0 0 1.5px var(--accent), 0 0 0 4px oklch(0.55 0.2 var(--hue) / 0.18);
}

.ref-form [aria-invalid="true"] {
  box-shadow: inset 0 0 0 1.5px oklch(0.6 0.19 25);
}

.ref-form ::placeholder {
  color: var(--text-3);
  opacity: 1;
}

.ref-methods {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}

.ref-methods legend {
  margin-bottom: 8px;
  padding: 0;
}

.ref-methods label {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 14px 0 10px;
  border-radius: 999px;
  background: var(--fill);
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--text-2);
  font-size: 0.9375rem;
  cursor: pointer;
}

.ref-methods label:has(input:checked) {
  background: oklch(0.55 0.2 var(--hue) / 0.16);
  box-shadow: inset 0 0 0 1.5px var(--accent);
  color: var(--text);
}

.ref-methods input,
.ref-check input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
}

.ref-methods label:has(input:focus-visible) {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.ref-check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  color: var(--text-2);
  font-size: 0.9375rem;
  cursor: pointer;
}

.ref-check input {
  flex: none;
  margin-top: 3px;
}

.ref-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.ref-actions .btn-primary {
  min-width: 140px;
}

.ref-msg {
  min-height: 1.3em;
  color: var(--text-2);
  font-size: 0.875rem;
}

.ref-msg:empty {
  min-height: 0;
}

.ref-msg.is-error {
  color: oklch(0.62 0.19 25);
  font-weight: 600;
}

.ref-msg.is-ok {
  color: var(--live-text);
  font-weight: 600;
}

.ref-done {
  display: grid;
  gap: 10px;
  color: var(--text-2);
}

.ref-done:focus {
  outline: none;
}

.ref-switch {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--text-2);
  font-size: 0.9375rem;
}

/* ───────── the dashboard ───────── */

.ref-dashboard {
  display: grid;
  gap: 24px;
  margin-bottom: clamp(48px, 7vw, 80px);
  padding: clamp(20px, 3.4vw, 36px);
  border-radius: 28px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.ref-dashboard h2 {
  font-size: clamp(1.6rem, 1.3rem + 1vw, 2.1rem);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.ref-dashboard h2:focus {
  outline: none;
}

.ref-dash-sub,
.ref-note {
  color: var(--text-2);
  font-size: 0.9375rem;
}

.ref-dash-sub {
  margin-top: 6px;
}

.ref-linkbox {
  display: grid;
  gap: 8px;
  max-width: 40rem;
}

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

.ref-copy-row input {
  flex: 1;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 0.9375rem;
}

.ref-copy-row .btn-small {
  min-height: 44px;
  padding: 0 18px;
  font-size: 0.9375rem;
}

.ref-code-line {
  color: var(--text-2);
  font-size: 0.9375rem;
}

.ref-code {
  color: var(--text);
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
}

.ref-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.ref-stats > div {
  display: grid;
  gap: 2px;
  padding: 14px 16px;
  border-left: 1px solid var(--line);
}

.ref-stats > div:first-child {
  padding-left: 0;
  border-left: 0;
}

.ref-stats dt {
  color: var(--text-3);
  font-size: 0.8125rem;
}

.ref-stats dd {
  color: var(--text);
  font: 650 clamp(1.25rem, 1.1rem + 0.6vw, 1.6rem) / 1.2 var(--font-round);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.ref-dash-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 32px clamp(32px, 5vw, 64px);
  align-items: start;
}

.ref-dash-grid > div {
  display: grid;
  gap: 10px;
}

.ref-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.ref-table th,
.ref-table td {
  padding: 10px 12px 10px 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.ref-table th {
  color: var(--text-3);
  font-size: 0.8125rem;
  font-weight: 600;
}

.ref-table td {
  color: var(--text-2);
}

.ref-table td.num {
  color: var(--text);
}

@media (max-width: 960px) {
  .ref-layout,
  .ref-dash-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .ref-panel {
    position: static;
  }
}

@media (max-width: 640px) {
  .ref-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-bottom: 0;
  }

  .ref-stats > div,
  .ref-stats > div:first-child {
    padding: 12px 0;
    border-left: 0;
    border-bottom: 1px solid var(--line);
  }

  .ref-stats > div:nth-child(even) {
    padding-left: 16px;
    border-left: 1px solid var(--line);
  }

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

/* On phones the example table becomes one block per row (style.css); keep the two amounts side by side, labelled. */
@media (max-width: 600px) {
  .prose .table-scroll .ref-example tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px 16px;
  }

  .prose .table-scroll .ref-example th[scope="row"] {
    grid-column: 1 / -1;
  }

  .prose .table-scroll .ref-example td.num {
    text-align: left;
  }

  .prose .table-scroll .ref-example td[data-label]::before {
    color: var(--text-3);
    font-weight: 400;
  }
}

.ref-table tr.is-reversed td:nth-child(2) {
  color: var(--text-3);
  text-decoration: line-through;
}
