/* Design system dùng chung cho toàn bộ trang web portal khách (public/portal/*.html). */

:root {
  --bg: #F6F7F9;
  --card: #ffffff;
  --border: #EAEAEE;
  --text: #1a1a1a;
  --text-secondary: #666666;
  --text-muted: #999999;
  --accent: #F5793C;
  --accent-dark: #D9631F;
  --accent-tint: #FFF1E6;
  --accent-tint-strong: #FFE0C7;
  --shadow: 0 3px 14px rgba(0, 0, 0, 0.09);
  --shadow-md: 0 4px 24px rgba(0, 0, 0, 0.08);
  --shadow-accent: 0 6px 18px rgba(245, 121, 60, 0.32);
  --radius: 16px;
  --radius-sm: 10px;
  --input-bg: #ffffff;
  --ok-bg: #eefaf0;
  --ok-border: #b8e6c0;
  --ok-text: #1a7a3a;
  --err-bg: #fef0ef;
  --err-border: #f5c2be;
  --err-text: #c0392b;
  /* Khớp màu trạng thái đơn với /my-orders.html (trang public khác) — "Đang chờ" phải đọc là
     VÀNG/hổ phách, không phải cam (accent cam của portal quá gần đỏ, dễ lẫn với "Đã huỷ"). */
  --warn-bg: #fff8e6;
  --warn-border: #f5dfa0;
  --warn-text: #d98600;
  --neutral-bg: #f2f3f5;
  --neutral-border: #dfe1e5;
  --neutral-text: #6b7280;
}

[data-theme="dark"] {
  --bg: #15171c;
  --card: #1f2229;
  --border: #2b2f38;
  --text: #e8e8ea;
  --text-secondary: #a8a8ad;
  --text-muted: #7a7a80;
  --accent: #FF9A5C;
  --accent-dark: #F5793C;
  --accent-tint: #3a2a1c;
  --accent-tint-strong: #4d3524;
  --shadow: 0 3px 14px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 24px rgba(0, 0, 0, 0.5);
  --shadow-accent: 0 6px 20px rgba(255, 154, 92, 0.4);
  --input-bg: #262a32;
  --ok-bg: #123420;
  --ok-border: #1f5c37;
  --ok-text: #5fd68a;
  --err-bg: #3a1a18;
  --err-border: #6b2b26;
  --err-text: #ff8b80;
  --warn-bg: #2e2410;
  --warn-border: #5c4a1f;
  --warn-text: #e6b04d;
  --neutral-bg: #26282e;
  --neutral-border: #3a3d44;
  --neutral-text: #9aa0a6;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: background 0.15s, color 0.15s;
}

/* ── Header / nav ─────────────────────────────────────────────────────── */

header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 45;
  background: var(--card);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  box-shadow: var(--shadow);
  border-bottom: 1px solid var(--border);
}

/* header cố định (position:fixed) nên không còn chiếm chỗ trong flow — bù bằng padding-top,
   đo chiều cao thật của header bằng JS (portal-header.js, ResizeObserver) vì header cao thấp
   khác nhau tuỳ độ rộng màn hình (nav wrap xuống hàng ở 721-900px, ẩn hẳn ở ≤720px). */
body { padding-top: var(--header-height, 70px); }
/* Trang không có header/bottom-nav (login) không được bù padding, nếu không sẽ dư
   khoảng trống trên đầu và đẩy layout min-height:100vh tràn xuống dưới màn hình. */
body.no-chrome { padding-top: 0; }

header .brand {
  font-weight: 700;
  font-size: 18px;
  text-decoration: none;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  min-width: 0;
}
header .brand #brandIcon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
  font-weight: 900;
  overflow: hidden;
}
/* Logo tuỳ khách upload có thể không vuông (banner ngang...) — nếu ép vừa khung 30x30 vuông
   bằng object-fit:cover sẽ bị cắt xén xấu. Khi có ảnh thật, bỏ ép vuông: chỉ giới hạn CHIỀU CAO
   theo đúng khung header, chiều rộng tự co giãn theo tỉ lệ gốc (object-fit:contain, không cắt). */
header .brand #brandIcon:has(img) {
  width: auto;
  max-width: 120px;
  padding: 0 2px;
}
header .brand #brandIcon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
header .brand #brandIcon:has(img) img {
  width: auto;
  max-width: 100%;
  object-fit: contain;
}
/* Tên thương hiệu tuỳ khách cấu hình (có thể dài, hoặc sau này chỉ còn logo) — luôn giới hạn
   width + ellipsis, không để phá layout header dù dài bao nhiêu. */
header .brand-text {
  display: inline-block;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}
header nav {
  flex: 1;
  margin-left: 20px;
  display: flex;
  flex-wrap: nowrap;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}
header nav::-webkit-scrollbar { display: none; }
header nav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
}
header nav a.active { background: var(--accent-tint); color: var(--accent-dark); }
header nav a:hover:not(.active) { background: var(--bg); }

/* Icon SVG đơn sắc (portal-icons.js) — inline theo màu chữ của phần tử cha (currentColor). */
.icon { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.icon svg { display: block; }

.icon-btn {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-secondary);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 15px;
  flex-shrink: 0;
  box-shadow: var(--shadow);
}
.icon-btn:hover { background: var(--bg); }

/* Mobile-first: dưới 900px, cụm icon bên phải giữ nguyên 1 hàng với brand; nav xuống hàng
   riêng, cuộn ngang — tránh vỡ layout khi nhồi nhiều mục nav + icon trên màn hình hẹp.
   ĐẶT SAU các rule header/nav/icon-btn gốc — vì cùng độ đặc hiệu (header nav),
   rule đứng sau mới thắng cascade, đặt trước bị rule "header nav { flex:1 }" đè mất. */
@media (max-width: 900px) {
  header { padding: 10px 14px; gap: 6px; }
  header .brand { order: 1; }
  /* Thứ tự khớp với markup desktop: theme → thông báo → avatar. margin-left:auto đặt ở phần tử
     ĐẦU TIÊN của cụm bên phải để đẩy cả cụm sang phải — đổi thứ tự mà quên dời nó là cụm dính
     luôn vào brand. */
  header #themeToggle { order: 2; margin-left: auto; }
  header .notif-wrap { order: 3; }
  header .user-menu-wrap { order: 4; }
  header nav {
    order: 7;
    flex: 1 1 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-left: 0;
    padding-bottom: 2px;
  }
  header nav a { flex-shrink: 0; }
}
@media (max-width: 480px) {
  .avatar-chip .avatar-name { display: none; }
  header .brand { font-size: 16px; }
  header .brand-text { max-width: 92px; }
  header { gap: 4px; }
}

/* ── Bottom nav (mobile) ──────────────────────────────────────────────── */
/* Dưới 720px: thay nav ngang trên header bằng thanh điều hướng cố định đáy
   màn hình (kiểu app di động) — dựng bằng JS trong portal-header.js. */

.bottom-nav { display: none; }

@media (max-width: 720px) {
  header nav { display: none; }
  body { padding-bottom: 74px; }
  body.no-chrome { padding-bottom: 0; }

  .bottom-nav {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    padding: 8px 4px calc(6px + env(safe-area-inset-bottom, 0px));
    justify-content: space-around;
    align-items: flex-end;
  }
  /* Nền thanh = SVG path riêng (bơm vào DOM trong portal-header.js), KHÔNG phải border-radius +
     mask CSS như 2 bản trước:
       - Bản 1 (mask-image trực tiếp trên .bottom-nav): mask khoét mất TOÀN BỘ nội dung con render
         bên trong nó, kể cả icon nút .bn-item.primary đang nổi lên → icon biến mất, chỉ còn thấy
         viền shadow.
       - Bản 2 (::before + mask, ::after vá màu): sửa được vụ icon mất, và né lộ nền trang tối,
         nhưng mask tròn chỉ tạo được 1 khối tròn nổi cứng — không mượt như đường lượn sóng thật
         (kiểu Material "FAB notch") trong thiết kế mẫu.
     Bản 3 này dùng SVG <path> với 2 đường cong Bezier lượn mượt quanh nút — đúng hình dạng mẫu,
     và filter:drop-shadow thay cho box-shadow (bo theo đúng contour path, không phải hình chữ nhật). */
  .bottom-nav-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    filter: drop-shadow(0 -6px 10px rgba(0, 0, 0, 0.12));
  }
  /* z-index tường minh — không dựa thứ tự mặc định: lớp nền từng đè LÊN TRÊN các .bn-item
     (chỉ nút .primary thoát vì margin âm đẩy hẳn ra ngoài khung), làm icon/tên các nút còn lại
     biến mất hoàn toàn. Ép rõ .bn-item luôn nổi trên lớp nền. */
  .bn-item {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: 3px;
    flex: 1;
    min-width: 0;
    background: none;
    border: none;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 10.5px;
    font-weight: 600;
    padding: 4px 2px;
    cursor: pointer;
  }
  .bn-item span:last-child { white-space: nowrap; }
  .bn-item.active { color: var(--accent-dark); }
  .bn-item .icon { width: 20px; height: 20px; }
  .bn-item.primary { margin-top: -24px; }
  .bn-item.primary .icon {
    width: 46px;
    height: 46px;
    background: var(--accent);
    color: #fff;
    border-radius: 50%;
    box-shadow: var(--shadow-accent);
    box-sizing: border-box;
  }
  .bn-item.primary span:last-child { margin-top: 1px; }
}

/* Sheet "Thêm" — trượt lên từ đáy, chỉ mở được từ nút Thêm trên bottom-nav (mobile) */
.more-sheet-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 50;
  align-items: flex-end;
}
.more-sheet-overlay.open { display: flex; }
.more-sheet {
  width: 100%;
  background: var(--card);
  border-radius: 18px 18px 0 0;
  padding: 10px 10px calc(18px + env(safe-area-inset-bottom, 0px));
  box-shadow: var(--shadow-md);
}
.more-sheet-handle {
  width: 36px;
  height: 4px;
  border-radius: 999px;
  background: var(--border);
  margin: 4px auto 14px;
}
.more-sheet-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 12px 14px;
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
}
.more-sheet-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--bg);
  color: var(--text-secondary);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.more-sheet-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 12px;
  border-radius: var(--radius-sm);
  border: none;
  background: none;
  width: 100%;
  color: var(--text);
  text-decoration: none;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}
