/* ============================================================================
   聚合客服台 · 商户端布局（按设计稿 1:1 落地）
   外壳：左侧栏 + 顶栏（标题 / 已连接 / 到期 / 刷新 / 切换主题）+ 内容区。
   会话页是一张圆角大卡：左会话列表 + 右对话，内部各自滚动。
   ========================================================================== */

/* ── 图标尺寸档 ──────────────────────────────────────────────────────────
   恒定物理笔画：stroke-width = 24 / 显示尺寸 × 1.5，所以任何尺寸下线条粗细都是 1.5px。
   基础属性写全（不只挂在 .ic 上）：单用 .ic-lg 时否则会吃浏览器默认的 fill:black 被涂黑。 */
.ic, .ic-sm, .ic-tiny, .ic-lg, .ic-xl { flex: none; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; }
.ic { width: 18px; height: 18px; stroke-width: 2; }
.ic-sm { width: 14px; height: 14px; stroke-width: 2.6; }
.ic-tiny { width: 12px; height: 12px; stroke-width: 3; }
.ic-lg { width: 30px; height: 30px; stroke-width: 1.2; }
.ic-xl { width: 44px; height: 44px; stroke-width: 0.8; }

/* ── 登录 ───────────────────────────────────────────────────────────────── */
.login-wrap {
  position: relative;
  min-height: 100dvh; display: flex; align-items: center; justify-content: center;
  padding: 24px; overflow: hidden;
  background: var(--bg);
}
.login-wrap .login-bg { position: absolute; inset: 0; pointer-events: none; }
.login-wrap .login-bg::before,
.login-wrap .login-bg::after { content: ""; position: absolute; border-radius: var(--r-circle); filter: blur(90px); }
.login-wrap .login-bg::before {
  width: 640px; height: 640px; left: -160px; top: -200px;
  background: radial-gradient(circle, color-mix(in srgb, var(--brand) 28%, transparent), transparent 65%);
}
.login-wrap .login-bg::after {
  width: 720px; height: 720px; right: -220px; bottom: -280px;
  background: radial-gradient(circle, color-mix(in srgb, var(--qq) 16%, transparent), transparent 62%);
}
.login-wrap .login-grid {
  position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: linear-gradient(var(--line-2) 1px, transparent 1px), linear-gradient(90deg, var(--line-2) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 72% 62% at 50% 42%, #000 18%, transparent 76%);
  -webkit-mask-image: radial-gradient(ellipse 72% 62% at 50% 42%, #000 18%, transparent 76%);
}
.login-card {
  position: relative;
  width: 100%; max-width: 396px; padding: 40px 36px 30px;
  background: var(--card);
  border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-2);
  text-align: center;
  animation: loginIn var(--dur-4) var(--ease) both;
}
@keyframes loginIn { from { opacity: 0; transform: translateY(12px); } }
.login-card h1 { font-size: 21px; letter-spacing: .04em; }
.login-card .login-tag { margin-top: 7px; font-size: 12.5px; color: var(--ink-3); letter-spacing: .26em; }
.login-card .field { text-align: left; }
.login-fields { margin-top: 28px; display: flex; flex-direction: column; gap: 16px; }
.login-card .btn-lg { margin-top: 4px; letter-spacing: .3em; text-indent: .3em; }
.login-hint { margin-top: 20px; font-size: 12.5px; color: var(--ink-3); }
.login-hint a { color: var(--ink-2); }
.login-mark {
  width: 54px; height: 54px; margin: 0 auto 16px;
  border-radius: 17px; display: flex; align-items: center; justify-content: center;
  /* ★ 2026-10-03：标记本体已经是品牌渐变的圆角方块（内联 SVG 自带底色），
     外框不再套一个空盒子，只留一层品牌色柔光。 */
  box-shadow: 0 16px 30px -16px color-mix(in srgb, var(--brand) 85%, transparent);
}
.login-mark svg { width: 54px; height: 54px; display: block; border-radius: 17px; }
.login-mark.sm { width: 38px; height: 38px; border-radius: var(--r-sm); margin: 0; }
.login-mark.sm svg { width: 38px; height: 38px; border-radius: var(--r-sm); }

/* 主题切换（登录页右上角） */
.theme-fab { position: absolute; top: 18px; right: 20px; z-index: 5; }
.theme-fab .btn { border-radius: var(--r-pill); background: var(--card); }

/* ── 外壳（设计稿的 .shell） ────────────────────────────────────────────── */
.app { display: grid; grid-template-columns: 236px minmax(0, 1fr); height: 100dvh; background: var(--bg); }

.side {
  display: flex; flex-direction: column; min-height: 0;
  background: var(--card); border-right: 1px solid var(--line-2);
  padding: 20px 14px 14px;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 20px; }
.brand .grow { min-width: 0; }
.brand-name { font-size: 15px; font-weight: 650; letter-spacing: .02em; }
.brand-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 1px; }

.nav-label { padding: 14px 10px 8px; font-size: 11px; letter-spacing: .18em; color: var(--ink-3); }
.nav { display: flex; flex-direction: column; gap: 3px; flex: 1; overflow: auto; }
.nav a {
  position: relative;
  display: flex; align-items: center; gap: 11px;
  height: 42px; padding: 0 11px; border-radius: var(--r-sm);
  color: var(--ink-2); font-size: 14px; font-weight: 560;
  transition: background var(--t), color var(--t), box-shadow var(--t);
  text-decoration: none;
}
.nav a:hover { background: var(--hover); color: var(--ink); text-decoration: none; }
.nav a.on {
  color: var(--ink);
  background: linear-gradient(90deg, color-mix(in srgb, var(--brand) 16%, transparent), color-mix(in srgb, var(--brand) 5%, transparent));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 22%, transparent);
}
.nav a.on::before {
  content: ""; position: absolute; left: -14px; top: 11px; bottom: 11px; width: 3px;
  /* 当前页的签名色，不用品牌渐变：导航有 6 个入口，每条都渐变色会变成彩虹 */
  border-radius: 0 var(--r-xs) var(--r-xs) 0; background: var(--nav-c, var(--brand));
}
.nav a .count { margin-left: auto; }
.nav a .ic { opacity: .92; }

.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding-top: 14px; border-top: 1px solid var(--line-2); }
.who {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px; border: 0; border-radius: var(--r-sm); background: transparent; cursor: pointer;
  transition: background var(--t); min-width: 0; text-align: left; color: inherit;
}
.who:hover { background: var(--hover); }
.who b { display: block; font-size: 13.5px; font-weight: 600; }
.who i { font-style: normal; font-size: 11.5px; color: var(--ink-3); }
.state { display: flex; align-items: center; gap: 8px; padding: 0 10px; font-size: 12px; color: var(--ink-3); }
.state .dot { width: 7px; height: 7px; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.top {
  display: flex; align-items: center; gap: 12px; flex: none;
  height: 64px; padding: 0 26px;
  background: color-mix(in srgb, var(--card) 80%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-2);
}
.top h1 { font-size: 17px; font-weight: 650; letter-spacing: .01em; }
.view { flex: 1; min-height: 0; overflow: auto; padding: 24px 26px 40px; }
.view.flush { padding: 22px 26px; overflow: hidden; }

/* 顶栏胶囊（已连接 / 到期） */
.conn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 34px; padding: 0 13px; border-radius: var(--r-pill);
  border: 1px solid var(--line); background: var(--field);
  font-size: 12.5px; color: var(--ink-2); white-space: nowrap;
}
.conn .dot { width: 6px; height: 6px; box-shadow: none; }
.conn:has(.dot-ok) { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 32%, transparent); background: var(--ok-soft); }
.conn:has(.dot-warn) { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 32%, transparent); background: var(--warn-soft); }
.conn:has(.dot-err) { color: var(--err); border-color: color-mix(in srgb, var(--err) 32%, transparent); background: var(--err-soft); }
.conn.expired { color: var(--err); border-color: color-mix(in srgb, var(--err) 32%, transparent); background: var(--err-soft); }

