/* HS WIN (trước là HSVN Inbox) 0.6: giao diện mới (thanh menu dọc, thẻ, ảnh đại diện). Không thư viện ngoài. */
:root {
  /* màu lấy từ logo HSVN: xanh navy #233477, chữ HS ánh bạc */
  --rail: #121c45; --rail-2: #1f2d63; --rail-text: #aab4d4;
  --bg: #f4f6fb; --panel: #fff; --line: #e3e7f0; --line-2: #eef1f7;
  --text: #141c33; --muted: #5f6b85; --faint: #97a0b5;
  --primary: #233477; --primary-600: #1a2760; --primary-50: #eef1f9; --primary-100: #d8def0;
  --silver: #c9cfdc;
  --warn: #c2410c; --warn-50: #fff4ec; --ok: #0f7a55; --ok-50: #e9f8f1; --bad: #c81e1e; --bad-50: #fdeeee;
  --violet: #5b46c9; --violet-50: #f1effc;
  --out: #233477; --in: #fff;
  --r: 12px; --r-sm: 9px;
  --sh: 0 1px 2px rgba(18,28,69,.05), 0 1px 3px rgba(18,28,69,.06);
  --sh-lg: 0 16px 40px rgba(18,28,69,.16);
  --font: "Be Vietnam Pro", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font: 14px/1.5 var(--font); background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
a { color: var(--primary); }
code { background: var(--line-2); padding: 1px 5px; border-radius: 4px; font-size: 12px; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
.hidden { display: none !important; }
.muted { color: var(--muted); } .small { font-size: 12px; } .err { color: var(--bad); min-height: 1em; }
.spacer { flex: 1; }
.mt { margin-top: 14px !important; }

/* ---------- nút, ô nhập ---------- */
button { font: inherit; cursor: pointer; border: 1px solid transparent; border-radius: var(--r-sm); padding: 7px 13px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: background .15s, border-color .15s, color .15s; }
button:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; font-weight: 600; }
.btn-primary:hover:not(:disabled) { background: var(--primary-600); }
.btn-ghost { background: var(--panel); color: var(--text); border-color: var(--line); font-weight: 500; }
.btn-ghost:hover:not(:disabled) { background: var(--primary-50); border-color: var(--primary-100); color: var(--primary); }
.btn-ghost.sm, button.sm { padding: 4px 9px; font-size: 12px; }
.btn-block { width: 100%; }
.link { background: none; color: var(--primary); padding: 3px 6px; font-size: 13px; }
.link:hover { background: var(--primary-50); }
.link.danger { color: var(--bad); } .link.danger:hover { background: var(--bad-50); }
.icon-btn { background: none; padding: 6px; color: var(--muted); }
.icon-btn:hover { background: var(--line-2); color: var(--text); }
input, select, textarea { font: inherit; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 7px 10px; background: #fff;
  color: var(--text); width: 100%; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-100); }
