/* ChatHub v7 */
/* Lọc theo thẻ màu */
#tagFilter { display: none; }
.tag-dots { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.tdot { display: inline-flex; align-items: center; gap: 0; border: 1px solid transparent; background: transparent; border-radius: 20px; padding: 3px; cursor: pointer; font: inherit; font-size: 12px; color: var(--text); }
.tdot i { width: 16px; height: 16px; border-radius: 50%; background: var(--c); display: block; box-shadow: inset 0 0 0 2px #fff6; }
.tdot span { max-width: 0; overflow: hidden; white-space: nowrap; transition: max-width .15s; }
.tdot:hover span, .tdot.on span { max-width: 120px; padding: 0 6px 0 5px; }
.tdot.on { border-color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); }
.small-chip { font-size: 11px; padding: 2px 8px; }
.cf-bar .chip { font-size: 11px; padding: 3px 9px; }
.post-chip { display: flex; align-items: center; gap: 4px; font-size: 12px; background: var(--accent-soft); border-radius: 8px; padding: 2px 4px 2px 10px; }
.post-chip span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.post-chip .icon-btn { font-size: 13px; }

/* Màu trang trên danh sách hội thoại */
.conv.pc { box-shadow: inset 3px 0 0 var(--pc); }
.kind.ok { color: #0f8a5f; border-color: #10b98155; background: #10b98112; }
#privBtn.done { color: var(--ok); }
body.role-viewer .composer, body.role-viewer #orderBtn, body.role-viewer #privBtn, body.role-viewer #newOrderBtn, body.role-viewer #saveCustomer { display: none !important; }

/* Tiêu đề trang có bộ chọn */
.view-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.view-head h2 { margin: 0 !important; }
.view-head select { width: auto; max-width: 260px; }

/* Bài viết */
.post-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; margin-top: 12px; }
.post-card { border-left: 4px solid var(--pc); display: flex; flex-direction: column; gap: 8px; }
.post-top { display: flex; align-items: center; gap: 6px; }
.pdot { width: 8px; height: 8px; border-radius: 50%; background: var(--pc); }
.post-title { font-weight: 700; font-size: 15px; }
.post-stats { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--muted); }
.post-stats b { color: var(--text); }
.post-stats .warn b { color: var(--accent); }
.post-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: space-between; }

/* Biểu đồ */
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; margin: 6px 0 8px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.k-in { background: var(--accent); } .k-cm { background: #f59e0b; } .k-new { background: #0ea5e9; border-radius: 50% !important; } .k-ord { background: #10b981; border-radius: 50% !important; }
.chart-wrap { overflow-x: auto; }
.chart { width: 100%; min-width: 520px; height: auto; display: block; }
.chart .gl { stroke: var(--line); stroke-width: 1; }
.chart .ax { fill: var(--muted); font-size: 10px; }
.chart .b-in { fill: var(--accent); opacity: .85; }
.chart .b-cm { fill: #f59e0b; opacity: .85; }
.chart g:hover rect.b-in, .chart g:hover rect.b-cm { opacity: 1; }
.chart .l-new { stroke: #0ea5e9; stroke-width: 2; } .chart .l-new-dot { fill: #0ea5e9; }
.chart .l-ord { stroke: #10b981; stroke-width: 2; } .chart .l-ord-dot { fill: #10b981; }
.hours { display: flex; align-items: flex-end; gap: 2px; height: 140px; margin: 10px 0 6px; }
.hcol { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; align-items: center; min-width: 0; }
.hcol span { font-size: 10px; color: var(--muted); height: 14px; }
.hbar { width: 100%; background: color-mix(in srgb, var(--accent) 45%, transparent); border-radius: 3px 3px 0 0; min-height: 1px; }
.hbar.peak { background: var(--accent); }

/* Cài đặt có menu con */
.set-page:not(.hidden) { display: grid; grid-template-columns: 230px minmax(0, 1fr); grid-template-rows: auto 1fr; gap: 0 20px; align-content: start; }
.set-page > h2 { grid-column: 1 / -1; }
.set-nav { display: flex; flex-direction: column; gap: 4px; align-self: start; position: sticky; top: 0; }
.set-nav button { font: inherit; text-align: left; border: 0; background: transparent; color: var(--text); padding: 10px 12px; border-radius: 10px; cursor: pointer; display: flex; gap: 8px; align-items: center; }
.set-nav button:hover { background: var(--panel); }
.set-nav button.on { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.set-body { grid-template-columns: minmax(0, 1fr) !important; max-width: 820px; align-content: start; }
.set-body > .card { margin-bottom: 0; }
.mode-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; margin-top: 8px; }
.mode-card { font: inherit; text-align: left; display: flex; gap: 10px; align-items: center; border: 1px solid var(--line); background: var(--bg); color: var(--text); border-radius: 10px; padding: 12px; cursor: pointer; }
.mode-card > span:last-child { display: flex; flex-direction: column; gap: 2px; }
.mode-card .ic { font-size: 20px; }
.mode-card.on { border-color: var(--accent); background: var(--accent-soft); }
.mode-card.on b { color: var(--accent); }
.switch-row { justify-content: space-between; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.switch-row:last-of-type { border-bottom: 0; }
.switch-row > span { display: flex; flex-direction: column; gap: 2px; }
input.switch { appearance: none; -webkit-appearance: none; width: 40px !important; height: 22px; border-radius: 11px; background: var(--line); position: relative; cursor: pointer; flex: 0 0 40px; transition: background .15s; border: 0; padding: 0; margin: 0; }
input.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: 0 1px 3px #0003; }
input.switch:checked { background: var(--accent); }
input.switch:checked::after { left: 21px; }
.page-color { display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-top: 8px; border-radius: 10px; background: var(--bg); border-left: 4px solid var(--pc); }
.page-color input[type=color] { width: 44px; height: 30px; padding: 2px; border-radius: 8px; flex: 0 0 44px; }
.page-color .pill { width: 50px; height: 16px; border-radius: 8px; background: var(--pc); }
.perm-matrix { margin-top: 14px; font-size: 13px; }
.perm-matrix th, .perm-matrix td { text-align: center; padding: 6px; }
.perm-matrix td:first-child, .perm-matrix th:first-child { text-align: left; }
.role-sel { width: auto; }

@media (max-width: 760px) {
  .set-page:not(.hidden) { display: block; }
  .set-nav { flex-direction: row; overflow-x: auto; position: static; margin-bottom: 12px; padding-bottom: 4px; }
  .set-nav button { white-space: nowrap; padding: 8px 12px; background: var(--panel); border: 1px solid var(--line); }
  .set-nav button.on { border-color: var(--accent); }
  .post-list { grid-template-columns: 1fr; }
  .switch-row { font-size: 13px; }
}
@media (max-width: 760px) { #privBtn .lbl { display: none; } }
@media (max-width: 760px) { .chat-head #assignSelect { max-width: 112px; } .chat-head .btn { padding: 7px 9px; } .chat-head .icon-btn { padding: 4px 6px; } }
