/* 快趣在线客服 · 管理端样式 */
* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }
:root {
  --pri: #2f7bff;
  --pri-d: #1f66e0;
  --bg: #f2f5fa;
  --line: #e4e9f2;
  --txt: #1c2534;
  --sub: #7b8698;
  --card: #ffffff;
  --danger: #e5484d;
}
html, body { height: 100%; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--txt);
  font-size: 14px;
}

/* ---------- 按钮 ---------- */
.btn { border: 1px solid var(--line); background: #fff; color: var(--txt); border-radius: 8px; padding: 8px 16px; cursor: pointer; font-size: 14px; transition: .15s; }
.btn:hover { border-color: var(--pri); color: var(--pri); }
.btn-primary { background: var(--pri); border-color: var(--pri); color: #fff; }
.btn-primary:hover { background: var(--pri-d); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--sub); }
.btn-ghost:hover { color: var(--pri); border-color: transparent; background: #eef3fc; }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-danger { color: var(--danger); }

/* ---------- 登录 ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #eaf1fd 0%, #f6f9fe 60%, #eef7ff 100%); }
.login-card { width: 360px; background: var(--card); border-radius: 16px; padding: 36px 32px; box-shadow: 0 12px 40px rgba(31, 60, 110, .12); }
.login-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 26px; font-size: 17px; font-weight: 600; }
.login-card label { display: block; margin-bottom: 14px; color: var(--sub); font-size: 13px; }
.login-card input { width: 100%; margin-top: 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; color: var(--txt); }
.login-card input:focus { outline: none; border-color: var(--pri); }
.login-err { background: #fdecec; color: var(--danger); border-radius: 8px; padding: 8px 12px; font-size: 13px; margin-bottom: 14px; }

/* ---------- 布局 ---------- */
#app { display: flex; height: 100vh; }
.side { width: 200px; background: #ffffff; border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 18px 12px; }
.side-logo { display: flex; align-items: center; gap: 8px; padding: 4px 8px 18px; font-size: 15px; }
.side-nav { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.snav { display: flex; align-items: center; gap: 10px; border: 0; background: transparent; padding: 11px 12px; border-radius: 10px; cursor: pointer; font-size: 14px; color: var(--txt); text-align: left; }
.snav:hover { background: #f0f5fd; }
.snav.on { background: #eaf1ff; color: var(--pri); font-weight: 600; }
.snav i { font-style: normal; }
.side-foot { border-top: 1px solid var(--line); padding-top: 12px; display: flex; align-items: center; justify-content: space-between; }
.me { color: var(--sub); font-size: 13px; padding-left: 6px; }

.main { flex: 1; overflow: hidden; display: flex; }
.view { flex: 1; display: flex; overflow: hidden; }
#view-kb, #view-leads, #view-set, #view-embed, #view-staff, #view-tickets { display: block; padding: 26px 32px; overflow-y: auto; }
#view-kb h2, #view-set h2, #view-embed h2 { font-size: 18px; margin-bottom: 18px; }

/* ---------- 工作台 ---------- */
.convos { width: 300px; border-right: 1px solid var(--line); background: #fff; display: flex; flex-direction: column; }
.convos-top { padding: 12px; border-bottom: 1px solid var(--line); }
.tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.tab { border: 0; background: transparent; padding: 6px 12px; border-radius: 16px; cursor: pointer; color: var(--sub); font-size: 13px; }
.tab.on { background: #eaf1ff; color: var(--pri); font-weight: 600; }
.convos-top input { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.convos-top input:focus { outline: none; border-color: var(--pri); }
.convos-list { flex: 1; overflow-y: auto; }
.c-item { padding: 12px 14px; border-bottom: 1px solid #f0f3f8; cursor: pointer; display: flex; gap: 10px; }
.c-item:hover { background: #f7faff; }
.c-item.on { background: #eef4ff; }
.c-item .c-main { flex: 1; min-width: 0; }
.c-item .c-page { font-size: 13px; color: var(--txt); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-item .c-last { font-size: 12px; color: var(--sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 3px; }
.c-item .c-meta { text-align: right; flex-shrink: 0; }
.c-item .c-time { font-size: 11px; color: var(--sub); }
.c-item .c-status { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 9px; margin-top: 6px; }
.c-status.s-open { background: #eaf1ff; color: var(--pri); }
.c-status.s-pending { background: #ffecec; color: #e05252; }
.c-status.s-replied { background: #e7f7ee; color: #2ba471; }
.c-status.s-closed { background: #f0f1f4; color: var(--sub); }
.c-rate { display: block; font-size: 10px; letter-spacing: -1px; margin-top: 4px; }
.chat-imgbtn { flex: 0 0 auto; width: 38px; height: 38px; border: 1px solid var(--line); background: #f6f9ff; color: var(--pri); border-radius: 10px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.chat-imgbtn:hover { background: #eaf1ff; border-color: var(--pri); }
.chat-plus-wrap { position: relative; flex: 0 0 auto; }
.chat-plus-menu { position: absolute; left: 0; bottom: 46px; z-index: 30; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 28px rgba(20,40,80,.16); padding: 6px; display: flex; flex-direction: column; min-width: 132px; }
.chat-plus-menu[hidden] { display: none; }
.chat-plus-menu button { border: 0; background: none; text-align: left; font-size: 13px; color: var(--txt); padding: 9px 12px; border-radius: 8px; cursor: pointer; white-space: nowrap; }
.chat-plus-menu button:hover { background: #eaf1ff; color: var(--pri); }
/* 消息里的图片：固定缩略图尺寸，点击看大图 */
.a-msg .bubble img.a-img { max-width: 200px; max-height: 150px; width: auto; height: auto; border-radius: 8px; display: block; border: 1px solid #e3eaf3; cursor: zoom-in; }
/* 系统提示行 */
.a-msg.sys { max-width: 100%; width: 100%; justify-content: center; }
.a-msg.sys .sys-line { font-size: 12px; color: #8a97a8; background: #f3f6fa; border-radius: 12px; padding: 4px 14px; margin: 4px 0; }
/* 客户满意度展示行 */
.rate-line { text-align: center; font-size: 12px; color: #b8860b; background: #fff8e6; border: 1px solid #f5dfa0; border-radius: 12px; padding: 5px 14px; margin: 8px auto; width: fit-content; }
/* 大图查看层 */
.admin-lightbox { position: fixed; inset: 0; z-index: 999; background: rgba(10,16,28,.72); display: flex; align-items: center; justify-content: center; cursor: zoom-out; }
.admin-lightbox[hidden] { display: none; }
.admin-lightbox img { max-width: 88vw; max-height: 88vh; border-radius: 10px; box-shadow: 0 12px 48px rgba(0,0,0,.5); background: #fff; }
.chat-imgprev { display: flex; align-items: center; gap: 9px; margin: 0 16px 8px; padding: 8px 10px; background: #f2f7ff; border: 1px solid #cdddfb; border-radius: 10px; }
.chat-imgprev[hidden] { display: none; }
.chat-imgprev .ci-thumb { position: relative; flex: 0 0 auto; display: inline-flex; }
.chat-imgprev .ci-thumb img { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; background: #fff; cursor: zoom-in; }
.chat-imgprev .ci-del { position: absolute; top: -7px; right: -7px; width: 17px; height: 17px; border-radius: 50%; background: #ff4d4f; color: #fff; font-style: normal; font-size: 12px; line-height: 16px; text-align: center; cursor: pointer; box-shadow: 0 1px 5px rgba(0,0,0,.22); }
.chat-imgprev .ci-del:hover { background: #e03131; }
.chat-imgprev .ci-name { flex: 1; min-width: 0; font-size: 12px; color: var(--txt); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge { display: inline-block; min-width: 18px; height: 18px; line-height: 18px; text-align: center; background: var(--danger); color: #fff; border-radius: 9px; font-size: 11px; padding: 0 5px; margin-top: 5px; }
.convos-list .none { padding: 40px 0; text-align: center; color: var(--sub); font-size: 13px; }

.chat { flex: 1; display: flex; flex-direction: column; background: var(--bg); }
.chat-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--sub); gap: 10px; }
.chat-empty .ce-ic { font-size: 42px; }
.chat-live { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.chat-head { background: #fff; border-bottom: 1px solid var(--line); padding: 12px 20px; display: flex; align-items: center; justify-content: space-between; }
.ch-info b { font-size: 15px; }
.ch-page { display: block; font-size: 12px; color: var(--sub); margin-top: 2px; max-width: 480px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.a-msg { max-width: 62%; display: flex; gap: 8px; }
.a-msg.me { align-self: flex-end; flex-direction: row-reverse; }
.a-msg .av { width: 32px; height: 32px; border-radius: 8px; background: #fff; border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.a-msg .bubble { background: #fff; border-radius: 12px; padding: 10px 14px; line-height: 1.6; font-size: 14px; word-break: break-word; white-space: pre-wrap; box-shadow: 0 1px 3px rgba(31,60,110,.06); }
.a-msg.me .bubble { background: var(--pri); color: #fff; }
.a-msg .who-tag { font-size: 11px; color: var(--sub); margin-bottom: 3px; }
.a-msg.me .who-tag { text-align: right; }
.a-msg .m-time { font-size: 11px; color: var(--sub); margin-top: 4px; }
.chat-quick { padding: 0 20px 8px; display: flex; flex-wrap: wrap; gap: 8px; }
.chat-quick button { border: 1px dashed var(--line); background: #fff; color: var(--sub); border-radius: 14px; padding: 5px 12px; cursor: pointer; font-size: 12px; max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-quick button:hover { color: var(--pri); border-color: var(--pri); }
.chat-input { background: #fff; border-top: 1px solid var(--line); padding: 12px 16px; display: flex; gap: 10px; align-items: flex-end; }
.chat-input textarea { flex: 1; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 14px; font-family: inherit; resize: none; color: var(--txt); }
.chat-input textarea:focus { outline: none; border-color: var(--pri); }

/* ---------- 知识库 ---------- */
.kb-head { display: flex; align-items: center; gap: 18px; }
.kb-head h2 { margin: 0 !important; }
.kb-head .btn { margin-left: auto; }
.switch-line { display: flex; align-items: center; gap: 7px; color: var(--txt); cursor: pointer; font-size: 14px; }
.switch-line input { width: 16px; height: 16px; accent-color: var(--pri); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; margin-bottom: 16px; }
.card h3 { font-size: 15px; margin-bottom: 12px; }
.card label { display: block; color: var(--sub); font-size: 13px; margin-bottom: 10px; }
.card input[type=text], .card input[type=password], .card input[type=number], .card textarea, .card select {
  width: 100%; margin-top: 5px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; font-family: inherit; color: var(--txt); resize: vertical;
}
.card input:focus, .card textarea:focus { outline: none; border-color: var(--pri); }
.card .btn { margin-top: 4px; }
.card .btn + .btn { margin-left: 8px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.kb-fallback b { font-size: 14px; }
.kb-fallback { color: var(--sub); font-size: 13px; }
.kb-list { display: flex; flex-direction: column; gap: 10px; }
.kb-item { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; display: flex; align-items: center; gap: 14px; }
.kb-item .k-ic { font-size: 20px; width: 34px; text-align: center; flex-shrink: 0; }
.kb-item .k-main { flex: 1; min-width: 0; }
.kb-item .k-q { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kb-item .k-a { font-size: 12px; color: var(--sub); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kb-item .k-tags { display: flex; gap: 6px; flex-shrink: 0; }
.k-tag { font-size: 11px; padding: 2px 8px; border-radius: 9px; background: #f0f4fa; color: var(--sub); }
.k-tag.t-quick { background: #fff4e6; color: #c4700a; }
.k-tag.t-off { background: #fdecec; color: var(--danger); }
.kb-item .k-ops { display: flex; gap: 4px; flex-shrink: 0; }

/* ---------- 留言表单 ---------- */
.leads-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 8px; }
.leads-title { display: flex; align-items: center; gap: 12px; }
.leads-ic { width: 44px; height: 44px; border-radius: 12px; background: linear-gradient(135deg, #eaf1ff, #d8e7ff); display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; }
.leads-title h2 { font-size: 18px; margin: 0; }
.leads-head .btn { flex-shrink: 0; }
.lead-hint { color: var(--sub); font-size: 13px; margin: 0 0 18px; line-height: 1.6; }
.leads-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 18px; }
.lstat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; display: flex; align-items: center; gap: 14px; }
.lstat-ic { width: 42px; height: 42px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.lstat-ic.ls-total { background: #eaf1ff; }
.lstat-ic.ls-today { background: #e7f7ee; }
.lstat-ic.ls-yest { background: #fff4e6; }
.lstat-body { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.lstat-num { font-size: 24px; font-weight: 700; color: var(--pri); line-height: 1; }
.lstat-num.lstat-today { color: #2ba471; }
.lstat-num.lstat-yest { color: #c4700a; }
.lstat-label { font-size: 12px; color: var(--sub); }
@media (max-width: 640px) { .leads-stats { grid-template-columns: 1fr; } }
.lead-table-wrap { padding: 0 !important; overflow-x: auto; }
.lead-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 720px; }
.lead-table th { text-align: left; padding: 12px 14px; background: #f7f9fc; color: var(--sub); font-weight: 600; border-bottom: 1px solid var(--line); white-space: nowrap; }
.lead-table td { padding: 12px 14px; border-bottom: 1px solid #f0f3f8; color: var(--txt); vertical-align: top; }
.lead-table tr:last-child td { border-bottom: 0; }
.lead-table tr:hover td { background: #f8fbff; }
.lead-phone { font-weight: 700; color: var(--pri); white-space: nowrap; }
.lead-content { max-width: 260px; word-break: break-word; }
.lead-page { max-width: 160px; color: var(--sub); font-size: 12px; word-break: break-all; }
.lead-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 72px 20px; text-align: center; }
.lead-empty .le-ic { font-size: 54px; margin-bottom: 16px; }
.lead-empty .le-title { font-size: 16px; font-weight: 600; color: var(--txt); margin-bottom: 6px; }
.lead-empty .le-sub { font-size: 13px; color: var(--sub); max-width: 340px; line-height: 1.6; }
.nbadge { display: inline-block; min-width: 17px; height: 17px; line-height: 17px; text-align: center; background: var(--danger); color: #fff; border-radius: 9px; font-size: 10.5px; padding: 0 5px; margin-left: auto; }
.nbadge[hidden] { display: none !important; }

/* ---------- 弹窗 / 提示 ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(15, 25, 40, .45); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal { width: 640px; max-width: calc(100vw - 40px); max-height: calc(100vh - 60px); background: #fff; border-radius: 14px; display: flex; flex-direction: column; }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; font-size: 15px; }
.modal-x { border: 0; background: transparent; font-size: 15px; cursor: pointer; color: var(--sub); }
.modal-body { padding: 16px 20px; overflow-y: auto; }
.modal-body label { display: block; color: var(--sub); font-size: 13px; margin-bottom: 12px; }
.modal-body input, .modal-body textarea { width: 100%; margin-top: 5px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; font-family: inherit; color: var(--txt); resize: vertical; }
.modal-body input:focus, .modal-body textarea:focus { outline: none; border-color: var(--pri); }
.modal-body .switch-line { margin-bottom: 12px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.tip { margin-top: 10px; padding: 8px 12px; border-radius: 8px; font-size: 13px; background: #eef7ee; color: #1d7a34; }
.tip.err { background: #fdecec; color: var(--danger); }
.toast { position: fixed; top: 24px; left: 50%; transform: translateX(-50%); background: #1c2534; color: #fff; padding: 10px 20px; border-radius: 10px; font-size: 13px; z-index: 99; box-shadow: 0 8px 24px rgba(0,0,0,.25); }

/* ---------- 移动端 ---------- */
@media (max-width: 860px) {
  #app { flex-direction: column; }
  .side { width: 100%; flex-direction: row; align-items: center; padding: 8px 12px; }
  .side-logo { padding: 0 8px 0 0; }
  .side-logo b { display: none; }
  .side-nav { flex-direction: row; }
  .snav { padding: 8px 10px; }
  .side-foot { border: 0; padding: 0; }
  .convos { width: 132px; }
  .c-item { padding: 10px 8px; }
  .kb-item { flex-wrap: wrap; }
}

/* ---- 设置：管理员头像 ---- */
.ava-row { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.ava-preview { flex: 0 0 auto; width: 56px; height: 56px; border-radius: 50%; overflow: hidden; background: linear-gradient(135deg, #ff9032, #ff7d1f); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 26px; border: 2px solid #ffe0c2; }
.ava-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ava-ops { display: flex; flex-direction: column; gap: 8px; }
.ava-ops .btn { width: 108px; }
/* 消息流中自定义头像 */
.a-msg .av img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }

/* ---- 客户档案信息条 / 标签编辑 ---- */
.vinfo { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 8px 16px; border-bottom: 1px solid var(--line); background: #f8faff; font-size: 12px; color: var(--muted); }
.vinfo[hidden] { display: none; }
.vinfo-text { color: #33415c; font-weight: 500; }
.vinfo-more { color: #7c8aa0; }
.vinfo .btn { margin-left: auto; }
.v-tag { display: inline-block; padding: 1px 8px; border-radius: 999px; background: #e8f1ff; color: #2f6bff; font-size: 11px; font-weight: 600; margin-left: 4px; }
.v-tag-count { background: #e7f7ee; color: #2ba471; cursor: help; }
.v-tag-note { background: #fff8e1; color: #8a6d1f; cursor: help; padding: 1px 6px; display: inline-flex; align-items: center; }
.ic-note { vertical-align: -1px; }
.vinfo-tags .v-tag { margin-left: 0; margin-right: 4px; }
.c-visits { color: #7c8aa0; font-size: 11px; font-weight: 600; }
.v-sessions { max-width: 240px; border: 1px solid var(--line); border-radius: 8px; padding: 3px 6px; font-size: 12px; color: #33415c; background: #fff; margin-left: 10px; }
.vedit { padding: 10px 16px; border-bottom: 1px solid var(--line); background: #fffdf5; }
.vedit[hidden] { display: none; }
.ve-row { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 8px; }
.ve-label { flex: 0 0 auto; font-size: 13px; color: #33415c; padding-top: 5px; }
.ve-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ve-chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 4px 12px; font-size: 12px; cursor: pointer; color: #55627a; }
.ve-chip.on { background: #2f6bff; border-color: #2f6bff; color: #fff; }
.ve-row input[type="text"] { flex: 1; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 12px; }
.ve-row textarea { flex: 1; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 12px; resize: vertical; font-family: inherit; }
.ve-ops { display: flex; gap: 8px; justify-content: flex-end; }
.vinfo-note { color: #8a6d1f; }
.vinfo-note .v-note { display: inline-block; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; background: #fff8e1; border: 1px solid #f2e3a0; border-radius: 6px; padding: 1px 8px; font-weight: 500; }

/* ========== 全站 UI 整体优化 v141 ========== */
body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
::selection { background: rgba(47, 123, 255, .18); }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: #cdd6e4; border-radius: 8px; }
*::-webkit-scrollbar-thumb:hover { background: #b3c0d4; }
*::-webkit-scrollbar-track { background: transparent; }

/* 按钮：圆角 + 渐变主色 + 悬停微浮起 */
.btn { border-radius: 10px; font-weight: 500; transition: all .18s ease; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(31, 60, 110, .10); }
.btn:active { transform: translateY(0); box-shadow: none; }
.btn-primary { background: linear-gradient(135deg, #3d86ff, #2f7bff); border-color: transparent; box-shadow: 0 2px 8px rgba(47, 123, 255, .28); }
.btn-primary:hover { background: linear-gradient(135deg, #2f7bff, #1f66e0); box-shadow: 0 4px 14px rgba(47, 123, 255, .36); color: #fff; }
.btn-ghost:hover { transform: none; box-shadow: none; }

/* 输入聚焦光环 */
input, textarea, select { transition: border-color .15s, box-shadow .15s; }
.card input:focus, .card textarea:focus, .card select:focus,
.convos-top input:focus, .chat-input textarea:focus,
.modal-body input:focus, .modal-body textarea:focus,
.login-card input:focus, .ve-row input:focus, .ve-row textarea:focus {
  outline: none; border-color: var(--pri); box-shadow: 0 0 0 3px rgba(47, 123, 255, .14);
}

/* 侧栏导航 */
.snav { transition: background .15s, color .15s; }
.snav.on { background: linear-gradient(135deg, #eaf1ff, #dfeaff); box-shadow: inset 0 0 0 1px rgba(47, 123, 255, .18); }
.side-logo b { letter-spacing: .2px; }

/* 卡片 / 标题 */
.card { border-radius: 14px; border-color: #e7ecf4; box-shadow: 0 1px 2px rgba(20, 35, 70, .04), 0 6px 20px rgba(20, 35, 70, .05); }
.card h3 { font-weight: 600; letter-spacing: .2px; }
#view-kb h2, #view-set h2, #view-embed h2, .leads-title h2 { font-weight: 700; letter-spacing: .2px; }

/* 筛选 tabs：分段控件 */
.tabs { background: #eef2f8; padding: 3px; border-radius: 12px; gap: 2px; }
.tab { border-radius: 9px; font-weight: 500; }
.tab.on { background: #fff; color: var(--pri); box-shadow: 0 1px 4px rgba(20, 35, 70, .12); }

/* 客户列表：选中左侧 accent + 独立标签行 */
.c-item { transition: background .12s; }
.c-item.on { background: linear-gradient(90deg, #eef4ff, #f6f9ff); box-shadow: inset 3px 0 0 var(--pri); }
.c-tags { display: flex; flex-wrap: nowrap; gap: 4px; margin-top: 5px; overflow: hidden; }
.c-tags .v-tag { margin-left: 0; flex: 0 0 auto; max-width: 92px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 聊天窗 */
.a-msg .bubble { border-radius: 14px; box-shadow: 0 1px 3px rgba(31, 60, 110, .08); }
.a-msg.me .bubble { background: linear-gradient(135deg, #3d86ff, #2f7bff); box-shadow: 0 2px 8px rgba(47, 123, 255, .25); }

/* 知识库条目 / 表格 / 统计卡 */
.kb-item { border-radius: 14px; box-shadow: 0 1px 2px rgba(20, 35, 70, .04); transition: box-shadow .15s; }
.kb-item:hover { box-shadow: 0 6px 18px rgba(20, 35, 70, .08); }
.lead-table th { background: #f8fafc; font-size: 12px; letter-spacing: .3px; }
.lead-table-wrap, .lstat { border-radius: 14px; }
.lstat { box-shadow: 0 1px 2px rgba(20, 35, 70, .04), 0 6px 20px rgba(20, 35, 70, .05); }
.lead-empty .le-ic { filter: drop-shadow(0 6px 14px rgba(20, 35, 70, .12)); }

/* 弹窗 / 提示 / 登录 */
.modal { border-radius: 16px; box-shadow: 0 24px 70px rgba(10, 20, 40, .28); }
.modal-mask { backdrop-filter: blur(3px); }
.toast { border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .3); }
.login-card { border-radius: 18px; box-shadow: 0 18px 50px rgba(31, 60, 110, .16); }

/* ========== 开关 / 复选框美化 v142 ========== */
.switch-line { display: flex; align-items: center; gap: 9px; }
.switch-line input[type=checkbox] {
  appearance: none; -webkit-appearance: none; flex: 0 0 auto;
  width: 40px; height: 22px; margin: 0; border: 0; border-radius: 999px;
  background: #d9e1ec; position: relative; cursor: pointer; transition: background .2s;
}
.switch-line input[type=checkbox]::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(20, 35, 70, .25); transition: left .2s;
}
.switch-line input[type=checkbox]:checked { background: var(--pri); }
.switch-line input[type=checkbox]:checked::after { left: 21px; }
.modal-body .switch-line { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; }
.modal-body .switch-line input[type=checkbox] { width: 40px; margin-top: 0; }

/* ========== 提示 Toast 移底部中间 + 成功/错误配色 v144 ========== */
.toast {
  top: auto; bottom: 36px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px;
  background: linear-gradient(135deg, #4a8dff, var(--pri)); color: #fff;
  padding: 12px 26px; border-radius: 999px; font-size: 14px; font-weight: 600;
  box-shadow: 0 10px 30px rgba(47, 123, 255, .35);
  animation: toast-in .28s cubic-bezier(.21, 1.02, .73, 1);
}
.toast[hidden] { display: none; }
.toast::before {
  content: '✓'; flex: 0 0 auto; width: 20px; height: 20px; border-radius: 50%;
  background: rgba(255, 255, 255, .25); display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}
.toast.err { background: linear-gradient(135deg, #f87171, #ef4444); box-shadow: 0 10px 30px rgba(239, 68, 68, .35); }
.toast.err::before { content: '!'; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ========== 英文翻译进行中指示 v145 ========== */
.cs-translating {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='9' fill='none' stroke='%23d7e0ec' stroke-width='3'/%3E%3Cpath d='M21 12a9 9 0 0 0-9-9' fill='none' stroke='%2310b981' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 18px 18px;
  padding-right: 34px; animation: cs-trans-pulse 1.1s ease-in-out infinite;
}
@keyframes cs-trans-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
  50% { box-shadow: 0 0 0 3px rgba(16, 185, 129, .20); }
}

/* ========== 网站接入页 v147 ========== */
.embed-code {
  width: 100%; box-sizing: border-box; font-family: ui-monospace, Consolas, Menlo, monospace;
  font-size: 12.5px; color: #1e2a3a; background: #f6f9ff; border: 1px solid #dfe7f3;
  border-radius: 10px; padding: 12px 14px; line-height: 1.7; resize: none; word-break: break-all;
}
.embed-code:focus { outline: none; border-color: var(--pri); box-shadow: 0 0 0 3px rgba(47, 123, 255, .14); }
.embed-ops { display: flex; gap: 10px; margin-top: 12px; }
.embed-ops .btn { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; line-height: 1.5; }
.embed-steps { margin: 6px 0 0; padding-left: 20px; color: var(--sub); font-size: 13px; line-height: 1.9; }
.embed-steps li { margin-bottom: 6px; }
.embed-steps b { color: #223; }
.embed-steps code { background: #eef3fc; color: var(--pri); padding: 1px 6px; border-radius: 6px; font-size: 12px; }
#embedKeyTip code { background: #eef3fc; color: var(--pri); padding: 1px 6px; border-radius: 6px; font-size: 12px; }

/* ========== 网站接入页 v150 ========== */
.embed-head { margin-bottom: 18px; }
.embed-head h2 { font-size: 19px; font-weight: 700; margin: 0 0 6px; color: #1c2735; }
.embed-head p { margin: 0; color: var(--sub); font-size: 13.5px; }
.embed-head code, .embed-note code { background: #eef3fc; color: var(--pri); padding: 1px 6px; border-radius: 6px; font-size: 12px; }
.embed-note { margin: 12px 0 0; color: #6b7889; font-size: 12.5px; line-height: 1.7; }
#view-embed .card { margin-bottom: 14px; }
#view-embed .card h3 { font-size: 14.5px; color: #1c2735; margin-bottom: 10px; }
/* ---------- 样式卡片 v151 ---------- */
.embed-opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(206px, 1fr)); gap: 10px; margin-top: 2px; }
.embed-opts .opt {
  position: relative; display: flex; align-items: center; gap: 12px; margin: 0; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.embed-opts .opt:hover { border-color: #c3d5f0; background: #fcfdff; }
.embed-opts .opt input { position: absolute; opacity: 0; pointer-events: none; }
.embed-opts .opt .thumb { flex: none; width: 88px; height: 55px; }
.embed-opts .opt-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.embed-opts .opt b { color: #223; font-size: 13.5px; font-weight: 600; letter-spacing: .1px; }
.embed-opts .opt i { color: var(--sub); font-size: 12px; font-style: normal; line-height: 1.5; }
.embed-opts .opt.on { border-color: var(--pri); background: #f7faff; box-shadow: 0 0 0 2px rgba(47, 123, 255, .14); }
.embed-opts .opt.on b { color: var(--pri); }
.embed-opts .opt.on .thumb { filter: drop-shadow(0 1px 2px rgba(20, 35, 70, .08)); }

/* ---------- 主题色 + 窗口标题 ---------- */
.embed-colors {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  margin-top: 14px; padding-top: 14px; border-top: 1px solid #eef1f7;
}
.embed-colors .cl-label { color: var(--sub); font-size: 12.5px; }
.embed-colors label.sw, .embed-colors input.cl-title { margin: 0; }
.embed-colors .sw {
  flex: none; width: 20px; height: 20px; border-radius: 50%; border: 0; background: var(--sw, #cbd5e1);
  cursor: pointer; box-shadow: 0 0 0 1px rgba(20, 35, 70, .10); padding: 0; position: relative;
  transition: transform .12s, box-shadow .12s;
}
.embed-colors .sw:hover { transform: scale(1.12); }
.embed-colors .sw.on { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--sw); }
.embed-colors .sw-custom {
  background: #fff; color: #93a1b5; box-shadow: 0 0 0 1px #dde4ee;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.embed-colors .sw-custom svg { display: block; }
.embed-colors .sw-custom:hover { color: var(--pri); box-shadow: 0 0 0 1px var(--pri); transform: none; }
.embed-colors .sw-custom input[type=color] { position: absolute; inset: 0; opacity: 0; cursor: pointer; border: 0; padding: 0; width: 100%; height: 100%; }
.embed-colors .cl-div { flex: none; width: 1px; height: 18px; background: #e6ebf3; margin: 0 4px; }
.embed-colors .cl-group { display: flex; align-items: center; gap: 7px; flex: 0 1 auto; min-width: 0; }
.embed-colors input.cl-title {
  flex: 1 1 118px; min-width: 88px; border: 1px solid #e2e8f2; border-radius: 8px; padding: 5px 10px;
  font-size: 12.5px; color: #223; background: #fff;
}
.embed-colors .cl-title:focus { outline: none; border-color: var(--pri); box-shadow: 0 0 0 3px rgba(47, 123, 255, .10); }
.embed-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.embed-foot .embed-note { margin: 0; }
.embed-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 4px 14px; }
.embed-grid label { font-size: 12.5px; color: var(--sub); margin-bottom: 8px; }
.embed-grid .wide { grid-column: 1 / -1; }
.embed-grid input { margin-top: 5px; }
.embed-faq dl { margin: 0; font-size: 13px; line-height: 1.75; }
.embed-faq dt { color: #223; font-weight: 600; margin-top: 12px; }
.embed-faq dt:first-child { margin-top: 0; }
.embed-faq dd { margin: 3px 0 0; color: var(--sub); }

/* ========== 同事名单 + 会话转接 v154 ========== */
#view-staff .card h3 { font-size: 14.5px; color: #1c2735; margin-bottom: 10px; }
#view-staff .card > label { margin-top: 12px; }

/* 名单 */
.staff-list { display: flex; flex-direction: column; }
.staff-list .staff-empty { padding: 14px 2px; color: var(--sub); font-size: 13px; }
.staff-row { display: flex; align-items: center; gap: 10px; padding: 10px 2px; border-bottom: 1px solid #f0f3f8; }
.staff-row:last-child { border-bottom: 0; }
.staff-row.off { opacity: .55; }
.staff-row .sr-name { font-size: 13.5px; color: #223; font-weight: 600; flex: none; max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.staff-row .sr-dept { flex: none; font-size: 11.5px; font-weight: 600; color: #2f6bff; background: #e8f1ff; border-radius: 999px; padding: 2px 9px; }
.staff-row .sr-note { flex: 1 1 auto; min-width: 0; font-size: 12.5px; color: var(--sub); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.staff-row .sr-n { flex: none; font-size: 11.5px; color: var(--sub); background: #f2f5fa; border-radius: 999px; padding: 2px 9px; }
.staff-row .sr-ops { flex: none; display: flex; gap: 2px; }
.staff-row .sr-ops .btn { padding: 4px 9px; font-size: 12px; }
.staff-row.editing { background: #f7faff; border-radius: 8px; }

/* 编辑表单 */
.staff-form { margin-top: 14px; padding-top: 14px; border-top: 1px solid #eef1f7; }
.staff-form.editing { background: #f7faff; border-radius: 10px; padding: 14px; border-top: 0; margin-top: 10px; }
.staff-form .switch-line { margin: 2px 0 10px; font-size: 13px; }

/* 聊天窗：负责人 + 转接菜单 */
.ch-ops { display: flex; align-items: center; gap: 8px; }
.ch-owner { display: inline-block; margin-left: 8px; font-size: 11.5px; font-weight: 600; color: #2f6bff; background: #e8f1ff; border-radius: 999px; padding: 2px 9px; vertical-align: 2px; }
.ch-owner[hidden] { display: none; }
.c-item .c-owner { display: inline-block; font-size: 11px; color: #2f6bff; background: #eef4ff; border-radius: 999px; padding: 1px 7px; margin-left: 5px; max-width: 84px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: 1px; }
.tr-wrap { position: relative; display: inline-block; }
.tr-menu { position: absolute; right: 0; top: calc(100% + 7px); width: 232px; max-height: 320px; overflow-y: auto; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(20, 35, 70, .14); padding: 6px; z-index: 60; }
.tr-menu[hidden] { display: none; }
.tr-menu .tr-group { font-size: 11.5px; color: var(--sub); padding: 8px 10px 4px; }
.tr-menu .tr-item { display: block; width: 100%; border: 0; background: transparent; text-align: left; padding: 8px 10px; border-radius: 9px; cursor: pointer; font-size: 13px; color: var(--txt); font-family: inherit; line-height: 1.4; }
.tr-menu .tr-item:hover { background: #f2f6fd; }
.tr-menu .tr-item.on { background: #eaf1ff; color: var(--pri); }
.tr-menu .tr-item b { font-weight: 600; }
.tr-menu .tr-item .tr-sub { display: block; font-size: 11.5px; color: var(--sub); font-weight: 400; margin-top: 2px; }
.tr-menu .tr-self { margin-top: 6px; padding-top: 9px; border-top: 1px solid #eef1f7; color: var(--sub); }
.tr-menu .tr-empty { padding: 12px 10px; font-size: 12.5px; color: var(--sub); line-height: 1.7; }

/* ========== 工单 v155 ========== */
#view-tickets .card h3 { font-size: 14.5px; color: #1c2735; margin-bottom: 10px; }
#view-tickets .tk-tabs { margin-bottom: 2px; padding-bottom: 10px; border-bottom: 1px solid #eef1f7; }
.tk-list { display: flex; flex-direction: column; }
.tk-list .tk-empty { padding: 26px 2px; text-align: center; color: var(--sub); font-size: 13px; line-height: 1.9; }
.tk-row { display: flex; gap: 12px; padding: 13px 2px; border-bottom: 1px solid #f0f3f8; }
.tk-row:last-child { border-bottom: 0; }
.tk-row.done .tk-title { color: var(--sub); font-weight: 500; }
.tk-main { flex: 1 1 auto; min-width: 0; }
.tk-top { display: flex; align-items: center; gap: 7px; }
.tk-no { flex: none; font-size: 12px; font-weight: 600; color: #4a5a72; background: #f1f4f9; border-radius: 6px; padding: 2px 7px; }
.tk-prio { flex: none; font-size: 11.5px; font-weight: 600; border-radius: 999px; padding: 1px 8px; }
.tk-prio.p2 { background: #fff4e5; color: #a35a12; }
.tk-prio.p3 { background: #ffecec; color: #e05252; }
.tk-st { flex: none; font-size: 11.5px; font-weight: 600; border-radius: 999px; padding: 1px 8px; }
.tk-st.s-open { background: #ffecec; color: #e05252; }
.tk-st.s-doing { background: #eaf1ff; color: var(--pri); }
.tk-st.s-done { background: #e7f7ee; color: #2ba471; }
.tk-title { margin-top: 7px; font-size: 14px; color: #223; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.tk-meta { margin-top: 4px; font-size: 12px; color: var(--sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tk-meta .tk-who { color: #2f6bff; font-weight: 600; }
.tk-content { margin-top: 6px; font-size: 12.5px; color: #56637a; line-height: 1.65; white-space: pre-wrap; word-break: break-word; }
.tk-note { margin-top: 8px; font-size: 12.5px; color: #2f6bff; background: #f7faff; border-radius: 8px; padding: 7px 10px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.tk-note-in { margin-top: 8px; font-size: 12.5px; }
.tk-ops { flex: none; display: flex; flex-direction: column; gap: 5px; align-items: flex-end; }
.tk-ops .btn { font-size: 12px; padding: 4px 10px; margin: 0; }
.tk-link { border: 0; background: none; color: var(--sub); font-size: 12px; cursor: pointer; padding: 2px 4px; font-family: inherit; }
.tk-link:hover { color: var(--pri); }
.ch-ticket { display: inline-block; margin-left: 6px; font-size: 11.5px; font-weight: 600; color: #a35a12; background: #fff4e5; border-radius: 999px; padding: 2px 9px; vertical-align: 2px; cursor: pointer; }
.tk-modal { width: 520px; }
.tk-from { font-size: 12.5px; color: var(--sub); background: #f6f8fc; border-radius: 8px; padding: 8px 12px; margin-bottom: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#tkModal .grid2 select { width: 100%; margin-top: 5px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; color: var(--txt); background: #fff; }