.more-sheet-item:hover { background: var(--bg); }
.more-sheet-item.active { background: var(--accent-tint); color: var(--accent-dark); }
.more-sheet-item.active .icon { color: var(--accent-dark); }
.more-sheet-item .icon { color: var(--text-secondary); width: 20px; height: 20px; }
.more-sheet-item.danger { color: var(--err-text); }
.more-sheet-item.danger .icon { color: var(--err-text); }
.more-sheet-divider { height: 1px; background: var(--border); margin: 8px 4px; }

/* ── Layout ───────────────────────────────────────────────────────────── */

main { max-width: 720px; margin: 40px auto; padding: 0 16px; }
@media (max-width: 640px) {
  main { margin: 20px auto; padding: 0 12px; }
  .card { padding: 18px; }
  h1 { font-size: 20px; }
}
main.narrow { max-width: 560px; }
main.wide { max-width: 820px; }

h1 { font-size: 24px; margin-bottom: 4px; color: var(--text); }
.page-sub { font-size: 14px; color: var(--text-secondary); margin-bottom: 20px; }

#loading { color: var(--text-muted); margin-top: 60px; text-align: center; }

/* ── Cards ────────────────────────────────────────────────────────────── */

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  margin-bottom: 20px;
}
.card h2 { font-size: 15px; margin-bottom: 16px; color: var(--text); }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 24px; }
/* 3 card CỐ ĐỊNH 1 hàng (trang Giới thiệu) — .cards mặc định dùng auto-fit minmax(150px,1fr),
   trên màn hẹp không đủ 150px cho card thứ 3 nên tự rớt xuống hàng 2 (2+1 lệch). repeat(3,1fr)
   ép đúng 3 cột chia đều, tự co nhỏ theo màn thay vì wrap. Padding/icon/chữ giảm nhẹ để 3 card
   hẹp không bị bí. */
.cards.cards-3col { grid-template-columns: repeat(3, 1fr); gap: 8px; }
.cards.cards-3col .stat-card { padding: 12px; }
.cards.cards-3col .stat-card-head { margin-bottom: 8px; }
.cards.cards-3col .stat-card .label { font-size: 9.5px; }
.cards.cards-3col .stat-card .icon-badge { width: 26px; height: 26px; border-radius: 8px; font-size: 13px; }
.cards.cards-3col .stat-card .value { font-size: 16px; }
.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  border-top: 3px solid var(--border);
}
.stat-card.accent-primary { border-top-color: var(--accent); }
.stat-card.accent-success { border-top-color: var(--ok-text); }
/* Khớp quy ước màu số dư dùng chung toàn portal (trang Rút tiền/Đơn hàng): Đang chờ=vàng,
   Có thể rút=xanh (accent-success), Đã nhận=xám. */
.stat-card.accent-warn { border-top-color: var(--warn-text); }
.stat-card.accent-neutral { border-top-color: var(--neutral-text); }
.stat-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.stat-card .label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
}
.stat-card.accent-success .label { color: var(--ok-text); }
.stat-card .icon-badge {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--bg);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}
.stat-card.accent-primary .icon-badge { background: var(--accent-tint); color: var(--accent-dark); }
.stat-card.accent-success .icon-badge { background: var(--ok-bg); color: var(--ok-text); }
.stat-card.accent-warn .icon-badge { background: var(--warn-bg); color: var(--warn-text); }
.stat-card.accent-neutral .icon-badge { background: var(--neutral-bg); color: var(--neutral-text); }
.stat-card .value { font-size: 20px; font-weight: 700; color: var(--text); }
.stat-card.accent-primary .value { color: var(--accent-dark); }
.stat-card.accent-success .value { color: var(--ok-text); }
.stat-card.accent-warn .value { color: var(--warn-text); }
.stat-card.accent-neutral .value { color: var(--neutral-text); }

.row { display: flex; justify-content: space-between; padding: 8px 0; font-size: 14px; border-bottom: 1px solid var(--border); }
.row span:first-child { color: var(--text-secondary); }

.wd-confirm-amount { text-align: center; padding: 20px 0 4px; }
.wd-confirm-amount #confirmAmountNum { font-size: 40px; font-weight: 700; color: var(--text); }
.wd-confirm-unit { font-size: 16px; font-weight: 600; color: var(--text-secondary); margin-left: 6px; }
.wd-confirm-divider { height: 1px; background: var(--border); margin: 16px 0; }

/* ── Forms ────────────────────────────────────────────────────────────── */

label { display: block; font-size: 13px; color: var(--text-secondary); margin: 12px 0 6px; font-weight: 600; }
label:first-child { margin-top: 0; }
input[type=text], input[type=number] {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: var(--input-bg);
  color: var(--text);
}
input[type=text]:focus, input[type=number]:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
input::placeholder { color: var(--text-muted); }

/* ── Combobox chọn ngân hàng (trang Tài khoản) — search + chọn từ list, chặn gõ tự do ─── */
.bank-combo { position: relative; }
.bank-combo-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 240px;
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  z-index: 20;
  padding: 6px;
}
.bank-combo-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 10px;
  border: none;
  background: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
}
.bank-combo-item:hover { background: var(--bg); }
.bank-combo-empty { padding: 10px; font-size: 13px; color: var(--text-muted); text-align: center; }

button.submit, .btn-primary {
  padding: 12px 22px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-accent);
}
button.submit { width: 100%; margin-top: 16px; display: flex; align-items: center; justify-content: center; gap: 8px; }
button.submit:disabled, .btn-primary:disabled { opacity: 0.6; cursor: not-allowed; box-shadow: none; }

.btn-outline {
  background: var(--card);
  border: 2px solid var(--accent);
  color: var(--accent-dark);
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: var(--shadow);
}

.cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 12px 24px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-weight: 700;
  box-shadow: var(--shadow-accent);
}

/* ── Result / status boxes ───────────────────────────────────────────── */

#result, .result-box {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  display: none;
  font-size: 13px;
}
#result.ok, .result-box.ok { background: var(--ok-bg); border: 1px solid var(--ok-border); color: var(--ok-text); }
#result.err, .result-box.err { background: var(--err-bg); border: 1px solid var(--err-border); color: var(--err-text); }
/* Loại trừ .cr-cta: `#result a` có độ ưu tiên (1,0,1) ăn đứt class `.cr-cta` (0,1,0) nên
   `color: inherit` kéo chữ + icon nút "Mở link mua hàng" về màu --text — ở light mode thành
   chữ ĐEN trên nền cam. Dark mode --text sáng nên trước giờ không lộ. */
#result a:not(.cr-cta) { word-break: break-all; color: inherit; font-weight: 600; }

/* ── Card kết quả chuyển đổi link ─────────────────────────────────────── */
/* Chuyển đổi link là tính năng chính của web portal nên card kết quả được thiết kế riêng thay vì
   dùng hộp #result chung. `.card-mode` gỡ padding/nền của #result để card tự lo phần hiển thị. */

#result.card-mode { padding: 0; background: none; border: none; }

.convert-result {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--ok-text);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-md);
  animation: cr-appear 0.28s ease-out;
}
@keyframes cr-appear {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

.cr-status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ok-text);
  font-weight: 800;
  font-size: 12.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.cr-product { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 18px; }
.cr-thumb {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  border-radius: 10px;
  border: 1px solid var(--border);
  background-color: var(--bg);   /* xem chú thích ở .li-thumb — tránh shorthand */
  object-fit: cover;
}
.cr-name {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--text);
  /* Tên sản phẩm Shopee thường rất dài — cắt 2 dòng để card không bị đẩy cao. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cr-money { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.cr-money-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 2px;
}
.cr-info-dot {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 1.5px solid var(--accent);
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  font-style: italic;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: help;
  flex-shrink: 0;
}
.cr-amount { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; color: var(--text); line-height: 1.15; }
.cr-price { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }
.cr-pct {
  flex-shrink: 0;
  background: var(--accent-tint);
  border: 1px solid var(--accent-tint-strong);
  color: var(--accent-dark);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 15px;
  font-weight: 800;
}

/* Khối mã code (nhóm đặt REPLY_TYPE='code') — bấm là copy mã + mở Shopee */
.cr-code {
  background: var(--accent-tint);
  border: 1px dashed var(--accent-tint-strong);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 14px;
  text-align: center;
}
.cr-code-label { font-size: 12px; font-weight: 600; color: var(--accent-dark); margin-bottom: 10px; }
.cr-code-btn {
  width: 100%;
  padding: 14px 12px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--text);
  /* Mã dạng ABC-DEF-GHI: monospace + giãn chữ để khách đọc/đối chiếu không nhầm ký tự. */
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.08em;
  cursor: pointer;
  word-break: break-all;
}
.cr-code-btn:hover { background: var(--accent-tint-strong); }
.cr-code-hint { font-size: 11.5px; color: var(--text-secondary); margin-top: 9px; line-height: 1.5; }

/* ── Card kết quả "Lấy mã liên kết" (trang Tài khoản) ────────────────────
   Cùng ngôn ngữ thiết kế với .cr-code ở trang Chuyển đổi (khối mã TikTok) để
   nhất quán trong portal: khối bấm-để-copy nổi bật, không phải dòng chữ trơn. */
.link-code-card {
  margin-top: 16px;
  padding: 20px 18px;
  background: var(--accent-tint);
  border: 1px solid var(--accent-tint-strong);
  border-radius: var(--radius);
  text-align: center;
}
.lcc-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-dark);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 10px;
}
.lcc-copied {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin-top: 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ok-text);
}
.lcc-instruction {
  margin-top: 14px;
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
}
.lcc-instruction strong { color: var(--accent-dark); }

