/* =====================================================================
   Tài khoản HưngThịnh Soft — giao diện theo thương hiệu hungthinhsoft.com
   Phong cách "accent ladder": màu xanh lá thương hiệu đậm chỉ ở điểm nhỏ
   (nút chính, trạng thái, liên kết); các mảng lớn dùng tông xanh bạc hà nhạt.
   Không gradient, không đổ bóng cho khối đứng yên, tách lớp bằng 1 bậc tông màu.
   ===================================================================== */
:root {
  /* Thương hiệu (đo từ hungthinhsoft.com) */
  --accent: #14946c;          /* xanh lá chính: nút, điểm nhấn nhỏ */
  --accent-fill: #0f7b59;      /* nền nút: chữ trắng đạt 5:1 */
  --accent-press: #0b6b4d;
  --accent-ink: #0b6b4d;      /* chữ màu xanh trên nền trắng/mint (>= 4.5:1) */
  --tint-50: #f7fbf9;         /* nền trang */
  --tint-100: #eef6f2;        /* mảng nền khối, khung ảnh */
  --tint-200: #e1f3ea;        /* trạng thái chọn, nhãn */
  --tint-300: #c6e8d7;
  --deep: #08261e;            /* xanh rêu đậm (chân trang thương hiệu) */

  --ground: var(--tint-50);
  --surface: #ffffff;
  --border: #e3ebe8;
  --rule: #edf3f0;
  --control: #cbd8d2;

  --text: #0f2a3d;            /* chữ chính xanh than */
  --muted: #516476;           /* chữ phụ (6:1 trên trắng) */

  --positive-bg: #e1f3ea;  --positive-ink: #0b5c42;
  --warning-bg: #fff6e0;   --warning-ink: #8a4b00;   --warning-line: #f6d79a;
  --negative-bg: #fdecec;  --negative-ink: #a1261f;
  --neutral-bg: #eef1f3;   --neutral-ink: #43566a;

  --radius-card: 16px;
  --radius-well: 12px;
  --radius-control: 10px;
  --control-height: 44px;

  --font: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
  --fs-title: 28px;
  --fs-section: 18px;
  --fs-body: 15px;
  --fs-small: 13px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: 1.55;
  color: var(--text);
  background: var(--ground);
}
a { color: var(--accent-ink); }
a:hover { color: var(--accent); }
img { max-width: 100%; display: block; }
h1, h2, h3 { color: var(--text); letter-spacing: -0.01em; margin: 0; }
p { margin: 0; }
:focus-visible { outline: 3px solid var(--tint-300); outline-offset: 2px; }
::selection { background: var(--tint-300); }

/* ---------- Thanh trên cùng ---------- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar-inner {
  max-width: 1180px; margin: 0 auto; padding: 0 24px;
  height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 24px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand:hover { color: var(--text); }
.brand-mark { width: 38px; height: 38px; flex: none; }
.brand { flex: none; }
.brand-name { display: flex; flex-direction: column; gap: 4px; line-height: 1.15; white-space: nowrap; }
.brand-name strong { font-size: 17px; font-weight: 800; letter-spacing: 0.01em; }
.brand-name span { font-size: 12px; color: var(--muted); font-weight: 500; }

.topnav { display: flex; align-items: center; gap: 2px; flex-wrap: nowrap; min-width: 0; }
.topnav a, .topnav .link-button {
  display: inline-flex; align-items: center; height: 38px; padding: 0 11px; white-space: nowrap; flex: none;
  border-radius: var(--radius-control); border: 0; background: none;
  color: var(--muted); font: 500 14px/1 var(--font); text-decoration: none; cursor: pointer;
}
.topnav a:hover, .topnav .link-button:hover { color: var(--text); background: var(--tint-100); }
.topnav a[aria-current="page"] { color: var(--accent-ink); background: var(--tint-200); font-weight: 600; }
.topnav .user-chip { color: var(--text); font-weight: 600; padding: 0 4px 0 10px; white-space: nowrap; max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
.topnav-sep { width: 1px; height: 24px; background: var(--border); margin: 0 6px; flex: none; }
.topbar-link { color: var(--muted); font-size: 14px; font-weight: 500; text-decoration: none; }

/* Menu gập trên điện thoại (không cần JS) */
.navmenu { display: none; position: relative; }
.navmenu summary {
  list-style: none; cursor: pointer; height: 40px; padding: 0 14px;
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--control); border-radius: var(--radius-control);
  font: 600 14px/1 var(--font); color: var(--text); background: var(--surface);
}
.navmenu summary::-webkit-details-marker { display: none; }
.navmenu-sheet {
  position: absolute; right: 0; top: 48px; z-index: 20; min-width: 240px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-well);
  padding: 8px; box-shadow: 0 12px 32px rgba(15, 42, 61, 0.12);
  display: flex; flex-direction: column;
}
.navmenu-sheet a, .navmenu-sheet button {
  display: flex; align-items: center; min-height: 44px; padding: 0 12px; border-radius: 8px;
  color: var(--text); text-decoration: none; font: 500 15px/1 var(--font); background: none; border: 0; width: 100%; text-align: left;
}
.navmenu-sheet a:hover, .navmenu-sheet button:hover { background: var(--tint-100); }
.navmenu-who { padding: 10px 12px 12px; border-bottom: 1px solid var(--rule); margin-bottom: 6px; font-size: 13px; color: var(--muted); }
.navmenu-who strong { display: block; color: var(--text); font-size: 15px; }

