/* =========================================================
   Thành Phát Messenger — giao diện
   ========================================================= */
:root {
  --bg: #eef2f7;
  --panel: #ffffff;
  --soft: #f6f8fb;
  --chat-bg: #f3f6fa;
  --line: #e5e9f0;
  --line-2: #eef1f5;
  --text: #0f1b2d;
  --text-2: #4a5568;
  --muted: #8a94a6;
  --primary: #0b63ce;
  --primary-600: #0852ad;
  --primary-soft: #e8f1fc;
  --accent: #1e90d8;
  --fb: #1877f2;
  --zalo: #0068ff;
  --danger: #e03131;
  --ok: #0f9d58;
  --warn: #f08c00;
  --rail: #0a2552;
  --rail-2: #081c40;
  --radius: 10px;
  --shadow-sm: 0 1px 2px rgba(15, 27, 45, .06);
  --shadow: 0 4px 16px rgba(15, 27, 45, .08);
  --shadow-lg: 0 18px 48px rgba(15, 27, 45, .18);
  --font: "Be Vietnam Pro", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font: 14px/1.5 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--danger); font-size: 13px; }
a { color: var(--primary); }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #cfd6e0; border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: #b5bfcc; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Nút & ô nhập ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border: 1px solid var(--line); background: #fff; border-radius: 9px; cursor: pointer; white-space: nowrap; font-weight: 500; font-size: 13.5px; transition: background .15s, border-color .15s, box-shadow .15s; }
.btn:hover { background: var(--soft); border-color: #d3d9e3; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(11, 99, 206, .3); }
.btn.primary:hover { background: var(--primary-600); }
.btn.danger { color: var(--danger); }
.btn.sm { height: 30px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
a.btn { text-decoration: none; }
input, select, textarea { border: 1px solid var(--line); border-radius: 9px; padding: 8px 11px; background: #fff; outline: none; transition: border-color .15s, box-shadow .15s; }
select { padding-right: 28px; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(11, 99, 206, .12); }
label { display: block; font-size: 12.5px; color: var(--text-2); font-weight: 500; }
label > input, label > select, label > textarea { display: block; width: 100%; margin-top: 5px; color: var(--text); font-weight: 400; }
code, .code { background: #f1f4f8; padding: 2px 6px; border-radius: 5px; font-size: 12.5px; word-break: break-all; }

/* ---------- Đăng nhập ---------- */
.login { height: 100%; display: grid; place-items: center; padding: 16px; overflow-y: auto;
  background: radial-gradient(1200px 600px at 10% 0%, #2c86e0 0%, transparent 60%), linear-gradient(150deg, #062a63, #0a4fa6 55%, #1a7fd6); }
.login-card { background: #fff; width: 100%; max-width: 380px; padding: 34px 30px 26px; border-radius: 20px; box-shadow: var(--shadow-lg); display: grid; gap: 14px; }
.login-logo { width: 240px; max-width: 80%; display: block; margin: 0 auto 2px; }
.login-card h1 { margin: 0; font-size: 22px; color: #0a4fa6; text-align: center; letter-spacing: -.01em; font-weight: 700; }
.login-card h1 span { color: var(--accent); }
.login-card > p.muted { text-align: center; margin: -8px 0 4px; }
.login-card .error { text-align: center; }
.login-card .error:empty { display: none; }
.fb-btn { background: #1877f2; border-color: #1877f2; color: #fff; font-weight: 600; height: 44px; font-size: 14.5px; text-decoration: none; }
.fb-btn:hover { background: #166fe0; }
.fb-btn svg { width: 20px; height: 20px; }
a.btn.fb-btn { display: flex; }
.login-note { font-size: 12px; color: var(--muted); margin: 0; text-align: center; }
.login-local { border-top: 1px solid var(--line-2); padding-top: 12px; }
.login-local summary { cursor: pointer; color: var(--text-2); font-size: 13px; text-align: center; list-style: none; }
.login-local summary::-webkit-details-marker { display: none; }
.login-local[open] { display: grid; gap: 12px; }

/* ---------- Khung ứng dụng ---------- */
.app { display: flex; height: 100%; }
.rail { width: 68px; background: linear-gradient(180deg, var(--rail), var(--rail-2)); display: flex; flex-direction: column; align-items: center; padding: 12px 0; gap: 4px; flex-shrink: 0; }
.rail-logo { width: 42px; height: 42px; border-radius: 12px; background: #fff; padding: 5px; margin-bottom: 14px; object-fit: contain; box-shadow: 0 4px 12px rgba(0,0,0,.25); }
.rail a { position: relative; width: 56px; padding: 8px 0 6px; border-radius: 12px; color: #9fb0cc; text-decoration: none; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10.5px; font-weight: 500; transition: background .15s, color .15s; }
.rail a svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.rail a:hover { background: rgba(255,255,255,.07); color: #fff; }
.rail a.on { background: rgba(255,255,255,.12); color: #fff; }
.rail a.on::before { content: ''; position: absolute; left: -6px; top: 10px; bottom: 10px; width: 3px; border-radius: 3px; background: #4fb3ff; }
.rail-spacer { flex: 1; }
.rail-me { width: 38px; height: 38px; border-radius: 50%; border: 2px solid rgba(255,255,255,.35); background: #33466b center/cover; color: #fff; font-weight: 600; cursor: pointer; }
.view { flex: 1; min-width: 0; }
.inbox { display: flex; height: 100%; }

/* ---------- Avatar ---------- */
.avatar { width: 44px; height: 44px; border-radius: 50%; background: #cbd5e1 center/cover; flex-shrink: 0; position: relative; display: grid; place-items: center; color: #fff; font-weight: 600; font-size: 16px; }
.avatar.sm { width: 32px; height: 32px; font-size: 13px; }
.avatar.md { width: 40px; height: 40px; font-size: 15px; }
.avatar.lg { width: 72px; height: 72px; font-size: 26px; }
.pbadge { position: absolute; right: -2px; bottom: -2px; width: 17px; height: 17px; border-radius: 50%; border: 2px solid #fff; display: grid; place-items: center; font-size: 9px; font-weight: 700; color: #fff; }
.pbadge.facebook { background: var(--fb); }
.pbadge.zalo { background: var(--zalo); }
.av-unread { position: absolute; left: -4px; top: -3px; background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 700; min-width: 19px; height: 19px; border-radius: 10px; border: 2px solid #fff; display: grid; place-items: center; padding: 0 4px; }

/* ---------- Danh sách hội thoại ---------- */
.list-pane { width: 350px; flex-shrink: 0; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.list-head { padding: 12px 12px 10px; display: grid; gap: 8px; border-bottom: 1px solid var(--line); }
.list-head > * { min-width: 0; }
.lh-row { display: flex; gap: 6px; align-items: center; min-width: 0; }
.scope-btn { display: flex; align-items: center; gap: 9px; width: 100%; border: 1px solid var(--line); background: var(--soft); border-radius: 10px; padding: 6px 10px; cursor: pointer; text-align: left; transition: border-color .15s; }
.scope-btn:hover { border-color: var(--primary); }
.scope-btn .sc-avs { display: flex; flex-shrink: 0; }
.scope-btn .sc-avs img, .scope-btn .sc-avs span { width: 24px; height: 24px; border-radius: 50%; border: 2px solid #fff; margin-left: -7px; object-fit: cover; background: #cbd5e1; display: grid; place-items: center; font-size: 10px; font-weight: 700; color: #fff; }
.scope-btn .sc-avs > :first-child { margin-left: 0; }
.scope-btn .sc-txt { flex: 1; min-width: 0; }
.scope-btn .sc-txt b { display: block; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scope-btn .sc-sub { color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.scope-btn .sc-caret { color: var(--muted); font-size: 12px; }
.search { position: relative; flex: 1; min-width: 0; }
.search svg { position: absolute; left: 10px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.search input { width: 100%; min-width: 0; height: 36px; padding: 0 10px 0 33px; background: var(--soft); border-color: transparent; }
.search input:focus { background: #fff; }
.flt-btn { position: relative; width: 36px; height: 36px; flex-shrink: 0; border: 1px solid var(--line); background: #fff; border-radius: 9px; cursor: pointer; display: grid; place-items: center; color: var(--text-2); }
.flt-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.flt-btn.on { color: var(--primary); border-color: var(--primary); background: var(--primary-soft); }
.flt-btn i { position: absolute; top: 5px; right: 5px; width: 7px; height: 7px; border-radius: 50%; background: var(--danger); display: none; }
.flt-btn i.on { display: block; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.list-head .chips { flex: 1; flex-wrap: nowrap; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.list-head .chips::-webkit-scrollbar { display: none; }
.chips button { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 4px 10px; font-size: 12.5px; font-weight: 500; cursor: pointer; white-space: nowrap; color: var(--text-2); transition: all .15s; }
.chips button:hover { border-color: #c9d2de; }
.chips button.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.chips button b { margin-left: 3px; background: #eef2f7; color: var(--text); border-radius: 8px; padding: 0 6px; font-size: 11px; font-weight: 600; }
.chips button b:empty { display: none; }
.chips button.on b { background: rgba(255,255,255,.22); color: #fff; }
.type-seg { display: flex; background: var(--soft); border: 1px solid var(--line-2); border-radius: 9px; padding: 2px; gap: 2px; flex: none; }
.type-seg button { border: none; background: none; border-radius: 7px; padding: 5px 7px; cursor: pointer; color: var(--muted); display: grid; place-items: center; }
.type-seg button svg, .kind-ic svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.type-seg button.on { background: #fff; color: var(--primary); box-shadow: var(--shadow-sm); }
.filter-panel { display: grid; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); }
.filter-panel .chips { overflow: visible; }
.filter-panel .btn { justify-self: start; }
.selects { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.selects select { padding: 6px 9px; font-size: 12.5px; min-width: 0; }
.conv-list { overflow-y: auto; flex: 1; padding: 4px 0; }
.conv { display: flex; gap: 11px; padding: 11px 14px 11px 13px; cursor: pointer; position: relative; border-left: 3px solid transparent; transition: background .12s; }
.conv + .conv { box-shadow: inset 0 1px 0 var(--line-2); }
.conv:hover { background: #f7f9fc; }
.conv.active { background: var(--primary-soft); border-left-color: var(--primary); }
.conv-body { flex: 1; min-width: 0; }
.conv-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.conv-name { font-weight: 500; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-time { font-size: 11.5px; color: var(--muted); flex-shrink: 0; }
.conv-last { color: var(--text-2); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.conv.unread { background: #dfe3ea; }
.conv.unread:hover { background: #d6dbe4; }
.conv.unread + .conv.unread { box-shadow: inset 0 1px 0 #eef1f5; }
.conv.unread.active { background: var(--primary-soft); }
.conv.unread .conv-name { font-weight: 600; color: #111827; }
.conv.unread .conv-last { color: #111827; font-weight: 600; }
.conv.unread .conv-time { color: #111827; font-weight: 500; }
.conv:not(.unread) .conv-last { color: #6b7280; }
.re-ic { color: #9ca3af; margin-right: 4px; font-weight: 400; }
.conv-icons { position: absolute; right: 14px; bottom: 11px; display: flex; gap: 4px; }
.conv-icons .ci { width: 20px; height: 20px; border-radius: 5px; display: grid; place-items: center; color: #9aa3af; }
.conv-icons .ci svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.conv-icons .ci.phone { background: #22a447; color: #fff; }
.conv-icons .ci.phone svg { fill: #fff; stroke: none; width: 13px; height: 13px; }
.conv-icons .ci.unread { background: #f15a24; color: #fff; }
.conv-icons .ci.unread.comment { background: transparent; color: #f15a24; }
.conv-icons .ci.unread.comment svg { fill: #f15a24; stroke: #f15a24; width: 18px; height: 18px; }
.conv-icons .ci.unread.message svg { stroke: #fff; }
.conv-meta { display: flex; align-items: center; gap: 5px; margin-top: 5px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); padding-right: 22px; }
.tagdot { display: inline-block; padding: 0 7px; border-radius: 999px; color: #fff; font-size: 10.5px; font-weight: 600; line-height: 17px; }
.phone-ic { color: var(--ok); font-weight: 700; }
.kind-ic { position: absolute; right: 14px; bottom: 11px; color: #a6b0bf; display: grid; place-items: center; }
.kind-ic.comment svg { fill: currentColor; fill-opacity: .15; }
.kind-ic.message svg { fill: currentColor; fill-opacity: .1; }
.kind-ic.unread.message { color: var(--danger); }
.kind-ic.unread.comment { color: var(--warn); }
.list-more { padding: 16px; text-align: center; }
.ad-ic { background: #fff4db; color: #9a5b00; border-radius: 5px; padding: 0 5px; font-size: 10.5px; font-weight: 700; letter-spacing: .02em; }
.ai-ic { background: #efeafe; color: #6d28d9; border-radius: 999px; padding: 0 7px; font-size: 10.5px; font-weight: 600; }
.ai-ic.hand { background: #fdecec; color: var(--danger); }
.auto-ic { background: #fff4db; color: #9a5b00; border-radius: 999px; padding: 0 7px; font-size: 10.5px; font-weight: 600; }
.auto-ic.fu { background: #e3f3fd; color: #075985; }

/* ---------- Khung chat ---------- */
.chat-pane { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--chat-bg); }
.empty-state { margin: auto; text-align: center; color: var(--muted); }
.empty-state .big { font-size: 54px; opacity: .35; }
.chat-head { display: flex; align-items: center; gap: 11px; padding: 10px 16px; background: #fff; border-bottom: 1px solid var(--line); min-height: 64px; box-shadow: var(--shadow-sm); z-index: 1; }
.chat-head .who { flex: 1; min-width: 0; }
.who-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.who-name b { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hd-phone { font-size: 12px; font-weight: 600; color: var(--ok); background: #e7f6ee; border-radius: 999px; padding: 1px 8px; cursor: pointer; white-space: nowrap; }
.who-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.head-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.chip-btn { height: 32px; padding: 0 11px; border-radius: 8px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.chip-btn:hover { background: var(--soft); }
.chip-btn.ok { color: var(--ok); border-color: #bfe6cf; background: #f1fbf5; }
.chip-btn.ai-on { background: #f3effe; border-color: #d9ccfb; color: #5b21b6; }
.sel-wrap { position: relative; display: flex; align-items: center; margin: 0; }
.sel-wrap svg { position: absolute; left: 9px; width: 14px; height: 14px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.sel-wrap select { height: 32px; padding: 0 26px 0 28px; font-size: 12.5px; max-width: 160px; margin: 0; color: var(--text); border-radius: 8px; }
.icon-btn { width: 38px; height: 38px; border-radius: 10px; border: 1px solid transparent; background: transparent; cursor: pointer; display: grid; place-items: center; flex-shrink: 0; color: var(--text-2); transition: background .15s, color .15s; }
.icon-btn:hover { background: #eef2f7; color: var(--primary); }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn.send { background: var(--primary); color: #fff; border-radius: 50%; box-shadow: 0 2px 6px rgba(11, 99, 206, .35); }
.icon-btn.send:hover { background: var(--primary-600); color: #fff; }
.icon-btn.mic.live { background: #fdecec; color: var(--danger); animation: pulse 1.2s infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(224, 49, 49, .35); } 50% { box-shadow: 0 0 0 6px rgba(224, 49, 49, 0); } }
.ai-btn { font-size: 18px; }
.icon-btn.back-btn { display: none; }
.post-link { font-size: 12.5px; background: #fff8e8; border-bottom: 1px solid #fbe3b0; padding: 7px 16px; color: #7a5200; }
.messages { flex: 1; overflow-y: auto; padding: 18px 22px; display: flex; flex-direction: column; gap: 3px; }
.day-sep { align-self: center; font-size: 11.5px; color: var(--text-2); background: #e6ebf2; border-radius: 999px; padding: 2px 12px; margin: 14px 0 8px; }
.msg { display: flex; flex-direction: column; max-width: 68%; }
.msg.in { align-self: flex-start; }
.msg.out { align-self: flex-end; align-items: flex-end; }
.bubble { padding: 9px 13px; border-radius: 18px; white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere; font-size: 14px; line-height: 1.45; }
.msg.in .bubble { background: #fff; border: 1px solid var(--line-2); border-bottom-left-radius: 6px; box-shadow: var(--shadow-sm); }
.msg.out .bubble { background: linear-gradient(135deg, #0b63ce, #1576e0); color: #fff; border-bottom-right-radius: 6px; box-shadow: 0 1px 2px rgba(11, 99, 206, .25); }
.msg.out .bubble a { color: #fff; }
.msg.comment.in .bubble { background: #fffaf0; border-color: #fbe3b0; }
.msg.hiddenc .bubble { opacity: .55; text-decoration: line-through; }
.msg img.att { max-width: 260px; max-height: 300px; border-radius: 14px; display: block; cursor: zoom-in; border: 1px solid var(--line); margin-bottom: 2px; }
.att-audio { height: 40px; max-width: 280px; }
.gallery { width: 300px; max-width: 100%; display: flex; flex-direction: column; gap: 2px; border-radius: 16px; overflow: hidden; margin-bottom: 2px; }
.g-row { display: grid; gap: 2px; }
.g-row.g1 { grid-template-columns: 1fr; }
.g-row.g2 { grid-template-columns: 1fr 1fr; }
.g-row.g3 { grid-template-columns: 1fr 1fr 1fr; }
.g-row img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; cursor: zoom-in; background: var(--line); }
.g-row.g1 img { aspect-ratio: 4 / 3; }
.g-row.g2 img { aspect-ratio: 1; }
.msg.out .gallery { align-self: flex-end; }
.msg .file-att { display: inline-block; padding: 8px 12px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.time-sep { align-self: center; font-size: 11px; color: var(--muted); margin: 10px 0 4px; }
.msg-meta { display: none; font-size: 11px; color: var(--muted); margin: 3px 6px 2px; }
.msg-meta b { color: var(--text-2); font-weight: 600; }
.msg.show-meta .msg-meta { display: block; }
.msg .bubble { cursor: pointer; }
.msg + .msg { margin-top: 2px; }
.msg.in + .msg.out, .msg.out + .msg.in { margin-top: 10px; }
.msg-foot { font-size: 11px; color: var(--muted); margin: 3px 4px 6px; display: flex; gap: 8px; align-items: center; }
.msg-foot .fail { color: var(--danger); }
.msg-foot button { border: none; background: none; color: var(--primary); cursor: pointer; font-size: 11px; padding: 0; font-weight: 500; }
.msg-foot button.liked { color: var(--fb); font-weight: 600; }

/* ---------- Ô soạn tin ---------- */
.composer { border-top: 1px solid var(--line); padding: 8px 14px 12px; position: relative; background: #fff; }
.composer-mode { display: flex; gap: 6px; margin-bottom: 8px; }
.composer-mode button { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 3px 11px; font-size: 12.5px; cursor: pointer; }
.composer-mode button.on { background: #fff8e8; border-color: var(--warn); color: #8a5300; font-weight: 500; }
.composer-row { display: flex; gap: 2px; align-items: flex-end; }
.composer textarea { flex: 1; resize: none; min-height: 40px; max-height: 160px; border-radius: 20px; background: var(--soft); border-color: transparent; padding: 9px 14px; margin: 0 6px; line-height: 1.45; }
.composer textarea:focus { background: #fff; }
.quick-tags { display: flex; gap: 5px; margin: 0 0 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 1px; }
.quick-tags::-webkit-scrollbar { display: none; }
.quick-tags:empty { display: none; }
.quick-tags button { flex: none; border: 1px solid color-mix(in srgb, var(--c) 45%, white); background: color-mix(in srgb, var(--c) 8%, white); color: color-mix(in srgb, var(--c) 85%, black); border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 500; cursor: pointer; white-space: nowrap; transition: all .12s; }
.quick-tags button:hover { background: color-mix(in srgb, var(--c) 16%, white); }
.quick-tags button.on { background: var(--c); border-color: var(--c); color: #fff; }
.reply-from { font-size: 11.5px; color: var(--muted); margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.reply-from img { width: 16px; height: 16px; border-radius: 50%; object-fit: cover; }
.preview-img { position: relative; display: inline-block; margin: 0 6px 8px 0; }
.preview-img img { height: 72px; width: 72px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.preview-img button { position: absolute; top: -7px; right: -7px; border-radius: 50%; width: 21px; height: 21px; border: 2px solid #fff; background: #1f2937; color: #fff; cursor: pointer; font-size: 12px; line-height: 1; }
.qr-pop { position: absolute; bottom: 100%; left: 14px; right: 14px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); max-height: 280px; overflow-y: auto; z-index: 5; }
.qr-item { padding: 9px 13px; cursor: pointer; border-bottom: 1px solid var(--line-2); font-size: 13px; }
.qr-item:hover, .qr-item.sel { background: var(--primary-soft); }
.qr-item b { color: var(--primary); margin-right: 6px; }
.qr-item span { color: var(--text-2); }
.window-warn { font-size: 12px; color: #8a5300; background: #fff8e8; border: 1px solid #fbe3b0; padding: 5px 10px; border-radius: 8px; margin-bottom: 8px; }
.voice-menu { position: absolute; right: 60px; bottom: 58px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; display: grid; gap: 2px; width: 280px; z-index: 6; }
.voice-menu button { text-align: left; border: none; background: none; border-radius: 8px; padding: 8px 10px; cursor: pointer; display: grid; gap: 1px; }
.voice-menu button:hover:not(:disabled) { background: var(--primary-soft); }
.voice-menu button:disabled { opacity: .5; cursor: default; }
.voice-menu small { color: var(--muted); font-size: 12px; }
.rec-bar { position: absolute; inset: auto 14px 12px 14px; height: 44px; background: #fff; border: 1px solid #f5c2c2; border-radius: 22px; display: flex; align-items: center; gap: 10px; padding: 0 6px 0 16px; box-shadow: var(--shadow); z-index: 6; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .25; } }
#recTime { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--danger); min-width: 38px; }
.rec-level { flex: 1; height: 6px; background: #f1f4f8; border-radius: 6px; overflow: hidden; }
.rec-level i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #ff8a8a, var(--danger)); transition: width .08s; }

/* ---------- AI ---------- */
.ai-box { background: #f6f3ff; border: 1px solid #e2d9fd; border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; display: grid; gap: 8px; font-size: 13.5px; }
.ai-box.thinking { color: #6d28d9; }
.ai-box.hand { background: #fef3f3; border-color: #f8cfcf; }
.ai-box.err { background: #fff8ee; border-color: #fbe0b8; display: block; }
.ai-box textarea { width: 100%; resize: vertical; background: #fff; }
.ai-head { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.ai-imgs, .thumbs { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.ai-imgs img, .thumbs img { width: 48px; height: 48px; object-fit: cover; border-radius: 7px; border: 1px solid var(--line); }
.thumbs span { font-size: 12px; color: var(--muted); }
.thumbs.edit .preview-img img { width: 72px; height: 72px; }

/* ---------- Thông tin khách ---------- */
.info-pane { width: 320px; flex-shrink: 0; background: var(--panel); border-left: 1px solid var(--line); overflow-y: auto; }
.info-pane:empty { display: none; }
.info-sec { padding: 16px 18px; border-bottom: 1px solid var(--line-2); }
.info-sec h4 { margin: 0 0 11px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.info-top { text-align: center; padding-top: 22px; background: linear-gradient(180deg, var(--primary-soft), #fff); }
.info-top .avatar { margin: 0 auto 10px; box-shadow: 0 0 0 4px #fff, var(--shadow); }
.info-top b { font-size: 16px; font-weight: 600; }
.form-grid { display: grid; gap: 11px; }
.form-grid .two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tag-pick { display: flex; flex-wrap: wrap; gap: 5px; }
.tag-pick button { border: 1.5px solid; border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 500; background: #fff; cursor: pointer; }
.note { background: #fffbeb; border: 1px solid #fcecb3; border-radius: 10px; padding: 8px 11px; margin-top: 8px; font-size: 13px; }
.note .meta { font-size: 11px; color: var(--muted); display: flex; justify-content: space-between; margin-top: 4px; }
.note .meta button { border: none; background: none; color: var(--danger); cursor: pointer; font-size: 11px; }
.rel-conv { display: flex; gap: 9px; align-items: center; padding: 7px 8px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.rel-conv:hover { background: var(--soft); color: var(--primary); }
.fu-box { font-size: 13px; display: grid; gap: 7px; color: var(--text-2); }

/* ---------- Trang (lịch hẹn, báo cáo, cài đặt) ---------- */
.page { overflow-y: auto; padding: 26px 30px; }
.page h2 { margin: 0 0 18px; font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 20px; margin-bottom: 18px; box-shadow: var(--shadow-sm); }
.card h3 { margin: 0 0 12px; font-size: 16px; font-weight: 600; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table th { font-size: 11.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; background: #f8fafc; }
.table tbody tr:hover { background: #fafbfd; }
.table-wrap { overflow-x: auto; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; box-shadow: var(--shadow-sm); }
.kpi .v { font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.kpi .l { color: var(--muted); font-size: 12.5px; }
.bars { display: grid; gap: 7px; }
.bar-row { display: grid; grid-template-columns: 100px 1fr 50px; gap: 10px; align-items: center; font-size: 13px; }
.bar-track { background: #eef2f7; border-radius: 6px; height: 12px; overflow: hidden; display: flex; }
.bar-fill { height: 100%; border-radius: 6px; }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.pill { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 500; background: #eef2f7; }
.pill.facebook { background: #e7f0ff; color: var(--fb); }
.pill.zalo { background: #e5efff; color: var(--zalo); }
.pill.off { background: #fdecec; color: var(--danger); }
.pill.ok { background: #e7f6ee; color: #0b7a45; }
.pill.warn { background: #fff4db; color: #9a5b00; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs button { border: none; background: none; padding: 11px 14px; cursor: pointer; border-bottom: 2px solid transparent; color: var(--text-2); white-space: nowrap; font-weight: 500; }
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--primary); border-color: var(--primary); font-weight: 600; }
.steps { padding-left: 18px; margin: 6px 0; }
.steps li { margin-bottom: 5px; }
.grid4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.task { display: inline-block; font-size: 11px; padding: 0 6px; border-radius: 4px; background: #eef2f7; color: var(--text-2); margin: 2px 3px 0 0; }
.fb-badge { display: inline-block; background: #1877f2; color: #fff; font-size: 10px; font-weight: 700; border-radius: 4px; padding: 0 5px; margin-left: 5px; vertical-align: 1px; }
.user-cell { display: flex; align-items: center; gap: 8px; }
.user-cell img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.page-list { display: grid; gap: 10px; }
.page-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; flex-wrap: wrap; box-shadow: var(--shadow-sm); }
.page-row img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; background: #e2e8f0; }
.page-row .info { flex: 1; min-width: 180px; }
.page-row .info b { display: block; }
.switch { position: relative; display: inline-block; width: 40px; height: 22px; vertical-align: middle; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #cbd5e1; border-radius: 22px; cursor: pointer; transition: .2s; }
.switch span::before { content: ''; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::before { transform: translateX(18px); }

/* Báo cáo */
.rep-filters input[type=date] { padding: 6px 9px; }
.rep-filters select { padding: 6px 9px; max-width: 230px; }
.vchart { display: flex; align-items: flex-end; gap: 3px; height: 200px; padding-top: 6px; overflow-x: auto; }
.vchart.hours { height: 160px; }
.vcol { flex: 1; min-width: 16px; height: 100%; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.vcol .vbars { flex: 1; width: 100%; display: flex; align-items: flex-end; gap: 1px; }
.vcol .vbars i { flex: 1; border-radius: 3px 3px 0 0; min-height: 1px; }
.vcol span { font-size: 10.5px; color: var(--muted); }
.rep-table th, .rep-table td { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rep-table th:first-child, .rep-table td:first-child { text-align: left; position: sticky; left: 0; background: #fff; }
.rep-table thead th:first-child { background: #f8fafc; }
.rep-table tfoot td { font-weight: 700; border-top: 2px solid var(--line); background: #f8fafc; }
.rep-table td.hl { color: var(--ok); font-weight: 700; }
.mini-bar { display: inline-block; width: 60px; height: 7px; background: #eef2f7; border-radius: 4px; overflow: hidden; margin-right: 6px; vertical-align: middle; }
.mini-bar i { display: block; height: 100%; background: var(--primary); }

/* Bám đuổi */
.fu-steps { display: grid; gap: 10px; }
.fu-step { display: grid; grid-template-columns: 150px 1fr 190px 36px; gap: 10px; align-items: start; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--soft); }
.fu-step .fu-h { display: flex; align-items: center; gap: 6px; }
.fu-step .fu-h input { width: 72px; }
.fu-step textarea { width: 100%; }
.fu-line { display: flex; align-items: center; margin: 10px 0 4px; overflow-x: auto; }
.fu-line .pt { background: var(--primary); color: #fff; border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.fu-line .pt.start { background: #64748b; }
.fu-line .pt.bad { background: var(--danger); }
.fu-line .seg { flex: 1; min-width: 20px; height: 2px; background: #cbd5e1; }

/* ---------- Modal, bảng chọn trang, thư viện ảnh ---------- */
.modal { position: fixed; inset: 0; background: rgba(10, 20, 40, .45); backdrop-filter: blur(2px); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal-card { background: #fff; border-radius: 16px; padding: 22px; width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg); }
.modal-card.wide { max-width: 980px; }
.modal-card h3 { margin-top: 0; font-weight: 600; }
.modal-card img.full { max-width: 100%; max-height: 80vh; display: block; margin: auto; border-radius: 8px; }
.picker-top { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.picker-top input { flex: 1; min-width: 180px; }
.picker-sec { font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin: 16px 0 8px; }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.pcard { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 12px; padding: 9px 11px; cursor: pointer; background: #fff; position: relative; transition: all .12s; }
.pcard:hover { border-color: var(--primary); background: #f7faff; }
.pcard.sel { border-color: var(--primary); background: var(--primary-soft); }
.pcard.cur { box-shadow: inset 3px 0 0 var(--primary); }
.pcard input[type=checkbox] { width: 18px; height: 18px; margin: 0; flex-shrink: 0; cursor: pointer; }
.pcard .pinfo { flex: 1; min-width: 0; }
.pcard .pinfo b { display: block; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard .pinfo small { color: var(--muted); font-size: 12px; }
.pcard .ubadge { background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; border-radius: 9px; min-width: 19px; height: 19px; padding: 0 5px; display: grid; place-items: center; }
.pcard .gact { display: flex; gap: 2px; }
.pcard .gact button { border: none; background: none; cursor: pointer; color: var(--muted); padding: 2px 5px; border-radius: 5px; }
.pcard .gact button:hover { background: #eef2f7; color: var(--text); }
.gicon { width: 36px; height: 36px; border-radius: 10px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-weight: 700; flex-shrink: 0; }
.picker-foot { position: sticky; bottom: -22px; background: #fff; border-top: 1px solid var(--line); margin: 16px -22px -22px; padding: 12px 22px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.lib { display: grid; grid-template-columns: 230px 1fr; gap: 16px; min-height: 420px; }
.lib-side { border-right: 1px solid var(--line); padding-right: 12px; display: flex; flex-direction: column; gap: 6px; max-height: 60vh; overflow-y: auto; }
.lib-folder { display: flex; gap: 10px; align-items: center; padding: 7px; border-radius: 10px; cursor: pointer; }
.lib-folder:hover { background: var(--soft); }
.lib-folder.on { background: var(--primary-soft); }
.lib-cover { width: 42px; height: 42px; border-radius: 9px; background: #eef2f7 center/cover; display: grid; place-items: center; flex-shrink: 0; font-size: 20px; }
.lib-fn { min-width: 0; }
.lib-fn b { display: block; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-fn small { color: var(--muted); font-size: 12px; }
.lib-main { min-width: 0; }
.lib-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; max-height: 56vh; overflow-y: auto; }
.lib-item { position: relative; border-radius: 12px; overflow: hidden; border: 2px solid transparent; cursor: pointer; aspect-ratio: 1; background: #f1f5f9; }
.lib-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lib-item.sel { border-color: var(--primary); }
.lib-check { position: absolute; top: 6px; left: 6px; width: 22px; height: 22px; border-radius: 50%; border: 2px solid #fff; background: rgba(0,0,0,.25); color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 700; }
.lib-item.sel .lib-check { background: var(--primary); }
.lib-acts { position: absolute; right: 5px; bottom: 5px; display: none; gap: 4px; }
.lib-item:hover .lib-acts { display: flex; }
.lib-acts button { border: none; border-radius: 6px; background: rgba(15,23,42,.78); color: #fff; font-size: 12px; padding: 3px 8px; cursor: pointer; }
.lib-acts button:hover { background: var(--primary); }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(90px); background: #111827; color: #fff; padding: 11px 18px; border-radius: 12px; transition: transform .25s; z-index: 60; max-width: calc(100% - 32px); box-shadow: var(--shadow-lg); font-size: 13.5px; }
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--danger); }

/* ---------- Màn hình nhỏ ---------- */
@media (max-width: 1280px) { .sel-wrap select { max-width: 120px; } }
@media (max-width: 1200px) { .info-pane { display: none; } .info-pane.open { display: block; position: fixed; right: 0; top: 0; bottom: 0; z-index: 30; box-shadow: var(--shadow-lg); } }
@media (min-width: 1201px) { .info-toggle { display: none; } }
@media (max-width: 1000px) { .head-actions .sel-wrap { display: none; } }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } .fu-step { grid-template-columns: 1fr; } .lib { grid-template-columns: 1fr; } .lib-side { border-right: none; padding-right: 0; max-height: 180px; } .lib-acts { display: flex; } }
@media (max-width: 800px) {
  .app { flex-direction: column-reverse; }
  .rail { width: 100%; flex-direction: row; justify-content: space-around; padding: 4px; height: 60px; }
  .rail-logo, .rail-spacer { display: none; }
  .rail a { width: auto; flex: 1; }
  .rail a.on::before { left: 20%; right: 20%; top: -4px; bottom: auto; width: auto; height: 3px; }
  .rail-me { width: 34px; height: 34px; }
  .view { min-height: 0; }
  .list-pane { width: 100%; }
  .inbox.chatting .list-pane { display: none; }
  .inbox:not(.chatting) .chat-pane { display: none; }
  .icon-btn.back-btn { display: grid; }
  .msg { max-width: 86%; }
  .page { padding: 16px; }
  .info-pane.open { width: 100%; }
  .head-actions .chip-btn.ai-on, .head-actions #aiToggle { display: none; }
  .composer-row .icon-btn:not(.send):not(.mic) { width: 32px; }
}
.chat-head .who { min-width: 150px; }
.sel-wrap select { max-width: 150px; }
.branch-sel { justify-content: center; margin-top: 10px; }
.branch-sel select { max-width: 220px; background: #fff; }
@media (max-width: 800px) { #libBtn, #qrBtn { display: none; } .composer textarea { margin: 0 4px; } }

.qr-manage { padding: 9px 12px; border-top: 1px solid var(--line); color: var(--primary); font-weight: 600; font-size: 13px; cursor: pointer; }
.qr-manage:hover { background: var(--primary-soft); }
.lib-sec { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 12px 4px 4px; }
label.check { display: flex; gap: 8px; align-items: center; font-size: 14px; }

.ai-logo { width: 18px; height: 18px; border-radius: 5px; object-fit: contain; vertical-align: -4px; background: #fff; }
.ai-btn .ai-logo { width: 22px; height: 22px; }
.ai-ic .ai-logo { width: 13px; height: 13px; vertical-align: -2px; }
.msg.by-ai { position: relative; }
.ai-mark { position: absolute; right: -26px; bottom: 6px; }
.ai-mark .ai-logo { width: 20px; height: 20px; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,.18); }
.ctx-bar { display: flex; align-items: center; gap: 10px; padding: 8px 16px; background: #fff8ec; border-bottom: 1px solid #f5e1bd; cursor: pointer; }
.ctx-bar img { width: 46px; height: 46px; object-fit: cover; border-radius: 8px; cursor: zoom-in; flex-shrink: 0; }
.ctx-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.ctx-post { color: var(--text-2); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; white-space: pre-line; }
.ctx-bar.open .ctx-post { -webkit-line-clamp: unset; }
.ctx-bar.open img { width: 120px; height: 120px; }
.qr-foot { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--line); }
.qr-foot .qr-manage { border-top: none; }
.qr-auto { display: flex; gap: 6px; align-items: center; padding: 9px 12px; font-size: 13px; cursor: pointer; }
.ai-report { border: 1px solid #c7d7f5; background: linear-gradient(180deg, #f5f9ff, #fff); }
.ai-report-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.ai-report-head .ai-logo { width: 28px; height: 28px; }
.md h4 { margin: 14px 0 6px; color: var(--primary); font-size: 15px; }
.md ul { margin: 4px 0 8px; padding-left: 20px; } .md li { margin: 3px 0; line-height: 1.55; } .md p { margin: 4px 0; line-height: 1.6; }

.list-sep { padding: 6px 14px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: #f6f7f9; border-top: 1px solid var(--line); }
.ai-connect { border: 1px solid #c7d7f5; }
.prov-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 6px 0 12px; }
.prov { position: relative; border: 2px solid var(--line); border-radius: 12px; padding: 12px 14px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.prov input { position: absolute; opacity: 0; }
.prov b { font-size: 15px; } .prov small { color: var(--muted); }
.prov i { position: absolute; right: 12px; top: 12px; font-style: normal; font-size: 12px; color: var(--ok); font-weight: 600; }
.prov.on { border-color: var(--primary); background: var(--primary-soft); }
.prov-box { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.prov-box label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 500; }
.steps { margin: 0; padding-left: 20px; font-size: 13.5px; line-height: 1.7; }
.ok-text { color: var(--ok); font-weight: 500; }
.prov-box[hidden] { display: none; }

.avatar.xs { width: 28px; height: 28px; font-size: 11px; }
.msg.in:not(.comment) { position: relative; }
.messages { padding-left: 54px; }
.msg-av { position: absolute; left: -38px; bottom: 2px; cursor: default; }
.ad-card-wrap { display: flex; justify-content: flex-end; margin: 6px 0; }
.ad-card { width: 300px; max-width: 80%; background: #fffbe6; border: 1px solid #f3e3a1; border-radius: 16px; overflow: hidden; display: flex; flex-direction: column; }
.ad-card-lbl { font-size: 11.5px; font-weight: 600; color: #8a6d00; padding: 7px 12px 5px; }
.ad-card img { width: 100%; max-height: 220px; object-fit: cover; cursor: zoom-in; display: block; }
.ad-card-txt { padding: 8px 12px 4px; font-size: 13px; display: flex; flex-direction: column; gap: 3px; }
.ad-card-txt span { color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.ad-card a { padding: 4px 12px 10px; font-size: 12.5px; font-weight: 600; }
.share-card { display: flex; flex-direction: column; gap: 2px; max-width: 280px; padding: 10px 12px; background: #fffbe6; border: 1px solid #f3e3a1; border-radius: 14px; color: var(--text); text-decoration: none; font-size: 13px; margin-bottom: 2px; }
.share-card span { color: var(--text-2); } .share-card small { color: var(--primary); font-weight: 600; }
.ctx-bar img { width: 34px; height: 34px; }
.ctx-post.one { -webkit-line-clamp: 1; }

.ai-ask { position: absolute; left: 12px; right: 12px; bottom: calc(100% + 6px); background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 10px 30px rgba(15,23,42,.18); padding: 12px; display: flex; flex-direction: column; gap: 8px; z-index: 20; }
.ai-ask-head { display: flex; align-items: center; gap: 8px; }
.ai-ask input { width: 100%; }
.ai-ask-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ai-ask-chips button { border: 1px solid #c7d7f5; background: var(--primary-soft); color: var(--primary); border-radius: 999px; padding: 4px 10px; font-size: 12.5px; cursor: pointer; }
.ai-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px; background: #f5f9ff; border: 1px dashed #c7d7f5; border-radius: 10px; }
.sim { height: 340px; overflow-y: auto; background: #f4f6fa; border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 8px; margin: 8px 0; }
.sim-empty { margin: auto; text-align: center; }
.sim-msg { display: flex; gap: 6px; align-items: flex-end; max-width: 80%; }
.sim-msg.customer { align-self: flex-start; } .sim-msg.shop { align-self: flex-end; flex-direction: row-reverse; }
.sim-b { padding: 8px 12px; border-radius: 16px; background: #fff; white-space: pre-wrap; font-size: 14px; }
.sim-msg.shop .sim-b { background: var(--primary); color: #fff; }
.sim-b small { display: block; opacity: .8; font-size: 11.5px; margin-top: 4px; }
.sim-input { display: flex; gap: 8px; } .sim-input input { flex: 1; }

.ch-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; max-height: 240px; overflow-y: auto; padding: 8px; border: 1px solid var(--line); border-radius: 10px; }
.ch-pick label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text); }
.ch-pick input { width: auto; margin: 0; }

.locked { opacity: .75; }
.lock-note { background: #fff7e6; border: 1px solid #f5d9a8; color: #8a5a00; border-radius: 10px; padding: 8px 12px; font-size: 13px; margin-bottom: 10px; }

.ch-lbl { display: inline-flex; align-items: center; gap: 8px; }
.ch-lbl img, .ch-ph { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; flex-shrink: 0; box-shadow: 0 0 0 1px var(--line); }
.ch-ph { display: grid; place-items: center; font-style: normal; font-weight: 700; color: #fff; background: #1877f2; font-size: 13px; }
.ch-ph.zalo { background: #0068ff; }
