/* [CR-1114-01/02] ═══════════════════════════════════════════════════════════════════════════
   Kyvian UI — lớp giao diện chung cho mọi trang (dashboard, kho, fulfillment,
   đăng nhập, quản trị). Đen trắng là chính, font Google Sans.

   Cách dùng: <link rel="stylesheet" href="/static/velix.css"> đặt SAU khối
   <style> của trang, nên token và khung ở đây thắng luật cũ cùng độ ưu tiên.
   Chỉ đổi giao diện; id, class và hàm JS của từng trang giữ nguyên.

   1. Font          2. Token (sáng / tối)      3. Nền tảng
   4. Thanh bên     5. Thu gọn (chỉ icon)       6. Mobile (ngăn kéo)
   7. Bố cục trang không phải dashboard         8. Trang chọn workspace
   ═══════════════════════════════════════════════════════════════════════════ */

/* 1. Font ──────────────────────────────────────────────────────────────────── */
@font-face { font-family: "Google Sans"; src: url("/static/fonts/GoogleSans-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Google Sans"; src: url("/static/fonts/GoogleSans-Medium.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Google Sans"; src: url("/static/fonts/GoogleSans-SemiBold.ttf") format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Google Sans"; src: url("/static/fonts/GoogleSans-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }

/* 2. Token ─────────────────────────────────────────────────────────────────
   Một bộ màu duy nhất; các tên cũ của từng trang (--accent, --primary, --card,
   --ok, --bad…) đều trỏ về đây để trang nào cũng ra cùng một giao diện. */
:root {
  color-scheme: light;
  --k-0: #ffffff; --k-50: #fafafa; --k-100: #f5f5f5; --k-150: #f0f0f0; --k-200: #e5e5e5;
  --k-300: #d4d4d4; --k-400: #a3a3a3; --k-500: #737373; --k-600: #525252; --k-700: #404040;
  --k-900: #171717; --k-950: #0a0a0a;

  --font: "Google Sans", -apple-system, "Segoe UI", Roboto, sans-serif;

  --bg: var(--k-50);
  --bg-gradient: none;
  --surface: var(--k-0);
  --surface-2: var(--k-50);
  --surface-3: var(--k-100);
  --soft: var(--k-0);
  --soft2: var(--k-50);
  --line: var(--k-200);
  --line-2: var(--k-300);
  --line-strong: var(--k-300);
  --txt: var(--k-950);
  --muted: var(--k-600);
  --subtle: var(--k-500);

  --accent: var(--k-950);
  --accent-glow: rgba(10, 10, 10, 0.06);
  --primary: var(--k-950);
  --primary-fg: var(--k-0);
  --input: var(--k-200);
  --ring: var(--k-400);

  /* Trạng thái: đen trắng là chính; chỉ giữ một sắc đỏ trầm cho số âm / lỗi */
  --pos: var(--k-950);
  --neg: #b91c1c;
  --warn: var(--k-700);
  --warm: var(--k-700);
  --ok: var(--k-950);
  --bad: #b91c1c;
  --info: var(--k-600);

  --nav-accent: var(--k-950);
  --nav-accent-soft: var(--k-150);

  /* Tên token của kho / đăng nhập / fulfillment hub */
  --card: var(--k-0);
  --card-hover: var(--k-50);
  --hover: var(--k-100);
  --muted-bg: var(--k-100);
  --icon-bg: var(--k-100);

  --radius: 8px;
  --radius-sm: 6px;
  --radius-card: 12px;
  --shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
  --shadow-md: 0 2px 6px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 20px -6px rgba(0, 0, 0, 0.10);
  --shadow-xl: 0 16px 32px -8px rgba(0, 0, 0, 0.14);
  --glass-border: 1px solid var(--line);
  --glass-bg: var(--surface);
  --glass-blur: none;

  --side-w: 248px;
  --side-w-collapsed: 64px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: var(--k-950);
  --surface: #111111;
  --surface-2: var(--k-900);
  --surface-3: #1f1f1f;
  --soft: #111111;
  --soft2: var(--k-900);
  --line: #262626;
  --line-2: #3a3a3a;
  --line-strong: #3a3a3a;
  --txt: var(--k-50);
  --muted: var(--k-400);
  --subtle: var(--k-500);

  --accent: var(--k-50);
  --accent-glow: rgba(250, 250, 250, 0.08);
  --primary: var(--k-50);
  --primary-fg: var(--k-950);
  --input: #3a3a3a;
  --ring: var(--k-500);

  --pos: var(--k-50);
  --neg: #f87171;
  --warn: var(--k-300);
  --warm: var(--k-300);
  --ok: var(--k-50);
  --bad: #f87171;
  --info: var(--k-400);

  --nav-accent: var(--k-50);
  --nav-accent-soft: #1f1f1f;

  --card: #111111;
  --card-hover: var(--k-900);
  --hover: #1f1f1f;
  --muted-bg: #1f1f1f;
  --icon-bg: #1f1f1f;

  --shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
  --shadow-md: 0 2px 6px -1px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 8px 20px -6px rgba(0, 0, 0, 0.6);
  --shadow-xl: 0 16px 32px -8px rgba(0, 0, 0, 0.7);
}

/* 3. Nền tảng ──────────────────────────────────────────────────────────────── */
html, body { background: var(--bg); }
body { font-family: var(--font); color: var(--txt); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
button, input, select, textarea { font-family: inherit; }
::selection { background: var(--k-950); color: var(--k-0); }
[data-theme="dark"] ::selection { background: var(--k-50); color: var(--k-950); }
:focus-visible { outline-color: var(--txt); }

.vx-icon, .sidebar-icon { width: 18px; height: 18px; flex: 0 0 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.vx-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Logo Kyvian: bản đen cho nền sáng, bản trắng cho nền tối */
.logo-dark { display: none; }
[data-theme="dark"] .logo-light { display: none; }
[data-theme="dark"] .logo-dark { display: inline-block; }

/* 4. Thanh bên ─────────────────────────────────────────────────────────────── */
.shell-side {
  display: flex; flex-direction: column; gap: 0;
  background: var(--surface); color: var(--txt); font-family: var(--font); font-size: 14px;
  border-right: 1px solid var(--line); box-sizing: border-box;
}
.shell-side .side-brand { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex: 0 0 64px; padding: 0 10px 0 20px; }
.shell-side .side-brand .logo { height: 26px; width: auto; }
.shell-side .brand-home { display: inline-flex; align-items: center; cursor: pointer; color: inherit; text-decoration: none; }

/* Trang riêng có luật chung cho button (padding, nền, chiều cao…): thanh bên tự đặt lại để không bị ảnh hưởng */
.shell-side button, .vx-mobile-bar button { height: auto; min-width: 0; box-shadow: none; text-transform: none; letter-spacing: 0; line-height: 1.3; }
.shell-side svg, .vx-mobile-bar svg { flex-shrink: 0; }
.nav-collapse-btn, .shell-side .nav-collapse-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; flex: 0 0 34px; padding: 0;
  border: 0; border-radius: 8px; background: transparent; color: var(--subtle); cursor: pointer;
}
.nav-collapse-btn:hover { background: var(--surface-3); color: var(--txt); }
.nav-collapse-btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s; }

/* Nút đổi workspace (đầu thanh bên) */
.ws-wrap { position: relative; padding: 4px 12px 8px; }
.shell-side .workspace-btn {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 46px; margin: 0; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--txt);
  font: inherit; font-size: 14px; font-weight: 600; text-align: left; cursor: pointer;
}
.shell-side .workspace-btn:hover { background: var(--surface-3); }
.shell-side .ws-icon {
  width: 28px; height: 28px; flex: 0 0 28px; border-radius: 7px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--txt); color: var(--surface);
}
.shell-side .ws-icon svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.shell-side .ws-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shell-side .ws-updown { width: 16px; height: 16px; flex: 0 0 16px; color: var(--subtle); stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Menu nổi (workspace, tài khoản) */
.shell-side .nav-pop-wrap { position: relative; }
.shell-side .nav-pop {
  position: absolute; left: 0; right: 0; z-index: 1100; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-xl);
}
.shell-side .nav-pop[hidden] { display: none; }
.shell-side .ws-pop { top: calc(100% - 2px); left: 12px; right: auto; bottom: auto; width: 288px; }
.shell-side .ws-pop .ws-item { padding: 8px 10px; align-items: center; }
.shell-side .ws-pop .ws-item > span:nth-child(2) { flex: 1 1 auto; min-width: 0; line-height: 1.3; }
.shell-side .nav-foot .nav-pop { bottom: calc(100% + 6px); top: auto; }
.shell-side .nav-pop-title { padding: 6px 10px 6px; color: var(--subtle); font-size: 12px; font-weight: 500; text-transform: none; letter-spacing: 0; }
.shell-side .user-pop-item, .shell-side .nav-pop #darkModeBtn, .shell-side .ws-item {
  display: flex; align-items: center; justify-content: flex-start; gap: 10px; width: 100%; min-height: 38px; padding: 0 10px; border: 0; border-radius: 8px;
  background: transparent; box-shadow: none; transform: none; color: var(--txt); font: inherit; font-size: 14px; font-weight: 500; text-decoration: none; cursor: pointer; text-align: left;
}
.shell-side .user-pop-item:hover, .shell-side .nav-pop #darkModeBtn:hover, .shell-side .ws-item:hover { background: var(--surface-3); box-shadow: none; transform: none; }
.shell-side .ws-item .ws-desc { display: block; font-size: 12px; font-weight: 400; color: var(--subtle); }
.shell-side .ws-item .ws-check { margin-left: auto; width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2.2; visibility: hidden; }
.shell-side .ws-item.current .ws-check, .shell-side .user-pop-item.current .ws-check { visibility: visible; }
.shell-side .user-pop-item.current { color: var(--txt); font-weight: 600; }

