/* ZAFAGO CRM — giao diện theo nhận diện thương hiệu Zafago (NEW-70): phẳng, màu đặc, nền sáng mặc định, theme tối trên nền đen thương hiệu.
   Thương hiệu: xanh #2000b1 (chính) · cam #ed6800 (nhấn, dùng ÍT: số đếm, nhãn "Mới", một con số chính) ·
   đen #03000e (chữ) · trắng #ebeaed (nền trang). KHÔNG gradient trang trí, KHÔNG kính mờ (làm mờ nền), KHÔNG bóng phát sáng.
   Mọi màn hình dùng các biến này; không tự đặt màu cứng ngoài khối biến. Đổi theme: <html data-theme="dark|light">. */
:root {
  --brand: #2000b1;
  --brand-dark: #17007f;          /* hover / nhấn / chữ link */
  --brand-soft: #ecebf8;          /* nền mục menu đang mở, dòng chọn */
  --on-brand: #ffffff;            /* chữ trên nền --brand */
  --topbar: #2000b1;
  --on-topbar: #ffffff;
  --on-topbar-muted: rgb(255 255 255 / .82);
  --on-topbar-line: rgb(255 255 255 / .38);
  --on-topbar-hover: rgb(255 255 255 / .12);
  --on-topbar-soft: #e5e1ff;      /* chữ mục menu dọc (NEW-73; mục đang mở trắng) */
  /* NEW-73 v3: menu dọc NỀN SÁNG phẳng — cùng giá trị với crm-prt (hai hệ thống giống nhau) */
  --sb-bg: #ffffff;
  --sb-border: #e4e3ea;
  --sb-ink: rgb(3 0 14 / .8);          /* chữ mục: #03000e 80% */
  --sb-icon: #5d5a6b;
  --sb-muted: #6b6879;                 /* tên app, tiêu đề phụ, gợi ý */
  --sb-hover: #efeff3;
  --sb-active: #2000b1;                /* khối mục đang mở */
  --sb-active-ink: #ffffff;
  --sb-group-on: #2000b1;              /* chữ nhóm chứa mục đang mở */
  --sb-line: #d9d8e0;                  /* đường cây mục con */
  --sb-field: #f5f5f8;                 /* ô tìm */
  --sb-dot: #e5372b;                   /* chấm cần xử lý */
  --sb-strong: #03000e;                /* chữ đậm: khi rê, tên người */
  --shell-top: 0px;              /* NEW-73: chiều cao thanh trên cùng (chỉ màn < 900 px có thanh mỏng 48 px) */
  --accent: #ed6800;              /* cam — KHÔNG dùng cho cảnh báo / lỗi */
  --accent-soft: #fdf0e6;
  --accent-text: #b34f00;         /* cam đủ tương phản AA trên nền trắng */
  --ink: #03000e;
  --muted: #5d5a6b;
  --line: #d8d6de;
  --line-2: #ecebf0;              /* NEW-71: kẻ dòng bảng / danh sách (nhạt hơn --line) */
  --bg: #ebeaed;
  --surface: #ffffff;
  --surface-2: #f5f4f7;
  --hover: #f3f2f6;
  --ok: #18794e;
  --ok-soft: #e6f4ec;
  --ok-text: #18794e;
  --warn: #8a6500;                /* vàng đất — không giống cam thương hiệu */
  --warn-soft: #fdf6dc;
  --err: #c0261b;
  --err-soft: #fdeceb;
  --err-strong: #9b1c13;
  --on-ok: #ffffff;
  --on-err: #ffffff;
  --toast-bg: #03000e;
  --toast-ink: #ffffff;
  --paper: #ffffff;             /* "giấy": mã QR, xem trước email — luôn nền trắng chữ đen, cả theme tối */
  --paper-ink: #03000e;
  --btn-border: #c9c6d2;
  --soon: #a9a6b5;
  --chart-1: #2000b1;             /* biểu đồ: xanh thương hiệu */
  --chart-2: #ed6800;             /* cam thương hiệu */
  --chart-3: #0086d8;             /* xanh trời của chữ Z */
  --chart-4: #5d5a6b;             /* xám trung tính */
  --chart-5: #8b7dff;             /* tím nhạt (xanh thương hiệu sáng) */
  --chart-6: #b9b6c4;             /* xám nhạt */
  --shadow: 0 1px 2px rgb(3 0 14 / .06);
  --shadow-pop: 0 4px 16px rgb(3 0 14 / .14);   /* chỉ cho lớp nổi (hộp thoại, menu thả) — không phát sáng */
  --overlay: rgb(3 0 14 / .45);
  --radius: 6px;                  /* NEW-71: góc vuông hơn kiểu Odoo (bản mẫu C: 4–6 px) */
  --radius-btn: 4px;
  --font: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --sb-bg: #12111a;                    /* NEW-73 v3: menu dọc theme tối */
  --sb-border: #2a2836;
  --sb-ink: #ebeaed;
  --sb-icon: #a29fb3;
  --sb-muted: #a29fb3;
  --sb-hover: #1f1d2b;
  --sb-active: #2000b1;
  --sb-active-ink: #ffffff;
  --sb-group-on: #8b7dff;              /* xanh #2000b1 không đọc được trên nền tối ⇒ --brand của theme tối */
  --sb-line: #34313f;
  --sb-field: #1a1925;
  --sb-dot: #ff6b5f;
  --sb-strong: #ffffff;
  --brand: #8b7dff;               /* xanh thương hiệu làm sáng ⇒ chữ / link đạt AA trên nền đen */
  --brand-dark: #b3aaff;
  --brand-soft: rgb(139 125 255 / .16);
  --on-brand: #03000e;
  --topbar: #2000b1;
  --accent: #ff8a2a;
  --accent-soft: rgb(237 104 0 / .18);
  --accent-text: #ffa45c;
  --ink: #ebeaed;
  --muted: #a29fb3;
  --line: #2a2645;
  --line-2: #1f1b38;
  --bg: #03000e;
  --surface: #100d22;
  --surface-2: #17142e;
  --hover: #1d1938;
  --ok: #4cc38a;
  --ok-soft: rgb(76 195 138 / .14);
  --ok-text: #6fd6a3;
  --warn: #e3b341;
  --warn-soft: rgb(227 179 65 / .14);
  --err: #ff7b72;
  --err-soft: rgb(255 123 114 / .14);
  --err-strong: #ff9d96;
  --on-ok: #03000e;
  --on-err: #03000e;
  --toast-bg: #ebeaed;
  --toast-ink: #03000e;
  --btn-border: #35304f;
  --soon: #5d5a73;
  --chart-1: #8b7dff;
  --chart-2: #ff8a2a;
  --chart-3: #3aa6e8;
  --chart-4: #a29fb3;
  --chart-5: #c9c1ff;
  --chart-6: #4a4660;
  --shadow: none;
  --shadow-pop: 0 4px 16px rgb(0 0 0 / .5);
  --overlay: rgb(3 0 14 / .7);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.5 var(--font); color: var(--ink); background: var(--bg); min-height: 100vh; -webkit-font-smoothing: antialiased; }
a { color: var(--brand-dark); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---- Đăng nhập (crmnew, legalhub, vendor, hhgt): trái = mảng xanh thương hiệu + logo trắng, phải = form trắng; màn hẹp: dải trên ---- */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); background: var(--surface); }
.login-brand { background: var(--topbar); color: var(--on-topbar); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 48px 32px; text-align: center; }
.login-brand .login-mark { width: 112px; height: 112px; display: block; }
.login-brand .login-word { width: 220px; max-width: 70%; height: auto; display: block; }
.login-brand p { margin: 6px 0 0; font-size: 16px; font-weight: 500; color: var(--on-topbar); }
.login-side { display: flex; align-items: center; justify-content: center; padding: 32px 24px; background: var(--surface); }
.login-card { width: 100%; max-width: 380px; }
.login-card .login-title { font-size: 26px; font-weight: 700; margin: 0; letter-spacing: -.01em; }
.login-card .login-app { margin: 4px 0 22px; }
.login-card .btn.primary { height: 40px; }
/* NEW-68: nút Đăng nhập bằng Lark (nổi bật) + link mở ô mật khẩu */
.login-card .lark-btn { display: flex; align-items: center; justify-content: center; width: 100%; text-decoration: none; font-weight: 600; }
.login-card .lark-hint { font-size: 12px; margin: 8px 0 14px; }
.login-card .lark-toggle { background: none; border: 0; padding: 0; color: var(--brand-dark); cursor: pointer; font: inherit; text-decoration: underline; margin-bottom: 12px; }
.login-card #loginForm[hidden], .login-card .lark-box[hidden] { display: none; }
/* NEW-79: nút Đăng nhập bằng Google — kiểu "light" theo hướng dẫn thương hiệu Google (nền trắng, viền xám, dấu G 4 màu gốc), phẳng;
   khi bật là nút CHÍNH (trên cùng, cao 44 px), nút Lark (nếu còn) thành nút phụ bên dưới */