input:disabled, textarea:disabled { background: var(--line-2); }
input[type=checkbox] { width: auto; margin: 0 6px 0 0; accent-color: var(--primary); }
input[type=color] { padding: 2px; width: 44px; height: 36px; }
label { display: block; margin: 0 0 10px; font-size: 12px; color: var(--muted); font-weight: 500; }
label > input, label > textarea, label > select { margin-top: 4px; color: var(--text); font-size: 14px; }
label.inl { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
label.inl input { width: auto; margin: 0; }
label.chk { display: inline-flex; align-items: center; margin: 0; white-space: nowrap; font-size: 13px; }

/* ---------- đăng nhập ---------- */
.login { display: grid; grid-template-columns: 1.1fr 1fr; height: 100%; }
.login-brand { background: radial-gradient(1200px 600px at -10% -10%, #2b55c2 0%, transparent 60%), linear-gradient(160deg, #0f1d3a 0%, #142857 100%);
  color: #dfe7fb; padding: 56px 64px; display: flex; flex-direction: column; justify-content: center; }
.login-brand h1 { font-size: 34px; color: #fff; margin: 18px 0 10px; }
.login-brand p { font-size: 16px; max-width: 460px; color: #b9c6e6; margin: 0 0 22px; }
.login-brand ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.login-brand li { display: flex; gap: 10px; align-items: center; color: #dfe7fb; }
.login-brand li svg { color: #7fb0ff; }
.logo-big { width: 56px; height: 56px; border-radius: 14px; background: var(--primary); display: grid; place-items: center; box-shadow: 0 8px 24px rgba(36,87,214,.45); }
.logo-big svg { width: 28px; height: 28px; color: #fff; fill: rgba(255,255,255,.15); }
.login-side { display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-box { width: 100%; max-width: 380px; background: var(--panel); padding: 32px; border-radius: 14px; box-shadow: var(--sh-lg); border: 1px solid var(--line); }
.login-box h2 { font-size: 22px; } .login-box > p { margin: 4px 0 20px; }
.login-box button { margin-top: 8px; padding: 10px; }

/* ---------- khung chính ---------- */
#app { display: flex; height: 100%; }
.rail { width: 84px; background: var(--rail); display: flex; flex-direction: column; align-items: center; padding: 14px 8px; gap: 2px; flex: none; overflow-y: auto; }
.rail-logo { width: 40px; height: 40px; border-radius: 11px; background: var(--primary); display: grid; place-items: center; margin-bottom: 14px; box-shadow: 0 6px 16px rgba(36,87,214,.5); }
.rail-logo svg { color: #fff; fill: rgba(255,255,255,.15); width: 20px; height: 20px; }
.rail .tab, .rail-out { position: relative; width: 68px; flex-direction: column; gap: 4px; padding: 9px 4px; background: none; color: var(--rail-text); font-size: 11px; font-weight: 500; border-radius: 10px; }
.rail .tab svg, .rail-out svg { width: 21px; height: 21px; }
.rail .tab:hover, .rail-out:hover { background: var(--rail-2); color: #fff; }
.rail .tab.active { background: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(36,87,214,.4); }
.rail-badge { position: absolute; top: 4px; right: 8px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #f04438; color: #fff; font-size: 10px; line-height: 18px; font-weight: 700; }
.rail-me { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.top { display: flex; align-items: center; gap: 12px; padding: 0 20px; height: 56px; background: var(--panel); border-bottom: 1px solid var(--line); flex: none; }
.top-title { display: flex; align-items: baseline; gap: 14px; min-width: 0; }
.top-title strong { font-size: 17px; }
.sync-info { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: inline-flex; gap: 10px; }
.sync-info .dot { display: inline-flex; align-items: center; gap: 5px; }
.sync-info .dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.sync-info .dot.ok::before { background: #12b76a; } .sync-info .dot.bad::before { background: #f04438; }
.me-box { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; white-space: nowrap; }
.role-pill { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 10px; background: var(--primary-50); color: var(--primary); }

/* ảnh đại diện chữ cái */
.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 14px; flex: none; position: relative; letter-spacing: .02em; }
.avatar.sm { width: 34px; height: 34px; font-size: 12px; border: 2px solid rgba(255,255,255,.15); }
.avatar .ch-dot { position: absolute; right: -2px; bottom: -2px; width: 16px; height: 16px; border-radius: 50%; border: 2px solid #fff; font-size: 8px; display: grid; place-items: center; font-weight: 800; }

/* ---------- hộp thư ---------- */
.inbox { flex: 1; display: grid; grid-template-columns: 360px minmax(0, 1fr) 320px; min-height: 0; }
.col-list { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.list-head { padding: 12px 12px 10px; border-bottom: 1px solid var(--line); display: grid; gap: 10px; }
.views { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 3px; background: var(--line-2); padding: 3px; border-radius: 9px; }
.views::-webkit-scrollbar { display: none; }
.view { background: none; color: var(--muted); padding: 5px 6px; font-size: 12.5px; font-weight: 600; border-radius: 7px; white-space: nowrap; }
.view:hover { color: var(--text); }
.view.active { background: var(--panel); color: var(--text); box-shadow: var(--sh); }
.view b { font-weight: 700; font-size: 11px; color: var(--muted); }
.view b:not(:empty) { background: var(--line); padding: 0 6px; border-radius: 8px; }
.view[data-view=waiting] b:not(:empty) { background: #f04438; color: #fff; }
.view[data-view=stale] b:not(:empty) { background: var(--warn-50); color: var(--warn); }
.filters { display: grid; gap: 8px; }
.search { position: relative; }
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--faint); width: 16px; height: 16px; }
.search input { padding-left: 34px; background: var(--bg); border-color: transparent; }
.search input:focus { background: #fff; }
.filter-row { display: flex; gap: 10px; align-items: center; }
.filter-row select { flex: 1; padding: 6px 8px; font-size: 13px; }
.stale-bar { display: flex; gap: 8px; align-items: center; justify-content: space-between; padding: 9px 12px; background: var(--warn-50); color: var(--warn); font-size: 12px; border-bottom: 1px solid #fde0cc; }
.conv-list { list-style: none; margin: 0; padding: 6px; overflow-y: auto; flex: 1; }
.conv { display: flex; gap: 11px; padding: 10px; border-radius: 10px; cursor: pointer; margin-bottom: 2px; position: relative; }
.conv:hover { background: var(--bg); }
.conv.active { background: var(--primary-50); }
.conv.active::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px; border-radius: 2px; background: var(--primary); }
.conv .body { flex: 1; min-width: 0; }
.conv .l1 { display: flex; gap: 6px; align-items: baseline; }
.conv .name { font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv.unread .name { font-weight: 700; }
.conv .time { font-size: 11.5px; color: var(--faint); white-space: nowrap; }
.conv.is-wait .time { color: var(--warn); font-weight: 600; }
.conv .l2 { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; }
.conv .l3 { display: flex; gap: 5px; margin-top: 6px; flex-wrap: wrap; }
.conv-empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.conv-empty svg { width: 36px; height: 36px; color: var(--ok); margin-bottom: 8px; }
.conv-empty b { display: block; color: var(--text); margin-bottom: 2px; }
.badge { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 6px; background: var(--line-2); color: var(--muted); white-space: nowrap; display: inline-flex; align-items: center; gap: 3px; }
.badge.wait { background: var(--warn-50); color: var(--warn); }
.badge.ch { background: var(--primary-50); color: var(--primary); }
.badge.misa { background: var(--ok-50); color: var(--ok); }
.badge.grp { background: var(--violet-50); color: var(--violet); }

.col-thread { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--bg); }
.empty { margin: auto; text-align: center; color: var(--muted); padding: 24px; }
.empty-ico { width: 72px; height: 72px; border-radius: 20px; background: var(--primary-50); color: var(--primary); display: grid; place-items: center; margin: 0 auto 16px; }
.empty-ico svg { width: 34px; height: 34px; }
.empty h3 { color: var(--text); font-size: 17px; margin-bottom: 4px; }
.empty p { margin: 0; }
#thread { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.thread-head { display: flex; align-items: center; gap: 12px; padding: 10px 18px; background: var(--panel); border-bottom: 1px solid var(--line); min-height: 64px; }
.t-info { min-width: 0; }
.t-title { font-weight: 700; font-size: 15.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-sub { font-size: 12.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 10px; }
.t-sub .w { color: var(--warn); font-weight: 600; }
.back { display: none; }
.msgs { flex: 1; overflow-y: auto; padding: 18px 24px; display: flex; flex-direction: column; gap: 4px; }
.day { align-self: center; font-size: 11.5px; color: var(--muted); margin: 14px 0 8px; background: var(--panel); border: 1px solid var(--line); padding: 2px 12px; border-radius: 12px; font-weight: 500; }
.msg { max-width: min(72%, 620px); padding: 8px 12px; border-radius: 14px; background: var(--in); box-shadow: var(--sh); white-space: pre-wrap; word-wrap: break-word; align-self: flex-start; border-bottom-left-radius: 4px; margin-top: 2px; }
.msg.out { align-self: flex-end; background: var(--out); color: #fff; border-bottom-left-radius: 14px; border-bottom-right-radius: 4px; }
.msg.out .meta { color: rgba(255,255,255,.75); }
.msg.ai { background: var(--violet-50); color: var(--text); border: 1px solid #e0dbf7; box-shadow: none; }
.msg.out.ai { background: #ece9fb; }
.msg.out.ai .meta { color: var(--violet); }
.msg.system, .msg.call { align-self: center; background: transparent; box-shadow: none; font-size: 12.5px; color: var(--muted); border: 1px dashed var(--line); border-radius: 10px; }
.msg.call { background: var(--ok-50); border: 0; color: var(--ok); font-weight: 600; }
.msg .meta { font-size: 11px; color: var(--faint); margin-top: 3px; }
.reply { display: flex; gap: 10px; padding: 12px 18px 16px; background: var(--bg); align-items: flex-end; }
.reply textarea { resize: none; border-radius: 12px; padding: 11px 14px; min-height: 48px; max-height: 180px; box-shadow: var(--sh); border-color: var(--line); }
.reply .send { height: 46px; padding: 0 18px; border-radius: 12px; }
.reply-off { display: flex; gap: 10px; align-items: center; margin: 0 18px 16px; padding: 11px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; color: var(--muted); font-size: 13px; }
.reply-off svg { color: var(--faint); }

.col-side { border-left: 1px solid var(--line); padding: 14px; overflow-y: auto; background: var(--bg); display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; box-shadow: var(--sh); }
.card h3 { font-size: 11.5px; margin: 0 0 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.card textarea { resize: vertical; }
.card form textarea { margin-bottom: 8px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 12px; border: 1px solid var(--line); background: #fff; color: var(--text); }
.tag:hover { border-color: var(--primary-100); }
.tag.on { color: #fff; border-color: transparent; }
.notes .note { background: #fffaeb; border: 1px solid #fde9b4; border-radius: 8px; padding: 8px 10px; margin: 0 0 8px; font-size: 13px; white-space: pre-wrap; }
.notes .note .meta { margin-top: 3px; }
.misa-box { display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.misa-ok { display: flex; gap: 8px; align-items: flex-start; }
.misa-ok .ic { width: 26px; height: 26px; border-radius: 50%; background: var(--ok-50); color: var(--ok); display: grid; place-items: center; flex: none; }
.misa-ok .ic svg { width: 14px; height: 14px; stroke-width: 3; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; font-size: 12.5px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-weight: 500; }

/* ---------- trang ---------- */
.page { padding: 24px 28px 40px; overflow: auto; flex: 1; }
.page-head { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 20px; }
.page-head h1 { font-size: 22px; } .page-head p { margin: 4px 0 0; font-size: 13px; max-width: 760px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin-bottom: 20px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; box-shadow: var(--sh); display: flex; gap: 14px; align-items: center; }
.tile-ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; flex: none; background: var(--primary-50); color: var(--primary); }
.tile-ic svg { width: 22px; height: 22px; }
.tile.c-ok .tile-ic { background: var(--ok-50); color: var(--ok); }
.tile.c-warn .tile-ic { background: var(--warn-50); color: var(--warn); }
.tile.c-violet .tile-ic { background: var(--violet-50); color: var(--violet); }
.tile.c-bad .tile-ic { background: var(--bad-50); color: var(--bad); }
.tile-v { font-size: 25px; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.tile-t { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.tile.bad .tile-v { color: var(--bad); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--sh); margin-bottom: 18px; overflow: hidden; }
.panel-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-size: 15px; }
.pad { padding: 16px 18px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.two-col .panel { margin-bottom: 18px; }
.table-wrap { overflow-x: auto; }
.grid { width: 100%; border-collapse: collapse; }
.grid th, .grid td { border-bottom: 1px solid var(--line-2); padding: 10px 14px; text-align: left; font-size: 13px; vertical-align: middle; }
.grid th { background: #f8f9fc; color: var(--muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.grid tbody tr:hover { background: #fafbfd; }
.grid tbody tr:last-child td { border-bottom: 0; }
.grid .num { text-align: right; font-variant-numeric: tabular-nums; }
.grid tr.total td { font-weight: 700; background: #f8f9fc; }
.grid tr.off td { color: var(--faint); }
.grid .acc-name { font-weight: 600; white-space: nowrap; }
.bad { color: var(--bad); font-weight: 600; }
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 10px; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ok { background: var(--ok-50); color: var(--ok); }
.pill.bad { background: var(--bad-50); color: var(--bad); }
.pill.idle { background: var(--line-2); color: var(--muted); }
.pill.warn { background: var(--warn-50); color: var(--warn); }
.sources { display: grid; }
.src { display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center; padding: 13px 18px; border-bottom: 1px solid var(--line-2); }
.src:last-child { border-bottom: 0; }
.src-ic { width: 40px; height: 40px; border-radius: 10px; background: var(--line-2); display: grid; place-items: center; color: var(--muted); }
.src-name { font-weight: 600; }
.src-detail { font-size: 12.5px; color: var(--muted); }
.src-right { text-align: right; display: grid; gap: 3px; justify-items: end; }
.src-time { font-size: 11.5px; color: var(--faint); }
.sources.compact .src { padding: 9px 0; grid-template-columns: 1fr auto; }
.sources.compact .src-ic { display: none; }
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.quick { display: flex; gap: 4px; background: var(--line-2); padding: 3px; border-radius: 9px; }
.chip { background: none; color: var(--muted); padding: 5px 11px; font-size: 12.5px; font-weight: 600; border-radius: 7px; }
.chip.active { background: var(--panel); color: var(--text); box-shadow: var(--sh); }
.form-row { display: flex; gap: 10px; flex-wrap: wrap; padding: 14px 18px; border-top: 1px solid var(--line-2); background: #fbfcfe; }
.pad .form-row { padding: 14px 0 0; border: 0; background: none; }
.form-row input, .form-row select { width: auto; flex: 1 1 150px; }
.form-row input[type=color] { flex: none; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
pre.code { background: #0f1d3a; color: #cfe0ff; padding: 14px 16px; border-radius: 10px; overflow-x: auto; font-size: 12.5px; }
.nick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; padding: 16px 18px; }
.nick { display: flex; justify-content: space-between; gap: 8px; align-items: center; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; font-size: 13px; }
dialog { border: 0; border-radius: 14px; padding: 22px; width: min(460px, 92vw); box-shadow: var(--sh-lg); }
dialog::backdrop { background: rgba(15,29,58,.45); }
dialog h3 { font-size: 17px; margin-bottom: 6px; }
dialog .acc-pick { max-height: 300px; overflow-y: auto; border: 1px solid var(--line); border-radius: 9px; padding: 6px 10px; }
dialog .acc-pick label { display: flex; gap: 6px; align-items: center; color: var(--text); font-size: 14px; margin: 6px 0; }
dialog .row { display: flex; gap: 8px; justify-content: flex-end; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px); background: #101828; color: #fff; padding: 10px 18px; border-radius: 10px; font-size: 13px; box-shadow: var(--sh-lg); opacity: 0; transition: .25s; z-index: 50; pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- màn hình nhỏ ---------- */
@media (max-width: 1280px) { .inbox { grid-template-columns: 330px minmax(0, 1fr) 290px; } }
.ai-btn { color: var(--violet); border-color: #e0dbf7; background: var(--violet-50); }
.ai-btn:hover:not(:disabled) { background: #e6e1fb; color: var(--violet); border-color: #cfc6f5; }
.ai-box { margin: 0 18px 4px; background: var(--panel); border: 1px solid #d9d2f6; border-radius: 12px; box-shadow: var(--sh); padding: 10px 14px 12px; }
.ai-head { display: flex; align-items: center; gap: 8px; color: var(--violet); }
.ai-head b { font-size: 13px; } .ai-head .icon-btn { padding: 3px; }
.ai-text { white-space: pre-wrap; font-size: 14px; margin: 6px 0 10px; max-height: 220px; overflow-y: auto; }
.ai-text.loading { color: var(--muted); display: flex; align-items: center; gap: 10px; }
.ai-text.loading::before { content: ""; width: 16px; height: 16px; border-radius: 50%; border: 2px solid #d9d2f6; border-top-color: var(--violet); animation: quay .8s linear infinite; }
.ai-text.err { color: var(--bad); }
@keyframes quay { to { transform: rotate(360deg); } }
.ai-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.info-btn, .side-head, .side-backdrop { display: none; }
.info-btn.has-misa::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #12b76a; margin-left: -2px; }
/* màn hình nhỏ: thông tin khách mở dạng ngăn kéo bên phải (nút "Khách" ở đầu hội thoại) */
@media (max-width: 1100px) {
  .inbox { grid-template-columns: 320px minmax(0, 1fr); } .two-col { grid-template-columns: 1fr; }
  .info-btn { display: inline-flex; }
  .col-side { position: fixed; top: 0; right: 0; bottom: 0; width: min(380px, 100vw); z-index: 40; border-left: 0; box-shadow: var(--sh-lg);
    transform: translateX(105%); transition: transform .22s ease; padding-top: 0; }
  .inbox.side-open .col-side { transform: none; }
  .side-head { display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 1;
    background: var(--bg); padding: 12px 0 4px; font-size: 15px; }
  .side-backdrop { position: fixed; inset: 0; background: rgba(15,29,58,.4); z-index: 39; }
  .inbox.side-open .side-backdrop { display: block; }
}
@media (max-width: 860px) { .login { grid-template-columns: 1fr; } .login-brand { display: none; } }
@media (max-width: 720px) {
  #app { flex-direction: column-reverse; }
  .rail { width: 100%; flex-direction: row; padding: 4px 6px calc(4px + env(safe-area-inset-bottom)); justify-content: space-around; gap: 0; overflow-x: auto; overflow-y: hidden; }
  .rail-logo, .rail .spacer, #meAvatar { display: none; }
  .rail .tab, .rail-out { width: auto; flex: 1; padding: 6px 2px; font-size: 10.5px; }
  .rail-me { flex-direction: row; flex: 1; }
  .rail-badge { right: 18%; }
  .top { height: 50px; padding: 0 14px; }
  .sync-info, .me-box #meName { display: none; }
  .inbox { grid-template-columns: minmax(0, 1fr); }
  .back { display: inline-flex !important; }
  .inbox.open .col-list { display: none; } .inbox:not(.open) .col-thread { display: none; }
  .msgs { padding: 12px; } .msg { max-width: 86%; }
  .thread-head { padding: 8px 10px; gap: 6px; } #tDone span, .ai-btn span { display: none; } .info-btn, .ai-btn { padding: 7px 10px; } .ai-box { margin: 0 10px 4px; }
  .page { padding: 16px; }
  .reply { padding: 10px 10px 12px; }
}

/* 0.5: ảnh trong hội thoại, chuông, nút tải thêm */
.msg.media { padding: 4px; background: transparent; box-shadow: none; }
.msg.media.out { background: transparent; }
.msg.media .meta { padding: 0 6px 2px; color: var(--faint) !important; }
.msg img.anh { display: block; max-width: min(280px, 100%); max-height: 320px; border-radius: 12px; cursor: zoom-in; background: var(--line-2); min-width: 80px; min-height: 60px; object-fit: cover; }
.msg .file-link { display: inline-flex; gap: 6px; align-items: center; color: inherit; text-decoration: underline; }
.msg.out .file-link { color: #fff; }
.notif-btn.on { color: var(--primary); background: var(--primary-50); }
.me-box { background: none; border: 0; padding: 6px 8px; border-radius: 8px; color: var(--text); }
.me-box:hover { background: var(--line-2); }
.me-box .me-key { width: 14px; height: 14px; color: var(--faint); }
.more-li { list-style: none; padding: 8px 6px 14px; text-align: center; }
.sub-h { font-size: 12px; color: var(--muted); margin: 16px 0 6px; text-transform: uppercase; letter-spacing: .05em; }
@media (max-width: 720px) { .me-box .me-key { display: none; } }

/* 0.6: trang Nick Zalo */
.nick-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; margin-bottom: 20px; }
.nick-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--sh); padding: 16px; display: grid; gap: 12px; }
.nick-card.off { opacity: .75; }
.cn-hd { display: inline-block; margin: 8px 0 2px; padding: 7px 14px; border-radius: 8px; text-decoration: none; font-weight: 600; }
.hd-form h4 { margin: 12px 0 4px; }
.hd-hang { display: grid; gap: 6px; }
.hd-dong { display: grid; grid-template-columns: 2fr 2fr 70px 70px 120px 34px; gap: 6px; align-items: start; }
.hd-dong input, .hd-dong textarea { width: 100%; padding: 6px 8px; font: inherit; font-size: 13px; }
@media (max-width: 760px) { .hd-dong { grid-template-columns: 1fr 1fr; } }
.hd-dots { display: grid; gap: 6px; margin: 4px 0; }
.hd-dot { display: grid; grid-template-columns: 52px 70px 16px 1fr; gap: 6px; align-items: center; }
.hd-dot input { padding: 6px 8px; }
.hd-tong { margin: 6px 0; padding: 7px 10px; background: var(--nen, #f6f8fc); border-radius: 8px; }
.hd-tha { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 26px 16px; margin: 0 0 14px; border: 2px dashed var(--line, #cbd5e1); border-radius: 14px; cursor: pointer; text-align: center; background: var(--panel, #fff); }
.hd-tha svg { width: 34px; height: 34px; color: var(--pri, #233477); }
.hd-tha.keo { border-color: var(--pri, #233477); background: rgba(35, 52, 119, .06); }
.pill.hd-bad, .hd-dau.hd-bad { background: #fee2e2; color: #b91c1c; }
.pill.hd-warn, .hd-dau.hd-warn { background: #fef3c7; color: #92400e; }
.pill.hd-ok, .hd-dau.hd-ok { background: #dcfce7; color: #166534; }
.hd-dau { padding: 10px 12px; border-radius: 10px; margin: 6px 0 10px; }
.hd-tt { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; font-size: 13.5px; margin: 6px 0 4px; }
.hd-loi { border-left: 4px solid #cbd5e1; padding: 7px 10px; margin: 6px 0; background: var(--panel, #fff); border-radius: 6px; }
.hd-loi.hd-P0 { border-left-color: #dc2626; } .hd-loi.hd-P1 { border-left-color: #d97706; } .hd-loi.hd-P2 { border-left-color: #64748b; }
.hd-trich { font-style: italic; margin: 2px 0; }
.qc-b2 { display: grid; gap: 6px; margin: 8px 0; padding: 10px 12px; border: 1px solid var(--line, #e3e7f0); border-radius: 10px; }
.qc-b2 input { padding: 7px 9px; }
.nick-sdt { display: block; font-size: 13px; color: var(--muted, #6b7280); margin-top: 2px; }
.nick-sdt a { color: inherit; text-decoration: none; font-weight: 600; }
.nick-top
.nick-top .t { flex: 1; min-width: 0; }
.nick-top .t b { display: block; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nick-top .t span { font-size: 12px; color: var(--muted); }
.nick-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.nick-stats div { background: var(--bg); border-radius: 9px; padding: 8px 4px; }
.nick-stats b { display: block; font-size: 18px; font-variant-numeric: tabular-nums; }
.nick-stats span { font-size: 11.5px; color: var(--muted); }
.nick-err { font-size: 12px; color: var(--bad); background: var(--bad-50); border-radius: 8px; padding: 7px 10px; }
.nick-tog { display: flex; gap: 8px; flex-wrap: wrap; }
.tog { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; padding: 6px 10px; border-radius: 8px; background: var(--line-2); color: var(--muted); border: 1px solid transparent; }
.tog::before { content: ""; width: 26px; height: 15px; border-radius: 8px; background: #cfd5df; box-shadow: inset 0 0 0 2px #cfd5df; transition: .15s; background-image: radial-gradient(circle at 7px 7.5px, #fff 5px, transparent 5.5px); }
.tog.on { background: var(--ok-50); color: var(--ok); }
.tog.on::before { background-color: #12b76a; box-shadow: inset 0 0 0 2px #12b76a; background-image: radial-gradient(circle at 18px 7.5px, #fff 5px, transparent 5.5px); }
.tog:disabled { cursor: default; }
.nick-empty { grid-column: 1 / -1; text-align: center; padding: 36px; color: var(--muted); background: var(--panel); border: 1px dashed var(--line); border-radius: 12px; }
ol.steps { margin: 0; padding-left: 20px; display: grid; gap: 8px; font-size: 13.5px; }
.qr-box { display: grid; place-items: center; gap: 10px; padding: 8px 0; text-align: center; }
.qr-box img { width: 240px; height: 240px; border-radius: 12px; border: 1px solid var(--line); image-rendering: pixelated; }
.qr-box .spin { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--primary-100); border-top-color: var(--primary); animation: quay .8s linear infinite; }
.qr-ok { width: 56px; height: 56px; border-radius: 50%; background: var(--ok-50); color: var(--ok); display: grid; place-items: center; }
.qr-ok svg { width: 28px; height: 28px; stroke-width: 3; }

/* ---- đợt 1: nhãn, hẹn, tiềm năng, mẫu, đơn hàng ---- */
.view[data-view=hen] b:not(:empty) { background: var(--violet-50); color: var(--violet); }
.view[data-view=tiem_nang] b:not(:empty) { background: var(--ok-50); color: var(--ok); }
.badge.lbl { color: #fff; }
.badge.hen { background: var(--violet-50); color: var(--violet); }
.badge.hen.qua { background: var(--bad-50); color: var(--bad); }
.filter-row select { min-width: 0; flex: 1; }
.tag-groups h4 { font-size: 11px; color: var(--faint); margin: 8px 0 5px; font-weight: 600; }
.tag-groups h4:first-child { margin-top: 0; }
.hen-now { font-size: 13px; margin-bottom: 8px; }
.hen-now .on { background: var(--violet-50); color: var(--violet); padding: 8px 10px; border-radius: 8px; }
.hen-now .on.qua { background: var(--bad-50); color: var(--bad); }
.hen-quick { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chip-b { font-size: 12px; padding: 4px 9px; border-radius: 12px; background: var(--line-2); color: var(--text); border: 1px solid var(--line); font-weight: 600; }
.chip-b:hover { border-color: var(--primary-100); color: var(--primary); }
.btn-pair { display: flex; gap: 8px; margin-top: 4px; }
.don-box { margin-top: 10px; }
.don-sum { font-size: 12.5px; font-weight: 600; margin-bottom: 6px; }
.don-sum .no { color: var(--bad); }
.don { border-top: 1px solid var(--line-2); padding: 6px 0; font-size: 12.5px; }
.don .l1 { display: flex; justify-content: space-between; gap: 8px; }
.don .l1 b { font-weight: 600; }
.don .sp { color: var(--muted); font-size: 12px; }
.don .st { font-size: 11px; color: var(--muted); }
.reply { position: relative; }
.mau-btn { height: 46px; border-radius: 12px; }
.mau-pop { position: absolute; left: 18px; right: 18px; bottom: calc(100% - 6px); max-height: 300px; overflow: auto; background: var(--panel);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(15, 23, 42, .15); z-index: 20; padding: 6px; }
.mau-it { display: block; width: 100%; text-align: left; background: none; padding: 7px 9px; border-radius: 8px; font-size: 13px; color: var(--text); }
.mau-it b { color: var(--primary); margin-right: 6px; }
.mau-it .rieng { font-size: 11px; color: var(--violet); margin-left: 4px; }
.mau-it .nd { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mau-it.sel, .mau-it:hover { background: var(--primary-50); }
.mau-foot { border-top: 1px solid var(--line-2); margin-top: 4px; padding: 6px 4px 2px; display: flex; justify-content: space-between; align-items: center; }
.mau-dlg textarea { width: 100%; min-height: 120px; }
.mau-dlg label { display: block; margin-bottom: 10px; }
@media (max-width: 760px) { .mau-btn span { display: none; } .mau-btn { padding: 0 12px; } }

/* ---- đợt 2: tra sản phẩm, phễu ---- */
.sp-pop { padding: 8px; }
.sp-pop input { width: 100%; margin-bottom: 6px; }
.sp-it { border-radius: 8px; padding: 7px 9px; cursor: pointer; }
.sp-it:hover, .sp-it.sel { background: var(--primary-50); }
.sp-it .t { font-weight: 600; font-size: 13px; }
.sp-it .g { font-size: 12.5px; color: var(--ok); font-weight: 600; }
.sp-it .g.misa { color: var(--muted); font-weight: 500; }
.sp-it .m { font-size: 11.5px; color: var(--muted); }
.sp-it .m a { color: var(--primary); }
.funnel { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; padding: 14px 16px; }
.fn { background: var(--line-2); border-radius: 10px; padding: 12px 14px; }
.fn b { display: block; font-size: 22px; font-weight: 700; }
.fn span { font-size: 12px; color: var(--muted); }
.fn em { font-style: normal; font-size: 12px; color: var(--primary); font-weight: 600; margin-left: 6px; }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 110px; padding: 6px 16px 22px; overflow-x: auto; }
.bar { flex: 1 0 14px; max-width: 34px; position: relative; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; }
.bar i { display: block; background: var(--primary-100); border-radius: 4px 4px 0 0; min-height: 2px; }
.bar i.don { background: var(--ok); position: absolute; bottom: 0; left: 25%; right: 25%; border-radius: 3px 3px 0 0; }
.bar s { position: absolute; bottom: -18px; left: 50%; transform: translateX(-50%); font-size: 10px; color: var(--faint); text-decoration: none; white-space: nowrap; }
.phieu-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(560px, 1fr)); gap: 14px; padding: 0 16px 16px; }

/* ---- đợt 3: dashboard, sao, AI từng khách, giai đoạn, sự kiện ---- */
.view[data-view=sao] b:not(:empty) { background: #fef3c7; color: #b45309; }
.sao-btn svg { fill: none; }
.sao-btn.on { color: #f59e0b; }
.sao-btn.on svg { fill: #f59e0b; stroke: #f59e0b; }
.badge.sao { background: #fef3c7; color: #b45309; }
.badge.gd { background: var(--ok-50); color: var(--ok); }
.ai-ban { display: flex; align-items: center; gap: 10px; margin: 0 18px 8px; padding: 9px 12px; border-radius: 10px; font-size: 13px;
  background: var(--violet-50); color: var(--violet); }
.ai-ban.off { background: var(--line-2); color: var(--muted); }
.ai-ban .spacer { flex: 1; }
.msg.ev { align-self: center; background: none; border: none; box-shadow: none; color: var(--faint); font-size: 12px; padding: 2px 8px; max-width: 90%; text-align: center; }
.msg .rep { color: var(--ok); font-weight: 600; }
.msg .rep.cham { color: var(--warn); }
.page-head .quick { margin-right: 8px; }
.dash-2 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 16px; }
@media (max-width: 1000px) { .dash-2 { grid-template-columns: 1fr; } }
.legend { font-size: 12px; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-left: 8px; }
.legend .lk, .chart .k { background: #93c5fd; fill: #93c5fd; }
.legend .ln, .chart .n { background: var(--primary); fill: var(--primary); }
.legend .la, .chart .a { background: var(--violet); fill: var(--violet); }
.chart { padding: 10px 16px 14px; }
.chart svg { width: 100%; height: 240px; display: block; }
.chart text { font-size: 10px; fill: var(--faint); }
.chart line { stroke: var(--line-2); }
.recent { padding: 4px 8px 10px; }
.rc { display: flex; gap: 10px; padding: 9px 8px; border-radius: 10px; cursor: pointer; }
.rc:hover { background: var(--primary-50); }
.rc .b { min-width: 0; flex: 1; }
.rc .l1 { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.rc .l1 b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rc .l1 span { color: var(--faint); font-size: 11.5px; white-space: nowrap; }
.rc .l2 { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rc .l3 { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 3px; }

/* ---- AI Agent ---- */
.agent-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; margin-bottom: 16px; }
.agent-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--sh); padding: 18px; display: grid; gap: 12px; }
.agent-card.off { opacity: .7; }
.agent-top { display: flex; gap: 12px; align-items: center; }
.agent-logo { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 19px; flex: none; }
.agent-top h2 { font-size: 19px; margin: 0; }
.agent-top .spacer { flex: 1; }
.agent-info { font-size: 13px; color: var(--muted); display: grid; gap: 3px; }
.agent-info b { color: var(--text); font-weight: 600; }
.agent-kenh { display: flex; flex-wrap: wrap; gap: 5px; }
.agent-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.agent-dlg { width: min(640px, 94vw); }
.agent-form label { display: block; margin-bottom: 9px; font-size: 13px; }
.agent-form .two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.agent-form textarea { width: 100%; }
.agent-form .acc-pick label { margin: 4px 0; }
.thu-log { max-height: 320px; overflow-y: auto; display: grid; gap: 8px; margin: 10px 0; }
.thu-log .q { justify-self: end; background: var(--primary); color: #fff; padding: 8px 12px; border-radius: 12px; max-width: 85%; font-size: 13.5px; }
.thu-log .a { background: var(--violet-50); color: var(--text); padding: 8px 12px; border-radius: 12px; max-width: 85%; font-size: 13.5px; white-space: pre-wrap; }
.thu-log .e { color: var(--bad); font-size: 13px; }

/* ---- đợt 5: ticket, website, tích hợp, báo cáo nhân viên ---- */
.rail .tab, .rail-out { padding: 7px 4px; }
@media (max-width: 760px) { .rail .tab { min-width: 58px; } }
.view[data-view=binh_luan] b:not(:empty) { background: #e0f2fe; color: #0369a1; }
.tile .chg { font-size: 11.5px; font-weight: 600; margin-left: 6px; }
.chg.up { color: var(--ok); } .chg.down { color: var(--bad); } .chg.up.xau { color: var(--bad); } .chg.down.tot { color: var(--ok); }
.ticket-mini { display: grid; gap: 6px; margin-bottom: 8px; font-size: 12.5px; }
.ticket-mini .tk { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; cursor: pointer; }
.ticket-mini .tk:hover { border-color: var(--primary-100); }
.pill.tk-mo { background: #e0f2fe; color: #0369a1; } .pill.tk-cho { background: var(--warn-50); color: var(--warn); } .pill.tk-xong { background: var(--ok-50); color: var(--ok); }
.tk-gap { color: var(--bad); font-weight: 700; }
#tkBody tr { cursor: pointer; }
.quick b:not(:empty) { background: var(--line); padding: 0 6px; border-radius: 8px; font-size: 11px; margin-left: 3px; }
.ticket-form label { display: block; margin-bottom: 9px; font-size: 13px; }
.ticket-form .two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ticket-form textarea { width: 100%; }
.w-pie { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 28px; align-items: center; padding: 8px 20px 18px; }
@media (max-width: 860px) { .w-pie { grid-template-columns: 1fr; } .w-pie-c { max-width: 240px; margin: 0 auto; } }
.w-pie-c svg { width: 100%; height: auto; display: block; }
.w-pie-c path { stroke: var(--panel); stroke-width: 2; }
.w-pie-c path.w-lat { cursor: pointer; } .w-pie-c path.w-lat:hover { opacity: .85; }
.w-pie-c .w-so { font-size: 30px; font-weight: 600; fill: var(--text); text-anchor: middle; }
.w-pie-c .w-nhan { font-size: 12px; fill: var(--muted); text-anchor: middle; }
.w-xep { font-size: 13px; max-height: 340px; overflow: auto; }
.w-dong { display: grid; grid-template-columns: 10px minmax(0, 1fr) 52px 56px 56px; gap: 10px; align-items: center; padding: 6px 4px; border-bottom: 1px solid var(--line-2); cursor: pointer; }
.w-dong:hover { background: var(--primary-50); }
.w-dong.w-dau { cursor: default; font-size: 11.5px; color: var(--faint); background: none; position: sticky; top: 0; background: var(--panel); }
.w-dong > i { width: 10px; height: 10px; border-radius: 2px; }
.w-ten { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-ten b { display: block; height: 4px; border-radius: 2px; margin-top: 4px; opacity: .85; }
.w-n { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; } .w-n.muted { font-weight: 400; }
.w-lh { color: var(--ok); }
.w-leg { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 11.5px; color: var(--muted); justify-content: flex-end; max-width: 60%; }
.w-leg span { display: inline-flex; align-items: center; gap: 4px; } .w-leg i { width: 9px; height: 9px; border-radius: 2px; }
.w-cot svg { height: auto; } .w-cot .w-dinh { fill: var(--muted); font-weight: 600; }
.tile.w-mq .tile-ic { background: var(--line-2); color: var(--faint); } .tile.w-mq .tile-v { color: var(--muted); }
.tile.w-mq button { margin-top: 4px; padding: 3px 9px; font-size: 12px; }
.w-xau { color: var(--bad); }
.w-cot rect, .w-cot text, .w-pie-c text, .ds-scatter text, .chart rect, .chart text { stroke: none; }
.chart svg { height: auto; }
.w-cot svg, .w-pie-c svg, .ds-scatter svg { flex: initial; } .w-dong.w-tinh { cursor: default; }
.ds-xep .w-dong { grid-template-columns: 10px minmax(0, 1fr) 70px 50px 40px 70px 72px; }
.w-pie-c .ds-so { font-size: 22px; }
.tile-sub { font-size: 11.5px; color: var(--faint); margin-top: 2px; } .tile-sub.tot { color: var(--ok); } .tile-sub.xau { color: var(--bad); }
.ds-ghep { background: var(--warn-50); border-color: #fed7aa; color: var(--warn); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; }
.ds-the tbody tr { cursor: pointer; } .ds-the tbody tr.w-tinh { cursor: default; } .ds-the td.num, .ds-the th.num { white-space: nowrap; }
.ds-dc { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(260px, 1fr); gap: 24px; padding: 8px 20px 18px; align-items: start; }
@media (max-width: 1000px) { .ds-dc { grid-template-columns: 1fr; } }
.ds-scatter svg { width: 100%; height: auto; display: block; }
.ds-scatter text { font-size: 10px; fill: var(--faint); } .ds-scatter .nhan-truc { font-size: 11px; fill: var(--muted); }
.ds-scatter .luoi { stroke: var(--line-2); } .ds-scatter .giua { stroke: var(--silver); stroke-dasharray: 4 4; }
.ds-scatter .goc { font-size: 10.5px; fill: var(--muted); font-style: italic; }
.ds-scatter circle { cursor: pointer; stroke: var(--panel); stroke-width: 2; } .ds-scatter circle.deu { fill: #2a78d6; } .ds-scatter circle.lech { fill: #eb6834; }
.ds-scatter .ten-diem { font-size: 10.5px; fill: var(--text); }
.ds-canh { color: var(--warn); background: var(--warn-50); padding: 8px 10px; border-radius: 8px; }
.ds-gopy { max-height: 52vh; overflow: auto; display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.ds-gy { border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; } .ds-gy-dau { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 3px; }
.ds-gy-gy { color: var(--warn); }
.ghep-wrap { max-height: 420px; overflow: auto; } .ghep-wrap select { max-width: 240px; }
.pill.warn { background: var(--warn-50); color: var(--warn); }
.o-ds { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 16px; align-items: center; padding: 4px 16px 10px; }
@media (max-width: 900px) { .o-ds { grid-template-columns: 1fr; } }
.o-ds-so { display: flex; flex-direction: column; gap: 12px; } .o-ds-o .tile-v { font-size: 20px; }
.w-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 16px; margin-bottom: 16px; }
.w-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh); padding: 12px 14px; }
.w-tabs { display: flex; gap: 12px; border-bottom: 1px solid var(--line-2); margin-bottom: 8px; flex-wrap: wrap; }
.w-tabs button { background: none; padding: 6px 0; font-size: 13px; color: var(--muted); border-bottom: 2px solid transparent; border-radius: 0; }
.w-tabs button.on { color: var(--primary); border-color: var(--primary); font-weight: 600; }
.bar-list { display: grid; gap: 4px; }
.bar-row { position: relative; display: flex; justify-content: space-between; gap: 8px; padding: 6px 9px; font-size: 12.5px; border-radius: 7px; overflow: hidden; }
.bar-row i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--primary-50); z-index: 0; border-radius: 7px; }
.bar-row span, .bar-row b { position: relative; z-index: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row b { font-weight: 600; flex: none; }
.heat { padding: 10px 14px 14px; overflow-x: auto; }
.heat table { border-collapse: separate; border-spacing: 2px; font-size: 10.5px; color: var(--faint); }
.heat td { width: 26px; height: 14px; border-radius: 3px; }
.w-funnel { padding: 12px 16px; display: grid; gap: 10px; }
.w-funnel .st { font-size: 13px; display: flex; justify-content: space-between; margin-bottom: 3px; }
.w-funnel .bar { height: 26px; background: var(--line-2); border-radius: 7px; overflow: hidden; }
.w-funnel .bar i { display: block; height: 100%; background: var(--violet); border-radius: 7px; }
.th-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.th-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--sh); padding: 18px; display: grid; gap: 10px; align-content: start; }
.th-card .top { display: flex; gap: 12px; align-items: center; }
.th-card .ic { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: var(--primary-50); color: var(--primary); flex: none; }
.th-card h2 { font-size: 16px; margin: 0; flex: 1; }
.th-card p { font-size: 13px; color: var(--muted); margin: 0; }
.th-card .nhom { font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: .05em; }
.donut-wrap { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.donut-wrap svg { width: 150px; height: 150px; flex: none; }
.donut-wrap .lg { display: grid; gap: 4px; font-size: 12.5px; min-width: 0; flex: 1; }
.donut-wrap .lg div { display: flex; gap: 6px; align-items: center; }
.donut-wrap .lg i { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.donut-wrap .lg span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.pad0 { padding: 0 16px 12px; }

/* ---- Tự động hoá ---- */
#flNhom { margin-top: 8px; }
.fl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; margin-top: 14px; }
.fl-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--sh); padding: 18px; display: grid; gap: 10px; align-content: start; }
.fl-card.off { opacity: .8; }
.fl-card .nhom { justify-self: start; font-size: 11.5px; padding: 2px 9px; border-radius: 8px; background: var(--violet-50); color: var(--violet); font-weight: 600; }
.fl-card h2 { font-size: 16.5px; margin: 0; }
.fl-card p { margin: 0; font-size: 13px; color: var(--muted); }
.fl-buoc { display: grid; gap: 4px; font-size: 12.5px; }
.fl-buoc div { display: flex; gap: 6px; align-items: baseline; }
.fl-buoc b { flex: none; min-width: 34px; color: var(--primary); font-size: 11px; text-transform: uppercase; }
.fl-meta { font-size: 12px; color: var(--faint); }
.fl-btns { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.fl-form h4 { margin: 14px 0 6px; font-size: 12px; text-transform: uppercase; color: var(--muted); letter-spacing: .05em; }
.fl-form label { display: block; margin-bottom: 8px; font-size: 13px; }
.fl-form .two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fl-form textarea { width: 100%; }
.fl-hd { border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 8px; display: grid; gap: 6px; }
.fl-hd .row1 { display: flex; gap: 8px; align-items: center; }
.fl-hd .row1 select { flex: 1; }
.fl-kenh { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12.5px; max-height: 110px; overflow: auto; }
.fl-kenh label { display: inline-flex; gap: 4px; margin: 0; }
.fl-log td { font-size: 12.5px; }

/* ---- chia khách: thương hiệu, giao / nhận / chuyển, đang trực ---- */
.brand-row { margin-bottom: 8px; display: flex; gap: 6px; }
.brand-row select { flex: 1; min-width: 0; }
#fBrand { font-weight: 600; }
.giao-wrap { position: relative; }
.giao-btn span { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.giao-btn.chua { color: var(--warn); border-color: var(--warn-50); }
.giao-pop { position: absolute; right: 0; top: calc(100% + 6px); width: 340px; max-height: 420px; overflow: auto; background: var(--panel);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(15, 23, 42, .18); z-index: 30; padding: 6px; }
.gp-it { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; background: none; padding: 8px; border-radius: 9px; color: var(--text); }
.gp-it:hover { background: var(--primary-50); }
.gp-it .b { min-width: 0; flex: 1; }
.gp-it .t { font-weight: 600; font-size: 13.5px; display: flex; gap: 6px; align-items: center; }
.gp-it .s { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gp-it .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
.gp-it .dot.nghi { background: #cbd5e1; }
.gp-it.on { background: var(--ok-50); }
.gp-sep { border-top: 1px solid var(--line-2); margin: 4px 0; }
.gp-load { font-size: 11px; color: var(--faint); white-space: nowrap; }
.truc-btn { display: inline-flex; align-items: center; gap: 6px; background: var(--ok-50); color: var(--ok); font-size: 12.5px; font-weight: 600; padding: 6px 11px; border-radius: 16px; margin-right: 6px; }
.truc-btn i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.truc-btn.nghi { background: var(--line-2); color: var(--muted); }
.chia-sel { width: 100%; }
.pc-form label { display: block; margin-bottom: 8px; font-size: 13px; }
.pc-form .chk-list { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; margin-bottom: 8px; }
.pc-form .chk-list label { display: inline-flex; gap: 5px; margin: 0; }
@media (max-width: 760px) { .truc-btn span { display: none; } .giao-btn span { max-width: 70px; } .giao-pop { right: -60px; width: 300px; } }

.chu-nick { width: 100%; font-size: 13px; }

/* ---- gửi ảnh, tệp ---- */
.tep-ds { position: absolute; left: 18px; right: 18px; bottom: calc(100% - 6px); display: flex; flex-wrap: wrap; gap: 8px; padding: 8px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 24px rgba(15,23,42,.12); z-index: 15; max-height: 190px; overflow: auto; }
.tep-it { position: relative; width: 92px; font-size: 11px; color: var(--muted); }
.tep-it .hinh { width: 92px; height: 70px; border-radius: 8px; background: var(--line-2) center/cover no-repeat; display: grid; place-items: center; font-weight: 700; color: var(--primary); font-size: 12px; }
.tep-it .ten { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 3px; }
.tep-it .x { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%; background: #0f172a; color: #fff; font-size: 12px; line-height: 20px; padding: 0; }
.tep-it.dang { opacity: .55; }
.tep-it.loi .hinh { background: var(--bad-50); color: var(--bad); }
.reply.keo { outline: 2px dashed var(--primary); outline-offset: -4px; }


/* ================= 0.18: giao diện HSVN (màu và logo HSVN, bản điện thoại, cài như app) ================= */
button, input, select, textarea { font-family: var(--font); }
.btn-primary { background: linear-gradient(180deg, #2b3f8f 0%, var(--primary) 100%); box-shadow: 0 1px 2px rgba(18,28,69,.2); }
.btn-primary:hover:not(:disabled) { background: var(--primary-600); }
.btn-ghost.danger { color: var(--bad); } .btn-ghost.danger:hover:not(:disabled) { background: var(--bad-50); border-color: #f6caca; color: var(--bad); }
input:focus, select:focus, textarea:focus { box-shadow: 0 0 0 3px rgba(35,52,119,.14); }

/* đăng nhập */
.login-brand { position: relative; overflow: hidden;
  background: radial-gradient(900px 520px at 0% 0%, rgba(84,116,220,.38), transparent 60%),
              radial-gradient(700px 520px at 110% 110%, rgba(201,207,220,.16), transparent 60%),
              linear-gradient(155deg, #121c45 0%, #233477 100%); }
.login-brand::after { content: ""; position: absolute; right: -110px; bottom: -80px; width: 460px; height: 390px;
  background: url(/static/logo-hs.png) center / contain no-repeat; opacity: .08; filter: grayscale(1) brightness(4); pointer-events: none; }
.login-brand > * { position: relative; z-index: 1; }
.brand-logo { width: 78px; height: 66px; border-radius: 18px; background: #fff; display: grid; place-items: center; box-shadow: 0 12px 30px rgba(0,0,0,.28); }
.brand-logo img { width: 58px; display: block; }
.login-brand h1 { font-size: 36px; font-weight: 700; }
.login-brand li svg { color: var(--silver); }
.login-side { background: var(--bg); }
.login-logo { display: block; height: 46px; margin: 0 0 22px; }
.login-box { border-radius: 18px; padding: 34px 32px 26px; }
.login-box button { padding: 12px; border-radius: 10px; font-size: 15px; }

/* thanh menu dọc */
.rail { background: linear-gradient(180deg, #121c45 0%, #18255c 100%); }
.rail-logo { width: 54px; height: 46px; border-radius: 13px; background: #fff; box-shadow: 0 6px 16px rgba(0,0,0,.3); margin-bottom: 16px; }
.rail-logo img { width: 40px; display: block; }
.rail .tab.active { background: #fff; color: var(--primary); box-shadow: 0 6px 16px rgba(0,0,0,.28); font-weight: 600; }
.tab-more, .top-logo { display: none; }

/* thanh trên, danh sách */
.top { box-shadow: 0 1px 0 var(--line); border-bottom: 0; }
.top-title strong { font-weight: 700; }
.conv.active { background: var(--primary-50); }
.view.active { color: var(--primary); }
.msg.out:not(.ai):not(.media) { background: linear-gradient(135deg, #2c4192 0%, var(--primary) 100%); }
.empty-ico { background: var(--primary-50); color: var(--primary); }

/* ô soạn tin: một thẻ, chữ ở trên, công cụ và nút Gửi ở dưới */
.reply { display: grid; grid-template-columns: auto auto auto 1fr auto; gap: 4px 6px; align-items: center;
  margin: 0 18px 16px; padding: 6px 8px 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--sh); }
.reply:focus-within { border-color: #c3cbe6; box-shadow: 0 0 0 3px rgba(35,52,119,.08), var(--sh); }
.reply textarea { grid-column: 1 / -1; grid-row: 1; border: 0; box-shadow: none !important; background: transparent; padding: 8px 8px 4px; min-height: 44px; border-radius: 10px; }
.reply .mau-btn { grid-row: 2; height: 34px; padding: 0 11px; border-radius: 9px; font-size: 13px; background: var(--bg); border-color: transparent; color: var(--muted); }
.reply .mau-btn:hover:not(:disabled) { background: var(--primary-50); color: var(--primary); border-color: transparent; }
.reply .send { grid-row: 2; grid-column: 5; height: 36px; padding: 0 18px; border-radius: 10px; }
.reply .mau-pop { left: 0; right: 0; }
.reply .tep-ds { left: 0; right: 0; }

/* bảng "Thêm" (điện thoại) */
.sheet { position: fixed; inset: 0; z-index: 60; }
.sheet-bg { position: absolute; inset: 0; background: rgba(18,28,69,.45); animation: hien .2s ease; }
.sheet-box { position: absolute; left: 0; right: 0; bottom: 0; max-height: 85vh; overflow-y: auto; background: var(--panel); border-radius: 22px 22px 0 0;
  padding: 8px 16px calc(16px + env(safe-area-inset-bottom)); box-shadow: var(--sh-lg); animation: len .24s cubic-bezier(.2,.8,.2,1); }
.sheet-grip { width: 42px; height: 4px; border-radius: 2px; background: var(--line); margin: 4px auto 14px; }
.sheet-me { display: flex; align-items: center; gap: 12px; padding: 0 4px 14px; margin-bottom: 14px; border-bottom: 1px solid var(--line-2); }
.sheet-me b { display: block; font-size: 15px; }
.sheet-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.sheet-it { flex-direction: column; gap: 7px; padding: 16px 6px 13px; background: var(--bg); color: var(--text); border-radius: 16px; font-size: 12.5px; font-weight: 600; text-align: center; }
.sheet-it svg { width: 24px; height: 24px; color: var(--primary); }
.sheet-it.active { background: var(--primary-50); box-shadow: inset 0 0 0 2px var(--primary-100); }
.sheet-foot { display: flex; gap: 10px; margin-top: 16px; }
.sheet-foot button { flex: 1; padding: 11px; border-radius: 12px; }
@keyframes len { from { transform: translateY(100%); } }
@keyframes hien { from { opacity: 0; } }

/* ---------- điện thoại ---------- */
@media (max-width: 720px) {
  html, body { height: 100dvh; overscroll-behavior: none; }
  input, select, textarea { font-size: 16px; }      /* iPhone không tự phóng to khi chạm ô nhập */
  #app { height: 100dvh; }
  /* thanh dưới: 4 mục chính + Thêm */
  .rail { background: rgba(255,255,255,.97); border-top: 1px solid var(--line); box-shadow: 0 -6px 20px rgba(18,28,69,.06);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); overflow: visible; justify-content: space-around; z-index: 20; }
  .rail .tab:not(.m-main), .rail-me, .rail .spacer { display: none !important; }
  .rail .tab, .tab-more { display: inline-flex; flex: 1; flex-direction: column; align-items: center; width: auto; min-width: 0; max-width: 86px;
    gap: 2px; padding: 2px 0; background: none !important; box-shadow: none !important; color: var(--muted); font-size: 11px; font-weight: 500; border-radius: 12px; }
  .rail .tab svg, .tab-more svg { width: 54px; height: 30px; padding: 4px 16px; border-radius: 15px; transition: background .15s; }
  .rail .tab.active, .tab-more.active { color: var(--primary); font-weight: 700; }
  .rail .tab.active svg, .tab-more.active svg { background: var(--primary-50); }
  .rail .tab:hover, .tab-more:hover { color: var(--primary); }
  .rail-badge { top: -2px; right: calc(50% - 26px); border: 2px solid #fff; height: 20px; line-height: 16px; }
  /* trong một hội thoại: ẩn thanh dưới cho rộng chỗ gõ */
  #app:has(#tab-inbox.open:not(.hidden)) .rail { display: none; }

  /* thanh trên màu navy */
  .top { height: calc(56px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 10px 0 12px; gap: 6px;
    background: linear-gradient(135deg, #18255c 0%, var(--primary) 100%); color: #fff; box-shadow: none; position: relative; z-index: 5; }
  .top-logo { display: block; width: 40px; height: 34px; padding: 4px 6px; background: #fff; border-radius: 10px; object-fit: contain; }
  .top-title { align-items: center; gap: 10px; }
  .top-title strong { font-size: 17.5px; color: #fff; }
  .top .icon-btn { color: #dfe5f6; } .top .icon-btn:hover { background: rgba(255,255,255,.12); color: #fff; }
  .notif-btn.on { background: rgba(255,255,255,.16); color: #fff; }
  .truc-btn { margin-right: 0; padding: 7px 10px; background: rgba(18,183,106,.2); color: #b7f3d6; }
  .truc-btn.nghi { background: rgba(255,255,255,.12); color: #cbd3ea; }
  .me-box { display: none; }

  /* hộp thư */
  .list-head { padding: 10px 12px 8px; gap: 8px; }
  .brand-row { margin-bottom: 0; }
  .views { display: flex; gap: 6px; overflow-x: auto; background: none; padding: 1px 12px 2px; margin: 0 -12px; border-radius: 0; scrollbar-width: none; }
  .view { flex: none; padding: 6px 12px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); font-size: 13px; color: var(--muted); }
  .view.active { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: none; }
  .view.active b:not(:empty) { background: rgba(255,255,255,.22); color: #fff; }
  .view.active[data-view=waiting] b:not(:empty) { background: #f04438; }
  .search input { padding-top: 9px; padding-bottom: 9px; border-radius: 12px; }
  .filter-row { gap: 8px; } .filter-row select { font-size: 14px; padding: 8px; }
  .conv-list { padding: 4px 6px 10px; }
  .conv { padding: 12px 10px; gap: 12px; border-radius: 14px; }
  .conv .avatar { width: 46px; height: 46px; font-size: 15px; }
  .conv .name { font-size: 15px; } .conv .l2 { font-size: 13.5px; }

  /* hội thoại */
  .thread-head { min-height: 58px; padding: 6px 6px 6px 4px; gap: 4px; }
  .thread-head .avatar { width: 38px; height: 38px; font-size: 13px; }
  .t-title { font-size: 15px; } .t-sub { font-size: 12px; }
  .thread-head .btn-ghost { padding: 7px 9px; }
  .thread-head .icon-btn { padding: 7px; }
  .msgs { padding: 12px 10px; }
  .reply { margin: 0 8px calc(8px + env(safe-area-inset-bottom)); border-radius: 18px; }
  .reply .mau-btn { padding: 0 12px; }
  .reply-off { margin: 0 8px calc(8px + env(safe-area-inset-bottom)); }
  .ai-box { margin: 0 8px 6px; }
  .col-side { width: 100vw; padding-bottom: calc(14px + env(safe-area-inset-bottom)); }

  /* các trang */
  .page { padding: 14px 12px 28px; }
  .page-head { flex-wrap: wrap; margin-bottom: 14px; } .page-head h1 { font-size: 20px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
  .tile { flex-direction: column; align-items: flex-start; gap: 8px; padding: 13px; border-radius: 14px; }
  .tile-ic { width: 36px; height: 36px; border-radius: 10px; } .tile-ic svg { width: 19px; height: 19px; }
  .tile-v { font-size: 22px; }
  .panel { border-radius: 14px; margin-bottom: 14px; }
  .panel-head { padding: 12px 14px; } .pad { padding: 14px; }
  .grid th, .grid td { padding: 9px 10px; }
  .toolbar { gap: 8px; } .quick { overflow-x: auto; max-width: 100%; }
  .nick-cards { grid-template-columns: minmax(0, 1fr); }
  /* hộp thoại thành bảng trượt từ dưới lên */
  dialog { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 20px 20px 0 0; max-height: 92dvh;
    padding: 20px 16px calc(18px + env(safe-area-inset-bottom)); }
  dialog[open] { animation: len .24s cubic-bezier(.2,.8,.2,1); }
  .toast { bottom: calc(86px + env(safe-area-inset-bottom)); max-width: calc(100vw - 32px); }
}
@media (max-width: 360px) { .rail .tab svg, .tab-more svg { width: 46px; padding: 4px 12px; } .rail .tab, .tab-more { font-size: 10.5px; } }
.thread-head .btn-ghost { white-space: nowrap; } .thread-head .t-info { min-width: 0; flex: 0 1 auto; }
@media (max-width: 1280px) { #tDone span { display: none; } }
@media (max-width: 720px) {
  .thread-head .t-info { flex: 1 1 auto; } .thread-head > .spacer, .thread-head > .avatar { display: none; }
  .thread-head .btn-ghost span, .thread-head .btn-ghost #tGiaoTen { display: none; }
  .thread-head .btn-ghost, .thread-head .icon-btn { padding: 8px; border-radius: 10px; }
  .t-sub { flex-wrap: nowrap; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .t-sub > * { flex: none; }
}
@media (max-width: 720px) { #app { overflow: hidden; } .main { min-height: 0; } }
.chip { white-space: nowrap; }
@media (max-width: 860px) { .login-side { background: linear-gradient(180deg, #18255c 0, var(--primary) 240px, var(--bg) 240px); padding-top: calc(24px + env(safe-area-inset-top)); } }

/* ---- danh bạ Zalo ---- */
.db-list { display: grid; }
.db-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line-2); }
.db-row:last-child { border-bottom: 0; }
.db-row:hover { background: #fafbfd; }
.db-row .avatar { width: 44px; height: 44px; }
.db-av { border-radius: 50%; object-fit: cover; background: var(--line-2); display: block; }
.db-info { min-width: 0; display: grid; }
.db-info b, .db-info span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.db-tags { display: flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end; }
.db-search { flex: 1 1 240px; }
.db-nick { width: auto; min-width: 170px; }
.db-list .conv-empty { display: grid; gap: 4px; }
@media (max-width: 720px) {
  .db-row { grid-template-columns: 44px minmax(0, 1fr) auto; padding: 10px 12px; gap: 4px 12px; }
  .db-row .avatar { grid-row: 1 / span 2; }
  .db-tags { grid-column: 2; grid-row: 2; justify-content: flex-start; }
  .db-tags:empty { display: none; }
  .db-row > button { grid-column: 3; grid-row: 1 / span 2; }
  .db-nick { flex: 1 1 100%; }
}

/* 0.20 hành trình xem trang của khách web */
.web-ht { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.web-lbl { font-size: 11.5px; font-weight: 600; color: var(--muted, #64748b); text-transform: uppercase; letter-spacing: .03em; margin-top: 6px; }
.web-sp { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-sp { background: #e8f0fe; color: #1e3a8a; border-radius: 10px; padding: 3px 10px; font-size: 12px; line-height: 1.4; max-width: 100%; overflow-wrap: anywhere; }
.web-ds { list-style: none; margin: 0; padding: 0; }
.web-ds li { border-top: 1px solid var(--line-2, #eef1f5); padding: 5px 0; display: flex; flex-direction: column; gap: 1px; }
.web-ds li.hidden { display: none; }
.web-ds li .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.web-ds li.sp .t { font-weight: 600; color: #1e3a8a; }
.web-ds li .m { font-size: 11.5px; color: var(--muted, #64748b); }

/* 0.21 người cầm nick (một nick nhiều người, một người nhiều nick, như Salework) */
.hold-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: 8px; font-size: 13px; }
.hold-lbl { color: var(--muted, #64748b); font-weight: 600; }
.hold-list { display: flex; flex-wrap: wrap; gap: 4px; }
td .hold-list { flex-direction: column; align-items: flex-start; }
.hold-chip { background: #e8f0fe; color: #1e3a8a; border-radius: 6px; padding: 2px 8px; font-size: 12.5px; line-height: 1.5; }
.hold-group { font-size: 11.5px; font-weight: 700; color: var(--muted, #64748b); text-transform: uppercase; letter-spacing: .03em; margin: 10px 0 2px; }
.hold-also { margin-left: 8px; font-size: 12px; color: var(--muted, #64748b); }
.hold-search { width: 100%; margin: 4px 0 6px; }
.acc-pick label.hidden { display: none; }

/* 0.22 quản lý nhân viên */
.q-loc { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 0 8px; }
.q-loc .chip.active { background: var(--navy, #233477); color: #fff; border-color: var(--navy, #233477); }
.badge.sla.ok { background: #e7f6ee; color: #0f7a55; }
.badge.sla.sap { background: #fff4e0; color: #a15c00; }
.badge.sla.qua { background: #fde8e8; color: #b42318; font-weight: 600; }
.kq-btns { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.kq-btns .chip-b.kq-chot_don { border-color: #0f7a55; color: #0f7a55; }
.kq-btns .chip-b.kq-tu_choi, .kq-btns .chip-b.kq-sai_so { color: #b42318; }
.kq-ls { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; font-size: 13px; }
.kq-item { border-top: 1px solid var(--line-2, #eef1f5); padding-top: 6px; }
.tt-box { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.tt-row b { display: block; font-size: 11.5px; color: var(--muted, #64748b); text-transform: uppercase; letter-spacing: .03em; }
.tt-cham { background: #f5f7ff; border-radius: 8px; padding: 8px 10px; }
.k360 { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.k360-item { border: 1px solid var(--line-2, #eef1f5); border-radius: 8px; padding: 6px 8px; cursor: pointer; }
.k360-item:hover { background: #f5f7ff; }
.k360-tl { max-height: 60vh; overflow: auto; display: flex; flex-direction: column; gap: 8px; }
.k360-m { padding: 6px 10px; border-radius: 10px; max-width: 92%; overflow-wrap: anywhere; }
.k360-m.in { background: #f1f5f9; align-self: flex-start; }
.k360-m.out { background: #e8f0fe; align-self: flex-end; }
.cd-list { display: flex; flex-direction: column; gap: 6px; padding: 0 16px 12px; }
.cd-item { border: 1px solid var(--line-2, #eef1f5); border-radius: 8px; padding: 8px 10px; cursor: pointer; font-size: 13px; }
.cd-item:hover { background: #f5f7ff; }
tr.click { cursor: pointer; }

/* ---------- tổng đài Stringee (0.23) ---------- */
.goi-btn { color: var(--ok); border-color: #bfe6d5; background: var(--ok-50); }
.goi-btn:hover { background: #d8f2e6; color: var(--ok); }
.goi-btn span { display: none; } .goi-btn { padding: 7px 10px; }
.td-box { position: fixed; right: 18px; bottom: 18px; z-index: 40; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.td-bar { display: flex; gap: 6px; box-shadow: var(--sh-lg); border-radius: 999px; background: var(--panel); padding: 4px; border: 1px solid var(--line); }
.td-trang { display: flex; align-items: center; gap: 8px; border-radius: 999px; padding: 6px 14px; background: transparent; color: var(--text); font-weight: 600; font-size: 13px; }
.td-trang i { width: 9px; height: 9px; border-radius: 50%; background: var(--faint); }
.td-trang.ok i { background: #16a34a; box-shadow: 0 0 0 4px #dcfce7; } .td-trang.nghi i { background: #f59e0b; }
.td-trang.mat i { background: var(--bad); } .td-trang.goi { color: var(--ok); } .td-trang.goi i { background: var(--ok); animation: td-nhay 1s infinite; }
@keyframes td-nhay { 50% { opacity: .3; } }
.td-quay-btn { border-radius: 50%; width: 36px; height: 36px; padding: 0; display: grid; place-items: center; background: var(--ok); color: #fff; }
.td-panel { width: 340px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--sh-lg); overflow: hidden; }
.td-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; background: var(--primary); color: #fff; }
.td-head .icon-btn { color: #fff; } .td-gio { font-variant-numeric: tabular-nums; font-weight: 700; }
.td-quay { display: grid; gap: 8px; padding: 14px; }
.td-quay input { font-size: 18px; letter-spacing: .5px; }
.td-goi { padding: 14px; display: grid; gap: 10px; }
.td-so b { display: block; font-size: 22px; letter-spacing: .5px; } .td-so span { color: var(--muted); font-weight: 600; }
.td-hs { display: grid; gap: 6px; max-height: 260px; overflow: auto; }
.td-misa { display: grid; gap: 2px; background: var(--primary-50); border-radius: 10px; padding: 8px 10px; font-size: 12.5px; }
.td-ht { display: grid; text-align: left; gap: 1px; background: var(--line-2); border-radius: 10px; padding: 7px 10px; font-size: 12.5px; }
.td-ht span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-nut { display: flex; gap: 8px; } .td-nut button { flex: 1; display: flex; justify-content: center; align-items: center; gap: 6px; padding: 10px; font-weight: 700; }
.td-xanh { background: #16a34a; color: #fff; } .td-xanh:hover { background: #15803d; }
.td-do { background: var(--bad); color: #fff; } .td-do:hover { background: #a51818; }
#tdMic.on { background: var(--warn-50); color: var(--warn); border-color: #fbd5bd; }
.goi-ds { display: grid; gap: 8px; }
.goi-dong { display: grid; gap: 2px; font-size: 12.5px; border-left: 3px solid var(--ok); padding-left: 8px; }
.goi-dong.nho { border-color: var(--bad); } .goi-dong.nho b { color: var(--bad); }
.goi-dong span { color: var(--muted); } .goi-dong audio { width: 100%; height: 32px; margin-top: 2px; }
@media (max-width: 720px) {
  .td-box { right: 10px; bottom: calc(80px + env(safe-area-inset-bottom)); }
  /* 0.31: đang mở một hội thoại thì ô soạn tin nằm ở đáy: đẩy thanh tổng đài lên trên để không che nút Gửi */
  body:has(#tab-inbox.open:not(.hidden)) .td-box { bottom: calc(190px + env(safe-area-inset-bottom)); }
  .td-panel { width: calc(100vw - 20px); }
  .goi-btn span { display: none; } .goi-btn { padding: 7px 10px; }
}

/* ---------- chăm sóc sau bán (0.24) ---------- */
.cs-body .pad { padding: 14px; }
.cs-grid td { vertical-align: top; }
.cs-act { display: flex; flex-wrap: wrap; gap: 6px; }
.cs-act .btn-ghost.sm { padding: 4px 9px; font-size: 12.5px; }
.primary-ghost { color: var(--primary) !important; border-color: var(--primary-100) !important; background: var(--primary-50) !important; }
.danger { color: var(--bad) !important; }
.cs-viec { display: inline-block; margin-top: 3px; background: var(--violet-50); color: var(--violet); }
.cs-qua { color: var(--bad) !important; font-weight: 600; }
.cs-cd { display: grid; gap: 10px; max-width: 980px; }
.cs-cd .tog { justify-self: start; }
.cs-cd textarea { width: 100%; }
.cs-pre { white-space: pre-wrap; }
.cs-ds { display: grid; gap: 8px; }
.cs-k { display: grid; gap: 3px; font-size: 12.5px; border-left: 3px solid var(--violet); padding-left: 8px; }
.cs-k.het { opacity: .55; border-color: var(--line); }
.cs-k span { color: var(--muted); }

#cName.tu-dien { background: var(--violet-50); }

/* 0.28: trang khách xem bấm được, mở tab mới */
a.chip-sp, a.xem-web, .web-ds li a.t, a.rc-link { text-decoration: none; cursor: pointer; }
a.chip-sp:hover { background: #d4e3fd; text-decoration: underline; }
a.xem-web { color: var(--brand, #233477); }
a.xem-web:hover, .web-ds li a.t:hover, a.rc-link:hover { text-decoration: underline; }
.web-ds li a.t { color: inherit; display: block; }
a.rc-link { color: var(--brand, #233477); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* 0.30 dòng chữ chạy: chào ngày mới, chúc mừng đơn mới, câu động viên */
.dong-chu { flex: 1 1 auto; min-width: 0; overflow: hidden; position: relative; height: 34px; margin: 0 8px; border-radius: 17px;
  background: linear-gradient(90deg, #f1f5ff, #fff7ed); border: 1px solid #e3e8f4;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent); mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent); }
.dong-chu:not([hidden]) ~ .dc-spacer { display: none; }
.dc-ray { position: absolute; top: 0; left: 0; height: 100%; display: flex; align-items: center; white-space: nowrap; will-change: transform;
  animation: dc-chay var(--dc-time, 60s) linear infinite; }
.dong-chu:hover .dc-ray { animation-play-state: paused; }
.dc-ray span { font-size: 13.5px; color: #334155; padding: 0 6px; }
.dc-ray span.chuc_mung { color: #b45309; font-weight: 600; }
.dc-ray span.chao { color: #1e3a8a; font-weight: 600; }
.dc-ray span.ca_nhan { color: #047857; font-weight: 600; }
.dc-ray span.loi_nhan { color: #be123c; font-weight: 700; }
.dc-ray span.bat_ngo { color: #7c3aed; font-weight: 700; }
.dc-ray span.thoi_tiet { color: #0369a1; }
.dc-ray span.meo { color: #475569; font-style: italic; }
.dc-ray i { width: 5px; height: 5px; border-radius: 50%; background: #cbd5e1; margin: 0 14px; flex: none; }
@keyframes dc-chay { from { transform: translateX(var(--dc-tu, 100%)); } to { transform: translateX(-100%); } }
@media (prefers-reduced-motion: reduce) { .dc-ray { animation: none; } }
@media (max-width: 900px) { .dong-chu { display: none; } .dong-chu ~ .dc-spacer { display: block !important; } }

/* 0.35 giao khách: dải báo trong hội thoại + khung nổi cho người được giao */
.giao-ban { display: flex; align-items: center; gap: 12px; padding: 9px 16px; background: #fff7ed; border-bottom: 1px solid #fed7aa; color: #9a3412; font-size: 13.5px; }
.giao-ban.toi { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; font-weight: 600; }
.giao-ban button { margin-left: auto; white-space: nowrap; }
.giao-noi { position: fixed; left: 18px; bottom: 18px; z-index: 60; display: flex; flex-direction: column; gap: 10px; max-width: 340px; }
.gn-card { background: var(--panel, #fff); border: 1px solid #a7f3d0; border-left: 5px solid #16a34a; border-radius: 12px; padding: 12px 14px; box-shadow: var(--sh-lg, 0 10px 30px rgba(0,0,0,.18)); display: grid; gap: 4px; animation: gn-vao .25s ease-out; }
.gn-card b { font-size: 14px; } .gn-card .small { color: var(--muted, #64748b); } .gn-card .gn-ghi { color: #065f46; }
.gn-card .row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; }
.gn-them { font-size: 12.5px; color: var(--muted, #64748b); background: var(--panel, #fff); border-radius: 10px; padding: 6px 10px; box-shadow: var(--sh, 0 2px 8px rgba(0,0,0,.1)); }
@keyframes gn-vao { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (max-width: 720px) { .giao-noi { left: 10px; right: 10px; bottom: calc(150px + env(safe-area-inset-bottom)); max-width: none; } }

/* ================= 0.38 bố cục 5 khung (kiểu Easy AI) ================= */
.inbox { grid-template-columns: 220px 340px minmax(0, 1fr) 320px; }
.inbox:not(.open) { grid-template-columns: 220px 340px minmax(0, 1fr); }
.inbox.fd-off { grid-template-columns: 340px minmax(0, 1fr) 320px; }
.inbox.fd-off:not(.open) { grid-template-columns: 340px minmax(0, 1fr); }
.inbox.fd-off .col-folder { display: none; }
.col-folder { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.fd-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 12px 8px 16px; }
.fd-head b { font-size: 17px; }
.fd-head .icon-btn svg { width: 16px; height: 16px; }
.fd-scroll { flex: 1; overflow-y: auto; padding: 0 8px 10px; }
.fd-group { margin-bottom: 10px; }
.fd-gt { display: flex; align-items: center; gap: 7px; font-size: 11.5px; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: .05em; padding: 8px 8px 4px; }
.fd-gt svg { width: 14px; height: 14px; }
.col-folder .view.fd { display: flex; width: 100%; justify-content: space-between; align-items: center; text-align: left; padding: 7px 10px; margin: 1px 0;
  font-size: 13.5px; font-weight: 500; color: var(--text); border-radius: 8px; background: none; border: 0; box-shadow: none; }
.col-folder .view.fd:hover { background: var(--bg); }
.col-folder .view.fd.active { background: var(--primary-50); color: var(--primary); font-weight: 600; box-shadow: none; }
.col-folder .view.fd span { overflow: hidden; text-overflow: ellipsis; }
.col-folder .view[data-view=homnay] b:not(:empty), .col-folder .view[data-view=waiting] b:not(:empty) { background: #f04438; color: #fff; }
.col-folder .view[data-view=ton] b:not(:empty) { background: var(--warn-50); color: var(--warn); }
.col-folder .view[data-view=qua_sla] b:not(:empty) { background: var(--bad-50); color: var(--bad); }
.col-folder .view[data-view=noi_bo] b:not(:empty) { background: var(--violet-50); color: var(--violet); }
.fd-sub { display: flex; flex-wrap: wrap; gap: 5px; padding: 2px 6px; }
.fd-chip { font-size: 12px; font-weight: 500; padding: 4px 10px; border-radius: 14px; background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.fd-chip:hover { color: var(--text); }
.fd-chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.fd-sync { padding: 8px 14px 12px; border-top: 1px solid var(--line-2); font-size: 11.5px; color: var(--faint); }
.fd-sync:empty { display: none; }
.fd-backdrop { display: none; }
.fd-mo { display: none; }
.inbox.fd-off .fd-mo { display: inline-flex; }
/* khung 3: đầu danh sách gọn */
.list-head { position: relative; padding: 10px 10px 8px; gap: 8px; }
.lh-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.lh-row .search { flex: 1; min-width: 0; }
.lh-title { display: flex; align-items: baseline; gap: 8px; min-width: 0; padding-left: 2px; }
.lh-title b { font-size: 15px; white-space: nowrap; }
.lh-loc { font-size: 12px; color: var(--primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.loc-btn { position: relative; border: 1px solid var(--line); border-radius: 9px; padding: 7px; }
.loc-btn svg { width: 17px; height: 17px; }
.loc-btn.co { color: var(--primary); border-color: var(--primary-100); background: var(--primary-50); }
.loc-btn i { position: absolute; top: -6px; right: -6px; min-width: 16px; height: 16px; border-radius: 8px; background: var(--primary); color: #fff; font-size: 10px; font-style: normal; font-weight: 700; line-height: 16px; text-align: center; }
.loc-btn i:empty { display: none; }
.loc-pop { position: absolute; top: calc(100% - 4px); left: 8px; right: 8px; z-index: 30; background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--sh-lg); padding: 12px; display: grid; gap: 10px; }
.loc-pop label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 600; }
.loc-pop label.chk { display: flex; font-weight: 500; color: var(--text); font-size: 13px; }
.loc-pop .q-loc { display: flex; flex-wrap: wrap; gap: 5px; }
.loc-pop .q-loc .chip { border: 1px solid var(--line); }
.loc-pop .q-loc .chip.active { background: var(--primary-50); color: var(--primary); border-color: var(--primary-100); }
.loc-pop .row { display: flex; justify-content: flex-end; gap: 8px; }
/* một dòng hội thoại */
.conv { padding: 9px 10px; border-bottom: 1px solid var(--line-2); border-radius: 0; margin: 0; }
.conv:hover, .conv.active { border-radius: 10px; }
.conv .l0 { display: flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--faint); margin-bottom: 1px; min-width: 0; }
.conv .l0 .src-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.src-ic { width: 15px; height: 15px; border-radius: 4px; display: inline-grid; place-items: center; font-size: 8.5px; font-weight: 800; color: #fff; flex: none; background: #98a2b3; }
.src-ic.s-zl { background: #0068ff; } .src-ic.s-oa { background: #0a4fc4; } .src-ic.s-fb { background: #1877f2; }
.src-ic.s-web { background: #0f7a55; } .src-ic.s-sw { background: #e8590c; }
.sao-mini { color: #f59e0b; margin-left: auto; font-size: 12px; }
.conv .l3 { margin-top: 5px; gap: 4px; }
.badge.pt { background: #eef2ff; color: #3538cd; padding-left: 2px; }
.pt-av { width: 15px; height: 15px; border-radius: 50%; background: #3538cd; color: #fff; font-size: 7.5px; font-style: normal; font-weight: 800; display: inline-grid; place-items: center; }
.badge.chua-giao { background: #fff1f3; color: #c01048; }
/* khung 4 */
.t-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.t-trang { font-size: 11.5px; font-weight: 600; padding: 1px 9px; border-radius: 10px; white-space: nowrap; }
.t-trang.mo { background: var(--ok-50); color: var(--ok); }
.t-trang.xong { background: var(--line-2); color: var(--muted); }
.t-trang:empty { display: none; }
.thread-head { min-height: 58px; padding: 8px 14px; }
/* khung 5: thẻ gập */
.col-side { gap: 10px; padding: 12px; }
.card { padding: 12px 14px; }
.card.gap h3 { cursor: pointer; display: flex; align-items: center; justify-content: space-between; user-select: none; }
.card.gap h3::after { content: ""; width: 7px; height: 7px; border-right: 2px solid var(--faint); border-bottom: 2px solid var(--faint); transform: rotate(45deg); margin: -3px 4px 0 8px; transition: transform .15s; }
.card.gap.dong h3::after { transform: rotate(-45deg); margin-top: 0; }
.card.gap.dong h3 { margin: 0; }
.card.gap.dong > *:not(h3) { display: none !important; }
.noi-bo-chk { display: flex; gap: 6px; align-items: center; margin-top: 12px; font-size: 12.5px; color: var(--muted); }
/* khung 1: chỉ icon trên máy tính */
@media (min-width: 721px) {
  .rail { width: 64px; padding: 10px 6px; gap: 2px; }
  .rail-logo { width: 46px; height: 40px; margin-bottom: 10px; }
  .rail-logo img { width: 34px; }
  .rail .tab, .rail-out, .tab-more { width: 48px; height: 44px; padding: 0; justify-content: center; flex: none; }
  .rail .tab span, .rail-out span, .tab-more span { display: none; }
  .rail .tab svg, .rail-out svg { width: 22px; height: 22px; }
  .rail-badge { top: 2px; right: 2px; }
  .rail-gon .rail-me { gap: 4px; }
  .rail-gon .rail-me .icon-btn, .rail-gon .rail-me .truc-btn { width: 44px; height: 38px; padding: 0; justify-content: center; margin: 0; border-radius: 10px; }
  .rail-gon .rail-me .icon-btn { color: var(--rail-text); display: inline-flex; align-items: center; }
  .rail-gon .rail-me .icon-btn:hover { background: var(--rail-2); color: #fff; }
  .rail-gon .rail-me .notif-btn.on { color: #fff; background: rgba(255,255,255,.18); }
  .rail-gon .rail-me .truc-btn span { display: none; }
  .rail-gon .rail-me .truc-btn { background: rgba(18,183,106,.22); color: #7ee2b0; }
  .rail-gon .rail-me .truc-btn.nghi { background: rgba(255,255,255,.1); color: #98a2b3; }
  .rail-gon .rail-me .truc-btn i { width: 11px; height: 11px; }
  .top { height: 48px; }
}
@media (max-width: 1366px) {
  .inbox { grid-template-columns: 196px 320px minmax(0, 1fr) 290px; }
  .inbox:not(.open) { grid-template-columns: 196px 320px minmax(0, 1fr); }
  .inbox.fd-off { grid-template-columns: 320px minmax(0, 1fr) 290px; }
  .inbox.fd-off:not(.open) { grid-template-columns: 320px minmax(0, 1fr); }
}
/* màn hình hẹp: thư mục thành ngăn kéo bên trái (nút ba gạch ở đầu danh sách) */
@media (max-width: 1180px) {
  .inbox, .inbox.fd-off { grid-template-columns: 320px minmax(0, 1fr) 290px; }
  .inbox:not(.open), .inbox.fd-off:not(.open) { grid-template-columns: 320px minmax(0, 1fr); }
  .col-folder, .inbox.fd-off .col-folder { display: flex; position: fixed; top: 0; bottom: 0; left: 0; width: min(280px, 86vw); z-index: 45; box-shadow: var(--sh-lg);
    transform: translateX(-105%); transition: transform .22s ease; }
  .inbox.fd-open .col-folder { transform: none; }
  .inbox.fd-open .fd-backdrop { display: block; position: fixed; inset: 0; background: rgba(15,29,58,.4); z-index: 44; }
  .fd-mo, .inbox.fd-off .fd-mo { display: inline-flex; }
  #fdGap { display: none; }
}
@media (max-width: 1100px) {
  .inbox, .inbox:not(.open), .inbox.fd-off, .inbox.fd-off:not(.open) { grid-template-columns: 320px minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .inbox, .inbox:not(.open), .inbox.fd-off, .inbox.fd-off:not(.open) { grid-template-columns: 1fr; }
  .col-folder .view.fd { flex: initial; border: 0; border-radius: 8px; padding: 10px 12px; font-size: 15px; background: none; }
  .col-folder .view.fd.active { background: var(--primary-50); color: var(--primary); }
  .col-folder .view.fd.active b:not(:empty) { background: var(--primary); color: #fff; }
  .col-folder { padding-top: env(safe-area-inset-top); }
}

/* 0.38: đầu hội thoại gọn, chữ trên nút ẩn khi khung chat hẹp (rê chuột xem tên nút) */
.thread-head .t-info { flex: 1; min-width: 140px; }
.thread-head .t-info + .spacer { display: none; }
.t-sub { flex-wrap: nowrap; overflow: hidden; white-space: nowrap; }
.t-sub > * { overflow: hidden; text-overflow: ellipsis; flex: none; max-width: 100%; }
.thread-head { gap: 8px; }
@media (max-width: 1700px) and (min-width: 721px) {
  .thread-head .btn-ghost > span:not(#tGiaoTen) { display: none; }
  .thread-head .btn-ghost { padding: 7px 9px; }
  #tGiaoTen { max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; vertical-align: middle; }
}

/* 0.38b: bỏ thanh cuộn ngang thừa, nút ô trả lời chỉ icon khi khung chat hẹp */
.col-side, .rail, .fd-scroll, .conv-list { overflow-x: hidden; }
@media (max-width: 1700px) and (min-width: 721px) {
  .reply .mau-btn span { display: none; }
  .reply .mau-btn { padding: 0 11px; }
}
.col-folder .view[data-view=homnay] b.tong:not(:empty) { background: var(--line); color: var(--muted); }

.rail { scrollbar-width: none; }
.rail::-webkit-scrollbar { display: none; }

/* ================= 0.39 lọc khách rác ================= */
.fd-gt .fd-cai { margin-left: auto; font-size: 11px; font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--primary); background: none; padding: 0 4px; }
.col-folder .view[data-view=tiem_cao] b:not(:empty) { background: var(--ok-50); color: var(--ok); }
.col-folder .view[data-view=da_loc] b:not(:empty), .col-folder .view[data-view=ngu_dong] b:not(:empty), .col-folder .view[data-view=doi_tac] b:not(:empty) { background: var(--line-2); color: var(--muted); }
.badge.loc-ld { background: #f2f4f7; color: #667085; }
.badge.diem { background: var(--ok-50); color: var(--ok); }
.loc-ban { display: flex; align-items: center; gap: 10px; padding: 9px 16px; background: #f2f4f7; border-bottom: 1px solid var(--line); color: #475467; font-size: 13px; }
.loc-ban svg { width: 16px; height: 16px; flex: none; }
.loc-nut { display: flex; gap: 6px; margin-top: 12px; flex-wrap: wrap; }
.loc-nut .btn-ghost { flex: 1; }
.loc-dlg { width: min(520px, 94vw); }
.loc-dlg label.chk { display: flex; gap: 6px; align-items: flex-start; margin: 8px 0; color: var(--text); font-size: 13.5px; }
.loc-dlg .loc-so { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 8px 0; font-size: 13.5px; color: var(--text); }
.loc-dlg .loc-so input { width: 90px; }
.loc-dlg .row { margin-top: 14px; }

.loc-dlg { overflow-x: hidden; }
.loc-dlg label.chk, .loc-dlg label.chk span { white-space: normal; }
.loc-dlg label.chk input { flex: none; margin-top: 3px; }

/* 0.42 điều phối */
.dp-dong { display: grid; gap: 6px; margin-bottom: 14px; }
.dp-nguoi { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.dp-nguoi .chk { display: flex; align-items: center; gap: 4px; font-size: 13.5px; }
.dp-dong input { max-width: 260px; }

/* 0.44: nút Hướng dẫn (thẻ a) trên thanh trái và bảng Thêm */
a.rail-out, .sheet-foot a.btn-ghost { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
a.rail-out { color: var(--rail-text); }

/* 0.44: nút Gọi luôn nổi bật, có chữ "Gọi" kể cả khi khung chat hẹp */
.thread-head #tGoi { background: #16a34a; border-color: #16a34a; color: #fff; font-weight: 600; padding: 7px 12px; }
.thread-head #tGoi:hover { background: #15803d; border-color: #15803d; color: #fff; }
.thread-head #tGoi > span { display: inline !important; }
.thread-head #tGoi.hidden { display: none !important; }
@media (max-width: 720px) { .thread-head #tGoi { padding: 7px 10px; } }
@media (max-width: 1700px) and (min-width: 721px) {
  .thread-head .t-info { min-width: 96px; }
  .thread-head #tGoi { padding: 7px 10px; }
  #tGiaoTen { max-width: 72px; }
}

/* 0.45: nút Quét lại trên thẻ nick bị văng */
.nick-card .nick-quet { margin-top: 8px; width: 100%; justify-content: center; }

/* 0.46: lời nhắn kèm ảnh / video */
.msg .cap { margin-top: 6px; white-space: pre-wrap; }

/* 0.46: chuông khi trình duyệt chặn thông báo */
.notif-btn.chan { color: #dc2626; }
.notif-btn.chan::after { content: "!"; font-weight: 800; font-size: 11px; margin-left: -4px; }

/* 0.47: thanh có bản mới */
.ban-moi { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 9999; display: flex; gap: 12px;
  align-items: center; background: #1e2a78; color: #fff; padding: 10px 14px; border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.25);
  font-size: 14px; max-width: calc(100vw - 32px); }
.ban-moi .btn-primary { background: #fff; color: #1e2a78; white-space: nowrap; }
.ban-moi.ios-goi-y { top: 70px; bottom: auto; background: #0f766e; }

/* 0.47: thêm khách bằng SĐT */
.tk-kq { margin-top: 10px; }
.tk-the { display: flex; gap: 12px; align-items: center; padding: 10px; border: 1px solid #e3e7f0; border-radius: 10px; margin-bottom: 10px; }
.tk-anh { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; }

/* 0.49: chuyển khách sang Zalo của KD */
.chuyen-kd { margin: 6px auto 10px; max-width: 640px; display: flex; gap: 10px; align-items: center; justify-content: space-between;
  background: #eef6ff; border: 1px solid #bfdbfe; color: #1e3a8a; border-radius: 10px; padding: 8px 12px; font-size: 13px; }
label.chk { display: flex; gap: 6px; align-items: flex-start; font-weight: 500; margin-top: 8px; }
label.chk input { width: auto; margin-top: 3px; }

/* 0.50: lời nhắn kèm ảnh / video hiện thành bong bóng riêng dưới ảnh (trước đây chữ trắng trên nền trong suốt nên bị mờ) */
.msg.media .cap { margin: 6px 0 2px; padding: 8px 12px; border-radius: 12px; background: #fff; color: var(--text, #1f2937);
  box-shadow: 0 1px 2px rgba(0,0,0,.08); white-space: pre-wrap; }
.msg.media.out .cap { background: linear-gradient(135deg, #2c4192 0%, var(--primary) 100%); color: #fff; }

/* 0.53: tin vừa bấm gửi, chờ Zalo xác nhận */
.msg.cho-gui { opacity: .75; }
.msg.cho-gui .meta { font-style: italic; }

/* 0.53: lọc chọn nhiều nick */
.nick-chon-o { display: flex; flex-direction: column; gap: 4px; position: relative; font-size: 13px; }
.nick-chon-nhan { font-weight: 600; color: var(--muted); font-size: 12px; }
.nick-chon-btn { text-align: left; padding: 8px 10px; border: 1px solid #d6dcea; border-radius: 8px; background: #fff; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nick-chon-ds { max-height: 300px; overflow: auto; border: 1px solid #d6dcea; border-radius: 8px; background: #fff; padding: 6px 8px; }
.nick-chon-nhom { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; margin: 8px 0 2px; }
.nick-chon-dong { display: flex; gap: 6px; align-items: center; padding: 4px 2px; cursor: pointer; font-weight: 500; }
.nick-chon-dong input { width: auto; margin: 0; }
.nick-chon-dong.tat { color: var(--muted); }

/* 0.53: thả cảm xúc vào tin khách */
.msg.in { position: relative; }
.msg .cx-nut { position: absolute; right: -30px; top: 50%; transform: translateY(-50%); width: 26px; height: 26px; border-radius: 50%;
  border: 1px solid #d6dcea; background: #fff; color: #5f6b85; cursor: pointer; font-size: 15px; line-height: 1; opacity: 0; transition: opacity .15s; padding: 0; }
.msg.in:hover .cx-nut, .msg.in:focus-within .cx-nut { opacity: 1; }
@media (hover: none) { .msg .cx-nut { opacity: .7; } }
.msg .cx-chon { position: absolute; left: 0; bottom: calc(100% + 4px); display: flex; gap: 2px; background: #fff; border: 1px solid #d6dcea;
  border-radius: 20px; padding: 4px 6px; box-shadow: 0 6px 18px rgba(0,0,0,.15); z-index: 30; }
.msg .cx-chon button { border: 0; background: none; font-size: 20px; cursor: pointer; padding: 2px 4px; border-radius: 8px; }
.msg .cx-chon button:hover { background: #f1f4fa; transform: scale(1.15); }
.msg .cx-da { position: absolute; right: -6px; bottom: -10px; background: #fff; border: 1px solid #e3e7f0; border-radius: 12px; font-size: 13px; padding: 0 4px; }

/* 0.55: trả lời trích dẫn */
.msg { position: relative; }
.msg .trich { display: flex; flex-direction: column; gap: 1px; border-left: 3px solid #93a4d8; background: rgba(15, 23, 42, .06);
  border-radius: 6px; padding: 4px 8px; margin-bottom: 6px; font-size: 12px; max-width: 100%; }
.msg.out .trich { background: rgba(255, 255, 255, .16); border-left-color: rgba(255, 255, 255, .7); }
.msg .trich b { font-weight: 700; }
.msg .trich span { white-space: pre-wrap; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; opacity: .85; }
.msg .tl-nut { position: absolute; top: 50%; transform: translateY(-50%); width: 26px; height: 26px; border-radius: 50%;
  border: 1px solid #d6dcea; background: #fff; color: #5f6b85; cursor: pointer; font-size: 14px; line-height: 1; padding: 0;
  opacity: 0; transition: opacity .15s; }
.msg.in .tl-nut { right: -58px; }
.msg.out .tl-nut { left: -32px; }
.msg:hover .tl-nut, .msg:focus-within .tl-nut { opacity: 1; }
@media (hover: none) { .msg .tl-nut { opacity: .7; } }
.tl-bar { display: flex; gap: 8px; align-items: center; background: #eef2fb; border-left: 3px solid var(--primary, #233477);
  border-radius: 8px; padding: 6px 10px; margin: 0 14px 6px; font-size: 13px; box-sizing: border-box; }
.tl-bar .tl-nhan { font-weight: 700; white-space: nowrap; }
.tl-bar .tl-text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted, #5f6b85); }
.tl-bar .tl-bo { border: 0; background: none; cursor: pointer; font-size: 14px; color: #5f6b85; padding: 2px 6px; }

/* 0.56: nút Không phải khách trên đầu hội thoại */
.khac-wrap { position: relative; }
.khac-wrap .giao-pop { right: 0; left: auto; min-width: 280px; }
.khac-btn svg { color: #b45309; }
@media (max-width: 1500px) { .khac-btn > span { display: none; } }

/* 0.57: ghi chú về khách rộng rãi */
#cNote { min-height: 150px; max-height: 420px; resize: vertical; line-height: 1.5; font-size: 14px; }

/* 0.58: ô tick cùng hàng chữ trong lọc nick (kiểu chung .loc-pop label đang ép thành cột) + ô tìm nick */
.loc-pop .nick-chon-dong { display: flex; flex-direction: row; align-items: center; gap: 8px; font-weight: 500; color: var(--text);
  font-size: 13px; margin: 0; padding: 5px 2px; cursor: pointer; }
.loc-pop .nick-chon-dong.tat { color: var(--muted); }
.loc-pop .nick-chon-dong.hidden, .loc-pop .nick-chon-nhom.hidden { display: none; }
.loc-pop .nick-chon-dong input[type="checkbox"] { width: 16px; height: 16px; margin: 0; flex: none; }
.nick-chon-tim { width: 100%; padding: 7px 10px; border: 1px solid #d6dcea; border-radius: 8px; margin-bottom: 4px; font-size: 13px; box-sizing: border-box; }

/* 0.59: danh sách tag @tên trong nhóm */
.tag-pop .mau-it b { color: var(--primary, #233477); }

/* 0.60: thanh nhắc hẹn */
.hen-nhac { position: fixed; right: 16px; top: 64px; z-index: 9998; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 32px)); }
.hen-the { background: #fff; border: 1px solid #e3e7f0; border-left: 5px solid #d97706; border-radius: 12px; padding: 10px 12px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, .18); display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.hen-the.hen-dung { border-left-color: #dc2626; }
.hen-the.hen-lai { border-left-color: #7c3aed; }
.hen-the b { font-size: 14px; }
.hen-nut { display: flex; gap: 8px; justify-content: flex-end; }

/* 0.61: lọc thời gian, nút báo nhóm, thanh hội thoại khác */
.tg-khoang { display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); margin: -4px 0 8px; }
.tg-khoang input { flex: 1; min-width: 0; padding: 6px 8px; border: 1px solid #d6dcea; border-radius: 8px; }
.nhom-bao-btn.tat { color: #9ca3af; text-decoration: line-through; }
@media (max-width: 1500px) { .nhom-bao-btn > span { display: none; } }
.khac-360 { flex-wrap: wrap; justify-content: flex-start; background: #f5f3ff; border-color: #ddd6fe; color: #4c1d95; }

/* 0.62 bố cục màn hình laptop (Anh Vinh 27/11/2026: để làm việc bị ẩn nhiều nút, phải thu nhỏ trình duyệt mới thấy đủ).
   Đo: đầu khung chat chỉ một hàng nên nút tràn bị cắt (1280: 4 nút, 1366-1440: Sao + Đánh dấu xong, 1920: Đánh dấu xong).
   1) Đầu khung chat không bao giờ cắt nút: hết chỗ thì nút xuống hàng thứ hai.
   2) Màn hình dưới 1600px: khung "Thông tin khách" bên phải thành ngăn kéo, bấm nút "Khách" mới mở, nhường chỗ cho khung chat. */
.thread-head { flex-wrap: wrap; row-gap: 6px; }
.thread-head .t-info { flex: 1 1 180px; min-width: 150px; }
.thread-head .spacer { display: none; }
@media (min-width: 721px) and (max-width: 1599px) {
  .inbox, .inbox:not(.open) { grid-template-columns: 210px 330px minmax(0, 1fr); }
  .inbox.fd-off, .inbox.fd-off:not(.open) { grid-template-columns: 330px minmax(0, 1fr); }
  .info-btn { display: inline-flex; }
  .col-side { position: fixed; top: 0; right: 0; bottom: 0; width: min(400px, 100vw); z-index: 40; border-left: 0; box-shadow: var(--sh-lg);
    transform: translateX(105%); transition: transform .22s ease; padding-top: 0; overflow-y: auto; }
  .inbox.side-open .col-side { transform: none; }
  .side-head { display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 1;
    background: var(--bg); padding: 12px 0 4px; font-size: 15px; }
  .side-backdrop { position: fixed; inset: 0; background: rgba(15,29,58,.25); z-index: 39; }
  .inbox.side-open .side-backdrop { display: block; }
}

/* 0.63 nút "Cập nhật mới" (như thông báo Facebook): sáng lên khi có tin chưa đọc, đọc xong thì chìm */
.cn-btn { position: relative; display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; border-radius: 18px;
  padding: 6px 11px; color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.cn-btn svg { width: 19px; height: 19px; }
.cn-btn:hover { background: var(--line-2); color: var(--text); }
.cn-btn.sang { background: #fff4e5; color: #b45309; box-shadow: 0 0 0 0 rgba(245,158,11,.55); animation: cnSang 2.2s ease-out infinite; }
.cn-btn.sang:hover { background: #ffe8c7; }
@keyframes cnSang { 0% { box-shadow: 0 0 0 0 rgba(245,158,11,.55); } 70% { box-shadow: 0 0 0 9px rgba(245,158,11,0); } 100% { box-shadow: 0 0 0 0 rgba(245,158,11,0); } }
@media (prefers-reduced-motion: reduce) { .cn-btn.sang { animation: none; } }
.cn-dem { position: absolute; top: -10px; left: 13px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px; background: #f04438;
  color: #fff; font-size: 11px; line-height: 19px; font-weight: 700; text-align: center; border: 2px solid var(--panel); box-sizing: content-box; }
.cn-panel { position: fixed; top: 60px; right: 16px; width: min(460px, calc(100vw - 24px)); max-height: min(640px, calc(100vh - 80px));
  display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--sh-lg); z-index: 60; overflow: hidden; }
.cn-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 10px 16px; border-bottom: 1px solid var(--line); }
.cn-head > b { font-size: 16px; white-space: nowrap; }
.cn-head .btn-ghost { white-space: nowrap; }
.cn-tom { font-size: 12px; color: var(--muted); white-space: nowrap; }
.cn-head .btn-ghost.sm { padding: 5px 9px; font-size: 12.5px; }
.cn-list { overflow-y: auto; padding: 6px; }
.cn-trong { padding: 30px 12px; text-align: center; color: var(--muted); }
.cn-item { border-radius: 10px; margin: 2px 0; background: #eef4ff; }
.cn-item.da-doc { background: none; }
.cn-item.mo { background: var(--line-2); }
.cn-dau { display: flex; gap: 10px; align-items: flex-start; justify-content: flex-start; width: 100%; text-align: left; background: none; border: 0; padding: 10px 10px; cursor: pointer; color: var(--text); }
.cn-cham { flex: none; width: 9px; height: 9px; border-radius: 50%; background: #1877f2; margin-top: 6px; }
.cn-item.da-doc .cn-cham { background: transparent; }
.cn-chu-tin { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; text-align: left; }
.cn-chu-tin b { font-size: 14px; line-height: 1.35; }
.cn-item.da-doc .cn-chu-tin b { font-weight: 500; color: #4b5563; }
.cn-meta { font-size: 11.5px; color: #1877f2; font-weight: 600; }
.cn-item.da-doc .cn-meta { color: var(--muted); font-weight: 400; }
.cn-than { white-space: pre-line; font-size: 13.5px; line-height: 1.55; color: #374151; padding: 0 12px 12px 29px; }
.cn-xoa-hang { display: flex; justify-content: flex-end; margin-top: 6px; }
.cn-xoa { background: none; border: 0; color: var(--bad); font-size: 12px; cursor: pointer; padding: 2px 6px; }
@media (max-width: 1100px) { .cn-chu { display: none; } .cn-btn { padding: 7px; } }
@media (max-width: 720px) {
  .cn-btn { color: #dfe5f6; } .cn-btn:hover { background: rgba(255,255,255,.12); color: #fff; }
  .cn-btn.sang { background: rgba(255,196,77,.22); color: #ffd57a; }
  .cn-dem { border-color: #233477; left: auto; right: -3px; top: -3px; }
  .cn-panel { top: calc(60px + env(safe-area-inset-top)); right: 8px; left: 8px; width: auto; max-height: calc(100vh - 90px); }
  .cn-tom { display: none; }
}

/* 0.64 chúc sinh nhật khách */
.sn-ban { flex-direction: column; align-items: stretch; gap: 6px; background: #fff7ed; border-color: #fed7aa; color: #7c2d12; }
.sn-ban .sn-cau { background: #fff; border: 1px solid #fde3c8; border-radius: 8px; padding: 8px 10px; color: #374151; font-size: 13.5px; line-height: 1.5; white-space: pre-line; }
.sn-ban .sn-nut { display: flex; gap: 8px; flex-wrap: wrap; }
.sn-dong { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 6px 0 10px; }
.sn-dong input[type=time] { width: 130px; flex: none; display: inline-block; margin: 0; padding: 5px 8px; border: 1px solid #d6dcea; border-radius: 8px; }
.sn-dong input[type=checkbox] { width: auto; margin: 0; }
.sn-nick { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0 0 12px; }
.sn-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; }

/* 0.65 số thư mục đang đếm theo bộ lọc */
.fd b.dem-loc:not(:empty) { box-shadow: inset 0 0 0 1.5px #3b82f6; color: #1d4ed8; background: #eff6ff; }

/* 0.69 Đơn web */
.col-folder .dw-link { display: flex; width: 100%; justify-content: space-between; align-items: center; text-align: left; padding: 7px 10px; margin: 1px 0;
  font-size: 13.5px; font-weight: 500; color: var(--text); border-radius: 8px; background: none; border: 0; cursor: pointer; }
.col-folder .dw-link:hover { background: var(--bg); }
.dw-link b { font-weight: 700; font-size: 11px; }
.dw-link b:not(:empty) { background: #f97316; color: #fff; padding: 0 6px; border-radius: 8px; }
.dw-site { margin-left: auto; max-width: 220px; }
tr.dw-moi td:first-child { box-shadow: inset 3px 0 0 #f97316; }
.dw-sp { max-width: 320px; }
.pill.dw-moi { background: #ffedd5; color: #c2410c; } .pill.dw-da_goi { background: #e0f2fe; color: #0369a1; }
.pill.dw-khong_nghe { background: #fef3c7; color: #b45309; } .pill.dw-chot { background: var(--ok-50); color: var(--ok); }
.pill.dw-huy, .pill.dw-cu { background: var(--line); color: var(--muted); }
.dw-don .dw-dong { display: flex; gap: 10px; padding: 3px 0; } .dw-don .dw-dong b { min-width: 110px; color: var(--muted); font-weight: 600; }
.dw-items { border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; margin: 8px 0; }
.dw-item { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; } .dw-tong { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 6px; }
.dw-sites { display: flex; flex-direction: column; gap: 10px; }
.dw-site-row { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.dw-site-dau { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; } .dw-site-dau .ok { color: var(--ok); } .dw-site-dau .bad { color: #dc2626; }
.dw-site-khoa { display: flex; gap: 8px; margin-top: 6px; flex-wrap: wrap; } .dw-site-khoa input { flex: 1 1 200px; min-width: 0; }

/* bản thử nghiệm (30/11/2026): dải cam trên cùng, nhãn giữa, nút Góp ý dọc mép phải */
body.thu-nghiem::before { content: ""; position: fixed; top: 0; left: 0; right: 0; height: 4px; background: #f97316; z-index: 10000; pointer-events: none; }
.thu-nhan { position: fixed; top: 4px; left: 50%; transform: translateX(-50%); z-index: 10000; pointer-events: none; background: #f97316;
  color: #fff; font-size: 11px; font-weight: 700; padding: 2px 10px; border-radius: 0 0 8px 8px; white-space: nowrap; letter-spacing: .3px; }
.thu-gop-y { position: fixed; right: 0; top: 42%; z-index: 9998; background: #f97316; color: #fff; border: 0; cursor: pointer;
  writing-mode: vertical-rl; transform: rotate(180deg); padding: 12px 6px; border-radius: 0 8px 8px 0; font-weight: 700; font-size: 13px;
  box-shadow: 0 4px 12px rgba(0,0,0,.2); }
.thu-ds { max-height: 38vh; overflow: auto; border: 1px solid #e3e7f0; border-radius: 10px; padding: 6px 10px; margin-bottom: 10px; }
.thu-dong { padding: 6px 0; border-bottom: 1px solid #eef1f6; }
.thu-dong:last-child { border-bottom: 0; }
.thu-pre { white-space: pre-wrap; word-break: break-word; font-size: 12px; background: #f6f7fb; padding: 6px; border-radius: 6px; margin: 4px 0 0; max-height: 160px; overflow: auto; }
@media (max-width: 767px) { .thu-nhan { font-size: 10px; } .thu-gop-y { top: 35%; } }