/* Cây điều hướng: nhóm là nhãn nhỏ (bấm để xổ/gập), mục con là dòng có icon */
.shell-side .maintabs {
  position: static; display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden;
  width: auto; height: auto; left: auto; padding: 4px 12px 12px; gap: 6px;
  background: transparent; border: 0; border-radius: 0; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; transition: none;
}
.shell-side .maintabs[hidden] { display: none; }
.shell-side .nav-group + .nav-group { margin-top: 4px; }
/* Nhóm = icon + tên (giữ icon nhóm của bản cũ); mục con thụt vào dưới một đường cây mảnh, mỗi mục có icon riêng */
.shell-side .nav-group-toggle {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 38px; padding: 0 10px; border: 0; border-radius: 8px;
  background: transparent; color: var(--txt); font: inherit; font-size: 14px; font-weight: 500; letter-spacing: 0; text-transform: none; text-align: left; cursor: pointer;
}
.shell-side .nav-group-toggle:hover { background: var(--surface-3); color: var(--txt); }
.shell-side .nav-group-toggle .sidebar-icon { display: block; width: 18px; height: 18px; flex: 0 0 18px; opacity: 0.9; }
.shell-side .nav-group-toggle > span { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shell-side .nav-group.active > .nav-group-toggle { font-weight: 600; color: var(--txt); background: transparent; }
.shell-side .nav-chevron { display: block; margin-left: auto; width: 14px; height: 14px; color: currentColor; stroke: currentColor; fill: none; stroke-width: 2; opacity: 0; transition: transform .15s, opacity .15s; }
.shell-side .nav-group-toggle:hover .nav-chevron, .shell-side .nav-group-toggle:focus-visible .nav-chevron, .shell-side .nav-group-toggle[aria-expanded="false"] .nav-chevron { opacity: 1; }
.shell-side .nav-group-toggle[aria-expanded="true"] .nav-chevron { transform: rotate(90deg); }
.shell-side .nav-group-body { display: flex; flex-direction: column; gap: 1px; margin: 2px 0 6px 19px; padding: 0 0 0 10px; border: 0; border-left: 1px solid var(--line); overflow: visible; }
.shell-side .nav-group-body.collapsed { display: none; }

.shell-side .maintab {
  position: relative; display: flex; align-items: center; gap: 10px; width: 100%; min-height: 38px; padding: 0 10px;
  border: 0; border-radius: 8px; background: transparent; box-shadow: none; transform: none;
  color: var(--k-700); font: inherit; font-size: 14px; font-weight: 400; text-align: left; text-decoration: none; cursor: pointer;
  transition: background-color .12s, color .12s;
}
[data-theme="dark"] .shell-side .maintab { color: var(--k-300); }
.shell-side .maintab::before, .shell-side .maintab::after { content: none; display: none; }
.shell-side .maintab .sidebar-icon { display: block; width: 16px; height: 16px; flex: 0 0 16px; color: currentColor; opacity: 0.85; }
.shell-side .maintab { min-height: 36px; }
.shell-side .maintab > span:not(.nav-badge) { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shell-side .maintab:hover { background: var(--surface-3); color: var(--txt); padding-left: 10px; }
.shell-side .maintab.active, .shell-side .maintab[aria-current="page"] { background: var(--txt); color: var(--surface); font-weight: 500; box-shadow: none; }
.shell-side .maintab.active .sidebar-icon, .shell-side .maintab[aria-current="page"] .sidebar-icon { opacity: 1; }
.shell-side .maintab:focus-visible, .shell-side .nav-group-toggle:focus-visible, .shell-side .workspace-btn:focus-visible,
.shell-side .nav-link:focus-visible, .shell-side .user-card:focus-visible, .shell-side .sync-btn:focus-visible, .nav-collapse-btn:focus-visible { outline: 2px solid var(--txt); outline-offset: 2px; }
.shell-side .nav-badge {
  margin-left: auto; flex: 0 0 auto; min-width: 18px; padding: 2px 7px; border-radius: 99px; text-align: center;
  background: var(--txt); color: var(--surface); font-size: 11px; font-weight: 600; line-height: 1.3;
}
.shell-side .maintab.active .nav-badge, .shell-side .maintab[aria-current="page"] .nav-badge { background: var(--surface); color: var(--txt); }

/* Chân thanh bên */
.shell-side .nav-foot { flex: 0 0 auto; margin-top: auto; padding: 10px 12px 12px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.shell-side .sync-block { display: flex; align-items: center; gap: 8px; padding: 0 0 6px; flex-direction: row; }
.shell-side .sync-state { display: inline-flex; align-items: center; gap: 8px; flex: 1 1 auto; min-width: 0; font-size: 12px; color: var(--subtle); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shell-side .sync-state .dot { width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%; background: var(--txt); box-shadow: none; animation: none; }
.shell-side .sync-state.bad { color: var(--neg); }
.shell-side .sync-state.bad .dot { background: var(--neg); }
.shell-side .sync-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; width: auto; height: 32px; padding: 0 10px; flex: 0 0 auto;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--txt); box-shadow: none; font: inherit; font-size: 13px; font-weight: 500; cursor: pointer;
}
.shell-side .sync-btn:hover { background: var(--surface-3); box-shadow: none; transform: none; }
.shell-side .nav-link {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 38px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent;
  color: var(--muted); text-decoration: none; font: inherit; font-size: 14px; font-weight: 400; text-align: left; cursor: pointer;
}
.shell-side .nav-link:hover { background: var(--surface-3); color: var(--txt); }
.shell-side .user-card {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; margin: 0; padding: 0 8px;
  border: 0; border-radius: 10px; background: transparent; color: var(--txt); font: inherit; font-size: 14px; font-weight: 500; text-align: left; cursor: pointer;
}
.shell-side .user-card:hover { background: var(--surface-3); }
.shell-side .avatar {
  width: 30px; height: 30px; flex: 0 0 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--txt); color: var(--surface); font-weight: 600; font-size: 12px;
}
.shell-side .user-card-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shell-side .user-card .nav-chevron { opacity: 1; transform: rotate(-90deg); color: var(--subtle); }

/* 5. Thu gọn (desktop): chỉ còn icon, rê chuột hiện tên (title) ──────────────── */
@media (min-width: 1025px) {
  .shell-side { flex: 0 0 var(--side-w); width: var(--side-w); height: 100vh; position: sticky; top: 0; z-index: 99; transition: width .18s ease, flex-basis .18s ease; }
  body.nav-collapsed .shell-side { flex-basis: var(--side-w-collapsed); width: var(--side-w-collapsed); }
  body.nav-collapsed .shell-side .side-brand { flex-direction: column; justify-content: center; padding: 10px 0 4px; flex-basis: auto; gap: 6px; }
  body.nav-collapsed .shell-side .side-brand .brand-home { display: none; }
  body.nav-collapsed .shell-side .nav-collapse-btn svg { transform: rotate(180deg); }
  body.nav-collapsed .shell-side .ws-wrap { padding: 4px 10px 8px; }
  body.nav-collapsed .shell-side .workspace-btn { justify-content: center; padding: 0; border-color: transparent; min-height: 44px; }
  body.nav-collapsed .shell-side .ws-name, body.nav-collapsed .shell-side .ws-updown { display: none; }
  body.nav-collapsed .shell-side .ws-pop { left: 8px; right: auto; width: 240px; }
  body.nav-collapsed .shell-side .maintabs { padding: 4px 10px 12px; gap: 2px; }
  /* Nhóm thành vạch ngăn; mọi mục con luôn hiện (dạng icon) dù nhóm đang gập */
  body.nav-collapsed .shell-side .nav-group-toggle { min-height: 0; height: 1px; padding: 0; margin: 8px 6px; background: var(--line); pointer-events: none; }
  body.nav-collapsed .shell-side .nav-group:first-child > .nav-group-toggle { margin-top: 2px; background: transparent; }
  body.nav-collapsed .shell-side .nav-group-toggle > * { display: none; }
  body.nav-collapsed .shell-side .nav-group-body, body.nav-collapsed .shell-side .nav-group-body.collapsed { display: flex; margin: 0; padding: 0; border-left: 0; }
  body.nav-collapsed .shell-side .maintab { justify-content: center; padding: 0; min-height: 40px; }
  body.nav-collapsed .shell-side .maintab .sidebar-icon { width: 18px; height: 18px; flex-basis: 18px; }
  body.nav-collapsed .shell-side .maintab:hover { padding: 0; }
  body.nav-collapsed .shell-side .maintab > span:not(.nav-badge) { display: none; }
  body.nav-collapsed .shell-side .maintab .nav-badge { position: absolute; top: 3px; right: 3px; min-width: 0; padding: 1px 5px; font-size: 10px; }
  body.nav-collapsed .shell-side .nav-foot { padding: 10px; align-items: center; }
  body.nav-collapsed .shell-side .sync-block { flex-direction: column; padding-bottom: 4px; }
  body.nav-collapsed .shell-side .sync-state, body.nav-collapsed .shell-side .sync-btn .lbl,
  body.nav-collapsed .shell-side .nav-link > span, body.nav-collapsed .shell-side .user-card-name, body.nav-collapsed .shell-side .user-card .nav-chevron { display: none; }
  body.nav-collapsed .shell-side .sync-btn { width: 40px; padding: 0; }
  body.nav-collapsed .shell-side .nav-link, body.nav-collapsed .shell-side .user-card { justify-content: center; padding: 0; width: 44px; }
  body.nav-collapsed .shell-side .nav-foot .nav-pop { left: 0; right: auto; width: 220px; }
}

/* 6. Mobile / tablet: thanh bên là ngăn kéo trượt từ trái ─────────────────────── */
.vx-mobile-bar { display: none; }
@media (max-width: 1024px) {
  .shell-side {
    position: fixed; top: 0; left: -300px; width: 280px; height: 100%; z-index: 10000;
    border-right: 1px solid var(--line); border-radius: 0; box-shadow: var(--shadow-xl); transition: left .25s cubic-bezier(.4, 0, .2, 1);
  }
  .shell-side.open { left: 0; }
  .shell-side .nav-collapse-btn { display: none; }
  .shell-side .side-brand { flex: 0 0 56px; }
  .vx-mobile-bar {
    display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 12px; position: sticky; top: 0; z-index: 1000;
    background: var(--surface); border-bottom: 1px solid var(--line);
  }
  .vx-mobile-bar .logo { height: 22px; width: auto; }
  .vx-menu-btn, .vx-mobile-bar .vx-menu-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--txt); cursor: pointer; }
  .vx-menu-btn svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }
  .vx-backdrop { position: fixed; inset: 0; z-index: 9999; background: rgba(0, 0, 0, 0.35); display: none; }
  .vx-backdrop.show { display: block; }
}

