.affiliate-dashboard {
  --ad-ink: #0b1220;
  --ad-secondary: #546579;
  --ad-line: #dfe7f0;
  --ad-blue: #1768dc;
  margin: 0;
  background: #f6f9ff;
  color: var(--ad-ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.ad-page, .ad-page * { box-sizing: border-box; }
.ad-page { width: min(1120px, calc(100% - 48px)); margin: 0 auto; padding: 34px 0 24px; }
.ad-page button { font: inherit; cursor: pointer; }
.ad-page button:focus-visible, .ad-page a:focus-visible { outline: 3px solid #147ae3; outline-offset: 3px; }
.ad-page h1, .ad-page h2, .ad-page h3, .ad-page p { margin: 0; }
.ad-heading, .ad-ledger-heading, .ad-invitation-top, .ad-settlement-top, .ad-detail, .ad-settlement-bottom, .ad-code-line { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.ad-heading { margin-bottom: 25px; }
.ad-page .ad-back { display: inline-flex; align-items: center; gap: 7px; color: var(--ad-secondary); text-decoration: none; font-size: 13px; font-weight: 620; }
.ad-back:hover { text-decoration: underline; }
.ad-page h1 { color: var(--ad-ink); font-size: clamp(34px,4.1vw,55px); line-height: 1.12; letter-spacing: -.065em; font-weight: 780; margin-top: 7px; }
.ad-profile { display: flex; gap: 11px; align-items: center; color: var(--ad-ink); }
.ad-profile strong { display: block; font-size: 14px; }
.ad-profile small, .ad-table small { display: block; color: var(--ad-secondary); font-size: 12px; font-weight: 470; line-height: 1.45; margin-top: 2px; }
.ad-avatar { width: 41px; height: 41px; border-radius: 50%; background: #e3edfd; color: #175bbb; font-size: 13px; font-weight: 780; display: grid; place-items: center; }
.ad-overview { display: grid; grid-template-columns: 1.22fr 1fr; gap: 18px; margin-bottom: 28px; }
.ad-settlement, .ad-invitation { border-radius: 19px; padding: 25px 28px; min-width: 0; }
.ad-settlement { color: white; background: radial-gradient(ellipse at 115% -70%,#78b6ff 0%,transparent 60%),linear-gradient(115deg,#1257bf,#2378ed); }
.ad-settlement-top { font-size: 15px; font-weight: 680; flex-wrap: wrap; }
.ad-onblue { font-size: 12px; font-weight: 580; letter-spacing: .01em; }
.ad-onblue::before { content: ""; display: inline-block; width: 6px; height: 6px; background: #c3e5ff; border-radius: 50%; vertical-align: 2px; margin-right: 7px; }
.ad-amount { font-size: clamp(48px,5.2vw,70px); line-height: 1.17; margin: 6px 0 18px; font-weight: 750; letter-spacing: -.065em; font-variant-numeric: tabular-nums; }
.ad-settlement-bottom { font-size: 13px; border-top: 1px solid #ffffff4d; padding-top: 12px; align-items: baseline; flex-wrap: wrap; gap: 3px 12px; }
.ad-settlement-bottom span { color: #f1f7ff; }
.ad-cleared-note { flex-basis: 100%; line-height: 1.5; }
.ad-page .ad-status-card .ad-agreement-note { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 9px; font-size: 12px; }
.ad-page .ad-status-card .ad-agreement-note[hidden] { display: none; }
.ad-agreement-note a { color: var(--ad-blue); text-decoration: underline; text-underline-offset: 2px; }
.ad-page .ad-withdrawal-guide .ad-withdrawal-path { color: var(--ad-ink); font-weight: 650; margin: 9px 0; }
.ad-page .ad-withdrawal-guide .ad-withdrawal-context { margin-top: 12px; font-size: 12px; }
.ad-invitation { background: white; border: 1px solid var(--ad-line); }
.ad-page .ad-invitation h2 { color: var(--ad-ink); font-size: 19px; font-weight: 730; letter-spacing: -.045em; }
.ad-invitation-icon { color: var(--ad-blue); font-size: 21px; line-height: 1; }
.ad-page .ad-invitation p { font-size: 14px; color: var(--ad-secondary); max-width: 42ch; line-height: 1.5; margin: 6px 0 15px; }
.ad-code-line { border: 1px solid #d8e5f8; border-radius: 11px; background: #f5f9ff; padding: 8px 9px 8px 14px; gap: 6px; }
#affiliate-code { color:#164577; font: 760 21px/1.2 ui-monospace, "Cascadia Code", Consolas, monospace; letter-spacing: .09em; user-select: all; }
#copy-code { background: white; color: #165cbf; border: 1px solid #d6e2f1; border-radius: 7px; padding: 7px 11px; font-size: 12px; font-weight: 700; }
#copy-code:hover { background: #e9f2ff; }
#copy-message { display: block; color: var(--ad-secondary); font-size: 11px; }
#copy-message:not(:empty) { margin-top: 4px; }
.ad-ledger { background: white; border: 1px solid var(--ad-line); border-radius: 19px; padding: 23px 0 0; overflow: hidden; }
.ad-ledger-heading { padding: 0 26px; }
.ad-ledger-heading h2 { font-size: 23px; font-weight: 740; color: var(--ad-ink); letter-spacing: -.045em; }
.ad-ledger-heading small { color: var(--ad-secondary); font-size: 12px; }
.ad-summary { display: grid; grid-template-columns: repeat(3,1fr); padding: 20px 26px; gap: 20px; }
.ad-summary > div + div { border-left: 1px solid var(--ad-line); padding-left: 22px; }
.ad-summary span { color: var(--ad-secondary); display: block; font-size: 13px; line-height: 1.4; }
.ad-summary strong { display: block; color: var(--ad-ink); font-size: clamp(23px,2.4vw,31px); letter-spacing: -.055em; line-height: 1.25; margin-top: 3px; font-weight: 730; font-variant-numeric: tabular-nums; }
.ad-tabs { display: flex; gap: 23px; padding: 0 26px; border-bottom: 1px solid var(--ad-line); }
.ad-tabs button { color: var(--ad-secondary); background: transparent; border: 0; border-bottom: 2px solid transparent; border-radius: 0; padding: 12px 0 10px; font-size: 14px; font-weight: 670; }
.ad-tabs button[aria-selected=true] { color: var(--ad-blue); border-color: var(--ad-blue); }
.ad-table { width: 100%; border-spacing: 0; text-align: left; table-layout: fixed; }
.ad-table th { text-align: left; font-weight: 600; font-size: 12px; color: #596c82; background: #f6f9fc; }
.ad-table th, .ad-table td { padding: 13px 14px; border-bottom: 1px solid #eaf0f4; vertical-align: middle; }
.ad-table th:first-child, .ad-table td:first-child { padding-left: 26px; }
.ad-table th:last-child, .ad-table td:last-child { padding-right: 26px; }
.ad-table th:first-child { width: 37%; }
.ad-table td { color: var(--ad-ink); font-size: 14px; overflow-wrap: anywhere; }
.ad-table tbody tr:last-child td { border-bottom: 0; }
.ad-table tbody tr:hover { background: #f9fbff; }
.ad-table .ad-numeric, .ad-table .ad-last { text-align: right; font-variant-numeric: tabular-nums; }
.ad-table td.ad-numeric { font-weight: 650; }
.ad-person { display: flex; align-items: center; gap: 11px; }
.ad-monogram { display: grid; place-items: center; width: 34px; height: 34px; flex: 0 0 34px; border-radius: 50%; background: #eef3fa; color: #415d7f; font-size: 12px; font-weight: 670; line-height: 1; }
.ad-page .ad-person-button { color: #145cc2; padding: 2px 0; border: 0; background: transparent; font-size: 14px; font-weight: 685; text-align: left; }
.ad-person-button:hover { text-decoration: underline; }
.ad-marks { display: inline-flex; gap: 3px; margin-right: 7px; vertical-align: middle; }
.ad-marks i { background: #e3eaf3; width: 12px; height: 5px; border-radius: 3px; }
.ad-marks .filled { background: #2d82f6; }
.ad-slots { color: var(--ad-secondary); white-space: nowrap; }
.ad-commissions-table td:first-child strong { font-size: 14px; font-weight: 670; }
.ad-status { display: inline-flex; align-items: center; border-radius: 6px; padding: 4px 8px; line-height: 1.25; font-size: 12px; font-weight: 640; white-space: nowrap; }
.ad-status.pending { color: #805809; background: #fff2d9; }
.ad-status.ready { color: #1c5dae; background: #eaf1fe; }
.ad-status.sent { color: #24653d; background: #e8f5ed; }
.ad-detail { padding: 11px 26px; }
.ad-detail h3 { font-size: 16px; font-weight: 720; letter-spacing: -.02em; }
.ad-detail button { background: none; border: 0; font-size: 13px; color: var(--ad-blue); padding: 6px 0; font-weight: 620; }
.ad-page .ad-empty,.ad-page .ad-payout-note { padding: 17px 26px; font-size: 13px; color: var(--ad-secondary); }
.ad-page .ad-demo-note { color: var(--ad-secondary); text-align: right; font-size: 11px; margin: 15px 0 0; }
@media(max-width:760px) {
  .ad-page { width: calc(100% - 32px); padding-top: 23px; }
  .ad-overview { gap: 12px; }
  .ad-settlement,.ad-invitation { padding: 18px; }
  .ad-settlement-bottom { flex-direction: column; }
  .ad-summary { gap: 10px; }
  .ad-marks { display: none; }
  .ad-ledger-heading,.ad-summary,.ad-tabs,.ad-detail { padding-left: 16px; padding-right: 16px; }
  .ad-table th:first-child,.ad-table td:first-child { padding-left: 16px; }
  .ad-table th:last-child,.ad-table td:last-child { padding-right: 16px; }
  .ad-table th,.ad-table td { padding-left: 7px; padding-right: 7px; }
}
@media(max-width:570px) {
  .ad-heading { align-items: flex-end; margin-bottom: 18px; }
  .ad-profile { gap: 6px; }
  .ad-profile small { display: none; }
  .ad-profile strong { font-size: 12px; }
  .ad-avatar { width: 29px; height: 29px; font-size: 11px; }
  .ad-overview { grid-template-columns: 1fr; gap: 11px; margin-bottom: 15px; }
  .ad-invitation,.ad-settlement { padding: 16px 18px; border-radius: 15px; }
  .ad-settlement-bottom { flex-direction: row; }
  .ad-amount { margin: 1px 0 8px; font-size: 45px; }
  .ad-page .ad-invitation p { margin: 3px 0 9px; }
  .ad-ledger { padding-top: 16px; border-radius: 15px; }
  .ad-ledger-heading h2 { font-size: 20px; }
  .ad-summary { padding-top: 13px; padding-bottom: 9px; }
  .ad-summary span,.ad-ledger-heading small { font-size: 11px; }
  .ad-summary > div+div { padding-left: 10px; }
  .ad-tabs { gap: 18px; }
  .ad-tabs button { font-size: 13px; }
  .ad-monogram { display: none; }
  .ad-table .ad-date { display: none; }
  .ad-referrals-table th:first-child { width: 47%; }
  .ad-table th,.ad-table td { font-size: 12px; }
  .ad-table th { padding-top: 10px; padding-bottom: 10px; font-size: 11px; }
  .ad-table small { font-size: 11px; }
  .ad-page .ad-person-button,.ad-commissions-table td:first-child strong { font-size: 13px; }
  .ad-status { padding: 3px 5px; font-size: 11px; }
  .ad-page .ad-demo-note { text-align:left; }
}
@media(max-width:390px) {
  .ad-heading { display: block; }
  .ad-profile { margin-top: 7px; }
  .ad-avatar { display:none; }
  .ad-table td:first-child,.ad-table th:first-child { padding-left: 9px; }
  .ad-table td:last-child,.ad-table th:last-child { padding-right: 9px; }
  .ad-table td,.ad-table th { padding-left: 3px; padding-right: 3px; }
  .ad-ledger-heading { align-items: baseline; }
}

/* Approved affiliates choose once inside the existing referral-code card. */
.affiliate-dashboard .ad-overview:has(.ad-code-picker:not([hidden])) {align-items:start;}
.affiliate-dashboard .ad-code-picker fieldset {margin:0;padding:0;border:0;min-inline-size:0;}
.affiliate-dashboard .ad-code-sr-only {position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;}
.affiliate-dashboard .ad-code-options {display:grid;gap:8px;margin-top:13px;}
.affiliate-dashboard .ad-code-choice {display:flex;align-items:center;gap:10px;min-width:0;padding:12px 13px;border:1px solid #c8d2de;border-radius:12px;background:#fff;cursor:pointer;font-size:14px;line-height:1.4;color:var(--ink);}
.affiliate-dashboard .ad-code-choice:has(input:checked) {border-color:var(--blue);background:#f2f7ff;}
.affiliate-dashboard .ad-code-choice input {flex:0 0 18px;width:18px;height:18px;margin:0;accent-color:var(--blue);}
.affiliate-dashboard .ad-code-choice > span {flex:1;min-width:0;}
.affiliate-dashboard .ad-code-choice small {display:block;color:var(--muted);font-size:12px;font-weight:450;overflow-wrap:anywhere;}
.affiliate-dashboard .ad-code-choice strong {font-size:13px;letter-spacing:.025em;max-width:48%;overflow-wrap:anywhere;}
.affiliate-dashboard .ad-custom-code {display:grid;gap:6px;margin-top:12px;}
.affiliate-dashboard .ad-custom-code label {color:var(--ink);font-size:14px;font-weight:700;}
.affiliate-dashboard .ad-custom-code input {box-sizing:border-box;width:100%;border-radius:12px;border:1px solid #c8d2de;padding:13px 14px;background:#fff;color:var(--ink);font:inherit;line-height:1.45;font-size:16px;}
.affiliate-dashboard .ad-custom-code small,.affiliate-dashboard .ad-code-help {color:var(--muted);font-size:13px;line-height:1.5;}
.affiliate-dashboard .ad-code-picker .ad-code-help {margin:12px 0;}
.affiliate-dashboard .ad-code-picker :focus-visible {outline:3px solid #72a3ee;outline-offset:2px;}
.affiliate-dashboard .ad-code-picker[hidden],.affiliate-dashboard .ad-code-picker [hidden] {display:none!important;}
.affiliate-dashboard .ad-code-picker fieldset:disabled {opacity:.7;}