.lcc-cmd-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 15px 16px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-accent);
  cursor: pointer;
}
.lcc-cmd-btn:hover { background: var(--accent-dark); }
.lcc-cmd-btn code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  background: none;
  word-break: break-all;
}
.lcc-copy-icon { flex-shrink: 0; opacity: 0.9; }

.lcc-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--accent-tint-strong);
  font-size: 12px;
  color: var(--text-secondary);
}
.lcc-meta b { color: var(--text); font-variant-numeric: tabular-nums; }

.wd-amount-hint {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-top: 8px;
  margin-bottom: 18px;
}

.cr-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 15px 16px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
  box-shadow: var(--shadow-accent);
}
.cr-cta:hover { background: var(--accent-dark); }

.cr-actions { display: flex; gap: 12px; margin-top: 12px; }
.cr-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.cr-btn:hover { background: var(--bg); }

/* Sản phẩm không có hoa hồng — vẫn tạo được link nhưng phải nói thẳng, đừng để khách mua xong
   mới biết mình không được hoàn tiền. */
.cr-nocomm {
  background: var(--err-bg);
  border: 1px solid var(--err-border);
  color: var(--err-text);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 18px;
}

/* Khối chờ trong lúc tra thông tin sản phẩm — link đã bấm được rồi, đây chỉ là phần bồi thêm. */
.cr-skel { background: var(--bg); border-radius: 8px; position: relative; overflow: hidden; }
.cr-skel::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
  animation: cr-shimmer 1.3s ease-in-out infinite;
}
@keyframes cr-shimmer {
  from { transform: translateX(-100%); }
  to   { transform: translateX(100%); }
}
.cr-skel-thumb { width: 64px; height: 64px; flex-shrink: 0; }
.cr-skel-lines { flex: 1; min-width: 0; }
.cr-skel-line { height: 13px; margin-bottom: 8px; }
.cr-skel-line.short { width: 45%; margin-bottom: 0; }
.cr-fade-in { animation: cr-appear 0.3s ease-out; }

/* ── Modal QR ─────────────────────────────────────────────────────────── */

.qr-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: cr-appear 0.2s ease-out;
}
.qr-modal {
  background: var(--card);
  border-radius: 20px;
  box-shadow: var(--shadow-md);
  padding: 24px;
  width: 100%;
  max-width: 340px;
  text-align: center;
}
.qr-modal h3 { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 18px; }
/* Nền trắng cố định kể cả ở dark mode — QR đảo màu là máy quét đọc không ra. */
.qr-modal .qr-box { background: #fff; border-radius: 12px; padding: 10px; display: inline-block; }
.qr-modal .qr-url { font-size: 12.5px; color: var(--text-muted); word-break: break-all; margin: 16px 0 18px; }
.qr-modal .qr-close {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}
.qr-modal .qr-close:hover { background: var(--border); }

/* ── Toast ────────────────────────────────────────────────────────────── */

.portal-toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%);
  z-index: 70;
  background: rgba(20, 20, 24, 0.92);
  color: #fff;
  padding: 11px 20px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  animation: cr-appear 0.2s ease-out;
}

@media (max-width: 480px) {
  .cr-amount { font-size: 26px; }
  /* Bottom-nav mobile cao 74px — đẩy toast lên trên để không bị che. */
  .portal-toast { bottom: 96px; }
}

/* ── Tables ───────────────────────────────────────────────────────────── */

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
th, td { padding: 12px 14px; text-align: left; font-size: 13px; border-bottom: 1px solid var(--border); color: var(--text); }
tr:last-child td { border-bottom: none; }
th { background: var(--bg); color: var(--text-secondary); font-weight: 700; text-transform: uppercase; font-size: 11px; letter-spacing: 0.03em; }
.empty { text-align: center; padding: 40px; color: var(--text-muted); }

.pager { display: flex; justify-content: center; align-items: center; gap: 10px; margin-top: 16px; }
.pager button {
  padding: 8px 16px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow);
}
.pager button:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; }
.pager span { font-size: 13px; color: var(--text-secondary); }

/* ── Highlight banner (mã giới thiệu, quote...) ──────────────────────── */

.highlight {
  background: linear-gradient(135deg, #E8630A 0%, #FF9142 55%, #FFB273 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}
.highlight .label { font-size: 11px; opacity: 0.9; margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 700; }
.highlight .code-row { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.highlight .code-row b { font-size: 24px; letter-spacing: 2px; }
.highlight button.copy {
  background: rgba(255, 255, 255, 0.25);
  border: none;
  color: #fff;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.highlight input {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 13px;
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.92);
  color: #1a1a1a;
}

/* ── Steps (trang Hướng dẫn) ──────────────────────────────────────────── */

.step { display: flex; gap: 14px; margin-bottom: 18px; }
.step:last-child { margin-bottom: 0; }
.step .num {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 15px;
  flex-shrink: 0;
  box-shadow: var(--shadow-accent);
}
.step p { font-size: 14px; color: var(--text-secondary); padding-top: 6px; line-height: 1.5; }
ul.notes { padding-left: 20px; font-size: 14px; color: var(--text-secondary); line-height: 1.8; }

/* Biến thể lưới ngang có icon — dùng cho "Cách hoạt động" trên dashboard */
.steps-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.step-card { background: var(--bg); border-radius: var(--radius-sm); padding: 16px; }
.step-top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.step-top .num {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
  flex-shrink: 0;
  box-shadow: var(--shadow-accent);
}
.step-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--accent-tint);
  color: var(--accent-dark);
  display: flex;
  align-items: center;
  justify-content: center;
}
.step-title { font-weight: 700; font-size: 14px; color: var(--text); margin-bottom: 6px; }
.step-desc { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }

@media (max-width: 720px) {
  .steps-grid { grid-template-columns: 1fr; }
}

/* ── Trang đăng nhập (split hero) ─────────────────────────────────────── */

.login-shell { display: flex; min-height: 100vh; }
.login-hero {
  flex: 1;
  background: linear-gradient(135deg, #E8630A 0%, #FF9142 55%, #FFB273 100%);
  color: #fff;
  padding: 56px 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 20px;
}
.login-hero .brand { font-size: 20px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.login-hero .brand #brandIcon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 17px;
  font-weight: 900;
  overflow: hidden;
}
/* Cùng lý do với header .brand #brandIcon — logo không vuông thì bỏ ép vuông, chỉ giới hạn chiều cao. */
.login-hero .brand #brandIcon:has(img) { width: auto; max-width: 150px; padding: 0 3px; }
.login-hero .brand #brandIcon img { width: 100%; height: 100%; object-fit: cover; display: block; }
.login-hero .brand #brandIcon:has(img) img { width: auto; max-width: 100%; object-fit: contain; }
.login-hero h1 { font-size: 34px; color: #fff; line-height: 1.25; margin-bottom: 0; }
.login-hero p.sub { font-size: 15px; opacity: 0.92; max-width: 420px; }
.login-hero .quote-card {
  margin-top: auto;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--radius);
  padding: 18px 20px;
  font-style: italic;
  font-size: 14px;
  max-width: 420px;
}
.login-hero .quote-card .attribution { margin-top: 8px; font-style: normal; font-weight: 700; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; opacity: 0.9; }

.login-panel { flex: 1; display: flex; align-items: center; justify-content: center; padding: 32px; background: var(--bg); position: relative; }
.login-panel .icon-btn { position: absolute; top: 24px; right: 24px; }
.login-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 40px 32px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  max-width: 380px;
  width: 100%;
}
.login-card h1 { font-size: 22px; margin-bottom: 8px; color: var(--text); }
.login-card p.sub { color: var(--text-secondary); font-size: 14px; margin-bottom: 28px; }

.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  transition: box-shadow 0.2s;
}
.btn-google:hover { box-shadow: var(--shadow); }
#err { color: var(--err-text); font-size: 13px; margin-top: 16px; display: none; }
a.back { display: block; margin-top: 24px; font-size: 13px; color: var(--text-muted); text-decoration: none; }

@media (max-width: 860px) {
  .login-shell { flex-direction: column; }
  .login-hero { padding: 36px 24px; }
  .login-hero h1 { font-size: 26px; }
  .login-hero .quote-card { display: none; }
  .login-panel { padding: 32px 20px 48px; }
}

/* ── Chọn sàn (trang Chuyển đổi) ──────────────────────────────────────── */

/* 3 tab luôn nằm CHUNG một dòng, chia đều bề ngang. Trước để flex-wrap:wrap nên mỗi tab giữ
   nguyên bề rộng theo nội dung và "Tiktok" bị đẩy xuống hàng hai ở khung hẹp. */
.platform-tabs { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: nowrap; }
.platform-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 1 1 0;
  min-width: 0;
  padding: 10px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--text);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  position: relative;
  box-shadow: var(--shadow);
}
.platform-tab.active { border-color: var(--accent); color: var(--accent-dark); background: var(--accent-tint); }

/* Khối chọn sàn ở trang Chuyển đổi — lưới 2×2 to hơn tab thường, KHOANH VÙNG riêng bằng #platformTabs
   vì .platform-tabs/.platform-tab còn dùng chung cho tab danh mục trang Hướng dẫn (4 tab, 1 hàng
   desktop) — sửa thẳng class chung sẽ vỡ layout bên đó. */
#platformTabs { display: grid; grid-template-columns: 1fr 1fr; flex-wrap: unset; }
#platformTabs .platform-tab { flex: unset; justify-content: flex-start; gap: 10px; padding: 14px 16px; font-size: 15px; }
#platformTabs .platform-tab .pt-logo { width: 26px; height: 26px; }
/* Logo sàn thay cho emoji. Ảnh PNG nền TRONG SUỐT nên không bọc nền — logo hoà thẳng vào card,
   sáng hay tối đều gọn. Riêng TikTok phải đổi file theo theme: bản gốc là túi đen, để trên nền
   tối thì chìm hẳn; bản -dark đảo đen↔trắng nhưng vẫn giữ nguyên cyan/hồng của thương hiệu.
   Shopee màu cam nên một file dùng chung cho cả hai theme. */
