.affiliate-page {
  --aff-accent: #57e37b;
  --aff-surface: #191b18;
  --aff-line: #343632;
  background: #111210;
  color: #f1f0e8;
}
.affiliate-page [hidden] { display: none !important; }
.affiliate-page i.bi { display: inline-flex; align-items: center; justify-content: center; width: 1em; height: 1em; flex-shrink: 0; vertical-align: -.125em; }
.affiliate-page i.bi svg { display: block; width: 100%; height: 100%; }
.affiliate-page .nav { background: #111210; }
.affiliate-page .btn--primary {
  background: var(--aff-accent);
  border-color: var(--aff-accent);
  color: #102426;
  box-shadow: none;
  font-weight: 700;
}
.affiliate-page .btn--primary:hover { background: #79ed96; border-color: #79ed96; }
.affiliate-page button:disabled { cursor: not-allowed; opacity: .46; }
.affiliate-page :is(button, a, input, select, summary):focus-visible {
  outline: 2px solid var(--aff-accent);
  outline-offset: 4px;
}
.aff-main { max-width: 1120px; margin: 0 auto; padding: 46px 24px 42px; }
.aff-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 30px; }
.aff-eyebrow { color: var(--aff-accent); font-size: 11px; font-weight: 700; letter-spacing: .13em; margin: 0 0 12px; }
.aff-heading h1 { font-size: clamp(26px, 3vw, 38px); line-height: 1.2; letter-spacing: -.035em; font-weight: 650; margin: 0; }
.aff-subtitle { color: #a5b6ab; margin: 12px 0 0; font-size: 15px; }
.aff-mobile-break { display: none; }
.aff-icon-button { display: inline-grid; place-items: center; flex-shrink: 0; width: 40px; height: 40px; border: 1px solid var(--aff-line); border-radius: 10px; background: transparent; color: #c4d3c9; cursor: pointer; font-size: 18px; }
.aff-icon-button:hover { border-color: #749b85; color: #fff; }
.aff-panel { border: 1px solid var(--aff-line); border-radius: 16px; background: var(--aff-surface); }
.aff-account { display: flex; align-items: center; justify-content: space-between; gap: 16px; color: #a5b6ab; font-size: 12px; margin-bottom: 12px; overflow-wrap: anywhere; }
.aff-account label { display: flex; align-items: center; gap: 8px; }
.aff-account select { max-width: 230px; padding: 6px 8px; border: 1px solid var(--aff-line); background: var(--aff-surface); color: #edf4ef; border-radius: 6px; }
.aff-top-grid { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(260px, 1fr); gap: 18px; }
.aff-share { padding: 28px; }
.aff-section-label { display: flex; gap: 7px; align-items: center; margin: 0 0 16px; color: #a8c4b2; font-size: 10px; font-weight: 700; letter-spacing: .1em; }
.aff-section-label i { font-size: 17px; }
.aff-share h2 { margin: 0 0 22px; font-size: clamp(18px, 2vw, 23px); letter-spacing: -.025em; font-weight: 600; }
.aff-link-field { display: flex; align-items: stretch; gap: 8px; padding: 5px; background: #0b120e; border: 1px solid #3b5344; border-radius: 10px; }
.aff-link-field input { width: 0; min-width: 0; flex: 1; border: none; padding: 8px; background: transparent; color: #deebe2; font-family: inherit; font-size: 13px; }
.aff-link-field .btn { flex-shrink: 0; border-radius: 7px; padding: 11px 15px; font-size: 13px; }
.aff-share-bottom { display: flex; justify-content: space-between; align-items: center; gap: 12px; color: #8fa697; font-size: 12px; margin: 12px 0 18px; }
.aff-share-bottom strong { color: #cedfd3; font-weight: 500; }
.aff-text-button { border: none; background: transparent; color: var(--aff-accent); padding: 6px 0; font-size: 12px; font-family: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.aff-small { color: #a6b9ad; font-size: 13px; line-height: 1.7; margin: 0; }
.aff-wallet { padding: 28px; background: #1a2b20; border-color: #36543f; display: flex; flex-direction: column; align-items: flex-start; }
.aff-wallet .aff-section-label { margin-bottom: 15px; }
.aff-balance { color: #effdf3; font-size: clamp(30px, 4vw, 42px); font-weight: 600; line-height: 1.15; letter-spacing: -.035em; overflow-wrap: anywhere; margin-bottom: 9px; }
.aff-wallet .btn { width: 100%; justify-content: space-between; display: flex; margin-top: auto; padding-top: 12px; padding-bottom: 12px; }
.aff-wallet .aff-small { margin-bottom: 22px; }
.aff-wallet .aff-pending { color: #e6c88a; font-size: 12px; line-height: 1.5; margin: 13px 0 0; }
.aff-stats { display: grid; grid-template-columns: repeat(4, 1fr); margin: 20px 0 30px; border-bottom: 1px solid var(--aff-line); padding: 5px 0 24px; }
.aff-stats div { padding: 0 24px; border-left: 1px solid var(--aff-line); min-width: 0; }
.aff-stats div:first-child { padding-left: 0; border-left: none; }
.aff-stats span { display: block; color: #a5b6ab; font-size: 12px; margin-bottom: 8px; }
.aff-stats strong { color: #edf4ef; font-size: 22px; font-weight: 600; letter-spacing: -.02em; overflow-wrap: anywhere; }
.aff-rank { padding: 27px 28px; margin: 26px 0; }
.aff-rank-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 20px; }
.aff-rank-heading .aff-section-label { margin-bottom: 7px; }
.aff-rank-heading h2 { font-size: 21px; letter-spacing: -.02em; line-height: 1.35; font-weight: 600; margin: 0; }
.aff-rank-badge { flex-shrink: 0; color: var(--aff-accent); border: 1px solid #41604c; padding: 7px 11px; border-radius: 20px; font-size: 12px; }
.aff-progress-label { display: flex; justify-content: space-between; gap: 14px; color: #b5c8bd; font-size: 12px; margin-bottom: 9px; }
.aff-progress-label strong { color: var(--aff-accent); font-size: 14px; white-space: nowrap; }
.aff-progress-track { height: 5px; border-radius: 10px; background: #2c3c32; overflow: hidden; }
.aff-progress-track > div { height: 100%; width: 0; background: var(--aff-accent); }
#rank-next { margin-top: 9px; }
.aff-rank-list { display: grid; grid-template-columns: repeat(5, 1fr); margin: 22px 0 17px; gap: 8px; }
.aff-rank-item { position: relative; padding: 16px 12px; border: 1px solid #324238; border-radius: 10px; background: #111a14; }
.aff-rank-item.is-current { border-color: #79dbab; background: #1c3325; }
.aff-rank-item.is-current::after { content: ''; width: 6px; height: 6px; background: var(--aff-accent); border-radius: 50%; position: absolute; top: 11px; right: 11px; }
.aff-rank-item p { margin: 0; }
.aff-rank-name { font-size: 12px; color: #c1d4c8; display: flex; align-items: center; gap: 5px; }
.aff-rank-name i { color: #96b4a1; }
.aff-rank-name[data-rank="dong"] i { color: #dfa67d; }
.aff-rank-name[data-rank="bac"] i { color: #c9d8e2; }
.aff-rank-name[data-rank="vang"] i { color: #f5d17b; }
.aff-rank-name[data-rank="kim-cuong"] i { color: #95d6f2; }
.aff-rank-item .aff-rank-percent { font-size: 27px; color: #f2faf5; font-weight: 600; letter-spacing: -.03em; margin: 11px 0 6px; }
.aff-rank-threshold { font-size: 12px; color: #a5b6ab; line-height: 1.5; }
.aff-rank-rule { max-width: 850px; }
.aff-history { padding: 24px 28px 8px; margin-bottom: 22px; }
.aff-history-heading { display: flex; gap: 15px; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.aff-history h2 { font-size: 20px; font-weight: 600; margin: 0; letter-spacing: -.02em; }
.aff-tabs { display: inline-flex; background: #0d1610; border: 1px solid var(--aff-line); border-radius: 8px; padding: 3px; }
.aff-tabs button { border: none; background: transparent; color: #9db2a4; padding: 8px 12px; border-radius: 5px; cursor: pointer; font-family: inherit; font-size: 12px; }
.aff-tabs button[aria-selected="true"] { background: #2a3d30; color: #effbf3; }
.aff-entry { display: flex; justify-content: space-between; align-items: center; padding: 18px 0; border-top: 1px solid var(--aff-line); gap: 15px; }
.aff-entry p { margin: 0; }
.aff-entry-title { font-size: 13px; font-weight: 500; color: #e6f0e9; }
.aff-entry-note { font-size: 11px; color: #99b0a1; line-height: 1.6; margin-top: 5px !important; }
.aff-entry-money { text-align: right; flex-shrink: 0; }
.aff-entry-money strong { display: block; font-size: 16px; font-weight: 600; color: var(--aff-accent); }
.aff-entry-money span { display: block; font-size: 11px; margin-top: 5px; color: #a8bbaf; }
.aff-entry-money .is-pending { color: #e6c88a; }
.aff-empty { padding: 36px 15px; text-align: center; color: #a5b6ab; border-top: 1px solid var(--aff-line); }
.aff-empty i { color: #8ab29a; display: block; font-size: 24px; margin-bottom: 11px; }
.aff-empty p { margin: 0 0 7px; color: #d1dfd6; font-size: 14px; }
.aff-empty span { font-size: 12px; }
.aff-how { border-bottom: 1px solid var(--aff-line); padding: 18px 0; }
.aff-how summary { cursor: pointer; color: #c8d9cf; font-size: 13px; }
.aff-how > p { max-width: 860px; font-size: 12px; line-height: 1.9; color: #9fb3a6; margin: 15px 0 3px; }
.aff-how summary::marker { color: #7a9f87; }
.aff-legacy-form { max-width: 480px; margin: 18px 0 6px; display: grid; gap: 14px; }
.aff-legacy-form label, .aff-dialog label { display: grid; gap: 7px; font-size: 12px; color: #d3e0d7; }
.aff-legacy-form input, .aff-dialog input { box-sizing: border-box; width: 100%; background: #0c140f; border: 1px solid #3a4e40; border-radius: 8px; padding: 12px; color: #edf7f1; font: inherit; font-size: 14px; }
.aff-legacy-form .btn { justify-self: start; }
.aff-legacy-form [role="status"] { font-size: 12px; margin: 0; }
.aff-footer { max-width: 1120px; margin: 0 auto; padding: 25px 24px 30px; color: #819a8a; display: flex; justify-content: space-between; gap: 20px; font-size: 11px; }
.aff-footer div { display: flex; flex-wrap: wrap; gap: 22px; }
.aff-footer a { color: #a9bfb1; }
.aff-dialog { box-sizing: border-box; width: min(480px, calc(100% - 32px)); max-height: calc(100dvh - 32px); margin: auto; padding: 28px; border-radius: 16px; border: 1px solid #496350; background: #152219; color: #edf7f1; box-shadow: 0 24px 80px #0007; }
.aff-dialog::backdrop { background: #030905bd; backdrop-filter: blur(4px); }
.aff-dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 15px; }
.aff-dialog-heading .aff-section-label { margin-bottom: 8px; }
.aff-dialog h2 { font-size: 21px; font-weight: 600; line-height: 1.35; margin: 0; letter-spacing: -.02em; }
.aff-dialog form { display: grid; gap: 16px; }
.aff-dialog .btn { width: 100%; justify-content: center; margin-top: 2px; }
.aff-alert { border: 1px solid #985c46; border-radius: 9px; padding: 12px 15px; color: #ffd2bd; background: #3a221c; font-size: 12px; line-height: 1.6; margin: 0 0 20px; }
.aff-dialog .aff-alert { margin: 0; }
.aff-toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); max-width: calc(100vw - 32px); padding: 12px 20px; border: 1px solid #4b7258; border-radius: 10px; color: #ecfff2; background: #264b33; box-shadow: 0 8px 40px #0007; font-size: 13px; z-index: 200; text-align: center; }
.aff-loading { display: flex; gap: 10px; align-items: center; padding: 30px 0; color: #a9bfb0; font-size: 13px; }
.aff-loading span { width: 8px; height: 8px; background: var(--aff-accent); border-radius: 50%; }
.aff-login { display: flex; align-items: flex-start; gap: 22px; background: #182b1f; border: 1px solid #385641; border-radius: 16px; padding: 32px; margin: 10px 0 26px; }
.aff-login-mark { display: grid; place-items: center; width: 54px; height: 54px; color: var(--aff-accent); background: #294a35; border-radius: 12px; flex-shrink: 0; font-size: 28px; }
.aff-login h2 { font-size: 22px; font-weight: 600; letter-spacing: -.02em; margin: 0 0 9px; line-height: 1.4; }
.aff-login p { color: #a9c0b1; font-size: 14px; margin: 0 0 20px; }
.aff-login #login-note { margin-top: 14px; margin-bottom: 0; font-size: 12px; }
@media (max-width: 800px) {
  .aff-top-grid { grid-template-columns: 1fr; }
  .aff-wallet { display: grid; grid-template-columns: 1fr auto; column-gap: 20px; }
  .aff-wallet .aff-section-label, .aff-wallet .aff-balance, .aff-wallet .aff-small { grid-column: 1; }
  .aff-wallet .aff-section-label { margin-bottom: 9px; }
  .aff-wallet .aff-small { margin-bottom: 0; }
  .aff-wallet .btn { grid-column: 2; grid-row: 1 / 4; align-self: center; margin: 0; gap: 25px; }
  .aff-wallet .aff-pending { grid-column: 1 / -1; }
  .aff-rank-list { gap: 6px; }
  .aff-rank-item { padding: 14px 9px; }
  .aff-stats div { padding: 0 14px; }
  .aff-rank-name { font-size: 11px; }
}
@media (max-width: 580px) {
  .aff-toast { top: 80px; bottom: auto; }
  .aff-main { padding: 30px 16px 18px; }
  .aff-heading { gap: 12px; margin-bottom: 25px; }
  .aff-mobile-break { display: initial; }
  .aff-subtitle { max-width: 270px; font-size: 13px; line-height: 1.65; }
  .aff-share, .aff-wallet, .aff-rank, .aff-history { padding: 21px 18px; }
  .aff-share h2 { margin-bottom: 18px; }
  .aff-link-field { flex-wrap: wrap; gap: 0; padding: 0; background: transparent; border: none; }
  .aff-link-field input { flex-basis: 100%; width: 100%; padding: 12px; border: 1px solid #3b5344; background: #0b120e; border-radius: 8px; margin-bottom: 9px; font-size: 12px; }
  .aff-link-field .btn { width: 100%; padding: 12px; justify-content: center; display: flex; }
  .aff-share-bottom { margin-bottom: 14px; }
  .aff-wallet { grid-template-columns: 1fr; }
  .aff-wallet .btn { grid-column: 1; grid-row: auto; margin-top: 18px; }
  .aff-stats { grid-template-columns: 1fr 1fr; gap: 20px 0; margin-bottom: 22px; padding: 3px 0 24px; }
  .aff-stats div { padding: 0 16px; }
  .aff-stats div:nth-child(3) { border-left: none; padding-left: 0; }
  .aff-stats span { font-size: 11px; }
  .aff-stats strong { font-size: 21px; }
  .aff-rank { margin: 22px 0; }
  .aff-rank-heading { align-items: flex-start; }
  .aff-rank-heading h2 { font-size: 18px; }
  .aff-rank-badge { font-size: 10px; padding: 6px 8px; }
  .aff-progress-label { flex-wrap: wrap; gap: 6px; }
  .aff-rank-list { display: flex; flex-direction: column; gap: 0; margin: 18px 0; }
  .aff-rank-item { display: grid; align-items: center; grid-template-columns: 1fr auto 1fr; gap: 10px; border-radius: 0; border: none; border-top: 1px solid #2f4135; background: transparent; padding: 13px 9px; }
  .aff-rank-item.is-current { border-radius: 7px; background: #1c3325; }
  .aff-rank-item.is-current::after { top: 50%; right: 5px; transform: translateY(-50%); width: 4px; height: 4px; }
  .aff-rank-item .aff-rank-percent { font-size: 21px; margin: 0; }
  .aff-rank-name { font-size: 12px; }
  .aff-rank-threshold { font-size: 12px; text-align: right; padding-right: 8px; }
  .aff-history-heading { flex-direction: column; align-items: flex-start; margin-bottom: 15px; }
  .aff-tabs { width: 100%; }
  .aff-tabs button { flex: 1; padding: 9px; }
  .aff-entry-money strong { font-size: 14px; }
  .aff-entry-title { font-size: 12px; }
  .aff-login { padding: 24px 18px; gap: 14px; }
  .aff-login-mark { display: none; }
  .aff-login h2 { font-size: 21px; }
  .aff-login p { font-size: 13px; }
  .aff-footer { padding: 24px 16px 30px; flex-direction: column; gap: 15px; }
  .aff-footer div { gap: 17px; }
  .aff-dialog { padding: 23px 20px; }
}

/* Shared OStudio finish for the account and referral workspace. */
.affiliate-page .aff-icon-button {
  border-color: var(--aff-line);
  color: #b7b8b0;
  border-radius: 6px;
}

.affiliate-page .aff-icon-button:hover {
  border-color: var(--aff-accent);
  color: #f1f0e8;
}

.affiliate-page .aff-panel,
.affiliate-page .aff-login {
  border-color: var(--aff-line);
  border-radius: 12px;
  background: var(--aff-surface);
}

.affiliate-page .aff-link-field {
  border-color: var(--aff-line);
  border-radius: 6px;
  background: #111210;
}

.affiliate-page .aff-link-field input,
.affiliate-page .aff-dialog input,
.affiliate-page .aff-legacy-form input {
  color: #f1f0e8;
}

.affiliate-page .aff-wallet {
  border-color: var(--aff-line);
  background: #20221f;
}

.affiliate-page .aff-rank-badge {
  border-color: var(--aff-line);
}

.affiliate-page .aff-progress-track {
  background: #343632;
}

.affiliate-page .aff-rank-item {
  border-color: var(--aff-line);
  border-radius: 8px;
  background: #151614;
}

.affiliate-page .aff-rank-item.is-current {
  border-color: var(--aff-accent);
  background: rgba(87, 227, 123, .1);
}

.affiliate-page .aff-tabs {
  border-color: var(--aff-line);
  border-radius: 6px;
  background: #111210;
}

.affiliate-page .aff-tabs button[aria-selected="true"] {
  background: rgba(87, 227, 123, .16);
  color: #dffafa;
}

.affiliate-page .aff-dialog {
  border-color: var(--aff-line);
  border-radius: 10px;
  background: #191b18;
  color: #f1f0e8;
}

.affiliate-page .aff-toast {
  border-color: rgba(87, 227, 123, .45);
  border-radius: 6px;
  background: #173033;
  color: #e5fbfb;
}

.affiliate-page .aff-footer a,
.affiliate-page .aff-empty i,
.affiliate-page .aff-how summary::marker {
  color: var(--aff-accent);
}
