/* =====================================================================
   WorkHub — giao diện. Màu dùng biến (design tokens) để có chế độ sáng/tối.
   Chế độ tối bật bằng data-bs-theme="dark" trên <html> (Bootstrap 5.3).
   ===================================================================== */
:root {
  --wh-primary: #0068ff;
  --wh-primary-hover: #0057d6;
  --wh-primary-soft: #e8f1ff;
  --wh-primary-softer: #f3f8ff;
  --wh-on-primary: #fff;
  --wh-app-bg: #f2f4f7;
  --wh-surface: #ffffff;
  --wh-surface-2: #f6f7f9;
  --wh-surface-3: #eceff3;
  --wh-border: #e4e7ec;
  --wh-border-strong: #d0d5dd;
  --wh-text: #1d2433;
  --wh-text-2: #475467;
  --wh-muted: #667085;
  --wh-hover: #f2f4f7;
  --wh-chat-bg: #eef2f7;
  --wh-bubble-in: #ffffff;
  --wh-bubble-out: #dcebff;
  --wh-bubble-out-text: #10223f;
  --wh-success: #12b76a;
  --wh-danger: #d92d20;
  --wh-warning: #f79009;
  --wh-mark: #fff3a3;
  --wh-shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
  --wh-shadow: 0 4px 12px rgba(16, 24, 40, .08);
  --wh-shadow-lg: 0 12px 32px rgba(16, 24, 40, .16);
  --wh-radius: 12px;
  --wh-radius-sm: 8px;
  --wh-sidebar-w: 340px;
  --wh-nav-h: 54px;
  --bs-primary: var(--wh-primary);
  --bs-primary-rgb: 0, 104, 255;
  --bs-link-color: var(--wh-primary);
  --bs-link-color-rgb: 0, 104, 255;
  --bs-body-font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

[data-bs-theme="dark"] {
  --wh-primary: #4d94ff;
  --wh-primary-hover: #74abff;
  --wh-primary-soft: #1b2b45;
  --wh-primary-softer: #17233a;
  --wh-on-primary: #0b1220;
  --wh-app-bg: #0f141c;
  --wh-surface: #161c26;
  --wh-surface-2: #1c2330;
  --wh-surface-3: #242c3a;
  --wh-border: #2a3342;
  --wh-border-strong: #3a4556;
  --wh-text: #e6e9ef;
  --wh-text-2: #b8c0cc;
  --wh-muted: #8a94a6;
  --wh-hover: #1f2735;
  --wh-chat-bg: #0f151e;
  --wh-bubble-in: #1e2633;
  --wh-bubble-out: #1d3a66;
  --wh-bubble-out-text: #e9f1ff;
  --wh-mark: #6b5a00;
  --wh-shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --wh-shadow: 0 4px 12px rgba(0, 0, 0, .45);
  --wh-shadow-lg: 0 12px 32px rgba(0, 0, 0, .6);
  --bs-body-bg: var(--wh-app-bg);
  --bs-body-color: var(--wh-text);
}

/* ---------- Nền tảng ---------- */
html { font-size: 14px; }
@media (min-width: 768px) { html { font-size: 15px; } }
body { background: var(--wh-app-bg); color: var(--wh-text); -webkit-font-smoothing: antialiased; }
a { color: var(--wh-primary); }
.min-w-0 { min-width: 0; }
.flex-none { flex: none; }
mark { padding: 0; background: var(--wh-mark); color: inherit; border-radius: 2px; }

.btn-primary { --bs-btn-bg: var(--wh-primary); --bs-btn-border-color: var(--wh-primary); --bs-btn-hover-bg: var(--wh-primary-hover); --bs-btn-hover-border-color: var(--wh-primary-hover); --bs-btn-active-bg: var(--wh-primary-hover); --bs-btn-color: var(--wh-on-primary); --bs-btn-hover-color: var(--wh-on-primary); --bs-btn-disabled-bg: var(--wh-primary); --bs-btn-disabled-border-color: var(--wh-primary); }
.btn-outline-primary { --bs-btn-color: var(--wh-primary); --bs-btn-border-color: var(--wh-primary); --bs-btn-hover-bg: var(--wh-primary); --bs-btn-hover-border-color: var(--wh-primary); --bs-btn-hover-color: var(--wh-on-primary); }
.btn-light { --bs-btn-bg: var(--wh-surface-2); --bs-btn-border-color: transparent; --bs-btn-hover-bg: var(--wh-surface-3); --bs-btn-hover-border-color: transparent; --bs-btn-color: var(--wh-text-2); --bs-btn-hover-color: var(--wh-text); --bs-btn-active-bg: var(--wh-surface-3); }
.btn:focus-visible, .form-control:focus, .form-select:focus, .form-check-input:focus {
  box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--wh-primary) 30%, transparent); border-color: var(--wh-primary);
}
.form-control, .form-select { border-color: var(--wh-border-strong); background-color: var(--wh-surface); color: var(--wh-text); }
.form-control::placeholder { color: var(--wh-muted); }
.card { --bs-card-bg: var(--wh-surface); --bs-card-border-color: var(--wh-border); border-radius: var(--wh-radius); box-shadow: var(--wh-shadow-sm); }
.modal-content { background: var(--wh-surface); border-color: var(--wh-border); border-radius: var(--wh-radius); }
.text-secondary { color: var(--wh-muted) !important; }
.badge.text-bg-light { background: var(--wh-surface-3) !important; color: var(--wh-text-2) !important; }
.form-floating > .form-control::placeholder { color: var(--bs-secondary-color); text-align: end; }
.form-floating > .form-control:focus::placeholder { text-align: start; }

