/* page-affiliates — số đo lấy từ ceoacc client/affiliates (giá trị CSS trước zoom .86).
 * Bảng (ft-dt-*) dùng CSS chung trong orders.css; phần riêng của trang này ghi đè bên dưới.
 * Khoảng cách theo rem như bản gốc: base.css đặt html 16px, 15.5px dưới 768px (ui-scale.css của ceoacc). */

/* ===== Tiêu đề trang ===== */
#page-affiliates .af-hero {
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  margin-bottom: 1rem; padding: 1.05rem 1.25rem;
  border: 1px solid var(--cg-line); border-radius: 24px;
  background: linear-gradient(135deg, var(--cg-surface) 35%, var(--cg-blue-soft));
  box-shadow: var(--cg-shadow); color: var(--cg-text); line-height: 21.7px;
}
#page-affiliates .af-hero::after {
  content: ""; position: absolute; right: -54px; top: -88px;
  width: 190px; height: 190px; border: 34px solid rgba(255,255,255,.08); border-radius: 50%;
}
#page-affiliates .af-hero > * { position: relative; z-index: 1; }
#page-affiliates .af-kicker {
  display: inline-flex; align-items: center; gap: .45rem;
  border-radius: 20px; background: var(--cg-blue-soft); color: var(--cg-primary);
  font-size: 11px; font-weight: 500; line-height: 17.05px;
}
#page-affiliates .af-hero h1 {
  margin: .2rem 0 .28rem; color: var(--cg-text);
  font-family: "Plus Jakarta Sans", sans-serif; font-size: 24px; font-weight: 600; line-height: 1.35; letter-spacing: -.025em;
}
#page-affiliates .af-hero p { max-width: 720px; margin: 0; color: #586a82; font-size: 13px; line-height: 1.7; }
#page-affiliates .af-hero-badges { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .45rem; }
#page-affiliates .af-hero-badges span {
  padding: .38rem .62rem; border-radius: 12px; background: var(--cg-soft); color: #586a82;
  font-size: 12px; font-weight: 500; line-height: 18.6px; white-space: nowrap;
}
#page-affiliates .af-hero-badges i { margin-right: 5px; color: var(--cg-primary); }
.cg-dark #page-affiliates .af-hero p, .cg-dark #page-affiliates .af-hero-badges span { color: var(--cg-muted); }

/* ===== Thanh tab ===== */
#page-affiliates .af-tabs-card {
  display: flex; flex-direction: column;
  margin-bottom: 1rem; border: 1px solid var(--cg-line); border-radius: 24px;
  background: linear-gradient(155deg, var(--cg-surface) 65%, var(--cg-soft)); box-shadow: var(--cg-shadow);
  line-height: 1.6;
}
#page-affiliates .af-tabs-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px; border-radius: inherit; background: var(--cg-surface);
}
#page-affiliates .af-tabs { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; list-style: none; }
#page-affiliates .af-tabs li { flex: 1 1 130px; text-align: center; }
#page-affiliates .af-tab {
  display: flex; align-items: center; justify-content: center;
  min-height: 44px; margin: 5px; padding: 9px 16px; border: 1px solid transparent; border-radius: 14px;
  color: var(--cg-muted); font-size: 14px; font-weight: 500; line-height: 1.5; text-decoration: none;
  cursor: pointer; transition: background-color .16s ease, color .16s ease, border-color .16s ease;
}
#page-affiliates .af-tab:hover { color: var(--cg-text); background: var(--cg-soft); border-color: var(--cg-line); text-decoration: none; }
#page-affiliates .af-tab.active { background: var(--cg-blue-soft); border-color: var(--cg-primary); color: var(--cg-primary); font-weight: 600; }
#page-affiliates .af-tab:focus-visible { outline: 2px solid var(--cg-primary); outline-offset: 2px; }

/* ===== Lưới (giống bootstrap .row / .col-*) ===== */
#page-affiliates .af-pane { display: none; }
#page-affiliates .af-pane.active { display: block; }
#page-affiliates .af-row { display: flex; flex-wrap: wrap; margin: 0 -15px; }
#page-affiliates .af-row > div { flex: 0 0 100%; width: 100%; padding: 0 15px; }
@media (min-width: 768px) {
  #page-affiliates .af-row > .af-col-4 { flex-basis: 33.3333%; max-width: 33.3333%; }
}
@media (min-width: 992px) {
  #page-affiliates .af-row > .af-col-7 { flex-basis: 58.3333%; max-width: 58.3333%; }
  #page-affiliates .af-row > .af-col-5 { flex-basis: 41.6667%; max-width: 41.6667%; }
}