/* 7. Trang không phải dashboard (kho, fulfillment, chat): thanh bên + nội dung ─── */
.vx-app { display: flex; align-items: stretch; min-height: 100vh; }
.vx-main { flex: 1 1 auto; min-width: 0; }
@media (max-width: 1024px) { .vx-app { display: block; } }
/* Kho: các mục đã nằm ở thanh bên (desktop) nên ẩn thanh tab trùng; mobile vẫn giữ */
@media (min-width: 1025px) { .vx-app .tabs[data-sidebar-dup] { display: none; } }
/* Nút “Về Dashboard / Đăng xuất” cũ ở đầu trang: đã có trong thanh bên */
.vx-app .vx-legacy-nav { display: none; }
/* Hộp thư (React): khung chiếm phần còn lại, không tràn dưới thanh bên */
.vx-app.vx-chat { height: 100vh; overflow: hidden; }
.vx-app.vx-chat > .vx-main { height: 100vh; overflow: hidden; display: flex; flex-direction: column; }
.vx-app.vx-chat > .vx-main > #root { flex: 1 1 auto; min-height: 0; }
/* [CR-1114-15] Điện thoại: khung cao đúng phần nhìn thấy (dvh, và --ibx-viewport-height khi bàn phím mở), không dùng 100vh
   (100vh tính cả vùng dưới thanh địa chỉ/thanh công cụ nên ô soạn tin bị cắt đáy). Thanh logo 52px là một phần của khung. */