.pad { padding: 20px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.grid-2 { display: grid; grid-template-columns: 1.55fr 1fr; gap: 14px; }

/* ── 数据面板（设计稿的 .stats / .grid2 / .card / .bars / .chs） ────────── */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.stat { background: var(--card); border: 1px solid var(--line-2); border-radius: var(--r); padding: 18px 18px 15px; box-shadow: var(--shadow-1); }
.stat .k { font-size: 12.5px; color: var(--ink-3); display: flex; align-items: center; gap: 7px; }
.stat .v { font-size: 30px; font-weight: 650; letter-spacing: .4px; margin: 6px 0 3px; font-variant-numeric: tabular-nums; }
.stat .d { font-size: 12px; color: var(--ink-2); }
.stat .d b { color: var(--ok); font-weight: 600; }

.card { background: var(--card); border: 1px solid var(--line-2); border-radius: var(--r); box-shadow: var(--shadow-1); }
.card .hd { display: flex; align-items: center; gap: 9px; padding: 16px 18px; border-bottom: 1px solid var(--line-2); }
.card .hd b { font-size: 14px; font-weight: 600; }
.card .hd i { font-style: normal; font-size: 12px; color: var(--ink-3); }
.card .bd { padding: 18px; }

.bars { display: flex; align-items: flex-end; gap: 18px; height: 190px; padding-top: 8px; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; min-width: 0; }
.bar i { width: 100%; max-width: 46px; border-radius: 8px 8px 4px 4px; background: linear-gradient(180deg, var(--brand), color-mix(in srgb, var(--brand) 25%, transparent)); transition: filter var(--t); }
.bar:hover i { filter: brightness(1.12); }
.bar.hot i { background: linear-gradient(180deg, var(--qq), var(--brand)); }
.bar span { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; }

.chs { display: grid; gap: 10px; }
.chrow { display: flex; align-items: center; gap: 12px; padding: 13px 14px; border-radius: var(--r); border: 1px solid var(--line-2); background: var(--card-2); }
.chrow .ic-wrap { width: 34px; height: 34px; border-radius: var(--r-sm); display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff; flex: none;
  background: linear-gradient(145deg, color-mix(in srgb, var(--c) 92%, #fff), color-mix(in srgb, var(--c) 78%, #000)); }
.chrow b { display: block; font-size: 13.5px; }
.chrow i { font-style: normal; font-size: 11.5px; color: var(--ink-3); }
.chrow .pill { margin-left: auto; }

/* ── 对话（设计稿的 .chat / .convs / .thread / .composer） ─────────────── */
.chat {
  display: grid; grid-template-columns: 320px minmax(0, 1fr);
  height: 100%; min-height: 0;
  border: 1px solid var(--line-2); border-radius: var(--r); overflow: hidden;
  background: var(--card); box-shadow: var(--shadow-1);
}
.convs { border-right: 1px solid var(--line-2); display: flex; flex-direction: column; min-height: 0; }
.convs .hd { display: flex; align-items: center; gap: 10px; padding: 15px 16px; border-bottom: 1px solid var(--line-2); flex: none; }
.convs .hd b { font-size: 14px; }
.convs .hd .pill { height: 22px; padding: 0 8px; }
.convs .hd .sbox {
  flex: 1; min-width: 0; height: 32px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--field); color: var(--ink);
  font-size: 12.5px; padding: 0 11px; outline: none;
}
.convs .hd .sbox::placeholder { color: var(--ink-3); }
.convs .hd .sbox:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
.convs-tools { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line-2); flex: none; }
.convs-tools .seg { flex: none; }
.convs-tools .seg button { white-space: nowrap; }
.convs-tools .select { width: auto; max-width: 180px; flex: none; height: 30px; min-height: 30px; padding: 2px 30px 2px 10px; font-size: 12.5px; border-radius: var(--r-sm); }
/* ── 会话列表（结构/尺寸照 workBuddy 的 .conv 网格，颜色走我们的令牌）────────
   行 = 头像 | 名字+标识（群/已结束/置顶）/ 预览 | 时间 / 通道胶囊+未读 */
.conv-list { list-style: none; margin: 0; padding: 4px 0 10px; flex: 1; overflow-y: auto; min-height: 0; }
.conv-list > li { margin: 0 8px 2px; border-radius: var(--r-sm); }
.conv-list > li:nth-child(odd) { background: rgba(17, 24, 39, .02); }
.conv-list > li:hover { background: var(--hover); }

.conv {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-rows: auto auto;
  gap: 4px 12px; align-items: center; width: 100%; position: relative;
  padding: 12px 10px 12px 12px; text-align: left; color: inherit; font: inherit;
  background: none; border: 0; border-radius: var(--r-sm); cursor: pointer;
  transition: background var(--t);
}
.conv > .avatar { grid-row: 1 / 3; grid-column: 1; align-self: center; }
.conv-top { grid-column: 2; grid-row: 1; display: flex; align-items: center; gap: 8px; min-width: 0; }
.conv-who { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-time { grid-column: 3; grid-row: 1; font-size: 11px; color: var(--ink-3); white-space: nowrap; }
.conv-last { grid-column: 2; grid-row: 2; font-size: 12.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-side { grid-column: 3; grid-row: 2; display: flex; align-items: center; gap: 8px; justify-self: end; }

/* 选中那条：一片淡底 + 左边一道 2px 背光（照 workBuddy） */
.conv[aria-selected="true"] { background: linear-gradient(90deg, color-mix(in srgb, var(--brand) 13%, transparent), transparent 82%); }
.conv[aria-selected="true"]::before {
  content: ""; position: absolute; left: 0; top: 6px; bottom: 6px; width: 2px;
  border-radius: 0 2px 2px 0; background: var(--brand);
}

/* 通道胶囊（照 workBuddy 的 .badge：外框和字都用通道本色） */
.conv .badge {
  display: inline-block; height: auto; padding: 1px 8px; border-radius: var(--r-xs);
  font-size: 10.5px; line-height: 1.7; font-weight: 600;
  border: 1px solid currentColor; background: none; opacity: .9; white-space: nowrap;
}
/* 已结束才摆胶囊；进行中不占位（状态移到聊天窗口上边那颗） */
.conv .conv-status {
  display: inline-flex; align-items: center; flex: none; padding: 0 6px; border-radius: var(--r-pill);
  font-size: 10.5px; line-height: 1.6; border: 1px solid var(--line); color: var(--ink-3); white-space: nowrap;
}
.conv-pin { display: none; opacity: .85; margin-left: 2px; line-height: 0; }
.conv[data-pinned="1"] .conv-pin { display: inline-block; }
/* 尺寸档统一在文件头的 .ic 家族里定义（旧这里又写了一份 .ic-tiny，导致 token 与覆盖打架） */
.attach { display: inline-flex; align-items: center; gap: 6px; }
.attach .ic { width: 15px; height: 15px; stroke-width: 2.4; }

/* ★【2026-10-13】语音气泡：紧凑自绘播放器（结构对齐参考实现的 .voice-player）。
   原生 <audio controls> 是 260×54 的横条，气泡比一句话还大 —— 换成 播放键 + 进度条 + 时长。 */
.voice-player {
  display: inline-flex; align-items: center; gap: 8px;
  min-width: 132px; max-width: 208px; padding: 3px 10px 3px 3px;
  border-radius: var(--r-pill); background: rgba(127, 127, 127, .16); cursor: pointer;
  user-select: none;
}
.voice-player audio { display: none; }
.voice-play-btn {
  flex: 0 0 auto; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  background: var(--c, var(--brand)); color: #fff;
}
.voice-play-btn .ic { width: 14px; height: 14px; }
.voice-wave-bar {
  flex: 1 1 auto; height: 4px; border-radius: 2px;
  background: rgba(127, 127, 127, .32); overflow: hidden;
}
.voice-wave-fill {
  height: 100%; width: 0; border-radius: 2px;
  background: var(--c, var(--brand)); transition: width .15s linear;
}
.voice-duration { flex: 0 0 auto; font-size: 11.5px; opacity: .72; min-width: 22px; text-align: right; }
.attach-note { margin-top: 5px; font-size: 11.5px; line-height: 1.5; opacity: .72; }

.conv .unread {
  min-width: 19px; height: 19px; padding: 0 5px; border-radius: var(--r-pill);
  display: grid; place-items: center; font-family: var(--mono);
  font-size: 10.5px; font-weight: 700; background: #f472b6; color: #3a0a1e;
}

.thread { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--card-2); }
.thread-empty { flex: 1; display: flex; align-items: center; justify-content: center; }

.thread-head { display: flex; align-items: center; gap: 12px; flex: none; padding: 13px 18px; border-bottom: 1px solid var(--line-2); background: var(--card); }
.thread-head .nm { font-weight: 650; font-size: 14.5px; }
.thread-back { display: none; }

.msgs { flex: 1; overflow: auto; padding: 22px 26px; min-height: 0; display: flex; flex-direction: column; gap: 3px; }
.msgs-more { text-align: center; padding: 4px 0 14px; }

.msg { display: flex; gap: 10px; max-width: min(680px, 78%); margin: 4px 0; }
.msg.in { align-self: flex-start; }
.msg.out { align-self: flex-end; flex-direction: row-reverse; }
.msg .av { flex: none; margin-top: 2px; }
.bubble {
  padding: 11px 15px; border-radius: var(--r); font-size: 14px; line-height: 1.65;
  word-break: break-word; white-space: pre-wrap;
  background: var(--card); border: 1px solid var(--line-2); box-shadow: var(--shadow-1);
  border-bottom-left-radius: 5px;
}
.msg.out .bubble {
  /* 发出的消息用品牌纯色：整屏十几颗渐变气泡会起带状色阶，反而显脏 */
  background: var(--brand); color: #fff; border-color: transparent;
  border-bottom-left-radius: 14px; border-bottom-right-radius: 5px;
  box-shadow: 0 10px 24px -14px var(--ring);
}
.bubble img { border-radius: var(--r-sm); max-width: 200px; max-height: 200px; width: auto; height: auto; margin-top: 2px; cursor: zoom-in; }
.bubble video { border-radius: var(--r-sm); max-width: 220px; max-height: 200px; margin-top: 2px; }
/* 点开的大图：铺满视口、不裁切；点任意处 / Esc 关掉 */
#img-lightbox { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center; padding: 18px; background: rgba(0, 0, 0, .86); cursor: zoom-out; }
#img-lightbox img { max-width: 92vw; max-height: 88vh; width: auto; height: auto; border-radius: var(--r-sm); cursor: default; }
.bubble a { color: inherit; text-decoration: underline; }
.msg-foot { display: flex; align-items: center; gap: 7px; margin-top: 5px; font-size: 11px; color: var(--ink-3); }
.msg.out .msg-foot { justify-content: flex-end; }
.msg-fail { color: var(--err); font-weight: 600; cursor: pointer; }
/**
 * ★【2026-10-15】失败原因：以前只挂在「发送失败 · 重发」按钮的 title 上 ——
 * 要**悬停**才看得见，而手机上根本没有悬停，商户只能猜。
 * 现在直接显示在气泡下面。几个约束：
 *   · 不放进 .msg-foot（那是 flex 单行，长句会被挤成一条）—— 单独一行、可换行；
 *   · 出站气泡在右侧，所以右对齐，跟着气泡走；
 *   · 颜色用 --ink-2 而不是 --err：整段话染成红色太吵，而「失败」这件事
 *     按钮那行已经用红色说过了，这里要的是**读得下去**。
 */
.msg-fail-why { margin-top: 4px; max-width: 100%; font-size: 11px; line-height: 1.6; color: var(--ink-2); text-align: right; word-break: break-word; }
.msg-time { font-variant-numeric: tabular-nums; }

.day-sep { align-self: center; margin: 14px 0 10px; font-size: 11.5px; color: var(--ink-3); background: var(--card); border: 1px solid var(--line); padding: 3px 12px; border-radius: var(--r-pill); }
.sys-msg { align-self: center; max-width: 82%; font-size: 11.5px; color: var(--ink-3); background: var(--card); border: 1px dashed var(--line); padding: 5px 13px; border-radius: var(--r-pill); margin: 6px 0; }

/* 回复窗口条（设计稿里 composer 上面那行提示） */
.win-bar {
  display: flex; align-items: center; gap: 9px; flex: none; flex-wrap: wrap;
  padding: 9px 18px; font-size: 12.5px;
  background: var(--warn-soft); border-top: 1px solid color-mix(in srgb, var(--warn) 22%, transparent);
  color: var(--ink-2);
}
.win-bar.ok { background: transparent; border-top: 1px solid var(--line-2); }
.win-bar.ok svg { color: var(--ok); }
.win-bar.dead { background: var(--err-soft); border-top-color: color-mix(in srgb, var(--err) 22%, transparent); }
.win-bar.dead svg { color: var(--err); }
/* 通道在难受（重连中 / 线路差 / 连续失败）：不拦发信，但要让商户看得见 */
.win-bar.warn { background: var(--warn-soft); border-top-color: color-mix(in srgb, var(--warn) 22%, transparent); }
.win-bar.warn svg { color: var(--warn); }
/* 主条下面的提醒行：通道不稳 / 24 小时内有没发出去的 / 这一分钟发得太密 */
.win-bar .row2 { display: flex; align-items: center; gap: 8px; flex-basis: 100%; font-size: 12px; color: var(--ink-2); }
.win-bar .row2 svg { flex: none; color: var(--warn); }
.win-bar .row2.bad { color: var(--err); }
.win-bar .row2.bad svg { color: var(--err); }
.win-bar .grow { min-width: 0; }
.win-bar b { font-variant-numeric: tabular-nums; color: var(--ink); }

.qbar { flex: 0 1 150px; height: 4px; border-radius: var(--r-xs); background: var(--field); overflow: hidden; }
.qbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--ok), var(--qq)); }

/* 输入区（设计稿的 .composer / .cbox） */
.composer { flex: none; padding: 12px 18px 16px; background: var(--card); border-top: 1px solid var(--line-2); }
.cbox { display: flex; gap: 10px; align-items: flex-end; }
.cbox textarea {
  flex: 1; min-height: 46px; max-height: 200px; resize: none;
  border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--field);
  color: var(--ink); padding: 12px 14px; font: inherit; line-height: 1.6; outline: none;
  transition: border-color var(--t), box-shadow var(--t), background var(--t);
}
.cbox textarea:focus { border-color: var(--brand); background: var(--card); box-shadow: 0 0 0 4px var(--ring); }
.cbox .btn { height: 46px; padding: 0 22px; }
.composer-tools { display: flex; align-items: center; gap: 6px; margin-top: 8px; }

.chips { display: flex; gap: 6px; overflow-x: auto; padding: 0 0 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; padding: 5px 11px; border-radius: var(--r-pill); font-size: 12.5px;
  background: var(--card); border: 1px solid var(--line); color: var(--ink-2);
  cursor: pointer; transition: border-color var(--t), box-shadow var(--t); max-width: 220px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chip:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }

.attach-preview { display: flex; align-items: center; gap: 9px; padding: 8px 10px; margin-bottom: 8px; background: var(--field); border-radius: var(--r-sm); font-size: 12.5px; }
.attach-preview img { width: 40px; height: 40px; border-radius: var(--r-xs); object-fit: cover; }

