/* Viva Gateway UI Kit v1.0 (19/10/2026)
   Bộ thành phần nội bộ cho Gateway. Đo theo nhịp giao diện app.ladipage.com (Inter, xám slate, nhấn chàm chuyển sắc,
   bố cục thanh trái + menu phụ + nội dung), viết lại từ đầu, không chép mã nguồn của LadiPage.
   Tiền tố lớp: vg-. Chủ đề: sáng mặc định, tối bằng <html data-theme="dark">.
   Tài liệu và mẫu: /ui/index.html */

/* ============ 1. TOKEN ============ */
:root {
  --vg-font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --vg-mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;

  --vg-bg: #ffffff;           /* nền vùng nội dung */
  --vg-bg-side: #f9fafb;      /* nền thanh trái, menu phụ */
  --vg-bg-soft: #f1f5f9;      /* nền ô, hover */
  --vg-bg-mute: #e2e8f0;
  --vg-line: #e2e8f0;         /* viền */
  --vg-line-soft: rgba(226, 232, 240, .7);
  --vg-text: #0f172a;         /* chữ chính */
  --vg-text-2: #475569;       /* chữ phụ */
  --vg-text-3: #94a3b8;       /* chữ mờ, gợi ý */

  --vg-acc: #3b4fe4;          /* chàm nhấn */
  --vg-acc-2: #2a2fc0;        /* điểm cuối chuyển sắc */
  --vg-acc-ink: #2b2a9f;      /* chữ chàm trên nền nhạt */
  --vg-acc-soft: #e0e7ff;     /* nền chàm nhạt (nút phụ, ô chọn) */
  --vg-acc-grad: linear-gradient(to bottom right, var(--vg-acc), var(--vg-acc-2));
  --vg-ring: 0 0 0 3px rgba(59, 79, 228, .22);

  --vg-ok: #16a34a;   --vg-ok-soft: #dcfce7;   --vg-ok-ink: #166534;
  --vg-warn: #d97706; --vg-warn-soft: #fef3c7; --vg-warn-ink: #92400e;
  --vg-bad: #dc2626;  --vg-bad-soft: #fee2e2;  --vg-bad-ink: #991b1b;
  --vg-info: #0284c7; --vg-info-soft: #e0f2fe; --vg-info-ink: #075985;
  --vg-new: linear-gradient(90deg, #f43f5e, #fb923c);   /* nhãn MỚI */

  --vg-r-xs: 4px; --vg-r-sm: 6px; --vg-r: 8px; --vg-r-lg: 12px; --vg-r-xl: 16px; --vg-r-full: 999px;
  --vg-sh-xs: 0 1px 2px rgba(15, 23, 42, .05);
  --vg-sh: 0 1px 3px rgba(15, 23, 42, .08), 0 1px 2px rgba(15, 23, 42, .04);
  --vg-sh-lg: 0 10px 30px -8px rgba(15, 23, 42, .18), 0 4px 10px -4px rgba(15, 23, 42, .08);

  --vg-h-sm: 28px; --vg-h: 36px; --vg-h-lg: 40px;   /* chiều cao nút, ô nhập */
  --vg-side-w: 216px; --vg-sub-w: 188px; --vg-top-h: 46px;
  --vg-sheet: #ffffff;        /* tấm nội dung trắng nổi trên nền xám (kiểu LadiPage) */
  --vg-sub-on: #e8e8ff;       /* nền mục menu phụ đang mở */
  --vg-ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --vg-bg: #0b1120; --vg-bg-side: #0f172a; --vg-bg-soft: #1e293b; --vg-bg-mute: #334155;
  --vg-line: #1e293b; --vg-line-soft: rgba(51, 65, 85, .7);
  --vg-text: #f1f5f9; --vg-text-2: #94a3b8; --vg-text-3: #64748b;
  --vg-acc: #6d7cf5; --vg-acc-2: #4f46e5; --vg-acc-ink: #a5b4fc; --vg-acc-soft: rgba(99, 102, 241, .18);
  --vg-ok-soft: rgba(22, 163, 74, .18); --vg-ok-ink: #86efac;
  --vg-warn-soft: rgba(217, 119, 6, .18); --vg-warn-ink: #fcd34d;
  --vg-bad-soft: rgba(220, 38, 38, .18); --vg-bad-ink: #fca5a5;
  --vg-info-soft: rgba(2, 132, 199, .18); --vg-info-ink: #7dd3fc;
  --vg-sh-lg: 0 10px 30px -8px rgba(0, 0, 0, .6);
  --vg-sheet: #0b1120; --vg-sub-on: rgba(99, 102, 241, .22);
  color-scheme: dark;
}

/* ============ 2. NỀN TẢNG ============ */
.vg, .vg *, .vg *::before, .vg *::after { box-sizing: border-box; }
.vg [hidden] { display: none !important; }
body.vg { margin: 0; font: 400 14px/20px var(--vg-font); color: var(--vg-text); background: var(--vg-bg);
  -webkit-font-smoothing: antialiased; }
.vg a { text-decoration: none; }
.vg a:not([class]) { color: var(--vg-acc-ink); }
.vg a:not([class]):hover { text-decoration: underline; }
.vg :focus-visible { outline: none; box-shadow: var(--vg-ring); border-radius: var(--vg-r-sm); }
.vg-h1 { font-size: 30px; line-height: 36px; font-weight: 700; letter-spacing: -.02em; margin: 0; }
.vg-h2 { font-size: 20px; line-height: 28px; font-weight: 600; letter-spacing: -.01em; margin: 0; }
.vg-h3 { font-size: 16px; line-height: 24px; font-weight: 600; margin: 0; }
.vg-sub { color: var(--vg-text-2); font-size: 14px; margin-top: 4px; }
.vg-dim { color: var(--vg-text-3); }
.vg-mono { font-family: var(--vg-mono); font-size: 12.5px; }
.vg-eyebrow { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--vg-text-3); }
.vg-up { color: var(--vg-ok); } .vg-down { color: var(--vg-bad); } .vg-warn-t { color: var(--vg-warn-ink); }
@media (min-width: 640px) { .vg-h1 { font-size: 36px; line-height: 40px; } }

/* ============ 3. KHUNG ỨNG DỤNG ============ */
.vg-app { display: grid; grid-template-columns: var(--vg-side-w) 1fr; min-height: 100vh; }
.vg-app.has-sub { grid-template-columns: var(--vg-side-w) var(--vg-sub-w) 1fr; }
.vg-app.is-collapsed { --vg-side-w: 60px; }
.vg-side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--vg-bg-side);
  border-right: 1px solid var(--vg-line); padding: 10px 8px; overflow: hidden; }
.vg-brand { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 6px; margin-bottom: 8px; font-weight: 700;
  font-size: 16px; color: var(--vg-text); }
.vg-brand-mark { width: 26px; height: 26px; border-radius: 7px; background: var(--vg-acc-grad); color: #fff; display: grid;
  place-items: center; font-size: 13px; flex: none; }
.vg-nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; scrollbar-width: thin; }
.vg-nav-sec { padding: 14px 8px 4px; }
.vg-nav-i { display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 6px; border-radius: var(--vg-r-sm);
  color: var(--vg-text-2); font-size: 14px; white-space: nowrap; transition: background .15s, color .15s; cursor: pointer;
  border: 0; background: none; width: 100%; text-align: left; font-family: inherit; }
