/* Affiliate surfaces inherit the same live tokens as the rest of admin. */
.tabs button.tab { font-family: var(--sans); }
.tabs button.tab:focus-visible { outline: 2px solid var(--purple-l); outline-offset: 2px; }
.cpg-affiliates { --af-muted: var(--ink3); }
.cpg-affiliates .cpg-ops-head { align-items: center; }
.af-head-actions, .af-row-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.af-head-actions { flex-shrink: 0; }
.af-program { display: flex; flex-wrap: wrap; gap: 10px 26px; padding: 14px 17px; margin-bottom: 15px; border: 1px solid var(--line); border-radius: 12px; background: color-mix(in srgb, var(--purple) 7%, var(--panel)); color: var(--af-muted); font-size: 12px; line-height: 1.6; }
.af-program strong { color: var(--ink2); font-weight: 650; }
.af-stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin-bottom: 20px; }
.af-stat { padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); min-width: 0; }
.af-stat > div { color: var(--af-muted); font-size: 11px; font-weight: 650; }
.af-stat > strong { display: block; margin: 8px 0 5px; font-size: clamp(20px, 2vw, 29px); font-variant-numeric: tabular-nums; letter-spacing: -.02em; overflow-wrap: anywhere; }
.af-stat > small { display: block; color: var(--af-muted); font-size: 11px; line-height: 1.4; }
.af-panel { margin-bottom: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); overflow: hidden; }
.af-panel-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 17px; border-bottom: 1px solid var(--line); }
.af-panel-head h3 { margin: 0; font-size: 15px; font-weight: 700; }
.af-panel-head h3 > span, .af-section-title > span { margin-left: 7px; color: var(--af-muted); font-weight: 400; font-size: 12px; }
.af-panel-head p { margin: 5px 0 0; color: var(--af-muted); font-size: 12px; }
.af-search { width: 280px; max-width: 100%; }
.af-search input, .af-filter select, .af-field input { width: 100%; min-height: 38px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel2); color: var(--ink); font-size: 13px; }
.af-search input::placeholder, .af-field input::placeholder { color: var(--af-muted); opacity: .85; }
.af-filter { display: flex; align-items: center; gap: 9px; max-width: 100%; font-size: 12px; color: var(--af-muted); }
.af-filter select { min-width: 170px; max-width: 280px; }
.af-scroll { overflow: auto; scrollbar-width: thin; }
.af-ledger { max-height: 440px; }
.cpg-affiliates table { min-width: 770px; }
.cpg-affiliates .af-creators { min-width: 1030px; }
.cpg-affiliates th { position: sticky; top: 0; z-index: 1; padding: 12px 17px; background: var(--panel); color: var(--af-muted); font-family: var(--mono); font-size: 10px; }
.cpg-affiliates td { padding: 16px 17px; border-bottom-color: var(--line); font-size: 12px; }
.cpg-affiliates td strong { font-weight: 650; }
.af-creators td:first-child { width: 35%; }
.af-creators td:last-child { width: 220px; }
.af-row-actions { justify-content: flex-end; }
.af-row-actions .cpg-ops-btn { min-height: 31px; font-size: 11px; padding: 0 9px; }
.af-creator-title { display: flex; align-items: center; gap: 10px; margin-bottom: 5px; }
.af-creator-title > strong { font-size: 14px; overflow-wrap: anywhere; }
.af-muted { display: block; margin-top: 4px; color: var(--af-muted); font-size: 11px; line-height: 1.5; }
.af-link { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.af-link code { display: block; max-width: 290px; overflow-wrap: anywhere; color: var(--purple-l); font: 11px/1.5 var(--mono); user-select: all; }
.af-link .cpg-ops-btn { flex: none; font-size: 10px; min-height: 28px; padding: 0 8px; }
.af-paused-note { display: block; color: var(--amber); font-size: 10px; margin-top: 7px; }
.af-measures { display: flex; flex-direction: column; gap: 6px; color: var(--af-muted); font-size: 11px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.af-measures b { font-weight: 600; color: var(--ink2); }
.af-adjustment { color: var(--amber); }
.af-badge { display: inline-flex; flex: none; align-items: center; padding: 3px 7px; border-radius: 5px; color: var(--af-muted); background: color-mix(in srgb, var(--ink) 6%, transparent); font-size: 10px; font-weight: 600; white-space: nowrap; }
.af-badge[data-status="active"], .af-badge[data-status="available"] { color: var(--green, #4be0a0); background: color-mix(in srgb, var(--green, #4be0a0) 10%, transparent); }
.af-badge[data-status="pending"], .af-badge[data-status="paused"] { color: var(--amber); background: color-mix(in srgb, var(--amber) 10%, transparent); }
.af-badge[data-status="paid"] { color: var(--purple-l); background: color-mix(in srgb, var(--purple) 15%, transparent); }
.af-badge[data-status="reversed"], .af-badge[data-status="disputed"] { color: var(--red); background: color-mix(in srgb, var(--red) 10%, transparent); }
.af-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 160px; padding: 28px 20px; text-align: center; color: var(--af-muted); font-size: 13px; line-height: 1.6; }
.af-empty strong { color: var(--ink2); }
.af-empty p { max-width: 65ch; margin: 7px 0 0; font-size: 12px; }
.af-empty .cpg-ops-btn { margin-top: 14px; }
.af-section-title { margin: 0; padding: 15px 17px; font-size: 12px; color: var(--ink2); border-bottom: 1px solid var(--line); }
.af-footnote { margin: 0; padding: 13px 17px; border-bottom: 1px solid var(--line); color: var(--af-muted); font-size: 11px; line-height: 1.7; }
.af-id { max-width: 230px; overflow-wrap: anywhere; font-family: var(--mono); font-size: 10px; }
.af-reference { max-width: 430px; overflow-wrap: anywhere; white-space: pre-wrap; }
.af-live { min-height: 20px; color: var(--ink2); font-size: 12px; line-height: 1.6; }
.af-live.is-error, .af-form-error { color: var(--red); }
.af-dialog { width: min(590px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); margin: auto; padding: 0; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); color: var(--ink); overflow: auto; box-shadow: 0 24px 90px #0009; }
.af-dialog::backdrop { background: #000a; backdrop-filter: blur(4px); }
.af-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.af-dialog-head h3 { margin: 0; font-size: 18px; }
.af-dialog form { padding: 20px; }
.af-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 17px; }
.af-full { grid-column: 1 / -1; }
.af-field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.af-field > span { font-size: 12px; font-weight: 600; color: var(--ink2); }
.af-field > small { color: var(--af-muted); font-size: 11px; line-height: 1.5; }
.af-dialog-note { margin: 0 0 18px; color: var(--af-muted); font-size: 12px; line-height: 1.7; }
.af-form-grid + .af-dialog-note { margin: 18px 0 0; }
.af-dialog-note strong { color: var(--ink2); }
.af-dialog-footer { display: flex; justify-content: flex-end; gap: 8px; padding-top: 16px; margin-top: 10px; border-top: 1px solid var(--line); }
.af-form-error { margin: 12px 0 0; font-size: 12px; line-height: 1.6; }
.af-form-error:empty { display: none; }
.af-payout-items { margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 10px; overflow: auto; max-height: 270px; }
.af-payout-items legend { padding: 0 7px; margin-left: 10px; font-size: 12px; color: var(--ink2); }
.af-check { display: flex; align-items: flex-start; gap: 10px; padding: 12px; font-size: 12px; color: var(--ink2); cursor: pointer; line-height: 1.5; }
.af-check input { width: 16px; height: 16px; flex: 0 0 16px; margin: 1px 0 0; accent-color: var(--purple); cursor: pointer; }
.af-select-all { color: var(--purple-l); }
.af-payout-item { border-top: 1px solid var(--line); }
.af-payout-item > span { min-width: 0; }
.af-payout-item small { display: block; margin-top: 3px; color: var(--af-muted); font-size: 10px; overflow-wrap: anywhere; }
.af-payout-total { display: flex; justify-content: space-between; align-items: center; gap: 15px; margin: 18px 0; padding: 14px; background: color-mix(in srgb, var(--purple) 10%, var(--panel2)); border-radius: 9px; }
.af-payout-total > span { color: var(--ink2); font-size: 12px; }
.af-payout-total > strong { font-size: 24px; font-variant-numeric: tabular-nums; }
.af-ack { margin-top: 14px; padding: 10px 0; }
.cpg-affiliates [readonly] { opacity: .65; }
@media (max-width: 1100px) { .af-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 620px) {
  .cpg-affiliates .cpg-ops-head { align-items: flex-start; flex-direction: column; gap: 14px; }
  .af-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .af-stat { padding: 13px; }
  .af-panel-head { align-items: flex-start; flex-direction: column; }
  .af-search, .af-filter { width: 100%; }
  .af-filter select { max-width: none; min-width: 0; }
  .af-program { gap: 7px; flex-direction: column; }
  .af-form-grid { grid-template-columns: 1fr; }
  .af-dialog-head, .af-dialog form { padding: 16px; }
  .af-dialog-footer .cpg-ops-btn { width: 100%; min-height: 42px; }
}