@media (max-width: 1024px) {
  .vx-app.vx-chat { display: flex; flex-direction: column; height: 100vh; height: var(--ibx-viewport-height, 100dvh); overflow: hidden; }
  .vx-app.vx-chat > .vx-main { flex: 1 1 auto; height: auto; min-height: 0; }
  .vx-app.vx-chat > .vx-mobile-bar { flex: none; }
}
/* Đang mở một hội thoại / hồ sơ khách (điện thoại): ẩn thanh logo — đã có nút quay lại, khung chat được thêm 52px chiều cao */
@media (max-width: 899px) {
  html[data-ibx-stage="thread"] .vx-chat .vx-mobile-bar,
  html[data-ibx-stage="panel"] .vx-chat .vx-mobile-bar { display: none; }
}

/* 8. Trang chọn workspace (dashboard) ─────────────────────────────────────────── */
.landing-hub-inner { max-width: 1080px; width: 100%; text-align: left; }
.landing-hub-inner .landing-sub { font-size: 30px; font-weight: 600; letter-spacing: -0.02em; color: var(--txt); margin: 0 0 6px; }
.landing-hub-inner .landing-desc { margin: 0 0 28px; color: var(--muted); font-size: 15px; }
.landing-blocks { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.landing-block {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 24px; min-height: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: none; transform: none;
  color: var(--txt); font: inherit; text-align: left; cursor: pointer; transition: border-color .15s;
}
.landing-block:hover { border-color: var(--txt); transform: none; box-shadow: none; }
.landing-block:focus-visible { outline: 2px solid var(--txt); outline-offset: 2px; }
.landing-block .landing-icon {
  width: 44px; height: 44px; border-radius: 12px; margin-bottom: 14px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--txt); color: var(--surface);
}
.landing-block .landing-icon svg { width: 22px; height: 22px; }
.landing-block .landing-arrow { position: absolute; top: 24px; right: 24px; width: 20px; height: 20px; color: var(--txt); opacity: 1; transform: none; }
.landing-block h2 { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: -0.01em; color: var(--txt); }
.landing-block p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.landing-block .ws-groups { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; width: 100%; }
.landing-block .ws-groups b { display: block; font-size: 12px; font-weight: 600; color: var(--txt); }
.landing-block .ws-groups span { display: block; font-size: 13px; color: var(--muted); }

/* 9. Màu trạng thái trong nội dung: tăng = chữ đen trên nền xám, giảm = đỏ trầm (chỉ màu duy nhất ngoài đen trắng) */
.up, .tag-green, .pnl-pct.pnl-pct-pos, .vat-yes,
[data-theme="dark"] .up, [data-theme="dark"] .tag-green { color: var(--txt); background: var(--surface-3); border-color: var(--line); }
.down, .tag-red,
[data-theme="dark"] .down, [data-theme="dark"] .tag-red { color: var(--neg); background: color-mix(in srgb, var(--neg) 8%, transparent); border-color: transparent; }

/* 10. Trang cũ nền tối (fulfillment, hàng lỗi, quản lý user): bỏ màu cứng, về đen trắng.
       Nhãn trạng thái phân biệt bằng nền / viền / độ đậm thay cho màu; chỉ hủy, hoàn, lỗi, hủy bỏ giữ đỏ trầm. */