.vg .vg-nav-i:hover { background: var(--vg-bg-soft); color: var(--vg-text); text-decoration: none; }
.vg .vg-nav-i.is-active { background: var(--vg-acc-grad); color: #fff; box-shadow: 0 2px 6px -2px rgba(59, 79, 228, .5); }
.vg-nav-i svg { width: 20px; height: 20px; flex: none; }
.vg-nav-i .vg-app-ic { margin-left: -2px; }
/* Ô ứng dụng nhiều màu (mục "Ứng dụng" kiểu LadiPage): VG.appIcon(name, mau) hoặc <i data-vg-icon="cart" data-vg-app="orange"> */
.vg-app-ic { width: 26px; height: 26px; border-radius: 7px; flex: none; display: inline-grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--a1, #818cf8), var(--a2, #4f46e5)); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18), 0 1px 2px rgba(15, 23, 42, .12); }
.vg-app-ic svg { width: 15px !important; height: 15px !important; }
.vg-app-ic.is-lg { width: 40px; height: 40px; border-radius: 10px; }
.vg-app-ic.is-lg svg { width: 22px !important; height: 22px !important; }
.vg-nav-i .vg-tag-new, .vg-nav-i .vg-count { margin-left: auto; }
.vg-count { min-width: 20px; height: 18px; padding: 0 6px; border-radius: var(--vg-r-full); background: var(--vg-bad);
  color: #fff; font-size: 11px; font-weight: 600; display: inline-grid; place-items: center; }
.vg-side-foot { border-top: 1px solid var(--vg-line); padding-top: 8px; display: flex; flex-direction: column; gap: 2px; }
.vg-app.is-collapsed .vg-nav-i span, .vg-app.is-collapsed .vg-nav-sec, .vg-app.is-collapsed .vg-brand-name,
.vg-app.is-collapsed .vg-nav-i .vg-tag-new, .vg-app.is-collapsed .vg-nav-i .vg-count { display: none; }

.vg-subnav { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--vg-bg-side);
  border-right: 1px solid var(--vg-line); padding: 14px 8px; }
.vg-subnav-t { font-weight: 600; padding: 0 6px 10px; }
.vg-subnav .vg-nav-i.is-active { background: var(--vg-acc-soft); color: var(--vg-acc-ink); box-shadow: none; font-weight: 500; }

.vg-main { min-width: 0; display: flex; flex-direction: column; }
.vg-topbar { position: sticky; top: 0; z-index: 20; height: var(--vg-top-h); display: flex; align-items: center; gap: 10px;
  padding: 0 20px; background: color-mix(in srgb, var(--vg-bg) 88%, transparent); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--vg-line); }
.vg-topbar .vg-grow { flex: 1; }
.vg-top-search { width: 220px; }
@media (max-width: 640px) { .vg-topbar .vg-top-search, .vg-topbar .vg-hide-sm { display: none; } }
.vg-page { padding: 28px 32px 48px; max-width: 1280px; width: 100%; }
.vg-page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  margin-bottom: 20px; }
.vg-btn.vg-menu-btn { display: none; }
@media (max-width: 900px) {
  .vg-app, .vg-app.has-sub { grid-template-columns: 1fr; }
  .vg-side { position: fixed; z-index: 50; left: 0; width: 260px; transform: translateX(-100%); transition: transform .25s var(--vg-ease); }
  .vg-app.is-open .vg-side { transform: none; box-shadow: var(--vg-sh-lg); }
  .vg-main > .vg-subnav { position: sticky; top: var(--vg-top-h); z-index: 15; }
  .vg-subnav { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--vg-line); display: flex;
    gap: 4px; overflow-x: auto; padding: 8px 16px; }
  .vg-subnav-t { display: none; }
  .vg-subnav .vg-nav-i { width: auto; }
  .vg-btn.vg-menu-btn { display: inline-flex; }
  .vg-page { padding: 20px 16px 40px; }
  .vg-topbar { padding: 0 16px; }
}

/* ============ 4. NÚT ============ */
.vg-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: var(--vg-h); padding: 0 14px;
  border-radius: var(--vg-r); border: 1px solid transparent; font: 500 14px/1 var(--vg-font); white-space: nowrap;
  cursor: pointer; transition: background .15s, border-color .15s, box-shadow .15s, transform .05s; text-decoration: none;
  color: var(--vg-text); background: transparent; }