.platform-tab .pt-logo { width: 26px; height: 26px; flex-shrink: 0; }
.pt-lazada { background-image: url('/portal/logo-lazada.png'); }
.pt-food { background-image: url('/portal/logo-shopeefood.png'); }
/* Tên sàn cắt bằng ellipsis khi khung quá hẹp — thà "Shopee F…" còn hơn vỡ layout xuống dòng. */
.platform-tab .pt-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* Dùng chung cho tab nền tảng và ô ảnh khi link chưa có ảnh sản phẩm thật. */
.pt-logo, .is-logo {
  display: inline-block;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}
.pt-shopee { background-image: url('/portal/logo-shopee.png'); }
.pt-tiktok { background-image: url('/portal/logo-tiktok.png'); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .pt-tiktok { background-image: url('/portal/logo-tiktok-dark.png'); }
}
:root[data-theme="dark"] .pt-tiktok { background-image: url('/portal/logo-tiktok-dark.png'); }

/* Ô ảnh đang hiển thị logo thay cho ảnh sản phẩm: bỏ nền + viền để logo trong suốt hoà vào thẻ,
   chừa lề trong để logo không chạm sát mép ô. Lặp lại background-image ở đây để chắc chắn thắng
   mọi rule nền đặt phía trên, bất kể sau này ai thêm gì vào .li-thumb/.cr-thumb. */
.li-thumb.is-logo, .cr-thumb.is-logo {
  background-color: transparent;
  border: none;
  background-size: 78%;
  background-repeat: no-repeat;
  background-position: center;
}
.li-thumb.is-logo.pt-shopee, .cr-thumb.is-logo.pt-shopee { background-image: url('/portal/logo-shopee.png'); }
.li-thumb.is-logo.pt-tiktok, .cr-thumb.is-logo.pt-tiktok { background-image: url('/portal/logo-tiktok.png'); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .li-thumb.is-logo.pt-tiktok,
  :root:not([data-theme="light"]) .cr-thumb.is-logo.pt-tiktok { background-image: url('/portal/logo-tiktok-dark.png'); }
}
:root[data-theme="dark"] .li-thumb.is-logo.pt-tiktok,
:root[data-theme="dark"] .cr-thumb.is-logo.pt-tiktok { background-image: url('/portal/logo-tiktok-dark.png'); }
.platform-tab:disabled { cursor: not-allowed; opacity: 0.55; box-shadow: none; }
.platform-tab .pt-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  text-transform: uppercase;
  white-space: nowrap;
}
.platform-tab .pt-badge.beta { background: var(--accent-tint); color: var(--accent-dark); }
.platform-tab .pt-badge.off { background: var(--border); color: var(--text-muted); }

/* ── Ô nhập link + nút dán (trang Chuyển đổi) ────────────────────────── */

/* Label mặc định margin-top:12px CỘNG THÊM vào padding 24px của .card → label bị đẩy xuống thấp,
   trong khi khoảng cách label→input (6px) lại nhỏ hơn nhiều so với input→nút (16px, từ margin-top
   của button.submit) — nhìn lệch nhau. Bỏ hẳn margin-top (label nằm sát mép trên card) + tăng nhẹ
   margin-bottom cho nhịp đều hơn. */
#urlLabel { margin: 0 0 10px; }
.input-with-paste { display: flex; gap: 8px; }
.input-with-paste input { flex: 1; }
.paste-btn {
  flex-shrink: 0;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.paste-btn:hover { background: var(--accent-tint); color: var(--accent-dark); }

/* ── Section thu gọn (Quan trọng / Chuyển đổi gần đây) ───────────────── */

.collapsible-head { display: flex; align-items: center; gap: 12px; cursor: pointer; user-select: none; background: none; border: none; width: 100%; text-align: left; padding: 0; }
.collapsible-head .cs-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--accent-tint);
  color: var(--accent-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.collapsible-head .cs-title { flex: 1; min-width: 0; }
.collapsible-head .cs-title strong { display: block; font-size: 15px; color: var(--text); }
.collapsible-head .cs-title span { font-size: 12px; color: var(--text-muted); }
.collapsible-head .cs-count {
  background: var(--accent-tint);
  color: var(--accent-dark);
  font-weight: 700;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.collapsible-head .cs-chevron { transition: transform 0.2s; color: var(--text-muted); flex-shrink: 0; }
.collapsible-head.open .cs-chevron { transform: rotate(180deg); }
.collapsible-body { margin-top: 16px; display: none; }
.collapsible-body.open { display: block; }

/* ── Card gây chú ý: viền cam chạy vòng quanh ────────────────────────────
   Dùng cho card "Quan trọng" — mặc định thu gọn nên cần hiệu ứng để khách vẫn để ý.
   Cách hoạt động: bỏ nền + viền tĩnh của .card; ::before là vệt sáng conic-gradient
   quay tròn (khối vuông to hơn card, bị overflow:hidden cắt gọn), ::after phủ nền đè
   lên phần giữa nên chỉ còn lộ vành ~1.5px → thành viền chạy. Nội dung phải nâng
   z-index lên trên ::after mới bấm/đọc được. */
.card-attn {
  position: relative;
  overflow: hidden;
  background: transparent;
  border-color: transparent;
}
.card-attn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 150%;
  aspect-ratio: 1;
  background: conic-gradient(from 0deg,
    transparent 0turn 0.55turn,
    rgba(245, 121, 60, 0.28) 0.70turn,
    var(--accent) 0.82turn,
    #FFC79A 0.88turn,
    transparent 0.95turn 1turn);
  animation: card-attn-run 3.2s linear infinite;
}
.card-attn::after {
  content: '';
  position: absolute;
  inset: 1.5px;
  border-radius: calc(var(--radius) - 1px);
  background: var(--card);
}
.card-attn > * { position: relative; z-index: 1; }
@keyframes card-attn-run {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to   { transform: translate(-50%, -50%) rotate(360deg); }
}
/* Tôn trọng thiết lập giảm chuyển động của máy khách — giữ viền cam tĩnh thay vì chạy. */
@media (prefers-reduced-motion: reduce) {
  .card-attn::before { animation: none; background: var(--accent); }
}

.rule-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}
.rule-row:last-child { margin-bottom: 0; }
.rule-row .rule-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent-tint);
  color: var(--accent-dark);
  font-weight: 700;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.link-history-note {
  background: var(--accent-tint);
  color: var(--accent-dark);
  font-size: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  line-height: 1.5;
}
/* Nút gom cụm lọc trên mobile — desktop ẩn hẳn, xem media query cuối khối này */
.link-filter-toggle {
  display: none;
  align-items: center;
  gap: 8px;
  width: 100%;
  justify-content: center;
  padding: 11px 14px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.link-filter-toggle.on { background: var(--accent-tint); border-color: var(--accent-tint-strong); color: var(--accent-dark); }
.link-filter-toggle .lft-count {
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 11.5px;
  font-weight: 800;
}

/* Thanh lọc của cụm "Chuyển đổi gần đây" */
/* align-items: flex-end (không phải center) — ô Từ ngày/Đến ngày có nhãn phía trên nên cao hơn
   hẳn ô tìm kiếm/nút Yêu thích; center sẽ kéo 2 cái đó lệch xuống giữa khối nhãn+ô thay vì
   thẳng hàng đáy với các ô input thật. */
.link-filters { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; align-items: flex-end; }
.link-filters input[type="search"] {
  flex: 1 1 220px;
  min-width: 0;
  height: 48px;
  box-sizing: border-box;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--text);
  font-size: 13px;
}
.link-filter-dates { display: flex; align-items: center; gap: 8px; }
.link-fav-filter {
  height: 48px;
  box-sizing: border-box;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.link-fav-filter.on { background: var(--accent-tint); border-color: var(--accent-tint-strong); color: var(--accent-dark); }

.link-item {
  border-left: 3px solid var(--accent);
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 10px;
}
.link-item:last-child { margin-bottom: 0; }

.li-head { display: flex; align-items: flex-start; gap: 12px; }
.li-thumb {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  border-radius: 8px;
  border: 1px solid var(--border);
  /* background-COLOR chứ không phải shorthand `background`: shorthand reset luôn background-image
     về none, mà biến thể .is-logo lại vẽ logo bằng background-image → ô trắng trơn. */
  background-color: #fff;
  object-fit: cover;
}
.li-body { flex: 1; min-width: 0; }
.li-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
/* Link cũ chưa có tên sản phẩm thì hiện URL — cỡ nhỏ hơn, ngắt được giữa chuỗi dài. */
.li-title.is-url { font-size: 12.5px; font-weight: 500; color: var(--text-secondary); word-break: break-all; }
.li-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-muted); margin-top: 5px; flex-wrap: wrap; }
.li-meta .li-platform { color: var(--accent-dark); font-weight: 700; }
.li-meta .has-order { color: var(--ok-text); font-weight: 700; }
/* Chip giá/hoa hồng bên trái, tiền hoàn bên phải — cùng MỘT hàng, chiếm hết bề ngang thẻ.
   Trước đây chip nằm trong cột chữ còn tiền ở cột phải riêng: trên mobile cột phải ăn mất chỗ
   khiến 2 chip bị ép xuống 2 dòng trong khi khoảng dưới ảnh bỏ trống. */
