/* 接线端新版（C 悬浮卡片版，2026-11-20）
   只有接线端加载（desk/index.html 的 <html class="dc">），管理端不受影响。
   颜色全部用主题变量（--p 等），蓝 / 绿 / 紫三种主题色和深色模式都跟着变。 */
html.dc {
  --dc-ground: #edf0f5;                 /* 卡片下面的底色 */
  --dc-sh: 0 1px 2px rgba(16,24,40,.05), 0 0 0 1px rgba(16,24,40,.045);
  --dc-sh-up: 0 6px 20px rgba(16,24,40,.08), 0 0 0 1px rgba(16,24,40,.06);
  --dc-r: 16px;
  --dc-bub: #f2f4f7;                    /* 访客气泡 */
  --dc-sel: #151821;                    /* 列表选中 */
  --rail: #151821;
  --rail-ink: #9aa1ad;
  --subnav-ink: #fff;
}
html.dc[data-theme="dark"] {
  --dc-ground: #0d0f13;
  --dc-sh: 0 0 0 1px rgba(255,255,255,.05);
  --dc-sh-up: 0 8px 24px rgba(0,0,0,.45), 0 0 0 1px rgba(255,255,255,.07);
  --dc-bub: #23272f;
  --dc-sel: color-mix(in srgb, var(--p) 20%, var(--card));
  --rail: #0d0f13;
}
html.dc body, html.dc .main, html.dc .view { background: var(--dc-ground); }

