/* ==========================================================================
   REFERRALS IN THE OFFICE (2026-10-21) — admin/js/office-referrals.mjs.

   The view (office.html#referrals) is the Office's own list: .ofc-stats,
   .ofc-card, .ofc-lines.is-cards, a state as a dot and a word (.ofc-st). This
   adds only the line under a referred business saying how it came, a credit's
   amount above its state, and the owner's two moves. The record's band
   (client.html) is the dossier's own (.of-band, .oc-det__list); this adds its
   quiet sub-lines. Monochrome, as the Office is (rules 7 and 18): colour is
   the state dot's alone.
   ========================================================================== */

/* The figures' lines: Credit owed says two amounts, three lines in a desk's tile; the row keeps three from the
   first frame, as its tiles stand unseen while the page reads (it grew a line as it landed: 0.06, 23 Oct). */
#office #ofc-ref-stats .ofc-stat__s { min-height: 3lh; }
/* How a referral came, under the business's name. */
#office .ofc-ref__how { display: block; margin-top: 2px; font-size: var(--o-t-xs, 0.75rem); color: var(--o-faint); }
/* The credit: its amount, then its state, right-aligned like every figure. */
#office .ofc-lines td.num .ofc-ref__amt { display: block; color: var(--o-ink, var(--tk-grey-e6)); }
#office .ofc-lines td.num.is-zero .ofc-ref__amt { color: var(--o-faint); }
#office .ofc-lines td.num .ofc-st { justify-content: flex-end; margin-top: 2px; font-size: var(--o-t-xs, 0.75rem); }
#office .ofc-ref__none { color: var(--o-faint); }
/* Why a referral closed, under its state, in as many lines as it needs. */
#office .ofc-ref__why { display: block; margin-top: 2px; font-size: var(--o-t-xs, 0.75rem); color: var(--o-faint); white-space: normal; }
/* The owner's moves: quiet until pressed once, then they say what the second press does. */
#office .ofc-ref__act { white-space: nowrap; text-align: right; }
#office .ofc-ref__move { min-height: 30px; padding: 0 12px; font-size: var(--o-t-sm, 0.8125rem); }
#office .ofc-ref__move + .ofc-ref__move { margin-left: 8px; }
#office .ofc-ref__move.is-armed { border-color: var(--o-line-3); color: var(--o-ink, var(--tk-white)); background: var(--o-raised); }
#office .ofc-ref__said { margin: 8px 0 0; font-size: var(--o-t-sm, 0.8125rem); color: var(--o-dim, #B5B5B5); }
#office .ofc-ref__said:empty { display: none; }
/* The credit card's second heading, and an invoice's number in the Office's figures face. */
#office .ofc-ref__h3 { margin: 24px 0 8px; font-size: var(--o-t-sm, 0.875rem); font-weight: 600; color: var(--o-ink, var(--tk-grey-e6)); }
#office .ofc-ref__inv { font-variant-numeric: tabular-nums; }
@media (max-width: 40rem) {
  #office .ofc-ref__act { text-align: left; white-space: normal; }
  #office .ofc-ref__move { min-height: 40px; }
}

/* The record's band: Referred by, their code, what they referred. */
.oc-ref__note { margin: 0; color: var(--of-muted, var(--tk-grey-9a)); font-size: 0.875rem; }
.oc-ref__sub { color: var(--of-muted, var(--tk-grey-9a)); }
.oc-ref__code { font-family: ui-monospace, 'SF Mono', Menlo, monospace; letter-spacing: 0.04em; }
.oc-ref .oc-sys__form { margin-top: 2px; }
.oc-ref__acts { display: flex; flex-wrap: wrap; gap: 8px; }
/* Their link: tkati.com/r/ beside the field, as the client's own card has it. */
.oc-ref__linkrow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 4px; }
.oc-ref__pre { font-family: ui-monospace, 'SF Mono', Menlo, monospace; color: var(--of-muted, var(--tk-grey-9a)); }
.oc-ref__in { flex: 1 1 8rem; max-width: 12rem; font-family: ui-monospace, 'SF Mono', Menlo, monospace; }
.oc-ref__hint { margin: 8px 0 0; color: var(--of-muted, var(--tk-grey-9a)); font-size: 0.8125rem; }
/* Its links are the dossier's (office-client.css .oc-who__a): the text's colour, a quiet underline. */
.oc-ref a { color: var(--o-text); text-decoration: underline; text-decoration-color: var(--o-line-3); text-underline-offset: 3px; }
.oc-ref a:hover { color: var(--tk-white); text-decoration-color: currentColor; }