.vg .vg-btn:hover { text-decoration: none; }
.vg-btn:active { transform: translateY(1px); }
.vg-btn svg { width: 16px; height: 16px; }
.vg-btn-primary { background: var(--vg-acc-grad); color: #fff; box-shadow: 0 2px 8px -2px rgba(59, 79, 228, .55); }
.vg-btn-primary:hover { filter: brightness(1.07); }
.vg-btn-outline { background: var(--vg-bg); border-color: var(--vg-line); box-shadow: var(--vg-sh-xs); }
.vg-btn-outline:hover { background: var(--vg-bg-soft); }
.vg-btn-soft { background: var(--vg-acc-soft); color: var(--vg-acc-ink); }
.vg-btn-soft:hover { filter: brightness(.97); }
.vg-btn-ghost { color: var(--vg-text-2); }
.vg-btn-ghost:hover { background: var(--vg-bg-soft); color: var(--vg-text); }
.vg-btn-danger { background: var(--vg-bad); color: #fff; }
.vg-btn-danger:hover { filter: brightness(1.08); }
.vg-btn-sm { height: var(--vg-h-sm); padding: 0 10px; font-size: 13px; border-radius: var(--vg-r-sm); }
.vg-btn-lg { height: var(--vg-h-lg); padding: 0 18px; }
.vg-btn-icon { width: var(--vg-h); padding: 0; }
.vg-btn-sm.vg-btn-icon { width: var(--vg-h-sm); }
.vg-btn[disabled], .vg-btn.is-loading { opacity: .55; pointer-events: none; }
.vg-btn.is-loading::before { content: ""; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: vg-spin .7s linear infinite; }
.vg-btn-wrap { position: relative; display: inline-flex; }
.vg-btn-wrap > .vg-tag-new { position: absolute; top: -8px; right: -6px; }
.vg-btn-group { display: inline-flex; }
.vg-btn-group .vg-btn { border-radius: 0; margin-left: -1px; }
.vg-btn-group .vg-btn:first-child { border-radius: var(--vg-r) 0 0 var(--vg-r); margin-left: 0; }
.vg-btn-group .vg-btn:last-child { border-radius: 0 var(--vg-r) var(--vg-r) 0; }
@keyframes vg-spin { to { transform: rotate(360deg); } }

/* ============ 5. Ô NHẬP ============ */
.vg-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.vg-label { font-size: 13px; font-weight: 500; color: var(--vg-text); }
.vg-help { font-size: 12px; color: var(--vg-text-3); }
.vg-err-text { font-size: 12px; color: var(--vg-bad); }
.vg-input, .vg-select, .vg-textarea { width: 100%; height: var(--vg-h); padding: 0 12px; border: 1px solid var(--vg-line);
  border-radius: var(--vg-r); background: var(--vg-bg); color: var(--vg-text); font: 400 14px var(--vg-font);
  box-shadow: var(--vg-sh-xs); transition: border-color .15s, box-shadow .15s; }
.vg-textarea { height: auto; min-height: 88px; padding: 8px 12px; line-height: 20px; resize: vertical; }
.vg-input::placeholder, .vg-textarea::placeholder { color: var(--vg-text-3); }
.vg-input:focus, .vg-select:focus, .vg-textarea:focus { outline: none; border-color: var(--vg-acc); box-shadow: var(--vg-ring); }
.vg-input.is-invalid, .vg-select.is-invalid { border-color: var(--vg-bad); }
.vg-select { appearance: none; padding-right: 32px; cursor: pointer;
  background: var(--vg-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2394a3b8' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center; }
.vg-input-wrap { position: relative; display: flex; align-items: center; }
.vg-input-wrap > svg { position: absolute; left: 11px; width: 16px; height: 16px; color: var(--vg-text-3); pointer-events: none; }
.vg-input-wrap > .vg-input { padding-left: 34px; }
.vg-input-wrap > .vg-kbd { position: absolute; right: 8px; }
.vg-kbd { display: inline-flex; align-items: center; height: 20px; padding: 0 6px; border: 1px solid var(--vg-line);
  border-radius: var(--vg-r-xs); font: 500 11px var(--vg-mono); color: var(--vg-text-3); background: var(--vg-bg-soft); }
.vg-check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }
.vg-check input { appearance: none; width: 16px; height: 16px; margin: 0; border: 1px solid #cbd5e1; border-radius: var(--vg-r-xs);
  background: var(--vg-bg); display: grid; place-items: center; cursor: pointer; transition: background .15s; }
.vg-check input[type="radio"] { border-radius: 50%; }
.vg-check input:checked { background: var(--vg-acc); border-color: var(--vg-acc); }
.vg-check input:checked::after { content: ""; width: 9px; height: 5px; border: 2px solid #fff; border-top: 0; border-right: 0;
  transform: translateY(-1px) rotate(-45deg); }
.vg-check input[type="radio"]:checked::after { width: 6px; height: 6px; border: 0; border-radius: 50%; background: #fff; transform: none; }
.vg-switch { position: relative; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.vg-switch input { appearance: none; width: 34px; height: 20px; margin: 0; border-radius: var(--vg-r-full); background: var(--vg-bg-mute);
  cursor: pointer; transition: background .2s; position: relative; }
.vg-switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: var(--vg-sh); transition: transform .2s var(--vg-ease); }
.vg-switch input:checked { background: var(--vg-acc); }
.vg-switch input:checked::after { transform: translateX(14px); }
.vg-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.vg-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 640px) { .vg-grid-2 { grid-template-columns: 1fr; } }

/* ============ 6. THẺ, KHỐI ============ */
.vg-card { background: var(--vg-bg); border: 1px solid var(--vg-line-soft); border-radius: var(--vg-r-xl); box-shadow: var(--vg-sh-xs); }
.vg-card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px;
  border-bottom: 1px solid var(--vg-line-soft); }
.vg-card-b { padding: 18px 22px; }
.vg-card-f { padding: 14px 22px; border-top: 1px solid var(--vg-line-soft); display: flex; justify-content: flex-end; gap: 8px; }
.vg-card.is-flat { box-shadow: none; }
.vg-feature { display: flex; gap: 12px; padding: 12px; border-radius: var(--vg-r-lg); color: inherit; transition: background .15s; }
.vg .vg-feature:hover { background: var(--vg-bg-soft); text-decoration: none; }
.vg-feature-ic { width: 34px; height: 34px; flex: none; border-radius: var(--vg-r); border: 1px solid var(--vg-line);
  display: grid; place-items: center; color: var(--vg-text-2); background: var(--vg-bg); }
.vg-feature-ic svg { width: 17px; height: 17px; }
.vg-feature b { display: block; font-weight: 600; font-size: 14px; color: var(--vg-text); }
.vg-feature p { margin: 2px 0 0; font-size: 12.5px; line-height: 18px; color: var(--vg-text-2); }
.vg-stat { padding: 16px 18px; }
.vg-stat-l { font-size: 13px; color: var(--vg-text-2); display: flex; align-items: center; gap: 6px; }
.vg-stat-l svg { width: 15px; height: 15px; flex: none; }
.vg :where(svg:not([width]):not([class]):not([style])) { width: 16px; height: 16px; flex: none; }
.vg-stat-v { font-size: 26px; line-height: 32px; font-weight: 700; letter-spacing: -.02em; margin-top: 6px; }
.vg-stat-d { font-size: 12.5px; margin-top: 2px; }
.vg-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
@media (max-width: 640px) { .vg-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.vg-divider { height: 1px; background: var(--vg-line); border: 0; margin: 16px 0; }

/* ============ 7. NHÃN, CHIP ============ */
.vg-badge { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: var(--vg-r-full);
  font-size: 12px; font-weight: 500; background: var(--vg-bg-soft); color: var(--vg-text-2); white-space: nowrap; }
.vg-badge::before { content: none; }
.vg-badge.is-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.vg-badge-acc { background: var(--vg-acc-soft); color: var(--vg-acc-ink); }
.vg-badge-ok { background: var(--vg-ok-soft); color: var(--vg-ok-ink); }
.vg-badge-warn { background: var(--vg-warn-soft); color: var(--vg-warn-ink); }
.vg-badge-bad { background: var(--vg-bad-soft); color: var(--vg-bad-ink); }
.vg-badge-info { background: var(--vg-info-soft); color: var(--vg-info-ink); }
.vg-tag-new { display: inline-flex; align-items: center; height: 16px; padding: 0 6px; border-radius: var(--vg-r-full);
  background: var(--vg-new); color: #fff; font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.vg-section-tag { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: var(--vg-r-sm);
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; background: var(--vg-acc-soft); color: var(--vg-acc-ink); }
.vg-section-tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.vg-chip { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 9px; border-radius: var(--vg-r-sm);
  background: var(--vg-bg-soft); color: var(--vg-text-2); font-size: 12.5px; cursor: pointer; border: 1px solid transparent;
  font-family: inherit; transition: background .15s; }
.vg-chip:hover { background: var(--vg-bg-mute); }
.vg-chip.is-active { background: var(--vg-acc-soft); color: var(--vg-acc-ink); font-weight: 500; }
.vg-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.vg-avatar { width: 28px; height: 28px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--vg-acc-soft);
  color: var(--vg-acc-ink); font-size: 12px; font-weight: 600; flex: none; overflow: hidden; }
.vg-avatar img { width: 100%; height: 100%; object-fit: cover; }
.vg-pill-stat { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: var(--vg-r-full);
  border: 1px solid var(--vg-line); font-weight: 600; font-size: 13px; background: var(--vg-bg); white-space: nowrap; }
@media (max-width: 1180px) { .vg-app.has-sub .vg-topbar .vg-pill-stat { display: none; } }

/* ============ 8. BẢNG ============ */
.vg-table-wrap { overflow-x: auto; }
.vg-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.vg-table th { height: 40px; padding: 0 10px; text-align: left; font-weight: 500; color: var(--vg-text-2); font-size: 13px;
  border-bottom: 1px solid var(--vg-line); white-space: nowrap; }
.vg-table td { padding: 10px; border-bottom: 1px solid var(--vg-line-soft); vertical-align: middle; }
.vg-table tbody tr { transition: background .12s; }
.vg-table tbody tr:hover { background: var(--vg-bg-side); }
.vg-table tr.is-selected { background: var(--vg-acc-soft); }
.vg-table .vg-num { text-align: right; font-variant-numeric: tabular-nums; }
.vg-table .vg-row-actions { opacity: 0; transition: opacity .12s; text-align: right; white-space: nowrap; }
.vg-table tr:hover .vg-row-actions { opacity: 1; }
@media (hover: none), (max-width: 900px) { .vg-table .vg-row-actions { opacity: 1; } }
.vg-cell-t { font-weight: 500; color: var(--vg-text); }
.vg-cell-s { font-size: 12.5px; color: var(--vg-acc-ink); }
.vg-toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.vg-toolbar > .vg-input-wrap { flex: 1 1 220px; max-width: 320px; }
.vg-toolbar > .vg-select { width: auto; min-width: 160px; }
.vg-pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 12px; color: var(--vg-text-2); font-size: 13px; }
.vg-bulk { display: none; align-items: center; gap: 10px; padding: 8px 12px; border-radius: var(--vg-r); background: var(--vg-acc-soft);
  color: var(--vg-acc-ink); font-size: 13px; font-weight: 500; margin-bottom: 10px; }
.vg-bulk.is-on { display: flex; }

/* ============ 9. TAB, PHÂN ĐOẠN ============ */
.vg-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--vg-line); margin-bottom: 16px; overflow-x: auto; }
.vg-tab { height: 38px; padding: 0 12px; border: 0; background: none; font: 500 14px var(--vg-font); color: var(--vg-text-2);
  cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.vg-tab:hover { color: var(--vg-text); }
.vg-tab.is-active { color: var(--vg-acc-ink); border-bottom-color: var(--vg-acc); }
.vg-seg { display: inline-flex; padding: 3px; border-radius: var(--vg-r); background: var(--vg-bg-soft); gap: 2px; }
.vg-seg button { white-space: nowrap; flex: none; height: 28px; padding: 0 12px; border: 0; border-radius: var(--vg-r-sm); background: none; font: 500 13px var(--vg-font);
  color: var(--vg-text-2); cursor: pointer; }
.vg-seg button.is-active { background: var(--vg-bg); color: var(--vg-text); box-shadow: var(--vg-sh); }
.vg-tab-panel[hidden] { display: none; }

/* ============ 10. MENU THẢ, HỘP THOẠI, NGĂN KÉO ============ */
.vg-dd { position: relative; display: inline-flex; }
.vg-dd-menu { position: absolute; top: calc(100% + 6px); left: 0; z-index: 60; min-width: 200px; padding: 4px; background: var(--vg-bg);
  border: 1px solid var(--vg-line); border-radius: var(--vg-r-lg); box-shadow: var(--vg-sh-lg); display: none;
  animation: vg-pop .14s var(--vg-ease); }
.vg-dd.is-right .vg-dd-menu { left: auto; right: 0; }
.vg-dd.is-open .vg-dd-menu { display: block; }
.vg-dd-i { display: flex; align-items: center; gap: 8px; width: 100%; height: 32px; padding: 0 8px; border: 0; background: none;
  border-radius: var(--vg-r-sm); font: 400 14px var(--vg-font); color: var(--vg-text); cursor: pointer; text-align: left; }
.vg .vg-dd-i:hover { background: var(--vg-bg-soft); text-decoration: none; }
.vg-dd-i.is-danger { color: var(--vg-bad); }
.vg-dd-i svg { width: 16px; height: 16px; color: var(--vg-text-3); }
.vg-dd-sep { height: 1px; background: var(--vg-line); margin: 4px 0; }
.vg-dd-h { padding: 6px 8px 4px; font-size: 11px; font-weight: 600; color: var(--vg-text-3); text-transform: uppercase; letter-spacing: .05em; }
.vg-switcher { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 8px; border: 0; background: none;
  border-radius: var(--vg-r); font: 500 14px var(--vg-font); color: var(--vg-text); cursor: pointer; white-space: nowrap; }
.vg-switcher:hover { background: var(--vg-bg-soft); }
.vg-switcher svg { width: 16px; height: 16px; color: var(--vg-text-3); }

.vg-overlay { position: fixed; inset: 0; z-index: 80; background: rgba(15, 23, 42, .45); display: none; align-items: flex-start;
  justify-content: center; padding: 8vh 16px 16px; animation: vg-fade .15s; }
.vg-overlay.is-open { display: flex; }
.vg-modal { width: 100%; max-width: 520px; max-height: 84vh; overflow: auto; background: var(--vg-bg); border-radius: var(--vg-r-xl);
  box-shadow: var(--vg-sh-lg); animation: vg-pop .18s var(--vg-ease); }
.vg-modal-lg { max-width: 760px; }
.vg-modal-h { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px 0; }
.vg-modal-b { padding: 14px 22px; }
.vg-modal-f { padding: 4px 22px 20px; display: flex; justify-content: flex-end; gap: 8px; }
.vg-overlay.is-drawer { padding: 0; justify-content: flex-end; align-items: stretch; }
.vg-drawer { width: min(460px, 100%); height: 100%; background: var(--vg-bg); box-shadow: var(--vg-sh-lg); display: flex;
  flex-direction: column; animation: vg-slide .22s var(--vg-ease); }
.vg-drawer .vg-modal-b { flex: 1; overflow: auto; }
@keyframes vg-fade { from { opacity: 0; } }
@keyframes vg-pop { from { opacity: 0; transform: translateY(4px) scale(.98); } }
@keyframes vg-slide { from { transform: translateX(30px); opacity: 0; } }

/* Bảng lệnh Ctrl+K */
.vg-cmd { width: 100%; max-width: 560px; background: var(--vg-bg); border-radius: var(--vg-r-xl); box-shadow: var(--vg-sh-lg);
  overflow: hidden; animation: vg-pop .16s var(--vg-ease); }
.vg-cmd input { width: 100%; height: 48px; border: 0; border-bottom: 1px solid var(--vg-line); padding: 0 16px; font: 400 15px var(--vg-font);
  background: transparent; color: var(--vg-text); outline: none; }
.vg-cmd-list { max-height: 50vh; overflow: auto; padding: 6px; }
.vg-cmd-i { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--vg-r); cursor: pointer; color: var(--vg-text); }
.vg-cmd-i.is-active { background: var(--vg-acc-soft); color: var(--vg-acc-ink); }
.vg-cmd-i small { margin-left: auto; color: var(--vg-text-3); }
.vg-cmd-i svg { width: 16px; height: 16px; flex: none; }
.vg-cmd-empty { padding: 24px; text-align: center; color: var(--vg-text-3); }