.li-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.li-chips { display: flex; gap: 6px; flex-wrap: wrap; min-width: 0; }
.li-chip {
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.li-chip.accent { background: var(--accent-tint); border-color: var(--accent-tint-strong); color: var(--accent-dark); }

.li-side { display: flex; align-items: flex-start; flex-shrink: 0; }
.li-tools { display: flex; gap: 2px; }
.li-icon-btn {
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 6px;
  cursor: pointer;
}
.li-icon-btn:hover { background: var(--card); color: var(--text); }
/* Đã đánh dấu: tô đặc ngôi sao thay vì đổi sang icon khác — giữ đúng hình, chỉ đổi màu. */
.li-icon-btn.on { color: var(--accent); }
.li-icon-btn.on svg { fill: currentColor; }
.link-fav-filter.on svg { fill: currentColor; }
.link-fav-filter { display: inline-flex; align-items: center; gap: 7px; justify-content: center; }
/* Trạng thái chờ xác nhận lần bấm thứ 2 của nút xoá (thay cho hộp thoại confirm) */
.li-icon-btn.armed { background: var(--err-bg); color: var(--err-text); font-size: 12px; font-weight: 700; padding: 4px 8px; }
.li-amount { font-size: 15px; font-weight: 800; color: var(--ok-text); white-space: nowrap; }

.li-actions { display: flex; gap: 10px; margin-top: 12px; }
.li-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.li-btn:hover { background: var(--accent-tint); }
.li-btn.primary { background: var(--accent-tint); border-color: var(--accent-tint-strong); color: var(--accent-dark); }
.li-btn.primary:hover { background: var(--accent-tint-strong); }

.link-pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 14px; }
.link-pager button {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.link-pager button:disabled { opacity: 0.45; cursor: not-allowed; }
.link-pager #pagerInfo { font-size: 12.5px; color: var(--text-muted); }

/* ≤720px: cụm lọc gập lại sau nút "Lọc" — 3 hàng ô nhập luôn hiện chiếm gần hết màn hình
   trong khi khách chỉ thỉnh thoảng mới lọc. Bấm nút mới trải ra. */
@media (max-width: 720px) {
  .link-filter-toggle { display: flex; }
  .link-filters { display: none; }
  .link-filters.open { display: flex; }
}

@media (max-width: 420px) {
  .platform-tabs { gap: 6px; }
  .platform-tab { padding: 9px 8px; font-size: 13px; gap: 6px; }
  .platform-tab .pt-logo { width: 18px; height: 18px; }
}

/* Tab danh mục trang Hướng dẫn (4 tab, dùng chung class .platform-tab với 3 tab nền tảng ở trang
   Chuyển đổi) — nowrap ép cả 4 vào 1 hàng khiến chữ dài phải tự xuống dòng trong từng nút, chật
   và xấu. Trên mobile cho xuống lưới 2×2, mỗi nút đủ rộng để chữ nằm gọn 1-2 dòng thoải mái. */
@media (max-width: 640px) {
  #guideTabs { flex-wrap: wrap; }
  #guideTabs .platform-tab { flex: 1 1 calc(50% - 4px); }
}

@media (max-width: 480px) {
  .link-filters { gap: 8px; }
  .link-filter-dates { flex: 1 1 100%; }
  .link-fav-filter { flex: 1 1 100%; }
  .link-filters input[type="search"] { flex: 1 1 100%; }
}

/* ── Quy trình hoàn tiền (trang Đơn hàng) ─────────────────────────────── */

.process-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.process-label .icon { color: var(--accent); }
.process-toggle-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
  padding: 0;
  text-align: center;
  color: inherit;
  font-family: inherit;
}
.process-compact { display: flex; align-items: flex-start; justify-content: center; gap: 24px; width: 100%; }
.process-compact .pc-step { display: flex; flex-direction: column; align-items: center; flex: none; width: 90px; gap: 6px; font-size: 13px; font-weight: 700; color: var(--text); white-space: nowrap; }
.process-compact .pc-step .pc-icon { width: 34px; height: 34px; border-radius: 50%; background: var(--accent-tint); color: var(--accent-dark); display: flex; align-items: center; justify-content: center; }
.process-compact .pc-dash { flex: none; width: 56px; border-top: 2px dashed var(--border); margin-top: 12px; align-self: flex-start; }
@media (max-width: 640px) {
  .process-compact { gap: 8px; }
  .process-compact .pc-step { width: 80px; }
  .process-compact .pc-dash { width: 20px; }
}
.process-expanded-title { width: 100%; font-size: 15px; font-weight: 700; color: var(--text); }
.process-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}
.process-hint .icon { transition: transform 0.2s; }
.process-toggle-row:hover .process-hint { color: var(--accent-dark); }
.process-detail { margin-top: 18px; display: none; }
.process-detail.open { display: block; }
.process-row { display: flex; gap: 16px; padding: 16px; background: var(--bg); border-radius: var(--radius-sm); margin-bottom: 10px; }
.process-row:last-child { margin-bottom: 0; }
.process-row .pr-num { font-size: 30px; font-weight: 800; color: var(--accent-tint-strong); flex-shrink: 0; line-height: 1.1; }
.process-row .pr-body { flex: 1; min-width: 0; }
.process-row .pr-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.process-row .pr-head strong { font-size: 14px; color: var(--text); }
.process-row .pr-badge { background: var(--accent-tint); color: var(--accent-dark); font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: var(--radius-sm); white-space: nowrap; }
.process-row .pr-icon { width: 30px; height: 30px; border-radius: 50%; background: var(--accent-tint); color: var(--accent-dark); display: flex; align-items: center; justify-content: center; margin-bottom: 8px; }
.process-row p { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }

/* ── Bộ lọc (trang Đơn hàng) ──────────────────────────────────────────── */
/* Ô tìm + nút Lọc nổi trực tiếp trên nền trang (KHÔNG bọc card) — card filter phụ
   (trạng thái + khoảng ngày) chỉ hiện khi bấm Lọc, độc lập ở dưới. Cùng 1 layout cho
   mọi kích thước màn hình — không còn nhánh riêng desktop/mobile như bản cũ. */
.filter-bar { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }

.filter-search-wrap { position: relative; flex: 1 1 auto; min-width: 0; }
.filter-search-wrap .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.filter-search-wrap input[type=text] {
  width: 100%;
  padding: 10px 12px 10px 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--text);
  font-size: 13px;
  box-shadow: var(--shadow);
}

/* Nút Lọc: viền THƯỜNG (không cam) khi chưa có filter nào — viền cam + badge số chỉ bật
   khi .active (đang có ít nhất 1 filter áp dụng thật, không tính việc card đang mở/đóng). */
.filter-toggle-btn {
  position: relative;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--text);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  box-shadow: var(--shadow);
  white-space: nowrap;
}
.filter-toggle-btn.active { border-color: var(--accent); color: var(--accent-dark); }
/* :not([hidden]) BẮT BUỘC — CSS tác giả (author stylesheet) luôn thắng CSS mặc định trình
   duyệt (`[hidden] { display:none }`) bất kể độ ưu tiên selector, đặt thẳng `display:` ở đây
   sẽ VÔ HIỆU HOÁ hidden attribute → badge "0" và card filter hiện ra dù JS đã set hidden=true. */
.filter-count-badge:not([hidden]) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

/* Chip liệt kê filter đang bật, mỗi chip có nút × riêng để bỏ đúng filter đó */
.filter-chips-row:not([hidden]) { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.filter-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px 5px 12px;
  border-radius: 999px;
  background: var(--accent-tint);
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 600;
}
.filter-chip button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 2px;
}
.filter-clear-all-btn { border: none; background: transparent; color: var(--text-muted); font-size: 12px; font-weight: 600; cursor: pointer; text-decoration: underline; }

/* Card filter phụ — ẨN mặc định, .open mới hiện. select/date full-width xếp dọc cho gọn
   trong card hẹp; date-range-row xếp 2 ô ngang có dấu gạch nối ở giữa. */
.filter-extra { display: none; flex-direction: column; gap: 12px; }
.filter-extra.open { display: flex; }

/* Select bo tròn dạng pill + chevron tự vẽ — appearance:none xoá mũi tên/khung mặc định của
   trình duyệt vì mỗi hệ điều hành vẽ khác nhau (không đồng nhất với thiết kế). Viền cam khi
   :focus (đang thao tác), không phải khi "đã chọn giá trị" — khớp hành vi ảnh mẫu. */
.pill-select-wrap { position: relative; display: block; }
/* height CỐ ĐỊNH + box-sizing:border-box — <select> có ràng buộc chiều cao tối thiểu riêng của
   trình duyệt (kể cả đã appearance:none), padding/font-size không đủ ép về đúng bằng
   .date-pick-text dù khai cùng số — từng làm khoảng cách giữa 2 dropdown nhìn KHÔNG đều so với
   khoảng cách xuống hàng ngày, dù gap flex của .filter-extra bằng nhau tuyệt đối. */
.pill-select-wrap select {
  appearance: none;
  -webkit-appearance: none;
  box-sizing: border-box;
  width: 100%;
  height: 48px;
  padding: 0 40px 0 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
}
.pill-select-wrap select:focus { outline: none; border-color: var(--accent); }
.pill-select-chevron {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%) rotate(90deg);
  color: var(--text-muted);
  pointer-events: none;
}

.date-range-row { display: flex; align-items: center; gap: 8px; }

/* "Nút" ngày: input date thật trong suốt PHỦ ĐÈ lên span hiển thị text tự set — bấm vào đâu
   trong khối cũng trúng input thật (đang che kín 100%) nên vẫn mở lịch gốc của trình duyệt,
   nhưng chữ hiện ra luôn do mình kiểm soát (dd/mm/yyyy placeholder), không lệ thuộc locale máy. */
.date-pick { position: relative; flex: 1; min-width: 0; }
.date-pick-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  opacity: 0;
  cursor: pointer;
  color-scheme: light dark;
}
/* Cùng padding dọc (12px) + font-size (14px) với .pill-select-wrap select — trước đó lệch
   (10px/13px) làm 2 ô ngày THẤP hơn 2 dropdown phía trên, khoảng trắng nhìn không đều dù gap
   flex đã bằng nhau (khung cao thấp khác nhau đánh lừa mắt). */
/* height/box-sizing khớp CHÍNH XÁC .pill-select-wrap select — dùng display:flex + align-items
   center để căn chữ giữa theo chiều dọc khi ép height cố định (thay vì dựa vào line-height của
   padding cũ, không chính xác bằng). */