/* ── 渠道管理（设计稿的 .chcards / .chcard / .qrwrap） ──────────────────── */
.chcards { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.chcard { background: var(--card); border: 1px solid var(--line-2); border-radius: var(--r); padding: 20px; box-shadow: var(--shadow-1); position: relative; overflow: hidden; }
.chcard.active { border-color: color-mix(in srgb, var(--c, var(--wx)) 45%, transparent); }
.chcard.active::before { content: ""; position: absolute; inset: 0 0 auto; height: 2px; background: linear-gradient(90deg, var(--c, var(--wx)), transparent 70%); }
.chcard h3 { font-size: 16px; font-weight: 650; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.chcard .desc { font-size: 12.5px; color: var(--ink-2); margin: 9px 0 14px; line-height: 1.7; }
.chcard .tags { display: flex; flex-wrap: wrap; gap: 7px; }
.tagc { font-size: 11.5px; padding: 4px 10px; border-radius: var(--r-pill); border: 1px solid var(--line); color: var(--ink-2); background: transparent; }
.tagc.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 30%, transparent); background: var(--ok-soft); }
.tagc.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, transparent); background: var(--warn-soft); }
.chcard .big { margin-top: 16px; width: 100%; height: 40px; border-radius: var(--r-sm); font-size: 13.5px; }

.qrwrap { display: grid; grid-template-columns: 1.1fr 1fr; gap: 18px; align-items: center; }
.qr-stage { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 22px; border-radius: var(--r); background: var(--card-2); border: 1px dashed var(--line); }
.qr-stage:empty { display: none; }
/* 只放大「二维码本身」（stage 的直接子元素）；不能写成 .qr-stage svg ——
   那会把提示框里的小图标也撑成 220×220 的白方块（生产上出现过）。 */
.qr-stage > img, .qr-stage > svg { width: 220px; height: 220px; border-radius: var(--r); background: #fff; padding: 8px; box-shadow: var(--shadow-1); }
.qr-stage.small > img, .qr-stage.small > svg { width: 168px; height: 168px; }
.qr-note { text-align: center; font-size: 12.5px; color: var(--ink-2); max-width: 330px; line-height: 1.7; }

.code-line { display: flex; align-items: center; gap: 8px; padding: 9px 12px; background: var(--field); border: 1px solid var(--line); border-radius: var(--r-sm); }
.code-line code { font-family: var(--mono); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; color: var(--ink-2); }

.kv { display: grid; grid-template-columns: 82px 1fr; gap: 6px 12px; font-size: 12.5px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; overflow: hidden; text-overflow: ellipsis; }

.ch-card { display: flex; flex-direction: column; overflow: hidden; }
.ch-top { display: flex; align-items: flex-start; gap: 13px; padding: 20px 20px 14px; }
.ch-body { padding: 0 20px 18px; display: flex; flex-direction: column; gap: 14px; }
.ch-facts { display: flex; flex-wrap: wrap; gap: 6px; }
.ch-desc { font-size: 12.5px; color: var(--ink-2); line-height: 1.7; }

/* 数据面板里的通道小行（兼容旧类名） */
.ch-status-card .ch-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r); border: 1px solid var(--line-2); background: var(--card-2); margin-bottom: 8px; }
.ch-status-card .ch-row:last-child { margin-bottom: 0; }
.ch-status-card .ch-row .ic-wrap { width: 36px; height: 36px; border-radius: var(--r-sm); display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 13px; flex: none;
  background: linear-gradient(145deg, color-mix(in srgb, var(--c) 92%, #fff), color-mix(in srgb, var(--c) 78%, #000)); }
.ch-status-card .ch-row b { display: block; font-size: 13.5px; }
.ch-status-card .ch-row i { font-style: normal; font-size: 11.5px; color: var(--ink-3); }
.ch-status-card .ch-row .pill { margin-left: auto; }

/* ── 表格 / 列表外壳（客户页、运营后台共用） ────────────────────────────── */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.tile { padding: 18px; }
.tile .k { font-size: 12.5px; color: var(--ink-3); display: flex; align-items: center; gap: 7px; }
.tile .v { font-size: 28px; font-weight: 680; margin-top: 7px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.tile .s { font-size: 11.5px; color: var(--ink-3); margin-top: 4px; }

.chart { display: flex; align-items: flex-end; gap: 6px; height: 168px; padding: 10px 0 0; }
.chart .col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; height: 100%; min-width: 0; position: relative; border-radius: var(--r-xs); }
.chart .col:hover { background: var(--hover); }
.chart .b { border-radius: var(--r-xs) var(--r-xs) 0 0; background: var(--brand); min-height: 3px; }
.chart .b.out { background: color-mix(in srgb, var(--brand) 38%, var(--line)); }
.chart-x { display: flex; gap: 6px; }
.chart-x > span { flex: 1; font-size: 10px; color: var(--ink-3); text-align: center; min-width: 0; overflow: hidden; }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--ink-2); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; } /* 3px 是 9px 色块的视觉圆角，不跟 UI 圆角体系 */

.list-card { overflow: hidden; }
.list-tools { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 9px; padding: 12px 16px; border-top: 1px solid var(--line-2); font-size: 12.5px; color: var(--ink-2); }

/* ── 设置页 ─────────────────────────────────────────────────────────────── */
.set-row { display: flex; align-items: flex-start; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--line-2); }
.set-row:last-child { border-bottom: none; }
.set-row .k { width: 132px; flex: none; font-size: 13px; font-weight: 600; padding-top: 9px; }
.set-row .v { flex: 1; min-width: 0; }
.qr-thumb { width: 108px; height: 108px; border-radius: var(--r-sm); border: 1px solid var(--line); background: #fff; padding: 5px; object-fit: contain; }
.quick-item { display: flex; gap: 7px; align-items: center; }
.quick-item .input { flex: 1; }

/* ── 窄屏 ───────────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
  .chcards { grid-template-columns: 1fr; }
  .qrwrap { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .side {
    position: fixed; inset: 0 auto 0 0; width: 264px; z-index: 70;
    transform: translateX(-100%); transition: transform var(--dur-3) var(--ease);
    box-shadow: var(--shadow-pop);
  }
  .app.nav-open .side { transform: none; }
  .app.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 60; backdrop-filter: blur(2px); }
  #side-toggle { display: inline-flex !important; }
  .chat { grid-template-columns: 1fr; height: 100%; }
  .chat .thread { display: none; }
  .chat.open .convs { display: none; }
  .chat.open .thread { display: flex; }
  .thread-back { display: inline-flex; }
  .msg { max-width: 92%; }
  .view, .view.flush { padding: 14px; }
  .top { padding: 0 14px; gap: 8px; }
  .conn span:last-child { display: none; }
  .conn { padding: 0 10px; }
  .bars { gap: 10px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ============================================================================
   v2 细节层（2026-10-02）：逐项配色 / 我的通道与二维码分开 / 顶栏席位与声音 /
   版本更新条 / 输入区工具 / 客户资料弹窗。追加覆盖，旧规则不删。
   ========================================================================== */

/* ── 导航逐项配色（workBuddy 每个菜单项颜色不同） ── */
.nav a .ic { color: var(--nav-c, currentColor); opacity: .95; }
.nav a.on {
  color: var(--ink);
  background: linear-gradient(90deg, color-mix(in srgb, var(--nav-c, var(--brand)) 17%, transparent), color-mix(in srgb, var(--nav-c, var(--brand)) 4%, transparent));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--nav-c, var(--brand)) 26%, transparent);
}
.nav a.on::before { background: var(--nav-c, var(--brand)); }
.nav a:hover .ic { color: var(--nav-c, currentColor); }

/* ── 顶栏：席位 / 声音 / 用户名 ── */
.seat-bar { width: 46px; height: 4px; border-radius: var(--r-xs); background: var(--field); overflow: hidden; display: inline-block; margin-left: 2px; }
.seat-bar i { display: block; height: 100%; width: 0; border-radius: var(--r-xs); background: linear-gradient(90deg, var(--ok), var(--qq)); }
.conn.warn-seat { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 32%, transparent); background: var(--warn-soft); }
.conn.full-seat { color: var(--err); border-color: color-mix(in srgb, var(--err) 32%, transparent); background: var(--err-soft); }
#sound-btn[aria-pressed="true"] { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 32%, transparent); background: var(--ok-soft); }
@media (max-width: 1120px) { #top-user { display: none !important; } }
#top-user { border-radius: var(--r-pill); }

/* ── 版本更新条 ── */
.ver-bar {
  display: flex; align-items: center; gap: 10px; flex: none;
  padding: 8px 26px; font-size: 12.5px; color: var(--ink-2);
  background: var(--brand-soft); border-bottom: 1px solid var(--brand-line);
}
.ver-bar .ic { color: var(--brand); }
.ver-bar-text { flex: 1; }

/* ── 侧栏退出登录 ── */
.side-logout {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 11px; border: 0; border-radius: var(--r-sm); background: transparent;
  color: var(--ink-3); font-size: 13px; cursor: pointer; text-align: left;
  transition: background var(--t), color var(--t);
}
.side-logout:hover { background: var(--hover); color: var(--err); }
.side-logout .ic { width: 16px; height: 16px; stroke-width: 2.25; }

/* ── 对话页细节 ── */
.thread-head .pill { height: 24px; }
.thread-actions { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
/* 会话状态：聊天窗口上边那颗可点的胶囊（进行中=绿点 / 已结束=灰点） */
.st-chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: var(--r-pill);
  border: 1px solid transparent; background: none; color: var(--ink-2); cursor: pointer;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.st-chip .st-dot { width: 7px; height: 7px; border-radius: var(--r-circle); background: currentColor; }
.st-chip.on { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 30%, transparent); background: var(--ok-soft); }
.st-chip.off { color: var(--ink-3); border-color: var(--line); background: var(--field); }

/* 输入区工具 + 表情面板 */
.composer-tools .btn.active { color: var(--brand); background: var(--brand-soft); border-color: var(--brand-line); }
.thread { position: relative; }
.emoji-panel {
  position: absolute; right: 16px; bottom: 118px; z-index: 30;
  width: 316px; max-width: calc(100vw - 32px);
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow-pop); padding: 10px;
}
.emoji-panel .grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; max-height: 190px; overflow: auto; }
.emoji-panel button { border: 0; background: transparent; font-size: 19px; line-height: 1; padding: 6px 0; border-radius: var(--r-xs); cursor: pointer; }
.emoji-panel button:hover { background: var(--hover); }

/* ── 客户资料弹窗 ── */
.profile-grid { display: grid; grid-template-columns: 92px 1fr; gap: 8px 12px; font-size: 13px; }
.profile-grid dt { color: var(--ink-3); }
.profile-grid dd { margin: 0; word-break: break-all; }

/* ── 渠道管理 v2：我的通道（一行卡）+ 二维码（单独一张卡） ── */
.ch-panel .hd { gap: 10px; }
.ch-panel .hd .pill { height: 22px; }
.ch-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; padding: 16px 18px 18px; }

