@font-face { font-family: "Be Vietnam Pro"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/be-vietnam-pro-400.woff2") format("woff2"); }
@font-face { font-family: "Be Vietnam Pro"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/be-vietnam-pro-500.woff2") format("woff2"); }
@font-face { font-family: "Be Vietnam Pro"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/be-vietnam-pro-600.woff2") format("woff2"); }
@font-face { font-family: "Be Vietnam Pro"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/be-vietnam-pro-700.woff2") format("woff2"); }
@font-face { font-family: "Be Vietnam Pro"; font-style: normal; font-weight: 800; font-display: swap; src: url("../fonts/be-vietnam-pro-800.woff2") format("woff2"); }

:root {
  --primary: #5b4cf0;
  --primary-dark: #4235c7;
  --primary-soft: #eeecff;
  --cyan: #13b8c8;
  --orange: #ff8b3d;
  --pink: #f15b9b;
  --ink: #172033;
  --muted: #73809a;
  --bg: #eef1f7;
  --surface: #fff;
  --line: #dfe3ed;
  --success: #12976b;
  --danger: #df4655;
  --warning: #b77912;
  --shadow: 0 14px 34px rgba(43, 48, 82, .1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background:
    radial-gradient(circle at 82% 2%, rgba(91, 76, 240, .08), transparent 25rem),
    var(--bg);
  color: var(--ink);
  font-family: "Be Vietnam Pro", Inter, system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.55;
}
button, input, select, textarea { font: inherit; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* Authentication */
.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #f1efff 0%, #f8fbff 52%, #e8fbff 100%);
}
.auth-page::before, .auth-page::after {
  content: "";
  position: fixed;
  border-radius: 50%;
  filter: blur(2px);
  opacity: .75;
}
.auth-page::before {
  width: 420px; height: 420px; top: -180px; right: -90px;
  background: linear-gradient(135deg, #6c5cf5, #e15ea9);
}
.auth-page::after {
  width: 300px; height: 300px; bottom: -150px; left: -80px;
  background: linear-gradient(135deg, #14c1c9, #6584ff);
}
.auth-card {
  width: min(460px, 100%);
  background: rgba(255,255,255,.94);
  border: 1px solid rgba(255,255,255,.75);
  border-radius: 28px;
  box-shadow: 0 30px 90px rgba(54, 48, 128, .2);
  padding: 38px;
  position: relative;
  z-index: 1;
  backdrop-filter: blur(18px);
}
.auth-card h1 { margin: 24px 0 8px; font-size: 28px; letter-spacing: -.7px; }
.auth-card h1::after {
  content: "Chào mừng bạn quay trở lại";
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0;
  margin-top: 6px;
}
.auth-page:has(input[name="name"]) .auth-card h1::after { content: "Tạo tài khoản để bắt đầu nhận cashback"; }
.auth-card form { margin-top: 24px; }
.auth-card > p { text-align: center; margin: 22px 0 0; }
.register-page .terms-label { display: flex; align-items: center; gap: 7px; }
.register-page .terms-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-height: 16px;
  padding: 0;
  margin: 0;
  flex: 0 0 16px;
  transition: none;
  transform: none;
  box-shadow: none;
}
.register-page .terms-label input[type="checkbox"]:hover,
.register-page .terms-label input[type="checkbox"]:focus,
.register-page .terms-label input[type="checkbox"]:active {
  transform: none;
  box-shadow: none;
  background: initial;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -.5px;
  color: var(--primary);
}
.brand-logo {
  width: 38px;
  height: 38px;
  display: block;
  flex: 0 0 38px;
  object-fit: contain;
  border-radius: 11px;
  box-shadow: 0 8px 20px rgba(91,76,240,.3);
}
.auth-card .brand {
  display: flex;
  justify-content: center;
  font-size: 22px;
}
.auth-card .brand-logo {
  width: 52px;
  height: 52px;
  flex-basis: 52px;
  border-radius: 15px;
}

/* Application shell */
.layout { min-height: 100vh; display: grid; grid-template-columns: 272px 1fr; }
.sidebar {
  color: #d9def0;
  padding: 22px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  z-index: 20;
  background:
    radial-gradient(circle at 15% 85%, rgba(105,83,255,.25), transparent 18rem),
    linear-gradient(180deg, #171a32 0%, #111427 100%);
  box-shadow: 10px 0 40px rgba(19,21,42,.08);
}
.sidebar .brand { color: #fff; padding: 2px 10px 25px; display: flex; }
.sidebar .brand-logo { width: 42px; height: 42px; flex-basis: 42px; }
.nav-section { margin: 14px 11px 7px; color: #747d9d; font-size: 10px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; }
.sidebar a:not(.brand) {
  color: #adb5d0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 13px;
  margin: 4px 0;
  border-radius: 12px;
  font-weight: 500;
  transition: .2s ease;
}
.sidebar a:not(.brand)::before {
  content: attr(data-icon);
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  font-size: 16px;
}
.sidebar a:not(.brand):hover { color: #fff; background: rgba(255,255,255,.07); transform: translateX(2px); }
.sidebar a.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(115,98,255,.95), rgba(91,76,240,.8));
  box-shadow: 0 9px 24px rgba(66,53,199,.32);
}
.main { min-width: 0; }
.topbar {
  height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 15;
  background: rgba(255,255,255,.84);
  border-bottom: 1px solid rgba(224,226,237,.8);
  backdrop-filter: blur(14px);
}
.topbar-context { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.topbar-context::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #29c98b; box-shadow: 0 0 0 4px #dff8ef; }
.user-menu { display: flex; align-items: center; gap: 11px; }
.notification-link { position: relative; color: var(--muted); padding: 8px; }
.notification-link span {
  position: absolute; top: 0; right: 0; min-width: 17px; height: 17px;
  display: grid; place-items: center; padding: 0 4px; border-radius: 999px;
  background: var(--danger); color: #fff; font-size: 9px; font-weight: 800;
}
.notification-item { display: flex; justify-content: space-between; gap: 16px; }
.notification-item.unread { border-left: 4px solid var(--primary); }
.notification-item h3 { margin: 0 0 5px; font-size: 15px; }
.notification-item p { margin: 0; color: var(--muted); }
.notification-read-button {
  width: 88px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  flex: 0 0 88px;
  align-self: flex-start;
  white-space: nowrap;
}
.important-inline-label,
.important-notification-label {
  display: inline-block;
  margin-right: 8px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #fff0d9;
  color: #a85d00;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .4px;
}
.important-notification-modal { border-top: 5px solid #f59e0b; }
.important-notification-modal > p {
  margin-top: 14px;
  color: var(--text);
  line-height: 1.65;
  white-space: pre-wrap;
}
.important-notification-modal > small { color: var(--muted); }
.important-notification-modal .actions { margin-top: 22px; }
.get-link-tutorial-modal {
  position: relative;
  width: min(620px, 100%);
  padding: 30px;
  overflow: hidden;
}
.tutorial-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 22px;
  line-height: 1;
}
.tutorial-progress {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
  padding-right: 42px;
  margin-bottom: 26px;
}
.tutorial-progress span {
  height: 5px;
  border-radius: 999px;
  background: var(--line);
  transition: background .2s ease;
}
.tutorial-progress span.active { background: var(--primary); }
.tutorial-step-icon {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  margin-bottom: 14px;
  border-radius: 16px;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--pink));
  box-shadow: 0 10px 24px rgba(91, 76, 240, .24);
  font-size: 20px;
  font-weight: 800;
}
.tutorial-eyebrow {
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .6px;
}
.get-link-tutorial-modal h3 {
  margin: 5px 0 12px;
  font-size: 23px;
}
.tutorial-content { color: var(--muted); }
.tutorial-content > p { margin: 0 0 12px; }
.tutorial-content b,
.tutorial-content strong { color: var(--ink); }
.tutorial-tip,
.tutorial-warning,
.tutorial-preview {
  margin: 10px 0;
  padding: 12px 14px;
  border-radius: 12px;
}
.tutorial-tip { background: #f5f6fa; }
.tutorial-warning {
  color: #8a5707;
  background: #fff6df;
  border: 1px solid #f4dfaa;
}
.tutorial-note { font-size: 12px; }
.tutorial-preview {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 7px 10px;
  background: #f5f3ff;
  border: 1px solid #ded9ff;
}
.tutorial-preview span { grid-column: 1 / -1; color: var(--ink); font-size: 11px; font-weight: 700; }
.tutorial-preview div { min-width: 0; padding: 9px 11px; overflow: hidden; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--muted); white-space: nowrap; }
.tutorial-preview > b { padding: 9px 13px; border-radius: 9px; background: var(--primary); color: #fff; }
.tutorial-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 22px;
  margin-top: 20px;
  border-top: 1px solid var(--line);
}
.tutorial-navigation { display: flex; gap: 9px; }
.tutorial-navigation button[hidden] { display: none; }
.avatar {
  width: 38px; height: 38px; display: grid; place-items: center;
  border-radius: 12px; color: #fff; font-weight: 700;
  background: linear-gradient(135deg, var(--primary), var(--pink));
}
.user-meta { line-height: 1.25; }
.user-meta strong { display: block; font-size: 13px; }
.user-meta span { color: var(--muted); font-size: 11px; }
.mobile-toggle { display: none; padding: 8px 10px; background: var(--primary-soft); color: var(--primary); }

.content { max-width: 1500px; padding: 30px 34px 48px; margin: auto; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 18px; margin-bottom: 24px; }
.page-title { margin: 0; font-size: 27px; line-height: 1.25; letter-spacing: -.7px; }
.page-subtitle { margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Cards */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 17px;
  margin-bottom: 24px;
}
.card, .panel {
  background: var(--surface);
  border: 1px solid rgba(216, 221, 233, .95);
  border-radius: 18px;
  padding: 21px;
  box-shadow: var(--shadow);
}
.card { position: relative; overflow: hidden; transition: transform .2s, box-shadow .2s; }
.card:hover { transform: translateY(-2px); box-shadow: 0 22px 50px rgba(43,48,82,.12); }
.card::after {
  content: "";
  position: absolute;
  width: 84px; height: 84px; border-radius: 50%;
  right: -28px; top: -30px;
  background: var(--card-soft, var(--primary-soft));
}
.card:nth-child(4n+1) { --card-color: var(--primary); --card-soft: #ece9ff; }
.card:nth-child(4n+2) { --card-color: var(--cyan); --card-soft: #e2fafa; }
.card:nth-child(4n+3) { --card-color: var(--orange); --card-soft: #fff0e5; }
.card:nth-child(4n+4) { --card-color: var(--pink); --card-soft: #ffe8f2; }
.metric-icon {
  width: 40px; height: 40px; display: grid; place-items: center;
  border-radius: 12px; margin-bottom: 17px;
  color: var(--card-color); font-size: 18px; font-weight: 800;
  background: var(--card-soft);
}
.metric-label { color: var(--muted); font-size: 12px; font-weight: 600; }
.metric-value { font-size: 24px; font-weight: 800; letter-spacing: -.5px; margin-top: 4px; }
.metric-note { color: var(--muted); font-size: 11px; margin-top: 8px; }
.panel { margin-bottom: 18px; }

/* Forms and controls */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.section-title { margin: 0 0 5px; font-size: 18px; }
.input-action { display: flex; align-items: stretch; gap: 8px; }
.input-action input { min-width: 0; }
.input-action button { flex: 0 0 auto; white-space: nowrap; }
label { font-size: 12px; font-weight: 700; display: block; margin-bottom: 8px; color: #3b455b; }
input, select, textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid #dfe2ec;
  border-radius: 11px;
  padding: 10px 13px;
  color: var(--ink);
  background: #fbfcfe;
  outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
input:not([type="checkbox"]):hover, select:hover, textarea:hover { border-color: #bfc5d8; background: #fff; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(91,76,240,.1); background: #fff; }
input[type="checkbox"] { min-height: 0; accent-color: var(--primary); }
.password-field { position: relative; }
.password-field input { padding-right: 48px; }
.password-toggle {
  position: absolute;
  top: 50%;
  right: 5px;
  width: 38px;
  min-height: 36px;
  padding: 0;
  color: var(--muted);
  background: transparent;
  transform: translateY(-50%);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.password-toggle:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}
.password-toggle svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
button, .btn {
  border: 0;
  border-radius: 11px;
  min-height: 40px;
  padding: 9px 15px;
  cursor: pointer;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: transform .18s, box-shadow .18s, opacity .18s;
}
button:hover, .btn:hover { transform: translateY(-1px); }
.register-page button:hover, .register-page .btn:hover { transform: none; }
button:disabled { cursor: not-allowed; opacity: .5; transform: none; }
button.password-toggle,
button.password-toggle:hover,
button.password-toggle:active {
  transform: translateY(-50%);
}
button.password-toggle:hover {
  color: var(--primary);
  background: var(--primary-soft);
}
.btn-primary { background: linear-gradient(135deg, #6657f5, #5041dd); color: #fff; box-shadow: 0 8px 18px rgba(91,76,240,.23); }
.btn-secondary { background: #f0f1f7; color: #45516c; }
.btn-danger { background: #ffebee; color: var(--danger); }
.btn-success { background: #e1f8ef; color: var(--success); }
.btn-icon { width: 40px; padding: 0; }
.actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.inline-action { display: flex; align-items: center; gap: 7px; min-width: 190px; }
.inline-action select { min-height: 38px; padding: 7px 30px 7px 10px; font-size: 12px; }
.inline-action button { min-height: 38px; white-space: nowrap; }
.commission-percent-input { width: 110px; min-height: 38px; }
.commission-create-panel h3, .commission-setting-heading p { margin: 0; }
.commission-setting-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
}
.commission-setting-heading h3 { margin-bottom: 5px; }
.commission-split-example {
  min-width: 290px;
  padding: 13px 15px;
  border-radius: 12px;
  background: #f5f3ff;
}
.commission-split-example span, .commission-split-example small {
  display: block;
  color: var(--muted);
  font-size: 11px;
}
.commission-split-example strong { display: block; margin: 4px 0; font-size: 13px; }
.commission-create-actions { display: flex; align-items: flex-end; justify-content: flex-end; gap: 12px; }
.referral-setting-panel, .referral-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.referral-setting-panel h3, .referral-summary h3 { margin: 0 0 5px; }
.referral-setting-panel p, .referral-summary p { margin: 0; }
.referral-setting-controls { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.referral-setting-controls label { margin: 0; }
.referral-setting-controls input[type="number"] { width: 140px; margin-top: 7px; }
.checkbox-label { display: flex; align-items: center; gap: 7px; min-height: 40px; }
.checkbox-label input { width: auto; }
.referral-metrics { margin: 20px 0; }
.cashflow-panel h3 { margin: 0 0 16px; }
.cashflow-panel.table-panel h3 { margin: 0; padding: 21px 21px 0; }

/* Tables */
.table-panel { padding: 0; overflow: hidden; }
.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 17px 19px;
  border-bottom: 1px solid var(--line);
}
.table-toolbar-title { font-size: 14px; font-weight: 700; }
.table-count { color: var(--muted); font-size: 12px; margin-left: 5px; }
.table-search { width: min(280px, 100%); min-height: 39px; background: #f7f8fb; }
.table-wrap { overflow: auto; }
.table-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}
.table-pagination .disabled { pointer-events: none; opacity: .45; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { padding: 14px 12px; border-bottom: 1px solid #eef0f5; text-align: left; white-space: nowrap; vertical-align: middle; }
th { color: #8992a7; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .65px; background: #fafbfc; }
tbody tr { transition: background .18s; }
tbody tr:hover { background: #faf9ff; }
tbody tr:last-child td { border-bottom: 0; }
.original-url-link {
  display: inline-block !important;
  width: 220px !important;
  max-width: 220px !important;
  overflow: hidden !important;
  color: inherit;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  vertical-align: middle;
}
body[data-page="my-links"] #data-table th:nth-child(2),
body[data-page="my-links"] #data-table td:nth-child(2),
body[data-page="admin-links"] #data-table th:nth-child(2),
body[data-page="admin-links"] #data-table td:nth-child(2) {
  width: 244px;
  max-width: 244px;
  overflow: hidden;
}
.original-url-link:hover { color: var(--primary); text-decoration: underline; }
body[data-page="admin-audit-logs"] #data-table {
  table-layout: fixed;
  min-width: 860px;
}
body[data-page="admin-audit-logs"] #data-table th:nth-child(1) { width: 122px; }
body[data-page="admin-audit-logs"] #data-table th:nth-child(2) { width: 62px; }
body[data-page="admin-audit-logs"] #data-table th:nth-child(3) { width: 185px; }
body[data-page="admin-audit-logs"] #data-table th:nth-child(4) { width: 118px; }
body[data-page="admin-audit-logs"] #data-table th:nth-child(5) { width: 56px; }
body[data-page="admin-audit-logs"] #data-table th:nth-child(6),
body[data-page="admin-audit-logs"] #data-table td:nth-child(6) {
  width: auto;
  min-width: 0;
}
body[data-page="admin-audit-logs"] #data-table th:nth-child(7) { width: 128px; }
.audit-detail-preview {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 7px 9px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 7px;
  background: #f7f8fb;
  color: var(--ink);
  font: inherit;
  line-height: 1.4;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.audit-detail-preview:hover,
.audit-detail-preview:focus-visible {
  border-color: #d8d3ff;
  background: var(--primary-soft);
  color: var(--primary);
}
.audit-detail-modal {
  width: min(720px, 100%);
}
.audit-detail-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.audit-detail-heading h3,
.audit-detail-heading p {
  margin: 0;
}
.audit-detail-heading p { margin-top: 5px; }
.audit-detail-close {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 22px;
  line-height: 1;
}
.audit-detail-modal pre {
  max-height: min(58vh, 520px);
  margin: 0 0 18px;
  overflow: auto;
  overflow-wrap: anywhere;
}
body[data-page="admin-withdrawals"] #data-table {
  table-layout: fixed;
  min-width: 1080px;
}
body[data-page="admin-withdrawals"] #data-table th:nth-child(1) { width: 58px; }
body[data-page="admin-withdrawals"] #data-table th:nth-child(2) { width: 118px; }
body[data-page="admin-withdrawals"] #data-table th:nth-child(3) { width: 112px; }
body[data-page="admin-withdrawals"] #data-table th:nth-child(4) { width: 150px; }
body[data-page="admin-withdrawals"] #data-table th:nth-child(5) { width: 105px; }
body[data-page="admin-withdrawals"] #data-table th:nth-child(6),
body[data-page="admin-withdrawals"] #data-table th:nth-child(7) { width: 112px; }
body[data-page="admin-withdrawals"] #data-table th:nth-child(8) { width: auto; }
body[data-page="admin-withdrawals"] #data-table td:nth-child(8) {
  min-width: 0;
  overflow: hidden;
}
body[data-page="admin-withdrawals"] #data-table th:nth-child(9) { width: 220px; }
.withdrawal-note-preview {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 7px 9px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 7px;
  background: #f7f8fb;
  color: var(--ink);
  font: inherit;
  line-height: 1.4;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.withdrawal-note-preview:hover,
.withdrawal-note-preview:focus-visible {
  border-color: #d8d3ff;
  background: var(--primary-soft);
  color: var(--primary);
}
.withdrawal-note-modal { width: min(640px, 100%); }
.withdrawal-note-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.withdrawal-note-heading h3,
.withdrawal-note-heading p { margin: 0; }
.withdrawal-note-heading p { margin-top: 5px; }
.withdrawal-note-close {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 22px;
  line-height: 1;
}
.withdrawal-note-content {
  max-height: min(50vh, 420px);
  margin-bottom: 18px;
  padding: 16px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f7f8fb;
  line-height: 1.7;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
body[data-page="wallet"] #data-table {
  table-layout: fixed;
  min-width: 820px;
}
body[data-page="wallet"] #data-table th:nth-child(1) { width: 165px; }
body[data-page="wallet"] #data-table th:nth-child(2),
body[data-page="wallet"] #data-table th:nth-child(3),
body[data-page="wallet"] #data-table th:nth-child(4) { width: 130px; }
body[data-page="wallet"] #data-table th:nth-child(5) { width: auto; }
body[data-page="wallet"] #data-table th:nth-child(6) { width: 125px; }
body[data-page="earnings"] #data-table {
  table-layout: fixed;
  min-width: 650px;
}
body[data-page="earnings"] #data-table th:nth-child(1) { width: 165px; }
body[data-page="earnings"] #data-table th:nth-child(2) { width: 140px; }
body[data-page="earnings"] #data-table th:nth-child(3) { width: auto; }
body[data-page="earnings"] #data-table th:nth-child(4) { width: 125px; }
body[data-page="wallet"] #data-table td:nth-child(5),
body[data-page="earnings"] #data-table td:nth-child(3) {
  min-width: 0;
  overflow: hidden;
}
.transaction-note-preview {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 7px 9px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 7px;
  background: #f7f8fb;
  color: var(--ink);
  font: inherit;
  line-height: 1.4;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.transaction-note-preview:hover,
.transaction-note-preview:focus-visible {
  border-color: #d8d3ff;
  background: var(--primary-soft);
  color: var(--primary);
}
.transaction-note-modal { width: min(640px, 100%); }
.transaction-note-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.transaction-note-heading h3,
.transaction-note-heading p { margin: 0; }
.transaction-note-heading p { margin-top: 5px; }
.transaction-note-close {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 22px;
  line-height: 1;
}
.transaction-note-content {
  max-height: min(50vh, 420px);
  margin-bottom: 18px;
  padding: 16px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f7f8fb;
  line-height: 1.7;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.empty-state { text-align: center; padding: 42px !important; color: var(--muted); }
.empty-state::before { content: "◇"; display: block; font-size: 34px; color: #bfc4d4; margin-bottom: 7px; }
.loading-row td { height: 96px; color: var(--muted); text-align: center; }
.loading-row .spinner { display: inline-block; margin-right: 8px; vertical-align: middle; }
.skeleton-card { pointer-events: none; }
.skeleton {
  display: block;
  border-radius: 8px;
  background: linear-gradient(90deg, #eef0f5 25%, #f8f9fc 50%, #eef0f5 75%);
  background-size: 200% 100%;
  animation: skeletonPulse 1.2s ease-in-out infinite;
}
.skeleton-icon { width: 40px; height: 40px; margin-bottom: 17px; border-radius: 12px; }
.skeleton-line { width: 48%; height: 11px; }
.skeleton-value { width: 70%; height: 28px; margin-top: 10px; }

.badge { padding: 5px 9px; border-radius: 999px; font-size: 10px; font-weight: 700; background: #edf0f5; color: #5e687d; text-transform: capitalize; }
.badge.pending, .badge.approved { color: #98640a; background: #fff2d4; }
.badge.confirmed, .badge.active, .badge.completed { color: #087757; background: #dcf8ed; }
.badge.rejected, .badge.blacklisted, .badge.deleted { color: #bf3042; background: #ffe5e9; }
.badge.paid { color: #6840c2; background: #eee7ff; }
.badge.disabled, .badge.suspended { color: #687085; background: #e9ecf2; }

/* Feedback and helpers */
.notice { padding: 13px 15px; border-radius: 11px; margin: 0 0 18px; display: none; border: 1px solid transparent; }
.notice.show { display: block; animation: slideDown .25s ease; }
.notice.error { background: #fff0f2; color: #ae293a; border-color: #ffd6dc; }
.notice.success { background: #e9faf4; color: #087557; border-color: #c8f1e2; }
.muted { color: var(--muted); }
.money { font-variant-numeric: tabular-nums; font-weight: 700; }
.result-box { margin-top: 20px; padding: 18px; border: 1px dashed #988cff; border-radius: 14px; background: #f8f7ff; }
.link-loading { display: none; align-items: center; gap: 10px; margin-top: 18px; color: var(--muted); font-weight: 600; }
.link-loading.show { display: flex; }
.spinner {
  width: 20px;
  height: 20px;
  border: 3px solid #ddd9ff;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .75s linear infinite;
}
.button-spinner {
  width: 16px;
  height: 16px;
  border-width: 2px;
  border-color: rgba(255,255,255,.4);
  border-top-color: #fff;
}
.copy-row { display: flex; gap: 8px; align-items: center; margin: 10px 0; }
.copy-row input { flex: 1; }
.admin-accent { border-left: 4px solid var(--primary); }
.dashboard-guide {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 27px 29px;
  color: #fff;
  border: 0;
  background:
    radial-gradient(circle at 82% 20%, rgba(255,255,255,.18), transparent 10rem),
    linear-gradient(125deg, #302879, #5b4cf0 55%, #9b55df);
}
.guide-copy h2 { margin: 5px 0 5px; font-size: 21px; }
.guide-copy p { margin: 0; color: #dedaff; }
.guide-kicker { color: #bff7ff; font-size: 10px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; }
.guide-actions { display: flex; gap: 9px; flex-shrink: 0; }
.dashboard-guide .btn-primary { background: #fff; color: var(--primary); }
.dashboard-guide .btn-secondary { background: rgba(255,255,255,.13); color: #fff; }
.row-actions { display: flex; gap: 7px; }
.profile-card { display: flex; align-items: center; gap: 15px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.profile-card h2, .profile-card p { margin: 0; }
.profile-avatar {
  width: 58px; height: 58px; display: grid; place-items: center;
  border-radius: 17px; color: #fff; font-size: 18px; font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--pink));
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.profile-identity { min-width: 0; flex: 1; }
.avatar-form { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-top: 12px; }
.avatar-form .muted { font-size: 11px; }
.avatar-form .disabled { pointer-events: none; opacity: .55; }
.profile-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; padding-top: 20px; }
.profile-grid span { display: block; color: var(--muted); font-size: 11px; margin-bottom: 4px; }
.profile-grid strong { font-size: 13px; }
.profile-security { display: grid; grid-template-columns: minmax(220px,.8fr) minmax(320px,1.2fr); gap: 30px; padding-top: 25px; margin-top: 25px; border-top: 1px solid var(--line); }
.profile-security h2 { margin: 0 0 5px; font-size: 18px; }
.profile-security p { margin: 0; }
.profile-password-form { display: grid; gap: 14px; }
.profile-password-form label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 600; }
.profile-password-form button { justify-self: start; }
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center; padding: 20px;
  background: rgba(17,20,39,.55); backdrop-filter: blur(5px);
}
.modal-card {
  width: min(460px,100%); padding: 25px;
  border-radius: 20px; background: #fff;
  box-shadow: 0 30px 90px rgba(17,20,39,.28);
  animation: slideDown .2s ease;
}
.modal-card h3 { margin: 0 0 5px; font-size: 19px; }
.modal-card p { margin: 0 0 17px; }
.modal-card .actions { justify-content: flex-end; }
.wallet-adjustment-modal form { display: grid; gap: 14px; }
.wallet-adjustment-modal label { margin: 0; }
.wallet-adjustment-modal input,
.wallet-adjustment-modal select,
.wallet-adjustment-modal textarea { margin-top: 7px; }
pre { white-space: pre-wrap; overflow: auto; padding: 16px; border-radius: 12px; background: #171a2e; color: #dbe1ff; font-size: 12px; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-5px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes skeletonPulse { to { background-position: -200% 0; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}

@media (max-width: 1000px) {
  .layout { grid-template-columns: 230px 1fr; }
  .content { padding: 26px 24px 42px; }
}
@media (max-width: 800px) {
  .layout { display: block; }
  .sidebar { position: fixed; left: -280px; width: 270px; transition: left .25s ease; }
  body.nav-open .sidebar { left: 0; }
  body.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(17,20,39,.45); z-index: 19; }
  .mobile-toggle { display: inline-flex; }
  .topbar { height: 66px; padding: 0 17px; }
  .topbar-context { display: none; }
  .user-meta { display: none; }
  .content { padding: 22px 16px 40px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .page-title { font-size: 23px; }
  .get-link-tutorial-modal { padding: 23px 19px 19px; }
  .get-link-tutorial-modal h3 { font-size: 20px; }
  .tutorial-progress { margin-bottom: 20px; }
  .tutorial-footer { align-items: stretch; flex-direction: column-reverse; }
  .tutorial-navigation { display: grid; grid-template-columns: auto 1fr; }
  .tutorial-footer > button,
  .tutorial-navigation button { justify-content: center; }
  .form-grid { grid-template-columns: 1fr; }
  .cards { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .table-toolbar { align-items: stretch; flex-direction: column; }
  .table-search { width: 100%; }
  .table-panel { overflow: visible; border: 0; background: transparent; box-shadow: none; }
  .table-panel .table-toolbar,
  .table-panel .table-pagination {
    border: 1px solid rgba(216, 221, 233, .95);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: var(--shadow);
  }
  .table-panel .table-toolbar { margin-bottom: 12px; }
  .table-panel .table-pagination {
    justify-content: space-between;
    flex-wrap: wrap;
    margin-top: 12px;
  }
  .responsive-table,
  .responsive-table tbody,
  .responsive-table tr,
  .responsive-table td { display: block; width: 100%; }
  .responsive-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
  .responsive-table tbody { display: grid; gap: 12px; }
  .responsive-table tbody tr {
    padding: 7px 15px;
    border: 1px solid rgba(216, 221, 233, .95);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: 0 8px 24px rgba(43, 48, 82, .08);
  }
  .responsive-table tbody tr:hover { background: var(--surface); }
  .responsive-table td {
    display: grid;
    width: 100% !important;
    max-width: none !important;
    grid-template-columns: minmax(92px, 34%) minmax(0, 1fr);
    gap: 12px;
    align-items: start;
    padding: 10px 0;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .responsive-table td::before {
    content: attr(data-label);
    color: #8992a7;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.55;
    text-transform: uppercase;
    letter-spacing: .55px;
  }
  .responsive-table td:last-child { border-bottom: 0; }
  .responsive-table .empty-state {
    display: block;
    padding: 32px 12px !important;
  }
  .responsive-table .empty-state::before {
    content: "\25C7";
    color: #bfc4d4;
    font-size: 34px;
    font-weight: 400;
    text-transform: none;
  }
  .responsive-table .original-url-link {
    width: auto !important;
    max-width: 100% !important;
    white-space: normal !important;
    overflow-wrap: anywhere;
  }
  .responsive-table .row-actions,
  .responsive-table .inline-action {
    min-width: 0;
    flex-wrap: wrap;
  }
  .responsive-table .inline-action select { min-width: 140px; flex: 1; }
  body[data-page="admin-users"] .responsive-table td,
  body[data-page="admin-links"] .responsive-table td,
  body[data-page="admin-orders"] .responsive-table td,
  body[data-page="admin-withdrawals"] .responsive-table td,
  body[data-page="admin-commission-settings"] .responsive-table td,
  body[data-page="admin-audit-logs"] .responsive-table td {
    overflow: visible !important;
  }
  body[data-page="admin-users"] .responsive-table button,
  body[data-page="admin-links"] .responsive-table button,
  body[data-page="admin-orders"] .responsive-table button,
  body[data-page="admin-withdrawals"] .responsive-table button,
  body[data-page="admin-commission-settings"] .responsive-table button,
  body[data-page="admin-audit-logs"] .responsive-table button { max-width: 100%; }
  body[data-page="admin-audit-logs"] .responsive-table td { grid-template-columns: minmax(84px, 28%) minmax(0, 1fr); }
  body[data-page="admin-audit-logs"] .responsive-table td:nth-child(6),
  body[data-page="admin-links"] .responsive-table td:nth-child(2),
  body[data-page="admin-links"] .responsive-table td:nth-child(3) {
    grid-template-columns: 1fr;
    gap: 5px;
  }
  body[data-page="admin-audit-logs"] #data-table {
    min-width: 0;
    table-layout: auto;
  }
  body[data-page="admin-withdrawals"] #data-table {
    min-width: 0;
    table-layout: auto;
  }
  body[data-page="wallet"] #data-table,
  body[data-page="earnings"] #data-table {
    min-width: 0;
    table-layout: auto;
  }
  body[data-page="wallet"] #data-table td:nth-child(5),
  body[data-page="earnings"] #data-table td:nth-child(3) {
    width: 100%;
    max-width: 100%;
  }
  body[data-page="wallet"] .transaction-note-preview,
  body[data-page="earnings"] .transaction-note-preview {
    width: 100%;
    max-width: 100%;
  }
  body[data-page="admin-withdrawals"] #data-table td:nth-child(8) {
    width: 100%;
    max-width: 100%;
  }
  body[data-page="admin-withdrawals"] .withdrawal-note-preview {
    width: 100%;
    max-width: 100%;
  }
  body[data-page="admin-audit-logs"] #data-table td:nth-child(6) {
    width: 100%;
    max-width: 100%;
  }
  body[data-page="admin-audit-logs"] .audit-detail-preview {
    width: 100%;
    max-width: 100%;
  }
  body[data-page="admin-links"] .responsive-table td:nth-child(3) {
    color: var(--primary);
    font-weight: 600;
  }
  body[data-page="admin-orders"] .responsive-table .inline-action,
  body[data-page="admin-users"] .responsive-table .inline-action,
  body[data-page="admin-links"] .responsive-table .inline-action {
    align-items: stretch;
    flex-direction: column;
    width: 100%;
  }
  body[data-page="admin-orders"] .responsive-table .inline-action select,
  body[data-page="admin-users"] .responsive-table .inline-action select,
  body[data-page="admin-links"] .responsive-table .inline-action select,
  body[data-page="admin-orders"] .responsive-table .inline-action button,
  body[data-page="admin-users"] .responsive-table .inline-action button,
  body[data-page="admin-links"] .responsive-table .inline-action button {
    width: 100%;
  }
  .dashboard-guide { align-items: flex-start; flex-direction: column; }
  .commission-setting-heading { flex-direction: column; }
  .commission-split-example { min-width: 0; width: 100%; }
  .commission-create-actions { justify-content: flex-start; }
  .referral-setting-panel, .referral-summary { align-items: flex-start; flex-direction: column; }
  .profile-grid { grid-template-columns: 1fr; }
  .profile-security { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .auth-page { padding: 16px; }
  .auth-card { padding: 27px 22px; border-radius: 22px; }
  .cards { grid-template-columns: 1fr; }
  .copy-row { align-items: stretch; flex-direction: column; }
  .input-action { align-items: stretch; flex-direction: column; }
  .profile-card { align-items: flex-start; }
  .avatar-form { align-items: stretch; flex-direction: column; }
  .avatar-form .btn { text-align: center; }
  body[data-page="admin-commission-settings"] .commission-create-actions,
  body[data-page="admin-commission-settings"] .referral-setting-controls {
    align-items: stretch;
    flex-direction: column;
    width: 100%;
  }
  body[data-page="admin-commission-settings"] .referral-setting-controls label,
  body[data-page="admin-commission-settings"] .referral-setting-controls input[type="number"],
  body[data-page="admin-commission-settings"] .commission-create-actions button,
  body[data-page="admin-commission-settings"] .referral-setting-controls button {
    width: 100%;
  }
  body[data-page="admin-commission-settings"] .commission-percent-input { width: 100%; }
  body:is(
    [data-page="admin-users"],
    [data-page="admin-links"],
    [data-page="admin-orders"],
    [data-page="admin-withdrawals"],
    [data-page="admin-commission-settings"],
    [data-page="admin-audit-logs"]
  ) .table-pagination .btn { flex: 1; }
  body:is(
    [data-page="admin-users"],
    [data-page="admin-links"],
    [data-page="admin-orders"],
    [data-page="admin-withdrawals"],
    [data-page="admin-commission-settings"],
    [data-page="admin-audit-logs"]
  ) .table-pagination span {
    order: -1;
    width: 100%;
    text-align: center;
  }
}
