/* AdsBoard — bộ khung giao diện dùng chung (bản 2).
   CSS thuần, không cần build: mọi trang nạp file này để có cùng màu, nút, thẻ,
   ô nhập, thanh bên. Tailwind CDN vẫn dùng cho bố cục. */
:root {
  --bg: #f4f5f9;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --line: #e6e8ee;
  --line-strong: #d5d9e2;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --faint: #94a3b8;
  --brand: #5546f0;
  --brand-ink: #3b28d9;
  --brand-soft: #eef2ff;
  --good: #059669;
  --good-soft: #ecfdf5;
  --bad: #e11d48;
  --bad-soft: #fff1f2;
  --warn: #d97706;
  --warn-soft: #fffbeb;
  --side: #090d1a;
  --lime: #b8f34a;
  --display: "Plus Jakarta Sans", Inter, ui-sans-serif, system-ui, sans-serif;
  --side-line: rgba(255, 255, 255, .07);
  --side-ink: #cbd5e1;
  --side-muted: #64748b;
  --radius: 12px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-md: 0 4px 16px -4px rgba(15, 23, 42, .10), 0 1px 3px rgba(15, 23, 42, .05);
  --shadow-lg: 0 18px 40px -12px rgba(15, 23, 42, .22), 0 2px 6px rgba(15, 23, 42, .06);
}