/* ===== Thẻ ===== */
#page-affiliates .af-card {
  display: flex; flex-direction: column; margin-bottom: 30px;
  border: 1px solid var(--cg-line); border-radius: 24px;
  background: linear-gradient(155deg, var(--cg-surface) 65%, var(--cg-soft));
  box-shadow: var(--cg-shadow); color: var(--cg-text); font-size: 14px; line-height: 1.6;
}
#page-affiliates .af-card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--cg-line);
  border-radius: 23px 23px 0 0; background: var(--cg-surface);
}
#page-affiliates .af-card-body { flex: 1 1 auto; padding: 20px; }
#page-affiliates .af-card-title { margin-bottom: 2.5rem; }
#page-affiliates .af-card b { font-weight: 700; }
.cg-dark #page-affiliates .af-card-header { color: var(--cg-text); }

/* Thẻ số liệu: viền trên 3px màu, chữ co theo nội dung (d-flex như bản gốc) */
#page-affiliates .af-stat {
  overflow: hidden; border: 1px solid #dfe7f2; border-radius: 14px; box-shadow: 0 8px 22px rgba(29,54,88,.06);
}
#page-affiliates .af-stat.is-blue { border-top: 3px solid #3978ef; }
#page-affiliates .af-stat.is-green { border-top: 3px solid #19a974; }
#page-affiliates .af-stat.is-orange { border-top: 3px solid #f3a51b; }
#page-affiliates .af-stat-flex { display: flex; align-items: center; }
#page-affiliates .af-stat-val { display: flex; flex-wrap: wrap; align-items: center; }
#page-affiliates .af-stat p { margin: 0 0 .625rem; color: #8f9fbc; font-size: 14px; line-height: 1.6; }
#page-affiliates .af-stat h5 {
  margin: 0; color: #17243a;
  font-family: "Plus Jakarta Sans", sans-serif; font-size: 1.35rem; font-weight: 700; line-height: 1.2;
}
.cg-dark #page-affiliates .af-stat { border-left-color: var(--cg-line); border-right-color: var(--cg-line); border-bottom-color: var(--cg-line); }
.cg-dark #page-affiliates .af-stat h5 { color: var(--cg-text); }
.cg-dark #page-affiliates .af-stat p { color: var(--cg-muted); }

/* Dòng thông tin: nhãn 1/3, giá trị 2/3 */
#page-affiliates .af-info-row { display: flex; flex-wrap: wrap; margin: 0 -15px 1rem; }
#page-affiliates .af-info-row > label {
  flex: 0 0 33.3333%; max-width: 33.3333%; align-self: center;
  margin-bottom: 8px; padding: 0 15px; color: #213446; font-size: 14px; font-weight: 500; line-height: 1.6;
}
#page-affiliates .af-info-row > div { flex: 0 0 66.6667%; max-width: 66.6667%; padding: 0 15px; }
#page-affiliates .af-text-red { color: #b33948; }
#page-affiliates .af-text-blue { color: var(--cg-primary); }
.cg-dark #page-affiliates .af-info-row > label { color: var(--cg-text); }
.cg-dark #page-affiliates .af-text-red { color: #ffa1ad; }

/* Ô nhập + nút (link giới thiệu, form rút tiền) — giống .form-control của ceoacc */
#page-affiliates .af-control {
  display: block; width: 100%; height: 46px; min-height: 44px;
  padding: .625rem 1.25rem;
  border: 1px solid #d4dfed; border-radius: 12px;
  background: var(--cg-surface); color: var(--cg-text);
  font-family: inherit; font-size: 14px; line-height: 1.5;
  transition: border-color .15s, box-shadow .15s;
}
#page-affiliates input.af-control { line-height: 45px; }
#page-affiliates .af-control:focus { outline: 0; border-color: var(--cg-primary); box-shadow: 0 0 0 2px var(--cg-field-ring); }
#page-affiliates .af-control[readonly] { background: var(--cg-soft); color: var(--cg-muted); }
#page-affiliates .af-control::placeholder { color: var(--cg-muted); }
.cg-dark #page-affiliates .af-control { border-color: var(--cg-line); }
#page-affiliates .af-input-group { display: flex; flex-wrap: wrap; align-items: stretch; margin-bottom: 1.875rem; }
#page-affiliates .af-input-group .af-control { position: relative; flex: 1 1 auto; width: 1%; min-width: 0; }
#page-affiliates .af-input-group .af-control:focus { z-index: 3; }
#page-affiliates .af-btn-primary {
  position: relative; z-index: 2; flex: 0 0 auto; margin-left: -1px;
  padding: .625rem 1.25rem; border: 1px solid #2465bd; border-radius: 12px;
  background: #2465bd; color: #fff; font-family: inherit; font-size: 14px; font-weight: 500; line-height: 1.5;
  vertical-align: middle; box-shadow: 0 4px 8px rgba(255,255,255,.05); cursor: pointer;
}

