/* Affiliate dashboard (/affiliate) and the admin page (/admin/affiliates). Sits on top of app.css. */
.aff { padding: 32px 16px 72px; }
.aff-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.aff-head h1 { font-size: clamp(26px, 3vw, 34px); margin: 4px 0 6px; }
.aff-head p { margin: 0; color: var(--muted); max-width: 640px; text-wrap: pretty; }
.aff-sec { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 24px; margin-bottom: 20px; min-width: 0; }
.aff-sec > h2 { font-size: 19px; margin: 0 0 6px; }
.aff-sec > .sub { color: var(--muted); font-size: 15px; margin: 0 0 18px; text-wrap: pretty; }
.aff-note { background: #fff7ed; border: 1px solid #fed7aa; border-radius: 10px; padding: 14px 16px; margin-bottom: 20px; font-size: 15px; }

/* The affiliate page: one card laid out like Skool's (Nate, 9 Oct). */
.aff-main { max-width: 880px; margin: 0 auto; padding: 32px; }
.aff-main h1 { font-size: clamp(26px, 3vw, 32px); margin: 0 0 6px; }
.aff-main > .sub { margin-bottom: 24px; }
.aff-main h2 { font-size: 18px; margin: 0 0 6px; }
.aff-main .lead { color: var(--text); font-size: 15px; margin: 0 0 14px; text-wrap: pretty; }

/* Numbers: one panel, columns split by thin lines (not a card each). */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); background: var(--subtle); border: 1px solid var(--line); border-radius: 12px; }
.stat { padding: 22px 16px; min-width: 0; text-align: center; }
.stat + .stat { border-left: 1px solid var(--line); }
.stat b { display: block; font-size: 28px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat b.pos { color: var(--ok); }
.stat span { display: block; font-size: 14px; color: var(--faint); margin-top: 4px; }
.soon { text-align: right; font-size: 14px; color: var(--faint); margin: 10px 0 28px; }

/* Your link: the link and Copy in one box. */
.link-box { display: flex; align-items: center; height: 56px; padding: 4px 4px 4px 16px; gap: 8px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--bg); }
.link-box[hidden] { display: none; }
.link-box output { flex: 1; min-width: 0; font: 500 15px/1.2 'Geist Mono', ui-monospace, monospace; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-box .btn { flex: none; height: 100%; min-width: 104px; border-radius: 7px; transition: transform 0.12s ease, background 0.15s; }
.link-box .btn:active { transform: scale(0.96); }
.link-box.edit:focus-within { border-color: var(--btn); box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--btn); }
.link-box .pre { font: 500 15px 'Geist Mono', ui-monospace, monospace; color: var(--faint); flex: none; }
.link-box.edit input { flex: 1; min-width: 0; height: 100%; border: 0; padding: 0; margin-left: -8px; background: none; font: 500 15px 'Geist Mono', ui-monospace, monospace; color: var(--text); box-shadow: none; }
.link-box.edit input:focus { box-shadow: none; }
.link-foot { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; font-size: 14px; color: var(--faint); margin-top: 10px; }
.link-foot code { font: 13px 'Geist Mono', ui-monospace, monospace; color: var(--muted); }
.text-btn { background: none; border: 0; padding: 0; font: inherit; font-size: 14px; color: var(--text); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.text-btn:active { opacity: 0.6; }

/* Sales list */
.list-head { display: flex; justify-content: space-between; align-items: baseline; margin: 32px 0 12px; }
.list-head h2 { margin: 0; }
.list-head span { font-size: 14px; color: var(--faint); }
.aff-list { border: 1px solid var(--line); border-radius: 10px; padding: 8px 20px; min-height: 160px; }
.aff-list .tbl-wrap { margin: 0 -20px; padding: 0 20px; }
.aff-list .tbl th { padding-top: 10px; }
.aff-list .tbl td b { display: block; font-weight: 600; }
.aff-list .tbl td.date { white-space: nowrap; width: 1%; padding-right: 24px; }
.aff-list .empty { text-align: center; padding: 56px 0; }
.pay-head { margin-top: 28px !important; margin-bottom: 12px !important; }
.aff-main > .hint { margin-top: 24px; }
.hint { font-size: 14px; color: var(--faint); margin: 10px 0 0; text-wrap: pretty; }
.hint a { text-decoration: underline; }

/* Tables */
.tbl-wrap { overflow-x: auto; margin: 0 -24px; padding: 0 24px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 15px; }
.tbl th { text-align: left; font-family: 'Geist Mono', ui-monospace, monospace; font-size: 11px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); padding: 0 12px 10px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 12px 12px 12px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tbl .neg { color: var(--err); }
.tbl .quiet { color: var(--faint); font-size: 14px; }
.tbl .note { max-width: 320px; color: var(--muted); font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.empty { color: var(--faint); font-size: 15px; margin: 0; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 9999px; font-size: 12px; font-weight: 500; background: var(--subtle); color: var(--muted); white-space: nowrap; }
.tag.ok { background: #dcfce7; color: #166534; }
.tag.warn { background: #ffedd5; color: #9a3412; }
.tag.bad { background: #fee2e2; color: #991b1b; }

/* Admin row actions */
.acts { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn.sm { padding: 7px 12px; font-size: 14px; border-radius: 6px; transition: transform 0.12s ease, background 0.15s; }
.btn.sm:active { transform: scale(0.96); }
.rate { display: flex; gap: 6px; align-items: center; }
.rate input { width: 64px; padding: 6px 8px; font-size: 14px; }
.pay { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.pay select, .pay input { padding: 7px 10px; font: inherit; font-size: 14px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--bg); }
.pay input { width: 180px; }

@media (max-width: 600px) {
  .aff-sec { padding: 20px 16px; }
  .aff-main { padding: 24px 16px; }
  .tbl-wrap { margin: 0 -16px; padding: 0 16px; }
  .stat { padding: 16px 6px; }
  .stat b { font-size: 20px; }
  .stat span { font-size: 12px; }
  .soon { text-align: left; }
  .link-box { height: auto; flex-wrap: wrap; padding: 12px; }
  .link-box output { flex-basis: 100%; white-space: normal; overflow-wrap: anywhere; }
  .link-box .btn { width: 100%; height: 44px; }
  .link-box.edit input { flex-basis: 0; height: 40px; }
  .aff-list { padding: 4px 16px; }
  .aff-list .tbl-wrap { margin: 0 -16px; padding: 0 16px; }
}