/* ---------- Nút ---------- */
[hidden] { display: none !important; }
.btn-primary, .btn-main {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--control-height); padding: 0 20px;
  background: var(--accent-fill); border: 2px solid var(--accent-fill); color: #fff;
  border-radius: var(--radius-control); font: 700 15px/1 var(--font); text-decoration: none;
  transition: background-color .15s ease, transform .1s ease;
}
.btn-primary:hover, .btn-primary:focus, .btn-main:hover { background: var(--accent-press); border-color: var(--accent-press); color: #fff; }
.btn-primary:active, .btn-main:active { transform: translateY(1px); }
.btn-primary:disabled { background: var(--control); border-color: var(--control); color: var(--neutral-ink); }
.btn-ghost, .btn-outline-secondary, .btn-outline-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--control-height); padding: 0 18px;
  background: var(--surface); border: 2px solid var(--border); color: var(--text);
  border-radius: var(--radius-control); font: 700 15px/1 var(--font); text-decoration: none;
  transition: border-color .15s ease, background-color .15s ease;
}
.btn-ghost:hover, .btn-outline-secondary:hover, .btn-outline-primary:hover { border-color: var(--accent); background: var(--tint-50); color: var(--accent-ink); }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; }
.btn-outline-danger { border-radius: var(--radius-control); font-weight: 600; }
.btn-ghost[aria-disabled="true"] { color: var(--muted); border-color: var(--rule); background: var(--tint-50); cursor: default; }

/* ---------- Biểu mẫu ---------- */
.form-label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 8px; color: var(--text); }
.form-control, .form-select {
  height: var(--control-height); padding: 0 14px; font: 400 15px var(--font); color: var(--text);
  background: var(--surface); border: 1px solid var(--control); border-radius: var(--radius-control);
}
.form-control::placeholder { color: #6b7c8a; }
.form-control:focus, .form-select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--tint-200); outline: none; }
.form-check-input:checked { background-color: var(--accent); border-color: var(--accent); }
.form-check-input:focus { box-shadow: 0 0 0 3px var(--tint-200); border-color: var(--accent); }
.text-danger { color: var(--negative-ink) !important; font-size: 13px; }
.text-success { color: var(--positive-ink) !important; }
.text-muted { color: var(--muted) !important; }
.hint { font-size: 13px; color: var(--muted); margin-top: 6px; }
.small-link { color: var(--accent-ink); font-weight: 600; text-decoration: none; }
.small-link:hover { text-decoration: underline; }
.alert { border-radius: var(--radius-control); border: 0; font-size: 14px; padding: 12px 16px; margin-bottom: 20px; }
.alert-success { background: var(--positive-bg); color: var(--positive-ink); }
.alert-danger { background: var(--negative-bg); color: var(--negative-ink); }
.alert-info { background: var(--tint-100); color: var(--text); }
.otp-row { display: flex; gap: 8px; }
.otp-row .form-control { flex: 1; min-width: 0; }
.otp-row .btn { white-space: nowrap; height: var(--control-height); border-radius: var(--radius-control); }

/* =====================================================================
   TRANG ĐĂNG NHẬP / ĐĂNG KÝ: form bên trái, bộ phần mềm bên phải
   ===================================================================== */
.auth-shell {
  flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 48px 24px 56px;
  display: grid; grid-template-columns: minmax(0, 480px) minmax(0, 1fr); gap: 48px; align-items: center;
}
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 36px 36px 32px; }
.auth-card h1 { font-size: var(--fs-title); font-weight: 800; line-height: 1.2; margin-bottom: 8px; }
.auth-sub { color: var(--muted); margin-bottom: 24px; font-size: 15px; }
.auth-card .mb-3 { margin-bottom: 18px !important; }
.auth-card .btn-primary.w-100 { margin-top: 4px; }
.auth-foot { text-align: center; margin-top: 24px; font-size: 14px; color: var(--muted); }
.auth-foot a { font-weight: 700; text-decoration: none; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; margin: 22px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.btn-google {
  width: 100%; height: var(--control-height); display: flex; align-items: center; justify-content: center; gap: 10px;
  background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius-control);
  font: 600 15px var(--font); color: var(--text);
}
.btn-google:hover { border-color: var(--accent); background: var(--tint-50); }