[x-cloak] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body.ui {
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-feature-settings: "cv11", "ss03";
  -webkit-font-smoothing: antialiased;
}
.num { font-variant-numeric: tabular-nums; }
.ic { width: 16px; height: 16px; flex: none; display: inline-block; vertical-align: -3px; }
.ic-lg { width: 18px; height: 18px; }
.ic-duo > :first-child { fill: currentColor; fill-opacity: .18; }
.side-link.on .ic-duo > :first-child { fill-opacity: .32; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- Thanh bên ---------- */
.side {
  position: fixed; inset: 0 auto 0 0; z-index: 40; width: 232px;
  background: radial-gradient(120% 60% at 0% 0%, rgba(91, 75, 255, .22), transparent 60%), var(--side);
  color: var(--side-ink); border-right: 1px solid rgba(255, 255, 255, .04);
  display: none; flex-direction: column;
  transition: width .18s ease;
}
@media (min-width: 768px) {
  .side { display: flex; }
  body.ui.has-side { padding-left: 232px; transition: padding-left .18s ease; }
  body.ui.has-side.side-mini { padding-left: 64px; }
}
.side-mini .side { width: 64px; }
.side-head { height: 64px; display: flex; align-items: center; gap: 10px; padding: 0 16px; flex: none; }
.side-logo { width: 32px; height: 32px; flex: none; border-radius: 9px; box-shadow: 0 6px 16px -4px rgba(91, 75, 255, .6); }
.brand-name { font-family: var(--display); font-weight: 800; font-size: 18px; letter-spacing: -.03em; color: #fff; }
.brand-name b { font-weight: 800; color: #a99dff; }
.mtop .brand-name { color: var(--ink); }
.mtop .brand-name b { color: var(--brand); }
.side-cta {
  margin: 4px 12px 10px; height: 38px; border-radius: 10px;
  background: linear-gradient(135deg, #6d5bff, #4330e0); color: #fff; font-size: 13.5px; font-weight: 600;
  box-shadow: 0 8px 20px -8px rgba(91, 75, 255, .8), inset 0 1px 0 rgba(255, 255, 255, .18);
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: background .15s, transform .1s;
}
.side-cta:hover { filter: brightness(1.08); }
.side-cta:active { transform: scale(.98); }
.side-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 2px 10px 10px; }
.side-nav::-webkit-scrollbar { width: 0; }
.side-group {
  padding: 14px 10px 6px; font-size: 10.5px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase; color: var(--side-muted);
}
.side-link {
  position: relative; display: flex; align-items: center; gap: 11px;
  height: 36px; padding: 0 10px; border-radius: 9px;
  font-size: 13.5px; color: var(--side-ink);
  transition: background .12s, color .12s;
}
.side-link .ic { width: 17px; height: 17px; opacity: .8; }
.side-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.side-link.on { background: rgba(124, 107, 255, .18); color: #fff; font-weight: 600; }
.side-link.on .ic { opacity: 1; color: #a5b4fc; }
.side-link.on::before {
  content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--lime);
}
.side-badge {
  margin-left: auto; min-width: 18px; padding: 1px 6px; border-radius: 999px;
  background: #f59e0b; color: #fff; font-size: 10px; font-weight: 700; text-align: center;
}
.side-foot { flex: none; border-top: 1px solid var(--side-line); padding: 10px 12px 12px; }
.side-sync { font-size: 11px; line-height: 1.45; color: var(--side-muted); padding: 0 4px 8px; word-break: break-word; }
.side-sync a { color: #a5b4fc; }
.side-user { display: flex; align-items: center; gap: 9px; min-width: 0; }
.side-avatar {
  width: 30px; height: 30px; border-radius: 999px; flex: none;
  background: #1e293b; color: #c7d2fe; font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.side-uname { flex: 1; min-width: 0; font-size: 12.5px; color: #e2e8f0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-uname a { color: #93c5fd; }
.side-icon-btn {
  width: 30px; height: 30px; border-radius: 8px; flex: none; color: var(--side-muted);
  display: flex; align-items: center; justify-content: center; transition: background .12s, color .12s;
}
.side-icon-btn:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.side-mini .side-hide { display: none !important; }
.side-mini .side-head { padding: 0; justify-content: center; }
.side-mini .side-link { justify-content: center; padding: 0; }
.side-mini .side-link.on::before { left: -10px; }
.side-mini .side-cta { margin: 4px 12px 10px; padding: 0; }
.side-mini .side-user { flex-direction: column; }
.side-mini .side-badge { position: absolute; top: 2px; right: 2px; min-width: 0; padding: 0 4px; }

/* ---------- Thanh trên + đáy (điện thoại) ---------- */
.mtop {
  position: sticky; top: 0; z-index: 40; height: 52px; padding: 0 14px;
  display: flex; align-items: center; gap: 10px;
  background: rgba(255, 255, 255, .92); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.mbar {
  position: fixed; inset: auto 0 0 0; z-index: 40;
  background: rgba(255, 255, 255, .96); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.mbar-grid { display: grid; grid-template-columns: repeat(5, 1fr); }
.mnav2 {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 0 7px; font-size: 10.5px; color: var(--muted);
}
.mnav2 .ic { width: 20px; height: 20px; }
.mnav2.on { color: var(--brand); font-weight: 600; }
@media (min-width: 768px) { .mtop, .mbar, .mmore { display: none !important; } }
@media (max-width: 767px) { body.ui.has-side { padding-bottom: 64px; } }

/* ---------- Đầu trang ---------- */
/* MỌI trang dùng chung một khung: cùng lề, cùng bề rộng tối đa -> mép trái/phải thẳng hàng giữa các trang */
.page { padding: 20px 16px 32px; max-width: 1520px; margin: 0 auto; width: 100%; }
@media (min-width: 1024px) { .page { padding: 24px 28px 40px; } }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-bottom: 18px; }
.page-head > .grow { margin-right: auto; min-width: 0; }
.page-title { font-family: var(--display); font-size: 24px; font-weight: 800; letter-spacing: -.03em; line-height: 1.15; }
.page-sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }

/* ---------- Thành phần ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 13px; border-radius: 9px; white-space: nowrap;
  font-size: 13.5px; font-weight: 500; line-height: 1;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2);
  transition: background .12s, border-color .12s, box-shadow .12s, transform .08s;
  cursor: pointer; user-select: none;
}
.btn:hover:not(:disabled) { background: var(--surface-2); border-color: #c3c9d6; }
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:focus-visible, .field:focus-visible, .seg button:focus-visible {
  outline: none; box-shadow: 0 0 0 3px rgba(99, 102, 241, .28); border-color: #818cf8;
}
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.btn-primary:hover:not(:disabled) { background: var(--brand-ink); border-color: var(--brand-ink); }
.btn-dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-dark:hover:not(:disabled) { background: #1e293b; border-color: #1e293b; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover:not(:disabled) { background: #eceef3; border-color: transparent; }
.btn-good { color: var(--good); }
.btn-good:hover:not(:disabled) { background: var(--good-soft); border-color: #a7f3d0; }
.btn-bad { color: var(--bad); }
.btn-bad:hover:not(:disabled) { background: var(--bad-soft); border-color: #fecdd3; }
.btn-sm { height: 32px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn-icon { width: 36px; padding: 0; }
.btn-sm.btn-icon { width: 32px; }

.field {
  height: 36px; padding: 0 11px; border-radius: 9px; font-size: 13.5px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  transition: border-color .12s, box-shadow .12s; min-width: 0;
}
.field::placeholder { color: var(--faint); }
.field:hover { border-color: #c3c9d6; }
.field:focus { outline: none; box-shadow: 0 0 0 3px rgba(99, 102, 241, .22); border-color: #818cf8; }
select.field { padding-right: 28px; }
.field-wrap { position: relative; display: flex; align-items: center; }
.field-wrap .ic { position: absolute; left: 11px; color: var(--faint); pointer-events: none; }
.field-wrap .field { padding-left: 33px; width: 100%; }
.label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }

.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: #eceef3; }
.seg button {
  height: 30px; padding: 0 13px; border-radius: 8px; font-size: 13px; font-weight: 500;
  color: var(--muted); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  transition: background .12s, color .12s, box-shadow .12s;
}
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(15, 23, 42, .12); }

.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px;
  border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap;
  background: var(--brand-soft); color: var(--brand-ink);
}
.chip-warn { background: var(--warn-soft); color: #92400e; }
.chip button { opacity: .6; } .chip button:hover { opacity: 1; }

.pill {
  display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 7px;
  border-radius: 6px; font-size: 11px; font-weight: 500; white-space: nowrap;
  background: #f1f5f9; color: var(--muted);
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 999px; background: currentColor; opacity: .75; }
.pill-good { background: var(--good-soft); color: var(--good); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-bad { background: var(--bad-soft); color: var(--bad); }

.switch {
  position: relative; width: 34px; height: 20px; border-radius: 999px; flex: none;
  background: #cbd5e1; transition: background .15s; cursor: pointer;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  border-radius: 999px; background: #fff; box-shadow: 0 1px 2px rgba(15, 23, 42, .3);
  transition: transform .15s;
}
.switch.on { background: #10b981; }
.switch.on::after { transform: translateX(14px); }
.switch:disabled { opacity: .5; }

.pop {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.pop-item {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  padding: 7px 10px; border-radius: 8px; font-size: 13.5px; color: var(--ink-2); cursor: pointer;
}
.pop-item:hover { background: var(--surface-2); }
.pop-item.on { background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; }
.pop-head {
  padding: 8px 12px 5px; font-size: 10.5px; font-weight: 600; letter-spacing: .07em;
  text-transform: uppercase; color: var(--faint); background: var(--surface-2); position: sticky; top: 0;
}
.check { width: 15px; height: 15px; border-radius: 4px; accent-color: var(--brand); cursor: pointer; }

/* ---------- Thẻ số liệu ---------- */
.kpi { padding: 14px 16px; transition: box-shadow .15s, transform .15s; min-width: 0; }
.kpi:hover { box-shadow: var(--shadow-md); }
.kpi-top { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.kpi-ic {
  width: 30px; height: 30px; border-radius: 10px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: #f1f5f9; color: var(--ink-2);
}
.kpi-ic .ic { width: 16px; height: 16px; }
.kpi-val { margin-top: 10px; font-family: var(--display); font-size: 23px; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.kpi-sub { margin-top: 5px; font-size: 11.5px; color: var(--faint); min-height: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tone-brand .kpi-ic { background: var(--brand-soft); color: var(--brand); }
.tone-good .kpi-ic { background: var(--good-soft); color: var(--good); }
.tone-bad .kpi-ic { background: var(--bad-soft); color: var(--bad); }
.tone-warn .kpi-ic { background: var(--warn-soft); color: var(--warn); }
@media (max-width: 767px) { .kpi { padding: 12px; } .kpi-val { font-size: 18px; } }

/* ---------- Bảng số liệu ---------- */
.dt-wrap { overflow: auto; max-height: 68vh; border-top: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius); }
.dt { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; white-space: nowrap; }
.dt thead th {
  position: sticky; top: 0; z-index: 3; background: var(--surface-2);
  padding: 9px 12px; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--muted); border-bottom: 1px solid var(--line); text-align: right; user-select: none;
}
.dt thead th.sortable { cursor: pointer; }
.dt thead th.sortable:hover { color: var(--ink); }
.dt thead th.sorted { color: var(--brand-ink); }
.dt tbody td { padding: 9px 12px; border-bottom: 1px solid #eef0f4; text-align: right; font-variant-numeric: tabular-nums; }
.dt tbody tr:hover td { background: #f7f8fc; }
.dt tbody tr.sel td { background: #f1f3ff; }
.dt tfoot td {
  position: sticky; bottom: 0; z-index: 3; background: #f1f3f7; padding: 10px 12px; text-align: right;
  font-size: 12.5px; font-weight: 700; border-top: 1px solid var(--line-strong); font-variant-numeric: tabular-nums;
}
.dt .l { text-align: left; }
.dt .c { text-align: center; }
/* 3 cột đầu (chọn, bật/tắt, tên) ghim lại khi cuộn ngang */
.dt .pin { position: sticky; background: var(--surface); z-index: 2; }
.dt thead .pin { z-index: 4; background: var(--surface-2); }
.dt tfoot .pin { z-index: 4; background: #f1f3f7; }
.dt tbody tr:hover .pin { background: #f7f8fc; }
.dt tbody tr.sel .pin { background: #f1f3ff; }
.dt .pin-1 { left: 0; width: 40px; min-width: 40px; }
.dt .pin-2 { left: 40px; width: 58px; min-width: 58px; }
.dt .pin-3 { left: 98px; box-shadow: 1px 0 0 var(--line); }
.dt .name { font-weight: 500; color: var(--ink); }
.dt .thumb { width: 34px; height: 34px; border-radius: 7px; object-fit: cover; border: 1px solid var(--line); background: var(--surface-2); flex: none; }

.empty { padding: 44px 16px; text-align: center; color: var(--muted); font-size: 13.5px; }
.empty b { display: block; color: var(--ink-2); font-size: 14.5px; margin-bottom: 4px; }

/* thẻ số liệu đầu tiên: thẻ nhấn nền tối như bảng tổng kết của agency */
.kpi-lead { background: linear-gradient(140deg, #141a33, #0b1020 70%); border-color: #0b1020; color: #fff; position: relative; overflow: hidden; }
.kpi-lead::after { content: ""; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px; border-radius: 999px; background: radial-gradient(circle, rgba(124, 107, 255, .55), transparent 70%); }
.kpi-lead .kpi-top { color: #aab2cf; }
.kpi-lead .kpi-ic { background: rgba(255, 255, 255, .10) !important; color: var(--lime) !important; }
.kpi-lead .kpi-sub { color: #7f89ab; }
.card-title { font-family: var(--display); font-size: 15.5px; font-weight: 700; letter-spacing: -.02em; }

.preview-note {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px;
  padding: 8px 16px; font-size: 12.5px; background: #1e1b4b; color: #e0e7ff;
}
.preview-note a { color: #fff; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }

/* ---------- Trang đăng nhập / đăng ký / đặt lại mật khẩu / hết hạn ---------- */
body.ui.auth {
  background:
    radial-gradient(60% 50% at 15% 0%, rgba(91, 75, 255, .38), transparent 70%),
    radial-gradient(45% 40% at 100% 100%, rgba(184, 243, 74, .10), transparent 70%),
    #090d1a;
}
.auth-mark { width: 44px; height: 44px; border-radius: 12px; box-shadow: 0 10px 28px -6px rgba(91, 75, 255, .75); }
.brand-name.auth-name { font-size: 28px; color: #fff; }
.auth form, .auth .bg-white { box-shadow: 0 30px 70px -20px rgba(0, 0, 0, .55); border-color: transparent !important; }
.auth form + p, .auth > div > p.text-slate-400 { color: #8b93b0 !important; }
.auth h1 { color: #fff; }

/* ---------- Lớp áo cho các trang viết bằng lớp Tailwind có sẵn ----------
   Không sửa từng trang: bắt các mẫu chung (thẻ trắng viền xám, bảng, ô nhập, tiêu đề)
   và đưa về cùng kiểu với Bảng điều khiển mới. */
body.ui main:not(.page) h1 { font-family: var(--display); font-size: 24px; font-weight: 800; letter-spacing: -.03em; line-height: 1.2; }
body.ui main:not(.page) h2 { font-family: var(--display); letter-spacing: -.02em; }
body.ui main:not(.page) { padding-top: 22px; padding-bottom: 36px; }
@media (min-width: 1024px) { body.ui.has-side main:not(.page) { padding-left: 28px; padding-right: 28px; } }
body.ui main:not(.page) .bg-white.rounded-xl.border,
body.ui main:not(.page) .bg-white.rounded-2xl.border,
body.ui main:not(.page) section.bg-white {
  border-color: var(--line); border-radius: 14px; box-shadow: var(--shadow-sm);
}
body.ui main:not(.page) thead th {
  font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted);
}
body.ui main:not(.page) tbody td { font-variant-numeric: tabular-nums; }
body.ui main:not(.page) tbody tr:hover > td { background: #f8f9fd; }
body.ui main:not(.page) input[type="text"], body.ui main:not(.page) input[type="number"], body.ui main:not(.page) input[type="email"],
body.ui main:not(.page) input[type="password"], body.ui main:not(.page) input[type="date"], body.ui main:not(.page) input[type="datetime-local"],
body.ui main:not(.page) input[type="url"], body.ui main:not(.page) input[type="search"], body.ui main:not(.page) select, body.ui main:not(.page) textarea {
  border-color: var(--line-strong); transition: border-color .12s, box-shadow .12s;
}
body.ui main:not(.page) input:focus, body.ui main:not(.page) select:focus, body.ui main:not(.page) textarea:focus {
  outline: none; border-color: #8778ff; box-shadow: 0 0 0 3px rgba(106, 88, 251, .20);
}
body.ui main:not(.page) input[type="checkbox"], body.ui main:not(.page) input[type="radio"] { accent-color: var(--brand); }
body.ui main:not(.page) button, body.ui main:not(.page) a { transition-property: background-color, border-color, color, box-shadow, transform, filter; transition-duration: .12s; }
body.ui .bg-indigo-600 { box-shadow: 0 1px 0 rgba(255, 255, 255, .16) inset, 0 6px 14px -8px rgba(85, 70, 240, .9); }

/* ================= BỘ KHUNG BỐ CỤC DÙNG CHUNG (bản 3) ================= */
.stack { display: grid; gap: 16px; align-content: start; }
.grid-2 { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.grid-3 { display: grid; gap: 16px; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; }
.grid-side { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
@media (max-width: 1100px) { .grid-2, .grid-3, .grid-side { grid-template-columns: minmax(0, 1fr); } }

/* Thẻ nội dung: đầu thẻ (tiêu đề + mô tả + nút) / thân / chân */
.card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.card-head > .grow { margin-right: auto; min-width: 0; }
.card-desc { font-size: 12.5px; color: var(--muted); margin-top: 2px; line-height: 1.5; font-weight: 400; }
.card-body { padding: 18px; }
.card-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; padding: 12px 18px;
  border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.card-ic { width: 34px; height: 34px; border-radius: 10px; flex: none; display: flex; align-items: center; justify-content: center;
  background: var(--brand-soft); color: var(--brand); }
.card-ic .ic { width: 17px; height: 17px; }

/* Tab con trong trang */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tab { display: inline-flex; align-items: center; gap: 7px; padding: 10px 14px; font-size: 13.5px; font-weight: 500; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; cursor: pointer; transition: color .12s, border-color .12s; }
.tab:hover { color: var(--ink); }
.tab.on { color: var(--brand-ink); border-color: var(--brand); font-weight: 600; }
.tab-count { font-size: 11px; padding: 1px 7px; border-radius: 999px; background: #eceef3; color: var(--muted); font-weight: 600; }
.tab.on .tab-count { background: var(--brand-soft); color: var(--brand-ink); }

/* Biểu mẫu */
.form-grid { display: grid; gap: 14px 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid > .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }
.field-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.hint { font-size: 12px; color: var(--muted); margin-top: 5px; line-height: 1.5; }
textarea.field { height: auto; min-height: 84px; padding: 9px 11px; line-height: 1.5; }
.field.w-full, .btn.w-full { width: 100%; }
.field-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.btn-lg { height: 42px; padding: 0 18px; font-size: 14.5px; border-radius: 11px; }
.btn-fb { background: #1877f2; border-color: #1877f2; color: #fff; font-weight: 600; }
.btn-fb:hover:not(:disabled) { background: #1568d8; border-color: #1568d8; }
.check-row { display: flex; align-items: flex-start; gap: 9px; font-size: 13.5px; color: var(--ink-2); cursor: pointer; line-height: 1.45; }
.check-row .check { margin-top: 2px; flex: none; }

/* Thanh công cụ phía trên bảng */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 14px; }
.toolbar > .grow { margin-right: auto; }
.dt-wrap.auto { max-height: none; }
.dt-wrap.flat { border-top: 0; }
.muted { color: var(--muted); }
.dt .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; color: var(--muted); }

/* Hộp nhắc */
.note { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: 11px; font-size: 13px; line-height: 1.55;
  background: var(--brand-soft); color: #2f2a86; }
.note .ic { margin-top: 2px; }
.note-warn { background: var(--warn-soft); color: #7c3f04; }
.note-bad { background: var(--bad-soft); color: #9f1239; }
.note-good { background: var(--good-soft); color: #065f46; }
.note-plain { background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }

/* Dòng thông tin dạng nhãn : giá trị */
.kv { display: grid; grid-template-columns: minmax(110px, 38%) minmax(0, 1fr); gap: 8px 14px; font-size: 13.5px; }
.kv > dt { color: var(--muted); }
.kv > dd { color: var(--ink); font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 999px; background: #cbd5e1; flex: none; }
.status-dot.good { background: #10b981; }
.status-dot.bad { background: #f43f5e; }
.status-dot.warn { background: #f59e0b; }

/* Hộp thoại */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
@media (min-width: 768px) { .modal { align-items: center; padding: 24px; } }
.modal-backdrop { position: absolute; inset: 0; background: rgba(9, 13, 26, .55); backdrop-filter: blur(3px); }
.modal-card { position: relative; width: 100%; max-height: 92vh; display: flex; flex-direction: column; background: var(--surface);
  border-radius: 18px 18px 0 0; box-shadow: var(--shadow-lg); overflow: hidden; }
@media (min-width: 768px) {
  .modal-card { border-radius: 16px; max-width: 560px; }
  .modal-card.lg { max-width: 920px; }
  .modal-card.xl { max-width: 1120px; }
}
.modal-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex: none; }
.modal-head > .grow { margin-right: auto; min-width: 0; }
.modal-title { font-family: var(--display); font-size: 16px; font-weight: 800; letter-spacing: -.02em; }
.modal-body { padding: 18px; overflow-y: auto; flex: 1; min-height: 0; }
.modal-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line);
  background: var(--surface-2); flex: none; }
.icon-btn { width: 32px; height: 32px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); flex: none; }
.icon-btn:hover { background: #eceef3; color: var(--ink); }

/* Thẻ chọn (gói cước, lựa chọn dạng thẻ) */
.option { display: block; text-align: left; padding: 14px 16px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface);
  cursor: pointer; transition: border-color .12s, box-shadow .12s, background .12s; position: relative; }
.option:hover { border-color: #c3c9d6; }
.option.on { border-color: var(--brand); background: #fbfaff; box-shadow: 0 0 0 3px rgba(106, 88, 251, .14); }
.price { font-family: var(--display); font-size: 24px; font-weight: 800; letter-spacing: -.03em; }
.badge { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 999px; font-size: 11px; font-weight: 600;
  background: var(--brand-soft); color: var(--brand-ink); white-space: nowrap; }
.badge-lime { background: var(--lime); color: #1a2e05; }
.badge-dark { background: var(--ink); color: #fff; }
.section-title { font-family: var(--display); font-size: 15.5px; font-weight: 700; letter-spacing: -.02em; color: var(--ink); }
.field-sm { height: 32px; padding: 0 9px; font-size: 12.5px; border-radius: 8px; }
select.field-sm { padding-right: 24px; }
.badge-bad { background: var(--bad-soft); color: var(--bad); }
.badge-warn { background: var(--warn-soft); color: #92400e; }
.badge-good { background: var(--good-soft); color: var(--good); }
.badge-info { background: #e0edff; color: #1d4ed8; }
.card-head > .grow, .modal-head > .grow, .page-head > .grow { flex: 1 1 0; }
.page-head > .grow { flex-basis: 260px; }

/* ================= LỚP VỎ BẢN 4: thanh bên theo biến màu, thanh trên, tìm nhanh, 3 kiểu giao diện ================= */
:root {
  /* kiểu mặc định "Sáng": thanh bên trắng, nền xám rất nhạt, nhiều khoảng thở */
  --bg: #f6f7f9;
  --radius: 14px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .03);
  --side-bg: #ffffff;
  --side-edge: var(--line);
  --side-ink: #475569;
  --side-ink-strong: #0f172a;
  --side-muted: #94a3b8;
  --side-hover: #f3f4f8;
  --side-on-bg: #f1efff;
  --side-on-ink: #3b28d9;
  --side-on-bar: var(--brand);
  --side-brand: #0f172a;
  --side-brand-2: var(--brand);
  --top-bg: rgba(255, 255, 255, .82);
  --card-bg: var(--surface);
  --card-edge: var(--line);
}
html[data-theme="ink"] {
  --side-bg: radial-gradient(120% 60% at 0% 0%, rgba(91, 75, 255, .22), transparent 60%), #090d1a;
  --side-edge: rgba(255, 255, 255, .05);
  --side-ink: #cbd5e1;
  --side-ink-strong: #ffffff;
  --side-muted: #64748b;
  --side-hover: rgba(255, 255, 255, .06);
  --side-on-bg: rgba(124, 107, 255, .18);
  --side-on-ink: #ffffff;
  --side-on-bar: var(--lime);
  --side-brand: #ffffff;
  --side-brand-2: #a99dff;
}
html[data-theme="aurora"] {
  --bg: #f3f2fb;
  --side-bg: rgba(255, 255, 255, .62);
  --side-edge: rgba(255, 255, 255, .8);
  --side-hover: rgba(255, 255, 255, .8);
  --side-on-bg: rgba(255, 255, 255, .95);
  --top-bg: rgba(255, 255, 255, .55);
  --card-bg: rgba(255, 255, 255, .74);
  --card-edge: rgba(255, 255, 255, .9);
  --shadow-sm: 0 8px 28px -14px rgba(76, 61, 201, .28), 0 1px 2px rgba(16, 24, 40, .04);
}
html[data-theme="aurora"] body.ui:not(.auth) {
  background:
    radial-gradient(42% 46% at 6% 0%, rgba(124, 107, 255, .30), transparent 70%),
    radial-gradient(38% 40% at 100% 8%, rgba(184, 243, 74, .22), transparent 70%),
    radial-gradient(46% 50% at 62% 100%, rgba(56, 189, 248, .18), transparent 70%),
    var(--bg);
  background-attachment: fixed;
}
html[data-theme="aurora"] .card, html[data-theme="aurora"] .side, html[data-theme="aurora"] .topbar {
  -webkit-backdrop-filter: blur(18px) saturate(1.3); backdrop-filter: blur(18px) saturate(1.3);
}

body.ui { font-size: 14px; }
.card { background: var(--card-bg); border-color: var(--card-edge); }
.kpi-lead { background: linear-gradient(140deg, #141a33, #0b1020 70%); border-color: #0b1020; }
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---- Thanh bên (ghi đè theo biến màu) ---- */
.side { background: var(--side-bg); color: var(--side-ink); border-right: 1px solid var(--side-edge); width: 240px; }
@media (min-width: 768px) {
  body.ui.has-side { padding-left: 240px; }
  body.ui.has-side.side-mini { padding-left: 68px; }
}
.side-mini .side { width: 68px; }
.side-head { height: 60px; padding: 0 14px 0 16px; }
.brand-name { color: var(--side-brand); }
.brand-name b { color: var(--side-brand-2); }
.auth .brand-name { color: #fff; } .auth .brand-name b { color: #a99dff; }
.side-group { color: var(--side-muted); padding: 16px 10px 6px; }
.side-link { color: var(--side-ink); height: 38px; font-weight: 500; }
.side-link .ic { opacity: .85; }
.side-link:hover { background: var(--side-hover); color: var(--side-ink-strong); }
.side-link.on { background: var(--side-on-bg); color: var(--side-on-ink); font-weight: 600; }
.side-link.on .ic { color: var(--side-on-ink); opacity: 1; }
.side-link.on::before { background: var(--side-on-bar); }
.side-foot { border-top: 1px solid var(--side-edge); display: flex; align-items: center; gap: 8px; min-height: 52px; }
.side-sync { padding: 0 4px; flex: 1; }
.side-sync a { color: var(--brand); font-weight: 600; }
html[data-theme="ink"] .side-sync a { color: #a5b4fc; }
.side-icon-btn { color: var(--side-muted); }
.side-icon-btn:hover { background: var(--side-hover); color: var(--side-ink-strong); }
.side-mini-only { display: none; }
.side-mini .side-mini-only { display: flex; margin: 0 auto; }
.side-mini .side-foot { justify-content: center; }
html[data-theme="light"] .side-cta, html[data-theme="aurora"] .side-cta { box-shadow: 0 8px 18px -10px rgba(85, 70, 240, .75), inset 0 1px 0 rgba(255, 255, 255, .18); }

/* ---- Thanh trên ---- */
.topbar {
  position: sticky; top: 0; z-index: 35; height: 60px; padding: 0 28px;
  display: none; align-items: center; gap: 14px;
  background: var(--top-bg); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
@media (min-width: 768px) { .topbar { display: flex; } }
.tb-search {
  display: flex; align-items: center; gap: 9px; height: 38px; width: min(420px, 42vw); padding: 0 10px 0 12px;
  border: 1px solid var(--line); border-radius: 11px; background: rgba(255, 255, 255, .7); color: var(--faint);
  font-size: 13.5px; text-align: left; cursor: text; transition: border-color .12s, box-shadow .12s, background .12s;
}
.tb-search:hover { border-color: #c3c9d6; background: #fff; }
.tb-search-text { flex: 1; }
kbd {
  font-family: inherit; font-size: 11px; font-weight: 600; color: var(--muted); padding: 2px 6px; border-radius: 6px;
  background: #f1f3f7; border: 1px solid var(--line); white-space: nowrap;
}
.tb-right { margin-left: auto; display: flex; align-items: center; gap: 8px; min-width: 0; }
.tb-sync { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
@media (max-width: 1180px) { .tb-sync { display: none; } }
.tb-user { position: relative; }
.tb-user-btn {
  display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 8px 0 4px; border-radius: 999px;
  border: 1px solid var(--line); background: rgba(255, 255, 255, .7); color: var(--ink-2); transition: background .12s, border-color .12s;
}
.tb-user-btn:hover { background: #fff; border-color: #c3c9d6; }
.tb-user-btn .ic { width: 14px; height: 14px; color: var(--faint); }
.tb-avatar {
  width: 30px; height: 30px; border-radius: 999px; flex: none; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #7c6bff, #3b28d9); color: #fff; font-size: 12.5px; font-weight: 700;
}
.tb-uname { max-width: 150px; font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-uname:empty { display: none; }
.tb-menu { position: absolute; right: 0; top: calc(100% + 8px); width: 248px; padding: 6px; z-index: 60; }
.tb-menu-line { height: 1px; background: var(--line); margin: 6px 4px; }
.theme-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 2px 4px 4px; }
.theme-sw {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 9px 4px 7px; border-radius: 10px;
  border: 1.5px solid var(--line); font-size: 11.5px; color: var(--ink-2); background: #fff; transition: border-color .12s, box-shadow .12s;
}
.theme-sw:hover { border-color: #c3c9d6; }
.theme-sw.on { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(106, 88, 251, .14); font-weight: 600; }
.theme-dot { width: 26px; height: 26px; border-radius: 999px; border: 1px solid var(--line-strong); }

/* ---- Tìm nhanh ---- */
.palette {
  position: fixed; inset: 0; z-index: 80; display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 0;
  background: rgba(9, 13, 26, .45); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.palette-card { width: 100%; max-width: 580px; background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg); overflow: hidden; }
.palette-in { display: flex; align-items: center; gap: 10px; padding: 0 16px; height: 54px; border-bottom: 1px solid var(--line); color: var(--faint); }
.palette-in input { flex: 1; height: 100%; border: 0; outline: 0; font-size: 15px; color: var(--ink); background: transparent; }
.palette-list { max-height: 52vh; overflow-y: auto; padding: 6px; }
.palette-item {
  display: flex; align-items: center; gap: 11px; width: 100%; padding: 10px 12px; border-radius: 10px; text-align: left;
  font-size: 14px; color: var(--ink-2);
}
.palette-item .ic { color: var(--faint); }
.palette-item:hover, .palette-item.on { background: var(--brand-soft); color: var(--brand-ink); }
.palette-item.on .ic { color: var(--brand); }
.palette-label { flex: 1; min-width: 0; }
.palette-hint { font-size: 11.5px; color: var(--faint); white-space: nowrap; }
.palette-empty { padding: 26px; text-align: center; color: var(--muted); font-size: 13.5px; }

/* nút đổi ngôn ngữ nổi trên các trang không có thanh trên (đăng nhập, giới thiệu, pháp lý) */
.lang-float {
  position: fixed; right: 16px; bottom: 16px; z-index: 70; display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 12px; border-radius: 999px; font: 600 12.5px Inter, system-ui, sans-serif; cursor: pointer;
  background: rgba(255, 255, 255, .94); color: #0f172a; border: 1px solid #e6e8ee; box-shadow: 0 8px 22px -10px rgba(15, 23, 42, .45);
}