/* ============ 11. PHẢN HỒI ============ */
.vg-toasts { position: fixed; z-index: 90; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; max-width: 360px; }
.vg-toast { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--vg-r-lg); background: var(--vg-bg);
  border: 1px solid var(--vg-line); box-shadow: var(--vg-sh-lg); font-size: 14px; animation: vg-pop .2s var(--vg-ease); }
.vg-toast::before { content: ""; width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: var(--vg-acc); flex: none; }
.vg-toast.is-ok::before { background: var(--vg-ok); } .vg-toast.is-err::before { background: var(--vg-bad); }
.vg-toast.is-warn::before { background: var(--vg-warn); }
.vg-toast.is-out { opacity: 0; transform: translateY(6px); transition: .2s; }
.vg-alert { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--vg-r-lg); font-size: 14px; background: var(--vg-info-soft);
  color: var(--vg-info-ink); border: 1px solid transparent; }
.vg-alert-ok { background: var(--vg-ok-soft); color: var(--vg-ok-ink); }
.vg-alert-warn { background: var(--vg-warn-soft); color: var(--vg-warn-ink); }
.vg-alert-bad { background: var(--vg-bad-soft); color: var(--vg-bad-ink); }
.vg-alert b { font-weight: 600; }
.vg-empty { padding: 40px 16px; text-align: center; color: var(--vg-text-2); }
.vg-empty-ic { width: 44px; height: 44px; margin: 0 auto 12px; border-radius: var(--vg-r-lg); background: var(--vg-bg-soft); display: grid;
  place-items: center; color: var(--vg-text-3); }