/* ── 渠道页「第一次接客」三步引导：只在还没有任何已接通通道时出现 ── */
.ch-guide { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.ch-guide-head { display: flex; align-items: center; gap: 9px; }
.ch-guide-head b { font-size: 14px; }
.ch-guide-head .hint { margin-left: auto; }
.ch-guide-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.ch-guide-step {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px; border: 1px solid var(--line-2); border-radius: var(--r-sm);
  background: var(--card-2);
}
.ch-guide-n {
  flex: none; width: 24px; height: 24px; border-radius: var(--r-circle);
  display: grid; place-items: center; background: var(--brand); color: #fff;
  font-size: 12px; font-weight: 700;
}
.ch-guide-step b { display: block; font-size: 12.5px; margin-bottom: 2px; }
.ch-guide-step span { font-size: 12px; color: var(--ink-2); line-height: 1.55; }
@media (max-width: 900px) {
  .ch-guide-steps { grid-template-columns: 1fr; }
  .ch-guide-head .hint { display: none; }
}
.chcard {
  background: var(--card-2); border: 1px solid var(--line-2); border-radius: var(--r);
  padding: 15px 16px; position: relative; overflow: hidden;
}
.chcard.active { border-color: color-mix(in srgb, var(--c) 45%, transparent); background: var(--card); }
.chcard.active::before { content: ""; position: absolute; inset: 0 0 auto; height: 2px; background: linear-gradient(90deg, var(--c), transparent 72%); }
.chcard.off { opacity: .62; }
.chcard h3 { font-size: 15px; font-weight: 650; display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.chcard .desc { font-size: 12.5px; color: var(--ink-2); margin: 9px 0 0; line-height: 1.7; }
.chcard .meta-line { font-size: 12px; color: var(--ink-2); margin-top: 7px; }
.chcard .id-line { font-size: 11.5px; color: var(--ink-3); margin-top: 3px; }
.chcard details { margin-top: 11px; }
.chcard summary {
  cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between;
  font-size: 12.5px; color: var(--ink-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 7px 11px;
}
.chcard summary::-webkit-details-marker { display: none; }
.chcard summary::after { content: "⌄"; color: var(--ink-3); }
.chcard details[open] summary::after { transform: rotate(180deg); }
.chcard .cap { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--ink-2); line-height: 1.6; }
.chcard .actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.chcard .actions .btn { flex: 1 1 auto; }

.qr-card .qr-block { padding: 20px 18px; border-top: 1px solid var(--line-2); }
.qr-card .qr-block:first-of-type { border-top: none; }
.qr-block .line-note { font-size: 13px; color: var(--ink-2); line-height: 1.9; margin-bottom: 14px; }
.qr-block .line-note b { color: var(--ink); }
/* 码在左（固定小尺寸）、说明与操作在右：不让一张码占满整行 */
.qr-block .qr-row { display: flex; gap: 22px; align-items: flex-start; flex-wrap: wrap; }
.qr-block .big-qr { flex: none; display: flex; justify-content: center; }
.qr-block .big-qr img { width: 188px; height: 188px; border-radius: var(--r); background: #fff; padding: 8px; box-shadow: var(--shadow-1); }
.qr-block .big-qr .small { padding: 64px 0; }
.qr-block .qr-side { flex: 1 1 260px; min-width: 240px; display: flex; flex-direction: column; gap: 10px; }
.qr-block .qr-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 0; }
@media (max-width: 720px) {
  .qr-block .big-qr img { width: 168px; height: 168px; }
}

/* 亮色下通道卡用浅灰内卡（更像 workBuddy 的层次） */
html[data-theme="light"] .chcard { background: #f7f8fc; border-color: rgba(17, 24, 39, .07); }
html[data-theme="light"] .chcard.active { background: #fff; }

/* hidden 属性必须压得住 .ver-bar 的 display:flex（不然「有新版本」的条一直挂着） */
.ver-bar[hidden] { display: none; }

/* ── 群发与自动化 ── */
.bc-list { display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow: auto; }
.bc-target { padding: 8px 10px; border: 1px solid var(--line-2); border-radius: var(--r-sm); cursor: pointer; }
.bc-target:hover { background: var(--hover); }
.bc-target.off { opacity: .55; cursor: not-allowed; }
.bc-target input { accent-color: var(--brand); }
.bc-results { display: flex; flex-direction: column; gap: 6px; }
.bc-result { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--r-sm); font-size: 12.5px; background: var(--card-2); border: 1px solid var(--line-2); }
.bc-result.ok { border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.bc-result.bad { border-color: color-mix(in srgb, var(--err) 30%, transparent); }
.bc-hist-item { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: var(--r-sm); }

/* ── 导航 hover 也要有色（workBuddy 口径：悬停就有本项配色，不用点） ── */
.nav a:hover {
  color: color-mix(in srgb, var(--nav-c, var(--ink)) 82%, var(--ink));
  background: color-mix(in srgb, var(--nav-c, var(--brand)) 11%, transparent);
}
.nav a.on {
  color: color-mix(in srgb, var(--nav-c, var(--ink)) 78%, var(--ink));
}

/* ── 渠道管理 v3：照 workBuddy 的通道卡重排（信息在上、动作克制、二维码更大） ── */
.ch-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.chcard { padding: 16px 17px 15px; border-radius: var(--r); }
.chcard .ch-head { display: flex; align-items: center; gap: 11px; }
.chcard .ch-head .ch-mark { width: 34px; height: 34px; border-radius: var(--r-sm); font-size: 13px; }
.chcard .ch-head .t { min-width: 0; flex: 1; }
.chcard .ch-head .t b { display: block; font-size: 15.5px; font-weight: 650; }
.chcard .ch-head .t i { font-style: normal; font-size: 11.5px; color: var(--ink-3); }
.chcard .ch-tags { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.chcard .ch-desc { margin-top: 10px; font-size: 12.5px; color: var(--ink-2); line-height: 1.7; }
.chcard .ch-usage { margin-top: 9px; font-size: 12px; color: var(--ink-2); }
.chcard .ch-id { margin-top: 3px; font-size: 11.5px; color: var(--ink-3); }
/* 商户自己给这条线起的名字：比机器码重要，给一点重量 */
.chcard .ch-name { margin-top: 9px; font-size: 13px; font-weight: 600; color: var(--ink); }
.chcard details { margin-top: 11px; }
.chcard summary { padding: 8px 11px; border-radius: var(--r-sm); font-size: 12.5px; }
.chcard .ch-actions { display: flex; justify-content: flex-end; margin-top: 12px; }
.chcard .ch-actions .btn { min-width: 92px; }
.card-help { width: 22px; height: 22px; border-radius: var(--r-circle); border: 1px solid var(--line); background: transparent; color: var(--ink-3); font-size: 12px; cursor: pointer; line-height: 1; flex: none; }
.card-help:hover { color: var(--ink); border-color: var(--ink-3); }
.card-why { margin: 0; padding: 12px 18px 0; font-size: 12.5px; color: var(--ink-2); line-height: 1.7; }

/* 通道卡限宽（照 workBuddy：一排 300~360 的卡，别拉成半页宽的空白） */
.ch-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 356px)); justify-content: start; }
.chcard .cap { display: flex; flex-direction: column; gap: 6px; padding: 10px 2px 2px; font-size: 12px; color: var(--ink-2); line-height: 1.6; }
.chcard .cap > div { display: flex; gap: 8px; }
.chcard .cap > div::before { content: ""; width: 4px; height: 4px; border-radius: var(--r-circle); background: var(--ink-3); margin-top: 7px; flex: none; }
.chcard .cap > div.dim { display: block; }
.chcard .cap > div.dim::before { display: none; }
@media (max-width: 900px) { .ch-grid { grid-template-columns: 1fr; } }

/* 群会话的小标记（列表里只出现一次「群」，不再到处重复） */
.conv .conv-ch.grp { color: var(--brand); background: var(--brand-soft); border: 1px solid var(--brand-line); }

/* ── 通道能力面板（照 workBuddy：可以/不能矩阵 + 参数表） ── */
.chcard .cap-row { display: flex; gap: 8px; flex-wrap: wrap; }
.chcard .cap > .cap-row::before { display: none; }
.cap-chip { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 6px 10px; background: var(--card); }
.cap-chip b { font-weight: 650; font-size: 11px; color: #fff; background: var(--ok); border-radius: var(--r-xs); padding: 2px 7px; }
.cap-chip.no { opacity: .6; }
.cap-chip.no b { background: var(--ink-3); }
.cap-params { display: grid; grid-template-columns: 76px 1fr; gap: 8px 12px; margin: 12px 0 0; padding-top: 12px; border-top: 1px solid var(--line-2); font-size: 12.5px; }
.cap-params dt { color: var(--ink-3); }
.cap-params dd { margin: 0; color: var(--ink); }
.chcard .ch-notes { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; font-size: 11.5px; color: var(--ink-3); line-height: 1.6; }

.tagc.brand { color: var(--brand); border-color: var(--brand-line); background: var(--brand-soft); }

/* ── v5：数据面板照 workBuddy（栏位/尺寸同名对齐：趋势 150px、柱宽 44px、间距 10px）── */
.dash-panel { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1180px) { .dash-panel { grid-template-columns: minmax(0, 1fr); } }

.trend-bars { display: flex; align-items: flex-end; gap: 10px; height: 150px; padding: 10px 4px 0; }
.trend-col { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.trend-bar {
  width: 100%; max-width: 44px; min-height: 2px; border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, var(--brand), color-mix(in srgb, var(--brand) 35%, transparent));
  transition: height var(--dur-2);
}
.trend-n { font-size: 11.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.trend-d { font-size: 11px; color: var(--ink-3); }

.seat-value-row { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.seat-value-row .v { margin: 0; }
.seat-card { display: flex; flex-direction: column; }
.seat-card .seat-bar {
  display: block; height: 4px; margin: 8px 0 7px; border-radius: var(--r-pill);
  overflow: hidden; background: rgba(17, 24, 39, .07); flex: none;
}
.seat-card .seat-bar > i { display: block; height: 100%; width: 0; border-radius: var(--r-pill); background: var(--ink-3); transition: width var(--dur-2); }
.seat-card[data-state="ok"] .seat-act { color: var(--ok); }
.seat-card[data-state="warn"] .seat-act { color: var(--warn); }
.seat-card[data-state="full"] .seat-act { color: var(--err); }
.seat-card[data-state="ok"] .seat-bar > i { background: var(--ok); }
.seat-card[data-state="warn"] .seat-bar > i { background: var(--warn); }
.seat-card[data-state="full"] .seat-bar > i { background: var(--err); }

.plan-validity { display: flex; align-items: center; gap: 8px; }
/* 统计卡副行照 workBuddy 的字号（11.5px），一行放得下 */
.stat .d { font-size: 11.5px; }

/* ── v6：签名色系统 —— 每个页面有自己的颜色，从导航一路跟到标题 / 卡片图标 / 筛选激活态 ── */
:root { --page-c: var(--brand); }

/* 标题前一颗圆角小方点（跟当前页面的颜色）+ 一圈淡光环 */
#top-title::before {
  content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 3px;
  background: var(--page-c); margin-right: 9px; vertical-align: 1px;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--page-c) 16%, transparent);
}
/* 卡片头的图标吃当前页面的颜色 */
.card-head .ic { color: var(--page-c); }
/* 分段筛选的激活态也用当前页面的颜色（对话=绿、群发=琥珀、沟通记录=蓝…） */
.seg button[aria-pressed="true"] {
  background: color-mix(in srgb, var(--page-c) 14%, transparent);
  color: color-mix(in srgb, var(--page-c) 72%, var(--ink));
}
/* 顶栏底下一条签名色发丝线（跟随当前页面，两端淡出） */
header.top { position: relative; }
header.top::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; pointer-events: none;
  background: linear-gradient(90deg, transparent,
    color-mix(in srgb, var(--page-c) 55%, transparent) 22%,
    color-mix(in srgb, var(--page-c) 55%, transparent) 78%, transparent);
}
/* 侧栏品牌名用品牌渐变（页面里唯一一处渐变字，像一枚签名） */
.brand-name {
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
  width: fit-content;
}
/* 切页淡入 + 统计卡悬浮微动效。
   幅度只留一份：以前这里 6px、文件末尾又覆写成 4px，两份同名 keyframes 只会让人以为改不动。 */
@keyframes pageIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
#view.page-in { animation: pageIn var(--dur-3) var(--ease); }
.stat { transition: transform var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease); }
.stat:hover { transform: translateY(-1px); box-shadow: var(--shadow-2); }
.btn:active:not(:disabled) { transform: translateY(1px); }

