/* Giao diện kiểu Odoo + nhận diện Zafago — đợt 1 (28/10/2026, chủ dự án chọn hướng C cho mọi CRM; cùng kiểu crmnew HQ-71).
   Nạp SAU components.css / column-filter.css: chỉ đổi hình thức, không đổi id / class mà JS dùng. Màu lấy từ biến ở theme.css.
   Phẳng: không gradient, không làm mờ nền, không bóng phát sáng; bóng nhẹ chỉ cho lớp nổi (menu thả, hộp thoại). */

/* Menu dọc: css/sidebar.css (v2 theo mẫu Zafago, 28/10/2026). Icon nét của control panel: */
.cp-l .ic, .cp-c .ic { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

/* ================= Control panel (js/core/control-panel.js) ================= */
.topbar.cp { display: grid; grid-template-columns: minmax(0, auto) minmax(0, 1fr) auto; align-items: center; gap: 8px 16px; padding: 8px 16px; }
.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; font-size: 14px; }
.cp-new-slot .btn.cp-new { background: var(--brand-ink); color: var(--on-brand); border-color: var(--brand-ink); font-weight: 600; }
.cp-main-slot { display: flex; gap: 6px; flex: none; }
.cp-main-slot:empty { display: none; }
.cp-main-slot .btn.cp-main { min-height: 30px; padding: 3px 12px; font-size: 14px; background: var(--control-bg); color: var(--ink); border: 1px solid var(--border); }
.cp-main-slot .btn.cp-main:hover { background: var(--surface-hover); }
.cp-bc { display: flex; align-items: center; gap: 8px; min-width: 0; }
.cp-bc > div { display: flex; align-items: center; gap: 8px; min-width: 0; }
.topbar.cp h2.cp-title { font-size: 18px; line-height: 24px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cp-gear { position: relative; flex: none; }
.cp-gear[hidden] { display: none; }
.cp-gear-btn { width: 28px; height: 28px; display: grid; place-items: center; border: 0; background: none; color: var(--text-muted); border-radius: var(--radius-btn); cursor: pointer; padding: 0; }
.cp-gear-btn .ic { width: 16px; height: 16px; }
.cp-gear-btn:hover, .cp-gear-btn[aria-expanded="true"] { background: var(--surface-hover); color: var(--ink); }
.cp-gear-pop { position: absolute; left: 0; top: calc(100% + 6px); min-width: 220px; padding: 4px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 4px 16px var(--shadow); z-index: 50; }
.cp-gear-pop[hidden] { display: none; }
.cp-gear-pop .btn { display: flex; width: 100%; justify-content: flex-start; text-align: left; border: 0; background: none; padding: 7px 10px; min-height: 0; border-radius: var(--radius-btn); color: var(--ink); font-weight: 400; font-size: 14px; }
.cp-gear-pop .btn:hover { background: var(--surface-hover); }
.cp-c { position: relative; min-width: 0; justify-self: center; width: 100%; max-width: 640px; }
.cp-c:empty { display: none; }
.cp-search { min-height: 34px; border: 1px solid var(--border); border-radius: var(--radius-btn); display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; padding: 2px 0 2px 8px; background: var(--control-bg); min-width: 0; }
.cp-search:focus-within { border-color: var(--brand); }
.cp-sic { color: var(--text-muted); display: grid; place-items: center; flex: none; }
.cp-sic .ic { width: 16px; height: 16px; }
.cp-facets { display: contents; }
.cp-facet { display: inline-flex; align-items: center; max-width: 100%; height: 24px; border-radius: 3px; background: var(--surface-neutral); color: var(--ink); font-size: 13px; overflow: hidden; }
.cp-fk { width: 22px; height: 24px; display: grid; place-items: center; background: var(--brand-ink); color: var(--on-brand); flex: none; }
.cp-fk .ic { width: 12px; height: 12px; }
.cp-fv { padding: 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cp-x { width: 22px; height: 24px; display: grid; place-items: center; border: 0; background: none; color: var(--text-muted); cursor: pointer; padding: 0; }
.cp-x .ic { width: 12px; height: 12px; }
.cp-x:hover { color: var(--danger); }
.cp-qslot { flex: 1 1 140px; min-width: 120px; display: flex; }
.cp-qslot[hidden], .cp-qslot:empty { display: none; }
.cp-search .cp-q, .cp-qslot input { flex: 1; width: 100%; min-width: 0; border: 0 !important; outline: 0; box-shadow: none !important; background: transparent; padding: 4px 2px !important; font-size: 14px; color: var(--ink); }
.cp-qslot .id-search { flex: 1; display: flex; }
.cp-qslot .id-search-chips { border: 0; border-radius: 0; }
.cp-ph { flex: 1; text-align: left; border: 0; background: none; color: var(--text-muted); font-size: 14px; cursor: pointer; padding: 4px 2px; }
.cp-ph[hidden] { display: none; }
.cp-toggle { margin-left: auto; width: 32px; align-self: stretch; min-height: 28px; border: 0; border-left: 1px solid var(--border); background: none; color: var(--text-muted); cursor: pointer; display: grid; place-items: center; padding: 0; }
.cp-toggle[hidden] { display: none; }
.cp-toggle:hover, .cp-toggle[aria-expanded="true"] { color: var(--ink); background: var(--surface-hover); }
.cp-panel { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 4px 16px var(--shadow); z-index: 50; padding: 12px 16px; }
.cp-panel[hidden] { display: none; }
.cp-col h4 { margin: 0 0 8px; font-size: 14px; 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-fbody .toolbar.cp-folded { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; margin: 0; padding: 0; position: static; background: none; }
.cp-fbody .toolbar.cp-folded > select, .cp-fbody .toolbar.cp-folded > input { width: 100% !important; }
.cp-fbody .toolbar.cp-folded > label.checkbox-inline, .cp-fbody .toolbar.cp-folded > span.checkbox-inline { grid-column: 1 / -1; }
.cp-fbody .toolbar.cp-folded > label.checkbox-inline[for] { grid-column: auto; align-self: center; }
.cp-fact { grid-column: 1 / -1; display: flex; gap: 8px; justify-content: flex-end; padding-top: 8px; border-top: 1px solid var(--line-2); margin-top: 4px; }
.cp-fact .btn:first-child { background: var(--brand-ink); color: var(--on-brand); border-color: var(--brand-ink); }
.cp-r { display: flex; align-items: center; gap: 8px; justify-self: end; }
.cp-pager:empty { display: none; }
.topbar.cp .pagination.cp-pg { margin: 0; gap: 4px; flex-wrap: nowrap; white-space: nowrap; color: var(--ink); }
.cp-pg > span { padding: 0 6px; font-variant-numeric: tabular-nums; }
.cp-pg .btn { min-height: 28px; padding: 0 9px; }
.cp-pg .btn.cp-arrow { width: 30px; padding: 0; font-size: 16px; }
.cp-pg .page-jump-input { width: 68px; height: 28px; padding: 2px 6px; }
@media (max-width: 1100px) {
  .topbar.cp { grid-template-columns: minmax(0, 1fr) auto; }
  .cp-c { grid-column: 1 / -1; grid-row: 2; max-width: none; justify-self: stretch; }
}
@media (max-width: 640px) {
  .topbar.cp { padding: 8px 12px; }
  .cp-pg .page-jump-input, .cp-pg #clientsPageGoBtn, .cp-pg [id$="PageGoBtn"] { display: none; }
  .cp-fbody .toolbar.cp-folded { grid-template-columns: minmax(0, 1fr); }
}

/* ================= Thanh lọc / tham số còn trong trang ================= */
.toolbar { gap: 8px; margin-bottom: 12px; }
.toolbar input, .toolbar select { padding: 5px 8px; min-height: 32px; border-radius: var(--radius-btn); font-size: 13px; }
.toolbar input:focus, .toolbar select:focus { outline: none; border-color: var(--brand); }
.toolbar.toolbar-sticky { padding: 4px 0; }
.page-body > .toolbar:first-child { margin-bottom: 12px; }
.subtabs { gap: 0; }
.subtab { border-radius: 0 !important; }
.subtab.active { border-bottom-color: var(--brand) !important; color: var(--ink); font-weight: 600; }

/* ================= Bảng kiểu Odoo: gọn, tiêu đề dính, số căn phải ================= */
.card { box-shadow: none; }
table { font-size: 13px; font-variant-numeric: tabular-nums; }
thead th { color: var(--ink); font-weight: 600; padding: 7px 10px; border-bottom: 1px solid var(--border); background: var(--card); }
tbody td { padding: 6px 10px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
th.num, td.num { text-align: right; white-space: nowrap; }
td.nw { white-space: nowrap; }
.table-scroll { border: 1px solid var(--border); border-radius: var(--radius); max-height: calc(100vh - 210px); }
.table-scroll table thead th { box-shadow: inset 0 -1px 0 var(--border); border-bottom: 0; }
/* Trang danh sách chỉ có bảng (Clients, Accounts, Người dùng, Nhật ký — class card-list): bỏ khung trắng ngoài để không thành
   2 lớp viền, lề trên/dưới/phải lệch nhau (28/10/2026). Bảng tự có viền + nền trắng; banner/chip phía trên cách bảng 8px. */
.page-body > .card.card-list { padding: 0; border: 0; background: transparent; }
.card-list > .table-scroll { background: var(--card); }
.card-list > :not(.table-scroll):not(.empty-state) { margin-top: 0; margin-bottom: 8px; }
.pagination { gap: 6px; }
.pagination .btn { min-height: 28px; }
.page-jump-input { border-radius: var(--radius-btn); }
.empty-state { padding: 32px 0; }

/* Nhãn: góc vuông nhẹ, phẳng */
.badge { border-radius: 3px; padding: 1px 7px; font-weight: 600; background: var(--brand-soft); color: var(--brand-hover); }
:root[data-theme="dark"] .badge { color: var(--brand); }
.badge.warn { background: var(--warning-soft); color: var(--warning-text); }
.badge.off { background: var(--surface-neutral); color: var(--text-muted); }
.badge.success { background: var(--success-soft); color: var(--success); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
/* Nền tảng: giữ màu nhận diện TikTok / Meta / Zalo, phẳng (nền nhạt, chữ màu) */
.badge.platform-badge { border: 0; background: var(--surface-neutral); color: var(--ink); }
.badge.platform-badge[data-platform="TikTok"] { background: var(--pf-tiktok-soft); color: var(--pf-tiktok); }
.badge.platform-badge[data-platform="Meta"] { background: var(--pf-meta-soft); color: var(--pf-meta); }
.badge.platform-badge[data-platform="Zalo"] { background: var(--pf-zalo-soft); color: var(--pf-zalo); }
tr.group-tier td { background: var(--surface-neutral); color: var(--ink); }
.toast { border-radius: var(--radius); background: var(--ink); color: var(--card); }

/* Menu hồ sơ / menu dòng: lớp nổi phẳng */
.profile-dropdown, .topup-row-menu { border-radius: var(--radius); box-shadow: 0 4px 16px var(--shadow); }

/* ================= Hộp thoại = form view (Odoo): tờ trắng, tiêu đề + nút thông minh, nhóm trường phẳng ================= */
.modal-overlay { background: var(--overlay); }
.modal-box { border-radius: var(--radius); box-shadow: 0 8px 32px var(--shadow); }
.modal-box > h3 { font-size: 20px; font-weight: 600; color: var(--ink); padding-bottom: 12px; border-bottom: 1px solid var(--line-2); }
.modal-box > .fv-head { position: sticky; top: -24px; z-index: 3; margin: -24px -24px 14px; padding: 18px 24px 12px; background: var(--card); border-bottom: 1px solid var(--line-2); }
.fv-titles { min-width: 0; flex: 1; }
.fv-head h3.fv-sub { margin: 2px 0 0; font-size: 13px; font-weight: 400; color: var(--text-muted); position: static; padding: 0; border: 0; background: none; }
.fv-acts[hidden] { display: none; }
.modal-section { background: transparent; border: 0; border-radius: 0; padding: 0 0 12px; margin-bottom: 12px; }
.modal-section--accent, .modal-section--ink, .modal-section--amber { background: transparent; border: 0; }
.modal-section-title { font-size: 12px; font-weight: 700; letter-spacing: .04em; color: var(--text-muted); text-transform: uppercase; padding-bottom: 6px; border-bottom: 1px solid var(--line-2); margin-bottom: 10px; }
.modal-section--accent .field label:not(.checkbox-inline) { color: var(--text-muted); }
.field label:not(.checkbox-inline) { font-weight: 600; color: var(--ink); font-size: 13px; }
.field.required > label:not(.checkbox-inline) { color: var(--danger); }

/* Trang bản ghi Client (form view): breadcrumb + nút thông minh (js/core/client-record.js) */
.fv-crumb { display: flex; align-items: baseline; gap: 6px; font-size: 20px; font-weight: 600; min-width: 0; }
.fv-crumb .fv-root { color: var(--brand); cursor: pointer; background: none; border: 0; padding: 0; font: inherit; font-weight: 500; }
.fv-crumb .fv-root:hover { text-decoration: underline; }
.fv-crumb .fv-sep { color: var(--text-muted); font-weight: 400; }
.fv-crumb .fv-cur { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fv-sub { display: block; font-size: 13px; font-weight: 400; color: var(--text-muted); margin-top: 2px; }
.fv-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.fv-acts { display: flex; align-items: center; gap: 6px; position: relative; }
.fv-more-btn { min-height: 30px; padding: 0 10px; }
.fv-more-pop { position: absolute; right: 0; top: calc(100% + 4px); min-width: 200px; padding: 4px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 4px 16px var(--shadow); z-index: 10; }
.fv-more-pop[hidden] { display: none; }
.fv-more-pop button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 7px 10px; border-radius: var(--radius-btn); color: var(--ink); font: 400 14px/1.4 var(--font); cursor: pointer; }
.fv-more-pop button:hover { background: var(--surface-hover); }
.fv-more-pop button.danger { color: var(--danger); }
.fv-smart { display: flex; flex-wrap: wrap; justify-content: flex-end; border: 1px solid var(--border); border-radius: var(--radius); margin: 0 0 14px; background: var(--card); }
.fv-smart[hidden] { display: none; }
.fv-sb { display: flex; align-items: center; gap: 10px; min-width: 130px; padding: 8px 14px; border: 0; border-left: 1px solid var(--border); background: none; color: var(--ink); cursor: pointer; text-align: left; font: inherit; }
.fv-sb:first-child { border-left: 0; }
.fv-sb:hover { background: var(--surface-hover); }
.fv-sb .ic { width: 20px; height: 20px; flex: none; stroke: var(--text-muted); fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.fv-sb b { display: block; font-size: 15px; line-height: 18px; color: var(--brand-hover); font-variant-numeric: tabular-nums; }
:root[data-theme="dark"] .fv-sb b { color: var(--brand); }
.fv-sb span { display: block; font-size: 12px; color: var(--text-muted); line-height: 16px; }
@media (max-width: 640px) {
  .fv-smart { justify-content: stretch; }
  .fv-sb { flex: 1 1 50%; min-width: 0; border-left: 0; border-top: 1px solid var(--border); }
}

/* Phân trang kiểu Odoo: bấm "1-80 / N" để gõ khoảng (control-panel.js editableRange) */
.cp-range { cursor: pointer; padding: 2px 6px; border-radius: 4px; }
.cp-range:hover, .cp-range:focus-visible { background: var(--line-2, #efeff3); outline: none; }
.cp-range-input { width: 76px; height: 26px; padding: 0 6px; font: inherit; text-align: right; border: 1px solid var(--brand, #2000b1); border-radius: 4px; }