.date-pick-text {
  display: flex;
  align-items: center;
  box-sizing: border-box;
  height: 48px;
  padding: 0 34px 0 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--text);
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}
.date-pick-text.is-placeholder { color: var(--text-muted); }
/* Icon lịch thuần trang trí (pointer-events:none) — không phải nút bấm riêng, click vẫn xuyên
   qua tới input thật bên dưới như phần còn lại của khối .date-pick. */
.date-pick-icon {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.date-sep { color: var(--text-muted); font-size: 13px; flex-shrink: 0; }

.filter-clear-inline-btn {
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 4px 0;
  margin-top: 2px;
}

/* ── Danh sách đơn hàng dạng card ─────────────────────────────────────── */

/* Card ĐỨNG ĐỘC LẬP trên nền trang (trước đây nằm lồng trong 1 <div class="card"> bọc ngoài,
   giờ đã bỏ bọc ngoài) — cần tự có nền/viền/shadow như .card, giữ thêm viền trái cam làm điểm
   nhấn riêng cho danh sách đơn hàng. */
/* Bỏ box-shadow đậm — chỉ viền mỏng + viền trái cam làm điểm nhấn, nhẹ nhàng hơn thay vì
   "nổi hẳn lên" khỏi nền trang. */
.order-card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  padding: 16px;
  margin-bottom: 12px;
}
.order-card:last-child { margin-bottom: 0; }
/* Icon + ngày đặt bên trái (điểm neo chính) / badge trạng thái bên phải. */
.order-card .oc-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
/* Góc trái gộp 2 thứ: badge kênh/sàn + ngày giờ — flex-wrap vì trên màn hẹp có thể không đủ
   chỗ cạnh badge trạng thái ở góc phải. */
.order-card .oc-top-left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
/* Badge kênh/sàn (Shopee/SP Food/TikTok...) — cùng "trọng lượng" hình ảnh với badge trạng thái
   (cũng là pill có nền màu) để không bị lép vế khi đứng cạnh nhau ở góc trái. */
.order-card .oc-channel-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  background: var(--accent-tint);
  color: var(--accent-dark);
  white-space: nowrap;
  flex-shrink: 0;
}
.order-card .oc-date {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
}
.order-card .oc-date .icon { color: var(--accent-dark); flex-shrink: 0; }
/* Mã đơn xuống hàng riêng, nhỏ + nhạt màu — thông tin tra cứu phụ, không còn là điểm nhấn chính
   như bản trước. ellipsis + title= khi quá dài (mã MANUAL-... rất dài). */
.order-card .oc-id {
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* 4 trạng thái khớp đúng /my-orders.html: Hoàn thành=xanh, Đang chờ=vàng, Đã huỷ=đỏ,
   Chưa thanh toán=xám. Icon SVG (không dùng emoji như /my-orders — khớp quy ước icon của
   portal) đặt cùng hàng với chữ. */
.order-card .oc-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  flex-shrink: 0;
}
.order-card .oc-status.completed { background: var(--ok-bg); color: var(--ok-text); }
.order-card .oc-status.pending { background: var(--warn-bg); color: var(--warn-text); }
.order-card .oc-status.cancelled { background: var(--err-bg); color: var(--err-text); }
.order-card .oc-status.unpaid { background: var(--neutral-bg); color: var(--neutral-text); }
.order-card .oc-items { margin-top: 10px; font-size: 13px; color: var(--text-secondary); }
/* Dạng bullet — dot + text trên cùng hàng, text word-break để tên dài tự xuống dòng gọn trong
   card (không tràn ra ngoài) mà không kéo lệch theo dot. */
.order-card .oc-item-row { display: flex; gap: 8px; padding: 2px 0; }
.order-card .oc-item-dot { color: var(--accent); flex-shrink: 0; line-height: 1.5; }
.order-card .oc-item-row > span:last-child { min-width: 0; word-break: break-word; }
.order-card .oc-chips { margin-top: 10px; }
/* Chip tên shop giới hạn bề rộng riêng — tên shop có thể rất dài, không giới hạn sẽ đẩy vỡ
   hàng chip trên màn hẹp; các chip khác (Giá/Hoa hồng/Kênh) vốn đã ngắn, không cần giới hạn. */
.order-card .oc-chip-shop { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Đường kẻ mờ tách 3 vùng: [ngày+trạng thái+mã+SP] / [chip thông tin] / [hoàn tất+tiền hoàn]. */
.order-card .oc-divider { height: 1px; background: var(--border); margin: 12px 0; }
/* Đứt nét ngay trên hàng Giá trị/tiền hoàn — đồng bộ .oc-foot bên /my-orders.html. */
.order-card .oc-divider-dashed { height: 0; background: none; border-top: 1px dashed var(--border); }
.order-card .oc-bottom { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.order-card .oc-value { font-size: 12.5px; color: var(--text-muted); }
.order-card .oc-value b { color: var(--text); font-weight: 700; font-size: 14px; }
/* Tiền hoàn dạng PILL nổi bật (trước đây chỉ là chữ đậm màu xanh, không đủ "phần thưởng"). */
.order-card .oc-cashback {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--ok-bg);
  color: var(--ok-text);
  font-weight: 800;
  font-size: 14px;
  white-space: nowrap;
}

.orders-count { font-size: 13px; color: var(--text-muted); margin: -4px 0 10px; }

/* ── Trạng thái rỗng (empty state) ────────────────────────────────────── */

.empty-state { text-align: center; padding: 50px 20px; }
.empty-state .es-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--accent-tint);
  color: var(--accent-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}
.empty-state h3 { font-size: 16px; margin-bottom: 6px; color: var(--text); }
.empty-state p { font-size: 13px; color: var(--text-muted); margin-bottom: 10px; }
.empty-state .es-note { font-size: 12px; color: var(--accent-dark); font-weight: 600; margin-bottom: 18px; }

/* ── Ví số dư / avatar / menu tài khoản trong header ─────────────────── */
/* Bấm avatar mở dropdown gộp số dư + Tài khoản + Đăng xuất — thay vì 3 phần tử rời trên
   header (số dư dài dễ tràn hàng, đặc biệt màn hình vừa). */

.user-menu-wrap { position: relative; flex-shrink: 0; }

.avatar-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  border: none;
  background: none;
  font: inherit;
  padding: 0;
  cursor: pointer;
}
.avatar-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-tint);
  color: var(--accent-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  overflow: hidden;
  flex-shrink: 0;
}
/* Chỉ avatar trên header (nút mở menu tài khoản) mới cần đổ bóng giống 2 nút theme/thông báo
   cạnh nó — avatar ở trang Tài khoản hay list Giới thiệu dùng chung class này nhưng không cần. */
.avatar-chip .avatar-circle { box-shadow: var(--shadow); }
.avatar-circle img { width: 100%; height: 100%; object-fit: cover; }
.avatar-chip .avatar-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-menu-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 220px;
  max-width: calc(100vw - 32px);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  z-index: 50;
  display: none;
  overflow: hidden;
}
.user-menu-dropdown.open { display: block; }
/* Đầu dropdown: avatar + tên khách. Trên màn hình hẹp tên cạnh avatar bị ẩn để nhường chỗ cho
   nav, mở dropdown ra mới biết đang đăng nhập bằng tài khoản nào. */
.user-menu-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.user-menu-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.user-menu-balance {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.user-menu-balance-label { font-size: 12px; color: var(--text-secondary); }
.user-menu-balance-value { font-size: 18px; font-weight: 800; color: var(--ok-text); }
.user-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  background: none;
  border: none;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}
.user-menu-item:hover { background: var(--bg); }

/* ── Chuông thông báo ─────────────────────────────────────────────────── */

.notif-wrap { position: relative; flex-shrink: 0; }
.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #e0392b;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.notif-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 320px;
  max-width: calc(100vw - 32px);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  z-index: 50;
  display: none;
  overflow: hidden;
}
.notif-dropdown.open { display: block; }
/* Mobile: neo theo viewport thay vì theo icon chuông — icon chuông không còn nằm sát mép phải
   header sau khi đổi thứ tự icon, nên dropdown 320px định vị "right:0" theo icon sẽ tràn ra
   ngoài mép trái màn hình hẹp. */