/* ── v7：对话页的通道色语言 —— 一眼看出「这条会话走哪条线」（龙虾橙 / QQ 蓝）── */
.thread-head { position: relative; }
.thread-head::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; pointer-events: none;
  background: linear-gradient(90deg, color-mix(in srgb, var(--c, var(--brand)) 55%, transparent), transparent 72%);
}
.ch-chip {
  display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: var(--r-xs);
  font-size: 10.5px; font-weight: 600; border: 1px solid currentColor; opacity: .9; white-space: nowrap; flex: none;
}
.msg-body { min-width: 0; }
.msg-sender { font-size: 11px; color: var(--ink-3); margin: 0 0 3px 2px; }
.msg.in .bubble { box-shadow: inset 3px 0 0 color-mix(in srgb, var(--c, var(--brand)) 48%, transparent), var(--shadow-1); }
.msg.in .av .avatar { box-shadow: 0 0 0 2px color-mix(in srgb, var(--c, var(--brand)) 30%, transparent); }

/* ── 两张码的用途标注：接通码（给你自己扫）/ 客户码（给客户扫），别让用户猜 ── */
.qr-badge {
  display: flex; width: fit-content; align-items: center; gap: 6px;
  padding: 3px 11px; border-radius: var(--r-pill); margin: 2px auto 10px;
  font-size: 11.5px; font-weight: 600; color: var(--brand);
  background: var(--brand-soft); border: 1px solid var(--brand-line);
}
.ch-hint { font-size: 11.5px; color: var(--ink-3); margin: 0 0 9px; line-height: 1.6; }

/* ── 二维码与落地页自定义（照 openclaw-web / workBuddy 的 Logo 口径）──
   两栏紧凑排布：左=外观（Logo/颜色），右=落地页文案；预览走弹窗。 */
.cust-sec { font-size: 12px; font-weight: 650; color: var(--ink-3); letter-spacing: .02em; }
.cust-fields.cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cust-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.cust-color { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-2); }
.color-input { width: 36px; height: 28px; padding: 1px 2px; border-radius: var(--r-xs); border: 1px solid var(--line); background: var(--card); }
.cust-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--line-2);
}
/* 出码中的加载态（临时码/接通码） */
.qr-loading { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 44px 0 40px; }
.qr-spin {
  width: 26px; height: 26px; border-radius: var(--r-circle); display: block;
  border: 3px solid var(--line); border-top-color: var(--brand);
  animation: qrspin .8s linear infinite;
}
@keyframes qrspin { to { transform: rotate(360deg); } }
.qr-block .qr-side .qr-badge { margin: 0; }
/* 二维码卡上的「外观」：Logo / 码点颜色就在这张码上改（不再有第二张预览码） */
.qr-look { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.qr-look-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.qr-logo-chip {
  width: 34px; height: 34px; border-radius: var(--r-sm); flex: none;
  display: grid; place-items: center; overflow: hidden;
  background: var(--field); border: 1px dashed var(--line); color: var(--ink-3);
}
.qr-logo-chip img { width: 100%; height: 100%; object-fit: cover; }
/* 二维码域名（只有龙虾微信有）：链接两条都列、二维码只画选中的那张。
   ★【2026-11-01】第一版左右并排两张码 → 中栏太窄会挤会叠；第二版上下堆叠两张码 →
   手机预览里本来就有一张，三张码商户不知道以谁为准。最终版：切换 + 两条链接。 */
.seg-sm button { padding: 6px 14px; font-size: 12.5px; }
.qr-links { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.qr-link-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.qr-link-tag {
  flex: none; width: 34px; font-size: 12px; font-weight: 600; color: var(--ink-2);
  text-align: center; padding: 4px 0; border-radius: var(--r-xs);
  background: var(--field); border: 1px solid var(--line);
}
.qr-link-row .input {
  flex: 1 1 auto; min-width: 0; font-size: 12px; font-family: var(--mono);
  text-overflow: ellipsis; white-space: nowrap; overflow: hidden;
}
.qr-link-row .btn-icon { flex: none; }
@media (max-width: 900px) {
  .cust-steps { grid-template-columns: 1fr; }
  .cust-fields.cols-2 { grid-template-columns: 1fr; }
}
/* 落地页实时小样（版式与客户看到的落地页一致；--c 跟着主题色输入实时变） */
.lp-mini {
  --c: #07c160;
  width: 228px; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden;
  background: var(--card); box-shadow: var(--shadow-1);
}
.lp-mini-body { padding: 14px 12px 16px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.lp-mini-logo { width: 44px; height: 44px; border-radius: var(--r-sm); object-fit: cover; display: block; }
.lp-mini-brand { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.lp-mini-title { font-size: 13.5px; font-weight: 650; color: var(--ink); line-height: 1.45; }
.lp-mini-sub { font-size: 11px; color: var(--ink-3); line-height: 1.5; }
.lp-mini-qr { margin-top: 4px; }
.lp-mini-qr img { width: 136px; height: 136px; border-radius: var(--r-xs); background: #fff; padding: 4px; border: 1px solid var(--line-2); display: block; }
.lp-mini-noqr {
  width: 136px; min-height: 96px; padding: 12px 8px; border-radius: var(--r-xs);
  background: var(--field); color: var(--ink-3); font-size: 10.5px; line-height: 1.6;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  border: 1px dashed var(--line);
}
.lp-mini-noqr .ic { width: 20px; height: 20px; stroke-width: 1.8; opacity: .7; }
.lp-mini-hint { font-size: 10.5px; color: var(--ink-3); }
.lp-mini-tip {
  width: 100%; text-align: left; font-size: 10.5px; line-height: 1.6; white-space: pre-wrap;
  padding: 7px 9px; border-radius: var(--r-xs);
  background: color-mix(in srgb, var(--c) 10%, transparent);
  color: color-mix(in srgb, var(--c) 70%, var(--ink));
}
.lp-mini-steps { width: 100%; text-align: left; display: flex; flex-direction: column; gap: 5px; margin-top: 2px; }
.lp-mini-step { display: flex; align-items: flex-start; gap: 7px; font-size: 10.5px; color: var(--ink-2); line-height: 1.5; }
.lp-mini-stepnum {
  flex: none; width: 16px; height: 16px; border-radius: var(--r-circle); background: var(--c);
  color: #fff; font-size: 9.5px; font-weight: 600; display: grid; place-items: center; margin-top: 1px;
}
.lp-mini-btn {
  width: 100%; padding: 9px 0; border-radius: var(--r-xs); background: var(--c); color: #fff;
  font-size: 13px; font-weight: 600; text-align: center; margin-top: 4px;
}
.lp-mini-bottom { font-size: 9.5px; color: var(--ink-3); margin-top: 6px; line-height: 1.5; }

/* 临时码倒计时（过期自动换新，看得见才叫实时） */
.qr-count { font-size: 11.5px; color: var(--ink-3); }


/* ── 微信客服入口：一整块（左手机预览 / 中链接与状态 / 右自定义），照 openclaw-web ── */
.wx-entry .bd { padding: 18px 20px 20px; }
/* ★【2026-11-01】中栏最小宽度从 280 提到 340：固定码栏现在要放**两张**码
   （每张：132px 码 + 文字 + 整行链接 + 两个按钮）。280px 时链接框被挤成一条、
   文字换行堆在一起 —— 用户实测反馈「稍微大一点就拥挤、还会叠加」。
   窄屏（<1180px）直接变单列，不在两栏里硬挤。 */
.wx-grid { display: grid; grid-template-columns: 292px minmax(340px, 1fr) minmax(330px, 420px); gap: 22px 24px; align-items: start; }
.wx-col { min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.wx-row { display: flex; align-items: center; gap: 8px; }
.wx-row .input { min-width: 0; }
.wx-row .grow { flex: 1; }
.wx-phone {
  width: 100%; max-width: 292px; margin: 0 auto; min-height: 520px;
  border: 1px solid var(--line); border-radius: var(--r-lg); background: #fff;
  padding: 12px 10px 16px; box-shadow: var(--shadow-1);
}
.wx-phone .lp-mini-body { min-height: 492px; justify-content: flex-start; }
.wx-phone .lp-mini-qr img { width: 148px; height: 148px; }
.wx-dot { width: 7px; height: 7px; border-radius: var(--r-circle); background: var(--ink-3); flex: none; }
.wx-dot.on { background: #22c55e; }
.wx-status { font-size: 13px; color: var(--ink-2); line-height: 1.6; }
.wx-bound {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--card-2);
}
/* 「已绑定微信号」列表：一条记录 = 一个微信号（本机那条 + 客户扫出来的那些）。
   版式照参考实现 openclaw-web 的 .binding-item：头像首字母 + 状态点 + 名字 + 状态徽章
   + 机器码小字副行。比 .wx-bound 紧凑（后者按「一行」设计，复制 N 份会把中栏撑成长条，
   而中列宽度只有 minmax(280px,1fr)、<1100px 还会整块变单列）。 */
.wx-binds { display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow-y: auto; }
.wx-bind-item {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--card-2);
  transition: opacity .18s ease, border-color .18s ease, background .18s ease;
}
.wx-bind-item.is-off { opacity: .6; }
/* 只有**新接进来的那几行**播入场动画（paintWxCust 走增量更新，不会整块重建）——
   整块重建会让所有行一起飞一遍，那就是「整片在跳」 */
.wx-bind-item.is-new { animation: wxBindIn .26s cubic-bezier(.22, .61, .36, 1); }
@keyframes wxBindIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .wx-bind-item.is-new { animation: none; } }
.wx-bind-avatar-wrap { position: relative; flex: none; }
.wx-bind-avatar {
  width: 30px; height: 30px; border-radius: var(--r-circle); background: var(--ink-3); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600;
}
.wx-bind-dot {
  position: absolute; right: -1px; bottom: -1px; width: 9px; height: 9px;
  border-radius: var(--r-circle); background: var(--ink-3); border: 2px solid var(--card-2);
  transition: background .18s ease;
}
.wx-bind-dot.on { background: #22c55e; }
.wx-bind-info { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.wx-bind-line { display: flex; align-items: center; gap: 6px; min-width: 0; }
.wx-bind-name { font-size: 13px; font-weight: 600; }
.wx-bind-item .badge { transition: background .18s ease, color .18s ease; }
.wx-mid { gap: 8px; }
.wx-right .field { margin: 0; }
.wx-right .cust-steps { grid-template-columns: 1fr; }
.wx-right .wx-row { flex-wrap: wrap; }
.wx-entry .qr-count { font-size: 12px; color: var(--ink-3); }
@media (max-width: 1180px) {
  .wx-grid { grid-template-columns: 1fr; }
  .wx-phone { max-width: 340px; }
  /* 单列时两张码并排也没问题（整栏宽度够了），但保持上下堆叠更整齐 */
}

/* 一键选平台图标：图标按钮（不带文字，避免和左边预览重复） */
.preset-ic { width: 18px; height: 18px; border-radius: var(--r-xs); display: block; }


.preset-ic { width: 20px !important; height: 20px !important; }

/* ── 录音条 / 试听条（输入区里点 🎤 后出现）────────────────
   结构照隔壁 workBuddy_h5 的 .voice-rec / .voice-preview：
   录音时只留一条红点 + 计时 + 「取消 / 完成」；录完换成试听播放器。
   ★ 这两条出现时，输入行与工具行会被 JS 收起来（display:none），
     所以这里只管自己这一条的排版，不用管和它们抢位置。 */
.voice-rec,
.voice-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--card-2, var(--hover));
}

.voice-rec-dot {
  width: 10px;
  height: 10px;
  border-radius: var(--r-circle);
  background: var(--err);
  flex: 0 0 auto;
  animation: voice-pulse 1.1s ease-in-out infinite;
}

@keyframes voice-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .35; transform: scale(.82); }
}

@media (prefers-reduced-motion: reduce) {
  /* 一律关掉：晕动症用户看到的是位移和缩放，不是「高级感」。
     连 transition 一起关 —— 只关 animation 的话，悬停位移照样在动。
     （全仓没有 transitionend/animationend 监听，关掉不会挂住任何逻辑。） */
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .voice-rec-dot { animation: none; }
}

.voice-rec-time {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  min-width: 46px;
}

.voice-rec-tip {
  flex: 1 1 auto;
  color: var(--ink-3);
  font-size: 13px;
}

.voice-preview audio {
  flex: 1 1 auto;
  min-width: 0;
  height: 36px;
}

/* 窄屏：试听条上的播放器会撑破，让按钮换到下一行 */
@media (max-width: 640px) {
  .voice-preview { flex-wrap: wrap; }
  .voice-preview audio { flex-basis: 100%; order: 3; }
  .voice-rec-tip { display: none; }
}

/* ── 只在窄屏出现的块 ──
   窄屏（≤900px）时侧栏收成抽屉，里面的「退出登录」就藏起来了，
   所以设置页再放一个；宽屏下必须消失，同一个动作不给两个入口。 */
.only-narrow { display: none; }
@media (max-width: 900px) {
  .only-narrow { display: block; }
}

/* ── 动效：卡片依次落下 ────────────────────────────────────────────────
   只挂在「一次画好、之后不重画」的容器上（数据面板的 .stats、我的通道的 .ch-grid）。
   对话列表和消息流每 3 秒被清空重画一次，**绝不能**用这个，否则整屏每轮都重播一遍。
   延迟用 nth-child 算（CSS 读不到子元素序号，做不了 calc），第 7 个起封顶 ——
   不封顶的话长列表会排到一秒以后，看起来像卡住了而不是像动效。 */
@keyframes riseIn { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }
.stats > *, .ch-grid > * { animation: riseIn var(--dur-4) var(--ease) both; }
.stats > *:nth-child(2), .ch-grid > *:nth-child(2) { animation-delay: 45ms; }
.stats > *:nth-child(3), .ch-grid > *:nth-child(3) { animation-delay: 90ms; }
.stats > *:nth-child(4), .ch-grid > *:nth-child(4) { animation-delay: 135ms; }
.stats > *:nth-child(5), .ch-grid > *:nth-child(5) { animation-delay: 180ms; }
.stats > *:nth-child(6), .ch-grid > *:nth-child(6) { animation-delay: 225ms; }
.stats > *:nth-child(n+7), .ch-grid > *:nth-child(n+7) { animation-delay: 270ms; }

/* 新消息落下来 —— 只有「这一轮才出现」的那几条会带上 .msg-in（见 renderMsgs）。
   消息区每次刷新都清空重画，全量挂动画 = 每 3 秒整屏重播一次。 */
@keyframes msgIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.msg.msg-in { animation: msgIn var(--dur-2) var(--ease) both; }

/* ── 统计卡：一个图标 + 一道悬停才亮的强调色 ────────────────────────────
   强调色走自定义属性 --c（JS 用 setProperty 给，见 viewStats 里的 stat()）。
   颜色只上在图标和细条上，数字保持墨色 —— 六个彩色数字排一起就花掉了。 */
.stat { position: relative; overflow: hidden; }
.stat .k .ic { width: 14px; height: 14px; stroke-width: 2.6; flex: 0 0 auto; color: var(--c, var(--brand)); }
.stat::after {
  content: ''; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--c, var(--brand));
  opacity: 0; transform: scaleY(.35); transform-origin: 50% 50%;
  transition: opacity var(--dur-2) var(--ease), transform var(--dur-2) var(--ease);
}
.stat:hover::after { opacity: 1; transform: none; }
/* 席位卡的强调色跟它的状态走，不用再让 JS 多传一份。 */
.seat-card[data-state="ok"] { --c: var(--ok); }
.seat-card[data-state="warn"] { --c: var(--warn); }
.seat-card[data-state="full"] { --c: var(--err); }

/* ── 导航未读数弹一下 ──────────────────────────────────────────────
   只在数字真的变了的时候才挂（见 paintUnread）——
   每轮轮询都重放的话，它会变成一个一直在抖的小圆点。 */
@keyframes pop { 0%, 100% { transform: scale(1); } 45% { transform: scale(1.28); } }
#nav-unread.pop { animation: pop var(--dur-4) var(--ease); }

/* ============================================================================
   v8 细节层（2026-10-04）：拉开层次 —— 画布 / 卡面 / 卡里再嵌一层，三层要分得开。
   不新增元素、不改结构、不加依赖，全部是对既有类的纯 CSS 追加覆盖。
   底色和阴影的 token 在 base.css 里调（--bg / --card / --card-2 / --card-3 / --line）。
   ========================================================================== */

/* ── 侧栏与顶栏：两条垂直面各有自己的底 ── */
.side { background: var(--bg-2); border-right: 1px solid var(--line); }
.side-foot { border-top: 1px solid var(--line-2); }
header.top {
  background: color-mix(in srgb, var(--card) 84%, transparent);
  backdrop-filter: blur(14px) saturate(1.15);
  -webkit-backdrop-filter: blur(14px) saturate(1.15);
  border-bottom: 1px solid var(--line);
}
#top-title { font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.nav-label { color: var(--ink-3); opacity: .85; }

/* ── 卡面：白得干净，阴影分层；卡头跟卡身分得开 ── */
.card { border-color: var(--line-2); }
.card-head { position: relative; padding: 15px 20px; background: var(--card-2); }

/* 卡头图标：一颗带底色的圆角小方（颜色跟当前页面走） */
.card-head > .ic {
  width: 27px; height: 27px; padding: 7px; box-sizing: border-box;
  /* box-sizing:border-box + 7px 内边距 → 实际绘制区只有 13px，笔画要按 13px 反算 */
  stroke-width: 2.8;
  border-radius: var(--r-sm);
  background: color-mix(in srgb, var(--page-c) 12%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--page-c) 20%, transparent);
}
.card-head h2, .card-head h3 { font-size: 15px; font-weight: 650; letter-spacing: -.005em; }