/* ---------- Thanh điều hướng ---------- */
.wh-nav { height: var(--wh-nav-h); background: var(--wh-surface); border-bottom: 1px solid var(--wh-border); box-shadow: var(--wh-shadow-sm); }
.wh-nav .navbar-collapse { background: var(--wh-surface); }
.wh-brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: var(--wh-text) !important; letter-spacing: -.01em; }
/* Logo "Alo": bong bóng chat bo tròn, gradient xanh → tím, đuôi nhỏ góc dưới trái. */
.wh-brand-mark {
  position: relative; height: 30px; padding: 0 9px; border-radius: 15px 15px 15px 5px; display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: .92rem; letter-spacing: -.02em; background: linear-gradient(135deg, #0068ff 0%, #7c3aed 100%);
  box-shadow: 0 2px 8px rgba(0, 104, 255, .25);
}
.wh-nav .nav-link { display: inline-flex; align-items: center; gap: 6px; color: var(--wh-text-2) !important; border-radius: 8px; padding: 6px 10px !important; }
.wh-nav .nav-link:hover { background: var(--wh-hover); color: var(--wh-text) !important; }
.wh-nav .nav-link.active { color: var(--wh-primary) !important; background: var(--wh-primary-soft); font-weight: 600; }
.theme-toggle { width: 36px; height: 36px; border-radius: 50%; border: 0; background: transparent; color: var(--wh-text-2); display: inline-flex; align-items: center; justify-content: center; }
.theme-toggle:hover { background: var(--wh-hover); color: var(--wh-text); }
@media (max-width: 575.98px) {
  .wh-nav .navbar-collapse { position: absolute; top: var(--wh-nav-h); left: 0; right: 0; z-index: 1030; padding: 8px 12px; border-bottom: 1px solid var(--wh-border); box-shadow: var(--wh-shadow); }
}

.landing { max-width: 680px; margin: 10vh auto 0; }
.landing-mark { width: 72px; height: 72px; border-radius: 22px; font-size: 2rem; margin: 0 auto 20px; }

/* ---------- Avatar ---------- */
.avatar { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; flex: none; background: var(--wh-surface-3); }
.avatar-lg { width: 52px; height: 52px; }
.avatar-xl { width: 88px; height: 88px; font-size: 2.2rem; }
.avatar-fallback { display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: 600; background: linear-gradient(135deg, #3b82f6, #6366f1); }
.avatar-cloud { display: inline-flex; align-items: center; justify-content: center; color: #fff; background: linear-gradient(135deg, #0068ff, #00b8d4); }
.avatar-wrap { position: relative; display: inline-flex; flex: none; }
.online-dot { position: absolute; right: 0; bottom: 0; width: 12px; height: 12px; border-radius: 50%; background: var(--wh-success); border: 2px solid var(--wh-surface); }
.online-text { color: var(--wh-success); }

/* ---------- Avatar / tên bấm được, hồ sơ ---------- */
.avatar-btn, .msg-avatar { border: 0; padding: 0; background: none; border-radius: 50%; cursor: pointer; flex: none; display: inline-flex; }
.avatar-btn:hover .avatar, .msg-avatar:hover .avatar { box-shadow: 0 0 0 2px var(--wh-primary); }
.avatar-btn:focus-visible, .msg-avatar:focus-visible { outline: 3px solid var(--wh-primary); outline-offset: 2px; }
.name-btn { display: block; max-width: 100%; border: 0; padding: 0; background: none; color: var(--wh-text); text-align: left; }
.name-btn:hover { color: var(--wh-primary); }
button.msg-from { display: block; border: 0; padding: 0; background: none; text-align: left; }
button.msg-from:hover { text-decoration: underline; }
.profile-dialog { max-width: 400px; }
.profile-cover { position: relative; height: 140px; background: linear-gradient(135deg, #0068ff 0%, #00b8d4 100%); background-size: cover; background-position: center; }
.profile-close { position: absolute; top: 10px; right: 10px; background-color: rgba(255,255,255,.85); border-radius: 50%; padding: 8px; opacity: 1; }
.profile-head { display: flex; flex-direction: column; align-items: center; text-align: center; margin-top: -48px; }
.profile-avatar { border: 4px solid var(--wh-surface); box-shadow: var(--wh-shadow); background-color: var(--wh-surface-3); }
.profile-bio { margin-top: 10px; padding: 8px 12px; border-radius: 10px; background: var(--wh-surface-2); color: var(--wh-text-2); white-space: pre-wrap; font-size: .9rem; max-height: 120px; overflow-y: auto; width: 100%; }
.profile-online { background: color-mix(in srgb, var(--wh-success) 15%, var(--wh-surface)); color: var(--wh-success); }
.profile-rows { margin-top: 14px; border-top: 1px solid var(--wh-border); }
.profile-rows:empty { display: none; }
.profile-row { display: flex; justify-content: space-between; gap: 12px; padding: 9px 2px; border-bottom: 1px solid var(--wh-border); font-size: .92rem; }
.profile-members { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.profile-member { border: 0; padding: 0; background: none; border-radius: 50%; }
.profile-member .avatar { width: 36px; height: 36px; }
.profile-member:hover .avatar { box-shadow: 0 0 0 2px var(--wh-primary); }
.member-row .avatar { cursor: pointer; }

/* ---------- Trang tài khoản ---------- */
.account-card { border-radius: var(--wh-radius); transition: box-shadow .15s; }
.account-card:hover { box-shadow: var(--wh-shadow); }
.qr-box { min-height: 240px; display: flex; align-items: center; justify-content: center; }
.qr-img { width: 240px; height: 240px; image-rendering: pixelated; background: #fff; padding: 8px; border-radius: 12px; }

/* =====================================================================
   Trang chat (toàn màn hình)
   ===================================================================== */
body.full-height { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.app-main { flex: 1; min-height: 0; }
.chat-app { display: flex; height: 100%; background: var(--wh-surface); }

/* ---------- Thanh bên ---------- */
.chat-sidebar { width: var(--wh-sidebar-w); flex: none; border-right: 1px solid var(--wh-border); display: flex; flex-direction: column; min-height: 0; background: var(--wh-surface); }
.chat-sidebar > * { min-width: 0; max-width: 100%; }
.sidebar-head { padding: 12px 12px 10px; border-bottom: 1px solid var(--wh-border); }
.sidebar-tabs { display: flex; gap: 4px; padding: 3px; border-radius: 10px; background: var(--wh-surface-2); }
.sidebar-tab { flex: 1; border: 0; border-radius: 8px; padding: 6px 0; background: none; font-size: .875rem; font-weight: 600; color: var(--wh-muted); }
.sidebar-tab:hover { color: var(--wh-text); }
.sidebar-tab.active { background: var(--wh-surface); color: var(--wh-primary); box-shadow: var(--wh-shadow-sm); }
.search-box { position: relative; flex: 1; min-width: 0; }
.search-box svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--wh-muted); pointer-events: none; }
.search-box .form-control { padding-left: 32px; border-radius: 9px; background: var(--wh-surface-2); border-color: transparent; }
.search-box .form-control:focus { background: var(--wh-surface); }

.conv-filters { display: flex; flex-wrap: wrap; gap: 5px; }
.filter-chip {
  display: inline-flex; align-items: center; gap: 5px; flex: none; height: 26px; padding: 0 10px; border-radius: 13px;
  border: 1px solid var(--wh-border); background: var(--wh-surface); font-size: .8rem; color: var(--wh-text-2); white-space: nowrap;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis;
}
.filter-chip:hover { background: var(--wh-hover); }
.filter-chip.active { background: var(--wh-primary); border-color: var(--wh-primary); color: var(--wh-on-primary); }
.filter-manage { color: var(--wh-muted); }
.filter-toggle { position: relative; width: 34px; display: inline-flex; align-items: center; justify-content: center; padding: 0; border-radius: 9px; }
.filter-toggle[aria-expanded="true"] { background: var(--wh-primary-soft); color: var(--wh-primary); }
.filter-toggle.active { color: var(--wh-primary); }
.filter-badge { position: absolute; top: 3px; right: 3px; width: 8px; height: 8px; border-radius: 50%; background: var(--wh-danger); border: 1px solid var(--wh-surface); }
.label-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; }
.label-dot.lg { width: 16px; height: 16px; }
.label-tag {
  display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 4px; font-size: .68rem; font-weight: 600; vertical-align: 1px;
  color: var(--label); background: color-mix(in srgb, var(--label) 15%, var(--wh-surface)); max-width: 90px; overflow: hidden; text-overflow: ellipsis;
}
/* Dấu nền tảng: Z = Zalo, M = Messenger */
.pf-mark {
  display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; border-radius: 50%; flex: none;
  font-size: .62rem; font-weight: 800; line-height: 1; color: #fff; vertical-align: -2px;
}
.pf-zalo { background: #0068ff; }
.pf-messenger { background: linear-gradient(45deg, #0099ff 0%, #a033ff 60%, #ff5280 100%); }
.pf-whatsapp { background: #25d366; }
.pf-corner { position: absolute; left: -2px; bottom: -2px; border: 2px solid var(--wh-surface); width: 18px; height: 18px; }
.acct-badge .pf-mark { width: 12px; height: 12px; font-size: .5rem; margin-left: -2px; }
.acct-badge:has(.pf-mark)::before { display: none; }

/* Nhãn tài khoản Zalo (hộp thư chung) */
.acct-badge {
  display: inline-flex; align-items: center; gap: 4px; flex: none; max-width: 110px; height: 18px; padding: 0 7px 0 6px; border-radius: 9px;
  font-size: .68rem; font-weight: 600; line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: var(--acct); background: color-mix(in srgb, var(--acct) 13%, var(--wh-surface)); border: 1px solid color-mix(in srgb, var(--acct) 30%, transparent);
}
.acct-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--acct); flex: none; }
[data-bs-theme="dark"] .acct-badge { color: color-mix(in srgb, var(--acct) 70%, white); }
.conv-item .acct-badge { margin-left: 2px; }
.label-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.label-swatch-btn { width: 34px; height: 31px; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.label-color { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--wh-surface); box-shadow: 0 0 0 1px var(--wh-border-strong); }

.conv-list { flex: 1; overflow-y: auto; padding: 4px 6px; }
.conv-row { position: relative; }
.conv-item {
  display: flex; gap: 11px; align-items: center; width: 100%; padding: 9px 10px; margin: 1px 0;
  border: 0; border-radius: 10px; background: none; text-align: left; color: inherit; position: relative;
}
.conv-item:hover { background: var(--wh-hover); }
.conv-item.active { background: var(--wh-primary-soft); }
.conv-item.active::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 2px; background: var(--wh-primary); }
.conv-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.conv-top, .conv-bottom { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.conv-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-top .conv-name { min-width: 0; flex: 1; }
.conv-time { font-size: .75rem; color: var(--wh-muted); flex: none; }
.conv-meta { display: inline-flex; align-items: center; gap: 4px; color: var(--wh-muted); flex: none; }
.conv-preview { font-size: .85rem; color: var(--wh-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-item.unread .conv-name, .conv-item.unread .conv-preview { color: var(--wh-text); }
.conv-item.unread .conv-preview { font-weight: 600; }
.conv-item.unread .conv-time { color: var(--wh-primary); font-weight: 600; }
.typing-text { color: var(--wh-primary) !important; font-style: italic; }
.unread-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--wh-danger); flex: none; }
.conv-more {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%); width: 28px; height: 28px; border: 0; border-radius: 50%;
  background: var(--wh-surface); color: var(--wh-muted); display: none; align-items: center; justify-content: center; box-shadow: var(--wh-shadow);
}
.conv-row:hover .conv-more, .conv-more:focus-visible { display: inline-flex; }
@media (hover: none) { .conv-more { display: none !important; } }
.list-heading { padding: 12px 10px 4px; font-size: .72rem; font-weight: 700; text-transform: uppercase; color: var(--wh-muted); letter-spacing: .04em; }
.find-card { display: flex; align-items: center; gap: 10px; padding: 8px; border: 1px solid var(--wh-border); border-radius: 10px; }

/* ---------- Khung chat ---------- */
.chat-main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--wh-chat-bg); }
.chat-empty { margin: auto; text-align: center; color: var(--wh-muted); padding: 24px; }
.chat-empty-icon { width: 88px; height: 88px; margin: 0 auto 16px; border-radius: 26px; display: flex; align-items: center; justify-content: center; color: var(--wh-primary); background: var(--wh-primary-soft); }
.chat-pane { display: flex; flex-direction: column; height: 100%; min-height: 0; position: relative; }
.chat-header { display: flex; align-items: center; gap: 10px; padding: 8px 12px 8px 16px; min-height: 60px; background: var(--wh-surface); border-bottom: 1px solid var(--wh-border); }
.chat-header .icon-btn { border-radius: 10px; }
#chatName { font-size: 1.02rem; }

.messages {
  flex: 1; overflow-y: auto; padding: 16px clamp(10px, 3vw, 28px); display: flex; flex-direction: column; gap: 3px;
  background-image: radial-gradient(color-mix(in srgb, var(--wh-primary) 7%, transparent) 1px, transparent 1px);
  background-size: 22px 22px;
}
.day-sep { align-self: center; margin: 12px 0 6px; padding: 3px 12px; border-radius: 12px; font-size: .75rem; font-weight: 600; color: var(--wh-text-2); background: color-mix(in srgb, var(--wh-surface) 85%, transparent); box-shadow: var(--wh-shadow-sm); }
.msg { display: flex; align-items: flex-end; gap: 6px; margin-top: 6px; }
.msg.grouped { margin-top: 0; }
.msg.self { flex-direction: row-reverse; justify-content: flex-start; }
.msg-avatar { width: 30px; flex: none; align-self: flex-end; margin-bottom: 2px; }
.msg-avatar .avatar { width: 30px; height: 30px; font-size: .8rem; }
.msg.grouped-next .msg-avatar { pointer-events: none; }
.msg.grouped-next .msg-avatar > * { visibility: hidden; }
.msg-body { max-width: min(72%, 600px); display: flex; flex-direction: column; align-items: flex-start; min-width: 0; }
.msg.self .msg-body { align-items: flex-end; }
.bubble {
  max-width: 100%; padding: 7px 12px 6px; border-radius: 16px; background: var(--wh-bubble-in); color: var(--wh-text);
  box-shadow: var(--wh-shadow-sm);
}
.msg:not(.self) .bubble { border-bottom-left-radius: 6px; }
.msg.self .bubble { background: var(--wh-bubble-out); color: var(--wh-bubble-out-text); border-bottom-right-radius: 6px; }
.msg.grouped:not(.self) .bubble { border-top-left-radius: 6px; }
.msg.grouped.self .bubble { border-top-right-radius: 6px; }
.msg.grouped .msg-from { display: none; }
.msg-from { font-size: .78rem; font-weight: 600; color: var(--wh-primary); margin-bottom: 1px; }
.msg-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.45; }
.msg-time { font-size: .68rem; color: var(--wh-muted); text-align: right; margin-top: 1px; }
.msg-link-inline { color: var(--wh-primary); text-decoration: underline; text-underline-offset: 2px; overflow-wrap: anywhere; }
.mention { color: var(--wh-primary); font-weight: 600; }
.msg.flash .bubble { animation: flash-bubble 1.8s ease-out; }
@keyframes flash-bubble { 0%, 40% { box-shadow: 0 0 0 3px var(--wh-warning); } 100% { box-shadow: var(--wh-shadow-sm); } }
@media (prefers-reduced-motion: reduce) { .msg.flash .bubble { animation: none; box-shadow: 0 0 0 3px var(--wh-warning); } }
.bubble.recalled { background: transparent !important; border: 1px dashed var(--wh-border-strong); box-shadow: none; }
.msg-recalled { color: var(--wh-muted); font-style: italic; }
.self-status { font-size: .7rem; color: var(--wh-muted); margin-top: 2px; padding: 0 4px; }
.self-status.seen { color: var(--wh-primary); }
.msg.is-pinned .msg-time::before { content: "📌 "; }

.quote-block {
  display: flex; gap: 8px; align-items: center; width: 100%; text-align: left; border: 0; border-left: 3px solid var(--wh-primary);
  background: color-mix(in srgb, var(--wh-primary) 9%, transparent); border-radius: 6px; padding: 4px 8px; margin: 2px 0 5px; color: inherit; font-size: .85rem;
}
.quote-block img { width: 36px; height: 36px; object-fit: cover; border-radius: 4px; flex: none; }
.quote-name { display: block; font-weight: 600; }
.quote-text { display: block; color: var(--wh-text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 320px; }
.bubble.has-media .quote-block { margin: 4px 4px 6px; width: calc(100% - 8px); }

/* Thao tác trên tin */
.msg-actions { display: flex; align-items: center; flex: none; align-self: center; }
.msg.self .msg-actions { flex-direction: row-reverse; }
.react-btn {
  flex: none; width: 28px; height: 28px; border: 0; border-radius: 50%; background: transparent; color: var(--wh-muted);
  display: inline-flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .12s, background .12s;
}
.msg:hover .react-btn, .msg:focus-within .react-btn, .react-btn:focus-visible { opacity: 1; }
.react-btn:hover { background: var(--wh-surface); color: var(--wh-primary); box-shadow: var(--wh-shadow-sm); }
@media (hover: none) { .react-btn { opacity: .5; } }
.reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: -7px; padding: 0 8px; position: relative; }
.reaction-chip {
  display: inline-flex; align-items: center; gap: 2px; height: 22px; padding: 0 7px; border-radius: 11px;
  border: 1px solid var(--wh-border); background: var(--wh-surface); color: var(--wh-text); font-size: .8rem; line-height: 1; box-shadow: var(--wh-shadow-sm);
}
.reaction-chip.mine { border-color: color-mix(in srgb, var(--wh-primary) 50%, transparent); background: var(--wh-primary-soft); }
.react-picker { position: fixed; z-index: 1070; display: flex; gap: 2px; padding: 4px 6px; border-radius: 24px; background: var(--wh-surface); box-shadow: var(--wh-shadow-lg); }
.react-option { width: 38px; height: 38px; border: 0; border-radius: 50%; background: none; font-size: 1.4rem; line-height: 1; transition: transform .1s; }
.react-option:hover, .react-option:focus-visible { transform: scale(1.25); background: var(--wh-hover); outline: none; }
.react-option.mine { background: var(--wh-primary-soft); }
.react-remove { font-size: .95rem; color: var(--wh-muted); }
@media (prefers-reduced-motion: reduce) { .react-option, .react-btn { transition: none; } .react-option:hover { transform: none; } }

/* Đính kèm */
.bubble.has-media { padding: 4px; }
.bubble.has-media .msg-text, .bubble.has-media .msg-from, .bubble.has-media .msg-time { padding: 0 8px; }
.bubble.is-sticker { background: none !important; box-shadow: none; }
.msg-image, .msg-video { display: block; max-width: min(360px, 100%); max-height: 420px; width: auto; height: auto; border-radius: 12px; background: var(--wh-surface-3); }
.msg-video { width: 360px; max-width: 100%; }
.msg-sticker { width: 120px; height: 120px; object-fit: contain; }
.msg-file { display: flex; gap: 10px; align-items: center; padding: 8px 10px; min-width: 220px; max-width: 320px; color: inherit; text-decoration: none; border-radius: 10px; background: color-mix(in srgb, var(--wh-text) 5%, transparent); }
.msg-file:hover { background: color-mix(in srgb, var(--wh-text) 9%, transparent); color: inherit; }
.msg-file svg { color: var(--wh-primary); flex: none; }
.msg-link { display: block; max-width: 320px; color: inherit; text-decoration: none; padding: 6px 8px; }
.msg-link img { display: block; width: 100%; border-radius: 8px; margin-bottom: 4px; }
.media-open { display: block; position: relative; padding: 0; border: 0; background: none; cursor: zoom-in; border-radius: 12px; }
.media-open:focus-visible { outline: 3px solid var(--wh-primary); outline-offset: 2px; }
.video-thumb { cursor: pointer; }
.video-thumb .msg-video { object-fit: cover; min-height: 120px; }
.play-badge { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 52px; height: 52px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.55); color: #fff; padding-left: 3px; }
.play-badge.small-badge { width: 28px; height: 28px; }
.duration-badge { position: absolute; right: 8px; bottom: 8px; padding: 1px 6px; border-radius: 6px; background: rgba(0,0,0,.6); color: #fff; font-size: .75rem; }
.voice-chip { display: flex; align-items: center; gap: 10px; padding: 6px 12px 6px 6px; cursor: pointer; color: inherit; }
.voice-play { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--wh-primary); color: #fff; padding-left: 2px; flex: none; }
.voice-wave { display: flex; align-items: center; gap: 2px; height: 24px; }
.voice-wave i { display: block; width: 3px; border-radius: 2px; background: color-mix(in srgb, var(--wh-primary) 45%, transparent); }
.voice-wave i:nth-child(3n+1) { height: 40%; } .voice-wave i:nth-child(3n+2) { height: 90%; } .voice-wave i:nth-child(3n) { height: 60%; }
.poll-card { padding: 4px 6px; min-width: 220px; }
.upload-bubble { min-width: 220px; }
.upload-bubble .progress { height: 6px; }
/* Tin đang gửi (hiện ngay, gửi nền) và tin gửi lỗi. */
.msg.pending .bubble { opacity: .7; }
.msg.pending .pending-status { display: flex; align-items: center; gap: 4px; justify-content: flex-end; flex-wrap: wrap; }
.msg.pending .pending-status .spinner-border { width: .7rem; height: .7rem; border-width: .12em; }
.msg.pending.failed .bubble { opacity: 1; outline: 1px solid var(--bs-danger); }

/* Thanh ghim, đang soạn, trả lời */
.pin-bar { padding: 6px 12px; background: var(--wh-surface); border-bottom: 1px solid var(--wh-border); max-height: 45vh; overflow-y: auto; box-shadow: var(--wh-shadow-sm); position: relative; z-index: 1; }
.pin-row { display: flex; align-items: center; gap: 6px; }
.pin-row + .pin-row { border-top: 1px solid var(--wh-border); }
.pin-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; border: 0; background: none; text-align: left; padding: 4px 2px; border-radius: 6px; color: inherit; }
.pin-main:hover { background: var(--wh-hover); }
.pin-main img { width: 32px; height: 32px; object-fit: cover; border-radius: 4px; flex: none; }
.pin-from { display: block; font-size: .78rem; font-weight: 600; color: var(--wh-text-2); }
.pin-text { display: block; font-size: .85rem; color: var(--wh-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.typing-bar { padding: 0 20px; font-size: .78rem; color: var(--wh-primary); font-style: italic; }
.typing-bar:not(:empty) { padding: 2px 20px 4px; }
.reply-bar { display: flex; align-items: center; gap: 10px; margin: 0 12px 6px; padding: 6px 10px; background: var(--wh-surface); border-left: 4px solid var(--wh-primary); border-radius: 10px; box-shadow: var(--wh-shadow-sm); }

/* ---------- Soạn tin ---------- */
.send-form { display: flex; gap: 6px; padding: 8px 12px 10px; background: var(--wh-surface); border-top: 1px solid var(--wh-border); align-items: flex-end; flex-wrap: wrap; }
.composer-tools { display: flex; gap: 2px; align-items: flex-end; }
.send-form textarea {
  flex: 1; min-width: 0; resize: none; max-height: 160px; border-radius: 20px; padding: 8px 14px; background: var(--wh-surface-2); border-color: transparent;
}
.send-form textarea:focus { background: var(--wh-surface); }
.send-form .btn-send { border-radius: 20px; padding-left: 18px; padding-right: 18px; height: 38px; flex: none; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; padding: 0; flex: none; border-radius: 50%; }
.btn-tools-toggle { display: none; }
.record-bar { flex: 1; display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 20px; background: color-mix(in srgb, var(--wh-danger) 12%, var(--wh-surface)); color: var(--wh-danger); font-variant-numeric: tabular-nums; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--wh-danger); animation: rec-blink 1s infinite; }
@keyframes rec-blink { 50% { opacity: .2; } }
@media (prefers-reduced-motion: reduce) { .rec-dot { animation: none; } }
.drop-overlay {
  position: absolute; inset: 8px; z-index: 5; display: flex; align-items: center; justify-content: center;
  border: 2px dashed var(--wh-primary); border-radius: 14px; background: color-mix(in srgb, var(--wh-primary-soft) 92%, transparent); color: var(--wh-primary); font-weight: 600; pointer-events: none;
}

/* Popup trong khung soạn tin */
.composer-pop-host { position: relative; }
.quick-popup {
  position: absolute; left: 12px; right: 12px; bottom: 6px; z-index: 10; max-height: 320px; overflow-y: auto;
  background: var(--wh-surface); border: 1px solid var(--wh-border); border-radius: 12px; box-shadow: var(--wh-shadow-lg);
}
.quick-item { padding: 8px 12px; cursor: pointer; }
.quick-item.active, .quick-item:hover { background: var(--wh-primary-soft); }
.quick-hint { padding: 6px 12px; border-top: 1px solid var(--wh-border); }
.quick-preview { margin: 0 12px 6px; padding: 10px 12px; background: var(--wh-surface); border: 1px solid var(--wh-border); border-left: 4px solid var(--wh-primary); border-radius: 10px; max-height: 40vh; overflow-y: auto; box-shadow: var(--wh-shadow-sm); }
.quick-preview-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.quick-preview-images { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.quick-preview-images img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; }
.sticker-panel {
  position: absolute; left: 12px; bottom: 6px; z-index: 10; width: min(420px, calc(100% - 24px)); padding: 10px;
  background: var(--wh-surface); border: 1px solid var(--wh-border); border-radius: 14px; box-shadow: var(--wh-shadow-lg);
}
.sticker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 6px; max-height: 260px; overflow-y: auto; }
.sticker-item { border: 0; background: none; border-radius: 8px; padding: 4px; aspect-ratio: 1; }
.sticker-item:hover, .sticker-item:focus-visible { background: var(--wh-hover); }
.sticker-item img { width: 100%; height: 100%; object-fit: contain; }

/* ---------- Menu nổi, thông báo nhỏ ---------- */
.pop-menu { position: fixed; z-index: 1075; min-width: 210px; padding: 5px; background: var(--wh-surface); border: 1px solid var(--wh-border); border-radius: 12px; box-shadow: var(--wh-shadow-lg); }
.pop-item { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 7px 12px; border-radius: 7px; font-size: .9rem; color: var(--wh-text); white-space: pre; }
.pop-item:hover, .pop-item:focus-visible { background: var(--wh-hover); outline: none; }
.pop-item.danger { color: var(--wh-danger); }
.pop-item:disabled { color: var(--wh-muted); }
.pop-sep { height: 1px; margin: 4px 6px; background: var(--wh-border); }
.wh-toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 1090; max-width: min(520px, calc(100vw - 32px));
  padding: 10px 16px; border-radius: 12px; background: #1f2937; color: #fff; font-size: .9rem; box-shadow: var(--wh-shadow-lg);
}
.wh-toast.error { background: var(--wh-danger); }

/* ---------- Bảng thông tin hội thoại ---------- */
.info-panel { width: 330px; flex: none; border-left: 1px solid var(--wh-border); background: var(--wh-surface); display: flex; flex-direction: column; min-height: 0; }
.info-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid var(--wh-border); min-height: 60px; }
.info-profile { display: flex; flex-direction: column; align-items: center; padding: 18px 12px 14px; border-bottom: 1px solid var(--wh-border); }
.info-desc { white-space: pre-wrap; color: var(--wh-text-2); max-height: 80px; overflow-y: auto; }
.info-tabs { display: flex; gap: 2px; padding: 6px; overflow-x: auto; border-bottom: 1px solid var(--wh-border); }
.info-tab { border: 0; background: none; padding: 5px 10px; border-radius: 7px; font-size: .82rem; font-weight: 600; color: var(--wh-muted); white-space: nowrap; }
.info-tab.active { background: var(--wh-primary-soft); color: var(--wh-primary); }
.info-body { flex: 1; overflow-y: auto; min-height: 0; }
.shared-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 6px; }
.shared-thumb { position: relative; aspect-ratio: 1; border: 0; padding: 0; border-radius: 8px; overflow: hidden; background: var(--wh-surface-3); }
.shared-thumb img { width: 100%; height: 100%; object-fit: cover; }
.shared-file { display: flex; align-items: center; gap: 10px; padding: 8px 12px; color: inherit; text-decoration: none; }
.shared-file:hover { background: var(--wh-hover); color: inherit; }
.member-row { display: flex; align-items: center; gap: 10px; padding: 6px 12px; }
.member-row .avatar { width: 36px; height: 36px; }
.forward-list { max-height: 50vh; overflow-y: auto; }
.forward-item { display: flex; align-items: center; gap: 10px; padding: 6px 4px; border-radius: 8px; cursor: pointer; }
.forward-item:hover { background: var(--wh-hover); }
.forward-item .avatar { width: 34px; height: 34px; }
.forward-preview { padding: 8px 10px; border-left: 3px solid var(--wh-primary); background: var(--wh-primary-softer); border-radius: 6px; }
.poll-option { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; margin-bottom: 6px; border: 1px solid var(--wh-border); border-radius: 10px; cursor: pointer; }
.poll-option.voted { border-color: color-mix(in srgb, var(--wh-primary) 50%, transparent); background: var(--wh-primary-softer); }
.poll-bar { display: block; height: 6px; margin-top: 6px; border-radius: 3px; background: var(--wh-surface-3); overflow: hidden; }
.poll-bar span { display: block; height: 100%; background: var(--wh-primary); }

/* ---------- Khung xem media toàn cửa sổ (luôn tối) ---------- */
body.viewer-open { overflow: hidden; }
.viewer { position: fixed; inset: 0; z-index: 1080; background: rgba(8, 10, 14, .95); color: #fff; display: flex; flex-direction: column; }
.viewer-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; }
.viewer-muted { color: rgba(255,255,255,.65); }
.viewer-btn { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 0; border-radius: 50%; background: rgba(255,255,255,.08); color: #fff; }
.viewer-btn:hover { background: rgba(255,255,255,.18); color: #fff; }
.viewer-btn:focus-visible { outline: 3px solid #8fb8ff; outline-offset: 2px; }
.viewer-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 8px 72px 40px; overflow: hidden; }
.viewer-img { max-width: 100%; max-height: 100%; object-fit: contain; cursor: zoom-in; user-select: none; }
.viewer-stage.zoomed { overflow: auto; align-items: flex-start; justify-content: flex-start; }
.viewer-stage.zoomed .viewer-img { max-width: none; max-height: none; cursor: zoom-out; margin: auto; }
.viewer-video { max-width: 100%; max-height: 100%; background: #000; border-radius: 8px; }
.viewer-audio { text-align: center; width: min(480px, 100%); }
.viewer-audio audio { width: 100%; }
.viewer-audio-icon { width: 112px; height: 112px; margin: 0 auto 16px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: #0068ff; }
.viewer-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 52px; height: 52px; }
.viewer-nav.prev { left: 12px; }
.viewer-nav.next { right: 12px; }
.viewer-count { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); color: rgba(255,255,255,.7); }

/* ---------- Trang tin nhắn nhanh ---------- */
.qm-list { max-height: 65vh; overflow-y: auto; }
.qm-item { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 8px; color: inherit; }
.qm-item:hover { background: var(--wh-hover); }
.qm-item.active { background: var(--wh-primary-soft); }
.qm-preview { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.editor-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 4px; border: 1px solid var(--wh-border-strong); border-bottom: 0; border-radius: 8px 8px 0 0; background: var(--wh-surface-2); }
.tb-btn { min-width: 34px; height: 32px; padding: 0 8px; border: 0; border-radius: 6px; background: none; color: var(--wh-text); display: inline-flex; align-items: center; justify-content: center; }
.tb-btn:hover { background: var(--wh-surface-3); }
.tb-btn:focus-visible { outline: 2px solid var(--wh-primary); }
.tb-sep { width: 1px; height: 20px; background: var(--wh-border-strong); margin: 0 4px; }
.swatch { display: inline-block; width: 16px; height: 16px; border-radius: 50%; }
.editor { min-height: 160px; max-height: 50vh; overflow-y: auto; border-radius: 0 0 8px 8px; white-space: pre-wrap; overflow-wrap: anywhere; }
.editor:empty::before { content: "Nhập nội dung tin nhắn…"; color: var(--wh-muted); }
.qm-images { display: flex; flex-wrap: wrap; gap: 8px; }
.qm-thumb { position: relative; width: 96px; height: 96px; border-radius: 10px; overflow: hidden; border: 1px solid var(--wh-border); }
.qm-thumb img { width: 100%; height: 100%; object-fit: cover; }
.qm-thumb-remove { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border: 0; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; line-height: 1; }
.qm-add { display: flex; flex-direction: column; align-items: center; justify-content: center; background: var(--wh-surface-2); border-style: dashed; color: var(--wh-muted); }
.qm-add span:first-child { font-size: 1.6rem; line-height: 1; }

/* =====================================================================
   Responsive
   ===================================================================== */
@media (min-width: 1400px) { :root { --wh-sidebar-w: 370px; } }
@media (max-width: 1199.98px) { :root { --wh-sidebar-w: 310px; } }
@media (max-width: 1100px) {
  .info-panel { position: fixed; right: 0; top: 0; bottom: 0; z-index: 1060; box-shadow: var(--wh-shadow-lg); }
}
@media (max-width: 767.98px) {
  .chat-sidebar { width: 100%; border-right: 0; }
  .chat-main { display: none; }
  .chat-app.show-chat .chat-sidebar { display: none; }
  .chat-app.show-chat .chat-main { display: flex; }
  .msg-body { max-width: 84%; }
  .info-panel { width: 100%; }
  .chat-header { padding-left: 8px; }
  .viewer-stage { padding: 8px 8px 56px; }
  .viewer-nav { top: auto; bottom: 6px; transform: none; width: 44px; height: 44px; }
  .msg-image, .msg-video { max-width: min(280px, 100%); }
}
/* Màn hình hẹp: gom công cụ soạn tin vào nút "+" để ô nhập đủ rộng. */
@media (max-width: 575.98px) {
  .btn-tools-toggle { display: inline-flex; }
  .composer-tools { display: none; order: -1; width: 100%; justify-content: flex-start; padding-bottom: 4px; }
  .send-form.tools-open .composer-tools { display: flex; }
  .send-form .btn-send { padding-left: 14px; padding-right: 14px; }
  .messages { padding: 10px 8px; }
  .msg-avatar { width: 26px; }
  .msg-avatar .avatar { width: 26px; height: 26px; }
}

/* ===================== Tính năng làm việc ===================== */
.pf-instagram { background: linear-gradient(45deg, #f9ce34 0%, #ee2a7b 50%, #6228d7 100%); }
.pf-telegram { background: #2aabee; }
.pf-local { background: #0ca678; }
.local-pick { max-height: 45vh; overflow-y: auto; }
.local-pick .list-group-item { cursor: pointer; }

/* Thanh công việc dưới tiêu đề hội thoại: thẻ, cần xử lý, phụ trách, liên hệ, hẹn giờ… */
.work-bar { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 12px; background: var(--wh-surface); border-bottom: 1px solid var(--wh-border); }
.work-bar .label-tag { border: 0; cursor: pointer; }
.wb-chip { border: 1px solid var(--wh-border); background: var(--wh-hover); color: var(--wh-text); border-radius: 999px; padding: 2px 10px; font-size: .78rem; line-height: 1.5; cursor: pointer; }
.wb-chip:hover { border-color: var(--wh-border-strong); }
.wb-chip.warn { background: color-mix(in srgb, var(--wh-warning) 16%, transparent); border-color: color-mix(in srgb, var(--wh-warning) 45%, transparent); }
.chat-header .icon-btn.active { color: var(--wh-warning); background: color-mix(in srgb, var(--wh-warning) 14%, transparent); }

/* Danh sách hội thoại: cờ cần xử lý, người phụ trách */
.work-flag { color: var(--wh-warning); font-size: .8rem; margin-left: 4px; }
.assignee-chip { display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: 999px; font-size: .68rem; font-weight: 600; background: var(--wh-hover); color: var(--wh-muted); vertical-align: middle; max-width: 9em; overflow: hidden; text-overflow: ellipsis; }
.assignee-chip.mine { background: var(--wh-primary-soft); color: var(--wh-primary); }

/* Tin: đã sửa, người gửi trong hộp thư nhóm */
.msg-edited, .msg-by { opacity: .85; }
.msg-by { font-weight: 600; }

/* Trợ lý AI */
.ai-suggest { margin: 0 12px 6px; padding: 8px 10px; background: var(--wh-surface); border: 1px solid var(--wh-border); border-left: 4px solid #8f4dff; border-radius: 10px; box-shadow: var(--wh-shadow-sm); max-height: 40vh; overflow-y: auto; }
.ai-chip { display: block; width: 100%; text-align: left; margin-top: 6px; padding: 8px 10px; border: 1px solid var(--wh-border); border-radius: 10px; background: var(--wh-hover); color: var(--wh-text); white-space: pre-wrap; font-size: .9rem; }
.ai-chip:hover, .ai-chip:focus-visible { border-color: var(--wh-primary); background: var(--wh-primary-softer); }
.ai-box { padding: 10px 12px; border-radius: 10px; background: var(--wh-hover); white-space: pre-wrap; word-wrap: break-word; }

/* Ghi chú nội bộ */
.note-list { max-height: 50vh; overflow-y: auto; }
.note-item { padding: 8px 10px; margin-bottom: 8px; border-radius: 10px; background: color-mix(in srgb, var(--wh-warning) 10%, var(--wh-surface)); border: 1px solid color-mix(in srgb, var(--wh-warning) 30%, transparent); }
.note-text { white-space: pre-wrap; word-wrap: break-word; }

/* Trang công việc / liên hệ / tự động / thống kê / hệ thống */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.wh-card { background: var(--wh-surface); border: 1px solid var(--wh-border); border-radius: var(--wh-radius); padding: 16px; box-shadow: var(--wh-shadow-sm); }
.task-row { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--wh-border); }
.task-row:last-child { border-bottom: 0; }
.task-row.done .task-title { text-decoration: line-through; color: var(--wh-muted); }
.task-row.overdue .task-due { color: var(--wh-danger); font-weight: 600; }
.stat-num { font-size: 1.8rem; font-weight: 800; line-height: 1.1; }
.stat-label { color: var(--wh-muted); font-size: .85rem; }
.bar-chart { display: flex; align-items: flex-end; gap: 2px; height: 160px; }
.bar-chart .bar { flex: 1 1 0; min-width: 2px; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; }
.bar-chart .bar span { display: block; border-radius: 3px 3px 0 0; }
.bar-chart .in { background: var(--wh-primary); }
.bar-chart .out { background: color-mix(in srgb, var(--wh-success) 80%, transparent); }
.hbar { height: 8px; border-radius: 4px; background: var(--wh-primary); }
.legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: middle; }
.status-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; background: var(--wh-muted); }
.status-dot.ok { background: var(--wh-success); }
.status-dot.bad { background: var(--wh-danger); }
@media (max-width: 575.98px) { .bar-chart { height: 120px; } }

/* ===================== Sửa giao diện chung ===================== */
/* Bộ lọc: chia nhóm (Lọc nhanh / Thẻ WorkHub / Thẻ Zalo), xuống dòng; mỗi thẻ một màu (--chip). */
.conv-filters { flex-direction: column; flex-wrap: nowrap; gap: 8px; max-height: 42vh; overflow-y: auto; padding: 8px; border-radius: 12px; background: var(--wh-surface-2); }
.filter-group { display: flex; flex-direction: column; gap: 5px; }
.filter-title { display: flex; align-items: center; justify-content: space-between; font-size: .7rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--wh-muted); }
.filter-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.filter-chip {
  --chip: #64748b; color: color-mix(in srgb, var(--chip) 82%, var(--wh-text)); font-weight: 600;
  background: color-mix(in srgb, var(--chip) 10%, var(--wh-surface)); border-color: color-mix(in srgb, var(--chip) 30%, transparent);
  transition: background-color .15s, color .15s, box-shadow .15s;
}
.filter-chip:hover { background: color-mix(in srgb, var(--chip) 18%, var(--wh-surface)); }
.filter-chip.active { background: var(--chip); border-color: var(--chip); color: #fff; box-shadow: 0 2px 8px color-mix(in srgb, var(--chip) 35%, transparent); }
.filter-chip .label-dot { background: var(--chip); }
.filter-chip.active .label-dot { background: #fff; }
.filter-chip .chip-icon { font-size: .72rem; line-height: 1; }
.filter-manage { border: 0; background: none; padding: 0; font-size: .72rem; font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--wh-primary); }
.filter-manage:hover { text-decoration: underline; }
[data-bs-theme="dark"] .filter-chip:not(.active) { color: color-mix(in srgb, var(--chip) 65%, white); }
/* Khu vực tài khoản thu gọn được. */
.acct-summary {
  display: flex; align-items: center; gap: 6px; width: 100%; padding: 6px 10px; border: 1px solid var(--wh-border); border-radius: 9px;
  background: var(--wh-surface-2); font-size: .82rem; color: var(--wh-text); text-align: left;
}
.acct-summary:hover { background: var(--wh-hover); }
.acct-summary > span { flex: 1; min-width: 0; }
.acct-state { max-height: 64px; overflow-y: auto; min-width: 0; }
#acctHide { width: 28px; height: 31px; min-width: 28px; padding: 0; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; }
#acctBlock #accountSelect { min-width: 0; flex: 1 1 auto; }
/* Cloud: lọc theo loại bằng ô xổ xuống. */
.cloud-filter { width: auto; max-width: 180px; }
.cloud-filter.active { border-color: var(--wh-primary); color: var(--wh-primary); font-weight: 600; background-color: var(--wh-primary-soft); }
/* Nút "..." của hội thoại không đè lên giờ / biểu tượng. */
.conv-row:hover .conv-meta, .conv-row:focus-within .conv-meta { visibility: hidden; }
/* Dấu nền tảng trên nút: logo và chữ thẳng hàng. */
.btn:has(> .pf-mark) { display: inline-flex; align-items: center; gap: 6px; }
.btn .pf-mark { width: 18px; height: 18px; font-size: .66rem; vertical-align: middle; margin: 0 !important; }
/* Biểu đồ ít ngày: cột không bị kéo dài cả khung. */
.bar-chart .bar { max-width: 40px; }

/* ===================== Giao diện "Sắc màu" ===================== */
[data-wh-skin="colorful"] {
  --wh-primary: #6d4aff;
  --wh-primary-hover: #5933f5;
  --wh-primary-soft: #efeaff;
  --wh-primary-softer: #f8f5ff;
  --wh-app-bg: #f7f4ff;
  --wh-chat-bg: #faf8ff;
  --wh-hover: #f4f0ff;
  --wh-border: #e9e4f7;
  --wh-bubble-out: linear-gradient(135deg, #6d4aff 0%, #a63dff 55%, #ff4f8b 100%);
  --wh-bubble-out-text: #fff;
  --wh-grad: linear-gradient(135deg, #6d4aff 0%, #b23cff 52%, #ff4f8b 100%);
  --wh-grad-soft: linear-gradient(135deg, #f1ebff 0%, #ffe9f3 100%);
  --wh-shadow: 0 6px 18px rgba(109, 74, 255, .12);
  --bs-primary-rgb: 109, 74, 255;
  --bs-link-color-rgb: 109, 74, 255;
}
[data-wh-skin="colorful"] body {
  background:
    radial-gradient(900px 500px at 0% 0%, #ffe4f1 0, transparent 60%),
    radial-gradient(900px 520px at 100% 0%, #e2ebff 0, transparent 55%),
    radial-gradient(800px 600px at 50% 100%, #ece3ff 0, transparent 60%),
    var(--wh-app-bg);
  background-attachment: fixed;
}
/* Thanh điều hướng gradient. */
[data-wh-skin="colorful"] .wh-nav, [data-wh-skin="colorful"] .wh-nav .navbar-collapse { background: var(--wh-grad); border-bottom: 0; box-shadow: 0 4px 18px rgba(178, 60, 255, .25); }
[data-wh-skin="colorful"] .wh-brand, [data-wh-skin="colorful"] .wh-nav .nav-link, [data-wh-skin="colorful"] .wh-nav .theme-toggle { color: rgba(255, 255, 255, .9) !important; }
[data-wh-skin="colorful"] .wh-nav .nav-link:hover, [data-wh-skin="colorful"] .wh-nav .theme-toggle:hover { background: rgba(255, 255, 255, .16); color: #fff !important; }
[data-wh-skin="colorful"] .wh-nav .nav-link.active { background: rgba(255, 255, 255, .24); color: #fff !important; }
[data-wh-skin="colorful"] .wh-brand-mark { background: #fff; color: #8a3dff; }
[data-wh-skin="colorful"] .wh-nav .navbar-toggler-icon { filter: invert(1) brightness(2); }
[data-wh-skin="colorful"] .wh-nav .dropdown-menu { --bs-dropdown-link-active-bg: var(--wh-primary); }
/* Nút chính gradient. */
[data-wh-skin="colorful"] .btn-primary { background-image: var(--wh-grad); border: 0; box-shadow: 0 4px 12px rgba(178, 60, 255, .28); }
[data-wh-skin="colorful"] .btn-primary:hover { filter: brightness(1.06); }
/* Danh sách hội thoại. */
[data-wh-skin="colorful"] .conv-item.active { background: var(--wh-grad-soft); }
[data-wh-skin="colorful"] .conv-item.active::before { background: var(--wh-grad); width: 4px; }
[data-wh-skin="colorful"] .badge.text-bg-danger { background: linear-gradient(135deg, #ff4f8b, #ff7a45) !important; }
[data-wh-skin="colorful"] .sidebar-tab.active { color: #fff; background: var(--wh-grad); }
[data-wh-skin="colorful"] .typing-text { color: #e8399a !important; }
/* Khung chat. */
[data-wh-skin="colorful"] .messages { background-image: radial-gradient(rgba(178, 60, 255, .09) 1px, transparent 1px); }
[data-wh-skin="colorful"] .msg.self .bubble { background: var(--wh-bubble-out); color: #fff; box-shadow: 0 4px 14px rgba(178, 60, 255, .25); }
[data-wh-skin="colorful"] .msg.self .bubble .msg-time,
[data-wh-skin="colorful"] .msg.self .bubble .msg-link-inline,
[data-wh-skin="colorful"] .msg.self .bubble .mention { color: rgba(255, 255, 255, .88); }
[data-wh-skin="colorful"] .msg.self .bubble.has-media { background: var(--wh-surface); color: var(--wh-text); }
[data-wh-skin="colorful"] .msg.self .bubble.has-media .msg-time { color: var(--wh-muted); }
[data-wh-skin="colorful"] .msg-from { background: var(--wh-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
[data-wh-skin="colorful"] .chat-empty-icon { background: var(--wh-grad); color: #fff; box-shadow: 0 10px 30px rgba(178, 60, 255, .3); }
/* Nút công cụ có màu riêng. */
[data-wh-skin="colorful"] .icon-btn { --ic: #6d4aff; color: var(--ic); background: color-mix(in srgb, var(--ic) 10%, var(--wh-surface)); }
[data-wh-skin="colorful"] .icon-btn:hover { background: color-mix(in srgb, var(--ic) 18%, var(--wh-surface)); color: var(--ic); }
[data-wh-skin="colorful"] #btnFollowUp { --ic: #d97706; }
[data-wh-skin="colorful"] #btnAi, [data-wh-skin="colorful"] #btnAiReply { --ic: #c026d3; }
[data-wh-skin="colorful"] #btnWork { --ic: #0d9488; }
[data-wh-skin="colorful"] #btnHistory { --ic: #2563eb; }
[data-wh-skin="colorful"] #btnInfo { --ic: #6d4aff; }
[data-wh-skin="colorful"] #btnQuick { --ic: #7c3aed; }
[data-wh-skin="colorful"] #btnSticker { --ic: #ec4899; }
[data-wh-skin="colorful"] #btnAttach { --ic: #2563eb; }
[data-wh-skin="colorful"] #btnRecord { --ic: #ef4444; }
[data-wh-skin="colorful"] #btnSchedule { --ic: #d97706; }
[data-wh-skin="colorful"] .send-form textarea:focus { border-color: #b23cff; }
/* Thẻ, trang công việc / thống kê. */
[data-wh-skin="colorful"] .card, [data-wh-skin="colorful"] .wh-card {
  border: 1px solid transparent;
  background: linear-gradient(var(--wh-surface), var(--wh-surface)) padding-box, linear-gradient(135deg, #d9ccff, #ffd1e6) border-box;
}
[data-wh-skin="colorful"] .stat-num { background: var(--wh-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
[data-wh-skin="colorful"] .row > div:nth-child(6n+1) > .wh-card .stat-num { background-image: linear-gradient(135deg, #2563eb, #06b6d4); }
[data-wh-skin="colorful"] .row > div:nth-child(6n+2) > .wh-card .stat-num { background-image: linear-gradient(135deg, #16a34a, #84cc16); }
[data-wh-skin="colorful"] .row > div:nth-child(6n+3) > .wh-card .stat-num { background-image: linear-gradient(135deg, #7c3aed, #c026d3); }
[data-wh-skin="colorful"] .row > div:nth-child(6n+4) > .wh-card .stat-num { background-image: linear-gradient(135deg, #f97316, #ef4444); }
[data-wh-skin="colorful"] .row > div:nth-child(6n+5) > .wh-card .stat-num { background-image: linear-gradient(135deg, #0d9488, #22c55e); }
[data-wh-skin="colorful"] .row > div:nth-child(6n+6) > .wh-card .stat-num { background-image: linear-gradient(135deg, #ec4899, #f59e0b); }
[data-wh-skin="colorful"] .bar-chart .in { background: linear-gradient(180deg, #8b5cf6, #6d4aff); }
[data-wh-skin="colorful"] .bar-chart .out { background: linear-gradient(180deg, #ff7ab0, #ff4f8b); }
[data-wh-skin="colorful"] .hbar { background: var(--wh-grad); }
[data-wh-skin="colorful"] h1.h3 { background: var(--wh-grad); -webkit-background-clip: text; background-clip: text; color: transparent; display: inline-block; }
.legend-in { background: var(--wh-primary); }
.legend-out { background: color-mix(in srgb, var(--wh-success) 80%, transparent); }
[data-wh-skin="colorful"] .legend-in { background: #6d4aff; }
[data-wh-skin="colorful"] .legend-out { background: #ff4f8b; }
.wh-nav .btn-link.nav-link { background: transparent; border: 0; box-shadow: none; }

/* ===================== WorkHub Cloud ===================== */
.cloud-gate { max-width: 520px; margin: 24px auto; text-align: left; }
.cloud-gate-icon { width: 64px; height: 64px; border-radius: 20px; display: flex; align-items: center; justify-content: center; font-size: 30px; margin-bottom: 12px;
  background: linear-gradient(135deg, #0068ff, #00b8d4); color: #fff; }
[data-wh-skin="colorful"] .cloud-gate-icon { background: var(--wh-grad); }
.recovery-code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 1.15rem; letter-spacing: .06em; padding: 12px 14px; border-radius: 10px;
  background: var(--wh-surface-2); border: 1px dashed var(--wh-border-strong); word-break: break-all; user-select: all; }
.cloud-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.cloud-card { position: relative; background: var(--wh-surface); border: 1px solid var(--wh-border); border-radius: var(--wh-radius); box-shadow: var(--wh-shadow-sm); overflow: hidden; transition: box-shadow .15s, transform .15s; }
.cloud-card:hover { box-shadow: var(--wh-shadow); transform: translateY(-1px); }
.cloud-card.pinned { border-color: color-mix(in srgb, var(--wh-warning) 55%, transparent); }
.cloud-card-main { display: block; width: 100%; padding: 0; border: 0; background: none; text-align: left; color: inherit; }
.cloud-thumb { display: block; width: 100%; height: 150px; object-fit: cover; background: var(--wh-surface-3); }
.cloud-icon { height: 110px; display: flex; align-items: center; justify-content: center; font-size: 42px; background: var(--wh-surface-2); }
.cloud-note-preview { height: 110px; padding: 10px 40px 10px 12px; overflow: hidden; white-space: pre-wrap; font-size: .82rem; color: var(--wh-text-2);
  background: color-mix(in srgb, var(--wh-warning) 9%, var(--wh-surface)); mask-image: linear-gradient(#000 70%, transparent); }
.cloud-card-body { padding: 8px 12px 10px; min-width: 0; }
.cloud-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cloud-more { position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; border: 0; border-radius: 50%; background: color-mix(in srgb, var(--wh-surface) 88%, transparent);
  color: var(--wh-text-2); box-shadow: var(--wh-shadow-sm); font-weight: 700; }
.cloud-more:hover { background: var(--wh-surface); color: var(--wh-text); }
.cloud-viewer { text-align: center; }
.cloud-viewer img, .cloud-viewer video { max-width: 100%; max-height: 70vh; border-radius: 8px; }
.cloud-viewer iframe { width: 100%; height: 70vh; border: 0; border-radius: 8px; background: #fff; }
.cloud-viewer audio { width: 100%; }
[data-wh-skin="colorful"] .cloud-card { border: 1px solid transparent; background: linear-gradient(var(--wh-surface), var(--wh-surface)) padding-box, linear-gradient(135deg, #d9ccff, #ffd1e6) border-box; }
[data-wh-skin="colorful"] #btnCloud { --ic: #0ea5e9; }
@media (max-width: 575.98px) { .cloud-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; } .cloud-thumb { height: 110px; } }

/* WorkHub Cloud — thư mục, đường dẫn, kéo-thả */
.cloud-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; }
.crumb { border: 1px dashed transparent; background: none; color: var(--wh-text-2); font-weight: 600; padding: 4px 8px; border-radius: 8px; }
.crumb:hover { background: var(--wh-hover); color: var(--wh-text); }
.crumb:last-child { color: var(--wh-primary); }
.crumb-sep { color: var(--wh-muted); }
.cloud-folder-icon { height: 90px; display: flex; align-items: center; justify-content: center; font-size: 46px;
  background: linear-gradient(135deg, color-mix(in srgb, #f59e0b 16%, var(--wh-surface)), color-mix(in srgb, #fbbf24 8%, var(--wh-surface))); }
.cloud-card[draggable="true"] { cursor: grab; }
.drop-target { outline: 2px dashed var(--wh-primary) !important; outline-offset: 2px; background-color: var(--wh-primary-softer) !important; }
.cloud-text { text-align: left; max-height: 70vh; overflow: auto; white-space: pre-wrap; padding: 12px; border-radius: 8px; background: var(--wh-surface-2); font-size: .85rem; }
kbd { font-size: .75em; }

/* Trợ lý AI của tôi: chọn nhà cung cấp */
.ai-providers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.ai-provider { display: flex; align-items: center; gap: 10px; padding: 12px; border: 2px solid var(--wh-border); border-radius: 12px; cursor: pointer; background: var(--wh-surface); }
.ai-provider:hover { border-color: var(--wh-border-strong); }
.ai-provider.active { border-color: var(--wh-primary); background: var(--wh-primary-softer); }
.ai-provider input { position: absolute; opacity: 0; pointer-events: none; }
.ai-provider:has(input:focus-visible) { box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--wh-primary) 30%, transparent); }
.ai-provider-mark { width: 36px; height: 36px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; flex: none; }
@media (max-width: 575.98px) { .ai-providers { grid-template-columns: 1fr; } }

/* AI tự trả lời */
.ai-preview-bubble { display: inline-block; max-width: 100%; margin-top: 4px; padding: 8px 12px; border-radius: 16px 16px 6px 16px; white-space: pre-wrap;
  background: var(--wh-bubble-out); color: var(--wh-bubble-out-text); box-shadow: var(--wh-shadow-sm); }
.ai-bot-badge { margin-left: 4px; font-size: .78rem; vertical-align: 1px; }
.ai-bot-badge.dim { opacity: .65; }
.ai-draft-chip { display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: 999px; font-size: .68rem; font-weight: 700; vertical-align: middle;
  color: #8a5a00; background: color-mix(in srgb, #f59e0b 22%, var(--wh-surface)); }
[data-bs-theme="dark"] .ai-draft-chip { color: #fcd34d; }
.ai-draft-text { white-space: pre-wrap; padding: 8px 10px; border-radius: 10px; background: var(--wh-hover); }

/* ---- Xem trước file ---- */
div.msg-file { padding: 0; gap: 0; }
.msg-file-main { display: flex; gap: 10px; align-items: center; flex: 1; min-width: 0; padding: 8px 10px; border: 0; background: none; color: inherit; text-align: left; border-radius: 10px; }
.msg-file-dl { display: grid; place-items: center; width: 38px; align-self: stretch; color: var(--wh-primary); border-left: 1px solid color-mix(in srgb, var(--wh-text) 10%, transparent); border-radius: 0 10px 10px 0; }
.msg-file-dl:hover { background: color-mix(in srgb, var(--wh-text) 9%, transparent); }
.file-badge { flex: none; display: grid; place-items: center; width: 34px; height: 40px; border-radius: 6px; font-size: .72rem; font-weight: 800; color: #fff; background: var(--fb, #64748b); letter-spacing: .02em; }
.fp-dialog .modal-body { display: flex; flex-direction: column; }
.fp-box { min-height: 60vh; }
.fp-frame { width: 100%; height: 75vh; border: 0; border-radius: 8px; background: #525659; }
.fp-media { display: block; max-width: 100%; max-height: 75vh; margin: 0 auto; border-radius: 8px; background: #000; }
.fp-text { max-height: 75vh; overflow: auto; padding: 12px; border-radius: 8px; background: var(--wh-hover); font-size: .85rem; white-space: pre-wrap; word-break: break-word; }
.fp-docx { max-height: 75vh; overflow: auto; border-radius: 8px; }
.fp-docx .docx-wrapper { padding: 16px; background: #e5e7eb; }
.fp-sheet-tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 6px; }
.fp-sheet-tabs button { border: 1px solid color-mix(in srgb, var(--wh-text) 15%, transparent); background: none; color: inherit; border-radius: 6px; padding: 2px 10px; font-size: .85rem; }
.fp-sheet-tabs button.active { background: #217346; border-color: #217346; color: #fff; }
.fp-sheet-body { max-height: 72vh; overflow: auto; border: 1px solid color-mix(in srgb, var(--wh-text) 12%, transparent); border-radius: 8px; }
.fp-sheet-body table { border-collapse: collapse; font-size: .82rem; }
.fp-sheet-body td { border: 1px solid color-mix(in srgb, var(--wh-text) 12%, transparent); padding: 3px 8px; white-space: nowrap; max-width: 360px; overflow: hidden; text-overflow: ellipsis; }
.fp-sheet-body tr:first-child td { position: sticky; top: 0; font-weight: 600; background: var(--wh-surface); }
.fp-slides { max-height: 75vh; overflow: auto; }
.fp-slide { position: relative; padding: 18px 20px; margin-bottom: 12px; border-radius: 10px; background: var(--wh-surface); border: 1px solid color-mix(in srgb, var(--wh-text) 12%, transparent); aspect-ratio: 16 / 9; overflow: auto; }
.fp-slide-no { position: absolute; top: 6px; right: 10px; font-size: .72rem; color: var(--bs-secondary-color); }
.fp-slide-title { font-size: 1.25rem; font-weight: 700; margin-bottom: 8px; }
.fp-slide p { margin: 0 0 4px; }
.fp-slide-imgs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.fp-slide-imgs img { max-height: 220px; max-width: 100%; border-radius: 6px; }
.fp-frame.fp-sandbox { background: #fff; }

/* ---------- Trang chủ Alo WorkHub ---------- */
.alo-hero { max-width: 1180px; margin: 0 auto; padding: clamp(24px, 6vh, 64px) 0 48px; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, .85fr); gap: clamp(24px, 4vw, 56px); align-items: start; }
@media (max-width: 991.98px) { .alo-hero { grid-template-columns: 1fr; } .alo-auth { order: -1; } }
.alo-pill { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border-radius: 999px; background: var(--wh-surface); border: 1px solid var(--wh-border); font-weight: 600; font-size: .9rem; box-shadow: var(--wh-shadow-sm); }
.alo-pill .wh-brand-mark { height: 26px; font-size: .8rem; }
.alo-title { font-size: clamp(2rem, 4.2vw, 3.3rem); font-weight: 800; letter-spacing: -.03em; line-height: 1.08; margin: 18px 0 14px; }
.alo-gradient-text { background: linear-gradient(90deg, #0068ff, #7c3aed 60%, #c026d3); -webkit-background-clip: text; background-clip: text; color: transparent; }
.alo-lead { font-size: 1.08rem; color: var(--wh-text-2); max-width: 620px; }
.alo-platforms { display: flex; flex-wrap: wrap; gap: 6px; margin: 16px 0 26px; }
.pf-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--wh-surface); border: 1px solid var(--wh-border); font-size: .82rem; font-weight: 600; }
.pf-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.alo-features { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 575.98px) { .alo-features { grid-template-columns: 1fr; } }
.alo-feature { display: flex; gap: 12px; padding: 14px; border-radius: 14px; background: var(--wh-surface); border: 1px solid var(--wh-border); box-shadow: var(--wh-shadow-sm); }
.alo-ico { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 1.15rem; background: linear-gradient(135deg, var(--c1), var(--c2)); }
@media (min-width: 992px) { .alo-auth { position: sticky; top: calc(var(--wh-nav-h) + 16px); } }
.alo-auth-card { padding: 22px; border-radius: 18px; background: var(--wh-surface); border: 1px solid var(--wh-border); box-shadow: 0 20px 50px rgba(15, 23, 42, .12); }
.alo-tabs { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--wh-hover); margin-bottom: 16px; }
.alo-tabs button { flex: 1; border: 0; background: transparent; padding: 8px; border-radius: 9px; font-weight: 600; color: var(--wh-text-2); }
.alo-tabs button.on { background: var(--wh-surface); color: var(--wh-text); box-shadow: var(--wh-shadow-sm); }
.alo-btn { padding: 10px; font-weight: 700; border: 0; background: linear-gradient(135deg, #0068ff, #7c3aed); }
.alo-btn:hover { filter: brightness(1.07); }

/* ---------- Bản tin AI ---------- */
.brief-out { line-height: 1.6; }
.brief-h { font-size: .95rem; font-weight: 800; letter-spacing: .02em; margin: 18px 0 8px; color: var(--wh-primary); }
.brief-h:first-child { margin-top: 0; }
.brief-item { position: relative; padding: 6px 10px 6px 26px; margin-bottom: 4px; border-radius: 10px; background: var(--wh-hover); }
.brief-item::before { content: ""; position: absolute; left: 11px; top: 15px; width: 6px; height: 6px; border-radius: 50%; background: linear-gradient(135deg, #0068ff, #7c3aed); }
.brief-link { margin-left: 6px; font-size: .8rem; font-weight: 600; text-decoration: none; white-space: nowrap; }

/* ---------- Tin cuộc gọi ---------- */
.call-chip { display: flex; align-items: center; gap: 10px; padding: 6px 4px; min-width: 190px; }
.call-ico { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, #16a34a 16%, transparent); font-size: 1.05rem; }
.call-chip.missed .call-ico { background: color-mix(in srgb, #dc2626 16%, transparent); }
.call-chip.missed .fw-semibold { color: #dc2626; }

/* ---------- Captcha ---------- */
.captcha-img { border-radius: 8px; border: 1px solid var(--wh-border); flex: none; }
.captcha-box input[name=CaptchaAnswer] { text-transform: uppercase; letter-spacing: .15em; font-weight: 700; min-width: 0; }

/* ===================== Sơ đồ tổ chức ===================== */
.org-tree ul { list-style: none; margin: 0; padding: 0; }
.org-tree ul ul { margin-left: 14px; border-left: 1px dashed var(--wh-border-strong); padding-left: 6px; }
.org-node { display: flex; align-items: center; gap: 6px; padding: 5px 6px; border-radius: 8px; cursor: pointer; min-width: 0; }
.org-node:hover { background: var(--wh-hover); }
.org-node.active { background: var(--wh-primary-soft); color: var(--wh-primary); font-weight: 600; }
.org-caret { border: 0; background: none; width: 18px; padding: 0; color: var(--wh-muted); transition: transform .15s; flex: none; }
.org-caret.open { transform: rotate(90deg); }
.org-caret-space { width: 18px; flex: none; }
.org-name { flex: 1; min-width: 0; }
.org-head { font-size: .75rem; color: var(--wh-muted); max-width: 40%; }
.org-code { font-size: .7rem; font-weight: 700; padding: 1px 6px; border-radius: 6px; background: var(--wh-surface-2); color: var(--wh-muted); vertical-align: 2px; }
.org-person { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--wh-border); }
.org-person:last-child { border-bottom: 0; }
.org-role { font-size: .68rem; font-weight: 700; padding: 1px 7px; border-radius: 8px; margin-left: 4px; vertical-align: 1px; }
.org-role-head { background: #fff4e6; color: #d9480f; }
.org-role-deputy { background: #e7f5ff; color: #1864ab; }
[data-bs-theme="dark"] .org-role-head { background: #5c2b0b; color: #ffc078; }
[data-bs-theme="dark"] .org-role-deputy { background: #12355b; color: #a5d8ff; }
.org-role-select { width: auto; max-width: 130px; }
.org-chart-wrap { overflow: auto; padding: 8px 0 16px; }
.org-chart { display: inline-block; min-width: 100%; }
.org-chart ul { display: flex; justify-content: center; padding-top: 18px; position: relative; margin: 0; padding-left: 0; list-style: none; }
.org-chart > ul { padding-top: 0; }
.org-chart li { position: relative; padding: 18px 6px 0; display: flex; flex-direction: column; align-items: center; }
.org-chart > ul > li { padding-top: 0; }
.org-chart li::before, .org-chart li::after { content: ""; position: absolute; top: 0; width: 50%; height: 18px; border-top: 2px solid var(--wh-border-strong); }
.org-chart li::before { right: 50%; }
.org-chart li::after { left: 50%; border-left: 2px solid var(--wh-border-strong); }
.org-chart li:only-child::before, .org-chart li:only-child::after { display: none; }
.org-chart li:only-child { padding-top: 18px; }
.org-chart > ul > li:only-child { padding-top: 0; }
.org-chart li:first-child::before, .org-chart li:last-child::after { border: 0; }
.org-chart li:last-child::before { border-right: 2px solid var(--wh-border-strong); border-radius: 0 6px 0 0; }
.org-chart li:first-child::after { border-radius: 6px 0 0 0; }
.org-chart ul ul::before { content: ""; position: absolute; top: 0; left: 50%; height: 18px; border-left: 2px solid var(--wh-border-strong); }
.org-box { display: flex; flex-direction: column; gap: 2px; min-width: 150px; max-width: 220px; padding: 10px 12px; border-radius: 12px; text-align: center;
  border: 1px solid var(--wh-border); border-top: 4px solid var(--wh-primary); background: var(--wh-surface); box-shadow: var(--wh-shadow-sm); color: var(--wh-text); }
.org-box:hover { box-shadow: 0 4px 14px rgba(0, 0, 0, .1); }
.org-box-name { font-weight: 700; }
.org-box-head { font-size: .8rem; }
.org-box-sub { font-size: .72rem; color: var(--wh-muted); }
.people-pick { max-height: 50vh; overflow-y: auto; }
.people-pick .list-group-item { cursor: pointer; }

/* ===================== Giao việc ===================== */
.work-layout { display: grid; grid-template-columns: minmax(280px, 380px) 1fr; gap: 16px; align-items: start; }
@media (max-width: 991.98px) { .work-layout { grid-template-columns: 1fr; } }
.work-list-card { position: sticky; top: 12px; max-height: calc(100vh - 120px); display: flex; flex-direction: column; }
@media (max-width: 991.98px) { .work-list-card { position: static; max-height: none; } }
.work-list { overflow-y: auto; min-height: 0; }
.work-item { display: block; width: 100%; text-align: left; border: 1px solid transparent; background: none; border-radius: 10px; padding: 9px 10px; margin-bottom: 4px; color: var(--wh-text); }
.work-item:hover { background: var(--wh-hover); }
.work-item.active { background: var(--wh-primary-soft); border-color: color-mix(in srgb, var(--wh-primary) 30%, transparent); }
.work-type { --chip: #0068ff; display: inline-block; font-size: .72rem; font-weight: 700; padding: 2px 9px; border-radius: 10px;
  color: #fff; background: var(--chip); }
.work-tree { list-style: none; margin: 0; padding: 0; }
.work-tree .work-tree { margin-left: 18px; padding-left: 14px; border-left: 2px solid var(--wh-border); }
.work-node { position: relative; margin-top: 10px; }
.work-tree .work-tree > .work-node::before { content: ""; position: absolute; left: -14px; top: 22px; width: 12px; border-top: 2px solid var(--wh-border); }
.work-card { border: 1px solid var(--wh-border); border-left: 4px solid var(--wh-primary); border-radius: 10px; padding: 10px 12px; background: var(--wh-surface); }
.work-node.done > .work-card { border-left-color: var(--wh-success); }
.work-node.cancelled > .work-card { border-left-color: var(--wh-muted); opacity: .65; }
.work-node.late > .work-card { border-left-color: var(--wh-danger); }
.work-node.mine > .work-card { box-shadow: 0 0 0 2px color-mix(in srgb, var(--wh-primary) 25%, transparent); }
.work-note, .work-desc { white-space: pre-wrap; font-size: .9rem; margin-top: 6px; }
.work-desc { padding: 10px 12px; border-radius: 10px; background: var(--wh-surface-2); }
.work-result { white-space: pre-wrap; font-size: .85rem; margin-top: 6px; padding: 6px 8px; border-radius: 8px; background: color-mix(in srgb, var(--wh-success) 10%, var(--wh-surface)); }
.work-activity li { display: flex; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--wh-border); font-size: .88rem; }
.work-activity li.log { color: var(--wh-text-2); }
.work-act-icon { width: 20px; flex: none; text-align: center; color: var(--wh-muted); }
.work-comment { white-space: pre-wrap; }
/* Giao việc bằng lời */
.ai-row { border: 1px solid var(--wh-border); border-radius: 10px; padding: 8px 10px; margin-bottom: 8px; }
.ai-row.need { border-color: #f59f00; background: color-mix(in srgb, #f59f00 8%, var(--wh-surface)); }
.voice-btn.recording { background: var(--wh-danger); color: #fff; animation: wh-pulse 1.2s ease-in-out infinite; }
@keyframes wh-pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--wh-danger) 45%, transparent); } 50% { box-shadow: 0 0 0 8px transparent; } }
@media (prefers-reduced-motion: reduce) { .voice-btn.recording { animation: none; } }
/* Chụp màn hình trong chat */
.shot-editor { position: fixed; inset: 0; z-index: 2000; display: flex; flex-direction: column; background: rgba(15, 18, 25, .92); }
.shot-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; padding: 10px 14px; background: #1e222b; color: #e9ecef; }
.shot-hint { font-size: .85rem; opacity: .85; }
.shot-tools { display: flex; flex-wrap: wrap; gap: 6px; }
.shot-tools [data-send] { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shot-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 8px; }
.shot-canvas { cursor: crosshair; box-shadow: 0 6px 30px rgba(0, 0, 0, .5); touch-action: none; max-width: 100%; max-height: 100%; }