/* GIVE A BONUS (0066, 25 Oct): an amount and a reason, inline under the row or in the record's band. */
#office .ofc-ref__bonus, .oc-ref__bonus { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
#office .ofc-ref__bonus input, .oc-ref__bonus input { min-height: 36px; padding: 0 12px; font: inherit; font-size: 1rem; color: inherit;
  background: transparent; border: 1px solid var(--o-line-2, var(--tk-grey-3a)); border-radius: var(--tk-r-md); }
#office .ofc-ref__bonus input[name="amount"], .oc-ref__bonus input[name="amount"] { width: 7.5em; }
#office .ofc-ref__bonus input[name="reason"], .oc-ref__bonus input[name="reason"] { flex: 1 1 14em; min-width: 0; }
/* THE SUGGESTED RANGE (13 Nov, 0037): one quiet line under the fields, the owner's alone. */
.ofc-ref__suggest { flex-basis: 100%; margin: 0; font-size: 0.8125rem; line-height: 1.4; color: var(--o-dim, var(--of-muted, var(--tk-grey-9a))); }

/* CASH-OUTS (2026-10-28, 0067): the owner's Mark paid takes how it was paid, Decline takes why; and in a
   client's record, the form and its answer under the moves' row. */
#office .ofc-ref__bonus input[name="reference"], .oc-ref__bonus input[name="reference"] { flex: 1 1 16em; min-width: 0; }
.oc-ref__cash { display: grid; gap: 4px; }
.oc-ref__cash:empty { display: none; }

/* THE CREATOR TOGGLE (13 Nov): on the account's record, the owner's. A head (Creator, On or Off), one or two lines,
   the moves; the panel: their code, their followers' discount, their rewards ("Same as everyone" until edited). */
.oc-cr { display: grid; gap: 8px; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--of-hair, var(--o-line, var(--tk-white-a080))); }
.oc-cr__head { display: flex; align-items: center; gap: 8px; }
.oc-cr__k, .oc-cr__k2 { margin: 0; font-weight: 600; font-size: 0.875rem; color: var(--of-text-hi, var(--o-text)); }
.oc-cr__state { font-size: 0.75rem; font-weight: 600; padding: 2px 8px; border-radius: var(--tk-r-pill); border: 1px solid var(--of-hair-3, var(--o-line-2, var(--tk-grey-3a))); color: var(--of-muted, var(--tk-grey-9a)); }
.oc-cr__state.is-on { color: var(--of-text-hi, var(--o-text)); border-color: currentColor; }
.oc-cr__sum { margin: 0; font-size: 0.875rem; color: var(--of-text-hi, var(--o-text)); }
.oc-cr__link { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 0.8125rem; color: var(--of-text-2, var(--of-muted, var(--tk-grey-9a))); overflow-wrap: anywhere; }
.oc-cr__said:empty { display: none; }
.oc-cr__form { display: grid; gap: 16px; margin-top: 4px; }
.oc-cr__set { display: grid; gap: 8px; margin: 0; padding: 0; border: 0; min-width: 0; }
.oc-cr__set legend { padding: 0; margin-bottom: 4px; font: 500 12px/1.4 var(--of-body, inherit); color: var(--of-muted, var(--tk-grey-9a)); }
.oc-cr__radio { display: flex; align-items: center; gap: 8px; font-size: 0.875rem; color: var(--of-text-hi, var(--o-text)); min-height: 32px; }
.oc-cr__radio input { width: 18px; height: 18px; margin: 0; accent-color: currentColor; }
.oc-cr__name { max-width: 14rem; font-family: ui-monospace, 'SF Mono', Menlo, monospace; text-transform: uppercase; }
.oc-cr__row { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 12px 16px; align-items: end; }
.oc-cr__row[hidden], .oc-cr__row .oc-sys__f[hidden] { display: none; }
.oc-cr__rewards { display: grid; gap: 8px; justify-items: start; }
.oc-cr__rewards .oc-cr__row { width: 100%; }
.oc-cr__same { margin: 0; font-size: 0.875rem; color: var(--of-text-2, var(--of-muted, var(--tk-grey-9a))); }
.oc-cr__pay { display: flex; flex-wrap: wrap; align-items: end; gap: 8px 12px; }
.oc-cr__pay .oc-sys__f { flex: 1 1 10rem; }