/* Hộp lưu ý */
#page-affiliates .af-rules { width: 100%; margin-bottom: 30px; line-height: 1.6; font-family: -apple-system, BlinkMacSystemFont, "Microsoft YaHei", Arial, sans-serif; }
#page-affiliates .af-rules-box { padding: 16px 18px; border: 1px solid #e5e7eb; border-radius: 8px; box-shadow: 0 2px 6px rgba(0,0,0,.02); }
#page-affiliates .af-rules ul { margin: 0 0 1rem; padding-left: 40px; }
.cg-dark #page-affiliates .af-rules-box { border-color: var(--cg-line); }

/* Form rút tiền: nhãn 1/3 + ô 2/3 */
#page-affiliates .af-form-row { display: flex; flex-wrap: wrap; margin: 0 -15px 1rem; }
#page-affiliates .af-form-row > label {
  flex: 0 0 33.3333%; max-width: 33.3333%; margin-bottom: 0;
  padding: calc(.625rem + 1px) 15px;
  color: #213446; font-size: 14px; font-weight: 500; line-height: 1.5;
}
#page-affiliates .af-form-row > div { flex: 0 0 66.6667%; max-width: 66.6667%; padding: 0 15px; }
#page-affiliates .af-form-row.is-center > div { flex-basis: 100%; max-width: 100%; text-align: center; }
.cg-dark #page-affiliates .af-form-row > label { color: var(--cg-text); }
#page-affiliates .af-btn-danger-sm {
  display: inline-block; padding: .25rem .5rem; border: 1px solid #f42b3d; border-radius: 10px;
  background: #f42b3d; color: #fff; font-family: inherit; font-size: 12px; font-weight: 500; line-height: 1.5;
  vertical-align: middle; box-shadow: 0 4px 8px rgba(255,255,255,.05); cursor: pointer;
}
#page-affiliates .af-btn-danger-sm:hover { background: #ec0c20; border-color: #e00c1f; }

/* Hộp chuyển hoa hồng vào số dư */
#page-affiliates .af-transfer { margin-top: 20px; padding-top: 20px; border-top: 1px solid #e5ebf5; }
#page-affiliates .af-transfer h6 {
  margin-bottom: 8px; color: #273650;
  font-family: "Plus Jakarta Sans", sans-serif; font-size: 1rem; font-weight: 700; line-height: 1.2;
}
#page-affiliates .af-transfer h6 i { margin-right: 5px; }
#page-affiliates .af-transfer p { margin-bottom: 12px; color: #6a7890; font-size: 13px; line-height: 1.7; }
#page-affiliates .af-transfer-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
#page-affiliates .af-amount-wrap {
  display: flex; align-items: center; flex: 1; min-width: 150px; overflow: hidden;
  border: 1px solid #dfe7f2; border-radius: 10px; background: var(--cg-surface);
}
#page-affiliates .af-amount-wrap input {
  flex: 1; width: 120px; min-width: 0; height: 46px; min-height: 44px;
  padding: .625rem 1.25rem;
  border: 0; border-radius: 12px; outline: 0; background: var(--cg-surface); color: var(--cg-text);
  font-family: inherit; font-size: 14px; line-height: 45px;
}
#page-affiliates .af-amount-wrap input::placeholder { color: var(--cg-muted); }
#page-affiliates .af-amount-wrap:focus-within { border-color: var(--cg-primary); box-shadow: 0 0 0 2px var(--cg-field-ring); }
#page-affiliates .af-unit { padding-right: 12px; color: #6a7890; font-size: 13px; line-height: 1.6; }
#page-affiliates .af-transfer-controls button {
  padding: 9px 14px; border-radius: 9px; font-family: inherit; font-size: 13px; line-height: 1.6;
  white-space: nowrap; cursor: pointer;
}
#page-affiliates .af-transfer-all { border: 1px solid #dbe5fb; background: #f1f5fe; color: #3864c7; }
#page-affiliates .af-transfer-submit { border: 1px solid #3e6fd9; background: #3e6fd9; color: #fff; }
#page-affiliates .af-transfer-submit:hover { background: #315fc1; }
#page-affiliates .af-transfer p.af-transfer-note { margin: 10px 0 0; }
.cg-dark #page-affiliates .af-transfer { border-top-color: var(--cg-line); }
.cg-dark #page-affiliates .af-transfer h6 { color: var(--cg-text); }
.cg-dark #page-affiliates .af-transfer p, .cg-dark #page-affiliates .af-unit { color: var(--cg-muted); }
.cg-dark #page-affiliates .af-amount-wrap { border-color: var(--cg-line); }
.cg-dark #page-affiliates .af-transfer-all { background: var(--cg-blue-soft); border-color: var(--cg-line); color: var(--cg-blue); }