button.primary, .vx-app button.primary { background: var(--txt); color: var(--surface); border: 0; }
button.primary:hover { opacity: .88; }
button.danger { background: color-mix(in srgb, var(--neg) 8%, transparent); color: var(--neg); border-color: color-mix(in srgb, var(--neg) 30%, transparent); }
button:hover, a.btn:hover { border-color: var(--line-strong); }
.tile.active { border-color: var(--txt); background: var(--surface); }
td, ul.timeline li { border-bottom-color: var(--line); }
.tag-tiktok, .tag-shopee, .tag-nhanh, .tag-admin, .qty-tag { background: var(--surface-3); color: var(--muted); }
.st-to_ship, .st-exception { background: transparent; color: var(--txt); box-shadow: inset 0 0 0 1px var(--line-strong); }
.st-awaiting_pickup, .st-in_transit { background: var(--surface-3); color: var(--txt); }
.st-delivered, .st-completed { background: transparent; color: var(--subtle); }
.st-cancelled, .st-returning { background: color-mix(in srgb, var(--neg) 8%, transparent); color: var(--neg); }
.flag.bad { color: var(--neg); border-color: color-mix(in srgb, var(--neg) 35%, transparent); }
.flag.warn { color: var(--txt); border-color: var(--line-strong); }
.status-pending { color: var(--txt); border-color: var(--line-strong); }
.status-return_supplier, .status-repair { color: var(--muted); border-color: var(--line-strong); }
.status-restock { color: var(--txt); border-color: var(--txt); }
.status-scrap { color: var(--neg); border-color: color-mix(in srgb, var(--neg) 35%, transparent); }

/* 11. Hộp thư (React) nằm trong khung chung: bỏ thanh icon và chữ thương hiệu riêng của nó (đã có ở thanh bên) */
.vx-chat .rail, .vx-chat .brand-word { display: none; }
.vx-chat .shell { height: 100%; }

/* 12. Biểu đồ & chỉ báo ─────────────────────────────────────────────────────────
   Khung giao diện đen trắng, nhưng DỮ LIỆU trong biểu đồ dùng 8 màu phân loại theo thứ tự cố định
   (đã chạy kiểm định: tách màu với người mù màu ≥ 8.4, mắt thường ≥ 19, trên nền #ffffff và #111111):
     1 xanh dương · 2 cam · 3 xanh ngọc · 4 vàng · 5 hồng · 6 lục · 7 tím · 8 đỏ
   Kênh luôn cùng một màu ở mọi biểu đồ: Facebook = 1, Shopee = 2, TikTok = 3 (bộ 3 màu này đạt cả khi xét mọi cặp).
   Biểu đồ > 3 chuỗi phải có chú thích / tooltip (3 màu nhạt dưới 3:1 trên nền trắng). Đỏ = chi phí / số âm.
   Mức độ (bản đồ, heatmap) dùng một màu xanh dương từ nhạt → đậm (--heat-1..5). */
:root {
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100;
  --series-5: #e87ba4; --series-6: #008300; --series-7: #6250d6; --series-8: #e34948;
  --chart-ink: #0a0a0a; --chart-muted: #d4d4d4;
  --chart-axis: #737373; --chart-grid: rgba(10, 10, 10, 0.07); --chart-tip-bg: #0a0a0a; --chart-tip-fg: #fafafa;
  --heat-1: #cde2fb; --heat-2: #86b6ef; --heat-3: #3987e5; --heat-4: #1c5cab; --heat-5: #0d366b;
  --warn-bg: var(--surface-2); --warn-border: var(--line-strong); --warn-text: var(--txt);
}
[data-theme="dark"] {
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
  --series-5: #d55181; --series-6: #008300; --series-7: #9085e9; --series-8: #e66767;
  --chart-ink: #fafafa; --chart-muted: #404040;
  --chart-axis: #a3a3a3; --chart-grid: rgba(255, 255, 255, 0.08); --chart-tip-bg: #fafafa; --chart-tip-fg: #0a0a0a;
  --heat-1: #184f95; --heat-2: #256abf; --heat-3: #3987e5; --heat-4: #86b6ef; --heat-5: #cde2fb;
  --warn-bg: var(--surface-2); --warn-border: var(--line-strong); --warn-text: var(--txt);
}

/* Thẻ biểu đồ: tiêu đề trên, mô tả nhỏ ngay dưới (trái), nút / bộ lọc bên phải; khung vẽ cao cố định */
.panel-title {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; row-gap: 2px; align-items: start;
  margin-bottom: 14px; font-size: 15px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.35; color: var(--txt);
}
.panel-title > .small { grid-column: 1; grid-row: 2; font-size: 12px; font-weight: 400; color: var(--subtle); letter-spacing: 0; }
.panel-title > span:first-child:not(.small) { grid-column: 1; grid-row: 1; min-width: 0; }   /* <span>tiêu đề</span> */
.panel-title > span:first-child:not(.small) > .small { display: block; margin-top: 2px; font-size: 12px; font-weight: 400; color: var(--subtle); letter-spacing: 0; }
.panel-title > :not(.small):not(span:first-child) { grid-column: 2; grid-row: 1 / span 2; align-self: center; justify-self: end; margin-left: 0; }   /* nút, bộ lọc, ô chọn tháng */
.chart-box { position: relative; height: 280px; margin-top: 4px; }
.chart-box.tall { height: 340px; }
.chart-box + .chart-box, .chart-box + table, .chart-box + .ux-table-wrap { margin-top: 16px; }
@media (max-width: 640px) {
  .panel-title { font-size: 14px; margin-bottom: 10px; }
  .chart-box { height: 220px; }
  .chart-box.tall { height: 240px; }
}

/* Chỉ báo: một bộ màu đơn giản cho mọi nhãn / huy hiệu / thanh tiến độ
   tốt = chữ đen nền xám · cần chú ý = viền đậm · xấu = đỏ trầm · trung tính = xám */
.ux-badge.ux-ok, .mkt-tag-organic, .mkt-tag-ads, .pnl-pct.pnl-pct-accent, .tag-amber {
  color: var(--txt); background: var(--surface-3); border-color: var(--line);
}
.ux-badge.ux-warn, .tag-amber { color: var(--txt); background: transparent; border-color: var(--line-strong); }
.ux-badge.ux-bad, .pnl-pct.pnl-pct-neg { color: var(--neg); background: color-mix(in srgb, var(--neg) 8%, transparent); border-color: color-mix(in srgb, var(--neg) 30%, transparent); }
.ux-banner.ux-warn { color: var(--txt); background: var(--surface-2); border-color: var(--line-strong); }
.ux-banner.ux-bad { color: var(--txt); border-color: color-mix(in srgb, var(--neg) 45%, transparent); background: color-mix(in srgb, var(--neg) 6%, transparent); }
.ux-bar span { background: var(--txt); }
.ux-bar.ux-warn span { background: var(--k-500); }
.ux-bar.ux-bad span { background: var(--neg); }
.ux-scale i { background: linear-gradient(90deg, var(--heat-1), var(--heat-5)); }
.kpi-spark polygon.area { opacity: 0.12; }
.mcell .bg { background: var(--series-1); }   /* ô heatmap địa phương × sản phẩm: cùng màu xanh với bản đồ */
.cm-stars { color: var(--txt); }
.auto-row td, [data-theme="dark"] .auto-row td { background: var(--surface-2); }
#toast.warn { border-color: var(--line-strong); }
.funnel-loss-card.cancel, .funnel-loss-card.returned,
[data-theme="dark"] .funnel-loss-card.cancel, [data-theme="dark"] .funnel-loss-card.returned { background: var(--surface-2); border-color: var(--line); }
.funnel-loss-card.cancel .fl-label { color: var(--neg); }
.funnel-loss-card.returned .fl-label { color: var(--txt); }
#err { background: color-mix(in srgb, var(--neg) 6%, transparent); border-color: color-mix(in srgb, var(--neg) 25%, transparent); }
.tag-inbox { background: var(--surface-3); color: var(--txt); }
/* Thanh tỷ trọng (Doanh thu đi về đâu, cơ cấu chi phí Ads): khe 2px màu nền giữa các đoạn để hai màu liền nhau vẫn tách rõ */
.ux-stack span + span, .mkt-share-bar span + span { box-shadow: inset 2px 0 0 var(--surface); }