.vg-empty b { display: block; color: var(--vg-text); font-weight: 600; margin-bottom: 4px; }
.vg-skel { background: linear-gradient(90deg, var(--vg-bg-soft) 0%, var(--vg-bg-mute) 50%, var(--vg-bg-soft) 100%); background-size: 200% 100%;
  animation: vg-shim 1.2s infinite; border-radius: var(--vg-r-sm); height: 14px; }
@keyframes vg-shim { to { background-position: -200% 0; } }
.vg-progress { height: 6px; border-radius: var(--vg-r-full); background: var(--vg-bg-soft); overflow: hidden; }
.vg-progress > i { display: block; height: 100%; background: var(--vg-acc-grad); border-radius: inherit; transition: width .3s; }
.vg-tip { position: relative; }
.vg-tip[data-tip]:hover::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: #0f172a; color: #fff; font-size: 12px; padding: 5px 8px; border-radius: var(--vg-r-sm); white-space: nowrap; z-index: 70; pointer-events: none; }
.vg-fab { position: fixed; right: 20px; bottom: 20px; width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--vg-acc-grad);
  color: #fff; box-shadow: var(--vg-sh-lg); cursor: pointer; display: grid; place-items: center; z-index: 40; }

@media (prefers-reduced-motion: reduce) { .vg * { animation: none !important; transition: none !important; } }


/* ============ 12. MÀN CẢM ỨNG VÀ CHỐNG TRÀN (v1.2, 19/10/2026: rút từ kiểm thử 15 trang Gateway v2 ở 1280, 820, 375px) ============ */
/* Mọi ô lưới, cột flex chứa nội dung: cho phép co lại, nội dung dài tự xuống dòng thay vì đẩy trang rộng ra */
.vg-grid-2 > *, .vg-stats > *, .vg-row > *, .vg-card, .vg-card-b, .vg-card-h > *, .vg-feature > span { min-width: 0; }
.vg-card-h { flex-wrap: wrap; }
.vg-card-b { overflow-wrap: break-word; }   /* break-word, KHÔNG dùng anywhere: anywhere làm bảng co cột tới mức chữ xuống dòng từng ký tự */
.vg-badge { overflow-wrap: normal; }
.vg-badge.is-wrap { white-space: normal; height: auto; min-height: 22px; padding-block: 2px; line-height: 1.35; max-width: 100%; }
.vg-table td { overflow-wrap: break-word; }
/* Bảng trên màn hẹp: giữ bề rộng tối thiểu và cuộn ngang trong khung, không bóp cột tới mức chữ xuống dòng từng ký tự */
@media (max-width: 760px) { .vg-table-wrap > .vg-table { min-width: 620px; } .vg-table-wrap { -webkit-overflow-scrolling: touch; } }
/* Vùng bấm tối thiểu 36px trên máy cảm ứng (chuẩn WCAG 2.5.8 là 24px, LadiPage dùng 36px) */
@media (pointer: coarse), (max-width: 900px) {
  .vg-chip { height: 34px; padding: 0 12px; font-size: 13px; }
  .vg-btn-sm { height: 34px; padding: 0 12px; }
  .vg-btn-sm.vg-btn-icon { width: 34px; }
  .vg-tab { height: 42px; }
  .vg-seg button { height: 34px; }
  .vg-check, .vg-switch { min-height: 36px; padding-block: 4px; }
  .vg-check input { width: 20px; height: 20px; }
  .vg-check input:checked::after { width: 11px; height: 6px; }
  .vg-input, .vg-select { height: 40px; font-size: 16px; }          /* 16px để iOS không tự phóng to khi gõ */
  .vg-textarea { font-size: 16px; }
  .vg-dd-i { height: 40px; }
  .vg-nav-i { height: 40px; }
  .vg-chips, .vg-seg { max-width: 100%; }
  .vg-seg { overflow-x: auto; scrollbar-width: none; }
}
/* Máy tính bảng dọc: thanh chip, tab, phân đoạn cuộn ngang thay vì xuống nhiều dòng */
@media (max-width: 900px) {
  .vg-chips.is-scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .vg-page-head > .vg-row { width: 100%; }
  .vg-page-head .vg-row > .vg-select, .vg-toolbar > .vg-select { flex: 1 1 140px; width: auto; min-width: 0; }
  .vg-page-head .vg-row > .vg-seg { flex: 1 1 100%; }
}
@media (max-width: 640px) {
  .vg-page-head { margin-bottom: 14px; }
  .vg-page-head .vg-btn-primary { flex: 1 1 auto; }
  .vg-card-h, .vg-card-b, .vg-card-f { padding-left: 16px; padding-right: 16px; }
  .vg-modal-h, .vg-modal-b, .vg-modal-f { padding-left: 16px; padding-right: 16px; }
  .vg-overlay { padding-top: 4vh; }
  .vg-toasts { left: 12px; right: 12px; max-width: none; }
}


/* ============ 13. KHUNG "TẤM NỘI DUNG" KIỂU LADIPAGE (v1.3, 19/10/2026) ============
   Đo app.ladipage.com: nền xám liền thanh trái và thanh trên (46px, trong suốt, không viền); menu phụ và nội dung nằm trên
   một tấm trắng bo góc trên trái 12px, viền 1px, bóng nhẹ; thanh trái và tấm cuộn riêng. Không cần đổi HTML trang:
   .vg-main dùng display: contents để thanh trên và .vg-page thành ô lưới của .vg-app. */