.login-card .google-btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; height: 44px; text-decoration: none;
  font-weight: 600; background: #ffffff; color: #1f1f1f; border: 1px solid #747775; }
.login-card .google-btn:hover { background: #f2f2f2; border-color: #1f1f1f; }
.login-card .google-btn svg { flex: none; }
:root[data-theme="dark"] .login-card .google-btn { background: #131314; color: #e3e3e3; border-color: #8e918f; }
:root[data-theme="dark"] .login-card .google-btn:hover { background: #1f1f22; border-color: #e3e3e3; }
.login-card .google-btn:not([hidden]) + .lark-btn { margin-top: 8px; height: 40px; }
.login-card .lark-btn[hidden], .login-card .google-btn[hidden] { display: none; }
/* NEW-93: passkey (admin) — nút phụ dưới form mật khẩu; bước 2FA "Dùng passkey thay mã" */
.login-card .passkey-box { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.login-card .passkey-box[hidden], .login-card .mfa-passkey[hidden] { display: none; }
.login-card .passkey-btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 40px; font-weight: 600; }
.login-card .passkey-btn svg { flex: none; }
.login-card .passkey-hint { font-size: 12px; margin: 8px 0 0; }
.login-card .mfa-passkey { margin: 0 0 12px; }
.passkey-list .muted { font-size: 12px; }
@media (max-width: 760px) {
  .login-wrap { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .login-brand { flex-direction: row; flex-wrap: wrap; gap: 10px 12px; padding: 16px; }
  .login-brand .login-mark { width: 40px; height: 40px; }
  .login-brand .login-word { width: 120px; }
  .login-brand p { flex-basis: 100%; margin: 0; font-size: 13px; }
  .login-side { align-items: flex-start; padding: 28px 16px; }
}
/* ---- Khung ứng dụng (NEW-73: MENU DỌC thay thanh ứng dụng NEW-71; v3 28/10: NỀN SÁNG phẳng, bản sắc riêng — cùng token với crm-prt) ----
   Desktop: .shell = hàng [.sidebar 256 px nền trắng, viền phải | .main cuộn riêng]. Hàng cấp 1 44 px; nhóm = hàng có mũi tên, mục con 36 px dạng cây;
   mục đang mở = khối xanh #2000b1 chữ trắng; nhóm chứa nó chữ xanh đậm. Thu gọn (.rail, ≥ 900 px) = dải biểu tượng 64 px + chú thích .sb-tip.
   < 900 px: thanh mỏng .mbar + menu trượt trên nền tối .sb-backdrop. Không gradient, không trang trí. */
.shell { display: flex; min-height: 100vh; }
.shell-body { flex: 1 1 auto; min-width: 0; min-height: 0; display: flex; flex-direction: column; }   /* băng Chỉ xem (NEW-75) + .main */
.shell-body > .ro-banner { flex: none; }
.sidebar { width: 256px; flex: none; display: flex; flex-direction: column; background: var(--sb-bg); color: var(--sb-ink); border-right: 1px solid var(--sb-border);
  position: relative; z-index: 30; }
.sidebar a { text-decoration: none; color: inherit; }
.sidebar :focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.sidebar .ic, .mbar .ic { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.sb-head, .sb-search, .sb-nav, .sb-foot { position: relative; }
.sb-head { z-index: 3; } .sb-foot { z-index: 2; } .sb-search, .sb-nav { z-index: 1; }
.sb-head, .sb-search, .sb-foot { flex: none; }
/* Đầu: logo màu (dấu Z + chữ ZAFAGO xanh; tối: chữ trắng) · nút thu gọn góc phải · tên app xám bên dưới (bấm = chọn ứng dụng) */
.sb-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; row-gap: 0; padding: 16px 10px 2px 16px; }
.sb-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sb-brand img:first-child { width: 32px; height: 32px; border-radius: 7px; display: block; flex: none; }
.sb-word { height: 15px; width: auto; display: block; }
.sb-word-dark { display: none; }
.sb-collapse, .sb-close { grid-column: 2; grid-row: 1; }
.sidebar .sb-i { width: 32px; height: 32px; display: grid; place-items: center; position: relative; border: 0; border-radius: 8px; background: none; color: var(--sb-icon); cursor: pointer; padding: 0; font-weight: 700; font-size: 15px; }
.sidebar .sb-i:hover { background: var(--sb-hover); color: var(--sb-strong); }
.sb-close { display: none !important; }
.sb-apps-wrap, .sb-appbtn { grid-column: 1 / -1; grid-row: 2; justify-self: start; }
.sb-appbtn { display: inline-flex; align-items: center; gap: 4px; margin-left: 34px; padding: 2px 8px; border: 0; border-radius: 6px; background: none; color: var(--sb-muted);
  font: 500 13px/1.4 var(--font); cursor: pointer; text-align: left; }
.sb-appbtn.static { cursor: default; }
button.sb-appbtn:hover, .sb-appbtn[aria-expanded="true"] { background: var(--sb-hover); color: var(--ink); }
.sb-appchev { display: grid; } .sb-appchev .ic { width: 14px; height: 14px; }
.sb-appgrid { display: none; }
/* Chọn ứng dụng (CRM / Legal Hub / Hoa hồng / CTV & NCC — chỉ app vai trò mở được) */
.sb-apps-pop { position: absolute; left: 12px; top: calc(100% + 2px); width: 340px; padding: 10px; z-index: 50; background: var(--surface); color: var(--ink); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-pop); }
.sb-apps-pop[hidden] { display: none; }
.sb-pop-h { font-size: 12px; font-weight: 700; color: var(--muted); padding: 2px 4px 8px; text-transform: uppercase; letter-spacing: .04em; }
.sb-app-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.sidebar .sb-app-tile { display: grid; grid-template-columns: 40px 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center; padding: 10px; border-radius: var(--radius); color: var(--ink); border: 1px solid transparent; }
.sidebar .sb-app-tile:hover { background: var(--hover); }
.sb-app-tile.on { border-color: var(--brand); background: var(--brand-soft); }
.sb-app-ic { grid-row: span 2; width: 40px; height: 40px; border-radius: var(--radius); display: grid; place-items: center; background: var(--brand); color: var(--on-brand); }
.sidebar .sb-app-ic .ic { width: 22px; height: 22px; }
.sb-app-t { font-weight: 700; font-size: 14px; line-height: 18px; }
.sb-app-h { font-size: 12px; color: var(--muted); line-height: 16px; }
/* Ô tìm ⌘K: ô xám nhạt viền mảnh, gợi ý phím bên phải */
.sb-search { padding: 12px 12px 4px; }
.sidebar .gsearch { width: 100%; height: 36px; margin: 0; border-radius: 8px; border: 1px solid var(--sb-border); background: var(--sb-field); color: var(--sb-muted); }
.sidebar .gsearch:hover { border-color: var(--btn-border); background: var(--sb-field); }
.sidebar .gsearch:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.sidebar .gsearch kbd { background: var(--sb-bg); border-color: var(--sb-border); color: var(--sb-muted); }
/* Thân: hàng cấp 1 (mục đơn + hàng nhóm có mũi tên) */
.sb-nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 8px 12px 16px; scrollbar-width: thin; scrollbar-color: var(--sb-border) transparent; }
.sidebar .sb-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; margin: 2px 0; padding: 0 12px; border: 0; border-radius: 8px; background: none;
  color: var(--sb-ink); font: 500 14.5px/1.3 var(--font); text-align: left; cursor: pointer; position: relative; }
.sidebar .sb-row .ic { width: 20px; height: 20px; color: var(--sb-icon); }
.sidebar .sb-row:hover, .sidebar .sb-child:hover { background: var(--sb-hover); color: var(--sb-strong); }
.sb-label { min-width: 0; }
.sb-chev { margin-left: auto; display: grid; color: var(--sb-icon); transition: transform .15s; }
.sidebar .sb-chev .ic { width: 16px; height: 16px; }
.sb-grp.open > .sb-grp-btn .sb-chev { transform: rotate(90deg); }
/* Nhóm chứa mục đang mở: chữ + biểu tượng xanh thương hiệu, đậm */
.sidebar .sb-grp.has-active > .sb-grp-btn, .sidebar .sb-grp.has-active > .sb-grp-btn .ic { color: var(--sb-group-on); }
.sidebar .sb-grp.has-active > .sb-grp-btn { font-weight: 600; }
/* Chấm đỏ "cần xử lý" (số đếm có sẵn của /my-work) — nhóm đóng hiện chấm khi có mục con cần xử lý */
.sb-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--sb-dot); flex: none; }
.sb-dot[hidden] { display: none; }
.sb-grp-btn .sb-dot { display: none; }
.sb-grp[data-attn]:not(.open) > .sb-grp-btn .sb-dot { display: inline-block; }
.sidebar .sb-i .sb-dot { position: absolute; top: 5px; right: 5px; box-shadow: 0 0 0 2px var(--sb-bg); }
/* Mục con dạng cây: đường kẻ xám mảnh + nhánh cong "└"; nhánh vào mục đang mở màu xanh */
.sb-items { display: none; padding: 0 0 4px 21px; }
.sb-grp.open > .sb-items { display: block; }
.sb-node { position: relative; padding-left: 18px; }
.sb-node::before { content: ""; position: absolute; left: 0; top: 0; width: 12px; height: 50%; border-left: 1px solid var(--sb-line); border-bottom: 1px solid var(--sb-line); }
.sb-node:not(:last-child)::after { content: ""; position: absolute; left: 0; top: 50%; bottom: 0; border-left: 1px solid var(--sb-line); }
.sb-node.on::before { border-color: var(--sb-active); }   /* nhánh vào mục đang mở = #2000b1 (cả theme tối, như crm-prt) */
.sb-node.sb-sub { font-size: 12px; color: var(--sb-muted); padding: 8px 12px 2px 30px; }
.sb-node.sb-sub::before { height: 100%; width: 0; border-bottom: 0; border-radius: 0; }
.sb-node.sb-sub::after { display: none; }
.sidebar .sb-child { display: flex; align-items: center; gap: 8px; min-height: 36px; margin: 1px 0; padding: 0 12px; border-radius: 8px; font-size: 14px; font-weight: 500; line-height: 1.3;
  color: var(--sb-ink); position: relative; }