/* 13. Biểu đồ nhiều khung (thay biểu đồ 2–3 trục y): mỗi đơn vị đo một khung, xếp dọc, chung trục thời gian */
.vx-split { display: flex; flex-direction: column; gap: 14px; margin-top: 4px; }
.vx-split-panel + .vx-split-panel { padding-top: 12px; border-top: 1px dashed var(--line); }
.vx-split-title { font-size: 12px; font-weight: 500; color: var(--muted); margin: 0 0 4px; }
.vx-split-plot { position: relative; }
@media (max-width: 640px) { .vx-split-plot { max-height: 180px; } }

/* 14. Bảng — một kiểu cho mọi trang ─────────────────────────────────────────────
   Tiêu đề cột: 12px chữ xám trên dải nền xám nhạt bo góc · ô: 13px, đệm 11×12, kẻ dưới 1px
   số: căn phải, chữ số đều cột (.num) · hàng: nền xám khi rê chuột · hàng tổng: đậm + vạch trên
   Selector thấp (table/th/td) để luật riêng có class/id (dòng tiền, tồn kho dạng thẻ, chi tiết đơn…) vẫn thắng. */
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; font-variant-numeric: tabular-nums; color: var(--txt); }
thead th {
  height: 38px; padding: 8px 12px; text-align: left; vertical-align: middle; white-space: nowrap;
  font-size: 12px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--muted);
  background: var(--surface-2); border-bottom: 1px solid var(--line); position: static;
}
thead th:first-child { border-top-left-radius: 8px; border-bottom-left-radius: 8px; }
thead th:last-child { border-top-right-radius: 8px; border-bottom-right-radius: 8px; }
td { padding: 11px 12px; border-bottom: 1px solid var(--line); background: transparent; }   /* căn dọc: để mỗi trang tự quyết (fulfillment căn trên) */
tbody tr:last-child > td { border-bottom: 0; }
tbody tr:hover > td, tr:hover td { background: var(--surface-2); }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
th.sortable:hover { color: var(--txt); }
th.sortable .sort-arrow { color: var(--txt); }
/* Hàng tổng / dòng nhóm */
tfoot td, tr.total-row > td, tr.total > td { font-weight: 600; background: var(--surface-2); border-top: 1px solid var(--line-strong); border-bottom: 0; }
.group > td { background: var(--surface-3); font-weight: 600; }
/* Bảng đứng riêng (kho, fulfillment): khung viền, không bóng; dải tiêu đề chạm mép khung nên không bo góc */
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); overflow: auto; box-shadow: none; }
.table-wrap thead th { border-radius: 0; }
.table-wrap td:first-child, .table-wrap th:first-child { padding-left: 16px; }
.table-wrap td:last-child, .table-wrap th:last-child { padding-right: 16px; }
.ux-table-wrap { overflow-x: auto; max-width: 100%; margin-top: 12px; }
/* Bảng cuộn trong khung có chiều cao: tiêu đề dính trên */
.mkt-scroll thead th, .table-wrap.sticky thead th { position: sticky; top: 0; z-index: 1; }
/* Nhãn trạng thái trong bảng: một kiểu chung */
.tag, .badge {   /* chỉ hình dáng; màu để các biến thể (.tag-red, .st-*, .status-*…) tự đặt */
  display: inline-flex; align-items: center; gap: 4px; min-height: 22px; padding: 0 8px; border-radius: 6px;
  font-size: 12px; font-weight: 500; line-height: 1.2; white-space: nowrap;
}
:where(.tag, .badge) { background: var(--surface-3); color: var(--txt); border: 1px solid transparent; }   /* màu mặc định, độ ưu tiên 0 */
/* Bảng ma trận (heatmap địa phương × sản phẩm): cột đầu dính trái, cùng nền với dải tiêu đề */
.matrix-pp thead th { background: var(--surface-2); }
.matrix-pp td.row-head, .matrix-pp th.row-head { background: var(--surface); }
.matrix-pp thead th.row-head { background: var(--surface-2); }
@media (max-width: 640px) {
  thead th { padding: 8px 8px; }
  td { padding: 9px 8px; }
  .table-wrap td:first-child, .table-wrap th:first-child { padding-left: 12px; }
  .table-wrap td:last-child, .table-wrap th:last-child { padding-right: 12px; }
}

/* 15. Thành phần tương tác dùng chung (vx.js): hộp xác nhận, thông báo, trạng thái khối, ngăn kéo, thẻ KPI ─── */
.vx-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 16px;
  border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); color: var(--txt);
  font: inherit; font-size: 14px; font-weight: 500; cursor: pointer;
}
.vx-btn:hover { background: var(--surface-3); }
.vx-btn.primary { background: var(--txt); color: var(--surface); border-color: var(--txt); }
.vx-btn.primary:hover { opacity: .88; background: var(--txt); }
.vx-btn.danger { background: var(--neg); color: #ffffff; border-color: var(--neg); }
.vx-btn.danger:hover { opacity: .9; background: var(--neg); }
.vx-btn:focus-visible, .vx-icon-btn:focus-visible { outline: 2px solid var(--txt); outline-offset: 2px; }
.vx-icon-btn { width: 36px; height: 36px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 22px; line-height: 1; cursor: pointer; }
.vx-icon-btn:hover { background: var(--surface-3); color: var(--txt); }

/* Hộp xác nhận (<dialog>): nêu đúng việc sắp làm; nút xoá màu đỏ, mặc định chọn Huỷ */
dialog.vx-dialog { position: fixed; inset: 0; margin: auto; height: fit-content; box-sizing: border-box; width: min(440px, calc(100vw - 32px)); padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--txt); box-shadow: var(--shadow-xl); font-family: var(--font); }
dialog.vx-dialog::backdrop { background: rgba(10, 10, 10, 0.4); }
.vx-dialog-title { margin: 0 0 8px; font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.vx-dialog-msg { margin: 0; font-size: 14px; line-height: 1.55; color: var(--muted); white-space: pre-line; }
.vx-dialog-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 18px; }