@media (min-width: 901px) {
  body.vg { background: var(--vg-bg-side); }
  .vg-app { height: 100vh; overflow: hidden; background: var(--vg-bg-side);
    grid-template-columns: var(--vg-side-w) minmax(0, 1fr); grid-template-rows: var(--vg-top-h) minmax(0, 1fr); }
  .vg-app.has-sub { grid-template-columns: var(--vg-side-w) var(--vg-sub-w) minmax(0, 1fr); }
  .vg-side { grid-row: 1 / -1; grid-column: 1; height: 100vh; border-right: 0; }
  .vg-main { display: contents; }
  .vg-app > .vg-main > .vg-topbar { grid-row: 1; grid-column: 2 / -1; position: static; background: transparent; backdrop-filter: none; border-bottom: 0; padding: 0 16px; }
  .vg-app > .vg-main > .vg-page { grid-row: 2; grid-column: -2; max-width: none; height: 100%; overflow-y: auto; background: var(--vg-sheet);
    border-top: 1px solid var(--vg-line); padding: 20px max(24px, calc((100% - 1280px) / 2)) 48px; }
  .vg-app:not(.has-sub) > .vg-main > .vg-page { border-left: 1px solid var(--vg-line); border-top-left-radius: 12px;
    box-shadow: -1px -1px 3px rgba(15, 23, 42, .03); }
  .vg-app > .vg-subnav { grid-row: 2; grid-column: 2; position: static; height: auto; background: var(--vg-sheet);
    border: 1px solid var(--vg-line); border-width: 1px 1px 0 1px; border-top-left-radius: 12px; padding: 12px 8px; }
  .vg-app.has-sub > .vg-main > .vg-page { border-left: 0; }
}
/* Chữ và nhịp theo LadiPage */
.vg-h1 { font-size: 20px; line-height: 28px; letter-spacing: -.01em; }
.vg-h1.is-hero { font-size: 30px; line-height: 36px; letter-spacing: -.02em; }
@media (min-width: 640px) { .vg-h1 { font-size: 20px; line-height: 28px; } .vg-h1.is-hero { font-size: 36px; line-height: 40px; } }
.vg-page-head { margin-bottom: 16px; }
.vg-nav-i { font-size: 13px; font-weight: 500; }
.vg-nav-sec { font-size: 10px; padding: 12px 8px 2px; }
.vg-subnav-t { font-size: 13px; padding: 0 8px 8px; }
.vg-subnav .vg-nav-i { height: 30px; padding: 0 8px; gap: 10px; color: var(--vg-text); }
.vg-subnav .vg-nav-i svg { width: 16px; height: 16px; color: var(--vg-text-2); }
.vg .vg-subnav .vg-nav-i.is-active { background: var(--vg-sub-on); color: var(--vg-text); font-weight: 600; }
.vg-table th { font-size: 12px; font-weight: 700; color: var(--vg-text); padding: 0 8px; }
.vg-table td { padding: 8px; height: 52px; }
.vg-chip { height: 24px; padding: 0 10px; border-radius: var(--vg-r-xs); font-size: 12px; font-weight: 500; }
.vg-input, .vg-select { font-size: 13px; }
.vg-textarea { font-size: 13px; }
@media (pointer: coarse), (max-width: 900px) {
  .vg-chip { height: 34px; padding: 0 12px; font-size: 13px; }
  .vg-input, .vg-select, .vg-textarea { font-size: 16px; }
  .vg-subnav .vg-nav-i { height: 40px; }
  .vg-nav-i { font-size: 14px; }
}

/* Phân đoạn đang xử lý (v1.4): khoá bấm, nút đang chọn hiện vòng quay. JS đặt class is-busy và disabled cho các nút. */
.vg-seg.is-busy { cursor: progress; }
.vg-seg.is-busy button { pointer-events: none; }
.vg-seg.is-busy button:not(.is-active) { opacity: .55; }
.vg-seg.is-busy button.is-active { display: inline-flex; align-items: center; gap: 6px; }
.vg-seg.is-busy button.is-active::before { content: ""; width: 12px; height: 12px; border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: vg-spin .7s linear infinite; }
.vg-seg button[disabled] { cursor: progress; }

/* 14. Chọn khoảng ngày (v1.5): nút hiện khoảng ngày, bảng kỳ có sẵn + lịch 2 tháng + Huỷ / Áp dụng (nhịp báo cáo LadiPage) */
.vg-drp { position: relative; display: inline-block; }
.vg-drp-btn { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; border: 1px solid var(--vg-line); border-radius: 8px;
  background: var(--vg-bg); color: var(--vg-text); font: inherit; font-size: 13px; cursor: pointer; white-space: nowrap; }
.vg-drp-btn:hover { background: var(--vg-bg-soft); }
.vg-drp-btn svg { width: 16px; height: 16px; color: var(--vg-text-2); flex: none; }
.vg-drp-btn b { font-weight: 600; }
.vg-drp-sep { color: var(--vg-text-3); margin: 0 2px; }
.vg-drp.is-busy .vg-drp-btn { cursor: progress; opacity: .8; }
.vg-drp.is-busy .vg-drp-btn > svg:first-child { display: none; }
.vg-drp.is-busy .vg-drp-btn::before { content: ""; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  animation: vg-spin .7s linear infinite; flex: none; }
.vg-drp-pop { position: absolute; z-index: 60; top: calc(100% + 6px); left: 0; display: flex; background: var(--vg-bg); border: 1px solid var(--vg-line);
  border-radius: 12px; box-shadow: 0 12px 32px rgba(15, 23, 42, .14); overflow: hidden; }
.vg-drp-pop[hidden] { display: none; }
.vg-drp-pre { display: flex; flex-direction: column; padding: 8px; border-right: 1px solid var(--vg-line); background: var(--vg-bg-side); min-width: 128px; }
.vg-drp-pre button { text-align: left; border: 0; background: none; font: inherit; font-size: 13px; color: var(--vg-text-2); padding: 7px 10px; border-radius: 6px; cursor: pointer; }
.vg-drp-pre button:hover { background: var(--vg-bg-soft); color: var(--vg-text); }
.vg-drp-pre button.is-active { background: var(--vg-acc-soft); color: var(--vg-acc-ink); font-weight: 600; }
.vg-drp-main { display: flex; flex-direction: column; }
.vg-drp-cal { position: relative; display: flex; gap: 20px; padding: 12px 16px 4px; }
.vg-drp-nav { position: absolute; top: 10px; width: 28px; height: 28px; border: 0; background: none; border-radius: 6px; cursor: pointer; color: var(--vg-text-2);
  display: inline-flex; align-items: center; justify-content: center; }
.vg-drp-nav:hover { background: var(--vg-bg-soft); }
.vg-drp-nav[data-nav="-1"] { left: 8px; } .vg-drp-nav[data-nav="1"] { right: 8px; }
.vg-drp-nav svg { width: 16px; height: 16px; }
.vg-drp-mh { text-align: center; font-weight: 600; font-size: 13px; height: 28px; line-height: 28px; margin-bottom: 4px; }
.vg-drp-g { display: grid; grid-template-columns: repeat(7, 34px); row-gap: 2px; }
.vg-drp-g i { font-style: normal; font-size: 11.5px; color: var(--vg-text-3); text-align: center; height: 24px; line-height: 24px; }
.vg-drp-g button { height: 32px; border: 0; background: none; font: inherit; font-size: 13px; color: var(--vg-text); cursor: pointer; border-radius: 6px; }
.vg-drp-g button:hover:not(:disabled) { background: var(--vg-bg-soft); }
.vg-drp-g button.is-in { background: var(--vg-acc-soft); color: var(--vg-acc-ink); border-radius: 0; }
.vg-drp-g button.is-edge { background: var(--vg-acc-grad); color: #fff; font-weight: 600; }
.vg-drp-g button.is-today:not(.is-edge) { box-shadow: inset 0 0 0 1px var(--vg-line); }
.vg-drp-g button:disabled { color: var(--vg-text-3); opacity: .45; cursor: default; }
.vg-drp-foot { display: flex; align-items: center; gap: 8px; padding: 10px 16px 12px; border-top: 1px solid var(--vg-line); }
.vg-drp-foot .vg-input { width: 112px; height: 32px; font-size: 13px; }
.vg-drp-sp { flex: 1; }
.vg-drp-cmp { font-size: 12.5px; color: var(--vg-text-3); margin-left: 8px; white-space: nowrap; }
@media (max-width: 640px) {
  .vg-drp { display: block; }
  .vg-drp-btn { width: 100%; }
  .vg-drp-pop { position: fixed; left: 8px; right: 8px; top: auto; bottom: 8px; flex-direction: column; max-height: calc(100vh - 16px); overflow: auto; }
  .vg-drp-pre { flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--vg-line); gap: 4px; }
  .vg-drp-pre button { border: 1px solid var(--vg-line); padding: 5px 10px; }
  .vg-drp-cal { justify-content: center; }
  .vg-drp-m2 { display: none; }
  .vg-drp-g { grid-template-columns: repeat(7, 1fr); }
  .vg-drp-foot { flex-wrap: wrap; }
  .vg-drp-foot .vg-input { flex: 1 1 0; width: auto; min-width: 0; }
  .vg-drp-sp { flex-basis: 100%; height: 0; }
  .vg-drp-foot .vg-btn { flex: 1; }
}
@media (max-width: 640px) { .vg-drp-cmp { display: none; } }