/* 卡身通高：设置页的 .set-row / 对话页的分区，边界铺满整卡宽度，列与列之间才有分界 */
.card > .bd { display: flex; flex-direction: column; }

/* ── 统计卡：数字更大更重，强调色色条常驻（不是只悬停才亮） ── */
.stat { border-color: var(--line-2); border-radius: var(--r); padding: 19px 20px 16px; }
.stat .k { font-size: 12.5px; font-weight: 600; letter-spacing: .01em; }
.stat .v {
  font-size: 34px; font-weight: 700; letter-spacing: -.02em;
  line-height: 1.12; margin: 9px 0 4px;
}
.stat .d { color: var(--ink-2); }
.stat::after { opacity: .38; transform: none; }
.stat:hover::after { opacity: 1; }
/* 强调色再从顶上压一道很淡的色带，让一排统计卡有节奏 */
.stat::before {
  content: ''; position: absolute; inset: 0 0 auto; height: 3px;
  background: linear-gradient(90deg, var(--c, var(--brand)), transparent 82%);
  opacity: .32; pointer-events: none;
}

/* ── 卡里再嵌一层的地方：底色和发丝线都要看得见 ── */
.chcard { border-color: var(--line-2); }
.chcard.active { border-color: color-mix(in srgb, var(--c) 52%, transparent); }
.chrow, .ch-status-card .ch-row { border-color: var(--line-2); background: var(--card-3); }
.cap-chip { background: var(--card-2); border-color: var(--line-2); }
.cap-params { border-top-color: var(--line-2); }

/* ── 列表：隔行谈一层，行与行之间才有节奏 ── */
.conv-list > li:nth-child(odd) { background: color-mix(in srgb, var(--ink) 2.2%, transparent); }
.conv-list > li:hover { background: var(--hover); }
.table th { background: var(--card-2); border-bottom: 1px solid var(--line); }

/* ── 设置页：每一组行都铺满卡宽，悬停整行亮 ── */
.set-row:hover { background: color-mix(in srgb, var(--ink) 1.8%, transparent); }

/* ── 对话页：左栏和右栏的底不同，一眼看出是两块 ── */
.convs { background: var(--card-2); border-right: 1px solid var(--line-2); }
.thread { background: var(--card); }

/* ============================================================================
   v9：签名色（--page-c）落到每个页面的第一屏 —— 卡头色带 + 标题下的一道色线。
   颜色仍然全部由 JS 按当前页面给（见 app.js 里的 page-c 赋值），这里不硬编码任何颜色。
   ========================================================================== */
.card-head::before {
  content: ''; position: absolute; left: 0; top: 13px; bottom: 13px; width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--page-c, var(--brand));
  opacity: .9;
}

/* 统计卡顶上那道色带（第一版试出来的）—— 一排五个颜色叠一起就花了。
   安静比热闹贵：去掉色带，只留侧边那根常驻的强调色，悬停才亮到底。 */
.stat::before { display: none; }
.stat::after { opacity: .3; }
.stat:hover::after { opacity: 1; }

/* 切页淡入的幅度在 #view.page-in 那一段（同名 keyframes 不能写两份，后一份会静默盖掉前一份） */

/* 设置页/资料页的长表格：行间距给足，看着才不局促 */
.profile-grid { gap: 8px 14px; }
.kv { gap: 8px 12px; }

/* ============================================================================
   v10：设置页「通话名片」—— 左边一枚圆形预览（头像用的是通话页同一套口径：
   真图就贴图，没图就是「首字」）+ 右边昵称与头像操作。
   ========================================================================== */
.call-card-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.call-ava {
  width: 60px; height: 60px; border-radius: var(--r-circle); flex: 0 0 auto;
  background: var(--card-3) center/cover no-repeat;
  border: 1px solid var(--line-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 23px; font-weight: 600; line-height: 1;
  color: var(--ink-2);
  box-shadow: var(--shadow-1);
  overflow: hidden;
}
.call-ava.has-img { border-color: var(--line); color: transparent; }

/* ============================================================================
   v11：渠道卡的品牌标与「现在到底在不在跑」
   - .ch-mark 换成官方标（本来就是圆角方 + 白色 glyph，不要再拿文字当标）
   - .ch-state：服务端 entitlement.explain() 给的一句话，摆在标签下面
   - .ch-err：绑定出错时的原话，只在出错时出现
   ========================================================================== */
.chcard .ch-head .ch-mark.has-logo { background: transparent; border: none; padding: 0; box-shadow: none; }
.chcard .ch-head .ch-logo { width: 34px; height: 34px; border-radius: var(--r-sm); display: block; box-shadow: 0 1px 2px rgba(15, 23, 42, .18); }
.chcard .ch-state {
  display: flex; align-items: flex-start; gap: 7px; margin-top: 10px;
  padding: 8px 10px; border-radius: var(--r-sm); font-size: 12px; line-height: 1.55;
  background: var(--card-2); border: 1px solid var(--line-2); color: var(--ink-2);
}
.chcard .ch-state .ic { width: 14px; height: 14px; stroke-width: 2.6; margin-top: 2px; flex: none; }
.chcard .ch-state.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 26%, transparent); color: var(--warn); }
.chcard .ch-state.err { background: var(--err-soft); border-color: color-mix(in srgb, var(--err) 26%, transparent); color: var(--err); }
.chcard .ch-state.off { background: var(--field); border-color: var(--line-2); color: var(--ink-3); }
.chcard .ch-err { margin-top: 7px; font-size: 11.5px; line-height: 1.55; color: var(--err); word-break: break-word; }

/* ── 违规词命中弹窗（.wf-*） ─────────────────────────────────────────────
   内容网拦下 / 提醒时那张弹窗：上面把命中的词逐个列出来，下面把商户自己那段原文
   摊开、命中处一一划重点。严重（-2）用红、一般（-1）用橙，浅色与深色主题共用一套变量。 */
