/* Zalo Sales (chỉ Lãnh đạo) — dùng token nâu đen / vàng đồng của workspace.css. */
.ld-wrap { min-width: 0; }
.ld-mfa { max-width: 460px; margin: 6vh auto 0; }
.ld-mfa h1 { margin: 0 0 18px; font-size: 20px; font-weight: 600; letter-spacing: -.02em; }
.ld-mfa input { width: 100%; }
.ld-mfa button[type=submit] { width: 100%; min-height: 42px; }
.ld-loading { padding: 60px 0; text-align: center; color: var(--muted); }
.ld-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.ld-head h1 { margin: 0; font-size: 24px; font-weight: 600; letter-spacing: -.03em; color: var(--ink); }
.ld-thresholds { color: var(--muted); font-size: 12.5px; display: flex; align-items: center; gap: 6px; }

.ld-tabs { display: flex; gap: 5px; padding: 6px; margin-bottom: 22px; width: fit-content; max-width: 100%; overflow-x: auto; scrollbar-width: none;
  background: #17130f; border: 1px solid #c59b6d33; border-radius: 12px; }
.ld-tabs button { border: 1px solid transparent; background: transparent; color: var(--muted); border-radius: 8px; padding: 9px 14px; font-size: 12.5px; white-space: nowrap; }
.ld-tabs button[aria-selected="true"] { background: #c59b6d1c; border-color: #c59b6d4a; color: #e6c6a0; }
.ld-count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--crit); color: #fff; font-size: 11px; }

.ld-emergency { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 14px 18px; margin-bottom: 20px;
  border: 1px solid #ff404066; border-radius: 12px; background: var(--crit-wash); color: #ffd9d6; font-size: 13px; }
.ld-emergency strong { color: #ff6b63; font-size: 14px; }
.ld-emergency button { margin-left: auto; }

.ld-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.ld-kpi { padding: 18px 20px; border: 1px solid var(--hair-soft); border-radius: 14px; background: var(--surface); }
.ld-kpi span { display: block; color: var(--muted); font-size: 12px; }
.ld-kpi strong { display: block; margin-top: 8px; font-size: 28px; font-weight: 600; letter-spacing: -.03em; color: var(--ink); font-variant-numeric: tabular-nums; }
.ld-kpi small { font-size: 15px; color: var(--muted); font-weight: 500; }
.ld-kpi.is-alert { border-color: #f4c07866; }
.ld-kpi.is-alert strong { color: var(--high); }

.ld-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.ld-card { display: block; width: 100%; text-align: left; padding: 18px; border: 1px solid var(--hair-soft); border-radius: 14px;
  background: var(--surface); color: var(--ink); box-shadow: inset 0 3px #6b5a48; font-weight: 400; }
.ld-card:hover { border-color: #c59b6d66; background: #1c1814; }
.ld-card.s-online { box-shadow: inset 0 3px var(--normal); }
.ld-card.s-offline, .ld-card.s-qr_pending { box-shadow: inset 0 3px var(--high); }
.ld-card.s-expired, .ld-card.s-banned { box-shadow: inset 0 3px var(--crit); }
.ld-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.ld-card-top strong { font-size: 15px; font-weight: 600; }
.ld-card-who { margin-top: 6px; color: var(--muted); font-size: 12.5px; }
.ld-card-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 16px 0 12px; }
.ld-card-stats dt { color: var(--muted-2); font-size: 11px; }
.ld-card-stats dd { margin: 3px 0 0; font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.ld-card-stats small { color: var(--muted); font-size: 12px; font-weight: 500; }
.ld-card-stats .is-alert dd { color: var(--high); }
.ld-card-foot { margin-top: 10px; color: var(--muted-2); font-size: 11.5px; }
.ld-empty { padding: 40px 0; }

.ld-alerts { list-style: none; margin: 0; padding: 6px; }
.ld-alerts li + li { border-top: 1px solid var(--hair-soft); }
.ld-alerts button { display: grid; grid-template-columns: 200px minmax(0, 1fr) auto; gap: 16px; align-items: center; width: 100%;
  padding: 14px 16px; border: 0; background: transparent; text-align: left; color: var(--ink); font-weight: 400; border-radius: 9px; }
.ld-alerts button:hover { background: #ffffff05; }
.ld-alert-kind { font-size: 12px; font-weight: 600; }
.lv-crit .ld-alert-kind { color: var(--crit); }
.lv-high .ld-alert-kind { color: var(--high); }
.ld-alert-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ld-alert-main span { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ld-alert-time { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }

.ld-table th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12px; padding: 14px 16px; border-bottom: 1px solid var(--hair); }
.ld-table td { padding: 12px 16px; border-bottom: 1px solid var(--hair-soft); vertical-align: top; }
.ld-table td:first-child { white-space: nowrap; font-variant-numeric: tabular-nums; }

.ld-back { flex-shrink: 0; width: 34px; height: 34px; padding: 0 !important; font-size: 18px; border-radius: 9px; }
.ld-account { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: nowrap; padding: 8px 12px; margin-bottom: 12px;
  border: 1px solid #c59b6d40; border-radius: 17px; background: linear-gradient(110deg, #231c16, #171411); }
.ld-account h1 { margin: 0; font-size: 19px; font-weight: 600; letter-spacing: -.03em; white-space: nowrap; }
.ld-account-id { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ld-account-facts { display: flex; align-items: center; gap: 6px 14px; flex-wrap: wrap; min-width: 0; color: var(--muted); font-size: 12.5px; }
.ld-account-err { color: var(--high); }
.ld-actions { flex-shrink: 0; flex-wrap: nowrap; }
.ld-actions button { min-height: 34px; padding: 6px 12px; }

.ld-detail { display: grid; grid-template-columns: 300px minmax(0, 1fr) 280px; gap: 18px; align-items: start; }
.ld-convs, .ld-events { position: sticky; top: calc(var(--bar-h) + 20px); }
.ld-conv-list { max-height: calc(100svh - 230px); overflow-y: auto; padding: 6px; }
.ld-conv { display: flex; flex-direction: column; align-items: stretch; gap: 5px; width: 100%; text-align: left; padding: 12px; margin-bottom: 4px;
  border: 1px solid transparent; border-radius: 11px; background: transparent; color: var(--ink); font-weight: 400; }
.ld-conv:hover { background: #ffffff04; border-color: var(--hair-soft); }
.ld-conv[aria-current="true"] { background: linear-gradient(110deg, #b7834f24, #b7834f0c); border-color: #c59b6d66; box-shadow: inset 3px 0 #c59b6d; }
.ld-conv-top { display: flex; justify-content: space-between; gap: 8px; width: 100%; }
.ld-conv-top strong { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ld-conv-top time { color: var(--muted-2); font-size: 11px; white-space: nowrap; }
.ld-conv-prev { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; width: 100%; }
.ld-conv-wait { color: var(--muted); font-size: 11px; }
.ld-conv.is-overdue .ld-conv-wait { color: var(--high); font-weight: 600; }

.ld-thread { min-height: 420px; display: flex; flex-direction: column; }
.ld-msgs { flex: 1; max-height: calc(100svh - 250px); min-height: 360px; overflow-y: auto; padding: 18px 22px; display: flex; flex-direction: column; gap: 10px; }
.ld-day { align-self: center; margin: 8px 0; padding: 3px 12px; border-radius: 99px; background: var(--surface-3); color: var(--muted); font-size: 11px; }
.ld-msg { display: flex; flex-direction: column; max-width: min(72%, 560px); }
.ld-msg.in { align-self: flex-start; }
.ld-msg.out { align-self: flex-end; align-items: flex-end; }
.ld-bubble { padding: 10px 14px; border-radius: 14px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13.5px; }
.ld-msg.in .ld-bubble { background: var(--surface-3); border-bottom-left-radius: 4px; }
.ld-msg.out .ld-bubble { background: #5b412b; color: #f7ece0; border-bottom-right-radius: 4px; }
.ld-msg-type { display: inline-block; margin-right: 6px; padding: 1px 7px; border-radius: 6px; background: #0000002e; font-size: 11px; font-weight: 600; }
.ld-msg-meta { margin-top: 4px; color: var(--muted-2); font-size: 11px; }

.ld-event-list { list-style: none; margin: 0; padding: 8px 18px 16px; max-height: calc(100svh - 230px); overflow-y: auto; }
.ld-event-list li { display: flex; flex-direction: column; gap: 3px; padding: 10px 0; border-bottom: 1px solid var(--hair-soft); font-size: 12.5px; }
.ld-event-list li:last-child { border-bottom: 0; }
.ld-event-list time { color: var(--muted-2); font-size: 11px; font-variant-numeric: tabular-nums; }
.ld-event-list em { color: var(--bronze); font-style: normal; }

.ld-modal { max-width: 560px; margin-top: 8vh; }
.ld-note { margin: 0 0 16px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.ld-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.ld-dlg-actions { justify-content: flex-end; margin-top: 4px; }
.overlay .ld-modal input, .overlay .ld-modal select, .overlay .ld-modal textarea { width: 100%; }
.overlay .ld-modal textarea { min-height: 90px; }
.ld-qr { text-align: center; }
.ld-qr-box { display: grid; place-items: center; min-height: 260px; }
.ld-qr-box img { width: 240px; height: 240px; padding: 10px; border-radius: 12px; background: #fff; }
.ld-qr-ph { width: 240px; height: 240px; border-radius: 12px; border: 1px dashed var(--hair); display: grid; place-items: center; }
.ld-qr-ph.ok { border-style: solid; border-color: var(--normal); color: var(--normal); }
.ld-qr-text { margin: 16px 0 8px; color: var(--ink-2); font-size: 13.5px; }

@media (max-width: 1320px) {
  .ld-detail { grid-template-columns: 280px minmax(0, 1fr); }
  .ld-events { grid-column: 1 / -1; position: static; }
}
@media (max-width: 900px) {
  .ld-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ld-detail { grid-template-columns: minmax(0, 1fr); }
  .ld-convs { position: static; }
  .ld-conv-list { max-height: 320px; }
  .ld-alerts button { grid-template-columns: minmax(0, 1fr) auto; }
  .ld-alert-kind { grid-column: 1 / -1; }
  .ld-grid2 { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .ld-kpi strong { font-size: 22px; }
  .ld-account { padding: 8px 10px; }
  .ld-msg { max-width: 88%; }
}

/* Hộp thư Zalo của Sales + ảnh/file trong hội thoại */
.zin-label { font-size: 13px; color: var(--ink-2); }
.zin-search { padding: 10px 12px 0; }
.zin-search input { width: 100%; }
.zin-cust { color: var(--bronze); font-size: 11.5px; }
.zin-detail { grid-template-columns: 320px minmax(0, 1fr); }
.zin-thread .ld-msgs { max-height: calc(100svh - 330px); }
.zin-compose { display: flex; gap: 10px; align-items: flex-end; padding: 12px 16px; border-top: 1px solid var(--hair-soft); }
.zin-compose textarea { flex: 1; min-height: 44px !important; max-height: 160px; resize: vertical; line-height: 1.5 !important; }
.zin-compose button { min-height: 44px; flex-shrink: 0; }
.zin-img { display: block; max-width: min(280px, 100%); max-height: 320px; border-radius: 10px; cursor: zoom-in; background: #0003; min-width: 80px; min-height: 60px; }
.zin-cust-results { display: grid; gap: 6px; max-height: 320px; overflow-y: auto; }
.zin-cust-results button { display: flex; justify-content: space-between; gap: 12px; text-align: left; font-weight: 400; }
.zin-cust-results button span { color: var(--muted); font-size: 12px; }
@media (max-width: 900px) {
  .zin-detail { grid-template-columns: minmax(0, 1fr); }
  .zin-thread .ld-msgs { max-height: 60svh; }
}
.ld-head select { width: auto; min-width: 180px; }
.ld-msg.is-pending .ld-bubble { opacity: .6; }
.ld-msg.is-failed .ld-bubble { outline: 1px solid var(--crit); }
.ld-msg.is-failed .ld-msg-meta { color: var(--crit); }
.ld-by-leader { color: var(--high); font-weight: 600; }
.ld-msg.by-leader .ld-bubble { box-shadow: inset 0 0 0 1px #f4c07880; }

/* Chi tiết tài khoản (Lãnh đạo): khung cao hết màn hình để thấy nhiều dòng hơn */
.ld-detail[data-account] { gap: 14px; }
.ld-detail[data-account] .ld-convs, .ld-detail[data-account] .ld-events { top: calc(var(--bar-h) + 12px); }
.ld-detail[data-account] .ld-conv-list, .ld-detail[data-account] .ld-event-list { max-height: calc(100svh - 230px); }
.ld-detail[data-account] .ld-thread .ld-msgs { flex: none; height: calc(100svh - 306px); max-height: none; min-height: 280px; }
.ld-detail[data-account] .panel-head { padding: 12px 18px; }
@media (max-width: 1100px) {
  .ld-account { flex-wrap: wrap; }
}
@media (max-width: 900px) {
  .ld-detail[data-account] .ld-thread .ld-msgs { height: 60svh; }
  .ld-detail[data-account] .ld-conv-list { max-height: 320px; }
}

/* Ảnh đại diện */
.zav { flex-shrink: 0; width: 38px; height: 38px; border-radius: 50%; display: inline-grid; place-items: center; background: #36271b center / cover no-repeat;
  color: #e4c29b; font-size: 14px; font-weight: 600; border: 1px solid #8d674640; }
.zav.has-img { color: transparent; }
.zav-sm { width: 30px; height: 30px; font-size: 12px; }
.zav-lg { width: 56px; height: 56px; font-size: 20px; }
.ld-conv.has-av { flex-direction: row; align-items: flex-start; gap: 10px; }
.ld-conv-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }

/* Sticker */
.ld-msg.is-sticker { gap: 4px; }
.zin-sticker { display: block; width: 110px; height: 110px; object-fit: contain; }
.zin-compose { position: relative; }
.zst-btn { min-height: 44px; width: 44px; padding: 0; font-size: 20px; flex-shrink: 0; }
.zst-pop { position: absolute; right: 16px; bottom: calc(100% + 6px); z-index: 30; width: min(360px, calc(100% - 32px)); padding: 10px;
  background: var(--surface); border: 1px solid var(--hair); border-radius: 12px; box-shadow: var(--shadow-3); }
.zst-words { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.zst-words button { padding: 3px 9px; font-size: 12px; font-weight: 500; border-radius: 99px; }
.zst-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; max-height: 260px; overflow-y: auto; }
.zst-grid button { padding: 4px; background: transparent; border-color: transparent; aspect-ratio: 1; }
.zst-grid button:hover { background: #ffffff08; border-color: var(--hair-soft); }
.zst-grid img { width: 100%; height: 100%; object-fit: contain; }

/* Tìm Zalo theo số */
.zin-find input { flex: 1; min-width: 180px; }
.zin-found { display: flex; align-items: center; gap: 14px; margin: 16px 0; }
.zin-found strong { display: block; font-size: 15px; }
.zin-found .muted { font-size: 12.5px; }
.zst-tabs { display: flex; gap: 4px; margin-bottom: 8px; }
.zst-tabs button { flex: 1; padding: 6px; font-size: 12.5px; border-color: transparent; background: transparent; color: var(--muted); }
.zst-tabs button[aria-selected="true"] { background: var(--bronze-wash); border-color: var(--hair); color: var(--bronze-deep); }
.zst-body input { width: 100%; }
.zst-emoji { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; max-height: 250px; overflow-y: auto; }
.zst-emoji button { padding: 4px 0; font-size: 22px; line-height: 1.2; background: transparent; border-color: transparent; }
.zst-emoji button:hover { background: #ffffff0a; }
.zst-packs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 6px; border-bottom: 1px solid var(--hair-soft); }
.zst-packs button { flex-shrink: 0; width: 40px; height: 40px; padding: 3px; background: transparent; }
.zst-packs button[aria-pressed="true"] { border-color: var(--bronze); background: var(--bronze-wash); }
.zst-packs img { width: 100%; height: 100%; object-fit: contain; }
.zst-err { color: var(--high); font-size: 12.5px; grid-column: 1 / -1; }

/* Xem ảnh trong chat (khung nổi) */
.zin-img { cursor: zoom-in; }
.zlb { position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center; padding: 56px 64px 24px; background: rgba(8, 6, 4, .88); }
.zlb-img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; box-shadow: 0 12px 48px rgba(0, 0, 0, .5); }
.zlb-bar { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 8px; padding: 10px 14px; color: #f2e8dc; font-size: 13px; }
.zlb-btn { min-height: 0; padding: 6px 12px; border: 1px solid #ffffff33; border-radius: 8px; background: #ffffff14; color: #f2e8dc; font-size: 12.5px; font-weight: 600; text-decoration: none; }
.zlb-btn:hover { background: #ffffff26; color: #fff; }
.zlb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 64px; min-height: 0; padding: 0; border: 0; border-radius: 10px; background: #ffffff14; color: #fff; font-size: 34px; line-height: 1; }
.zlb-nav:hover { background: #ffffff2b; color: #fff; }
.zlb-nav.prev { left: 12px; }
.zlb-nav.next { right: 12px; }
@media (max-width: 600px) { .zlb { padding: 52px 8px 12px; } .zlb-nav { width: 36px; height: 52px; font-size: 28px; } }

/* Thông báo tin mới */
.zin-badge { display: inline-block; box-sizing: border-box; min-width: 18px; height: 18px; margin-left: 6px; padding: 0 5px; border-radius: 99px; text-align: center; line-height: 18px; font-variant-numeric: tabular-nums;
  background: var(--crit); color: #fff; font-size: 10.5px; font-weight: 700; line-height: 1; }
.zin-unread { margin-left: auto; margin-right: 6px; min-width: 18px; padding: 1px 6px; border-radius: 99px; background: var(--crit); color: #fff; font-size: 10.5px; font-weight: 700; text-align: center; }
.zin-unread.is-quiet { background: var(--surface-3); color: var(--muted); }
.ld-conv.is-unread .ld-conv-prev { color: var(--ink); font-weight: 600; }
.zin-notes { position: fixed; left: 20px; bottom: 20px; z-index: 70; display: flex; flex-direction: column; gap: 8px; width: min(340px, calc(100vw - 32px)); }
.zin-note { position: relative; display: flex; background: var(--surface); border: 1px solid var(--hair); border-left: 3px solid var(--bronze); border-radius: 12px; box-shadow: var(--shadow-3); animation: zin-note-in .18s ease-out; }
.zin-note-open { flex: 1; display: flex; flex-direction: column; align-items: stretch; gap: 3px; min-width: 0; padding: 10px 34px 10px 12px; border: 0; background: transparent; text-align: left; font-weight: 400; }
.zin-note-open:hover { background: #ffffff06; }
.zin-note-top { display: flex; align-items: baseline; gap: 8px; }
.zin-note-top strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.zin-note-top small { margin-left: auto; flex-shrink: 0; color: var(--muted); font-size: 11px; }
.zin-note-text { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; color: var(--ink-2); font-size: 12.5px; }
.zin-note-x { position: absolute; top: 6px; right: 6px; min-height: 0; padding: 2px 6px; border: 0; background: transparent; color: var(--muted); font-size: 12px; }
@keyframes zin-note-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .zin-note { animation: none; } }

/* Cửa sổ chat nhanh từ trang Khách hàng */
.zin-pop { position: fixed; right: 20px; bottom: 20px; z-index: 60; width: min(400px, calc(100vw - 32px)); height: min(560px, calc(100vh - 100px));
  display: flex; flex-direction: column; margin: 0; padding: 0; overflow: hidden; box-shadow: var(--shadow-3); }
.zin-pop > .panel-head { gap: 8px; }
.zin-pop-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.zin-pop-head span { display: flex; flex-direction: column; min-width: 0; }
.zin-pop-head strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zin-pop-head small { color: var(--muted); font-size: 11px; }
.zin-pop .ld-msgs { flex: 1; min-height: 0; height: auto; max-height: none; overflow-y: auto; }
.zin-pop .zin-compose { padding: 10px 12px; }
.zin-pop .zin-compose textarea { min-height: 40px !important; }
.zin-cf-pick { gap: 10px; align-items: center; }
@media (max-width: 600px) { .zin-pop { right: 8px; left: 8px; bottom: 8px; width: auto; height: calc(100vh - 80px); } }

/* @nhắc tên, trích dẫn, trả lời, thành viên nhóm */
.zmention { color: var(--bronze-lift, #e7c08d); font-weight: 600; }
.ld-msg.mention-me .ld-bubble { box-shadow: inset 3px 0 0 var(--bronze); }
.zquote { display: block; margin: -2px 0 6px; padding: 5px 9px; border-left: 3px solid var(--bronze); border-radius: 6px; background: #00000026; font-size: 12px; line-height: 1.45; }
.zquote strong { display: block; font-size: 11.5px; }
.zquote span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; opacity: .85; }
.zin-reply { min-height: 0; margin-left: 6px; padding: 0 6px; border: 0; background: none; color: var(--bronze-deep); font-size: 11px; opacity: 0; }
.ld-msg:hover .zin-reply, .zin-reply:focus-visible { opacity: 1; }
@media (hover: none) { .zin-reply { opacity: 1; } }
.zin-compose { flex-wrap: wrap; }
.zin-replybar { flex-basis: 100%; display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-left: 3px solid var(--bronze); border-radius: 6px; background: var(--surface-2); font-size: 12.5px; }
.zin-replybar span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zin-replybar button { min-height: 0 !important; padding: 2px 8px; }
.zmen-pop { position: absolute; left: 16px; bottom: calc(100% + 6px); z-index: 30; width: min(280px, calc(100% - 32px)); max-height: 260px; overflow-y: auto; padding: 6px;
  background: var(--surface); border: 1px solid var(--hair); border-radius: 12px; box-shadow: var(--shadow-3); }
.zmen-pop button { display: block; width: 100%; min-height: 0; padding: 7px 10px; text-align: left; background: transparent; border-color: transparent; font-weight: 500; }
.zmen-pop button[aria-selected="true"] { background: var(--bronze-wash); border-color: var(--hair); }
.zmembers { display: grid; gap: 8px; max-height: 60vh; overflow-y: auto; }
.zmembers > div { display: flex; align-items: center; gap: 10px; }
.zmembers > div > span:nth-child(2) { flex: 1; }

/* ---------- Bot tư vấn ---------- */
.ld-by-bot { color: #1b54c8; font-weight: 600; }
.ld-msg.by-bot .ld-bubble { box-shadow: inset 0 0 0 1px #9bb8f0; background: #eef4ff; color: #0f2a66; }
.ld-conv-wait.is-bot { color: #1b54c8; background: #eef4ff; }
.zbot-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 7px 14px; border-bottom: 1px solid var(--hair-soft); background: #f5f8ff; font-size: 12.5px; }
.zbot-bar.is-handoff { background: #fff4e5; border-bottom-color: #f0cfa6; }
.zbot-bar .zbot-text { flex: 1 1 200px; min-width: 0; }
.zbot-bar .zbot-ico { font-size: 15px; }
.lb-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, .75fr); gap: 16px; align-items: start; }
.lb-col { display: grid; gap: 16px; min-width: 0; }
.lb-note { margin: 0; padding: 10px 16px 14px; font-size: 12px; color: var(--muted); }
.lb-inline { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.lb-inline input { width: 74px; }
.lb-list { list-style: none; margin: 0; padding: 4px 0; }
.lb-list li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-top: 1px solid var(--hair-soft); }
.lb-list li:first-child { border-top: 0; }
.lb-list li.is-off .lb-main { opacity: .55; }
.lb-main { flex: 1 1 auto; min-width: 0; }
.lb-main p { margin: 4px 0 0; font-size: 12.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.lb-kws { display: inline-flex; flex-wrap: wrap; gap: 4px; margin-left: 6px; vertical-align: middle; }
.lb-kws .chip { font-size: 11px; padding: 1px 7px; }
.lb-price { font-weight: 700; color: var(--bronze-deep); }
.lb-side { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.lb-switch { position: relative; display: inline-block; width: 36px; height: 20px; flex: 0 0 auto; }
.lb-switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.lb-switch span { position: absolute; inset: 0; border-radius: 999px; background: #c9c9d0; transition: background .15s; }
.lb-switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px #0003; transition: transform .15s; }
.lb-switch input:checked + span { background: var(--bronze); }
.lb-switch input:checked + span::after { transform: translateX(16px); }
.lb-switch input:focus-visible + span { outline: 2px solid var(--bronze); outline-offset: 2px; }
.lb-form { display: grid; gap: 10px; }
.lb-form .field { margin: 0; }
.lb-check { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.lb-days { display: flex; flex-wrap: wrap; gap: 6px 12px; margin: 0; padding: 8px 10px; border: 1px solid var(--hair-soft); border-radius: 10px; }
.lb-days legend { padding: 0 4px; font-size: 12px; color: var(--muted); }
.lb-days label { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; }
.lb-test { margin-top: 10px; display: grid; gap: 8px; }
.lb-test-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lb-test .ld-msg { max-width: 100%; }
#botTestForm textarea { width: 100%; }
#botTestForm .btn-row { margin-top: 8px; align-items: center; }
.lb-log-bot_handoff { color: #a2560b; } .lb-log-bot_error { color: var(--crit); } .lb-log-bot_reply { color: #1b54c8; }
@media (max-width: 1100px) { .lb-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) { .lb-list li { flex-direction: column; } .lb-side { justify-content: flex-start; } }
#appView .lb-check input[type="checkbox"], #appView .lb-days input[type="checkbox"] { width: 16px; height: 16px; min-height: 0; margin: 0; padding: 0; flex: 0 0 auto; accent-color: var(--bronze); }
#botTestForm .btn-row { display: flex; justify-content: space-between; }
#botTestForm .btn-row .spacer { display: none; }
#botCfgForm .btn-row { display: flex; justify-content: flex-end; }

.lb-pages { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.lb-pages li { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 6px 10px; border: 1px solid var(--hair-soft); border-radius: 10px; }
#mkForm.is-off { opacity: .55; }
#appView .lb-days-in { width: 70px; min-height: 0; height: 28px; padding: 2px 6px; display: inline-block; }
#mkForm .btn-row { display: flex; justify-content: flex-end; }

.zbot-bar.is-paused { background: #f4f4f6; }

/* ---------- Nạp kiến thức bot bằng AI ---------- */
.lb-kb { margin-bottom: 16px; border-color: var(--bronze-lift); background: linear-gradient(90deg, var(--bronze-wash), var(--surface) 70%); }
.lb-kb .panel-body { display: flex; align-items: center; gap: 16px; }
.lb-kb .panel-body > div { flex: 1 1 auto; min-width: 0; }
.lb-kb p { margin: 4px 0 0; }
.kb-wrap { display: grid; gap: 14px; }
.kb-head { display: flex; align-items: flex-start; gap: 14px; }
.kb-head h2 { margin: 0; font-size: 20px; }
.kb-head p { margin: 2px 0 0; }
.kb-steps { list-style: none; margin: 0; padding: 0; display: flex; gap: 8px; flex-wrap: wrap; }
.kb-steps li { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px 6px 6px; border-radius: 999px; background: var(--surface); border: 1px solid var(--hair); font-size: 13px; color: var(--muted); }
.kb-steps b { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--hair-soft); font-size: 12px; }
.kb-steps li.is-on { border-color: var(--bronze); color: var(--ink); font-weight: 600; background: var(--bronze-wash); }
.kb-steps li.is-on b, .kb-steps li.is-done b { background: var(--bronze); color: #fff; }
.kb-pick { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr); gap: 14px; align-items: start; }
.kb-drop { display: grid; gap: 4px; justify-items: center; text-align: center; padding: 22px 16px; border: 2px dashed var(--hair); border-radius: var(--r-lg); cursor: pointer; background: var(--paper); transition: border-color .15s, background .15s; }
.kb-drop:hover, .kb-drop.is-over { border-color: var(--bronze); background: var(--bronze-wash); }
.kb-drop input { margin-top: 6px; max-width: 100%; }
.kb-url { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 12px; }
.kb-url input[type=url] { flex: 1 1 260px; min-width: 0; }
.kb-sources { list-style: none; margin: 12px 0 0; padding: 0; border-top: 1px solid var(--hair-soft); }
.kb-sources li { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--hair-soft); flex-wrap: wrap; }
.kb-src-name { flex: 1 1 200px; min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
.kb-pages { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; }
.kb-pages input { width: 110px; }
.kb-empty { margin: 12px 0 0; }
#kbNotes { width: 100%; }
.kb-actions { margin: 0; }
.kb-resume { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.kb-progress { height: 8px; border-radius: 999px; background: var(--hair-soft); overflow: hidden; }
.kb-progress span { display: block; height: 100%; background: var(--bronze); transition: width .3s; }
.kb-jobs { list-style: none; margin: 8px 0 0; padding: 0; max-height: 420px; overflow: auto; }
.kb-jobs li { display: flex; align-items: baseline; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--hair-soft); font-size: 13px; }
.kb-job-name { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.kb-ico { width: 16px; text-align: center; font-weight: 700; color: var(--muted); }
.kb-jobs .is-run .kb-ico { color: var(--bronze); }
.kb-jobs .is-done .kb-ico { color: var(--normal); }
.kb-jobs .is-err .kb-ico, .kb-jobs .is-err .muted { color: var(--crit); }
.kb-toolbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.kb-list { list-style: none; margin: 0; padding: 0; }
.kb-item { display: flex; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--hair-soft); }
.kb-item:first-child { border-top: 0; }
.kb-item.is-off .kb-fields { opacity: .5; }
.kb-pick-item { padding-top: 6px; }
.kb-pick-item input { width: 18px; height: 18px; }
.kb-fields { flex: 1 1 auto; min-width: 0; display: grid; gap: 6px; }
.kb-fields textarea { width: 100%; resize: vertical; font-size: 13px; }
.kb-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.kb-row input { flex: 1 1 240px; min-width: 0; font-weight: 600; }
.kb-row input.kb-price { flex: 0 1 260px; color: var(--bronze-deep); }
.kb-kw { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.kb-src { margin: 0; }
.kb-conflict { padding: 6px 10px; border-radius: var(--r-sm); background: var(--crit-wash); color: var(--crit); font-size: 12.5px; }
.kb-sticky { position: sticky; bottom: 0; z-index: 2; padding: 10px 14px; background: var(--surface); border: 1px solid var(--hair); border-radius: var(--r-lg); box-shadow: 0 -4px 16px #0000000f; }
@media (max-width: 860px) {
  .kb-pick { grid-template-columns: 1fr; }
  .lb-kb .panel-body { flex-direction: column; align-items: stretch; }
  .kb-head { flex-direction: column; }
}
.kb-wrap .spacer { flex: 1; }
.lb-kb button { white-space: nowrap; }

/* ===== MOBILE 11/2026 (≤ 760px) — docs/MOBILE-UI-SPEC.md =====
   Nhập Mã nội bộ (Lãnh đạo): màn khóa gọn giữa màn, không khung; hộp thoại Zalo thành tấm trượt từ dưới. */
@media screen and (max-width: 760px) {
  body.sales-shell #appView #zaloMain:has(> .ld-mfa) {
    display: flex; flex-direction: column; justify-content: center;
    min-height: calc(100dvh - 52px - var(--m-tabbar) - 24px); box-sizing: border-box; padding: 0 12px 6vh;
  }
  body.sales-shell #appView .ld-mfa { width: 100%; max-width: 400px; margin: 0 auto; border: 0; border-radius: 0; background: none; box-shadow: none; }
  body.sales-shell #appView .ld-mfa > .panel-body { padding: 0; }
  /* Biểu tượng ổ khóa trên tiêu đề (trang trí, không chữ) */
  body.sales-shell #appView .ld-mfa > .panel-body::before {
    content: ""; display: block; width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 20px;
    background: var(--m-accent-wash) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239A6A2E' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4.5' y='10.5' width='15' height='10' rx='2.5'/%3E%3Cpath d='M8 10.5V7.5a4 4 0 018 0v3M12 14.5v2.5'/%3E%3C/svg%3E") center / 30px no-repeat;
  }
  body.sales-shell #appView .ld-mfa h1 { margin: 0 0 20px; color: var(--m-ink); font-size: 22px; font-weight: 800; letter-spacing: -.3px; text-align: center; }
  body.sales-shell #appView .ld-mfa .field { margin: 0 0 12px; }
  body.sales-shell #appView .ld-mfa .field label { display: block; margin-bottom: 6px; color: var(--m-sub); font-size: 13px; font-weight: 600; }
  body.sales-shell #appView .ld-mfa input { height: 52px; min-height: 52px; border-color: var(--m-line); border-radius: 14px; font-size: 20px; letter-spacing: 4px; text-align: center; }
  body.sales-shell #appView .ld-mfa button[type=submit] { width: 100%; min-height: 50px; border-radius: 14px; font-size: 16px; font-weight: 700; }
  body.sales-shell #appView .ld-mfa .notice { margin-bottom: 12px; border-radius: 12px; }

  /* Hộp thoại Zalo (.overlay): tấm trượt từ dưới, đầu dính + nút ✕ */
  body.sales-shell :is(#zinDialog, #zaloDialog) > .modal { display: flex; flex-direction: column; max-height: 92dvh; border: 0; }
  body.sales-shell :is(#zinDialog, #zaloDialog) > .modal > .panel-head {
    position: sticky; top: 0; z-index: 2; flex: none; min-height: 56px; box-sizing: border-box; padding: 8px 8px 8px 16px;
    border-bottom: 1px solid var(--m-line-soft); background: #fff; color: var(--m-ink); font-size: 16px; font-weight: 800;
  }
  body.sales-shell :is(#zinDialog, #zaloDialog) > .modal > .panel-head > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  body.sales-shell :is(#zinDialogClose, #zaloDialogClose) {
    flex: none; display: inline-grid; place-items: center; width: 40px; min-width: 40px; height: 40px; min-height: 40px; padding: 0;
    border: 0; border-radius: 12px; background: var(--m-wash); color: var(--m-ink); font-size: 0;
  }
  body.sales-shell :is(#zinDialogClose, #zaloDialogClose)::before {
    content: ""; width: 18px; height: 18px; background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E") center / contain no-repeat;
  }
  body.sales-shell :is(#zinDialog, #zaloDialog) > .modal > .panel-body { flex: 1 1 auto; min-height: 0; padding: 14px 16px calc(16px + env(safe-area-inset-bottom, 0px)); overflow: auto; }
  body.sales-shell :is(#zinDialog, #zaloDialog) .ld-dlg-actions { position: sticky; bottom: calc(-16px - env(safe-area-inset-bottom, 0px)); display: flex; gap: 8px; margin: 12px -16px calc(-16px - env(safe-area-inset-bottom, 0px)); padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--m-line); background: #fff; }
  body.sales-shell :is(#zinDialog, #zaloDialog) .ld-dlg-actions button { flex: 1 1 0; min-height: 46px; border-radius: 12px; font-size: 15px; }
  body.sales-shell :is(#zinDialog, #zaloDialog) .ld-grid2 { grid-template-columns: minmax(0, 1fr); }
  body.sales-shell :is(#zinDialog, #zaloDialog) .zin-cust-results button { min-height: 52px; border-radius: 12px; }
}
