@import url("fonts.css");
/* Giao diện Lead Finder: thanh trên 4 mục, nền trắng xanh nhạt, màu chính xanh dương, xanh lá cho trạng thái tốt. Không cần bước build. */
:root {
  /* Bộ nhận diện chung web + app (app: app/leadfinder/ui/theme.py). Chữ phụ --muted đủ tương phản 4.5:1 trên nền trắng. */
  --font: "Be Vietnam Pro", "Segoe UI", system-ui, -apple-system, sans-serif;
  --bg: #f6f7f9; --card: #ffffff; --line: #e5e7eb; --text: #0f172a; --ink-2: #334155; --muted: #475569; --hover: #eef2f7; --hot: #2563eb;
  --primary: #2563eb; --primary-dark: #1d4ed8; --primary-soft: #e8efff;
  --ok: #15803d; --ok-dot: #16a34a; --ok-soft: #ecfdf3; --warn: #b45309; --warn-soft: #fff7ed; --danger: #b91c1c; --danger-soft: #fef2f2;
  --todo: #c2410c;
  --info: #2563eb; --info-soft: #e8efff; --violet: #7c3aed; --violet-soft: #f1ebfe; --gray: #475569; --gray-soft: #eef2f7;
  --radius: 12px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: var(--font); font-size: 14.5px; color: var(--text);
  background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--primary-dark); text-decoration: none; }
.main p a, .main td a, .main li a, .main .hint a, .main .muted a, .alert a { text-decoration: underline; text-underline-offset: 2px; text-decoration-color: #a9c1f5; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
svg.i { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }

.flash-row { padding: 10px 24px 0; }
.flash-row .alert { margin-bottom: 0; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 14px; flex: none;
  background: var(--primary-soft); color: var(--primary-dark); }
.icon-btn { background: none; border: 0; padding: 6px; border-radius: 8px; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--gray-soft); color: var(--text); }
.main { padding: 26px 28px 40px; width: 100%; max-width: 1600px; margin: 0 auto; }
.page-head { margin-bottom: 18px; }