@media (max-width: 720px) {
  .notif-dropdown {
    position: fixed;
    top: calc(var(--header-height, 70px) + 8px);
    left: 12px;
    right: 12px;
    width: auto;
    max-width: none;
  }
  .user-menu-dropdown {
    position: fixed;
    top: calc(var(--header-height, 70px) + 8px);
    right: 12px;
    width: 220px;
    max-width: calc(100vw - 24px);
  }
}
.notif-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 14px;
}
.notif-dropdown-header button {
  background: none;
  border: none;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.notif-list { max-height: 360px; overflow-y: auto; }
.notif-item { padding: 12px 16px; border-bottom: 1px solid var(--border); }
.notif-item:last-child { border-bottom: none; }
.notif-item.unread { background: var(--accent-tint); }
/* .notif-page-item = trang Thông báo đầy đủ (notifications.html), .notif-item = dropdown chuông
   trên header — 2 nơi khác class bọc ngoài nhưng dùng chung .notif-title/.notif-detail/.notif-time
   nên phải khai chung, thiếu 1 trong 2 là chữ rơi về mặc định (không đậm nhạt, mất phân cấp). */
.notif-item .notif-title,
.notif-page-item .notif-title { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 3px; }
.notif-item .notif-detail,
.notif-page-item .notif-detail { font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; }
.notif-item .notif-time,
.notif-page-item .notif-time { font-size: 11px; color: var(--text-muted); }
.notif-empty { padding: 32px 16px; text-align: center; color: var(--text-muted); font-size: 13px; }

/* ── Biểu đồ đơn hàng theo tháng (trục Y luôn hiện, kể cả chưa có đơn) ──── */

.chart-wrap { display: flex; gap: 8px; }
.chart-yaxis {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 22px;
  padding-bottom: 22px;
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
  flex-shrink: 0;
}
/* position:relative — .chart-tooltip định vị absolute theo khối này (toạ độ tính bằng
   getBoundingClientRect() rồi trừ offset của chính .chart-area). */
.chart-area { position: relative; flex: 1; min-width: 0; }
.chart-svg { width: 100%; height: 180px; display: block; overflow: visible; }
.chart-gridline { stroke: var(--border); stroke-width: 1; stroke-dasharray: 4 4; }
.chart-bar { fill: var(--accent); transition: fill 0.15s; }
.chart-bar.active { fill: var(--accent-dark); }
.chart-bar-hit { fill: transparent; cursor: pointer; }
.chart-tooltip {
  position: absolute;
  z-index: 5;
  background: var(--card);
  border: 1px solid var(--accent-tint-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  padding: 8px 14px;
  min-width: 120px;
  pointer-events: none;
}
.ct-label { font-size: 13px; font-weight: 700; color: var(--text); }
.ct-value { font-size: 12.5px; color: var(--accent-dark); font-weight: 600; margin-top: 2px; }
.chart-xaxis { display: flex; margin-top: 6px; }
.chart-xaxis span { flex: 1; text-align: center; font-size: 10px; color: var(--text-muted); white-space: nowrap; }
@media (max-width: 600px) {
  .chart-xaxis span:nth-child(even) { visibility: hidden; }
}

/* ── Card hồ sơ dashboard ─────────────────────────────────────────────── */

.profile-card { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; border-left: 4px solid var(--accent); }
.profile-card .avatar-circle { width: 56px; height: 56px; font-size: 20px; border: 2px solid var(--accent-tint); }
.profile-card .profile-info { flex: 1; min-width: 160px; }
.profile-card .profile-info .greeting { font-size: 13px; color: var(--text-secondary); }
.profile-card .profile-info .name { font-size: 20px; font-weight: 700; color: var(--text); }
.profile-card .profile-info .email { font-size: 13px; color: var(--text-muted); }

.profile-actions-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }

/* ── Banner giới thiệu bạn bè (dashboard) ────────────────────────────── */

.referral-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  background: linear-gradient(135deg, #E8630A 0%, #FF9142 55%, #FFB273 100%);
  border-radius: var(--radius);
  padding: 18px 22px;
  color: #fff;
  text-decoration: none;
  margin-bottom: 24px;
  box-shadow: var(--shadow-accent);
}
.referral-banner-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.referral-banner-text { flex: 1; min-width: 0; }
.referral-banner-title { font-weight: 700; font-size: 15px; margin-bottom: 3px; }
.referral-banner-sub { font-size: 13px; opacity: 0.92; }
.referral-banner-arrow { font-size: 22px; opacity: 0.9; flex-shrink: 0; }

/* ── Trang Rút tiền ───────────────────────────────────────────────────── */

/* Icon $ tròn — cùng "trọng lượng" hình ảnh với icon các finance-row bên dưới, làm điểm
   neo thị giác thay vì chỉ có 2 dòng chữ trần trụi trước đây. */
.finance-head-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--ok-bg);
  color: var(--ok-text);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.finance-head-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.finance-title { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 14px; }
/* "Có thể rút" và số tiền đi baseline chung 1 dòng từng nhìn lệch/không ăn nhập (cỡ chữ chênh
   nhau quá nhiều mà canh cùng đường baseline). Đổi thành caption viết hoa nhỏ NẰM TRÊN số tiền
   — đúng mẫu .fr-label/.fr-value đã dùng ở các dòng finance-row bên dưới, đồng bộ trong 1 card. */
.finance-value {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.finance-value #balanceText {
  display: block;
  margin-top: 2px;
  font-size: 22px;
  font-weight: 800;
  text-transform: none;
  letter-spacing: normal;
  color: var(--ok-text);
}

.finance-row { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 10px; }
.finance-row:last-child { margin-bottom: 0; }
.finance-row .fr-icon { width: 36px; height: 36px; border-radius: 50%; background: var(--bg); color: var(--text-muted); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.finance-row .fr-body { flex: 1; min-width: 0; }
.finance-row .fr-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.finance-row .fr-value { font-size: 16px; font-weight: 800; color: var(--text); margin-top: 2px; }
/* Đồng bộ màu với admin panel (admin/style.css .money-pending/.money-available/.money-withdrawn)
   và badge trạng thái đơn ở trang Đơn hàng: Đang chờ=vàng, Có thể rút=xanh, Đã nhận=xám. */
.finance-row.pending .fr-icon     { background: var(--warn-bg); color: var(--warn-text); }
.finance-row.pending .fr-value    { color: var(--warn-text); }
.finance-row.available .fr-icon   { background: var(--ok-bg); color: var(--ok-text); }
.finance-row.available .fr-value  { color: var(--ok-text); }
.finance-row.withdrawn .fr-icon   { background: var(--neutral-bg); color: var(--neutral-text); }
.finance-row.withdrawn .fr-value  { color: var(--neutral-text); }

/* ── Bố cục trang Rút tiền (MOBILE FIRST) ────────────────────────────────
   MẶC ĐỊNH = mobile, giữ NGUYÊN bố cục cũ: 1 cột, bề ngang như main.narrow, thứ tự
   Tài chính (gập được) → Tạo lệnh → Giao dịch. Thứ tự đó chính là thứ tự DOM nên chỉ
   cần display:block, card tự xếp dọc bằng margin-bottom sẵn có — không cần order/gap.
   Từ 901px trở lên mới bật thêm bố cục 2 cột cho màn rộng. */
main.wd-page { max-width: 560px; }
.wd-layout { display: block; }
.wd-col-main, .wd-col-side { min-width: 0; }

@media (min-width: 901px) {
  /* Rộng hơn main.wide (820px) vì chứa 2 cột — chỉ áp cho trang Rút tiền, không đụng
     orders/guide/notifications cũng đang dùng .wide. */
  main.wd-page { max-width: 1040px; }
  .wd-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 20px;
    align-items: start;
  }
  /* Đặt cột tường minh: DOM để Tài chính TRƯỚC (cho mobile) nhưng desktop hiển thị bên PHẢI */
  .wd-col-main { grid-column: 1; grid-row: 1; }
  .wd-col-side { grid-column: 2; grid-row: 1; }
  /* Card Tài chính đã có chỗ riêng ở cột phải → luôn mở, bỏ nút gập */
  .wd-col-side .collapsible-body { display: block; }
  .wd-col-side .collapsible-head { cursor: default; }
  .wd-col-side .collapsible-head .cs-chevron { display: none; }
}

.wd-steps { display: flex; align-items: center; gap: 10px; margin: 16px 0 20px; }
.wd-step { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--text-muted); }
.wd-step.active { color: var(--accent-dark); }
.wd-step-num { width: 26px; height: 26px; border-radius: 50%; background: var(--border); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 800; flex-shrink: 0; }
.wd-step.active .wd-step-num { background: var(--accent); }
.wd-step-line { flex: 1; height: 2px; background: var(--border); max-width: 60px; }

.wd-warning {
  background: var(--accent-tint);
  border: 1px solid var(--accent-tint-strong);
  color: var(--accent-dark);
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
}
.wd-warning a { color: inherit; text-decoration: underline; }

.wd-history-item { display: flex; align-items: center; gap: 12px; padding: 14px; background: var(--bg); border-radius: var(--radius-sm); margin-bottom: 8px; border: 1px solid transparent; transition: border-color .15s, background .15s; }
.wd-history-item:hover { border-color: var(--border); }
.wd-history-item:last-child { margin-bottom: 0; }
.wd-h-icon { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.wd-h-icon.pending { background: var(--accent-tint); color: var(--accent-dark); }
.wd-h-icon.paid { background: var(--ok-bg); color: var(--ok-text); }
.wd-h-icon.rejected { background: var(--err-bg); color: var(--err-text); }
.wd-h-left { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.wd-h-code { font-size: 13px; font-weight: 700; color: var(--text); }
.wd-h-time { font-size: 11px; color: var(--text-muted); }
.wd-h-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; }
.wd-h-amount { font-size: 17px; font-weight: 800; color: var(--text); letter-spacing: -0.2px; }
.wd-h-amount.paid { color: var(--ok-text); }
.wd-h-amount.rejected { color: var(--text-muted); text-decoration: line-through; }
.wd-h-status { font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.wd-h-status.pending { background: var(--accent-tint); color: var(--accent-dark); }
.wd-h-status.paid { background: var(--ok-bg); color: var(--ok-text); }
.wd-h-status.rejected { background: var(--err-bg); color: var(--err-text); }

/* ── Phân trang list (Trước/Sau) — dùng chung nhiều trang, xem portal-pagination.js ─── */
.pg-nav { display: flex; align-items: center; justify-content: center; gap: 14px; padding-top: 14px; margin-top: 4px; }
.pg-btn { border: 1px solid var(--border); background: var(--card); color: var(--text); font-size: 13px; font-weight: 600; padding: 6px 14px; border-radius: 8px; cursor: pointer; }
.pg-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.pg-btn:disabled { opacity: 0.4; cursor: default; }
.pg-info { font-size: 13px; color: var(--text-secondary); }

/* ── Trang Giới thiệu bạn bè ──────────────────────────────────────────── */

/* Card % hoa hồng — cùng kiểu icon tròn + label/value stack với .finance-head-icon bên trang
   Rút tiền (đồng bộ ngôn ngữ hình ảnh giữa các trang portal). */
/* align-items: flex-start (không phải center) — card giờ 3 dòng (label/value/desc), icon
   center theo chiều dọc sẽ lệch xuống giữa khối chữ cao hơn hẳn 1 dòng số %. */
.ref-rate-card { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 16px; }
.ref-rate-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--accent-tint);
  color: var(--accent-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ref-rate-body { display: flex; flex-direction: column; }
.ref-rate-label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.ref-rate-value { margin-top: 2px; font-size: 22px; font-weight: 800; color: var(--accent-dark); }
.ref-rate-desc { margin-top: 4px; font-size: 12.5px; line-height: 1.5; color: var(--text-secondary); }
.ref-rate-desc strong { color: var(--text); font-weight: 700; }

.ref-highlight { background: var(--accent-tint); border: 1px solid var(--accent-tint-strong); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; }
.ref-highlight .label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--accent-dark); margin-bottom: 8px; }
.ref-code-row { display: flex; gap: 10px; margin-bottom: 18px; }
.ref-code-box {
  flex: 1;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--text);
  display: flex;
  align-items: center;
  min-width: 0;
  overflow-x: auto;
  white-space: nowrap;
}
.ref-code-row .btn-outline { flex-shrink: 0; white-space: nowrap; }
.ref-link-row { position: relative; margin-bottom: 14px; }
.ref-link-row .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.ref-link-row input {
  width: 100%;
  padding: 14px 14px 14px 40px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text);
}
.ref-action-row { display: flex; gap: 10px; }
.ref-action-row .submit { margin-top: 0; flex: 2; }
.ref-action-row .btn-outline { flex: 1; justify-content: center; }