/* Mục đang mở: khối xanh thương hiệu, chữ + biểu tượng trắng (không trang trí) */
.sidebar .sb-link.active, .sidebar .sb-link.active:hover { background: var(--sb-active); color: var(--sb-active-ink); font-weight: 600; }
.sidebar .sb-row.active .ic { color: var(--sb-active-ink); }
.sidebar .sb-link.active .sb-dot { box-shadow: 0 0 0 2px var(--sb-active-ink); }
.sidebar .sb-link.soon { opacity: .5; pointer-events: none; }
/* Chân: viền mảnh phía trên; tin nhắn / việc hẹn / ? + tài khoản (avatar, tên, "Zafago HQ") */
.sb-foot { border-top: 1px solid var(--sb-border); padding: 8px 12px 10px; }
.sb-tools { display: flex; align-items: center; gap: 4px; }
.sb-user { margin-top: 4px; }
.sb-me { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px; border: 0; border-radius: 8px; background: none; color: var(--sb-ink); cursor: pointer; text-align: left; }
.sb-me:hover, .sb-me[aria-expanded="true"] { background: var(--sb-hover); }
.sb-av { width: 32px; height: 32px; border-radius: 8px; background: var(--brand-soft); color: var(--brand-dark); font-weight: 700; font-size: 12px; display: grid; place-items: center; flex: none; }
.sb-who { display: flex; flex-direction: column; line-height: 1.25; overflow: hidden; }
.sb-who strong { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--sb-strong); }
.sb-co { font-size: 12px; color: var(--sb-muted); }
.sb-user .umenu-pop { top: auto; bottom: calc(100% + 6px); left: 0; right: auto; }
.umenu-pop [hidden] { display: none !important; }   /* NEW-68: ẩn "Đổi mật khẩu" với tài khoản tạo qua Lark */
/* Chú thích (app.js đặt vị trí; position fixed ⇒ không bị .sb-nav cắt) */
.sb-tip { position: fixed; z-index: 70; pointer-events: none; padding: 4px 8px; border-radius: 4px; background: var(--ink); color: var(--surface); font-size: 12px; font-weight: 500; white-space: nowrap; box-shadow: var(--shadow-pop); }
.sb-tip[hidden] { display: none; }
/* Thu gọn (chỉ màn rộng): dải biểu tượng 64 px cùng nền sáng; mục đang mở / nhóm chứa nó = ô vuông xanh biểu tượng trắng; bấm nhóm = mở rộng menu */
@media (min-width: 900px) {
  .sidebar.rail { width: 64px; }
  .sidebar.rail .sb-word, .sidebar.rail .sb-chev, .sidebar.rail .sb-appchev, .sidebar.rail .sb-items { display: none; }
  .sidebar.rail .sb-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .sidebar.rail .sb-head { grid-template-columns: 1fr; justify-items: center; row-gap: 6px; padding: 14px 0 4px; }
  .sidebar.rail .sb-collapse { grid-column: 1; grid-row: 2; }
  .sidebar.rail .sb-apps-wrap, .sidebar.rail .sb-appbtn { grid-column: 1; grid-row: 3; justify-self: center; }
  .sidebar.rail .sb-appbtn { margin-left: 0; padding: 0; width: 32px; height: 32px; justify-content: center; border-radius: 8px; color: var(--sb-icon); }
  .sidebar.rail .sb-appbtn.static { display: none; }
  .sidebar.rail .sb-appgrid { display: grid; }
  .sidebar.rail .sb-search { padding: 4px 12px 6px; }
  .sidebar.rail .gsearch { width: 40px; padding: 0; justify-content: center; }
  .sidebar.rail .gsearch-text, .sidebar.rail .gsearch-kbd { display: none; }
  .sidebar.rail .sb-nav { padding: 4px 10px 12px; scrollbar-width: none; }
  .sidebar.rail .sb-row { justify-content: center; padding: 0; gap: 0; }
  .sidebar.rail .sb-row .sb-dot, .sidebar.rail .sb-grp[data-attn] > .sb-grp-btn .sb-dot { display: inline-block; position: absolute; top: 8px; right: 9px; box-shadow: 0 0 0 2px var(--sb-bg); }
  .sidebar.rail .sb-row .sb-dot[hidden] { display: none; }
  .sidebar.rail .sb-grp:not([data-attn]) > .sb-grp-btn .sb-dot { display: none; }
  .sidebar.rail .sb-grp.has-active > .sb-grp-btn, .sidebar.rail .sb-grp.has-active > .sb-grp-btn .ic { background: var(--sb-active); color: var(--sb-active-ink); }
  .sidebar.rail .sb-grp.has-active > .sb-grp-btn .ic { background: none; }
  .sidebar.rail .sb-foot { padding: 8px 6px 10px; }
  .sidebar.rail .sb-tools { flex-direction: column; }
  .sidebar.rail .sb-me { justify-content: center; padding: 6px 0; }
}
/* Màn hẹp: thanh mỏng nền sáng + menu trượt */
.mbar { display: none; height: 48px; align-items: center; gap: 4px; padding: 0 8px 0 4px; background: var(--sb-bg); color: var(--ink); border-bottom: 1px solid var(--sb-border); flex: none; }
.mbar a { text-decoration: none; color: inherit; }
.mbar :focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.mbar .mb-i { width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 8px; background: none; color: var(--sb-icon); cursor: pointer; padding: 0; font-weight: 700; font-size: 16px; }
.mbar .mb-i:hover { background: var(--sb-hover); color: var(--ink); }
.mbar .mb-i .ic { width: 22px; height: 22px; }
.mb-name { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1 1 auto; font-weight: 700; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mb-name img { width: 24px; height: 24px; border-radius: 5px; flex: none; }
.sb-backdrop { position: fixed; inset: 0; z-index: 55; background: var(--overlay); }
.sb-backdrop[hidden] { display: none; }
:root[data-theme="dark"] .sb-word { display: none; }
:root[data-theme="dark"] .sb-word-dark { display: block; }
@media (min-width: 900px) { :root[data-theme="dark"] .sidebar.rail .sb-word-dark { display: none; } }
@media (min-width: 761px) { .shell { flex: 1 1 auto; min-height: 0; } }
@media (max-width: 899px) {
  :root { --shell-top: 48px; }
  .shell { flex-direction: column; }
  .mbar { display: flex; }
  .sidebar { position: fixed; top: 0; bottom: 0; left: 0; z-index: 60; width: min(300px, 86vw); transform: translateX(-100%); visibility: hidden; border-right: 0;
    transition: transform .18s ease, visibility 0s linear .18s; }
  .sidebar.open { transform: none; visibility: visible; transition: transform .18s ease; box-shadow: var(--shadow-pop); }
  .sb-close { display: grid !important; }
  .sb-collapse, .sidebar .gsearch-kbd { display: none !important; }
  .sb-apps-pop { width: calc(100% - 24px); }
  .sb-app-grid { grid-template-columns: minmax(0, 1fr); }
  body.sb-open { overflow: hidden; }
}
@media (max-width: 760px) {
  .shell { display: block; min-height: 0; }
  .shell-body { display: block; }
  .mbar { position: sticky; top: 0; z-index: 30; }
}
/* Vùng nội dung: thanh trên đứng yên, chỉ .main cuộn (desktop); màn hẹp cuộn cả trang */
.main { padding: 16px 16px 24px; min-width: 0; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; margin: 0; flex: 1; letter-spacing: -.01em; }

/* ---- Thành phần ---- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.btn { border: 1px solid var(--btn-border); background: var(--surface); padding: 7px 14px; min-height: 36px; border-radius: var(--radius-btn); cursor: pointer; transition: border-color .1s, background .1s; }
.btn:hover { border-color: var(--brand); background: var(--hover); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); font-weight: 600; }
.btn.primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn.mint { background: var(--ok); border-color: var(--ok); color: var(--on-ok); font-weight: 600; }   /* nút xác nhận tích cực: Xong / Won / Duyệt */
.btn.mint:hover { background: var(--ok-text); border-color: var(--ok-text); }
.btn.danger { background: var(--err); border-color: var(--err); color: var(--on-err); font-weight: 600; }
.btn.danger:hover { background: var(--err-strong); border-color: var(--err-strong); }
.btn.small { padding: 3px 10px; font-size: 13px; min-height: 28px; }
.btn.icon { padding: 4px 9px; min-height: 32px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], input[type=search], select, textarea {
  border: 1px solid var(--btn-border); border-radius: var(--radius-btn); padding: 7px 11px; min-height: 36px; background: var(--surface); min-width: 0; transition: border-color .1s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field label { font-size: 13px; color: var(--muted); }
.field-label { font-size: 13px; color: var(--muted); }
.field .req { color: var(--brand); }
.check-list { display: grid; gap: 7px; max-height: 190px; overflow-y: auto; padding: 9px 11px; border: 1px solid var(--btn-border); border-radius: var(--radius); background: var(--surface-2); }
.check-list label { display: flex; align-items: flex-start; gap: 7px; color: var(--ink); cursor: pointer; }
.check-list input { margin-top: 4px; }
.catalog-required::after { content: " *"; color: var(--brand); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }   /* minmax(0): ô chọn có lựa chọn dài không đẩy cột tràn khỏi hộp thoại */

table.data { width: 100%; border-collapse: collapse; background: var(--surface); }
table.data th, table.data td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data th { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: var(--surface-2); position: sticky; top: 0; z-index: 1; font-weight: 600; }
table.data tbody tr { transition: background .1s; }
table.data tbody tr:hover td { background: var(--hover); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.pager { display: flex; align-items: center; gap: 8px; justify-content: flex-end; margin-top: 10px; color: var(--muted); }
.empty { padding: 28px; text-align: center; color: var(--muted); }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--muted); }
.badge[hidden] { display: none; }   /* NEW-47: display của .badge thắng thuộc tính hidden ⇒ chấm xám rỗng (VD thẻ Order Legal chưa có order) */
.badge.ok { background: var(--ok-soft); color: var(--ok-text); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.err { background: var(--err-soft); color: var(--err); }
.badge.new { background: var(--accent-soft); color: var(--accent-text); }   /* NEW-70: nhãn "Mới" — cam thương hiệu */

.msg { padding: 9px 13px; border-radius: var(--radius-btn); margin-bottom: 12px; }
.msg.err { background: var(--err-soft); color: var(--err); }
.msg.ok { background: var(--ok-soft); color: var(--ok-text); }
.msg.info { background: var(--brand-soft); color: var(--brand-dark); }
.msg.warn { background: var(--warn-soft); color: var(--ink); border-left: 3px solid var(--warn); }   /* NEW-59: hộp hậu quả / cảnh báo không chặn */
.ro-banner { margin: 0; border-radius: 0; padding: 8px 16px; font-size: 14px; }   /* NEW-75: băng vai trò Chỉ xem đầu vùng nội dung (bên phải menu dọc, trên #view) */
.msg ul { margin: 6px 0 0; padding-left: 18px; }
.msg li + li { margin-top: 3px; }

.modal-bg { position: fixed; inset: 0; background: var(--overlay); display: flex; align-items: flex-start; justify-content: center; padding: 60px 16px; z-index: 50; overflow-y: auto; }
.modal { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); width: 100%; max-width: 560px; box-shadow: var(--shadow-pop); }
.modal header { padding: 15px 20px; border-bottom: 1px solid var(--line); font-weight: 700; display: flex; }
.modal header .x { margin-left: auto; cursor: pointer; border: 0; background: none; font-size: 18px; color: var(--muted); }
.modal .body { padding: 18px 20px; }
.modal footer { padding: 13px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }

#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; z-index: 60; max-width: calc(100vw - 32px); }
.toast { padding: 10px 15px; border-radius: var(--radius-btn); color: var(--toast-ink); background: var(--toast-bg); border: 1px solid var(--toast-bg); z-index: 60; box-shadow: var(--shadow-pop); }
.toast.err { background: var(--err); border-color: var(--err); color: var(--on-err); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; scrollbar-width: thin; }   /* NEW-26: nhiều tab ⇒ cuộn ngang trong thanh tab, không tràn trang */
.tabs a { padding: 9px 15px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; flex: 0 0 auto; white-space: nowrap; }
.tabs a:hover { color: var(--ink); }
.tabs a.active { color: var(--brand-dark); border-bottom-color: var(--brand); font-weight: 600; }
.catalog-tabs { overflow-x: auto; }
.catalog-tabs a { white-space: nowrap; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 6px 12px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.muted { color: var(--muted); }

/* Tổng quan (dùng cho chi tiết cửa hàng trong hệ thống) */
.filters { display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: flex-end; margin-bottom: 16px; }
.filters label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.filters input, .filters select { min-width: 150px; }
.kpi-wrap { display: grid; gap: 14px; margin-bottom: 18px; }
.kpi-group { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; border-top: 3px solid var(--line); box-shadow: var(--shadow); }
.kpi-group.total { border-top-color: var(--brand); }
.kpi-group h3 { margin: 0 0 10px; font-size: 15px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.kpi-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.kpi-value { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; margin: 2px 0; overflow-wrap: anywhere; letter-spacing: -.01em; }
.kpi-sub { font-size: 12px; }
.delta { font-weight: 600; }
.delta.up { color: var(--ok); }
.delta.down { color: var(--err); }
.delta.up::before { content: "▲ "; font-size: .8em; }
.delta.down::before { content: "▼ "; font-size: .8em; }
.note { font-size: 12px; margin: 10px 0 0; }
.seg { display: flex; gap: 6px; margin-bottom: 10px; }
.chart { margin-bottom: 12px; }
.chart svg { width: 100%; height: 180px; display: block; background: var(--surface-2); border-radius: var(--radius); }
.chart-axis { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 4px; }

@media (max-width: 760px) {
  .main { padding: 12px 12px 20px; }
  .grid2 { grid-template-columns: minmax(0, 1fr); }
  .tabs { overflow-x: auto; }   /* nhiều tab (dự án 7 tab) không đẩy trang tràn ngang ở 390 px */
  .tabs a { white-space: nowrap; flex: none; }
  .filters input, .filters select { min-width: 0; width: 100%; }
  .filters label { flex: 1 1 140px; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpi-value { font-size: 19px; }
  .chat-bubble { max-width: 100%; }
  table.data td, table.data th { white-space: nowrap; }
}

/* ---- Khung cố định: header + menu đứng yên, chỉ vùng dữ liệu cuộn (desktop) ---- */
@media (min-width: 761px) {
  html, body { height: 100%; }
  body { overflow: hidden; }
  #app { height: 100%; display: flex; flex-direction: column; }
  .main { flex: 1; min-height: 0; overflow-y: auto; }
  .table-wrap.fit { overflow: auto; }
  .table-wrap.fit table.data th { box-shadow: 0 1px 0 var(--line); }
}

/* Bảo mật tài khoản */
.security-grid { display: grid; gap: 18px; }
.security-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.security-card-head h2 { font-size: 17px; margin: 0 0 4px; }
.security-card-head p { margin: 0; }
.security-sessions { min-width: 0; }
/* NEW-53a thẻ "Email hệ thống" (Admin, views/mail_admin.js) */
.mail-admin { min-width: 0; }
.mail-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.mail-facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0 0 14px; font-size: 14px; }
.mail-facts dt { color: var(--muted); }
.mail-facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.mail-hint { background: var(--warn-soft); color: var(--ink); border-radius: var(--radius); padding: 10px 12px; margin: 0 0 14px; font-size: 14px; }
.mail-err { font-size: 13px; margin-top: 4px; color: var(--err); overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mail-list { border: 1px solid var(--line); border-radius: var(--radius); }
.mail-row { display: flex; gap: 12px; justify-content: space-between; align-items: flex-start; padding: 10px 12px; border-top: 1px solid var(--line); }
.mail-row:first-child { border-top: 0; }
.mail-main { min-width: 0; flex: 1; }
.mail-line { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.mail-line .badge { white-space: nowrap; }
.mail-subject { font-weight: 600; margin-top: 4px; overflow-wrap: anywhere; }
.mail-token { font-weight: 400; font-size: 12px; }
.mail-addr { font-size: 13px; overflow-wrap: anywhere; }
.mail-text { white-space: pre-line; margin-top: 4px; font-size: 14px; overflow-wrap: anywhere; }
.mail-btns { display: flex; gap: 6px; flex-shrink: 0; }
.mail-btns .btn { white-space: nowrap; }
@media (max-width: 760px) { .mail-facts { grid-template-columns: 1fr; } .mail-facts dd { margin-bottom: 6px; } .mail-row { flex-direction: column; gap: 6px; } .mail-btns [data-eml] { display: none; } }   /* điện thoại: ẩn "Tải .eml" cho hàng gọn */
.mfa-qr { display: flex; justify-content: center; margin: 4px 0 18px; }
.mfa-qr img { display: block; width: 220px; height: 220px; max-width: 100%; border-radius: var(--radius); background: var(--paper); padding: 8px; }
.mfa-secret { display: block; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; overflow-wrap: anywhere; }

/* ---- Sales: Lead / Account / Client / Cơ hội / Hợp đồng ---- */
input[type=datetime-local] { border: 1px solid var(--btn-border); border-radius: var(--radius); padding: 7px 11px; min-height: 36px; background: var(--surface-2); min-width: 0; }
.check-inline { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; color: var(--muted); cursor: pointer; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 6px 0 10px; }
.section-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 6px 0 12px; }
.seg .btn.primary { pointer-events: none; }

/* Timeline hoạt động / lịch sử trạng thái */
.timeline { display: grid; gap: 0; border-left: 2px solid var(--line); margin-left: 8px; }
.timeline-item { position: relative; padding: 4px 0 14px 18px; }
.timeline-item::before { content: ""; position: absolute; left: -7px; top: 10px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--brand); }
.timeline-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.timeline-head .muted { font-size: 12px; }
.timeline-note { margin-top: 4px; white-space: pre-wrap; }

/* Kanban cơ hội */
.kanban { display: grid; grid-template-columns: repeat(3, minmax(240px, 1fr)); gap: 14px; align-items: start; }
.kanban-col { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; min-height: 240px; transition: border-color .12s, background .12s; }
.kanban-col.over { border-color: var(--brand); background: var(--brand-soft); }
.kanban-col h3 { display: flex; align-items: center; gap: 8px; font-size: 14px; margin: 2px 4px 10px; }
.kanban-col h3 .kanban-sum { margin-left: auto; font-size: 12px; font-weight: 500; }
.kanban-cards { display: grid; gap: 8px; }
.kanban-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; box-shadow: var(--shadow); cursor: grab; display: grid; gap: 4px; }
.kanban-card[draggable="true"]:active { cursor: grabbing; }
.kanban-card.dragging { opacity: .5; }
.kanban-card .kanban-title { font-weight: 600; }
.kanban-card .kanban-title a { text-decoration: none; }
.kanban-meta { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); }
.kanban-meta strong { color: var(--ink); }
.kanban-actions { display: flex; gap: 6px; justify-content: flex-end; margin-top: 2px; }
.kanban.six { grid-template-columns: repeat(6, minmax(200px, 1fr)); overflow-x: auto; }  /* Plan: 6 cột theo stage */
.kanban-card .kanban-days { font-size: 12px; color: var(--muted); }
@media (max-width: 900px) { .kanban { grid-template-columns: 1fr; } }

/* Tổng quan Sales (#/overview): bộ lọc, ô số liệu, thanh ngang (phễu / theo stage), lưới thẻ */
.ov-toolbar { align-items: flex-end; }
.ov-filter { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.ov-period { margin: -8px 0 14px; font-size: 13px; }
.ov-tiles { margin-bottom: 18px; }
.ov-tiles .kpi-value { font-variant-numeric: normal; }
.ov-tone-ok { color: var(--ok-text); }
.ov-tone-warn { color: var(--warn); }
.ov-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; margin-bottom: 18px; }
.ov-card { min-width: 0; }
.ov-card .table-wrap { box-shadow: none; }
.ov-title { font-size: 15px; margin: 0 0 12px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.ov-note { font-size: 12px; font-weight: 400; }
.ov-bars { display: grid; gap: 10px; }
.ov-row { display: grid; grid-template-columns: minmax(96px, 150px) 1fr auto; gap: 10px; align-items: center; font-size: 13px; }
.ov-label { color: var(--muted); overflow-wrap: anywhere; }
.ov-track { display: block; height: 18px; border-radius: 0 4px 4px 0; background: var(--surface-2); overflow: hidden; }
.ov-fill { display: block; height: 100%; background: var(--brand); border-radius: 0 4px 4px 0; }
.ov-fill.ok { background: var(--ok); }
.ov-fill.err { background: var(--err); }
.ov-num { font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.ov-num small { color: var(--muted); font-size: 12px; }
@media (max-width: 760px) {
  .ov-filter { flex: 1 1 140px; }
  .ov-filter input, .ov-filter select { width: 100%; }
  .ov-grid { grid-template-columns: 1fr; }
  .ov-row { grid-template-columns: minmax(80px, 110px) 1fr auto; }
  .ov-num { white-space: normal; }
}

/* ---- Trang bản ghi kiểu Salesforce / Odoo (đợt UX 1) ---- */
.crumb { font-size: 13px; color: var(--muted); margin: -4px 0 6px; display: flex; gap: 6px; align-items: center; }
.crumb a { color: var(--muted); text-decoration: none; }
.crumb a:hover { color: var(--brand-dark); text-decoration: underline; }
.path { display: flex; gap: 4px; margin: 4px 0 8px; flex-wrap: wrap; }
.path-step { flex: 1 1 0; min-width: 110px; text-align: center; padding: 9px 14px; font-size: 13px; font-weight: 600; color: var(--muted);
  background: var(--surface-2); border: 0; clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%, 12px 50%); font-family: inherit; }
.path-step:first-child { clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%); border-radius: 8px 0 0 8px; }
.path-step:last-child { clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 12px 50%); border-radius: 0 8px 8px 0; }
.path-step.done { background: var(--brand-soft); color: var(--brand-dark); }
.path-step.current { background: var(--brand); color: var(--on-brand); }
.path-step.current.bad, .path-step.bad { background: var(--err); color: var(--on-err); }
.path-step.can { cursor: pointer; }
.path-step.can:hover { background: var(--brand-soft); color: var(--brand-dark); }
.path-step.blocked { cursor: not-allowed; opacity: .55; text-decoration: line-through dotted; }   /* NEW-55: còn thiếu điều kiện (title = lý do) */
.path-guide { font-size: 13px; color: var(--muted); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); padding: 8px 12px; margin-bottom: 12px; }
.highlights { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px 18px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 16px; margin: 0 0 12px; box-shadow: var(--shadow); }
.hl-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.hl-value { font-size: 15px; font-weight: 600; overflow-wrap: anywhere; margin-top: 2px; }
.tab-count { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 6px; border-radius: 999px; font-size: 11px; line-height: 18px; text-align: center;
  background: var(--accent-soft); color: var(--accent-text); font-weight: 700; }   /* NEW-70: số đếm = cam thương hiệu */