/* ===== Bảng kiểu DataTables: phần riêng của trang (bảng sọc, dòng trống, khung cuộn) ===== */
#page-affiliates .af-header-title b { display: inline; }
#page-affiliates .af-card-table { padding: 0 10px; border-radius: 0 0 14px 14px; overflow-x: auto; }
#page-affiliates .ft-dt { padding: .85rem; }
#page-affiliates .ft-dt-top { align-items: flex-start; }
#page-affiliates .ft-dt-top > div,
#page-affiliates .ft-dt-info { color: var(--cg-muted); font-size: 12px; line-height: 1.6; }
#page-affiliates .ft-dt-top select { width: auto; min-height: 44px; padding-right: 2.25rem; cursor: default; }
#page-affiliates .ft-dt-top input { width: auto; height: 44px; min-height: 44px; }
/* Bảng Rút tiền và Lịch sử của ceoacc: nhãn ô tìm không có lề phải */
#page-affiliates .af-dt-nopad .ft-dt-filter label { padding-right: 0; }
#page-affiliates .ft-dt-table { min-width: 720px; }
@media (min-width: 768px) { #page-affiliates .ft-dt-table { overflow: hidden; } }
#page-affiliates .ft-dt-table thead.af-thead-tint { background: rgba(51,120,255,.05); }
/* table-striped (không có hover): dòng lẻ nền #f7f9fd, chữ đen như bản gốc */
#page-affiliates .ft-dt-table tbody tr:nth-of-type(odd),
#page-affiliates .ft-dt-table tbody tr:nth-of-type(odd):hover { background: var(--cg-soft); color: #000; }
#page-affiliates .ft-dt-table tbody tr:nth-of-type(even):hover { background: transparent; }
.cg-dark #page-affiliates .ft-dt-table tbody tr:nth-of-type(odd) { color: var(--cg-text); }
#page-affiliates .ft-dt-pagination { flex-wrap: nowrap; white-space: nowrap; }
#page-affiliates td.is-plus { color: #19a974; font-weight: 600; }

/* ===== Điện thoại (số đo ceoacc ở khổ 375px) ===== */
@media (max-width: 767.98px) {
  #page-affiliates .af-hero { align-items: flex-start; padding: .9rem; }
  #page-affiliates .af-hero-badges { display: none; }
  #page-affiliates .af-tabs li { flex: 1 1 calc(50% - .35rem); }
  #page-affiliates .af-pane .af-card-body { padding: 1rem; }
  #page-affiliates .af-stat h5 { line-height: 25.1px; }
  #page-affiliates .af-info-row > label, #page-affiliates .af-info-row > div,
  #page-affiliates .af-form-row > label, #page-affiliates .af-form-row > div { flex-basis: 100%; max-width: 100%; }
  #page-affiliates .af-info-row > label, #page-affiliates .af-form-row > label { margin-bottom: .35rem; }
  #page-affiliates .af-control, #page-affiliates .af-amount-wrap input { font-size: 16px; }
  /* DataTables bootstrap4 trong .table-responsive: hai cột xếp chồng; cột đầu (chọn số dòng, dòng thông tin)
     lùi 15px bên phải, cột sau (ô tìm, phân trang) lùi 15px bên trái */
  #page-affiliates .ft-dt-top, #page-affiliates .ft-dt-bottom { flex-wrap: wrap; row-gap: .45rem; }
  #page-affiliates .ft-dt-top > div, #page-affiliates .ft-dt-info, #page-affiliates .ft-dt-pagination { flex: 0 0 calc(100% - 15px); max-width: calc(100% - 15px); }
  #page-affiliates .ft-dt-length, #page-affiliates .ft-dt-info { margin-right: 15px; }
  #page-affiliates .ft-dt-filter { margin-left: 15px; text-align: left; }
  #page-affiliates .ft-dt-filter label { padding-left: 0; }
  #page-affiliates .ft-dt-top label { margin-bottom: .5rem; }
  #page-affiliates .ft-dt-top select, #page-affiliates .ft-dt-top input { font-size: 16px; }
  #page-affiliates .ft-dt-top input { width: 192.5px; margin-left: 8px; }
  #page-affiliates .ft-dt-table { display: inline-table; }
  #page-affiliates .ft-dt-info { padding: 10.2px 0 20px 20px; text-align: center; }
  #page-affiliates .ft-dt-pagination { justify-content: center; margin: 2px 0 2px 15px; padding: 0 20px 20px 0; }
  #page-affiliates .ft-page-link { padding: .5rem .75rem; }
}
@media (max-width: 600px) {
  #page-affiliates :is(.af-hero, .af-tabs-card, .af-card:not(.af-stat)) { border-radius: 20px; }
  #page-affiliates .af-hero h1 { font-size: 22px; }
  #page-affiliates .af-card-header { padding: 14px 16px; border-radius: 19px 19px 0 0; }
  #page-affiliates .af-pane .af-card-body { padding: 16px; }
}