/* Thông báo góc dưới */
.vx-toasts { position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 12000; display: flex; flex-direction: column; align-items: center; gap: 8px; width: min(440px, calc(100vw - 32px)); pointer-events: none; }
.vx-toast { pointer-events: auto; width: 100%; box-sizing: border-box; padding: 11px 14px; border-radius: 10px; background: var(--txt); color: var(--surface); font-size: 14px; line-height: 1.4; box-shadow: var(--shadow-lg); transition: opacity .25s, transform .25s; }
.vx-toast.err { background: var(--neg); color: #ffffff; }
.vx-toast.out { opacity: 0; transform: translateY(6px); }

/* Trạng thái khối */
.vx-state { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.vx-state-title { font-size: 14px; font-weight: 600; }
.vx-state-text { font-size: 13px; color: var(--muted); }
.vx-state.error { border-color: color-mix(in srgb, var(--neg) 40%, transparent); background: color-mix(in srgb, var(--neg) 5%, var(--surface)); }
.vx-state .vx-btn { min-height: 34px; margin-top: 4px; font-size: 13px; }
.vx-skel { height: 10px; border-radius: 5px; background: var(--surface-3); animation: vx-pulse 1.4s ease-in-out infinite; }
@keyframes vx-pulse { 50% { opacity: .5; } }
@media (prefers-reduced-motion: reduce) { .vx-skel { animation: none; } }

/* Ngăn kéo form */
.vx-drawer-wrap { position: fixed; inset: 0; z-index: 11000; display: flex; justify-content: flex-end; }
.vx-drawer-scrim { position: absolute; inset: 0; background: rgba(10, 10, 10, 0.35); }
.vx-drawer { position: relative; width: min(480px, 100vw); height: 100%; display: flex; flex-direction: column; background: var(--surface); color: var(--txt); border-left: 1px solid var(--line); box-shadow: var(--shadow-xl); font-family: var(--font); }
.vx-drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 16px 14px 20px; border-bottom: 1px solid var(--line); }
.vx-drawer-title { margin: 0; font-size: 17px; font-weight: 600; }
.vx-drawer-body { flex: 1 1 auto; overflow-y: auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 14px; }
.vx-drawer-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px max(12px, env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); }
.vx-field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.vx-field input, .vx-field select, .vx-field textarea { font: inherit; font-size: 14px; color: var(--txt); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px; padding: 9px 12px; min-height: 40px; box-sizing: border-box; }
.vx-field input:focus-visible, .vx-field select:focus-visible, .vx-field textarea:focus-visible { outline: 2px solid var(--txt); outline-offset: 1px; }

/* Thẻ KPI dùng chung: nhãn → số → chênh lệch → dòng phụ (+ thanh tiến độ tuỳ chọn) */
.vx-kpi { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); color: inherit; text-decoration: none; min-width: 0; }
a.vx-kpi:hover, button.vx-kpi:hover { border-color: var(--line-strong); }
.vx-kpi-label { font-size: 13px; color: var(--muted); }
.vx-kpi-value { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.vx-kpi-delta { font-size: 12.5px; color: var(--muted); }
.vx-kpi-delta b { color: var(--txt); font-weight: 600; }
.vx-kpi-delta b.bad { color: var(--neg); }
.vx-kpi-sub { font-size: 12px; color: var(--subtle); }
.vx-meter { position: relative; height: 6px; margin-top: 6px; border-radius: 99px; background: var(--surface-3); }
.vx-meter > span { position: absolute; inset: 0 auto 0 0; border-radius: 99px; background: var(--txt); }
.vx-meter > i { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--neg); }

/* Bộ chọn kỳ Marketing: cùng khung với ERP; khoảng ngày tuỳ chọn nằm cuối menu */
#mktPeriodMenu.period-pop { width: min(300px, calc(100vw - 32px)); padding: 6px; left: auto; right: 0; }   /* nút nằm sát mép phải: mở về bên trái */
#mktPeriodMenu .prod-opt { display: flex; align-items: center; min-height: 38px; padding: 0 10px; border-radius: 8px; cursor: pointer; }
#mktPeriodMenu .prod-opt:hover { background: var(--surface-3); }
.pp-custom { margin-top: 6px; padding: 10px 10px 6px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.pp-custom-title { font-size: 12px; font-weight: 500; color: var(--muted); }
.pp-custom .range-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.pp-custom .date-in { flex: 1 1 120px; min-width: 0; }
.pp-quick { flex-wrap: wrap; }
.pp-quick .pp-chip { flex: 1 1 calc(50% - 8px); }

/* 16. Hôm nay, tìm kiếm Ctrl+K, đầu thanh bên (UX v2 đợt 2) ───────────────────── */
.shell-side .side-top { display: flex; flex-direction: column; gap: 2px; padding: 4px 12px 2px; }
.shell-side .nav-kbd { flex: 0 0 auto; margin-left: auto; padding: 1px 6px; border: 1px solid var(--line-strong); border-radius: 5px; font: inherit; font-size: 11px; color: var(--subtle); }
body.nav-collapsed .shell-side .side-top { padding: 4px 10px 2px; }
body.nav-collapsed .shell-side .nav-kbd { display: none; }
.shell-side .nav-badge[hidden] { display: none; }

dialog.vx-search { position: fixed; inset: 0; margin: 12vh auto auto; box-sizing: border-box; width: min(620px, calc(100vw - 24px)); max-height: 72vh; padding: 0; display: none; flex-direction: column; overflow: hidden;
  border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--txt); box-shadow: var(--shadow-xl); font-family: var(--font); }