/* ---------- Khung: thanh bên trái theo thứ tự công việc (kế hoạch giao diện, bước 1) ---------- */
.shell { display: flex; min-height: 100vh; }
.side { width: 248px; flex: none; background: var(--card); border-right: 1px solid var(--line); padding: 16px 12px 12px; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; z-index: 30; }
.page { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mark { display: flex; align-items: center; gap: 10px; padding: 4px 10px 14px; font-weight: 700; font-size: 16px; color: var(--text); white-space: nowrap; }
.mark:hover { text-decoration: none; color: var(--text); }
.mark img { width: 32px; height: 32px; border-radius: 50%; flex: none; } /* logo Vietconnectasia (app/dong-goi/make_icon.py) */
.auth-logo { display: block; width: 64px; height: 64px; margin: 0 0 10px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; min-height: 0; overflow-y: auto; }
.side-grp { font-size: 11.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding: 14px 12px 6px; }
.side-nav a { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 8px; color: var(--ink-2); font-weight: 500; }
.side-nav a:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.side-nav a.on { background: var(--primary-soft); color: var(--primary-dark); font-weight: 600; }
.side-nav svg.i { width: 18px; height: 18px; }
.side-nav .n { margin-left: auto; background: var(--primary); color: #fff; font-size: 11.5px; font-weight: 700; border-radius: 99px; padding: 1px 7px; }
.side-gap { flex: 1; min-height: 20px; }
.side-foot { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.side-foot .auto summary { display: flex; width: 100%; }
.side-foot .auto-pop { left: 0; right: auto; top: auto; bottom: calc(100% + 8px); max-height: calc(100vh - 120px); overflow-y: auto; }
.machine { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; font-size: 13px; color: var(--ink-2); min-width: 0; }
.machine:hover { background: var(--hover); text-decoration: none; color: var(--text); }
.machine-text { min-width: 0; }
.machine-text b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.machine-text small { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.machine .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: #94a3b8; }
.machine.tone-ok .dot { background: var(--ok-dot); box-shadow: 0 0 0 3px rgba(22, 163, 74, .18); }
.machine.tone-warn .dot { background: #d97706; }
.machine.tone-bad .dot { background: var(--todo); }
.me-menu { position: relative; }
.me-menu summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; }
.me-menu summary::-webkit-details-marker { display: none; }
.me-menu summary:hover { background: var(--hover); }
.me { width: 30px; height: 30px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 600; flex: none; }
.me-name { min-width: 0; font-size: 13px; }
.me-name b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-name small { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-pop { position: absolute; left: 0; bottom: calc(100% + 8px); width: 240px; background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .1); padding: 6px; z-index: 40; }
.me-who { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.me-who b { display: block; }
.me-who span { color: var(--muted); font-size: 12.5px; }
.me-pop button { display: flex; align-items: center; gap: 9px; width: 100%; text-align: left; padding: 8px 10px; border-radius: 8px; color: var(--ink-2);
  background: none; border: 0; font: inherit; cursor: pointer; }
.me-pop button:hover { background: var(--hover); color: var(--text); }
.me-pop svg.i { width: 16px; height: 16px; color: var(--muted); }
.me-pop form { margin: 0; }
.mtop, .side-scrim { display: none; }
@media (max-width: 900px) {
  .side { position: fixed; left: 0; top: 0; bottom: 0; height: auto; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 12px 32px rgba(0, 0, 0, .18); }
  body.nav-open .side { transform: none; }
  body.nav-open .side-scrim { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, .35); z-index: 25; }
  .mtop { display: flex; align-items: center; gap: 8px; height: 56px; padding: 0 12px; background: var(--card); border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 20; }
  .mtop .mark { padding: 0; }
  .mtop .machine { margin-left: auto; padding: 10px; }
  .side-foot .auto-pop { position: fixed; top: auto; bottom: 12px; left: 12px; right: 12px; width: auto; }
}

/* Thẻ, lưới */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.stat .num { font-size: 28px; font-weight: 700; }
.stat .label { color: var(--muted); }

/* Bảng */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #f6f9fd; font-weight: 600; font-size: 14px; }
.tag { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; white-space: nowrap; background: var(--gray-soft); color: var(--gray); }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.off { background: var(--danger-soft); color: var(--danger); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.info { background: var(--info-soft); color: var(--info); }

/* Biểu mẫu */
label { display: block; font-weight: 600; margin: 12px 0 4px; }
.hint { font-weight: 400; color: var(--muted); font-size: 13px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=datetime-local], input[type=time], textarea, select {
  width: 100%; padding: 9px 11px; border: 1px solid #d6dfec; border-radius: 8px; font: inherit; background: #fff;
}
input:focus, textarea:focus, select:focus { outline: 2px solid #dbe7ff; border-color: #2563eb; }
textarea { min-height: 70px; resize: vertical; }
.row { display: grid; gap: 0 16px; grid-template-columns: 1fr 1fr; }
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 8px 16px; border: 1px solid #d6dfec; border-radius: 8px; background: #fff;
  color: var(--text); font: inherit; font-weight: 600; font-size: 14.5px; cursor: pointer; }
.btn:hover { background: var(--gray-soft); text-decoration: none; }
.main a.btn { text-decoration: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.danger { color: var(--danger); border-color: #f5b99f; }
.inline { display: inline; }
.actions { margin-top: 16px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* Thông báo */
.alert { padding: 11px 14px; border-radius: 10px; margin-bottom: 14px; }
.alert.ok { background: var(--ok-soft); color: var(--ok); border: 1px solid #b6e3c4; }
.alert.err { background: var(--danger-soft); color: var(--danger); border: 1px solid #f5c8b4; }
.alert.warn { background: var(--warn-soft); color: var(--warn); border: 1px solid #f3dca5; }
.keybox { font-family: Consolas, monospace; font-size: 15px; padding: 10px 12px; background: #f6f9fd; border: 1px dashed #9ca3af; border-radius: 8px; word-break: break-all; user-select: all; }

/* Danh sách việc cần làm */
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.checklist .mark { display: inline-block; width: 22px; }

/* Trang đăng nhập */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.auth-card { width: 380px; max-width: 100%; }

@media (max-width: 760px) {
  .main { padding: 18px 16px 40px; }
  .flash-row { padding: 10px 16px 0; }
  .row { grid-template-columns: 1fr; }
}

/* Tab nhanh, bộ lọc (trang Khách tiềm năng, Bài viết) */
.tabs { display: flex; gap: 4px; margin-bottom: 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tabs a { padding: 8px 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { text-decoration: none; color: var(--text); }
.tabs a.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.tabs .count { font-size: 12px; background: var(--gray-soft); border-radius: 10px; padding: 1px 7px; margin-left: 4px; color: var(--muted); }
.filters .actions { margin-top: 12px; }
.filter-search { display: flex; gap: 8px; }
.filter-search .w-auto { width: auto; max-width: 320px; }
.filter-grid { display: grid; gap: 8px; margin-top: 10px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.table-card { padding: 0; overflow-x: auto; }
.table-card table { min-width: 860px; }
.table-card .pager, .table-card .empty { padding: 14px 16px; }
.empty { color: var(--muted); }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; }
.btn.disabled { color: #9ca3af; cursor: default; }
.btn.disabled:hover { background: #fff; }
.small-btn { padding: 4px 10px; font-size: 13px; margin-top: 4px; }
td.need { min-width: 190px; max-width: 320px; }
td.service { min-width: 110px; }
td.num, .reasons .num { text-align: right; }
.nowrap { white-space: nowrap; }
tr.dim td { opacity: .55; }
.score { display: inline-block; min-width: 36px; text-align: center; padding: 3px 6px; border-radius: 8px; font-weight: 700; background: var(--gray-soft); color: var(--gray); }
.score.mid { background: var(--warn-soft); color: var(--warn); }
.score.hi { background: var(--ok-soft); color: var(--ok); }
.score.big { font-size: 26px; min-width: 64px; padding: 8px; }
.tag.status-moi { background: var(--primary-soft); color: var(--primary); }
.tag.status-da_lien_he { background: var(--ok-soft); color: var(--ok); }
.tag.ai-xong { background: var(--ok-soft); color: var(--ok); }
.tag.ai-can_thu_lai { background: var(--warn-soft); color: var(--warn); }
.post-text { max-width: 420px; }
.post-text summary { cursor: pointer; }
.post-text .full, blockquote { white-space: pre-wrap; }

/* Chi tiết khách */
.detail-grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); }
.score-head { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.reasons td, .facts th, .facts td { padding: 6px 4px; }
.facts th { background: none; color: var(--muted); font-weight: 400; width: 45%; }
.signal { border-top: 1px solid var(--line); padding: 14px 0; }
.signal:first-of-type { border-top: 0; padding-top: 0; }
blockquote { margin: 8px 0; padding: 10px 14px; background: #f9fafb; border-left: 3px solid #d1d5db; border-radius: 4px; }
.ai-box { padding: 10px 14px; background: var(--primary-soft); border-radius: 6px; }
.ai-box .tag { background: #fff; margin: 4px 4px 0 0; }
.signal .actions { margin-top: 10px; }

@media (max-width: 900px) {
  .detail-grid { grid-template-columns: 1fr; }
  .filter-search { flex-wrap: wrap; }
}
.push-right { margin-left: auto; }

/* Kiểm tra AI */
.progress-line { margin-bottom: 8px; }
.bar { height: 8px; background: var(--gray-soft); border-radius: 4px; overflow: hidden; }
.bar span { display: block; height: 100%; background: #2563eb; }
.choices { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.choice { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; margin: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
.choice:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.choice input { margin-top: 3px; }
blockquote.parent { color: var(--muted); font-size: 14px; }
.table-scroll { overflow-x: auto; }
.matrix th, .matrix td { text-align: center; font-size: 14px; }
.matrix td.hit { background: var(--ok-soft); color: var(--ok); font-weight: 600; }
.matrix td.miss { background: var(--danger-soft); color: var(--danger); }

/* Tìm khách bằng AI */
.templates { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; }
.chip { font: inherit; font-size: 13px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 14px; background: #fff; cursor: pointer; }
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.searching { display: flex; gap: 12px; align-items: center; }
.spinner { width: 16px; height: 16px; border: 2px solid var(--primary-soft); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.edit-filters summary { cursor: pointer; color: var(--primary); }
.checks { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.checks.scroll { max-height: 150px; overflow-y: auto; border: 1px solid var(--line); border-radius: 6px; padding: 8px; }
.check { font-weight: 400; margin: 0; display: inline-flex; flex-wrap: wrap; gap: 5px; align-items: center; min-width: 0; }
.check .tag { white-space: normal; }
tr.current td { background: var(--primary-soft); }
.table-card table.compact { min-width: 0; }

/* Báo cáo */
.stat .up { color: var(--ok); }
.stat .down { color: var(--danger); }
.vbars { display: flex; align-items: flex-end; gap: 3px; height: 170px; overflow-x: auto; padding-top: 4px; }
.vbar { flex: 1 0 8px; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; }
.vbar .fill { width: 70%; min-height: 2px; background: #2563eb; border-radius: 3px 3px 0 0; }
.vbar .v { font-size: 11px; color: var(--muted); }
.vbar .d { font-size: 10px; color: var(--muted); margin-top: 3px; white-space: nowrap; height: 13px; overflow: visible; }
.hbar { flex: 1; height: 10px; background: var(--gray-soft); border-radius: 5px; overflow: hidden; }
.hbar span { display: block; height: 100%; background: #2563eb; }
.hrow { display: flex; align-items: center; gap: 10px; padding: 5px 0; }
.hrow .lbl { width: 45%; font-size: 14px; }
.hrow .n { min-width: 28px; text-align: right; font-weight: 600; }
th.bar-col { width: 30%; }
ol.steps li { margin-bottom: 8px; }
.inline-code { display: inline-block; padding: 2px 8px; font-size: 14px; }

/* Thu thập tự động */
.device { padding: 8px 0; border-top: 1px solid var(--line); }
.device:first-of-type { border-top: 0; }
.device table { margin-top: 6px; }
.group-tools { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.group-tools input { flex: 1; min-width: 200px; }
.checks.scroll.tall { max-height: 300px; display: block; }
.checks.tall .check { display: flex; padding: 3px 0; }
.err-text { color: var(--danger); }
/* Thu thập tự động: xem trước cách chia nhóm, từng nick trong một đợt */
.preview { margin-top: 8px; line-height: 1.6; }
.preview .alert { margin: 6px 0 0; }
.nick-line { padding: 3px 0; }
.nick-line + .nick-line { border-top: 1px dashed var(--line); }
#account-list { flex-direction: column; }
/* Tin nhắn cho khách (trang chi tiết khách) */
.msg-box + .msg-box { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 10px; }
.msg-text { white-space: pre-wrap; background: var(--bg, #f6f7f9); padding: 8px 10px; border-radius: 6px; }

/* Biểu tượng trong ô màu, nhãn có biểu tượng (dùng chung) */
.ico { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.ico svg.i { width: 22px; height: 22px; }
.ico.sm { width: 36px; height: 36px; border-radius: 10px; }
.ico.sm svg.i { width: 18px; height: 18px; }
.t-info { background: var(--info-soft); color: var(--info); }
.t-warn { background: var(--warn-soft); color: var(--warn); }
.t-ok { background: var(--ok-soft); color: var(--ok); }
.t-off { background: var(--danger-soft); color: var(--danger); }
.t-violet { background: var(--violet-soft); color: var(--violet); }
.t-teal { background: var(--primary-soft); color: var(--primary-dark); }
.tag svg.i { width: 13px; height: 13px; stroke-width: 2.2; margin: -2px 4px 0 0; }
.card.flush { padding: 0; }
.card-h { display: flex; align-items: center; gap: 10px; padding: 15px 20px; border-bottom: 1px solid var(--line); }
.card-h h2 { margin: 0; font-size: 16px; }
.more { margin-left: auto; color: var(--primary-dark); font-size: 13.5px; font-weight: 600; white-space: nowrap; }
.pad { padding: 16px 20px; }
.grow { flex: 1; min-width: 0; }

/* Ô số liệu, hàng khách, việc cần làm (Báo cáo, bảng khách) */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 18px; }
.stat-tile { display: flex; gap: 14px; align-items: flex-start; margin: 0; color: var(--text); }
a.stat-tile:hover { text-decoration: none; border-color: #a9c1f5; }
.stat-tile .num { font-size: 28px; font-weight: 700; line-height: 1.1; }
.stat-tile .label { color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.trend { font-size: 12.5px; margin-top: 6px; font-weight: 600; }
.trend.up { color: var(--ok); } .trend.down { color: var(--danger); } .trend.warn { color: var(--warn); } .trend.muted { color: var(--muted); font-weight: 400; }
.lead-row { display: flex; gap: 14px; padding: 14px 20px; border-bottom: 1px solid var(--line); align-items: center; color: var(--text); }
.lead-row:last-child { border-bottom: 0; }
.lead-row:hover { background: #f6f9fd; text-decoration: none; }
.lead-row .body { flex: 1; min-width: 0; }
.lead-row .name { font-weight: 600; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.lead-row .need { color: var(--muted); font-size: 13.5px; margin-top: 3px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.lead-row .meta { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }
.lead-row .time { color: var(--muted); font-size: 12.5px; }
.lead-row .score { font-size: 15px; padding: 4px 8px; }
.avatar.gray { background: var(--gray-soft); color: var(--gray); }
.todo { display: flex; gap: 12px; padding: 13px 20px; border-bottom: 1px solid var(--line); align-items: center; }
.todo:last-child { border-bottom: 0; }
.todo .txt { flex: 1; font-size: 14px; min-width: 0; }
.todo .txt small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.todo .btn { margin: 0; }
.machines { padding: 14px 20px; display: grid; gap: 12px; }
.mrow { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.mrow.nick { padding-left: 22px; }
.mrow .bar { height: 5px; margin-top: 5px; max-width: 220px; }

@media (max-width: 1000px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .stat-grid { gap: 10px; }
  .stat-tile { flex-direction: column; gap: 10px; padding: 14px; }
  .stat-tile .num { font-size: 24px; }
  .lead-row { padding: 12px 14px; align-items: flex-start; }
  .lead-row .avatar { display: none; }
  .todo, .card-h, .machines { padding-left: 14px; padding-right: 14px; }
  .mrow.nick { padding-left: 0; }
}

/* Danh sách khách tiềm năng: mỗi khách một hàng gọn (không bảng tràn ngang) */
.filter-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.more-filters { margin-top: 10px; }
.more-filters summary { cursor: pointer; color: var(--primary-dark); font-weight: 600; font-size: 14px; }
.lead-list .lead-row { align-items: flex-start; }
.lead-row .name a { color: var(--text); }
.lead-row .name a:hover { color: var(--primary-dark); }
.lead-row.dim { opacity: .55; }
.facts-line { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.facts-line a { font-weight: 600; }
.card.flush .pager { padding: 14px 16px; }

@media (max-width: 760px) {
  .filter-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
}

/* Chi tiết khách: cột phải rộng hơn, khối tin nhắn có nút gửi to, nút phụ dạng chữ */
@media (min-width: 901px) {
  .detail-grid { grid-template-columns: minmax(0, 1.5fr) minmax(320px, 1fr); }
}
.msg-box { padding: 2px 0; }
.msg-actions { margin-top: 12px; display: grid; gap: 8px; }
.btn.wide { width: 100%; justify-content: center; padding: 10px 16px; }
.msg-secondary { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }
.link-btn { background: none; border: 0; padding: 4px 2px; font: inherit; font-size: 13.5px; font-weight: 600; color: var(--primary-dark); cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px; }
.link-btn svg.i { width: 15px; height: 15px; }
.link-btn.muted { color: var(--muted); }
.link-btn:hover { text-decoration: underline; }
.score-bar { height: 6px; margin: 6px 0; max-width: 260px; }
.score-bar.hi span { background: var(--ok); }
.score-bar.mid span { background: var(--warn); }
.score-bar:not(.hi):not(.mid) span { background: var(--gray); }

/* Cài đặt chia thẻ; phần tùy chỉnh nâng cao thu gọn */
.card[hidden] { display: none; }
.advanced { margin: 14px 0 6px; padding: 10px 14px; border: 1px dashed var(--line); border-radius: 10px; background: #f6f9fd; }
.advanced summary { cursor: pointer; font-weight: 600; color: var(--primary-dark); }
.advanced[open] summary { margin-bottom: 4px; }

/* Thu thập tự động: chọn việc bằng thẻ lớn có biểu tượng */
.type-cards { display: grid; gap: 8px; }
.type-card { display: flex; gap: 12px; align-items: center; margin: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  cursor: pointer; font-weight: 400; background: #fff; }
.type-card:hover { border-color: #b9d3d1; }
.type-card:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 1px var(--primary); }
.type-card input { position: absolute; opacity: 0; pointer-events: none; }
.type-card strong { display: block; }
.type-card small { color: var(--muted); font-size: 12.5px; }
.mt { margin-top: 16px; }
.stat-tile .small { font-size: 12.5px; margin-top: 4px; }
.post-actions { min-width: 96px; font-size: 13px; }
.post-actions form { margin-top: 4px; }
td.post-text { max-width: 360px; }

/* ---------- Hộp khách: danh sách bên trái, chi tiết bên phải (điện thoại: một cột) ---------- */
svg.ch { width: 16px; height: 16px; flex: none; vertical-align: -3px; }
body.bare .page { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.inbox { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.ib-bar { display: flex; align-items: center; gap: 10px; padding: 12px 24px; flex-wrap: wrap; }
.inbox .seg { display: flex; gap: 2px; padding: 3px; background: var(--hover); border-radius: 9px; }
.inbox .seg a { padding: 6px 12px; border-radius: 7px; color: var(--ink-2); font-weight: 500; white-space: nowrap; }
.inbox .seg a:hover { text-decoration: none; color: var(--text); }
.inbox .seg a.on { background: var(--card); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .06); }
.inbox .seg .c { color: var(--muted); margin-left: 5px; font-weight: 400; }
.ib-pick { position: relative; }
.ib-pick summary { list-style: none; border: 1px solid var(--line); background: var(--card); border-radius: 9px; padding: 6px 10px 6px 12px; cursor: pointer;
  display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; max-width: 320px; }
.ib-pick summary::-webkit-details-marker { display: none; }
.ib-pick summary b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.ib-pick summary svg.i { width: 16px; height: 16px; color: var(--muted); }
.ib-pick.active summary { border-color: var(--primary); }
.ib-menu { position: absolute; top: calc(100% + 6px); left: 0; z-index: 25; width: 340px; background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: 0 12px 32px rgba(0, 0, 0, .1); padding: 8px; }
.ib-menu input { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; margin-bottom: 6px; }
.ib-menu .opts { max-height: 320px; overflow-y: auto; }
.ib-menu .opt { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 7px; color: var(--text); }
.ib-menu .opt[hidden] { display: none; }
.ib-menu .opt:hover { background: var(--hover); text-decoration: none; }
.ib-menu .opt.on { font-weight: 600; }
.ib-menu .opt .on-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ib-menu .opt .k { margin-left: auto; color: var(--muted); font-size: 12.5px; white-space: nowrap; padding-left: 10px; font-weight: 400; }
.ib-menu .opt .k.hot { color: var(--hot); font-weight: 600; }
.ib-menu .hint { font-size: 12px; color: var(--muted); padding: 8px 8px 2px; border-top: 1px solid var(--line); margin-top: 6px; }
.ib-menu .hint a { color: var(--ink-2); text-decoration: underline; }
.inbox .ib-table { margin-left: auto; }
.inbox .week { padding-left: 12px; border-left: 1px solid var(--line); color: var(--muted); font-size: 13px; white-space: nowrap; }
.inbox .week b { color: var(--ink-2); font-weight: 600; }

.ib-bulk { display: flex; align-items: center; gap: 10px; padding: 8px 24px; background: var(--primary-dark); color: #fff; }
.ib-bulk[hidden] { display: none; }
.ib-bulk button { background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .2); color: #fff; padding: 5px 12px; border-radius: 8px;
  cursor: pointer; font: inherit; }
.ib-bulk button.del { background: #b4361a; border-color: #b4361a; }
.ib-bulk .x { margin-left: auto; background: none; border: 0; }
.ib-toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; transition: .2s; background: var(--text); color: #fff;
  padding: 11px 16px; border-radius: 10px; display: flex; gap: 16px; align-items: center; font-size: 14px; z-index: 40; pointer-events: none;
  max-width: calc(100vw - 32px); }
.ib-toast.on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.ib-toast button { background: none; border: 0; color: #a9c1f5; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.ib-toast button[hidden] { display: none; }
.ib-work { flex: 1; min-height: 0; display: grid; grid-template-columns: 420px 1fr; border-top: 1px solid var(--line); }
.ib-list { overflow-y: auto; border-right: 1px solid var(--line); }
.ib-item { display: grid; grid-template-columns: 18px 1fr; gap: 0 8px; padding: 12px 18px 12px 10px; border-bottom: 1px solid var(--line); position: relative; }
.ib-item:hover { background: var(--hover); }
.ib-item .lead-col { display: grid; place-items: center; height: 20px; }
.ib-item .ck { display: none; width: 15px; height: 15px; margin: 0; accent-color: var(--primary); cursor: pointer; }
.ib-item:hover .ck, body.bulking .ib-item .ck { display: block; }
.ib-item:hover .u, body.bulking .ib-item .u { display: none; }
.ib-item a.body { display: grid; grid-template-columns: 1fr auto; gap: 3px 10px; color: var(--text); min-width: 0; }
.ib-item a.body:hover { text-decoration: none; }
.ib-item.sel { background: var(--card); }
.ib-item.sel::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--primary); }
.ib-item .u { width: 7px; height: 7px; border-radius: 50%; }
.ib-item.unread .u { background: var(--hot); }
.ib-item .nm { font-weight: 500; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 6px; }
.ib-item.unread .nm { font-weight: 600; color: var(--text); }
.ib-item .t { justify-self: end; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.ib-item .t.hot { color: var(--hot); font-weight: 600; }
.ib-item .need { grid-column: 1 / 3; }
.ib-item .need { color: var(--ink-2); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ib-item .src { min-width: 0; font-size: 12.5px; color: var(--muted); display: flex; gap: 6px; align-items: center; white-space: nowrap; overflow: hidden; }
.ib-item .src .grp { overflow: hidden; text-overflow: ellipsis; }
.ib-item .st { font-size: 12.5px; color: var(--muted); display: flex; gap: 8px; align-items: center; justify-content: flex-end; white-space: nowrap; }
.ib-item .st span { display: inline-flex; gap: 5px; align-items: center; }
.ib-item .st .chs { gap: 3px; }
.ib-item.done { opacity: .6; }
.inbox .kind { font-size: 11.5px; font-weight: 600; color: var(--ink-2); background: var(--hover); border-radius: 5px; padding: 1px 6px; }
.s-ok { color: #2f7d4f; } .s-warn { color: #a8701a; } .s-bad { color: #b4361a; }
.ib-more { display: flex; justify-content: space-between; gap: 10px; padding: 14px 18px; font-size: 13.5px; }
.ib-more a { color: var(--ink-2); font-weight: 500; }

.ib-detail { overflow-y: auto; background: var(--card); }
.ib-detail .d-in { max-width: 1320px; margin: 0 auto; padding: 26px 40px 60px; }
.ib-detail .back { display: none; }
.ib-detail .d-head { display: flex; align-items: flex-start; gap: 16px; }
.ib-detail h1 { margin: 0; font-size: 22px; letter-spacing: -.01em; }
.ib-detail .d-meta { color: var(--muted); font-size: 13.5px; margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; }
.ib-detail .d-meta .hot { color: var(--hot); font-weight: 600; }
.ib-detail .d-score { margin-left: auto; text-align: right; }
.ib-detail .d-score b { font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.ib-detail .d-score b.hot { color: var(--hot); }
.ib-detail .d-score div { font-size: 12.5px; color: var(--muted); }
.ib-detail .links { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.ib-detail .lk { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px;
  color: var(--ink-2); background: var(--card); }
.ib-detail a.lk:hover { background: var(--hover); text-decoration: none; }
.ib-detail .sec { margin-top: 26px; }
.ib-detail .sec h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; margin: 0 0 8px; }
.ib-detail .parent { font-size: 13.5px; color: var(--muted); border-left: 2px solid var(--line); padding-left: 16px; margin-bottom: 10px; }
.ib-detail .parent b { color: var(--ink-2); font-weight: 600; }
.ib-detail .quote { font-size: 15.5px; line-height: 1.6; white-space: pre-wrap; border-left: 2px solid var(--primary); padding-left: 16px; overflow-wrap: anywhere; }
.ib-detail .ai { color: var(--ink-2); line-height: 1.6; }
.ib-detail .why { margin: 8px 0 0; padding: 0; list-style: none; color: var(--muted); font-size: 13px; display: flex; flex-wrap: wrap; gap: 4px 16px; }
.ib-detail .why li::before { content: "+"; margin-right: 4px; color: var(--ink-2); }
.ib-detail .compose { margin-top: 10px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.ib-detail .chan { display: flex; align-items: center; border-bottom: 1px solid var(--line); background: var(--bg); }
.ib-detail .chan button { border: 0; border-right: 1px solid var(--line); background: none; padding: 9px 14px; cursor: pointer; color: var(--muted); font: inherit;
  font-weight: 500; display: inline-flex; gap: 7px; align-items: center; }
.ib-detail .chan button.on { background: var(--card); color: var(--text); }
.ib-detail .chan button:disabled { cursor: not-allowed; opacity: .45; }
.ib-detail .compose textarea { display: block; width: 100%; border: 0; border-radius: 0; resize: vertical; min-height: 140px; padding: 14px 16px; font: inherit;
  font-size: 15px; line-height: 1.55; color: var(--text); outline: none; background: var(--card); }
.ib-detail .compose textarea:focus { outline: none; box-shadow: inset 0 0 0 2px #dbe7ff; }
.ib-detail .c-err { padding: 10px 16px; background: #fbeee9; color: #b4361a; font-size: 13px; border-bottom: 1px solid var(--line); }
.ib-detail .who select { border: 1px solid var(--line); background: var(--card); border-radius: 7px; padding: 3px 6px; font: inherit; font-size: 12.5px;
  color: var(--text); width: auto; max-width: 240px; }
.ib-detail .who { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.ib-detail .who b { color: var(--ink-2); }
.ib-detail .skip-row { margin-top: 10px; }
.ib-detail .lk-form { margin: 0 0 0 auto; }
.ib-detail .lk.danger { color: #b4361a; cursor: pointer; font: inherit; font-size: 13px; }
.ib-detail .lk.danger:hover { background: #fbeee9; }
.ib-detail .lk svg.i { width: 15px; height: 15px; }
.inbox kbd { font: 600 11px/1 var(--font); padding: 3px 5px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px;
  color: var(--muted); background: #fff; }
.ib-btn.go kbd { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .25); color: #ddd; }
.ib-btn { font: inherit; cursor: pointer; }
.ib-btn svg.i { width: 16px; height: 16px; }
.ib-detail .keys { margin-top: 22px; font-size: 12px; color: var(--muted); display: flex; gap: 6px 14px; align-items: center; flex-wrap: wrap; }
.ib-detail .msg { padding: 14px 16px; font-size: 15px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.ib-detail .c-foot { display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 16px; border-top: 1px solid var(--line); background: var(--bg); }
.ib-detail .c-foot .who { color: var(--muted); font-size: 12.5px; flex: 1; min-width: 0; }
.ib-btn { flex: none; border: 1px solid var(--line); background: var(--card); padding: 8px 14px; border-radius: 9px; font-weight: 500; color: var(--text);
  display: inline-flex; gap: 8px; align-items: center; }
.ib-btn:hover { background: var(--hover); text-decoration: none; }
.ib-btn.go { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; padding: 9px 18px; }
.ib-btn.go:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.ib-detail .sent { margin-top: 10px; padding: 14px 16px; border-radius: 12px; background: #eef6f1; color: #2f7d4f; display: flex; gap: 8px; align-items: flex-start; }
.ib-detail .sent.off { background: var(--hover); color: var(--muted); }
.ib-detail .sent svg.ch { margin-top: 3px; }
.ib-empty { height: 100%; min-height: 240px; display: grid; place-items: center; text-align: center; color: var(--muted); padding: 40px; }
.ib-empty b { display: block; color: var(--text); font-size: 17px; margin-bottom: 6px; }

@media (max-width: 820px) {
  body.bare .page { height: auto; display: block; overflow: visible; }
  .ib-bar { padding: 10px 16px; }
  .inbox .ib-table { margin-left: 0; }
  .inbox .week { padding-left: 0; border-left: 0; width: 100%; white-space: normal; }
  .ib-menu { position: fixed; top: 110px; left: 16px; right: 16px; width: auto; }
  .ib-work { grid-template-columns: 1fr; }
  .ib-list { border-right: 0; padding-bottom: 70px; }
  .ib-detail { display: none; }
  body.open .ib-bar, body.open .ib-list, body.open .flash-row { display: none; }
  body.open .ib-detail { display: block; }
  .ib-detail .d-in { padding: 16px 16px 40px; }
  .ib-detail .back { display: inline-block; margin-bottom: 14px; color: var(--ink-2); }
  .ib-detail .d-head { flex-wrap: wrap; }
  .ib-detail .d-score { margin-left: 0; text-align: left; display: flex; align-items: baseline; gap: 8px; width: 100%; }
  .ib-detail .c-foot { flex-wrap: wrap; }
  .ib-detail .c-foot .who { flex-basis: 100%; }
  .ib-detail .c-foot .ib-btn.go { flex: 1; justify-content: center; }
  .inbox kbd, .ib-detail .keys { display: none; }
  .ib-item .ck { display: block; }
  .ib-item .u { display: none; }
  .ib-bulk { padding: 8px 16px; position: sticky; top: 56px; z-index: 15; }
  .ib-toast { bottom: 76px; }
  body.open .ib-toast { bottom: 24px; }
  .ib-detail .lk-form { margin-left: 0; }
}

/* ---------- Công tắc Tự động (thanh trên) ---------- */
.auto { position: relative; }
.auto summary { list-style: none; cursor: pointer; border: 1px solid var(--line); background: var(--card); border-radius: 99px; padding: 5px 12px 5px 10px;
  display: inline-flex; gap: 7px; align-items: center; font-size: 13px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.auto summary::-webkit-details-marker { display: none; }
.auto .ad { width: 8px; height: 8px; border-radius: 50%; background: #c3cfdf; flex: none; }
.auto.on summary { border-color: #b9dcc7; background: #eef6f1; color: #2f7d4f; }
.auto.on .ad { background: #3aa76d; box-shadow: 0 0 0 3px rgba(58, 167, 109, .18); }
.auto-warn { background: var(--hot); color: #fff; border-radius: 99px; font-size: 11px; padding: 0 6px; line-height: 17px; }
.auto-pop { position: absolute; right: 0; top: calc(100% + 8px); width: 400px; background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .1); padding: 6px 0; z-index: 30; color: var(--text); font-size: 14px; }
.anote { margin: 6px 12px 4px; padding: 8px 10px; border-radius: 8px; background: var(--hover); font-size: 12.5px; color: var(--ink-2); }
.arow { padding: 12px 16px; border-bottom: 1px solid var(--line); }
.arow form { margin: 0; }
.ahead { display: flex; align-items: center; gap: 10px; }
.ahead b { font-weight: 600; }
.ahead small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.sw { margin-left: auto; width: 38px; height: 22px; border-radius: 99px; background: #d8d5ce; border: 0; position: relative; cursor: pointer; flex: none; transition: .15s; }
.sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: .15s;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
.sw.on { background: #2f7d4f; }
.sw.on::after { left: 19px; }
.amode { display: flex; gap: 2px; padding: 3px; background: var(--hover); border-radius: 8px; margin-top: 10px; }
.amode button { flex: 1; border: 0; background: none; padding: 5px 8px; border-radius: 6px; cursor: pointer; font: inherit; font-size: 13px; color: var(--ink-2); }
.amode button.on { background: var(--card); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, .06); }
.arow.off .amode, .arow.off .alim { opacity: .4; }
.amode button:disabled { cursor: default; }
.alim { font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.nicks { padding: 10px 16px; border-bottom: 1px solid var(--line); }
.nicks h4 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.nrow { display: grid; grid-template-columns: 10px 1fr auto; gap: 2px 8px; align-items: center; padding: 5px 0; font-size: 13px; }
.nrow b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nrow .nd { width: 8px; height: 8px; border-radius: 50%; background: #3aa76d; }
.nrow.paused .nd, .nrow.pin .nd { background: #e0a23b; }
.nrow.login .nd { background: var(--hot); }
.nrow.zalo .nd { background: #0068ff; }
.nrow .ns { font-size: 12px; color: var(--muted); text-align: right; }
.nrow.paused .ns, .nrow.login .ns, .nrow.pin .ns { color: #a8701a; }
.nrow .nb { grid-column: 2 / 4; height: 4px; background: var(--hover); border-radius: 99px; overflow: hidden; }
.nrow .nb span { display: block; height: 100%; background: var(--ink-2); border-radius: 99px; }
.afoot { padding: 10px 16px 6px; font-size: 12.5px; color: var(--muted); }
.afoot a { color: var(--ink-2); text-decoration: underline; }
@media (max-width: 820px) {
  .auto-pop { position: fixed; top: 60px; left: 12px; right: 12px; width: auto; max-height: calc(100vh - 80px); overflow-y: auto; }
}

/* ---------- Dải nhắc việc Hộp khách ---------- */
.ib-remind { padding: 10px 24px 0; display: grid; gap: 6px; }
.ib-remind .rm { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; background: var(--card); border: 1px solid var(--line); }
.ib-remind .rd { width: 8px; height: 8px; border-radius: 50%; flex: none; background: #e0a23b; align-self: flex-start; margin-top: 6px; }
.ib-remind .rm.bad .rd { background: var(--hot); }
.ib-remind .rm.steps .rd { background: #3aa76d; }
.ib-remind .rt { flex: 1; min-width: 0; font-size: 13.5px; }
.ib-remind .rt b { font-weight: 600; }
.ib-remind .rt small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 1px; }
.ib-remind .step { display: inline-block; margin-right: 14px; }
.ib-remind .step.done { color: #9b988f; }
.ib-remind .step a { text-decoration: underline; }
.ib-remind .ib-btn { padding: 5px 12px; font-size: 13px; }
.ib-table { font-size: 13px; color: var(--ink-2); text-decoration: underline; text-underline-offset: 2px; text-decoration-color: #c3cfdf; white-space: nowrap; }
@media (max-width: 820px) {
  .ib-remind { padding: 10px 16px 0; }
  body.open .ib-remind { display: none; }
}
/* Ô số liệu (Báo cáo…): biểu tượng một màu trung tính, không nhiều màu pastel */
.stat-tile .ico, .stat .ico, .type-card .ico { background: var(--hover); color: var(--ink-2); }

/* Bảng hẹp trên điện thoại: mỗi hàng thành một khối, không phải cuộn ngang */
@media (max-width: 760px) {
  table.stack, .table-card table.stack { display: block; min-width: 0; }
  table.stack tbody, table.stack tr, table.stack td { display: block; }
  table.stack .stack-hide { display: none; }
  table.stack tr { padding: 10px 12px; border-bottom: 1px solid var(--line); }
  table.stack tr:last-child { border-bottom: 0; }
  table.stack td { padding: 3px 0; border: 0; text-align: left; max-width: none; min-width: 0; }
  table.stack td[data-label]::before { content: attr(data-label); display: block; font-size: 12px; font-weight: 600; color: var(--muted); }
}

/* Màn hình rộng: đọc khách bên trái, soạn và gửi tin bên phải */
@media (min-width: 1500px) {
  .ib-detail .d-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(400px, 460px); gap: 48px; align-items: start; }
  .ib-detail .d-act { position: sticky; top: 20px; }
  .ib-detail .d-act .c-foot { flex-wrap: wrap; }
  .ib-detail .d-act .c-foot .who { flex-basis: 100%; }
  .ib-detail .d-act .c-foot .ib-btn.go { flex: 1; justify-content: center; white-space: nowrap; }
  .ib-detail .d-act .c-foot kbd { display: none; }
  .ib-detail .d-act .compose textarea { min-height: 240px; }
}

/* Máy & nick: các cột đứng sát nhau, không giãn theo bề ngang màn hình */
@media (min-width: 1001px) {
  table.compact.stack td { width: 1%; white-space: nowrap; padding-right: 32px; }
  table.compact.stack td:last-child { width: auto; padding-right: 0; }
}

/* Icon trong menu, thẻ, bộ lọc, tiêu đề, nút */
.settings-tabs a, .inbox .seg a, .ib-table { display: inline-flex; align-items: center; gap: 7px; }
.settings-tabs svg.i { width: 16px; height: 16px; }
.inbox .seg svg.i, .ib-table svg.i { width: 15px; height: 15px; }
.inbox .seg .c { margin-left: -1px; }
.ib-pick summary > svg.i:first-child { width: 15px; height: 15px; }
.inbox .week > svg.i { width: 14px; height: 14px; margin-right: 6px; vertical-align: -2px; color: var(--muted); }
.btn svg.i { width: 16px; height: 16px; }
.btn svg.ch { width: 16px; height: 16px; }
.main h2 > svg.i { width: 18px; height: 18px; margin-right: 8px; vertical-align: -3px; color: var(--muted); }
.ib-detail .sec h2 { display: flex; align-items: center; gap: 6px; }
.ib-detail .sec h2 svg.i { width: 14px; height: 14px; }
.ib-detail .c-foot .ib-btn svg.i { width: 15px; height: 15px; }
@media (max-width: 480px) { .inbox .seg svg.i { display: none; } }

/* Phong cách xanh dương + trắng + xanh lá */
.card { box-shadow: 0 1px 4px rgba(27, 42, 65, .05); }
.btn, .ib-btn { border-radius: 9px; font-weight: 600; transition: background .15s, box-shadow .15s, border-color .15s; }
.btn { color: var(--ink-2); }
.btn.danger { color: var(--danger); }
.btn.primary, .ib-btn.go { box-shadow: 0 3px 10px rgba(37, 99, 235, .25); color: #fff; }
.btn.primary:hover { border-color: var(--primary-dark); color: #fff; }
input, select, textarea { border-radius: 9px; }
.inbox .seg a.on { color: var(--primary-dark); font-weight: 600; }
.tabs a.on, .settings-tabs a.on { color: var(--primary-dark); border-color: var(--primary); }
.ib-item.sel { background: var(--primary-soft); }
.ib-detail .d-score b.hot { color: var(--ok); }
.ib-detail .compose { box-shadow: 0 2px 10px rgba(27, 42, 65, .06); }
.ib-detail .chan button.on { color: var(--primary-dark); }
.inbox .kind { background: var(--primary-soft); color: var(--primary-dark); }
.s-warn { color: var(--primary-dark); }
.ib-btn.go kbd { background: rgba(255, 255, 255, .18); border-color: rgba(255, 255, 255, .3); color: #fff; }
.inbox .seg a { padding: 6px 10px; font-size: 14px; }
@media (max-width: 1540px) { .inbox .week .wk-speed { display: none; } }

/* Đăng ký / đăng nhập */
.google-btn { width: 100%; justify-content: center; padding: 10px 16px; color: var(--text); }
.auth-or { display: flex; align-items: center; gap: 10px; margin: 14px 0 4px; color: var(--muted); font-size: 13px; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-submit { width: 100%; justify-content: center; padding: 10px 16px; }
.auth-alt { text-align: center; margin: 14px 0 0; }

/* Trang thanh toán */
.pay { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 36px; align-items: center; max-width: 860px; padding: 26px 28px; }
.pay-qr { text-align: center; }
.pay-qr img { max-width: 100%; height: auto; border-radius: 10px; }
.pay-qr p { margin: 8px 0 0; }
.pay-info dl { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 10px 12px; margin: 0 0 14px; }
.pay-info dt { color: var(--muted); }
.pay-sum { display: flex; flex-direction: column; gap: 2px; margin: 0 0 16px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg, #f8fafc); }
.pay-sum span { color: var(--muted); font-size: 13.5px; }
.pay-sum b { font-size: 17px; }
.pay-sum .pay-switch { margin: 8px 0 0; padding-top: 8px; border-top: 1px dashed var(--line); font-size: 14px; }
.pay-sum small { color: var(--muted); font-size: 13px; }
.pay-info dd { margin: 0; overflow-wrap: anywhere; }
.pay-amount, .pay-code { color: var(--primary-dark); font-size: 18px; }
.pay-wait { display: flex; gap: 9px; align-items: center; margin: 14px 0 0; padding: 10px 12px; background: var(--primary-soft); border-radius: 9px; font-size: 13.5px; }
.pay-dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--primary); animation: pay-pulse 1.4s infinite; }
@keyframes pay-pulse { 50% { opacity: .3; } }
.pay-done { text-align: center; max-width: 560px; padding: 34px 28px; }
.pay-done > svg.i { width: 44px; height: 44px; color: var(--ok); margin-bottom: 8px; }
@media (max-width: 760px) {
  .pay { grid-template-columns: 1fr; gap: 18px; padding: 18px 16px; }
  .pay-info dl { grid-template-columns: 100px minmax(0, 1fr); }
}
.pay-key { text-align: left; margin-top: 14px; }
.pay-key .keybox { margin: 8px 0; }
.pay-next { text-align: left; margin: 16px 0 4px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: #fbfcfe; }
.pay-next ol { margin: 8px 0 12px; padding-left: 20px; line-height: 1.6; }
.pay-next .actions { justify-content: flex-start; }

/* Quản trị */
.adm-row { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.adm-row input { width: 220px; max-width: 100%; }
.adm-log { padding: 6px 0; font-size: 13.5px; border-top: 1px solid var(--line); }
.view-banner { display: flex; align-items: center; gap: 10px; padding: 8px 24px; background: #fff4d6; color: #7a5200; font-size: 14px; border-bottom: 1px solid #f2dfa7; }
.view-banner svg.i { width: 18px; height: 18px; }
.view-banner form { margin: 0 0 0 auto; }
.view-banner button { border: 1px solid #d9b65a; background: #fff; color: #7a5200; border-radius: 8px; padding: 4px 14px; font: inherit; font-weight: 600; cursor: pointer; }

/* ---------- Máy & tài khoản (kế hoạch giao diện, bước 2) ---------- */
.page-head-row { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.page-head-row > div { flex: 1 1 320px; }
.page-head-row p { margin: 4px 0 0; }
.dev-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.dev-ic { width: 40px; height: 40px; border-radius: 10px; background: var(--primary-soft); color: var(--primary-dark); display: grid; place-items: center; flex: none; }
.dev-off .dev-ic { background: var(--gray-soft); color: var(--muted); }
.dev-name { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; }
.dev-name b { font-size: 15px; }
.dev-accs { margin-top: 12px; border-top: 1px solid var(--line); }
.dev-acc { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid #f1f5f9; flex-wrap: wrap; }
.dev-acc:last-child { border-bottom: 0; }
.dev-tags { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.dev-empty { margin: 12px 0 0; }
.dev-off { opacity: .85; }
.empty-state { text-align: center; padding: 32px 20px; }
.empty-state b { display: block; font-size: 16px; margin-bottom: 4px; }
.steps-mini { margin: 0 0 12px; padding-left: 20px; color: var(--ink-2); }
.steps-mini li { padding: 2px 0; }
.newkey { border: 1px solid #fde68a; background: #fffbeb; border-radius: 10px; padding: 14px; margin-bottom: 4px; }
.newkey-t { font-weight: 600; margin-bottom: 8px; }
.copy-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.copy-row .keybox { flex: 1 1 260px; min-width: 0; background: #fff; border-style: solid; border-color: var(--line); }
.btn.done { background: var(--ok-soft); border-color: #86efac; color: var(--ok); box-shadow: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.plan-sum { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.plan-sum > div { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.plan-sum b { font-size: 18px; }

/* ---------- Kết nối máy không cần key (kế hoạch giao diện, bước 3) ---------- */
.pair { max-width: 520px; margin: 32px auto; padding: 32px 36px; }
.pair h1 { font-size: 22px; margin: 16px 0 6px; }
.pair-ic { width: 52px; height: 52px; border-radius: 14px; }
.pair-code { margin: 18px 0 8px; padding: 14px; border-radius: 12px; background: var(--primary-soft); border: 1px solid #bfdbfe; text-align: center;
  display: flex; flex-direction: column; gap: 2px; }
.pair-code b { font-size: 32px; letter-spacing: .12em; color: var(--primary-dark); }
.pair-info { margin: 0; }
.pair-info div { display: flex; justify-content: space-between; gap: 16px; padding: 11px 0; border-top: 1px solid #f1f5f9; }
.pair-info dt { color: var(--muted); }
.pair-info dd { margin: 0; font-weight: 600; text-align: right; }
.pair-actions { display: flex; gap: 12px; margin-top: 20px; }
.pair-actions form { flex: 1; }
.pair-actions form:last-child { flex: 2; }
.pair-actions .btn { width: 100%; justify-content: center; padding: 12px 16px; }
@media (max-width: 480px) { .pair { padding: 24px 18px; margin: 12px auto; } .pair-actions { flex-direction: column-reverse; } }

/* ---------- Nguồn quét (kế hoạch giao diện, bước 4) ---------- */
.last-round { color: var(--ok); margin-top: 2px; }
.last-round svg.i { width: 14px; height: 14px; margin-right: 4px; vertical-align: -2px; }
.grp-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.grp-bar input[type=search] { flex: 1 1 260px; max-width: 420px; }
.grp-bar .btn { margin-left: auto; }
.grp-table th.ck, .grp-table td.ck { width: 36px; }
.grp-table td a { color: var(--text); font-weight: 500; }
.grp-table td .tag { margin-left: 6px; }
.sec-title { font-size: 17px; margin: 22px 0 10px; }

/* ---------- Trang chủ (kế hoạch giao diện, bước 5) ---------- */
.flow { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; padding: 16px 20px; }
.flow-step { display: flex; gap: 12px; align-items: flex-start; min-width: 0; }
.flow-step > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.flow-step small { color: var(--muted); font-size: 13px; }
.flow-step > a { font-size: 13px; white-space: nowrap; }
.flow-n { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--primary-soft); color: var(--primary-dark); font-weight: 700;
  font-size: 13px; display: grid; place-items: center; }
.flow-n.on { background: var(--primary); color: #fff; }
.dash-cols { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
.dash-main { flex: 2 1 460px; min-width: 0; }
.dash-side { flex: 1 1 280px; min-width: 0; }
.dash-h { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.dash-h h2 { flex: 1; margin: 0; }
.dash-h > a { font-size: 14px; font-weight: 600; }
.dash-lead { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid #f1f5f9; color: var(--text); }
.dash-lead:hover { text-decoration: none; background: #fafbfd; }
.dl-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dl-body small { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-scan { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid #f1f5f9; }
.dash-scan svg.i.ok { color: var(--ok-dot); }
.dash-scan svg.i.bad { color: var(--danger); }
.ds-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ds-body small { color: var(--muted); font-size: 13px; }
.spin { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--primary); border-right-color: transparent; flex: none; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation: none; } }
.dash-empty { margin: 8px 0 0; }
.dash-bar { height: 6px; background: var(--hover); border-radius: 99px; margin: 8px 0 12px; }
.dash-bar span { display: block; height: 6px; background: var(--primary); border-radius: 99px; }
.setup { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.setup li { display: flex; align-items: center; gap: 10px; }
.setup li.done { color: var(--muted); }
.setup li svg.i { width: 18px; height: 18px; color: var(--ok-dot); stroke-width: 2.6; }
.setup .ring { width: 16px; height: 16px; border-radius: 50%; border: 2px solid #94a3b8; flex: none; }
.setup a { font-weight: 600; color: var(--text); }
.dash-todo { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid #f1f5f9; }
.dash-todo > div { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 14px; }
.dash-todo small { color: var(--muted); font-size: 12.5px; }
.dash-todo .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: #94a3b8; }
.dash-todo.info .dot { background: var(--primary); }
.dash-todo.warn .dot { background: #d97706; }
.dash-todo.bad .dot { background: var(--todo); }
@media (max-width: 760px) { .flow { grid-template-columns: 1fr; } }

/* ---------- Trợ lý cài đặt lần đầu (kế hoạch giao diện, bước 8; demo Web C) ---------- */
.ob { display: grid; grid-template-columns: 300px 1fr; gap: 16px; align-items: start; }
.ob-steps { list-style: none; margin: 0; padding: 10px; }
.ob-steps li a { display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: 10px; color: var(--text); }
.ob-steps li a:hover { background: var(--hover); }
.ob-steps li a, .ob-steps li a * { text-decoration: none; }
.page-head-row > .actions { flex: none; }
.ob-steps li.on a { background: var(--primary-soft); }
.ob-steps b { display: block; font-size: 14px; }
.ob-steps small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 1px; }
.ob-num { width: 28px; height: 28px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 700; font-size: 13px;
  border: 1.5px solid #cbd5e1; color: var(--muted); background: #fff; }
.ob-steps li.on .ob-num { border-color: var(--primary); color: var(--primary-dark); }
.ob-steps li.done .ob-num { border-color: var(--ok-dot); background: var(--ok-dot); color: #fff; }
.ob-num svg.i { width: 15px; height: 15px; stroke-width: 3; }
.ob-main { padding: 24px 28px; }
.ob-main h2 { font-size: 21px; margin: 6px 0 8px; }
.ob-main > p.muted { max-width: 640px; line-height: 1.6; }
.ob-sub { list-style: none; counter-reset: ob; margin: 18px 0; padding: 0; display: grid; gap: 10px; max-width: 640px; }
.ob-sub li { counter-increment: ob; position: relative; padding: 14px 16px 14px 52px; border: 1px solid var(--line); border-radius: 12px; background: #fbfcfe; }
.ob-sub li::before { content: counter(ob, lower-alpha); position: absolute; left: 16px; top: 13px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--primary-soft); color: var(--primary-dark); font-weight: 700; font-size: 12.5px; display: grid; place-items: center; }
.ob-sub b { display: block; }
.ob-sub small { display: block; color: var(--muted); margin: 3px 0 0; line-height: 1.5; }
.ob-sub .btn { margin-top: 10px; }
.ob-key { display: inline-block; padding: 1px 8px; border-radius: 6px; background: var(--primary); color: #fff; font-size: 13px; font-weight: 600; }
.ob-wait { display: flex; align-items: center; gap: 10px; margin: 16px 0 4px; padding: 12px 14px; border-radius: 10px; max-width: 640px;
  background: var(--gray-soft); color: var(--ink-2); font-weight: 600; }
.ob-wait.ok { background: var(--ok-soft); color: var(--ok); }
.ob-wait.warn { background: var(--warn-soft); color: var(--warn); }
.ob-wait svg.i { width: 18px; height: 18px; stroke-width: 3; }
.ob-spin { width: 16px; height: 16px; border-radius: 50%; border: 2.5px solid #cbd5e1; border-top-color: var(--primary); animation: ob-spin 1s linear infinite; flex: none; }
@keyframes ob-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ob-spin { animation: none; } }
.ob-nav { display: flex; align-items: center; gap: 10px; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.ob-gap { flex: 1; }
.ob-finish { text-align: center; padding: 24px 8px; }
.ob-finish p { margin: 0 auto 16px; max-width: 460px; }
.ob-big-ok { width: 56px; height: 56px; border-radius: 50%; background: var(--ok-dot); color: #fff; display: inline-grid; place-items: center; }
.ob-big-ok svg.i { width: 28px; height: 28px; stroke-width: 3; }
@media (max-width: 900px) {
  .ob { grid-template-columns: 1fr; }
  .ob-steps { display: flex; overflow-x: auto; gap: 4px; }
  .ob-steps li { flex: none; }
  .ob-steps small { display: none; }
  .ob-main { padding: 18px 16px; }
}
