/* Clairvoyant Research — referral portal
   Self-contained page (no site nav/footer). Layers on brand.css tokens. */

body.portal {
  background:
    radial-gradient(1100px 560px at 85% -8%, rgba(36,86,229,.10), transparent 60%),
    radial-gradient(760px 460px at 2% 0%, rgba(23,182,196,.07), transparent 58%),
    var(--bg-soft);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ---- Branding bar (logo only, no links) ---- */
.portal-bar {
  padding: 22px 0;
}
.portal-bar .brand-logo { height: 30px; width: auto; display: block; }

/* ---- Layout ---- */
.ref-wrap { padding: clamp(8px, 2vw, 24px) 0 clamp(48px, 6vw, 72px); }

.ref-intro { max-width: 760px; margin: 0 auto clamp(28px, 4vw, 44px); text-align: center; }
.ref-title {
  font-family: var(--display);
  font-weight: 900;
  color: var(--ink);
  font-size: clamp(2rem, 3.8vw, 2.9rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 6px 0 14px;
}
.ref-lead { color: var(--body); font-size: 1.1rem; line-height: 1.6; margin: 0 auto; max-width: 60ch; }
.ref-intro .badge { display: inline-block; margin-bottom: 0; }

.ref-cols {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: clamp(20px, 2.4vw, 32px);
  align-items: start;
}

/* ---- Cards ---- */
.ref-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-md);
  padding: clamp(22px, 2.6vw, 34px);
}
.ref-card-title {
  font-family: var(--display);
  font-weight: 800;
  color: var(--ink);
  font-size: 1.28rem;
  margin-bottom: 22px;
}
.ref-divider { border: 0; border-top: 1px solid var(--line); margin: 4px 0 18px; }
.ref-subhead { font-family: var(--display); font-weight: 700; color: var(--ink); font-size: 1.02rem; margin-bottom: 16px; }
.ref-optional { color: var(--muted); font-weight: 500; }
.ref-card .contact-form > .btn { width: 100%; margin-top: 6px; }
/* Disabled submit (e.g. project closed): solid grey, normal cursor — overrides
   brand.css's .contact-form button[disabled] { cursor: progress } */
.contact-form button[disabled],
.ref-card .btn[disabled] {
  background: var(--line-2);
  color: var(--muted);
  border-color: var(--line-2);
  box-shadow: none;
  opacity: 1;
  cursor: not-allowed;
}
.form-blocked { display: none; margin-top: 12px; font-size: .9rem; line-height: 1.5; text-align: center; color: #b7791f; background: #fdf3e2; border: 1px solid #f4d9a8; border-radius: 12px; padding: 12px 15px; }
.form-blocked:not([hidden]) { display: block; }
.form-sent #refer-another { margin-top: 18px; }

/* ---- Referrals table ---- */
.reftable-wrap { min-height: 220px; position: relative; overflow-x: auto; }
.reftable { width: 100%; border-collapse: collapse; }
.reftable th {
  text-align: left;
  font-family: var(--sans);
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
  font-weight: 600;
  padding: 0 12px 12px;
  border-bottom: 1px solid var(--line);
}
.reftable td {
  padding: 15px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  font-size: .95rem;
  color: var(--ink-soft);
}
.reftable tr:last-child td { border-bottom: 0; }
.reftable tr.rt-pending { opacity: .7; }
.reftable .rt-name { display: block; font-weight: 700; color: var(--ink); font-size: 1.02rem; line-height: 1.25; }
.reftable a.rt-link { color: var(--brand-600); }
.reftable a.rt-link:hover { color: var(--brand-700); text-decoration: underline; }
.reftable .rt-sub { display: block; font-size: .82rem; color: var(--muted); font-weight: 400; margin-top: 2px; }
.reftable .col-date, .reftable td.col-date { color: var(--muted); font-size: .88rem; white-space: nowrap; }

/* Status pills — mapped from a normalized status key */
.status {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .78rem; font-weight: 600; line-height: 1;
  padding: 6px 11px; border-radius: 100px; white-space: nowrap;
}
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status.is-new       { background: var(--brand-tint);  color: var(--brand-700); }
.status.is-progress  { background: var(--brand-tint2); color: var(--brand-600); }
.status.is-active    { background: var(--teal-tint);   color: #0f766e; }
.status.is-won       { background: #e6f6ec;            color: var(--green); }
.status.is-lost      { background: #f2f4f7;            color: var(--muted); }
.status.is-hold      { background: #fdf3e2;            color: #b7791f; }

/* Ensure the hidden attribute always wins over the flex/table display rules below. */
[hidden] { display: none !important; }

/* Loading / empty states */
.reftable-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 14px; padding: 40px 16px; color: var(--muted);
  min-height: 200px;
}
.reftable-state p { font-size: .95rem; max-width: 34ch; }
.reftable-ic {
  width: 52px; height: 52px; border-radius: 14px;
  background: var(--brand-tint); color: var(--brand-600);
  display: grid; place-items: center;
}
.reftable-ic svg { width: 26px; height: 26px; }
.spinner {
  width: 30px; height: 30px; border-radius: 50%;
  border: 3px solid var(--line-2); border-top-color: var(--brand);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Footer (text only, no links) ---- */
.portal-foot {
  padding: 26px 0 34px;
}
.portal-foot .container {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px;
  font-size: .86rem; color: var(--muted);
  border-top: 1px solid var(--line);
  padding-top: 22px;
}
.portal-foot .foot-tag { font-family: var(--display); color: var(--faint); }

/* ---- Responsive ---- */
@media (max-width: 900px) {
  .ref-cols { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .reftable th.col-date, .reftable td.col-date { display: none; }
}