dialog.vx-search[open] { display: flex; }
dialog.vx-search::backdrop { background: rgba(10, 10, 10, 0.4); }
.vx-search-input { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.vx-search-input svg { width: 18px; height: 18px; flex: 0 0 18px; stroke: var(--subtle); fill: none; stroke-width: 2; stroke-linecap: round; }
.vx-search-input input { flex: 1 1 auto; min-width: 0; height: 52px; border: 0; outline: 0; background: transparent; color: var(--txt); font: inherit; font-size: 16px; }
.vx-search-input kbd { padding: 1px 6px; border: 1px solid var(--line-strong); border-radius: 5px; font: inherit; font-size: 11px; color: var(--subtle); }
.vx-search-body { overflow-y: auto; padding: 6px 8px 10px; }
.vx-search-group { padding: 10px 10px 4px; font-size: 12px; font-weight: 500; color: var(--subtle); }
.vx-search-item { display: flex; flex-direction: column; gap: 1px; padding: 8px 10px; border-radius: 8px; color: var(--txt); text-decoration: none; cursor: pointer; }
.vx-search-item b { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vx-search-item span { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vx-search-item[aria-selected="true"], .vx-search-item:hover { background: var(--surface-3); }
.vx-search-empty { padding: 22px 12px; text-align: center; font-size: 13.5px; color: var(--muted); }
.vx-search-foot { display: flex; gap: 14px; padding: 8px 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--subtle); }

/* Trang Hôm nay */
.vx-today { max-width: 1180px; margin: 0 auto; padding: 28px 24px 56px; display: flex; flex-direction: column; gap: 22px; }
.vx-today-head h1 { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.vx-today-head p { margin: 4px 0 0; font-size: 14px; color: var(--muted); }
.vx-today-section { display: flex; flex-direction: column; gap: 10px; }
.vx-today-section > h2 { margin: 0; font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.vx-today-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.vx-todo { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); overflow: hidden; }
.vx-todo-row { display: flex; align-items: center; gap: 14px; padding: 13px 16px; border-top: 1px solid var(--line); color: inherit; text-decoration: none; }
.vx-todo-row:first-child { border-top: 0; }
a.vx-todo-row:hover { background: var(--surface-2); }
.vx-todo-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.vx-todo-main b { font-size: 14px; font-weight: 500; }
.vx-todo-main span { font-size: 12.5px; color: var(--muted); }
.vx-todo-count { min-width: 28px; text-align: right; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.vx-todo-go { width: 16px; height: 16px; flex: 0 0 16px; stroke: var(--subtle); fill: none; stroke-width: 2; }
/* Bốn mức nhãn: luôn có chữ. Khẩn = nền đen; cần chú ý = viền đậm; theo dõi = viền mảnh */
.vx-tag { display: inline-flex; align-items: center; flex: 0 0 auto; min-width: 74px; justify-content: center; padding: 2px 8px; border-radius: 99px; font-size: 11.5px; font-weight: 500; border: 1px solid var(--line-strong); color: var(--muted); }
.vx-tag.urgent { background: var(--txt); border-color: var(--txt); color: var(--surface); }
.vx-tag.attention { border-color: var(--txt); color: var(--txt); }
.vx-today-note { font-size: 12.5px; color: var(--muted); }
.vx-today-empty { padding: 26px 16px; text-align: center; font-size: 14px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); }
.vx-today-links { display: flex; flex-wrap: wrap; gap: 8px; }
.vx-today-links a { display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 8px; color: var(--txt); font-size: 13.5px; text-decoration: none; }
.vx-today-links a:hover { background: var(--surface-3); }
/* [CR-1117-01] Điện thoại: nhãn mức độ nằm một dòng riêng, dưới đó là nội dung | số | mũi tên thẳng hàng (trước đây flex-wrap làm số và mũi tên rơi xuống dòng, lúc trên lúc dưới). */
@media (max-width: 640px) {
  .vx-today { padding: 18px 16px 40px; }
  .vx-todo-row { display: grid; grid-template-columns: minmax(0, 1fr) auto 16px; align-items: center; gap: 6px 12px; }
  .vx-todo-row > .vx-tag { grid-column: 1 / -1; justify-self: start; }
  .vx-todo-row > .vx-todo-main { grid-column: 1; }
  .vx-todo-row > .vx-todo-count { grid-column: 2; }
  .vx-todo-row > .vx-todo-go { grid-column: 3; }
}
/* Hôm nay: cây ERP/Marketing + CRM cùng cuộn trong thanh bên */
.shell-side[data-today] { overflow-y: auto; }
.shell-side[data-today] .maintabs { flex: 0 0 auto; overflow: visible; }
.shell-side[data-today] .nav-foot { margin-top: auto; }

/* 17. Hôm nay: ba mục lớn ERP / Marketing / CRM + hàng chọn nhanh workspace ─────────────── */
.shell-side .ws-tree { gap: 2px; }
.shell-side .ws-section + .ws-section { margin-top: 2px; }
.shell-side .ws-toggle {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 42px; padding: 0 10px; border: 0; border-radius: 8px;
  background: transparent; color: var(--txt); font: inherit; font-size: 14.5px; font-weight: 600; text-align: left; cursor: pointer;
}
.shell-side .ws-toggle:hover { background: var(--surface-3); }
.shell-side .ws-toggle:focus-visible { outline: 2px solid var(--txt); outline-offset: 2px; }
.shell-side .ws-toggle .ws-ico { display: block; width: 18px; height: 18px; flex: 0 0 18px; }
.shell-side .ws-toggle > span { flex: 1 1 auto; min-width: 0; }
.shell-side .ws-toggle .nav-chevron { opacity: 1; }
.shell-side .ws-toggle[aria-expanded="true"] .nav-chevron { transform: rotate(90deg); }
.shell-side .ws-body { padding: 2px 0 8px 6px; }
.shell-side .ws-body[hidden] { display: none; }
.shell-side .ws-body .nav-group-toggle { font-weight: 500; }
.shell-side .ws-quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 10px; }
.shell-side .ws-quick-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px; border: 1px solid var(--line); border-radius: 8px;
  color: var(--txt); font-size: 11.5px; font-weight: 500; text-decoration: none;
}
.shell-side .ws-quick-btn:hover { background: var(--surface-3); border-color: var(--line-strong); }
.shell-side .ws-quick-btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.shell-side .ws-ico { stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
body.nav-collapsed .shell-side .ws-body { display: none; }
body.nav-collapsed .shell-side .ws-toggle { justify-content: center; padding: 0; min-height: 40px; }
body.nav-collapsed .shell-side .ws-toggle > span, body.nav-collapsed .shell-side .ws-toggle .nav-chevron { display: none; }
body.nav-collapsed .shell-side .ws-quick { grid-template-columns: 1fr; }
body.nav-collapsed .shell-side .ws-quick-btn { padding: 8px 0; }
body.nav-collapsed .shell-side .ws-quick-btn span { display: none; }