/* Cột phải: bộ phần mềm dùng chung một tài khoản */
.auth-aside { background: var(--tint-100); border-radius: var(--radius-card); padding: 36px 36px 32px; }
.auth-aside h2 { font-size: 26px; font-weight: 800; line-height: 1.25; }
.auth-aside > p { color: var(--muted); margin-top: 10px; max-width: 46ch; }
.auth-points { list-style: none; padding: 0; margin: 28px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px 24px; font-size: 14px; }
.auth-points li { padding-left: 22px; position: relative; }
.auth-points li::before { content: ""; position: absolute; left: 0; top: 7px; width: 10px; height: 10px; border-radius: 3px; background: var(--accent); }

/* =====================================================================
   TRANG ỨNG DỤNG (Sản phẩm, Tài khoản, Quản trị)
   ===================================================================== */
.page-wide { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 36px 24px 56px; }
.page-head { margin-bottom: 24px; display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; }
.page-head > div { min-width: 0; }
.page-head h1 { font-size: var(--fs-title); font-weight: 800; line-height: 1.2; }
.page-head p { color: var(--muted); margin-top: 6px; font-size: 15px; }
.page-head .finding { color: var(--text); }
.page-head .finding strong { color: var(--accent-ink); }
.page-head .finding.warn strong { color: var(--warning-ink); }

/* Lưới sản phẩm: 4 cột ở 1132px = 4 × 271 + 3 × 16 */
.product-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.product { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 14px 14px 18px; display: flex; flex-direction: column; transition: border-color .15s ease; }
.product:hover { border-color: var(--tint-300); }
.product-art { background: var(--tint-100); border-radius: var(--radius-well); height: 236px; padding: 14px; overflow: hidden; }
.product-art img { width: 100%; height: 100%; object-fit: contain; transition: transform .25s ease; }
.product:hover .product-art img { transform: translateY(-3px); }
.product-body { padding: 16px 6px 0; display: flex; flex-direction: column; flex: 1; }
.product h2 { font-size: var(--fs-section); font-weight: 800; }
.product-desc { color: var(--muted); font-size: 14px; margin-top: 4px; }
.product-state { margin-top: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 13px; color: var(--muted); }
.product .btn-main, .product .btn-ghost { margin-top: auto; width: 100%; }
.product-action { margin-top: 18px; display: flex; flex: 1; align-items: flex-end; }

.pill { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 999px; font-size: 13px; font-weight: 600; white-space: nowrap; flex: none; }
.pill-on { background: var(--positive-bg); color: var(--positive-ink); }
.pill-trial { background: var(--tint-200); color: var(--accent-ink); }
.pill-warn { background: var(--warning-bg); color: var(--warning-ink); }
.pill-off { background: var(--negative-bg); color: var(--negative-ink); }
.pill-none { background: var(--neutral-bg); color: var(--neutral-ink); }

/* Khối tài khoản dưới lưới */
.account-strip { margin-top: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 22px 24px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; gap: 16px 24px; align-items: center; }
.account-strip dt { font-size: 13px; color: var(--muted); font-weight: 500; }
.account-strip dd { margin: 2px 0 0; font-weight: 600; overflow-wrap: anywhere; }
.account-strip h2 { grid-column: 1 / -1; font-size: 16px; font-weight: 700; }

/* ---------- Panel dùng chung (Tài khoản, Quản trị) ---------- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 24px; margin-bottom: 16px; }
.panel h2 { font-size: 17px; font-weight: 700; margin-bottom: 16px; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 12px; font-size: 14px; margin: 0 0 16px; }
.kv dt { color: var(--muted); font-weight: 400; }
.kv dd { margin: 0; }
.kv-tight { grid-template-columns: 140px 1fr; gap: 4px 10px; font-size: 13px; }

.search-bar { display: flex; gap: 8px; margin-bottom: 18px; max-width: 560px; }
.table-wrap { overflow-x: auto; }
.table { font-size: 14px; margin: 0; color: var(--text); }
.table > :not(caption) > * > * { border-bottom-color: var(--rule); padding: 12px 10px; background: transparent; }
.table th { font-weight: 500; color: var(--muted); font-size: 13px; white-space: nowrap; }
.table-hover > tbody > tr:hover > * { background: var(--tint-50); }
.app-chip { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--neutral-bg); color: var(--neutral-ink); margin: 1px 2px; }
.app-zalo, .app-sms, .app-email, .app-fb { background: var(--tint-200); color: var(--accent-ink); }
.app-admin { background: var(--warning-bg); color: var(--warning-ink); }
.admin-apps { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; margin-bottom: 16px; }
.admin-app { margin-bottom: 0; display: flex; flex-direction: column; }
.admin-app-head { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.admin-app-head h2 { margin: 0 0 4px; }
.admin-app-thumb { width: 48px; height: 60px; flex: none; background: var(--tint-100); border-radius: 8px; padding: 4px; overflow: hidden; }
.admin-app-thumb img { width: 100%; height: 100%; object-fit: contain; }
.badge-state-inline { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; }
.badge-state-inline.ok { background: var(--positive-bg); color: var(--positive-ink); }
.badge-state-inline.fail { background: var(--negative-bg); color: var(--negative-ink); }
.badge-state-inline.muted { background: var(--neutral-bg); color: var(--neutral-ink); }
.activate-form { border-top: 1px solid var(--rule); padding-top: 14px; margin-top: auto; }
.history-table td { font-size: 13px; }
.setup-steps { padding-left: 18px; font-size: 14px; }
.setup-steps li { margin-bottom: 6px; }
.shared-key { font-size: 13px; background: var(--tint-100); color: var(--accent-ink); padding: 2px 6px; border-radius: 6px; word-break: break-all; }
.qr-box { display: flex; justify-content: center; margin: 8px 0 20px; }

/* ---------- Chân trang ---------- */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); }
.site-footer-inner { max-width: 1180px; margin: 0 auto; padding: 20px 24px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; font-size: 13px; color: var(--muted); }
.site-footer a { color: var(--muted); text-decoration: none; font-weight: 500; }
.site-footer a:hover { color: var(--accent-ink); }