.ref-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--bg); border-radius: var(--radius-sm); margin-bottom: 8px; border: 1px solid transparent; transition: border-color .15s; }
.ref-item:hover { border-color: var(--border); }
.ref-item:last-child { margin-bottom: 0; }
.ref-item-avatar.avatar-circle { width: 38px; height: 38px; font-size: 15px; flex-shrink: 0; }
.ref-item-left { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.ref-item-name { font-size: 13px; font-weight: 700; color: var(--text); }
.ref-item-meta { font-size: 11px; color: var(--text-muted); }
.ref-item-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.ref-item-amount { font-size: 14px; font-weight: 800; color: var(--ok-text); }
.ref-item-pending { font-size: 10.5px; font-weight: 600; color: var(--accent-dark); background: var(--accent-tint); padding: 2px 8px; border-radius: 999px; white-space: nowrap; }

.ref-history-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--bg); border-radius: var(--radius-sm); margin-bottom: 8px; border: 1px solid transparent; transition: border-color .15s; }
.ref-history-item:hover { border-color: var(--border); }
.ref-history-item:last-child { margin-bottom: 0; }
.ref-history-icon { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ref-history-icon.pending { background: var(--accent-tint); color: var(--accent-dark); }
.ref-history-icon.positive { background: var(--ok-bg); color: var(--ok-text); }
.ref-history-icon.negative { background: var(--err-bg); color: var(--err-text); }
.ref-history-left { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.ref-history-title { font-size: 13px; font-weight: 700; color: var(--text); }
.ref-history-time { font-size: 11px; color: var(--text-muted); }
.ref-history-amount { font-size: 15px; font-weight: 800; flex-shrink: 0; letter-spacing: -0.2px; }
.ref-history-amount.positive { color: var(--ok-text); }
.ref-history-amount.pending { color: var(--accent-dark); }
.ref-history-amount.negative { color: var(--err-text); }

/* ── Trang Thông báo đầy đủ ───────────────────────────────────────────── */

.notif-page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.notif-page-head h1 { margin-bottom: 0; }
.notif-tabs { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.notif-tab { padding: 8px 16px; border-radius: 999px; border: 1px solid var(--border); background: var(--card); color: var(--text-secondary); font-size: 13px; font-weight: 700; cursor: pointer; }
.notif-tab.active { background: var(--accent-tint); color: var(--accent-dark); border-color: var(--accent-tint-strong); }
.notif-count { font-size: 12px; color: var(--text-muted); margin-bottom: 12px; }

.notif-page-item { display: flex; gap: 12px; padding: 14px; border-radius: var(--radius-sm); background: var(--bg); margin-bottom: 8px; }
.notif-page-item:last-child { margin-bottom: 0; }
.notif-page-item.unread { background: var(--accent-tint); }
.notif-page-icon { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: var(--card); color: var(--text-muted); }
.notif-page-icon.ok { background: var(--ok-bg); color: var(--ok-text); }
.notif-page-icon.err { background: var(--err-bg); color: var(--err-text); }
.notif-page-body { flex: 1; min-width: 0; }

.notif-dropdown-footer { text-align: center; padding: 10px; border-top: 1px solid var(--border); }
.notif-dropdown-footer a { font-size: 12px; font-weight: 700; color: var(--accent-dark); text-decoration: none; }

/* ── Walkthrough hướng dẫn khách mới (spotlight tour) ────────────────── */

.tour-overlay { position: fixed; inset: 0; z-index: 199; background: transparent; }
.tour-highlight {
  position: fixed;
  z-index: 200;
  border-radius: 10px;
  border: 2px solid var(--accent);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  transition: top 0.25s ease, left 0.25s ease, width 0.25s ease, height 0.25s ease;
}
.tour-tooltip {
  position: fixed;
  z-index: 201;
  background: var(--card);
  color: var(--text);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 18px;
  width: min(300px, calc(100vw - 24px));
}
.tour-tooltip .tour-step { font-size: 11px; font-weight: 700; color: var(--accent-dark); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 6px; }
.tour-tooltip h3 { font-size: 15px; margin-bottom: 6px; color: var(--text); }
.tour-tooltip p { font-size: 13px; color: var(--text-secondary); line-height: 1.5; margin-bottom: 14px; }
.tour-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.tour-actions-right { display: flex; gap: 8px; align-items: center; }
.tour-skip { background: none; border: none; color: var(--text-muted); font-size: 12px; cursor: pointer; font-weight: 600; padding: 0; }
.tour-back { background: none; border: none; color: var(--accent-dark); font-size: 13px; font-weight: 700; cursor: pointer; padding: 0; }
.tour-next { background: var(--accent); color: #fff; border: none; border-radius: var(--radius-sm); padding: 8px 16px; font-size: 13px; font-weight: 700; cursor: pointer; }

/* ── Xung đột tài khoản ngân hàng sau khi liên kết Zalo ──────────────── */

.bank-conflict-options { display: flex; flex-direction: column; gap: 12px; }
.bank-conflict-option { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; }
.bank-conflict-label { font-weight: 700; font-size: 13px; color: var(--text); margin-bottom: 8px; }
.bank-conflict-detail { font-size: 13px; color: var(--text-secondary); line-height: 1.7; margin-bottom: 12px; }
.bank-conflict-detail b { color: var(--text); }

.bank-conflict-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.logout-modal-overlay {
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.bank-conflict-modal {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 460px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
}
.bank-conflict-modal h3 { font-size: 17px; margin-bottom: 8px; color: var(--text); }
.bank-conflict-modal > p { font-size: 13px; color: var(--text-secondary); line-height: 1.6; margin-bottom: 16px; }

/* ── Modal xác nhận đăng xuất — dùng chung overlay .bank-conflict-modal-overlay ── */
.logout-modal {
  background: var(--card);
  border-radius: var(--radius);
  padding: 28px 24px 24px;
  max-width: 340px;
  width: 100%;
  box-shadow: var(--shadow-md);
  text-align: center;
}
.logout-modal-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--err-bg);
  color: var(--err-text);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}
.logout-modal h3 { font-size: 18px; margin-bottom: 8px; color: var(--text); }
.logout-modal p { font-size: 13.5px; color: var(--text-secondary); line-height: 1.6; margin-bottom: 22px; }
.logout-modal-actions { display: flex; gap: 10px; }
.logout-modal-actions .btn-outline { flex: 1; justify-content: center; }
.logout-modal-confirm {
  flex: 1;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  background: var(--err-text);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}
.logout-modal-confirm:hover { opacity: 0.9; }


/* ── Tóm tắt kết quả chuyển đổi (nhiều link) ─────────────────────────────
   Khách chuyển tối đa 3 link/lần nên cần 1 dòng đọc phát biết ngay đã xong mấy cái. */
.cr-summary { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.cr-summary .crs-label { font-size: 15px; font-weight: 700; color: var(--text); }
.cr-summary .crs-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: var(--ok-tint, rgba(34, 160, 90, 0.12));
  color: var(--ok, #22A05A);
}
.cr-summary .crs-badge.running { background: var(--accent-tint); color: var(--accent-dark); }
.cr-summary .crs-badge.fail { background: rgba(214, 60, 60, 0.12); color: #D63C3C; }
.cr-list { display: flex; flex-direction: column; gap: 14px; }
.cr-error {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid rgba(214, 60, 60, 0.35);
  background: rgba(214, 60, 60, 0.06);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.cr-error .cre-icon {
  flex-shrink: 0;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: rgba(214, 60, 60, 0.15);
  color: #D63C3C;
  display: flex; align-items: center; justify-content: center;
}
.cr-error .cre-body { min-width: 0; flex: 1; }
.cr-error .cre-title { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.cr-error .cre-url { font-size: 12px; color: var(--text-muted); word-break: break-all; margin-bottom: 4px; }
.cr-error .cre-msg { font-size: 12.5px; color: #D63C3C; }


/* ── Nút xoá nhanh nội dung ô nhập link ──────────────────────────────────
   Chỉ hiện khi ô có chữ (class .has-value do JS gắn) — ô rỗng mà vẫn có dấu × thì thừa. */
.field-wrap { position: relative; flex: 1; min-width: 0; display: flex; }
.field-wrap input[type=text] { padding-right: 40px; }
.field-clear {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}
.field-clear:hover { background: var(--bg); color: var(--text); }
.field-wrap.has-value .field-clear { display: flex; }

/* ── Khối luật trong card "Quan trọng" ───────────────────────────────────
   Nền card + viền riêng cho từng khối (thay vì nền xám phẳng) để tách bạch từng ý;
   số tròn cam viền đậm, canh flex-start để chữ dài xuống dòng thụt vào dưới chữ, không
   chui xuống dưới số. Chỉ áp trong #rulesBody để không đụng .rule-row ở guide.html. */
#rulesBody .rule-row {
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 10px;
  line-height: 1.5;
  color: var(--text);
}
#rulesBody .rule-row .rule-num {
  width: 24px;
  height: 24px;
  font-size: 12px;
  border: 1.5px solid var(--accent);
  background: var(--accent-tint);
  color: var(--accent-dark);
  margin-top: 1px;
}