.wf-lead { font-size: 13.5px; line-height: 1.65; }
.wf-lead.err { color: var(--err); }
.wf-lead.warn { color: var(--warn); }
.wf-sec { display: flex; flex-direction: column; gap: 8px; }
.wf-sec-t { font-size: 11.5px; font-weight: 650; letter-spacing: .04em; color: var(--ink-3); }

.wf-words { display: flex; flex-wrap: wrap; gap: 6px; }
.wf-word {
  display: inline-flex; align-items: baseline; gap: 6px; max-width: 100%;
  padding: 4px 10px; border-radius: var(--r-pill);
  font-size: 13px; line-height: 1.5;
  border: 1px solid var(--line); background: var(--field);
}
.wf-word .wf-w { font-weight: 650; word-break: break-all; }
.wf-word .wf-n { font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.wf-word .wf-cat { font-size: 11px; color: var(--ink-3); white-space: nowrap; }
.wf-word-1 { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.wf-word-1 .wf-w { color: var(--warn); }
.wf-word-2 { background: var(--err-soft); border-color: color-mix(in srgb, var(--err) 32%, transparent); }
.wf-word-2 .wf-w { color: var(--err); }

.wf-text {
  padding: 12px 14px; border-radius: var(--r-sm);
  background: var(--field); border: 1px solid var(--line);
  font-size: 14px; line-height: 1.85;
  white-space: pre-wrap; word-break: break-word;
  max-height: 34vh; overflow: auto;
}
/* mark 的浏览器默认底色是亮黄，深色主题下刺眼，这里一律覆盖掉 */
.wf-mark {
  padding: 1px 2px; border-radius: 3px; color: inherit;
  background: var(--warn-soft);
  box-shadow: inset 0 -2px 0 color-mix(in srgb, var(--warn) 60%, transparent);
}
.wf-mark-2 {
  background: var(--err-soft);
  box-shadow: inset 0 -2px 0 color-mix(in srgb, var(--err) 65%, transparent);
}

@media (max-width: 560px) {
  .wf-text { font-size: 13.5px; line-height: 1.8; max-height: 30vh; }
  .wf-word { font-size: 12.5px; }
  .wf-word .wf-cat { font-size: 10.5px; }
}

/* ============================================================================
   手机端细节层（2026-10-04）：让商户页在手机上真能上手。
   每一条都对应 tools/check-mobile.js 在 390×844 真视口下量出来的缺口，改完用
   `node tools/check-mobile.js` 复验。追加覆盖，旧规则不删。
   ========================================================================== */
@media (max-width: 900px) {
  /* ① iOS 只认 16px：聚焦字号更小的输入框时，它会把整页放大且弹不回去。
        body 前缀是为了压过 .input / .convs .hd .sbox 这类类选择器，不是要缩小范围。 */
  body input, body textarea, body select { font-size: 16px; }
  /* 输入区那条比「元素选择器」更具体（.cbox textarea），这里拿同样的选择器盖回来 */
  .cbox textarea { font-size: 16px; }
  .input, .select, .textarea { min-height: 42px; }
  .convs .hd .sbox { font-size: 16px; height: 40px; }

  /* ② 顶栏的图标键与状态标签不许被挤：标题是 flex: 1 1 auto，宽度不够时
        收缩会平摊到图标键上，汉堡键曾被压到 22px 宽（可点范围只剩 29px）。 */
  .btn-icon { flex: none; }
  #top .conn { flex: none; }
  .thread-head > .avatar { flex: none; }

  /* ③ 会话区整屏：别的页面留内边距好看，聊天留一条边就是白扔给背景。 */
  #view:has(> .chat) { padding: 0; }

  /* ④ 让开 iPhone 底部那条横条和横屏时的刘海（viewport-fit=cover 已打开安全区）。 */
  .composer {
    padding-left: calc(18px + env(safe-area-inset-left, 0px));
    padding-right: calc(18px + env(safe-area-inset-right, 0px));
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  }
  .side { padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
  .top {
    padding-left: calc(14px + env(safe-area-inset-left, 0px));
    padding-right: calc(14px + env(safe-area-inset-right, 0px));
  }
  .view, .view.flush {
    padding-left: calc(14px + env(safe-area-inset-left, 0px));
    padding-right: calc(14px + env(safe-area-inset-right, 0px));
    padding-bottom: calc(40px + env(safe-area-inset-bottom, 0px));
  }
}

/* 窄屏（≤560px，iPhone SE / 小屏安卓）：顶栏里挤着「实时 / 到期 / 席位 / 声音 / 刷新 /
   主题」六个胶囊和图标键，360px 视口下它们合计要 380px —— 整页被撑出 20px 横向滚动，
   Chrome 还会因此缩放布局（量到 innerWidth 380 而可视宽只有 360，高度也一并虚高 44px，
   「能滚到最底」跟着失败）。收紧的都是不损信息的部分：内边距/间距变窄；席位胶囊在手机
   上文字本来就已隐藏（见上面 900px 层的 .conn span:last-child），这会儿连数字也收起来
   —— 设置页有完整的席位卡片，胶囊颜色照样能看出快满/已满。 */
@media (max-width: 560px) {
  .top {
    padding-left: calc(10px + env(safe-area-inset-left, 0px));
    padding-right: calc(10px + env(safe-area-inset-right, 0px));
    gap: 6px;
  }
  #seat-chip .seat-bar { display: none; }
  #seat-chip #seat-text { display: none; }
}

/* ============================================================================
   v12：侧栏「名片」入口 —— 左编辑 / 右「客户看到的名片」实时预览
   （用户 2026-10-15：「把设置里面相关的功能抽离出来，现在请在侧边栏增加一个入口」；
     改卡片时旁边要有一张跟着变的卡片，让商户知道自己卡片长什么样）
   ========================================================================== */
.card-edit-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
/* 窄屏（侧栏收起以后）：预览落到编辑器下面，不再并排 —— 一张 300px 的卡挤在 360px 手机上
   会把编辑区压到只剩两百来像素宽，输入框和按钮全得换行。 */
@media (max-width: 1080px) { .card-edit-grid { grid-template-columns: 1fr; } }

.ncard-wrap { display: flex; flex-direction: column; gap: 8px; }
.ncard-cap { font-size: 12px; font-weight: 600; color: var(--ink-3); letter-spacing: .02em; }
.ncard {
  padding: 22px 18px 16px; border-radius: var(--r-lg); text-align: center;
  background: var(--card); border: 1px solid var(--line-2); box-shadow: var(--shadow-1);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.ncard-ava {
  width: 72px; height: 72px; border-radius: var(--r-circle); flex: none;
  background: var(--card-3) center/cover no-repeat;
  border: 1px solid var(--line-2); box-shadow: var(--shadow-1);
}
.ncard-ava.has-img { border-color: var(--line); }
.ncard-id { display: flex; flex-direction: column; gap: 4px; align-items: center; max-width: 100%; }
.ncard-name { font-size: 16px; font-weight: 650; color: var(--ink); }
.ncard-sub { font-size: 12px; color: var(--ink-3); }
.ncard-foot {
  margin-top: 6px; padding-top: 12px; border-top: 1px solid var(--line-2); width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 12px; color: var(--ink-3);
}
.ncard-foot .ic { width: 14px; height: 14px; stroke-width: 2.2; }

/* ============================================================================
   v13：设置分区导航 / 顶栏收口 / 小屏客户表 / 关键说明字号
   ========================================================================== */
.settings-nav {
  position: sticky; top: 0; z-index: 8;
  display: flex; gap: 6px; padding: 8px; overflow-x: auto;
  border: 1px solid var(--line-2); border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--card) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow-1);
}
.settings-nav button {
  flex: none; height: 32px; padding: 0 13px; border-radius: var(--r-pill);
  border: 1px solid transparent; background: transparent; color: var(--ink-2);
  font-size: 12.5px; cursor: pointer; transition: background var(--t), color var(--t);
}
.settings-nav button:hover { background: var(--hover); color: var(--ink); }
.settings-nav button[aria-pressed="true"] {
  color: var(--brand); background: var(--brand-soft); border-color: var(--brand-line);
}
.settings-sections { gap: 24px; }
.set-sec { display: flex; flex-direction: column; gap: 10px; scroll-margin-top: 74px; }
.set-sec-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; padding: 0 2px; }
.set-sec-head h3 { font-size: 15px; font-weight: 650; }
.set-sec-head .hint { margin: 0; }

/* 顶栏收口：到期和客户额度在窄屏先收起来；它们仍在设置/侧栏里可查。 */
@media (max-width: 1100px) { #me-expiry { display: none !important; } }
@media (max-width: 900px) { #seat-chip { display: none !important; } }
@media (max-width: 560px) {
  #conn-text { display: none; }
  #conn { padding: 0 9px; }
}

/* 关键说明文字不再用过小的字号。纯 ID / 时间 / 徽章仍可保留小字。 */
.ch-hint, .chcard .ch-notes, .chcard .ch-err { font-size: 12.5px; }
.ch-hint { line-height: 1.65; }
.chcard .ch-head .t i, .ch-status-card .ch-row i { font-size: 12px; }
.stat .d { font-size: 12.5px; }
.attach-note, .sys-msg { font-size: 12px; }

/* 小屏客户表：先隐藏“通道 ID / 首次联系”两列，避免整张表横向挤成一团；
   这两项仍可在客户资料弹窗里看。 */
@media (max-width: 640px) {
  .table th:nth-child(3), .table td:nth-child(3),
  .table th:nth-child(4), .table td:nth-child(4) { display: none; }
  .table { font-size: 12.5px; }
  .table th, .table td { padding-left: 8px; padding-right: 8px; }
}

/* ============================================================================
   概览页宽屏排版：整页有最大宽度，不把 6 张统计卡拉成一条无限长的横带。
   - 1440px 内居中；超大屏两侧留白，不再把趋势/套餐卡拉到变形
   - 700–1320px 用 3×2 的统计卡，避免 5+1 的孤儿行
   - 1321px 以上恢复 6 列一排，但整体仍在 1440px 内
   ========================================================================== */
.overview-page { width: 100%; max-width: 1440px; margin: 0 auto; }
@media (min-width: 700px) and (max-width: 1320px) {
  .overview-page .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1321px) {
  .overview-page .stats { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .overview-page .trend-bars { height: 190px; }
}

/* 概览右列「常用操作」：四个高频入口竖排，和大屏高度更平衡 */
@media (min-width: 1181px) {
  .overview-page .dash-panel {
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, .8fr);
  }
}
.quick-actions { display: flex; flex-direction: column; gap: 8px; }
.quick-act { width: 100%; justify-content: flex-start; height: 44px; }
.quick-act .ic { color: var(--brand); }

/* ============================================================================
   宽屏页面内容上限：消息页保持全宽（三栏聊天需要宽度），其余页面收在可读宽度内。
   ========================================================================== */
#view[data-view="contacts"] > .list-card,
#view[data-view="channels"] > .stack,
#view[data-view="channels"] > .card,
#view[data-view="reach"] > .stack,
#view[data-view="settings"] > .stack {
  width: 100%; max-width: 1440px; margin-left: auto; margin-right: auto;
}
#view[data-view="reach"] > .stack { max-width: 1200px; }
#view[data-view="settings"] > .stack { max-width: 1120px; }

/* ============================================================================
   v14：会话框视觉重做（A+B：微信的克制 + Telegram 的头像/分组信息流）
   功能不动：资料 / 语音 / 视频 / 置顶 / 状态 / 更多全部保留，只改呈现。
   ========================================================================== */
.chat { border-color: var(--line); border-radius: 16px; box-shadow: var(--shadow-2); }
.convs { background: var(--card); }
.convs .hd.convs-head {
  display: flex; flex-direction: column; align-items: stretch; gap: 10px;
  padding: 16px 16px 12px;
}
.convs-hd-row { display: flex; align-items: center; gap: 8px; }
.convs-hd-row b { font-size: 17px; font-weight: 700; letter-spacing: .01em; }
.convs-head .sbox {
  width: 100%; height: 38px; border-radius: 12px; padding: 0 12px;
  border-color: transparent; background: var(--field);
}
.convs-head .sbox:focus { border-color: var(--brand); background: var(--card); }
.convs-tools { padding: 0 14px 10px; border-bottom: 1px solid var(--line-2); }
.convs-tools .seg button { height: 28px; padding: 0 10px; border-radius: 8px; }

/* 左栏：去掉隔行底色，只留 hover / 选中，头像和信息按固定网格排 */
.conv-list > li:nth-child(odd) { background: transparent; }
.conv-list > li { margin: 0 8px; border-radius: 12px; }
.conv-list > li:hover { background: var(--hover); }
.conv { padding: 12px; gap: 4px 10px; }
.conv-who { font-size: 14px; font-weight: 650; }
.conv-time { font-size: 11px; }
.conv-last { font-size: 12.5px; }
.conv .badge {
  border: 0; padding: 2px 7px; border-radius: 6px;
  background: color-mix(in srgb, currentColor 10%, transparent);
  font-size: 10px;
}
.conv .unread {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  display: grid; place-items: center;
  background: var(--brand); color: #fff; font-size: 10.5px; font-weight: 700;
}
.conv[aria-selected="true"] {
  background: linear-gradient(90deg, color-mix(in srgb, var(--brand) 11%, transparent), transparent 90%);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 16%, transparent);
}
.conv[aria-selected="true"]::before { width: 3px; top: 10px; bottom: 10px; }

/* 聊天头部：头像 + 名字/状态 + 整齐的图标动作 */
.thread { background: var(--bg-2); }
.thread-head { padding: 14px 20px; gap: 12px; background: var(--card); }
.thread-head > .avatar { flex: none; }
.thread-name-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.thread-name-row .nm { font-size: 15.5px; font-weight: 700; }
.thread-sub { margin-top: 2px; font-size: 12px; color: var(--ink-3); }
.thread-actions { gap: 2px; flex-wrap: nowrap; }
.thread-act { width: 34px; height: 34px; border-radius: 50%; color: var(--ink-2); }
.thread-act:hover { background: var(--hover); color: var(--ink); }
.thread-act .ic { width: 18px; height: 18px; }
.thread-act-pin[aria-pressed="true"], .thread-act-pin.is-on { color: var(--brand); background: var(--brand-soft); }
.thread-head .st-chip { margin-left: 4px; }

/* 消息区：连续消息分组，头像只出现在组首 */
.msgs { padding: 24px 28px; gap: 2px; }
.msg { margin: 2px 0; max-width: min(620px, 74%); gap: 10px; }
.msg .av { margin-top: 0; }
.msg:not(.group-first) .av { visibility: hidden; }
.bubble {
  border-radius: 18px; padding: 10px 14px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 20px -18px rgba(15, 23, 42, .35);
}
.msg.in .bubble { border-radius: 18px 18px 18px 6px; box-shadow: 0 1px 2px rgba(15, 23, 42, .04); }
.msg.out .bubble { border-radius: 18px 18px 6px 18px; }
.msg.in:not(.group-first) .bubble { border-top-left-radius: 6px; }
.msg.in:not(.group-last) .bubble { border-bottom-left-radius: 6px; }
.msg.out:not(.group-first) .bubble { border-top-right-radius: 6px; }
.msg.out:not(.group-last) .bubble { border-bottom-right-radius: 6px; }
.msg.in .av .avatar { box-shadow: 0 0 0 1px var(--line-2); }
.msg-foot { margin-top: 6px; font-size: 11px; }
.msg-sender { font-size: 11.5px; font-weight: 600; color: var(--ink-2); }

/* 输入区：一个完整的 composer，而不是输入框和按钮硬拼 */
.composer { padding: 14px 20px 18px; background: var(--card); border-top: 1px solid var(--line-2); }
.cbox {
  display: flex; align-items: flex-end; gap: 6px; padding: 6px;
  border: 1px solid var(--line-2); border-radius: 18px; background: var(--card-2);
}
.cbox textarea {
  min-height: 40px; padding: 9px 10px; border: 0; background: transparent;
  box-shadow: none; border-radius: 12px;
}
.cbox textarea:focus { border: 0; background: transparent; box-shadow: none; }
.cbox .btn { height: 40px; border-radius: 12px; padding: 0 18px; flex: none; }
.composer-tools { padding: 0 4px; margin-top: 7px; }

@media (max-width: 640px) {
  .thread-head { padding: 10px 12px; gap: 8px; }
  .thread-head > .avatar { width: 36px !important; height: 36px !important; }
  .thread-sub, .thread-head .ch-chip { display: none; }
  .thread-head .st-chip { padding: 0 7px; }
  .thread-head .st-chip span { display: none; }
  .thread-actions { gap: 0; }
  .thread-act { width: 30px; height: 30px; }
  .thread-act .ic { width: 17px; height: 17px; }
  .msgs { padding: 16px 14px; }
  .msg { max-width: 88%; }
  .composer { padding: 10px 12px 12px; }
}

/* 顶栏主题按钮：图标 + “外观”，不再让商户猜太阳/月亮是什么 */
.theme-toggle { height: 36px; padding: 0 12px; border-radius: var(--r-pill); gap: 7px; }
.theme-toggle .ic { width: 17px; height: 17px; }
.theme-toggle .theme-toggle-label { font-size: 12.5px; color: var(--ink-2); line-height: 1; }
.theme-toggle:hover .theme-toggle-label { color: var(--ink); }
@media (max-width: 900px) {
  .theme-toggle { width: 36px; height: 36px; padding: 0; justify-content: center; }
  .theme-toggle .theme-toggle-label { display: none; }
}

/* ============================================================================
   v15：按通道切换桌面端聊天皮肤
   longxia = 桌面微信（绿色发送气泡 / 浅灰背景）
   qq      = 桌面 QQ（蓝色发送气泡 / 浅蓝背景）
   只改颜色、圆角、间距；不改接口、不改轮询、不改功能入口。
   ========================================================================== */
@media (min-width: 901px) {
  .chat { grid-template-columns: 300px minmax(0, 1fr); }
}
.convs .hd.convs-head { padding: 12px 14px 10px; gap: 8px; }
.convs-hd-row b { font-size: 16px; }
.convs-head .sbox { height: 34px; border-radius: 6px; }
.convs-tools { padding: 0 12px 8px; }
.conv-list > li { margin: 0 6px; }
.conv { padding: 9px 10px; gap: 3px 9px; }
.conv-who { font-size: 13.5px; font-weight: 600; }
.conv-last { font-size: 12px; }
.conv-time { font-size: 10.5px; }
.conv .badge { font-size: 9.5px; padding: 1px 6px; }
.conv .unread { min-width: 18px; height: 18px; padding: 0 5px; font-size: 10px; background: #fa5151; }
.conv[aria-selected="true"] {
  background: color-mix(in srgb, var(--ink) 6%, transparent);
  box-shadow: none;
}
.conv[aria-selected="true"]::before { width: 2px; top: 8px; bottom: 8px; background: var(--c, var(--brand)); }

.thread { background: var(--bg-2); }
.thread[data-channel="longxia"] { --out-bg: #95ec69; --out-ink: #111; background: #f2f2f2; }
.thread[data-channel="qq"] { --out-bg: #12b7f5; --out-ink: #fff; background: #f3f8fc; }
.thread-head { padding: 10px 16px; gap: 10px; }
.thread-name-row .nm { font-size: 15px; font-weight: 650; }
.thread-sub { font-size: 11.5px; }
.thread-actions { gap: 0; }
.thread-act { width: 30px; height: 30px; border-radius: 4px; }
.thread-act .ic { width: 17px; height: 17px; }
.thread-head .ch-chip { font-size: 10.5px; }

.msgs { padding: 16px 18px; gap: 1px; }
.msg { margin: 1px 0; max-width: min(560px, 68%); gap: 8px; }
.bubble {
  padding: 7px 10px; border-radius: 4px; font-size: 14px; line-height: 1.5;
  box-shadow: none;
}
.msg.in .bubble { border-radius: 4px; background: #fff; border: 1px solid rgba(0, 0, 0, .06); box-shadow: none; }
.msg.out .bubble { border-radius: 4px; background: var(--out-bg, var(--brand)); color: var(--out-ink, #fff); border-color: transparent; box-shadow: none; }
.msg.in .av .avatar { box-shadow: none; }
.msg-foot { margin-top: 3px; font-size: 10.5px; }
.msg-sender { font-size: 11px; }

.composer { padding: 8px 16px 12px; background: var(--card); }
.cbox { padding: 3px; border-radius: 6px; background: var(--card); border-color: var(--line); }
.cbox textarea { min-height: 38px; padding: 8px 9px; border-radius: 2px; font-size: 14px; }
.cbox .btn { height: 38px; border-radius: 4px; padding: 0 16px; }
.composer-tools { margin-top: 4px; }

:root[data-theme="dark"] .thread[data-channel="longxia"] { --out-bg: #3e9e5f; --out-ink: #fff; background: #101010; }
:root[data-theme="dark"] .thread[data-channel="qq"] { --out-bg: #0e7fa8; --out-ink: #fff; background: #0d131a; }
:root[data-theme="dark"] .msg.in .bubble { background: #1b1b1b; border-color: rgba(255, 255, 255, .06); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .thread[data-channel="longxia"] { --out-bg: #3e9e5f; --out-ink: #fff; background: #101010; }
  :root:not([data-theme="light"]) .thread[data-channel="qq"] { --out-bg: #0e7fa8; --out-ink: #fff; background: #0d131a; }
  :root:not([data-theme="light"]) .msg.in .bubble { background: #1b1b1b; border-color: rgba(255, 255, 255, .06); }
}

@media (max-width: 640px) {
  .thread-head { padding: 8px 10px; }
  .thread-act { width: 28px; height: 28px; }
  .msgs { padding: 12px 10px; }
  .msg { max-width: 86%; }
  .composer { padding: 7px 10px 10px; }
}

.thread-sub.is-closed { color: var(--warn); }

/* 小屏客户列表：表格行变成卡片，避免 7 列横向挤成一团 */
@media (max-width: 640px) {
  .table-wrap { overflow: visible; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table thead { display: none; }
  .table tr {
    margin: 0 0 10px; padding: 12px;
    border: 1px solid var(--line-2); border-radius: 12px; background: var(--card);
  }
  .table td {
    border: 0; padding: 4px 0;
    display: flex; align-items: center; gap: 10px;
  }
  .table td::before {
    content: attr(data-label); width: 64px; flex: none;
    color: var(--ink-3); font-size: 12px;
  }
  .table td:first-child { padding-bottom: 8px; }
  .table td:first-child::before { display: none; }
  .table td.contact-actions {
    margin-top: 6px; padding-top: 10px; border-top: 1px solid var(--line-2);
    flex-wrap: wrap; justify-content: flex-end;
  }
  .table td.contact-actions::before { display: none; }
}

/* 群发页宽屏：收件人/历史在左，内容在右；手机仍按顺序一列 */
.reach-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.reach-grid > .card:nth-child(1) { grid-column: 1; grid-row: 1; }
.reach-grid > .card:nth-child(2) { grid-column: 2; grid-row: 1 / span 2; }
.reach-grid > .card:nth-child(3) { grid-column: 1; grid-row: 2; }
@media (max-width: 1000px) {
  .reach-grid { display: flex; flex-direction: column; gap: 16px; }
}