/* =====================================================================
   Máy tính bảng
   ===================================================================== */
@media (max-width: 1080px) {
  .auth-shell { grid-template-columns: minmax(0, 1fr); max-width: 640px; gap: 24px; padding-top: 32px; }
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .account-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .account-strip .btn-ghost { grid-column: 1 / -1; justify-self: start; }
}

/* =====================================================================
   Điện thoại
   ===================================================================== */
@media (max-width: 640px) {
  .topbar-inner { height: 60px; padding: 0 16px; }
  .brand-name span { display: none; }
  .topnav { display: none; }
  .navmenu { display: block; }
  .topbar-link { font-size: 13px; }

  .auth-shell { padding: 20px 16px 32px; gap: 16px; }
  .auth-card { padding: 24px 20px; border-radius: 14px; }
  .auth-card h1 { font-size: 24px; }
  .auth-aside { padding: 22px 20px; border-radius: 14px; }
  .auth-aside h2 { font-size: 20px; }
  .auth-points { grid-template-columns: 1fr; margin-top: 18px; }

  .page-wide { padding: 24px 16px 40px; }
  .page-head h1 { font-size: 24px; }
  /* Sản phẩm thành hàng ngang: ảnh hộp bên trái, thông tin bên phải */
  .product-grid { grid-template-columns: 1fr; gap: 12px; }
  .product { flex-direction: row; gap: 14px; padding: 12px; }
  .product-art { width: 96px; height: 128px; flex: none; padding: 8px; }
  .product-body { padding: 2px 0 0; min-width: 0; }
  .product h2 { font-size: 17px; }
  .product-desc { font-size: 13px; }
  .product-state { margin-top: 8px; }
  .product-action { margin-top: 12px; }
  .product .btn-main, .product .btn-ghost { height: 40px; font-size: 14px; }
  .account-strip { grid-template-columns: 1fr; padding: 18px; }
  .kv, .kv-tight { grid-template-columns: 1fr; }
  .panel { padding: 18px; }
  .search-bar { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}

/* Thanh trên cùng gập thành menu từ 1120px trở xuống (không đủ chỗ cho 6 mục + tên khách) */
@media (max-width: 1120px) {
  .topnav { display: none; }
  .navmenu { display: block; }
  .brand-name span { display: none; }
}

/* Máy tính: form đăng ký dài hơn cột giới thiệu, cột giới thiệu đi theo khi cuộn */
@media (min-width: 1081px) {
  .auth-aside { align-self: center; }
}

/* =====================================================================
   master-admin.html: danh sách tài khoản, cửa sổ tạo / sửa
   ===================================================================== */
.num { font-variant-numeric: tabular-nums; }
.accounts-panel { padding: 8px 0 0; }
.accounts-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 16px 24px 8px; }
.accounts-head h2 { margin: 0; }
.accounts-table th:first-child, .accounts-table td:first-child { padding-left: 24px; }
.accounts-table th:last-child, .accounts-table td:last-child { padding-right: 24px; }
.accounts-table td { vertical-align: middle; }
.accounts-table .sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.accounts-table td:first-child { min-width: 230px; }
.accounts-table td:first-child strong { white-space: nowrap; }
.accounts-table .cell-email { max-width: 270px; margin-top: 2px; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.accounts-table .cell-password { white-space: nowrap; }
.pw-box { display: inline-flex; align-items: center; gap: 4px; }
.pw-text { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 13px; background: var(--tint-100, #f1f5f9); padding: 2px 6px; border-radius: 4px; color: #b91c1c; font-weight: 600; letter-spacing: 0.5px; }
.btn-copy-icon { border: none; background: transparent; padding: 2px 4px; cursor: pointer; color: var(--muted); border-radius: 4px; display: inline-flex; align-items: center; justify-content: center; transition: color 0.15s, background 0.15s; }
.btn-copy-icon:hover { color: var(--ink); background: rgba(0,0,0,0.06); }
.accounts-table th.num, .accounts-table td.num { white-space: nowrap; }
.accounts-table .pill { height: 24px; font-size: 12px; }
.row-actions { white-space: nowrap; text-align: right; }
.row-actions .btn-sm + .btn-sm { margin-left: 6px; }
.empty-row { padding: 8px 24px 24px; color: var(--muted); }
.pager { display: flex; justify-content: flex-end; align-items: center; gap: 12px; padding: 16px 24px 20px; }

/* Cửa sổ nổi (dialog): đổ bóng chỉ dùng cho thứ thật sự nổi */
.sheet { width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 0; border-radius: var(--radius-card); color: var(--text); box-shadow: 0 24px 64px rgba(8, 38, 30, 0.22); }
.sheet::backdrop { background: rgba(8, 38, 30, 0.45); }
.sheet form { display: flex; flex-direction: column; max-height: calc(100vh - 48px); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 24px; border-bottom: 1px solid var(--rule); }
.sheet-head h2 { font-size: 20px; font-weight: 800; }
.sheet-close { width: 40px; height: 40px; border: 0; background: none; border-radius: var(--radius-control); font-size: 26px; line-height: 1; color: var(--muted); cursor: pointer; }
.sheet-close:hover { background: var(--tint-100); color: var(--text); }
.sheet-body { padding: 20px 24px 8px; overflow-y: auto; }
.sheet-foot { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; padding: 16px 24px 20px; border-top: 1px solid var(--rule); }
.req { color: var(--negative-ink); }
.opt { font-weight: 400; color: var(--muted); }
.label-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.link-action { border: 0; background: none; padding: 0; color: var(--accent-ink); font: 600 14px var(--font); cursor: pointer; }
.link-action:hover { text-decoration: underline; }
.joined { display: flex; }
.joined .form-control { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.joined .btn-ghost { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: -1px; border-width: 1px; border-color: var(--control); }
.pw-field { font-weight: 700; letter-spacing: 0.04em; color: var(--accent-ink); }
fieldset { border: 0; padding: 0; margin: 0; }
.app-checks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.app-check { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 6px 12px; border: 1px solid var(--control); border-radius: var(--radius-control); cursor: pointer; font-weight: 600; font-size: 14px; }
.app-check img { width: 30px; height: 40px; object-fit: contain; flex: none; }
.app-check input { width: 18px; height: 18px; accent-color: var(--accent-fill); flex: none; }
.app-check:has(input:checked) { border-color: var(--accent); background: var(--tint-100); }
.copy-preview { background: var(--tint-100); border-radius: var(--radius-well); padding: 12px 14px; margin: 4px 0 12px; }
.copy-preview-title { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.copy-preview pre { margin: 0; font-family: var(--font); font-size: 14px; white-space: pre-wrap; color: var(--text); }
.lock-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-control); background: var(--negative-bg); margin-bottom: 12px; cursor: pointer; }
.lock-row .form-check-input { margin-top: 3px; flex: none; }
.lock-row .form-check-input:checked { background-color: var(--negative-ink); border-color: var(--negative-ink); }

@media (max-width: 900px) {
  .accounts-table .cell-email { max-width: 160px; }
}

/* Điện thoại: mỗi tài khoản thành một khối 2 dòng, không cuộn ngang */
@media (max-width: 640px) {
  .accounts-head { padding: 14px 16px 6px; }
  .accounts-table thead { display: none; }
  .accounts-table, .accounts-table tbody, .accounts-table tr, .accounts-table td { display: block; width: 100%; }
  .accounts-table tr { padding: 12px 16px; border-bottom: 1px solid var(--rule); }
  .accounts-table > :not(caption) > * > * { border: 0; padding: 2px 0 !important; }
  .accounts-table td[data-label="Email"], .accounts-table td[data-label="Đăng nhập gần nhất"] { display: none; }
  .accounts-table td[data-label="Số điện thoại"] { font-weight: 600; }
  .accounts-table td[data-label="Mật khẩu"] { font-size: 13px; }
  .accounts-table td[data-label="Mật khẩu"]::before { content: "MK: "; font-weight: 600; color: var(--muted); }
  .accounts-table .cell-email { max-width: none; }
  .row-actions { text-align: left; padding-top: 8px !important; }
  .app-checks { grid-template-columns: 1fr; }
  .sheet-head, .sheet-body, .sheet-foot { padding-left: 18px; padding-right: 18px; }
  .sheet-foot .btn-main, .sheet-foot .btn-ghost { flex: 1 1 auto; }
}

/* ===== Cộng tác viên - Affiliate ===== */
/* Số liệu là chữ, không phải thẻ; màu xanh chỉ đặt lên dữ liệu chính (số dư, tiến độ, hoa hồng). */
.aff-facts { list-style: none; margin: 0 0 24px; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px 28px; }
.aff-facts li { display: flex; flex-direction: column; gap: 6px; }
.aff-facts strong { font-size: 30px; line-height: 1.1; font-weight: 800; letter-spacing: -0.02em; color: var(--accent-ink); font-variant-numeric: tabular-nums; }
.aff-facts span { font-size: 14px; color: var(--muted); line-height: 1.5; }
.aff-facts b { color: var(--text); font-weight: 600; }
.aff-facts-compact { margin-bottom: 0; }
.aff-facts-compact strong { font-size: 20px; color: var(--text); }
.aff-facts-compact span { font-size: 13px; }
.aff-join { padding: 32px; }
.aff-join h2 { font-size: 22px; margin-bottom: 8px; }
.aff-join-lead { max-width: 60ch; color: var(--muted); margin-bottom: 28px; }

.aff-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-bottom: 16px; }
.aff-top .panel { margin-bottom: 0; }
.aff-balance { font-size: 44px; line-height: 1.05; font-weight: 800; letter-spacing: -0.03em; color: var(--accent-ink); font-variant-numeric: tabular-nums; margin: 0; }
.aff-balance.neg { color: var(--negative-ink); }
.aff-balance-sub { color: var(--muted); font-size: 14px; margin: 8px 0 24px; }
.aff-balance-sub strong { color: var(--text); font-weight: 600; }
.aff-goal { margin-top: 18px; }
.aff-goal-head { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.aff-goal-state { font-weight: 400; color: var(--muted); text-align: right; }
.aff-bar { height: 8px; border-radius: 4px; background: var(--tint-200); overflow: hidden; }
.aff-bar i { display: block; height: 100%; background: var(--accent); border-radius: 4px; transition: width .4s ease; }
.aff-goal small { display: block; margin-top: 6px; font-size: 13px; color: var(--muted); }

.aff-link { display: flex; gap: 8px; }
.aff-link .form-control { flex: 1; min-width: 0; font-family: var(--font); font-size: 14px; }
.aff-code { margin: 14px 0 0; font-size: 14px; color: var(--muted); }
.aff-code strong { margin-left: 6px; padding: 3px 10px; border-radius: 8px; background: var(--tint-200); color: var(--accent-ink); font-size: 18px; font-weight: 800; letter-spacing: .08em; }
.aff-tips { margin: 18px 0 0; padding-left: 18px; font-size: 14px; color: var(--muted); line-height: 1.65; }
.aff-tips li + li { margin-top: 6px; }
.aff-tips strong { color: var(--text); }

.aff-funnel { padding: 22px 24px; }
.aff-funnel dl { margin: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px 28px; }
.aff-funnel dl > div { display: flex; flex-direction: column; gap: 2px; }
.aff-funnel dt { font-size: 13px; font-weight: 400; color: var(--muted); }
.aff-funnel dd { margin: 0; font-size: 28px; line-height: 1.15; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.aff-funnel dd.accent { color: var(--accent-ink); }
.aff-funnel small { font-size: 13px; color: var(--muted); }

.aff-lists { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.aff-lists .panel { margin-bottom: 0; }
.aff-table td, .aff-table th { vertical-align: top; }
.aff-name { display: block; font-weight: 500; }
.aff-sub { display: block; font-size: 13px; color: var(--muted); }
.aff-empty { color: var(--muted); padding: 20px 10px !important; }
.aff-in { color: var(--positive-ink); font-weight: 600; }
.aff-out { color: var(--negative-ink); font-weight: 600; }
.aff-zero { color: var(--muted); }
.aff-rules-foot { margin-top: 28px; padding: 4px 4px 0; }
.aff-rules-foot h2 { font-size: 15px; font-weight: 700; margin-bottom: 14px; color: var(--muted); }

@media (max-width: 991px) {
  .aff-top, .aff-lists { grid-template-columns: 1fr; }
  .aff-facts, .aff-funnel dl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 575px) {
  .aff-link { flex-direction: column; }
  .aff-balance { font-size: 36px; }
  .aff-join { padding: 22px; }
  .aff-facts strong { font-size: 24px; }
  .aff-funnel dd { font-size: 24px; }
  .aff-goal-head { flex-direction: column; gap: 2px; }
  .aff-goal-state { text-align: left; }
}

/* Form ghi nhận thanh toán trên trang khách hàng (admin) */
.pay-form { display: grid; gap: .5rem; margin-top: .75rem; padding-top: .75rem; border-top: 1px solid var(--border, #e5e7eb); }
.pay-form .pay-title { font-size: 1rem; margin: 0; }
.pay-form label { display: grid; gap: .2rem; }

/* Rút tiền (CTV) */
.aff-withdraw { scroll-margin-top: 16px; margin-top: 16px; }
.aff-withdraw-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; max-width: 760px; }
.aff-withdraw-form label { display: grid; gap: 6px; font-size: 14px; font-weight: 600; align-content: start; }
.aff-withdraw-form label .hint, .aff-withdraw-form label small { font-weight: 400; margin: 0; }
.aff-amount { display: flex; gap: 8px; }
.aff-amount .form-control { flex: 1; min-width: 0; }
.aff-withdraw-actions { grid-column: 1 / -1; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.aff-pending { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; border-radius: var(--radius-well); background: var(--warning-bg); color: var(--warning-ink); }
.aff-pending strong { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.aff-pending small { font-size: 13px; }
.aff-empty-text { color: var(--muted); margin: 0; }
.aff-empty-text strong { color: var(--text); }
.aff-sub-title { font-size: 14px; font-weight: 700; margin: 24px 0 8px; color: var(--muted); }
@media (max-width: 575px) { .aff-withdraw-form { grid-template-columns: 1fr; } }

/* Admin: cộng tác viên và rút tiền */
.wd-card { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 16px 28px; padding: 18px 0; border-top: 1px solid var(--rule); }
.wd-card:first-of-type { border-top: 0; padding-top: 0; }
.wd-amount { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.wd-bank { display: grid; grid-template-columns: 130px 1fr auto; gap: 6px 10px; align-items: center; margin: 12px 0 0; font-size: 14px; }
.wd-bank dt { color: var(--muted); font-weight: 400; }
.wd-bank dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.wd-copy { border: 0; background: var(--tint-200); color: var(--accent-ink); border-radius: 8px; font-size: 12px; font-weight: 600; padding: 3px 10px; cursor: pointer; }
.wd-actions { display: grid; gap: 10px; align-content: start; }
.wd-actions form { display: grid; gap: 6px; }
.wd-actions details > summary { cursor: pointer; font-size: 14px; color: var(--negative-ink); font-weight: 600; }
.wd-actions details form { margin-top: 8px; }
@media (max-width: 767px) { .wd-card { grid-template-columns: 1fr; } .wd-bank { grid-template-columns: 110px 1fr auto; } }

/* Đổi số dư (CTV) */
.aff-convert-sum { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding: 14px 16px; border-radius: var(--radius-well); background: var(--tint-100); }
.aff-convert-sum span { color: var(--muted); font-size: 14px; }
.aff-convert-sum strong { font-size: 22px; font-weight: 800; letter-spacing: -0.01em; color: var(--accent-ink); }
.aff-convert-sum small { color: var(--muted); font-size: 13px; margin-left: auto; }
#convert { scroll-margin-top: 16px; }

/* ===== Trang đăng nhập / đăng ký: banner giới thiệu bộ phần mềm ===== */
.auth-aside { overflow: hidden; }
.auth-aside h2 { max-width: 22ch; }
.auth-banner { display: block; width: 100%; height: auto; margin: 20px 0 4px; }
.suite-list { list-style: none; margin: 16px 0 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 16px; }
.suite-list li { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: var(--radius-well); background: var(--surface); }
.suite-list strong { font-size: 15px; font-weight: 700; }
.suite-list span { font-size: 13px; color: var(--muted); line-height: 1.35; }
.suite-list .soon { color: var(--warning-ink); font-weight: 600; }
.auth-points { margin-top: 22px; }

/* ===== Điện thoại: các trang sau đăng nhập ===== */
@media (max-width: 640px) {
  .suite-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .suite-list li { padding: 10px 12px; }
  .auth-banner { margin-top: 14px; }

  /* Ô nhập 16px để iPhone không tự phóng to khi chạm vào; nút và liên kết đủ lớn cho ngón tay */
  input.form-control, select.form-select, textarea.form-control { font-size: 16px; }
  .btn, .btn-main, .btn-ghost { min-height: 44px; }
  .form-control, .form-select { min-height: 44px; }

  .page-head { margin-bottom: 18px; }
  .page-head > div { flex: 1 1 100%; }
  .panel, .account-strip { margin-bottom: 12px; }
  .panel h2 { font-size: 16px; margin-bottom: 12px; }

  /* Bảng cuộn ngang trong khung, không làm cả trang tràn */
  .table-wrap { margin: 0 -4px; padding: 0 4px; -webkit-overflow-scrolling: touch; }
  .table { font-size: 13px; }
  .table > :not(caption) > * > * { padding: 10px 8px; }

  /* Khách hàng (admin) và danh sách ứng dụng */
  .admin-apps { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .pay-form { gap: .6rem; }

  /* Cộng tác viên */
  .aff-top, .aff-lists { gap: 12px; }
  .aff-balance { font-size: 34px; }
  .aff-funnel { padding: 16px; }
  .aff-funnel dl { gap: 14px 16px; }
  .aff-funnel dd { font-size: 22px; }
  .aff-facts { gap: 16px; }
  .aff-withdraw-form { max-width: none; }
  .aff-convert-sum small { margin-left: 0; }
  .aff-link .btn { width: 100%; }
  .aff-code strong { font-size: 16px; }
  .wd-card { gap: 14px; padding: 16px 0; }
  .wd-amount { font-size: 24px; }
  .wd-bank { grid-template-columns: 96px minmax(0, 1fr) auto; font-size: 13px; }
  .wd-actions .btn { width: 100%; }
}

/* Điện thoại nhỏ (≤ 380px): bớt lề để biểu mẫu và bảng đỡ chật */
@media (max-width: 380px) {
  .page-wide { padding-left: 12px; padding-right: 12px; }
  .auth-shell { padding-left: 12px; padding-right: 12px; }
  .panel { padding: 14px; }
  .aff-funnel dl, .aff-facts { grid-template-columns: 1fr 1fr; }
  .brand-name strong { font-size: 15px; }
}

/* Nhắc xác thực email (tài khoản do admin tạo) */
.notice-warn { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; margin: 0 0 16px; padding: 14px 18px; border-radius: var(--radius-well); background: var(--warning-bg); color: var(--warning-ink); font-size: 14px; line-height: 1.55; }
.notice-warn > div { flex: 1 1 360px; min-width: 0; }
.notice-warn strong { font-weight: 700; }
.email-flag { display: inline-block; margin-top: 4px; padding: 2px 10px; border-radius: 999px; background: var(--warning-bg); color: var(--warning-ink); border: 1px solid var(--warning-line); font-size: 12px; font-weight: 600; }
@media (max-width: 640px) {
  .accounts-table td:first-child { min-width: 0; }
  .accounts-table td:first-child strong { white-space: normal; font-size: 15px; }
  .accounts-table .cell-email { max-width: none; white-space: normal; overflow-wrap: anywhere; }
  .notice-warn { padding: 12px 14px; }
  .notice-warn .btn-ghost { width: 100%; justify-content: center; }
}
@media (min-width: 641px) { .page-wide { padding-top: 28px; } }

/* Thông báo xác thực email (đầu trang, mọi trang sau đăng nhập) */
.verify-banner-wrap { max-width: 1180px; width: 100%; margin: 16px auto 0; padding: 0 24px; }
.verify-banner { display: flex; align-items: center; gap: 14px 18px; padding: 14px 18px; border-radius: var(--radius-well); background: #fff4d6; border-left: 5px solid #f59e0b; color: #5b3a00; }
.verify-icon { flex: none; color: #f59e0b; }
.verify-text { flex: 1 1 auto; min-width: 0; font-size: 14px; line-height: 1.55; }
.verify-text strong { display: block; font-size: 15px; font-weight: 700; color: #3f2800; margin-bottom: 2px; }
.verify-text b { font-weight: 600; overflow-wrap: anywhere; }
.verify-btn { flex: none; display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 18px; border-radius: var(--radius-control); background: #f59e0b; color: #3f2800; font-weight: 700; font-size: 14px; text-decoration: none; white-space: nowrap; }
.verify-btn:hover { background: #e08e00; color: #3f2800; }
.verify-btn:active { transform: translateY(1px); }
@media (max-width: 760px) {
  .verify-banner-wrap { padding: 0 16px; margin-top: 12px; }
  .verify-banner { flex-wrap: wrap; padding: 12px 14px; }
  .verify-text { flex-basis: calc(100% - 44px); }
  .verify-btn { width: 100%; justify-content: center; height: 44px; }
}

/* ---------- Nút 9 chấm (launcher.js tự vẽ trong Shadow DOM) + trang /go/{code} ---------- */
.ht-launcher-slot { display: inline-flex; align-items: center; flex: none; }
.topbar-right { display: flex; align-items: center; gap: 8px; min-width: 0; }

.launch-head { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.launch-head img, .launch-tile { width: 64px; height: 64px; border-radius: 16px; flex: none; }
.launch-tile { display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 28px; font-weight: 800; }
.launch-head h1 { font-size: 24px; margin-bottom: 4px; }
.launch-note { color: var(--text); margin: 0 0 22px; line-height: 1.6; }
.launch-note .pill { margin-right: 6px; }
.launch-points { list-style: none; padding: 0; margin: 0 0 24px; display: grid; gap: 10px; }
.launch-points li { position: relative; padding-left: 22px; }
.launch-points li::before { content: ""; position: absolute; left: 0; top: 7px; width: 10px; height: 10px; border-radius: 3px; background: var(--accent); }
.launch-actions { display: flex; gap: 12px; flex-wrap: wrap; }