.tab-count.zero { background: var(--surface-2); color: var(--muted); }
@media (max-width: 720px) { .path-step { min-width: 0; padding: 8px 10px; font-size: 12px; } }

/* ---- NEW-17: Việc của tôi, chip lọc nhanh (Odoo favorites), ô chọn khách, thẻ dự án (Khách hàng 360) ---- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0 0 10px; }
.chip { border: 1px solid var(--btn-border); background: var(--surface); color: var(--muted); padding: 4px 12px; min-height: 30px; border-radius: 999px; font-size: 13px; font-weight: 600; cursor: pointer; transition: background .12s, color .12s, border-color .12s; }
.chip:hover { border-color: var(--brand); color: var(--ink); }
.chip.on { background: var(--brand-soft); color: var(--brand-dark); border-color: var(--brand); }
.chip.on::before { content: "✓ "; }
/* NEW-23: nút "Bộ lọc" (bộ lọc lưu sẵn) cuối hàng chip + bảng nhóm theo */
.chips { position: relative; z-index: 3; }   /* hàng chip nổi trên bảng để menu "Bộ lọc" không bị bảng che */
.chips .fmenu { position: relative; margin-left: auto; }
.fmenu-btn.on { background: var(--brand-soft); color: var(--brand-dark); border-color: var(--brand); font-weight: 600; }
.fmenu-pop { right: 0; left: auto; min-width: 280px; max-width: min(380px, calc(100vw - 32px)); max-height: min(70vh, 520px); overflow-y: auto; }
.fmenu-head { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 8px 10px 4px; }
.fmenu-row { display: flex; align-items: center; gap: 2px; }
.fmenu-pop .fmenu-row button { width: auto; }
.fmenu-pop .fmenu-row .fmenu-apply { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.fmenu-row.on .fmenu-apply { background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; }
.fmenu-pop .fmenu-row .fmenu-more { flex: none; width: 34px; text-align: center; color: var(--muted); font-weight: 700; }
.fmenu-star { color: var(--warn); }
.fmenu-sub { display: block; font-size: 12px; color: var(--muted); font-weight: 400; }
.fmenu-empty { padding: 4px 10px 10px; font-size: 12px; }
.fmenu-sep { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
table.data tr.grp td { background: var(--surface-2); padding: 6px 10px; border-top: 1px solid var(--line); }
.grp-toggle { border: 0; background: none; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; font: inherit; color: var(--ink); padding: 2px 0; }
.grp-toggle .grp-caret { display: inline-block; color: var(--muted); transition: transform .12s; }
.grp-toggle[aria-expanded="false"] .grp-caret { transform: rotate(-90deg); }
.grp-sum { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
@media (max-width: 760px) { .chips .fmenu { margin-left: 0; } .fmenu-pop { left: 0; right: auto; } }
.home-hello { margin: -6px 0 16px; color: var(--muted); }
.home-phases { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 18px; }
.home-phase { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; box-shadow: var(--shadow); border-top: 3px solid var(--brand); }
.home-phase.p2 { border-top-color: var(--brand-dark); }
.home-phase h3 { margin: 0 0 4px; font-size: 14px; }
.home-phase .steps { display: flex; flex-wrap: wrap; gap: 4px 8px; font-size: 13px; }
.home-phase .steps a { text-decoration: none; font-weight: 600; }
.home-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.home-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; min-width: 0; }
.home-card h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 4px; font-size: 15px; }
.home-card h3 .badge { font-size: 13px; }
.home-card .hint { font-size: 12px; color: var(--muted); margin: 0 0 10px; }
.home-card .table-wrap { box-shadow: none; }
.home-card table.data th { position: static; }
.home-card .all { margin-top: 10px; text-align: right; }
.home-done { padding: 14px; text-align: center; color: var(--ok-text); background: var(--ok-soft); border-radius: var(--radius); font-weight: 600; }
.picker { position: relative; }
.picker-list { position: absolute; top: 100%; left: 0; right: 0; z-index: 20; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); max-height: 260px; overflow-y: auto; }
.picker-item { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 12px; cursor: pointer; border-bottom: 1px solid var(--line); }
.picker-item:last-child { border-bottom: 0; }
.picker-item:hover { background: var(--hover); }
.picker-empty { padding: 10px 12px; color: var(--muted); font-size: 13px; }
.proj-group { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 14px 0 8px; }
.proj-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.proj-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); display: grid; gap: 6px; }
.proj-card.ended { opacity: .8; }
.proj-card .title { font-weight: 600; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.proj-card .title a { text-decoration: none; }
.proj-card .meta { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 10px; font-size: 13px; }
.proj-card .meta span { color: var(--muted); }
.proj-card .meta strong { font-variant-numeric: tabular-nums; }
/* NEW-25: gom phụ lục — khung gợi ý gộp, thanh chọn phụ lục, dòng ô chọn trong hộp thoại */
.suggest-panel { border-left: 3px solid var(--warn); margin-bottom: 12px; }
.suggest-panel h4 { margin: 0 0 4px; }
.sg-row { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; padding: 8px 0; border-top: 1px solid var(--line); }
.sg-row .btn { flex: none; }
.group-bar { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin: 0 0 8px; }
.group-bar label { display: inline-flex; gap: 6px; align-items: center; }
.check-row { display: flex; gap: 8px; align-items: flex-start; padding: 4px 0; }
a.badge { text-decoration: none; }
.btn.disabled { opacity: .5; cursor: default; pointer-events: none; }
@media (max-width: 600px) { .sg-row { flex-direction: column; } }
.rev-group { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 14px 0 8px; }
.rev-group h4 { margin: 0; font-size: 14px; }
@media (max-width: 900px) { .home-grid, .home-phases { grid-template-columns: 1fr; } }
a.btn { display: inline-flex; align-items: center; text-decoration: none; color: var(--ink); }
a.btn.primary { color: var(--on-brand); }
a.btn.mint { color: var(--on-ok); }
.kanban.six.four { grid-template-columns: repeat(4, minmax(220px, 1fr)); }
/* ---- NEW-19: việc hẹn (Sắp tới / Quá hạn), chấm việc kế tiếp trên thẻ Kanban / danh sách, khối Việc hẹn ở trang chủ ---- */
.act-due-list { display: grid; gap: 8px; margin-bottom: 14px; }
.act-due { border: 1px solid var(--line); border-left: 4px solid var(--warn); border-radius: var(--radius); padding: 8px 12px; background: var(--surface); }
.act-due.late { border-left-color: var(--err); background: var(--err-soft); }
.act-due-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.act-due-head .muted { font-size: 12px; }
.act-due-actions { margin-left: auto; display: inline-flex; gap: 6px; flex-wrap: wrap; }
.timeline-item.canceled { opacity: .65; }
.timeline-item.canceled strong { text-decoration: line-through; }
.chips.due-quick { margin: -4px 0 10px; }
.act-dot { display: inline-block; width: 12px; height: 12px; min-width: 12px; border-radius: 50%; border: 0; padding: 0; vertical-align: middle; background: var(--muted); opacity: .45; }
.act-dot.planned { background: var(--ok); opacity: 1; }
.act-dot.overdue { background: var(--err); opacity: 1; box-shadow: 0 0 0 3px var(--err-soft); }
button.act-dot { cursor: pointer; }
button.act-dot:hover, button.act-dot:focus-visible { opacity: 1; outline: 2px solid var(--brand); outline-offset: 2px; }
.kanban-title { display: flex; align-items: flex-start; gap: 6px; }
.kanban-title .act-dot { margin-top: 5px; margin-left: auto; }
.home-card.due { grid-column: 1 / -1; }
.home-card tr.late td { background: var(--err-soft); }
.home-card tr.late td:first-child { box-shadow: inset 4px 0 0 var(--err); }
.section-actions .btn-group { display: inline-flex; gap: 6px; flex-wrap: wrap; }

/* ---- Tìm kiếm toàn cục + menu tài khoản (NEW-21) ---- */
.gsearch { display: inline-flex; align-items: center; gap: 8px; min-width: 0; width: min(420px, 38vw); height: 36px; padding: 0 10px; margin-left: 10px; flex: none; border: 1px solid var(--btn-border); border-radius: var(--radius-btn); background: var(--surface); color: var(--muted); cursor: text; text-align: left; transition: border-color .12s, box-shadow .12s; }
.gsearch:hover { border-color: var(--on-topbar); }
.gsearch:focus-visible { border-color: var(--brand); outline: 2px solid var(--on-topbar); outline-offset: 1px; }
.gsearch svg, .gs-head svg { width: 17px; height: 17px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }
.gsearch-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
kbd { display: inline-block; padding: 0 5px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; background: var(--surface-2); color: var(--muted); font: 600 11px/1.6 var(--font); }
.gs-bg { position: fixed; inset: 0; z-index: 60; background: var(--overlay); display: flex; justify-content: center; align-items: flex-start; padding: 9vh 16px 16px; }
.gs { width: 100%; max-width: 680px; max-height: 78vh; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-pop); overflow: hidden; }
.gs-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); color: var(--muted); position: relative; }
.gs .gs-head input, .gs .gs-head input:focus { flex: 1; min-width: 0; border: 0; outline: 0; box-shadow: none; border-radius: 0; background: transparent; font-size: 16px; padding: 8px 0; min-height: 0; color: var(--ink); }
.gs-head:focus-within { color: var(--brand); }
.gs-bg.loading .gs-head::after { content: ""; position: absolute; left: 0; bottom: -1px; height: 2px; width: 40%; background: var(--brand); animation: gs-load 1s ease-in-out infinite; }
@keyframes gs-load { from { left: -40%; } to { left: 100%; } }
.gs-list { overflow-y: auto; padding: 6px 8px 10px; }
.gs-group + .gs-group { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 4px; }
.gs-group-head { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; font-weight: 700; color: var(--muted); padding: 8px 8px 4px; display: flex; align-items: center; gap: 6px; }
.gs-count { background: var(--surface-2); border-radius: 999px; padding: 0 7px; letter-spacing: 0; font-size: 11px; }
.gs-item { display: flex; flex-direction: column; gap: 1px; padding: 7px 10px; border-radius: var(--radius); text-decoration: none; color: var(--ink) !important; }
.gs-item.active { background: var(--brand-soft); box-shadow: inset 3px 0 0 var(--brand); }
.gs-main { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.gs-title { font-weight: 600; }
.gs-code { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.gs-sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gs-item mark { background: var(--warn-soft); color: inherit; border-radius: 3px; padding: 0 1px; }
.gs-more { font-size: 13px; font-weight: 600; color: var(--brand-dark) !important; }
.gs-hint, .gs-empty { padding: 14px 10px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.gs-empty { color: var(--ink); }
.gs-foot { display: flex; flex-wrap: wrap; gap: 14px; padding: 8px 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.gs-foot-tip { margin-left: auto; }
body.gs-open { overflow: hidden; }
.umenu { position: relative; flex: none; }
button.avatar { border: 0; padding: 0; cursor: pointer; }
button.avatar:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.umenu-pop { position: absolute; right: 0; top: calc(100% + 9px); color: var(--ink); min-width: 240px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-pop); padding: 6px; z-index: 40; }
.umenu-who { display: flex; flex-direction: column; padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; font-size: 13px; overflow-wrap: anywhere; }
.umenu-pop button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 9px 10px; border-radius: 8px; cursor: pointer; }
.umenu-pop button:hover, .umenu-pop button:focus-visible { background: var(--hover); outline: none; }
.umenu-pop button.danger { color: var(--err); }
@media (max-width: 760px) {
  .gs-bg { padding: 0; }
  .gs { max-width: none; max-height: none; height: 100%; border-radius: 0; border: 0; }
  .gs-foot { display: none; }
  .gs-item { padding: 10px; }
}

/* ---- Dòng thời gian gộp / chatter (NEW-22) ---- */
.chatter-composer { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 16px; box-shadow: var(--shadow); }
.composer-box { position: relative; }
.chatter-composer textarea { width: 100%; resize: vertical; min-height: 54px; }
.composer-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 6px; font-size: 12px; }
.mention-pop { position: absolute; left: 0; top: 100%; z-index: 30; min-width: 240px; max-width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.mention-item { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 7px 12px; cursor: pointer; }
.mention-item.active, .mention-item:hover { background: var(--brand-soft); }
.mention { color: var(--brand-dark); background: var(--brand-soft); border-radius: 5px; padding: 0 3px; font-weight: 600; }
.tl { margin-left: 14px; }
.tl-item { position: relative; display: flex; gap: 10px; padding: 4px 0 14px 18px; }
.tl-item::before { display: none; }
.tl-icon { position: absolute; left: -13px; top: 4px; width: 24px; height: 24px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line); display: flex; align-items: center; justify-content: center; color: var(--muted); }
.tl-icon svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.kind-note > .tl-icon { border-color: var(--brand); color: var(--brand-dark); }
.kind-activity > .tl-icon { border-color: var(--ok); color: var(--ok-text); }
.kind-stage > .tl-icon { border-color: var(--warn); color: var(--warn); }
.kind-created > .tl-icon { border-color: var(--brand); color: var(--brand-dark); }
.tl-body { flex: 1; min-width: 0; }
.tl-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.tl-head .muted, .tl-time { font-size: 12px; color: var(--muted); }
.tl-time { cursor: help; border-bottom: 1px dotted var(--line); }
.tl-actions { margin-left: auto; display: inline-flex; gap: 4px; }
.tl-note { margin-top: 4px; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px; }
.tl-item.pinned .tl-note { border-color: var(--brand); background: var(--brand-soft); }
.tl-changes { display: grid; gap: 2px; margin-top: 4px; font-size: 13px; }
.tl-change { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tl-field { color: var(--muted); min-width: 120px; }
.tl-old { text-decoration: line-through; color: var(--muted); }
.tl-new { font-weight: 600; }
.tl-more { text-align: center; margin: 4px 0 10px; }
@media (max-width: 760px) {
  .chatter-composer { position: sticky; top: var(--shell-top); z-index: 5; }
  .tl-field { min-width: 0; width: 100%; }
  .tl-actions { margin-left: 0; width: 100%; }
}
/* ---- NEW-26 người liên hệ: quá trình làm việc, chip vai trò trong dự án, khung "trùng" ---- */
.contact-sub { margin: -6px 0 12px; font-size: 15px; }
.copyable { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.copy-btn { padding: 1px 8px; min-height: 24px; font-size: 12px; }
.job-list { list-style: none; margin: 4px 0 0; padding: 0 0 0 6px; }
.job { position: relative; display: flex; gap: 12px; padding: 0 0 16px 0; }
.job::before { content: ""; position: absolute; left: 6px; top: 16px; bottom: 0; width: 2px; background: var(--line); }
.job:last-child::before { display: none; }
.job-dot { flex: 0 0 14px; height: 14px; margin-top: 3px; border-radius: 50%; border: 2px solid var(--line); background: var(--surface); position: relative; z-index: 1; }
.job.current .job-dot { border-color: var(--brand); background: var(--brand); }
.job-body { display: grid; gap: 3px; min-width: 0; }
.job-head { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.job-note { font-size: 13px; }
.job-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.role-chips { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.role-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--brand-soft); color: var(--brand-dark); white-space: nowrap; }
.role-chip.role-decision_maker { background: var(--warn-soft); color: var(--warn); }
.role-chip.role-accounting { background: var(--ok-soft); color: var(--ok-text); }
.role-chip.role-other, .role-chip.role-technical { background: var(--surface-2); color: var(--muted); }
.role-chip button { border: 0; background: none; color: inherit; cursor: pointer; font-size: 14px; line-height: 1; padding: 0 0 0 2px; }
.dup-box .dup-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.row-actions { display: inline-flex; flex-wrap: wrap; gap: 6px; }
dl.kv { display: grid; grid-template-columns: minmax(120px, 200px) 1fr; gap: 8px 16px; margin: 0 0 8px; }
dl.kv dt { color: var(--muted); font-size: 13px; }
dl.kv dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 760px) { dl.kv { grid-template-columns: 1fr; gap: 2px; } dl.kv dd { margin-bottom: 8px; } }

/* ---- NEW-71: CONTROL PANEL kiểu Odoo (list_tools.js ControlPanel) — một hàng trắng sát dưới thanh ứng dụng, dính khi cuộn ---- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.ic { flex: none; }
svg.ic { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.main > .page-head.cp { position: sticky; top: -16px; z-index: 20; margin: -16px -16px 16px; padding: 8px 16px; background: var(--surface); border-bottom: 1px solid var(--line);
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 560px) minmax(0, 1fr); gap: 8px 16px; align-items: center; flex-wrap: nowrap; }
.page-head.cp > .cp-l { display: flex; align-items: center; gap: 8px; min-width: 0; }
.cp-new-slot { display: contents; }
.cp-new-slot .btn { min-height: 32px; padding: 4px 12px; }
.cp-bc { display: flex; align-items: center; gap: 8px; min-width: 0; }
.page-head.cp h1.cp-title { font-size: 18px; line-height: 24px; font-weight: 600; flex: 0 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: 0; }
.cp-bc > .badge, .cp-bc > span { flex: none; }
.cp-gear { position: relative; flex: none; }
.cp-gear-btn { width: 28px; height: 28px; display: grid; place-items: center; border: 0; background: none; color: var(--muted); border-radius: var(--radius-btn); cursor: pointer; padding: 0; }
.cp-gear-btn:hover, .cp-gear-btn[aria-expanded="true"] { background: var(--hover); color: var(--ink); }
.cp-gear-pop { left: 0; right: auto; top: calc(100% + 6px); }
.cp-gear-pop .btn, .cp-gear-pop a { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; min-height: 0; border-radius: var(--radius-btn); color: var(--ink); font-weight: 400; text-decoration: none; }
.cp-gear-pop .btn:hover, .cp-gear-pop a:hover { background: var(--hover); }
.cp-gear-pop [hidden] { display: none !important; }
.page-head.cp > .cp-c { position: relative; min-width: 0; }
.cp-search { height: 34px; border: 1px solid var(--line); border-radius: var(--radius-btn); display: flex; align-items: center; gap: 6px; padding: 0 0 0 8px; background: var(--surface); min-width: 0; }
.cp-search:focus-within { border-color: var(--brand); }
.cp-search[hidden] { display: none; }
.cp-sic { color: var(--muted); display: grid; place-items: center; flex: none; }
.cp-facets { display: flex; gap: 4px; flex-wrap: nowrap; overflow: hidden; flex: 0 1 auto; min-width: 0; }
.cp-facet { display: inline-flex; align-items: stretch; height: 24px; border-radius: var(--radius-btn); overflow: hidden; font-size: 13px; background: var(--surface-2); border: 1px solid var(--line-2); flex: none; max-width: 220px; }
.cp-fk { background: var(--brand); color: var(--on-brand); padding: 0 5px; display: grid; place-items: center; }
.cp-facet.grp .cp-fk { background: var(--ink); color: var(--surface); }
.cp-facet.fav .cp-fk { background: var(--accent); color: #fff; }
.cp-fk .ic { width: 12px; height: 12px; stroke-width: 2; }
.cp-fv { padding: 0 6px; display: flex; align-items: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--sb-strong); }
.cp-x { border: 0; background: none; padding: 0 6px 0 0; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.cp-x:hover { color: var(--err); }
.cp-x .ic { width: 12px; height: 12px; }
.cp-qslot { flex: 1 1 120px; min-width: 60px; display: flex; }
.cp-qslot:empty, .cp-qslot[hidden] { display: none; }
.cp-search input.cp-q { border: 0; outline: 0; box-shadow: none; padding: 0; min-height: 0; height: 30px; width: 100%; min-width: 0 !important; background: transparent; font-size: 13px; }
.cp-search input.cp-q:focus-visible { outline: 0; }
.cp-ph { flex: 1; text-align: left; border: 0; background: none; color: var(--muted); font-size: 13px; cursor: pointer; padding: 0; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cp-toggle { width: 30px; height: 32px; border: 0; border-left: 1px solid var(--line); background: none; color: var(--muted); display: grid; place-items: center; cursor: pointer; margin-left: auto; flex: none; border-radius: 0 var(--radius-btn) var(--radius-btn) 0; }
.cp-toggle:hover, .cp-toggle[aria-expanded="true"] { background: var(--hover); color: var(--ink); }
.cp-toggle[hidden], .cp-ph[hidden] { display: none; }
.cp-panel { position: absolute; top: calc(100% + 4px); left: 0; right: 0; min-width: min(640px, calc(100vw - 24px)); z-index: 30; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-pop); display: flex; flex-wrap: wrap; padding: 4px 0; max-height: min(70vh, 560px); overflow-y: auto; }
.cp-panel[hidden] { display: none; }
.cp-col { flex: 1 1 200px; min-width: 0; padding: 6px 14px 10px; border-left: 1px solid var(--line-2); }
.cp-col:first-child, .cp-col[hidden] + .cp-col:not([hidden]):nth-child(2) { border-left: 0; }
.cp-col[hidden] { display: none; }
.cp-col h4 { margin: 4px 0 8px; font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 6px; color: var(--ink); }
.cp-col h4 .ic { width: 14px; height: 14px; color: var(--brand); }
.cp-col-g h4 .ic { color: var(--ink); }
.cp-col-s h4 .ic { color: var(--accent); }
.cp-folded { display: flex; flex-direction: column; align-items: stretch; gap: 6px; margin: 0; flex-wrap: nowrap; }
.cp-folded[hidden] { display: none; }
.cp-folded + .cp-folded { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line-2); }
.cp-folded .chip { border: 0; border-radius: var(--radius-btn); background: none; color: var(--ink); text-align: left; padding: 5px 8px 5px 28px; min-height: 0; font-weight: 400; font-size: 14px; position: relative; }
.cp-folded .chip:hover { background: var(--hover); color: var(--ink); }
.cp-folded .chip.on { background: none; color: var(--ink); font-weight: 600; }
.cp-folded .chip.on::before { content: "✓"; position: absolute; left: 9px; color: var(--brand); font-weight: 700; }
.cp-folded select, .cp-folded input, .cp-gbody select { width: 100%; min-height: 32px; padding: 4px 8px; font-size: 13px; }
.cp-folded label, .cp-gbody label { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink); min-height: 30px; margin: 0; padding: 0 8px; }
.cp-gbody { display: flex; flex-direction: column; gap: 6px; }
.cp-fmenu { position: static; margin: 0; }
.cp-fmenu .fmenu-btn { display: none; }
.cp-fmenu .fmenu-pop, .cp-fmenu .fmenu-pop[hidden] { display: block; position: static; box-shadow: none; border: 0; padding: 0; min-width: 0; max-width: none; max-height: none; overflow: visible; }
.cp-fmenu .fmenu-head { padding-left: 8px; }
.page-head.cp > .cp-r { display: flex; justify-content: flex-end; align-items: center; gap: 8px; min-width: 0; }
.cp-pager .pager { margin: 0; gap: 4px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.pager .pager-arr { width: 28px; min-height: 28px; height: 28px; padding: 0; display: inline-grid; place-items: center; color: var(--muted); }
.pager .pager-arr .ic { width: 14px; height: 14px; }
.cp-views { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-btn); overflow: hidden; flex: none; }
.cp-views[hidden] { display: none; }
.cp-views > .seg, .cp-views > .cl-seg, .cp-views > .lg-viewseg { display: contents; }
.cp-views .btn, .cp-views .chip, .cp-views > span, .cp-views a { width: 34px; height: 32px; min-height: 0; padding: 0; margin: 0; display: grid; place-items: center; border: 0; border-left: 1px solid var(--line);
  border-radius: 0; background: var(--surface); color: var(--muted); font-weight: 400; }
.cp-views > :first-child, .cp-views > .seg > :first-child, .cp-views > .cl-seg > :first-child, .cp-views > .lg-viewseg > :first-child { border-left: 0; }
.cp-views .chip.on::before { content: none; }
.cp-views .btn.primary, .cp-views .on, .cp-views [aria-pressed="true"] { background: var(--brand-soft); color: var(--brand); }
.cp-views .btn:hover, .cp-views .chip:hover { background: var(--hover); color: var(--ink); }
.main > .page-head.cp + p.muted, .main > .page-head.cp + .home-hello { margin: -6px 0 12px; font-size: 13px; }
@media (max-width: 1100px) {
  .main > .page-head.cp { grid-template-columns: minmax(0, 1fr) auto; }
  .page-head.cp > .cp-c { grid-column: 1 / -1; grid-row: 2; }
  .page-head.cp > .cp-r { grid-column: 2; grid-row: 1; }
}
@media (max-width: 760px) {
  .main > .page-head.cp { position: static; margin: -12px -12px 12px; padding: 8px 12px; }
  .cp-panel { position: fixed; left: 8px; right: 8px; top: auto; min-width: 0; }
  .cp-col { flex-basis: 100%; border-left: 0; border-top: 1px solid var(--line-2); }
  .cp-col:first-child { border-top: 0; }
  .cp-facet { max-width: 150px; }
}
@media print { .page-head.cp > .cp-c, .page-head.cp > .cp-r, .cp-gear, .cp-new { display: none !important; } .main > .page-head.cp { position: static; margin: 0 0 12px; border: 0; } }

/* ---- NEW-71: bảng danh sách kiểu Odoo — dòng gọn, tiêu đề dính chữ thường đậm, số căn phải, rê chuột đổi nền ---- */
table.data { font-size: 13px; }
table.data th, table.data td { padding: 7px 10px; border-bottom-color: var(--line-2); vertical-align: middle; }
table.data th { font-size: 13px; text-transform: none; letter-spacing: 0; color: var(--ink); font-weight: 700; background: var(--surface); border-bottom: 2px solid var(--line); white-space: nowrap; }
table.data th.num { text-align: right; }
table.data tbody tr:hover td { background: var(--hover); }
.table-wrap { border-radius: var(--radius); background: var(--surface); }
.badge { padding: 2px 8px; border-radius: 11px; line-height: 18px; white-space: nowrap; }
.badge.info, .badge.run { background: var(--brand-soft); color: var(--brand-dark); }
.badge.dark { background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); }
.btn { min-height: 32px; padding: 5px 12px; font-weight: 500; }
.btn.small { min-height: 28px; padding: 3px 10px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], input[type=search], select, textarea { min-height: 32px; padding: 5px 10px; }
@media (max-width: 600px) {
  .main > .page-head.cp { display: flex; flex-wrap: wrap; gap: 8px; }
  .page-head.cp > .cp-l { flex: 1 1 auto; }
  .page-head.cp > .cp-r { flex: 0 1 auto; margin-left: auto; }
  .page-head.cp > .cp-c { flex: 1 1 100%; order: 3; }
}

/* ---- NEW-71: Kanban kiểu Odoo (bản mẫu C) — cột không khung, tiêu đề đậm + số + tổng tiền, thẻ trắng góc 6 px ---- */
.kanban { gap: 12px; }
.kanban-col { background: transparent; border: 0; border-radius: var(--radius); padding: 0; min-height: 160px; }
.kanban-col.over { background: var(--brand-soft); outline: 2px dashed var(--brand); outline-offset: 2px; }
.kanban-col h3 { font-size: 15px; font-weight: 700; margin: 4px 4px 10px; padding-bottom: 8px; border-bottom: 3px solid var(--line); }
.kanban-col h3 .badge { background: none; color: var(--muted); font-weight: 500; font-size: 14px; padding: 0; }
.kanban-col h3 .badge::before { content: "("; } .kanban-col h3 .badge::after { content: ")"; }
.kanban-col h3 .kanban-sum { color: var(--ink); font-weight: 600; font-size: 13px; font-variant-numeric: tabular-nums; }
.kanban-card { border-radius: var(--radius); padding: 10px 12px; box-shadow: 0 1px 1px rgb(3 0 14 / .04); }
.kanban-card:hover { border-color: var(--btn-border); }
.kanban-card .kanban-title a { color: var(--ink); font-weight: 700; }
.kanban-col > .empty, .kanban-cards > .empty { padding: 16px; border: 1px dashed var(--line); border-radius: var(--radius); }

/* NEW-100: Cần giao lại / Dự án sắp hết hạn / KPI Account (views/renewals.js) */
.rg-all { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; margin: 0 12px 6px 0; }
table.data.kpi-account tr.total td { background: var(--surface-2); font-weight: 600; }
table.data.kpi-account td.num { white-space: nowrap; }
/* NEW-103: Hiệu suất vận hành (views/ops_report.js) + Nghiệm thu theo hạng mục của dự án (views/projects.js) */
.ops-appendix { margin-top: 14px; } .ops-appendix > summary { cursor: pointer; padding: 6px 0; }
table.data.acc-items td.num { white-space: nowrap; } table.data.acc-items tr.grp td.num { font-weight: 600; }
table.data.acc-items td.acc-desc { padding-left: 22px; max-width: 360px; }