/* 15. Đồng bộ cỡ chữ, dòng, biểu tượng với LadiPage (v1.6, đo từ app.ladipage.com/reports 19/10/2026)
   Menu trái: hàng 32px, chữ 13/19.5 đậm 500 màu slate-500, biểu tượng 20px (đặc, 24 viewBox), nhãn nhóm 10/15 hoa 0.5px.
   Menu phụ: tiêu đề 14/24 đậm 600, hàng 28px, chữ 13/19.5, biểu tượng 16px nét 2. Tiêu đề trang 24/32 đậm 700.
   Thẻ chỉ số: nhãn 14/20 đậm 500 slate-500, số 24/32 đậm 700, ghi chú 12/16. */
:root { --vg-nav-c: #64748b; --vg-nav-lab: #7f849e; }
:root[data-theme="dark"] { --vg-nav-c: #94a3b8; --vg-nav-lab: #64748b; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --vg-nav-c: #94a3b8; --vg-nav-lab: #64748b; } }
.vg .vg-nav-i { flex: none; height: 32px; font-size: 13px; line-height: 19.5px; font-weight: 500; color: var(--vg-nav-c); gap: 8px; padding: 0 6px; }
.vg .vg-nav-i:hover { background: rgba(226, 232, 240, .7); color: var(--vg-text); }
:root[data-theme="dark"] .vg .vg-nav-i:hover { background: rgba(255, 255, 255, .08); }
.vg .vg-nav-i.is-active { color: #fff; }
.vg .vg-nav-i svg { width: 20px; height: 20px; flex: none; }
.vg .vg-nav-i .vg-app-ic svg { width: 15px !important; height: 15px !important; }
.vg .vg-nav-sec { font-size: 10px; line-height: 15px; font-weight: 600; letter-spacing: .5px; color: var(--vg-nav-lab); padding: 12px 8px 4px; }
.vg .vg-nav { gap: 2px; }
.vg .vg-subnav-t { font-size: 14px; line-height: 24px; font-weight: 600; padding: 4px 8px; }
.vg .vg-subnav .vg-nav-i { height: 28px; padding: 0 8px; gap: 12px; color: var(--vg-text); }
.vg .vg-subnav .vg-nav-i svg { width: 16px; height: 16px; color: var(--vg-nav-c); }
.vg .vg-h1 { font-size: 24px; line-height: 32px; font-weight: 700; letter-spacing: 0; }
.vg .vg-h1.is-hero { font-size: 36px; line-height: 40px; letter-spacing: -.02em; }
@media (max-width: 640px) { .vg .vg-h1.is-hero { font-size: 28px; line-height: 34px; } }
.vg .vg-h3 { font-size: 14px; line-height: 20px; font-weight: 600; }
.vg .vg-sub { font-size: 14px; line-height: 20px; color: var(--vg-nav-c); }
.vg .vg-stat-l { font-size: 14px; line-height: 20px; font-weight: 500; color: var(--vg-nav-c); gap: 8px; }
.vg .vg-stat-l svg { width: 16px; height: 16px; }
.vg .vg-stat-v { font-size: 24px; line-height: 32px; font-weight: 700; letter-spacing: 0; margin-top: 8px; }
.vg .vg-stat-d { font-size: 12px; line-height: 16px; }
@media (max-width: 900px) { .vg .vg-nav-i { height: 40px; font-size: 14px; } .vg .vg-subnav .vg-nav-i { height: 40px; } }

/* 16. Logo thương hiệu (v1.7): VG.shell({markImg}) dùng ảnh thay chữ cái, nền trong suốt, không khung chuyển sắc */
.vg-brand-mark.is-img { background: none; border-radius: 0; width: 28px; height: 28px; }
.vg-brand-mark.is-img img { width: 100%; height: 100%; object-fit: contain; display: block; }

/* 17. Ô chọn có tìm kiếm (v1.8): VG.combo / select[data-vg-combo] */
.vg-combo-native { display: none !important; }
.vg-combo { position: relative; display: inline-block; min-width: 170px; max-width: 240px; vertical-align: middle; }
.vg-combo[hidden] { display: none; }
.vg-combo-in { width: 100%; padding-right: 54px; text-overflow: ellipsis; cursor: text; }
.vg-combo.is-set .vg-combo-in { font-weight: 500; border-color: var(--vg-acc); }
.vg-combo-c { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--vg-text-3); pointer-events: auto; display: inline-flex; cursor: pointer; }
.vg-combo-c svg { width: 16px; height: 16px; }
.vg-combo-x { position: absolute; right: 30px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; border: 0; background: var(--vg-bg-soft); border-radius: 50%; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; color: var(--vg-text-2); padding: 0; }
.vg-combo-x[hidden] { display: none; }
.vg-combo-x svg { width: 12px; height: 12px; }
.vg-combo-list { position: absolute; z-index: 70; top: calc(100% + 4px); left: 0; min-width: 100%; width: max-content; max-width: 360px; max-height: 280px; overflow-y: auto;
  background: var(--vg-bg); border: 1px solid var(--vg-line); border-radius: 10px; box-shadow: 0 12px 32px rgba(15, 23, 42, .14); padding: 4px; }
.vg-combo-list[hidden] { display: none; }
.vg-combo-i { padding: 7px 10px; border-radius: 6px; font-size: 13px; line-height: 19px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vg-combo-i.is-hi { background: var(--vg-bg-soft); }
.vg-combo-i.is-sel { color: var(--vg-acc-ink); font-weight: 600; }
.vg-combo-empty { padding: 10px; color: var(--vg-text-3); font-size: 13px; }
@media (max-width: 640px) { .vg-combo { display: block; max-width: none; width: 100%; } .vg-combo-list { max-width: none; width: 100%; } }

/* 18. Thành phần báo cáo quảng cáo (v1.9): vg-kpi, vg-chan, vg-alerts, vg-funnel, vg-pair, vg-rank; chỉ dùng token */
.vg-unit { font-size: max(11px, .62em); font-weight: 500; color: var(--vg-text-2); margin-left: 2px; }
.vg-delta { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.vg-delta.is-good { color: var(--vg-ok); } .vg-delta.is-bad { color: var(--vg-bad); } .vg-delta.is-flat, .vg-delta.is-none { color: var(--vg-text-3); font-weight: 500; }
.vg-spark { width: 64px; height: 24px; color: var(--vg-acc); flex: none; }
.vg-kpi { background: color-mix(in srgb, var(--vg-bg) 84%, transparent); backdrop-filter: blur(8px); border: 1px solid var(--vg-line); border-radius: var(--vg-r-xl); padding: 14px 16px; min-width: 0;
  font-variant-numeric: tabular-nums; display: flex; flex-direction: column; gap: 6px; }
.vg-kpi-l { font-size: 13px; color: var(--vg-text-2); font-weight: 500; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.vg-kpi-b { font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: var(--vg-r-full); background: var(--vg-warn-soft); color: var(--vg-warn-ink); }
.vg-kpi-v { font-size: 24px; line-height: 32px; font-weight: 700; }
.vg-kpi-f { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.vg-kpi-n { font-size: 11.5px; line-height: 15px; color: var(--vg-text-3); }
.vg-kpi.is-emphasis { background: var(--vg-text); border-color: var(--vg-text); color: var(--vg-bg); }
.vg-kpi.is-emphasis .vg-kpi-l, .vg-kpi.is-emphasis .vg-unit, .vg-kpi.is-emphasis .vg-kpi-n { color: var(--vg-bg); opacity: .78; }
.vg-kpi.is-emphasis .vg-spark { color: var(--vg-bg); }
.vg-chan { position: relative; background: color-mix(in srgb, var(--vg-bg) 84%, transparent); backdrop-filter: blur(8px); border: 1px solid var(--vg-line); border-radius: var(--vg-r-xl); padding: 16px; overflow: hidden;
  font-variant-numeric: tabular-nums; min-width: 0; }
.vg-chan::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--ch, var(--vg-acc)); }
.vg-chan.is-off { opacity: .62; }
.vg-chan-h { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; } .vg-chan-h b { font-size: 15px; flex: 1; }
.vg-chan-g { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 12px; }
.vg-chan-l { font-size: 12px; color: var(--vg-text-3); } .vg-chan-v { font-size: 16px; font-weight: 600; }
.vg-chan-e { margin-top: 10px; font-size: 12px; color: var(--vg-text-3); line-height: 16px; }
.vg-chan-a { margin-top: 12px; border-top: 1px solid var(--vg-line-soft); padding-top: 8px; font-size: 13px; }
.vg-chan-a summary { cursor: pointer; color: var(--vg-text-2); font-weight: 500; }
.vg-chan-ar { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; }
.vg-alerts { border: 1px solid var(--vg-line); border-radius: var(--vg-r-lg); background: var(--vg-bg); font-size: 13.5px; }
.vg-alerts > summary, .vg-alerts.is-clear { display: flex; align-items: center; gap: 8px; padding: 10px 14px; cursor: pointer; list-style: none; }
.vg-alerts.is-clear { cursor: default; color: var(--vg-ok-ink); background: var(--vg-ok-soft); border-color: transparent; }
.vg-alerts.is-clear span { display: flex; align-items: center; gap: 8px; }
.vg-alerts > summary::-webkit-details-marker { display: none; }
.vg-alerts-s { flex: 1; color: var(--vg-text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.vg-alerts.is-high { background: var(--vg-bad-soft); border-color: transparent; } .vg-alerts.is-medium { background: var(--vg-warn-soft); border-color: transparent; } .vg-alerts.is-low { background: var(--vg-bg-soft); }
.vg-alerts svg { width: 16px; height: 16px; flex: none; }
.vg-alerts[open] > summary svg:last-child { transform: rotate(180deg); }
.vg-alerts-l { padding: 0 14px 10px; display: flex; flex-direction: column; gap: 6px; }
.vg-alerts-r { display: flex; gap: 8px; align-items: baseline; } .vg-alerts-r i { width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--vg-text-3); transform: translateY(-1px); }
.vg-alerts-r.is-high i { background: var(--vg-bad); } .vg-alerts-r.is-medium i { background: var(--vg-warn); } .vg-alerts-r span { flex: 1; }
.vg-funnel { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.vg-funnel-s { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: var(--vg-r-lg); border: 1px solid transparent; min-width: 0;
  background: color-mix(in srgb, var(--vg-acc) var(--tone), var(--vg-bg)); color: var(--vg-text); font-variant-numeric: tabular-nums; }
.vg-funnel-s:nth-child(n+3) { color: var(--vg-bg); } .vg-funnel-s:nth-child(n+3) .vg-dim { color: var(--vg-bg); opacity: .8; }
.vg-funnel .vg-funnel-s.is-empty { border-style: dashed; border-color: var(--vg-line); background: var(--vg-bg-soft); color: var(--vg-text-2); }
.vg-funnel .vg-funnel-s.is-empty .vg-dim { color: var(--vg-text-3); opacity: 1; }
.vg-funnel-t { font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: var(--vg-r-full); background: var(--vg-bg); color: var(--vg-text-2); white-space: nowrap; }
.vg-funnel-s.is-alert { border-color: var(--vg-bad); box-shadow: 0 0 0 2px var(--vg-bad-soft); }
.vg-funnel-l { flex: 1; font-size: 13px; font-weight: 600; min-width: 0; } .vg-funnel-c { font-size: 17px; font-weight: 700; } .vg-funnel-r { font-size: 12px; min-width: 52px; text-align: right; opacity: .85; }
.vg-pair { padding: 10px 0; border-bottom: 1px solid var(--vg-line-soft); font-variant-numeric: tabular-nums; } .vg-pair:last-child { border-bottom: 0; }
.vg-pair-l { font-size: 13px; font-weight: 600; margin-bottom: 4px; } .vg-pair-v { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.vg-pair small { display: block; font-size: 11.5px; color: var(--vg-text-3); } .vg-pair b { font-size: 16px; }
.vg-rank th.is-sort { cursor: pointer; user-select: none; } .vg-rank th.is-sort:hover { color: var(--vg-text); }
.vg-rank td, .vg-rank th { font-variant-numeric: tabular-nums; }
.vg-chip { display: inline-block; padding: 1px 8px; border-radius: var(--vg-r-full); font-size: 12px; background: var(--vg-acc-soft); color: var(--vg-acc-ink); white-space: nowrap; }

/* ---- Báo cáo quảng cáo (v1.9.1): bố cục khối báo cáo đa kênh, dùng cùng VG.kpiCard, channelCard, funnelGlass, rankTable ---- */
.vg-ar-ctl { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 6px; }
.vg-ar-ctl .vg-ar-end { margin-left: auto; }
.vg-ar-info { font-size: 12.5px; color: var(--vg-text-3); margin: 0 0 14px; }
.vg-ar-kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin: 14px 0; }
.vg-ar-chans { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.vg-ar-journey { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 16px; }
.vg-ar-unattr { margin: 0 0 14px; padding: 10px 14px; border: 1px dashed var(--vg-line); border-radius: var(--vg-r-lg); font-size: 13px; color: var(--vg-text-2); background: var(--vg-bg-soft); }
.vg-ar-sec { margin-bottom: 16px; }
.vg-ar-notes { font-size: 12.5px; color: var(--vg-text-3); line-height: 1.6; padding: 4px 2px 0; }
.vg-ar-k, .vg-ar-c, .vg-ar-f, .vg-ar-t { background: var(--vg-bg-soft); border-radius: var(--vg-r-xl); }
.vg-ar-k { height: 112px; } .vg-ar-c { height: 168px; } .vg-ar-f { height: 280px; } .vg-ar-t { height: 220px; }
@media (max-width: 1279px) { .vg-ar-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 767px) {
  .vg-ar-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .vg-ar-chans { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 12px; margin: 0 -16px 12px; padding: 0 16px 6px; }
  .vg-ar-chans > * { flex: 0 0 86%; scroll-snap-align: start; }
  .vg-ar-journey { grid-template-columns: 1fr; } .vg-ar-journey .vg-ar-pairs { order: 2; } .vg-ar-journey .vg-ar-funnel { order: 1; }
}