/* ---------- 左边导航 ---------- */
html.dc .rail { border-right: 0; }
html.dc .rail-btn { border-radius: 12px; transition: background .2s var(--ease), color .2s, box-shadow .2s, transform .12s; }
html.dc .rail-btn:active { transform: scale(.94); }
html.dc .rail-btn:hover { background: rgba(255,255,255,.08); color: #fff; }
html.dc .rail-btn.on, html.dc .rail-btn.on:hover { background: var(--p); color: #fff; box-shadow: 0 4px 12px rgba(var(--p-rgb), .45); }
html.dc .rail-sep { background: rgba(255,255,255,.1); }
html.dc .rail-me .av .st { border-color: var(--rail); }

/* ---------- 顶部工作条：浮在底色上的胶囊 ---------- */
html.dc .wbar { background: transparent; border-bottom: 0; height: 56px; padding: 0 12px 0 12px; gap: 8px; }
html.dc .wb-st { height: 34px; border-radius: 999px; padding: 0 12px 0 13px; background: var(--card); box-shadow: var(--dc-sh); transition: box-shadow .2s, transform .12s; }
html.dc .wb-st:hover { filter: none; box-shadow: var(--dc-sh-up); }
html.dc .wb-st:active { transform: scale(.97); }
html.dc .wb-st.wst-busy { background: var(--card); color: var(--warn); }
html.dc .wb-st.wst-away, html.dc .wb-st.wst-offline { background: var(--card); color: var(--ink-3); }
html.dc .wb-site { height: 34px; border-radius: 999px; background: var(--card); box-shadow: var(--dc-sh); }
html.dc .wb-kpis:not(.st-text) { background: transparent; box-shadow: none; height: 34px; padding: 0; gap: 6px; overflow: visible; }
html.dc .wb-kpis:not(.st-text) .wb-kpi { height: 34px; padding: 0 13px; border-radius: 999px; background: color-mix(in srgb, var(--card) 72%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--line) 60%, transparent); }
html.dc .wb-kpis:not(.st-text) .wb-kpi + .wb-kpi::before { display: none; }
html.dc .wb-kpis.st-stack { height: 38px; }
html.dc .wb-kpis.st-stack .wb-kpi { height: 38px; border-radius: 12px; }
/* 正常的数字不用绿色（以前满屏绿字像报警）；慢了才变橙 / 红 */
html.dc .wb-kpi.good b, html.dc .wb-kpi.good svg.i { color: var(--ink) !important; }
html.dc .wb-kpi.good svg.i { color: var(--ink-3) !important; }
html.dc .wb-ring { height: 34px; border-radius: 999px; background: var(--card); box-shadow: var(--dc-sh); }
html.dc .wb-ring:hover { box-shadow: var(--dc-sh-up); }
html.dc .wb-search { height: 34px; border-radius: 999px; background: var(--card); box-shadow: var(--dc-sh); padding: 0 8px 0 14px; }
html.dc .wb-search:hover { box-shadow: var(--dc-sh-up); }
html.dc .wb-search .kbd { background: var(--fill); border-color: transparent; box-shadow: none; }
html.dc .wb-q { border-radius: 999px; background: var(--card); box-shadow: var(--dc-sh); }
html.dc .wb-q.on { background: var(--warn-soft); }

/* ---------- 三块卡片：会话列表 / 聊天 / 访客资料 ---------- */
html.dc .chats { padding-bottom: 12px; }
html.dc .clist, html.dc .chat-col { border-radius: var(--dc-r); box-shadow: var(--dc-sh); background: var(--card); overflow: hidden; }
/* 缝的宽度 --dcg 由 chats.js applyCols 算（窗口窄了自动变小），栏宽本身不受影响 */
html.dc .clist { border-right: 0; margin: 0 calc(var(--dcg, 12px) / 2) 0 var(--dcg, 12px); }
html.dc .chat-col { margin: 0 calc(var(--dcg, 12px) / 2); }
html.dc .chats.no-side .chat-col { margin-right: var(--dcg, 12px); }
html.dc .side { background: transparent; border-left: 0; margin: 0 var(--dcg, 12px) 0 calc(var(--dcg, 12px) / 2); gap: 12px; scrollbar-width: none; }
html.dc .side::-webkit-scrollbar { display: none; }
html.dc .col-rs::after { left: 2px; border-radius: 2px; }

/* 会话列表 */
html.dc .clist-hd { padding: 12px 12px 8px; }
html.dc .clist-hd .seg { border-radius: 12px; padding: 4px; background: var(--fill); box-shadow: none; }
html.dc .clist-hd .seg button { border-radius: 9px; height: 30px; transition: background .2s, color .2s, box-shadow .2s; }
html.dc .clist-search { padding: 0 12px 8px; }
html.dc .clist-search .input { height: 36px; border-radius: 10px; background: var(--fill); }
html.dc .clist-search .input:focus { background: var(--card); }
html.dc .clist-body { padding: 2px 8px 12px; }
html.dc .citem { border-radius: 12px; padding: 11px 12px; transition: background .18s, color .18s; }
html.dc .citem:hover { background: var(--hover); }
html.dc .citem.on { background: var(--dc-sel); }
html.dc .citem.on::before { display: none; }
/* 浅色：选中的那一条用深色底白字，一眼找到正在聊的人 */
html.dc:not([data-theme="dark"]) .citem.on .nm { color: #fff; }
html.dc:not([data-theme="dark"]) .citem.on .tm,
html.dc:not([data-theme="dark"]) .citem.on .pv { color: rgba(255,255,255,.66); }
html.dc:not([data-theme="dark"]) .citem.on .pv.typing { color: #a9c0ff; }
html.dc:not([data-theme="dark"]) .citem.on.unread .pv { color: #fff; }
html.dc:not([data-theme="dark"]) .citem.on .l1s { background: rgba(255,255,255,.12); color: #e5e7eb; box-shadow: none; }
html.dc:not([data-theme="dark"]) .citem.on .l1s b { color: #e5e7eb; }
html.dc:not([data-theme="dark"]) .citem.on .replied-tag { background: rgba(108,233,166,.14); color: #6ce9a6; }
html.dc:not([data-theme="dark"]) .citem.on .wait { color: #fdb022; }
html.dc:not([data-theme="dark"]) .citem.on .wait.long { color: #ff8a80; }
html.dc:not([data-theme="dark"]) .citem.on .agent-chip,
html.dc:not([data-theme="dark"]) .citem.on .muted { color: rgba(255,255,255,.66); }
html.dc:not([data-theme="dark"]) .citem.on .tag,
html.dc:not([data-theme="dark"]) .citem.on .lang-chip { background: rgba(255,255,255,.12); color: #e5e7eb; box-shadow: none; }
html.dc:not([data-theme="dark"]) .citem.on .av .st { border-color: var(--dc-sel); }

/* ---------- 聊天区 ---------- */
html.dc .chat { background: var(--card); }
html.dc .chat-hd { height: 68px; padding: 0 16px 0 20px; border-bottom: 1px solid var(--line-2); gap: 12px; }
html.dc .chat-hd > .av { width: 42px; height: 42px; font-size: 15px; }
html.dc .chat-hd .who b { gap: 8px; }
html.dc .chat-hd .who b .hd-nm { font-size: 16px; letter-spacing: -.01em; }
html.dc .chat-hd .site-chip.lg { height: 22px; border-radius: 999px; font-size: 12px; padding: 0 9px 0 8px; }
html.dc .chat-hd .online-pill { font-size: 12px; }
/* 顶部按钮：圆角胶囊，统一 34 高；"结束"浅红底 */
html.dc .chat-hd .acts { gap: 6px; }
html.dc .hd-ib { width: 32px; height: 32px; border: 0; border-radius: 999px; background: var(--fill); color: var(--ink-2); transition: background .18s, color .18s, transform .12s, box-shadow .18s; }
html.dc .hd-ib:hover { background: var(--hover); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
html.dc .hd-ib:active { transform: scale(.95); }
html.dc .hd-ib svg.i { width: 16px; height: 16px; }
html.dc .hd-ib.bad { background: var(--bad-soft); color: var(--bad); }
html.dc .hd-ib.bad:hover { background: color-mix(in srgb, var(--bad) 16%, var(--card)); box-shadow: none; }
html.dc .hd-ib.on { background: var(--p-soft); color: var(--p); }
html.dc .hd-div { height: 20px; margin: 0 4px; background: var(--line); }
html.dc .chat-hd .acts .btn.sm, html.dc .hd-inj { height: 32px; border-radius: 999px; }

/* 识别到的订单号 / 单号 / 账号：置顶的一张卡片，大号等宽字，好核对好复制 */
html.dc .hd-pinw { flex: none; display: flex; align-items: center; gap: 12px; margin: 12px 16px 0; padding: 8px 10px 8px 10px; border-radius: 12px;
  background: color-mix(in srgb, var(--p) 6%, var(--card)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--p) 18%, transparent); animation: fadeUp .25s var(--ease); }
html.dc .hd-pinw[hidden] { display: none; }
html.dc .hd-pin-ic { width: 32px; height: 32px; flex: none; border-radius: 9px; background: var(--card); color: var(--p); display: grid; place-items: center; box-shadow: 0 1px 2px rgba(var(--p-rgb), .14); }
html.dc .hd-pin-ic svg.i { width: 16px; height: 16px; }
html.dc .hd-pin { flex: 1; min-width: 0; display: flex; align-items: center; gap: 0; overflow-x: auto; scrollbar-width: none; }
html.dc .hd-pin::-webkit-scrollbar { display: none; }
html.dc .hd-pin .hd-fact { height: auto; max-width: none; background: none; box-shadow: none; border-radius: 0; display: grid; grid-template-columns: auto auto; grid-template-rows: auto auto; column-gap: 10px; align-items: center; padding: 0 16px; overflow: visible; }
html.dc .hd-pin .hd-fact:first-child { padding-left: 0; }
html.dc .hd-pin .hd-fact em { grid-column: 1; grid-row: 1; background: none; border: 0; padding: 0; font-size: 11.5px; line-height: 1.3; color: color-mix(in srgb, var(--p) 70%, var(--ink-2)); justify-self: start; }
html.dc .hd-pin .hd-fact b { grid-column: 1; grid-row: 2; padding: 0; font-family: inherit; font-variant-numeric: tabular-nums; font-size: 15px; font-weight: 600; line-height: 1.35; letter-spacing: .02em; color: var(--ink); white-space: nowrap; overflow: visible; }
html.dc .hd-pin .hd-fact .hd-cp { grid-column: 2; grid-row: 1 / 3; width: auto; height: 30px; padding: 0 11px 0 9px; margin: 0; border-radius: 999px; background: var(--card); color: var(--p); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--p) 22%, transparent); display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 500; transition: background .18s, transform .12s; }
html.dc .hd-pin .hd-fact .hd-cp::after { content: "复制"; }
html.dc .hd-pin .hd-fact .hd-cp:hover { background: var(--p-soft); }
html.dc .hd-pin .hd-fact .hd-cp:active { transform: scale(.95); }
html.dc .hd-pin .hd-fact .hd-cp svg.i { width: 13px; height: 13px; }
/* 有好几条时，复制按钮缩成图标，省地方 */
html.dc .hd-pin .hd-fact:not(:only-child) .hd-cp { width: 28px; height: 28px; padding: 0; justify-content: center; }
html.dc .hd-pin .hd-fact:not(:only-child) .hd-cp::after { content: none; }

/* 消息 */
html.dc .msgs { background: var(--card); padding: 18px 28px 12px; }
html.dc .m { margin: 4px 0; }
html.dc .m .bb { background: var(--dc-bub); box-shadow: none; border-radius: 18px; border-bottom-left-radius: 6px; padding: 10px 15px; }
html.dc .m.me .bb { background: var(--p); border-radius: 18px; border-bottom-right-radius: 6px; border-top-right-radius: 18px; box-shadow: 0 2px 6px rgba(var(--p-rgb), .2); }
html.dc .m .bb.img { background: var(--card) !important; box-shadow: 0 0 0 1px var(--line) !important; border-radius: 14px; }
html.dc .m .meta { margin: 4px 6px 0; color: var(--ink-3); }
html.dc .m .meta .recall-btn { color: var(--ink-3); transition: color .15s; }
html.dc .m .meta .recall-btn:hover { color: var(--p); }
html.dc .m-sep { width: max-content; margin: 18px auto 12px; padding: 3px 12px; border-radius: 999px; background: var(--fill); font-size: 11.5px; color: var(--ink-3); }
html.dc .m-sep::before, html.dc .m-sep::after { display: none; }
html.dc .m-sys span { background: transparent; color: var(--ink-3); padding: 2px 4px; }
html.dc .v-typing .bb { background: var(--dc-bub); border: 0; border-radius: 18px; border-bottom-left-radius: 6px; padding: 9px 14px; font-style: normal; color: var(--ink-3); }

/* 输入框：浮起来的卡片 */
html.dc .composer { padding: 0 16px 16px; }
html.dc .cbox { border-radius: 16px; box-shadow: var(--dc-sh-up); transition: box-shadow .2s var(--ease); }
html.dc .cbox:focus-within { box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--p) 70%, transparent), 0 8px 24px rgba(var(--p-rgb), .12); }
html.dc .cbox.note-mode:focus-within { box-shadow: 0 0 0 1.5px #e9b949, 0 8px 24px rgba(217,119,6,.12); }
html.dc .c-tabs { padding: 10px 12px 0; gap: 4px; }
html.dc .c-tab { border-radius: 999px; padding: 4px 11px; transition: background .18s, color .18s; }
html.dc .c-foot { padding: 4px 10px 10px 8px; }
html.dc .c-foot > .icon-btn, html.dc .c-foot > label.icon-btn { border-radius: 10px; }
html.dc .c-foot #csend { height: 36px; border-radius: 999px; padding: 0 18px 0 15px; box-shadow: 0 4px 12px rgba(var(--p-rgb), .3); transition: box-shadow .2s, transform .12s, opacity .2s; }
html.dc .c-foot #csend:active:not(:disabled) { transform: scale(.96); }
html.dc .c-foot #csend:disabled { box-shadow: none; }

/* ---------- 右边：一块块小卡片 ---------- */
html.dc .side > .stabs.top { flex: none; border-radius: var(--dc-r); box-shadow: var(--dc-sh), 0 12px 0 var(--dc-ground); border-bottom: 0; padding: 6px; background: var(--card); }
html.dc .stabs.top button { border-radius: 10px; }
html.dc .stabs.top button.on { background: var(--fill); color: var(--ink); }
html.dc[data-theme="dark"] .stabs.top button.on { background: var(--hover); }
html.dc .side > .spane { background: var(--card); border-radius: var(--dc-r); box-shadow: var(--dc-sh); flex: none; }
html.dc .side > .spane[data-sp=sum] { flex: 1; }
html.dc .side > .spane[data-sp=info] { background: transparent; box-shadow: none; display: flex; flex-direction: column; gap: 12px; }
html.dc .side > .spane[data-sp=info][hidden] { display: none; }
html.dc .spane[data-sp=info] > * { background: var(--card); border-radius: var(--dc-r); box-shadow: var(--dc-sh); border-bottom: 0 !important; }
html.dc .spane[data-sp=info] > .vcard { padding: 18px 18px 16px; }
html.dc .spane[data-sp=info] > .side-sec { padding: 16px 18px; }
html.dc .spane[data-sp=info] > .side-blk { margin: 0; background: var(--bad-soft); box-shadow: none; }
html.dc .vc-hd .av { width: 48px; height: 48px; font-size: 17px; }
html.dc .vc-kv { gap: 9px 10px; }
html.dc .side-sec h4 { color: var(--ink); font-size: 12.5px; letter-spacing: 0; margin-bottom: 10px; }
html.dc .add-tag { border-radius: 999px; }
html.dc .spane[data-sp=info] > :last-child { margin-bottom: 0; }

@media (max-width: 1100px) { html.dc .wbar { padding: 0 8px; } }
@media (prefers-reduced-motion: reduce) { html.dc .hd-pinw { animation: none; } }
/* 列表第二行：状态（已回复 / 等待时长 / 未读）不被挤掉，预览文字先省略 */
html.dc .citem .l2 > .l1c { flex: none; overflow: visible; }
html.dc .citem .l2 > .pv { min-width: 0; }
/* 好几条关键信息：换行排，不横着滚（以前后面的订单号会被挡住） */
html.dc .hd-pin { flex-wrap: wrap; gap: 8px 28px; overflow: visible; }
html.dc .hd-pin .hd-fact { padding: 0 !important; }
html.dc .hd-pin .hd-fact:not(:only-child) b { font-size: 14px; }
/* 选中那一条里的等待时长：别用白底框 */
html.dc:not([data-theme="dark"]) .citem.on .wait { background: rgba(255,255,255,.1); box-shadow: none; border-color: transparent; }
html.dc:not([data-theme="dark"]) .citem.on .wtimer { background: rgba(255,255,255,.12); color: #e5e7eb; }
html.dc:not([data-theme="dark"]) .citem.on .wtimer.warn { background: rgba(253,176,34,.18); color: #fdb022; }
html.dc:not([data-theme="dark"]) .citem.on .wtimer.bad { background: rgba(255,138,128,.18); color: #ff8a80; }
