/* visitor.css - 访客端样式（由 public/visitor.html 内联样式提取；含 WhatsApp 平台模板） */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
:root {
  --theme: #1677ff;
  --theme-grad: linear-gradient(135deg, #1677ff 0%, #4d9bff 100%);
  --bg: #f0f2f7;
  --card: #ffffff;
  --ink: #1a2233;
  --ink-2: #5c6b85;
  --ink-3: #9aa7bd;
  --line: #e8ecf3;
  --radius: 14px;
}
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--ink);
  display: flex; flex-direction: column;
  overflow: hidden;
}
#app { display: flex; flex-direction: column; height: 100%; }

/* ================= 头部 ================= */
.v-header {
  position: relative;
  background: var(--theme-grad);
  color: #fff;
  padding: 16px 18px calc(16px);
  /* v2.87 公告并进蓝色横幅：原来一行变成「头部一行 + 公告一行」 */
  display: flex; flex-direction: column; align-items: stretch; gap: 10px;
  flex-shrink: 0;
  z-index: 10;
}
.v-head-row { display: flex; align-items: center; gap: 13px; min-width: 0; }
/* 横幅里的公告条：点一下复制续聊链接 */
.v-notice {
  display: flex; align-items: center; gap: 6px;
  background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .24);
  border-radius: 10px; padding: 6px 10px;
  font-size: 12px; line-height: 1.5; color: #fff;
  cursor: pointer; user-select: none;
}
.v-notice .vn-ic { flex-shrink: 0; }
.v-notice .vn-t { flex: 1; min-width: 0; opacity: .96; }
.v-notice .vn-copy {
  flex-shrink: 0; font-size: 11px; padding: 2px 8px; border-radius: 999px;
  background: rgba(255, 255, 255, .26); white-space: nowrap;
}
.v-notice:active { background: rgba(255, 255, 255, .24); }
.v-header::after {
  content: '';
  position: absolute; left: 0; right: 0; bottom: -18px; height: 18px;
  background: var(--bg);
  border-radius: 18px 18px 0 0;
}
.v-avatar {
  position: relative;
  width: 48px; height: 48px; border-radius: 50%;
  background: rgba(255,255,255,.22);
  display: flex; align-items: center; justify-content: center;
  font-size: 27px; flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0,0,0,.14), inset 0 0 0 1.5px rgba(255,255,255,.35);
  overflow: visible;
}
.v-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.v-avatar .online-dot {
  position: absolute; right: -1px; bottom: -1px;
  width: 13px; height: 13px; border-radius: 50%;
  background: #2ee66b; border: 2.5px solid #fff0;
  box-shadow: 0 0 0 2px rgba(46,230,107,.35);
  animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 2px rgba(46,230,107,.35);} 50% { box-shadow: 0 0 0 5px rgba(46,230,107,.12);} }
.v-title { font-size: 16.5px; font-weight: 700; letter-spacing: .3px; display: flex; align-items: center; gap: 7px; }
.v-sub { font-size: 12px; opacity: .88; margin-top: 3px; }
.v-status {
  margin-left: auto; font-size: 11.5px; font-weight: 500;
  background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.25);
  padding: 4px 11px; border-radius: 999px; flex-shrink: 0;
  backdrop-filter: blur(4px);
}

/* ================= 平台导航条 ================= */
.nav-bar {
  background: var(--theme-grad);
  color: #fff; display: flex; align-items: center; justify-content: space-between;
  padding: calc(6px + env(safe-area-inset-top)) 14px 6px;
  font-size: 15px; font-weight: 600; flex-shrink: 0;
  opacity: .95;
}
body[data-tpl="default"] .nav-bar { display: none; }

/* ================= WhatsApp 模板（真实界面结构，v2.21） =================
   参考 WhatsApp 聊天页：米色涂鸦墙纸、气泡带尾巴（访客绿/客服白）、药丸输入条。
   结构与关键颜色写死在此（品牌色只影响 --theme 点缀，不会破坏界面形态）。 */
body[data-tpl="whatsapp"] {
  --bg: #efe7dd;
  background-color: #efe7dd;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='280' height='280' viewBox='0 0 280 280'%3E%3Cg fill='none' stroke='%23d5cab9' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round' opacity='.55'%3E%3Ccircle cx='42' cy='44' r='11'/%3E%3Cpath d='M38 44h8M42 40v8'/%3E%3Cpath d='M118 26l9 9-9 9-9-9z'/%3E%3Cpath d='M198 40c-5-7 5-15 9-8 4-7 14 1 9 8l-9 10z'/%3E%3Cpath d='M246 96h18m-9-9v18'/%3E%3Ccircle cx='132' cy='132' r='13'/%3E%3Cpath d='M127 130a5 5 0 0 1 10 0M127 137a7 7 0 0 0 10 0'/%3E%3Cpath d='M196 128h16l-3 15h-10zM200 143v7M208 143v7M214 122v8'/%3E%3Cpath d='M52 186c0-11 15-11 15 0s-15 11-15 0z'/%3E%3Cpath d='M128 196q11-13 22 0t-11 14z'/%3E%3Cpath d='M206 186l7 7m0-7-7 7'/%3E%3Cpath d='M60 246l12 12m0-12-12 12'/%3E%3Ccircle cx='150' cy='252' r='8'/%3E%3Cpath d='M147 252h6m-3-3v6'/%3E%3Cpath d='M236 236l14-6-6 14-3-5z'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 280px auto;
}
body[data-tpl="whatsapp"] .v-body { background: transparent; }
/* 头部：纯 WhatsApp 青绿（不跟随品牌渐变） */
body[data-tpl="whatsapp"] .v-header { background: linear-gradient(135deg, #008069, #00947c); }
/* 气泡：圆角 + 顶部尾巴；访客浅绿、客服白 */
body[data-tpl="whatsapp"] .msg-row .msg-bubble {
  border-radius: 8px; position: relative;
  box-shadow: 0 1px .5px rgba(11,20,26,.13);
}
body[data-tpl="whatsapp"] .msg-row.visitor .msg-bubble {
  background: #d9fdd3; color: #111b21; border-top-right-radius: 3px;
}
body[data-tpl="whatsapp"] .msg-row.visitor .msg-bubble::after {
  content: ''; position: absolute; top: 0; right: -7px;
  width: 7px; height: 13px; background: #d9fdd3;
  clip-path: polygon(0 0, 100% 0, 0 100%);
}
body[data-tpl="whatsapp"] .msg-row.agent .msg-bubble {
  background: #fff; color: #111b21; border-top-left-radius: 3px;
}
body[data-tpl="whatsapp"] .msg-row.agent .msg-bubble::after {
  content: ''; position: absolute; top: 0; left: -7px;
  width: 7px; height: 13px; background: #fff;
  clip-path: polygon(0 0, 100% 0, 100% 100%);
}
body[data-tpl="whatsapp"] .msg-time { color: #667781; }
/* 1:1 聊天不显示访客自己的头像（贴近 WhatsApp 原生观感），客服消息保留头像 */
body[data-tpl="whatsapp"] .msg-row.visitor .msg-ava { display: none; }
/* 输入区：贴在墙纸上的白色药丸输入条 */
body[data-tpl="whatsapp"] .v-footer-wrap {
  background: transparent; box-shadow: none; border-radius: 0;
  padding-bottom: calc(6px + env(safe-area-inset-bottom));
}
body[data-tpl="whatsapp"] .v-input {
  background: #fff; border: none; border-radius: 999px;
  padding: 11px 16px; box-shadow: 0 1px 2px rgba(11,20,26,.12);
}
body[data-tpl="whatsapp"] .v-input:focus { background: #fff; }
body[data-tpl="whatsapp"] .v-btn { border-radius: 999px; }
body[data-tpl="whatsapp"] .v-footer-text { background: transparent; }
/* 滚动通知：WhatsApp 样式圆角提示卡（公告 v2.87 起并进蓝色横幅，不再单独成条） */
body[data-tpl="whatsapp"] .inform-bar {
  background: #fdf4c9; border-bottom: none; color: #54656d;
}
.nav-back, .nav-menu { font-size: 17px; opacity: .85; width: 24px; text-align: center; }
.recall-capsule {
  background: rgba(26,34,51,.05) !important; color: var(--ink-3) !important;
  font-size: 11.5px !important; text-align: center; border-radius: 999px !important;
  padding: 4px 12px; box-shadow: none !important; margin: 0 auto;
}
.recall-link { color: var(--theme); margin-left: 8px; cursor: pointer; }

/* ================= 公告（v2.87 起并进蓝色横幅 .v-header 里的 .v-notice，不再单独成条） ================= */

/* ================= 消息区 ================= */
.v-body { flex: 1; overflow-y: auto; padding: 14px 14px 6px; -webkit-overflow-scrolling: touch; }
.v-body::-webkit-scrollbar { width: 0; }

/* 欢迎屏（无消息时） */
.welcome-card {
  margin: 8vh auto 0; max-width: 300px; text-align: center;
  background: var(--card); border-radius: 20px; padding: 34px 26px;
  box-shadow: 0 10px 40px rgba(30,60,120,.08);
}
.welcome-card .w-ava {
  width: 68px; height: 68px; border-radius: 50%; margin: 0 auto 16px;
  background: linear-gradient(135deg, rgba(22,119,255,.12), rgba(22,119,255,.22));
  display: flex; align-items: center; justify-content: center; font-size: 36px;
}
.welcome-card .w-ava img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.welcome-card h3 { font-size: 16.5px; font-weight: 700; color: var(--ink); margin-bottom: 8px; }
.welcome-card p { font-size: 13px; color: var(--ink-2); line-height: 1.7; }

.msg-row { display: flex; margin-bottom: 16px; align-items: flex-start; gap: 9px; }
.msg-row.visitor { flex-direction: row-reverse; }
.msg-ava {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--card); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 18px;
  box-shadow: 0 2px 8px rgba(30,60,120,.10), inset 0 0 0 1px var(--line);
  overflow: hidden;
}
.msg-ava img { width: 100%; height: 100%; object-fit: cover; }
.msg-box { max-width: 74%; width: fit-content; }
.msg-bubble {
  padding: 10px 13px; border-radius: 16px; font-size: 15px;
  line-height: 1.6; word-break: break-word; white-space: pre-wrap;
  width: fit-content; max-width: 100%;
}
.msg-row.agent .msg-bubble {
  background: var(--card); color: var(--ink);
  border-top-left-radius: 5px;
  box-shadow: 0 2px 8px rgba(30,60,120,.06), inset 0 0 0 1px var(--line);
}
.msg-row.visitor .msg-bubble {
  background: linear-gradient(135deg, #95ec69 0%, #7ed957 100%); color: #11181f;
  border-top-right-radius: 5px;
  box-shadow: 0 3px 10px rgba(74,164,96,.22);
}
.msg-bubble img { max-width: 100%; max-height: 260px; border-radius: 10px; display: block; margin-top: 4px; cursor: zoom-in; }
/* v2.90.49 访客端消息里的数字：微信那种蓝，点一下复制 */
.msg-bubble .num { color: #576b95; cursor: pointer; font-weight: 600; }
body[data-tpl="whatsapp"] .msg-bubble .num { color: #0a7cff; }
.msg-bubble audio { width: 100%; max-width: 210px; margin-top: 4px; }
.msg-time { font-size: 10.5px; color: var(--ink-3); margin-top: 5px; padding: 0 3px; }
.msg-row.visitor .msg-time { text-align: right; }

/* ================= 输入区 ================= */
.v-footer-wrap {
  flex-shrink: 0;
  background: var(--card);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -6px 30px rgba(30,60,120,.10);
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
}
.v-tool { display: flex; gap: 6px; padding: 0 4px 8px; align-items: center; }
.v-tool-btn {
  background: none; border: none; cursor: pointer; padding: 5px 7px;
  font-size: 12px; color: var(--ink-2); border-radius: 8px;
  display: flex; align-items: center; gap: 5px;
}
.v-tool-btn:active { background: var(--bg); }
.v-tool-btn .ic { font-size: 19px; }
.v-input-row { display: flex; gap: 9px; align-items: flex-end; }
.v-input {
  flex: 1; border: 1.5px solid var(--line); border-radius: 12px;
  padding: 10px 13px; font-size: 15px; outline: none; resize: none;
  max-height: 96px; line-height: 1.5; font-family: inherit;
  background: #f7f9fc; transition: border-color .15s;
}
.v-input:focus { border-color: var(--theme); background: #fff; }
.v-btn {
  background: var(--theme-grad); color: #fff; border: none;
  border-radius: 12px; min-width: 66px; height: 42px; font-size: 15px;
  font-weight: 600; flex-shrink: 0; cursor: pointer;
  box-shadow: 0 4px 12px rgba(22,119,255,.3);
}
.v-btn:disabled { opacity: .45; box-shadow: none; }
.v-btn:active { transform: scale(.97); }

/* 录音条 */
.recording-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 8px; font-size: 14px; color: var(--ink-2);
}
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: #ff4d4f; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .25; } }
.rec-time { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink); }
.rec-actions { margin-left: auto; display: flex; gap: 8px; }
.rec-cancel { background: #eef1f6; color: var(--ink-2); border: none; border-radius: 10px; padding: 8px 16px; font-size: 14px; cursor: pointer; }
.rec-send { background: var(--theme-grad); color: #fff; border: none; border-radius: 10px; padding: 8px 18px; font-size: 14px; font-weight: 600; cursor: pointer; }

/* ================= 状态页 ================= */
.block-page {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 32px;
  text-align: center; background: var(--bg);
}
.block-card {
  background: var(--card); border-radius: 20px; padding: 38px 30px;
  max-width: 320px; box-shadow: 0 10px 40px rgba(30,60,120,.08);
}
.block-icon { font-size: 52px; margin-bottom: 16px; }
.block-title { font-size: 16.5px; color: var(--ink); font-weight: 700; margin-bottom: 9px; }
.block-desc { font-size: 13.5px; color: var(--ink-2); line-height: 1.75; }
.spinner {
  width: 34px; height: 34px; margin: 0 auto 16px;
  border: 3px solid rgba(22,119,255,.18); border-top-color: var(--theme);
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ================= 询前表单 ================= */
.mask {
  position: fixed; inset: 0; background: rgba(15,23,42,.55);
  z-index: 50; display: flex; align-items: center; justify-content: center; padding: 22px;
  backdrop-filter: blur(3px);
}
.form-card {
  background: var(--card); width: 100%; max-width: 380px;
  border-radius: 22px; padding: 28px 24px 24px;
  max-height: 86vh; overflow-y: auto;
  animation: cardIn .28s cubic-bezier(.2,.9,.3,1.2);
  box-shadow: 0 24px 70px rgba(0,0,0,.28);
}
@keyframes cardIn { from { transform: translateY(24px) scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }
.form-ava {
  width: 54px; height: 54px; border-radius: 50%; margin: 0 auto 12px;
  background: linear-gradient(135deg, rgba(22,119,255,.12), rgba(22,119,255,.22));
  display: flex; align-items: center; justify-content: center; font-size: 28px;
}
.form-ava img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.form-title { font-size: 16.5px; font-weight: 700; text-align: center; margin-bottom: 4px; color: var(--ink); }
.form-sub { font-size: 12.5px; color: var(--ink-3); text-align: center; margin-bottom: 20px; }
.form-item { margin-bottom: 15px; }
.form-label { font-size: 13px; color: var(--ink-2); margin-bottom: 7px; display: block; font-weight: 500; }
.form-label .req { color: #ff4d4f; margin-left: 2px; }
.form-input {
  width: 100%; border: 1.5px solid var(--line); border-radius: 12px;
  padding: 11px 13px; font-size: 15px; outline: none; font-family: inherit;
  background: #f7f9fc; transition: border-color .15s;
}
.form-input:focus { border-color: var(--theme); background: #fff; }
textarea.form-input { resize: none; min-height: 78px; }
.form-btn {
  width: 100%; margin-top: 10px;
  background: var(--theme-grad); color: #fff; border: none;
  border-radius: 13px; height: 47px; font-size: 16px; font-weight: 600;
  cursor: pointer; box-shadow: 0 6px 16px rgba(22,119,255,.3);
}
.form-btn:disabled { opacity: .6; }
.form-btn:active { transform: scale(.98); }

/* ================= 验证层 ================= */
.verify-wrap { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px; }
.verify-card { background: var(--card); border-radius: 20px; padding: 32px 26px; width: 100%; max-width: 340px; text-align: center; box-shadow: 0 10px 40px rgba(30,60,120,.08); }
.verify-card.bg { padding: 0; overflow: hidden; background-size: cover; background-position: center; }
.verify-card.bg .verify-inner { background: rgba(255,255,255,.92); margin: 90px 14px 14px; border-radius: 14px; padding: 22px 18px; }
.verify-title { font-size: 16px; font-weight: 700; margin-bottom: 14px; }
.verify-btn {
  width: 100%; height: 46px; border: none; border-radius: 12px;
  background: var(--theme-grad); color: #fff; font-size: 15px; font-weight: 600; cursor: pointer;
}
.verify-input {
  width: 100%; border: 1.5px solid var(--line); border-radius: 12px; padding: 11px 13px;
  font-size: 15px; outline: none; margin-bottom: 12px; text-align: center; letter-spacing: 2px;
}
.verify-code-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.verify-code-img { font-family: Consolas, monospace; font-size: 22px; font-weight: 700; letter-spacing: 5px; font-style: italic;
  background: linear-gradient(90deg,#eef2f7,#e3ecf5); padding: 8px 14px; border-radius: 10px; user-select: none; color: #33445f; }
.slide-track { position: relative; height: 44px; background: #eef1f6; border-radius: 12px; overflow: hidden; margin-bottom: 12px; }
.slide-tip { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 13px; color: var(--ink-3); }
.slide-block {
  position: absolute; top: 3px; left: 3px; width: 38px; height: 38px; border-radius: 10px;
  background: var(--theme-grad); cursor: grab; display: flex; align-items: center; justify-content: center; color: #fff;
}
.slide-ok { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: #e8f8ee; color: #00b42a; font-size: 14px; font-weight: 600; }
/* 弹窗公告 */
.pub-mask { position: fixed; inset: 0; background: rgba(15,23,42,.55); z-index: 60; display: flex; align-items: center; justify-content: center; padding: 24px; }
.pub-card { background: var(--card); border-radius: 18px; max-width: 340px; width: 100%; overflow: hidden; animation: cardIn .25s; }
.pub-head { background: var(--theme-grad); color: #fff; padding: 12px 16px; font-weight: 700; font-size: 15px; display: flex; justify-content: space-between; }
.pub-close { cursor: pointer; opacity: .85; }
.pub-body { padding: 18px 18px 22px; font-size: 14px; line-height: 1.8; color: var(--ink-2); white-space: pre-wrap; max-height: 50vh; overflow-y: auto; }
/* 滚动通知 */
.inform-bar { background: #fffbe6; border-bottom: 1px solid #ffe58f; overflow: hidden; flex-shrink: 0; height: 32px; display: flex; align-items: center; }
.inform-track { white-space: nowrap; display: inline-block; padding-left: 100%; animation: marquee 14s linear infinite; font-size: 12.5px; color: #9a6d1b; }
@keyframes marquee { to { transform: translateX(-100%); } }
/* 底部标识 */
.v-footer-text { text-align: center; font-size: 11px; color: var(--ink-3); padding: 4px 0 6px; background: var(--bg); flex-shrink: 0; }
/* 消息链接 */
.msg-link { color: inherit; text-decoration: underline; cursor: pointer; word-break: break-all; }
.msg-link-copy { display: inline-flex; align-items: center; gap: 3px; background: rgba(0,0,0,.08); border-radius: 6px; padding: 1px 8px; cursor: pointer; font-size: 13px; }
.msg-row.me .msg-link-copy { background: rgba(255,255,255,.2); }
/* VIP 标识 */
.vip-badge { display: inline-block; font-size: 10px; font-weight: 700; color: var(--theme); background: rgba(255,255,255,.85); border: 1px solid var(--theme); border-radius: 4px; padding: 0 5px; margin-left: 6px; vertical-align: 1px; }

/* 图片预览 */
.img-viewer {
  position: fixed; inset: 0; background: rgba(0,0,0,.92); z-index: 100;
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn .18s;
}
@keyframes fadeIn { from { opacity: 0; } }
.img-viewer img { max-width: 96vw; max-height: 90vh; border-radius: 6px; }

/* ================= v2.32：现代观感升级 ================= */
/* 默认模板：柔和渐变背景 + 圆角头部 + 卡片化气泡 */
body[data-tpl="default"] { background: linear-gradient(180deg, #eef3fb 0%, #f7f9fd 100%); }
body[data-tpl="default"] .v-header { border-radius: 0 0 22px 22px; box-shadow: 0 8px 24px rgba(30,60,120,.16); }
body[data-tpl="default"] .v-header::after { display: none; }
body[data-tpl="default"] .v-body { background: transparent; }
body[data-tpl="default"] .msg-row.agent .msg-bubble { border-radius: 14px; border-top-left-radius: 4px; }
body[data-tpl="default"] .msg-row.visitor .msg-bubble { border-radius: 14px; border-top-right-radius: 4px; }
body[data-tpl="default"] .v-input { border-radius: 999px; }
body[data-tpl="default"] .v-btn { border-radius: 999px; }

/* WhatsApp 模板细节打磨 */
body[data-tpl="whatsapp"] .v-header { box-shadow: 0 2px 10px rgba(11,20,26,.18); }
body[data-tpl="whatsapp"] .v-avatar { background: rgba(255,255,255,.28); box-shadow: 0 2px 8px rgba(0,0,0,.16); }
body[data-tpl="whatsapp"] .msg-bubble { font-size: 14.5px; line-height: 1.55; padding: 7px 10px 8px; }
body[data-tpl="whatsapp"] .msg-time { font-size: 10.5px; margin-top: 3px; }
body[data-tpl="whatsapp"] .v-input { font-size: 15px; }
body[data-tpl="whatsapp"] .v-btn { background: #008069; box-shadow: 0 2px 8px rgba(0,128,105,.28); }
body[data-tpl="whatsapp"] .v-footer-wrap { padding-top: 6px; }
body[data-tpl="whatsapp"] .welcome-card { background: #fff; box-shadow: 0 6px 24px rgba(11,20,26,.12); }

/* 「客服请求上传图片」卡片 */
.msg-bubble.ask-card {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  background: var(--card); border: 1.5px dashed var(--theme);
  border-radius: 16px; padding: 16px 18px 14px; text-align: center;
  box-shadow: 0 2px 10px rgba(30,60,120,.08);
}
.ask-card .ac-ic { font-size: 26px; }
.ask-card .ac-t { font-size: 13.5px; font-weight: 700; color: var(--ink); }
.ask-card .ac-s { font-size: 12.5px; color: var(--ink-2); line-height: 1.6; }
.ask-card .ac-btn {
  margin-top: 6px; background: var(--theme-grad); color: #fff; border: none;
  border-radius: 999px; padding: 8px 22px; font-size: 13.5px; font-weight: 600; cursor: pointer;
  box-shadow: 0 4px 12px rgba(22,119,255,.24);
}
.ask-card .ac-btn:active { transform: scale(.97); }
body[data-tpl="whatsapp"] .msg-row.agent .msg-bubble.ask-card { border-color: #008069; }
body[data-tpl="whatsapp"] .ask-card .ac-btn { background: #008069; box-shadow: 0 4px 12px rgba(0,128,105,.24); }

/* 会话已结束 */
.ended-wrap {
  flex-shrink: 0; display: flex; justify-content: center;
  padding: 12px 16px calc(16px + env(safe-area-inset-bottom));
}
.ended-card {
  background: var(--card); border-radius: 18px; padding: 20px 22px;
  text-align: center; width: 100%; max-width: 420px;
  box-shadow: 0 -6px 30px rgba(30,60,120,.10), inset 0 0 0 1px var(--line);
}
.ended-card .e-ic { font-size: 30px; }
.ended-card .e-t { font-size: 15px; font-weight: 700; margin-top: 6px; color: var(--ink); }
.ended-card .e-s { font-size: 12.5px; color: var(--ink-2); margin-top: 6px; line-height: 1.65; }
.ended-card .e-btn {
  margin-top: 13px; background: var(--theme-grad); color: #fff; border: none;
  border-radius: 999px; padding: 9px 26px; font-size: 14px; font-weight: 600; cursor: pointer;
}
.ended-card .e-btn:active { transform: scale(.97); }

/* 宽屏（电脑打开）：居中成「App 窗口」卡片，观感更现代 */
@media (min-width: 820px) {
  #app {
    max-width: 620px; width: 100%; margin: 0 auto;
    border-radius: 20px; overflow: hidden;
    box-shadow: 0 26px 70px rgba(24,48,88,.20), 0 0 0 1px rgba(255,255,255,.55);
  }
  body[data-tpl="default"] #app { background: linear-gradient(180deg, #eef3fb 0%, #f7f9fd 100%); }
  body[data-tpl="whatsapp"] #app { background: inherit; }
  body[data-tpl="whatsapp"] .v-header { border-radius: 20px 20px 0 0; }
  .v-footer-wrap { border-radius: 20px 20px 0 0; }
  body[data-tpl="whatsapp"] .v-footer-wrap { border-radius: 0; }
}

/* ================= v2.33 访客端细节打磨 ================= */
/* 默认模板也加气泡小尾巴（自己发的绿、客服的白），与微信观感一致 */
body[data-tpl="default"] .msg-bubble { position: relative; }
body[data-tpl="default"] .msg-row.agent .msg-bubble::after {
  content: ''; position: absolute; left: -5px; top: 12px; width: 0; height: 0;
  border: 6px solid transparent; border-right-color: var(--card); border-left: 0;
}
body[data-tpl="default"] .msg-row.visitor .msg-bubble::after {
  content: ''; position: absolute; right: -5px; top: 12px; width: 0; height: 0;
  border: 6px solid transparent; border-left-color: #8fe066; border-right: 0;
}
.v-tool-btn {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 6px 10px; font-weight: 500;
}
.v-tool-btn:active { background: var(--bg); }
.v-tool-btn .ic { font-size: 17px; }
body[data-tpl="whatsapp"] .v-tool-btn { background: rgba(255, 255, 255, .92); border-color: transparent; }
body[data-tpl="whatsapp"] .v-input-row .v-btn { box-shadow: 0 3px 10px rgba(0, 128, 105, .3); }
.v-header { padding-top: calc(14px + env(safe-area-inset-top)); }
.welcome-card h3 { letter-spacing: .2px; }

/* =====================================================================
   v2.35 访客端视觉升级：给「扫码进来咨询的人」一个更现代、更好用的界面
   ===================================================================== */
/* ---------- 头部 ---------- */
.v-header { padding: 15px 16px; gap: 12px; box-shadow: 0 6px 20px rgba(6, 40, 32, .16); }
.v-avatar {
  width: 47px; height: 47px; font-size: 24px;
  box-shadow: 0 6px 18px rgba(4, 30, 24, .25), inset 0 0 0 2px rgba(255, 255, 255, .55);
}
.v-id { flex: 1; min-width: 0; }
.v-title { font-size: 16px; font-weight: 750; letter-spacing: .2px; }
.v-sub {
  font-size: 11.5px; opacity: .9; margin-top: 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.v-status {
  display: inline-flex; align-items: center; gap: 5px; flex-shrink: 0;
  font-size: 11.5px; font-weight: 600; padding: 5px 11px; border-radius: 999px;
  background: rgba(255, 255, 255, .2); border: 1px solid rgba(255, 255, 255, .34);
  backdrop-filter: blur(6px);
}
.v-status .st-dot {
  width: 7px; height: 7px; border-radius: 50%; background: #8df5b4;
  box-shadow: 0 0 0 3px rgba(141, 245, 180, .26);
}
body[data-tpl="whatsapp"] .nav-bar {
  background: linear-gradient(135deg, #008069, #00947c);
  padding-bottom: 8px;
}
body[data-tpl="whatsapp"] .v-header { background: linear-gradient(135deg, #008069, #00947c); box-shadow: 0 8px 22px rgba(0, 88, 72, .22); }

/* ---------- 首屏欢迎（含快捷提问） ---------- */
.welcome-card {
  max-width: 336px; padding: 26px 22px 20px; border-radius: 22px;
  box-shadow: 0 20px 50px rgba(6, 40, 32, .13), inset 0 0 0 1px rgba(255, 255, 255, .6);
}
.welcome-card .w-ava {
  width: 66px; height: 66px; font-size: 33px; margin-bottom: 14px;
  box-shadow: 0 10px 24px rgba(6, 40, 32, .14), inset 0 0 0 3px #fff;
}
.welcome-card h3 { font-size: 17px; margin-bottom: 7px; }
.welcome-card p { font-size: 12.5px; line-height: 1.65; }
.w-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 16px; }
.w-chip {
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  border-radius: 999px; padding: 7px 14px; font-size: 12.5px; cursor: pointer;
  transition: all .16s ease; font-family: inherit;
}
.w-chip:hover, .w-chip:active {
  border-color: color-mix(in srgb, var(--theme) 45%, #fff);
  color: var(--theme); background: color-mix(in srgb, var(--theme) 7%, #fff);
}
.w-tip { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 15px; font-size: 11px; color: var(--ink-3); }
.w-tip i { width: 6px; height: 6px; border-radius: 50%; background: #2ee66b; box-shadow: 0 0 0 3px rgba(46, 230, 107, .18); }

/* ---------- 气泡：时间收到气泡里（微信/WhatsApp 观感） ---------- */
.b-time {
  float: right; margin: 5px -2px -3px 10px;
  font-size: 10.5px; opacity: .55; white-space: nowrap; user-select: none;
}
.b-time .b-tick { font-style: normal; margin-left: 3px; font-weight: 700; color: #2f8fe6; }
.msg-row.visitor .b-time .b-tick { color: #0b7f66; }
/* v2.90.81 乐观发送：发送中 / 发送失败可点重试 */
.b-time .b-pend { font-style: normal; margin-left: 4px; color: #86909c; }
.b-time .b-fail { font-style: normal; margin-left: 4px; color: #e5484d; text-decoration: underline; cursor: pointer; }
.msg-row.visitor .b-time .b-fail { color: #ffd7d7; }
.msg-row.pending .msg-bubble, .msg-bubble.pending { opacity: .62; }
.msg-row { animation: msgIn .18s ease-out; }
@keyframes msgIn { from { opacity: 0; transform: translateY(6px); } }
.msg-time { margin-top: 3px; }

/* ---------- 工具条 + 按住说话 ---------- */
.v-tool { gap: 8px; padding: 0 2px 9px; }
.v-tool-btn {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--card); border: 1px solid var(--line); border-radius: 999px;
  padding: 7px 13px; font-size: 12.5px; color: var(--ink-2); cursor: pointer;
  transition: all .16s ease; font-family: inherit;
}
.v-tool-btn svg { width: 17px; height: 17px; display: block; }
.v-tool-btn:hover, .v-tool-btn:active { background: var(--bg); }
.v-tool-btn.on {
  color: var(--theme); border-color: color-mix(in srgb, var(--theme) 40%, #fff);
  background: color-mix(in srgb, var(--theme) 8%, #fff);
}
.v-hold-row { padding: 2px 2px 4px; }
.v-hold-btn {
  width: 100%; height: 50px; border-radius: 15px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink-2);
  font-size: 15px; font-weight: 650; font-family: inherit; cursor: pointer;
  user-select: none; touch-action: none; transition: all .12s ease;
}
.v-hold-btn.on {
  background: color-mix(in srgb, var(--theme) 12%, #fff);
  border-color: color-mix(in srgb, var(--theme) 55%, #fff);
  color: var(--theme); transform: scale(.99);
}
.v-hold-btn.cancel { background: #fdeeee; border-color: #f4c7c8; color: #e5484d; }
body[data-tpl="whatsapp"] .v-hold-btn { background: rgba(255, 255, 255, .95); border-color: transparent; }

/* 录音提示层 */
.hold-tip {
  position: fixed; left: 50%; bottom: 190px; transform: translateX(-50%); z-index: 60;
  min-width: 196px; padding: 16px 22px 14px; border-radius: 20px; text-align: center;
  background: rgba(16, 24, 32, .86); color: #fff; backdrop-filter: blur(9px);
  box-shadow: 0 16px 44px rgba(0, 0, 0, .3);
}
.hold-tip.cancel { background: rgba(168, 44, 48, .92); }
.ht-wave { display: flex; align-items: center; justify-content: center; gap: 3px; height: 26px; margin-bottom: 6px; }
.ht-wave i { width: 4px; height: 8px; border-radius: 3px; background: #74eda8; animation: wave 1s infinite ease-in-out; }
.ht-wave i:nth-child(2) { animation-delay: .1s; }
.ht-wave i:nth-child(3) { animation-delay: .2s; }
.ht-wave i:nth-child(4) { animation-delay: .3s; }
.ht-wave i:nth-child(5) { animation-delay: .4s; }
.ht-wave i:nth-child(6) { animation-delay: .5s; }
.ht-wave i:nth-child(7) { animation-delay: .6s; }
@keyframes wave { 0%, 100% { height: 7px; opacity: .7; } 50% { height: 24px; opacity: 1; } }
.hold-tip.cancel .ht-wave i { background: #ffb3b5; }
.ht-time { font-size: 23px; font-weight: 750; font-variant-numeric: tabular-nums; letter-spacing: .5px; }
.ht-t { font-size: 11.5px; opacity: .82; margin-top: 3px; }

/* 轻提示 */
.v-toast {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 220;
  background: rgba(16, 24, 32, .86); color: #fff; font-size: 13px;
  padding: 10px 18px; border-radius: 11px; animation: fadeIn .15s;
}

/* 输入区更精致 */
.v-input { background: #fff; box-shadow: 0 1px 3px rgba(6, 40, 32, .07); }
.v-btn {
  background: var(--theme-grad); border-radius: 999px; font-weight: 650;
  box-shadow: 0 6px 16px color-mix(in srgb, var(--theme) 34%, transparent);
}
body[data-tpl="whatsapp"] .v-btn { box-shadow: 0 6px 16px rgba(0, 128, 105, .32); }
.v-footer-wrap { box-shadow: 0 -8px 30px rgba(6, 40, 32, .10); }

/* =====================================================================
   v2.38 访客端再升级：日期分隔 / 圆形发送键 / 更现代的聊天观感
   ===================================================================== */
/* 日期分隔胶囊 */
.day-sep { display: flex; justify-content: center; margin: 4px 0 14px; }
.day-sep span {
  font-size: 11px; color: #8b95a7; background: rgba(255, 255, 255, .82);
  padding: 3px 12px; border-radius: 999px; backdrop-filter: blur(4px);
}
body[data-tpl="whatsapp"] .day-sep span { background: rgba(255, 255, 255, .85); color: #667781; }

/* 圆形发送键（图标） */
.v-btn {
  width: 46px; height: 46px; min-width: 46px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; padding: 0;
}
.v-btn svg { width: 21px; height: 21px; display: block; margin-left: 2px; }

/* 气泡更圆润、行距更舒服 */
.msg-bubble { border-radius: 16px; padding: 10px 14px; font-size: 15px; line-height: 1.62; }
.msg-row.agent .msg-bubble { border-top-left-radius: 6px; }
.msg-row.visitor .msg-bubble { border-top-right-radius: 6px; }
body[data-tpl="default"] .msg-row.visitor .msg-bubble { border-top-right-radius: 6px; }
body[data-tpl="whatsapp"] .msg-row .msg-bubble { border-radius: 12px; }
body[data-tpl="whatsapp"] .msg-row.visitor .msg-bubble { border-top-right-radius: 4px; }
body[data-tpl="whatsapp"] .msg-row.agent .msg-bubble { border-top-left-radius: 4px; }
.msg-row { margin-bottom: 14px; }

/* 头部更精致：圆角下沿 + 光晕 */
.v-header { border-radius: 0 0 20px 20px; }
body[data-tpl="whatsapp"] .v-header { border-radius: 0; }
.v-avatar { box-shadow: 0 4px 14px rgba(4, 30, 24, .22), inset 0 0 0 2px rgba(255, 255, 255, .6); }

/* 输入区：白色卡片 + 更大圆角 */
.v-footer-wrap { border-radius: 22px 22px 0 0; padding: 10px 14px calc(12px + env(safe-area-inset-bottom)); }
.v-input { border-radius: 22px; padding: 11px 16px; }

/* 宽屏：更像一个 App 窗口 */
@media (min-width: 820px) {
  #app { max-width: 480px; border-radius: 26px; box-shadow: 0 30px 80px rgba(16, 40, 80, .22), 0 0 0 1px rgba(255, 255, 255, .5); }
  .v-footer-wrap { border-radius: 22px 22px 26px 26px; }
}

/* =====================================================================
   v2.39 访客端「现代客服组件」重构（借鉴 Intercom / Crisp / Tidio 的做法）
   · 去掉整行工具条，图标收进输入条内 + 圆形渐变发送键
   · 消息浮在柔和渐变底上，底部输入区悬浮并带渐隐遮罩
   · 回到最新按钮、日期胶囊、自动长高输入框
   ===================================================================== */
/* 页面底：柔和渐变 + 品牌色光斑（不是白底一片） */
body[data-tpl="default"] {
  background:
    radial-gradient(120% 60% at 12% -8%, color-mix(in srgb, var(--theme) 22%, #fff) 0%, transparent 60%),
    radial-gradient(100% 50% at 92% 0%, color-mix(in srgb, var(--theme) 12%, #fff) 0%, transparent 55%),
    linear-gradient(180deg, #eef2f9 0%, #f6f8fc 60%, #f3f6fb 100%);
  background-attachment: fixed;
}
/* 头部：悬浮圆角卡（左右留边），发丝高光 */
body[data-tpl="default"] .v-header {
  margin: 10px 10px 0; border-radius: 22px; padding: 14px 16px;
  background: var(--theme-grad);
  box-shadow: 0 12px 30px color-mix(in srgb, var(--theme) 26%, transparent);
}
body[data-tpl="whatsapp"] .v-header { margin: 0; border-radius: 0 0 18px 18px; }
.v-header .v-title { text-shadow: 0 1px 2px rgba(0, 0, 0, .12); }

/* 消息区：更宽的留白；底部给输入条留出空间 */
.v-body { padding: 14px 16px 12px; }
.msg-box { max-width: 78%; }
.msg-bubble {
  border-radius: 18px; padding: 10px 14px; font-size: 15px; line-height: 1.6;
  box-shadow: 0 1px 2px rgba(16, 40, 80, .06), 0 6px 16px -10px rgba(16, 40, 80, .18);
}
.msg-row.agent .msg-bubble { border-top-left-radius: 6px; }
.msg-row.visitor .msg-bubble { border-top-right-radius: 6px; }
.msg-ava { width: 32px; height: 32px; font-size: 17px; }
.msg-row { margin-bottom: 12px; gap: 8px; }
.b-time { font-size: 10px; opacity: .5; }

/* WhatsApp 模板同步微调（保留墙纸，但更干净） */
body[data-tpl="whatsapp"] {
  /* 墙纸更淡：图案只做质感，不抢内容 */
  background-color: #f3efe8;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='280' height='280' viewBox='0 0 280 280'%3E%3Cg fill='none' stroke='%23d8cfc2' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round' opacity='.32'%3E%3Ccircle cx='42' cy='44' r='11'/%3E%3Cpath d='M38 44h8M42 40v8'/%3E%3Cpath d='M118 26l9 9-9 9-9-9z'/%3E%3Cpath d='M198 40c-5-7 5-15 9-8 4-7 14 1 9 8l-9 10z'/%3E%3Cpath d='M246 96h18m-9-9v18'/%3E%3Ccircle cx='132' cy='132' r='13'/%3E%3Cpath d='M196 128h16l-3 15h-10zM200 143v7M208 143v7M214 122v8'/%3E%3Cpath d='M128 196q11-13 22 0t-11 14z'/%3E%3Cpath d='M60 246l12 12m0-12-12 12'/%3E%3Ccircle cx='150' cy='252' r='8'/%3E%3Cpath d='M236 236l14-6-6 14-3-5z'/%3E%3C/g%3E%3C/svg%3E");
}
body[data-tpl="whatsapp"] .msg-bubble { border-radius: 14px; }
body[data-tpl="whatsapp"] .msg-row.visitor .msg-bubble { border-top-right-radius: 5px; }
body[data-tpl="whatsapp"] .msg-row.agent .msg-bubble { border-top-left-radius: 5px; }

/* 悬浮输入条：图标在条内 + 圆形发送键 */
.v-footer-wrap {
  background: transparent; box-shadow: none; border-radius: 0;
  padding: 8px 12px calc(12px + env(safe-area-inset-bottom));
  position: relative;
}
.v-footer-wrap::before {
  content: ''; position: absolute; left: 0; right: 0; top: -26px; height: 26px;
  background: linear-gradient(180deg, transparent, rgba(246, 248, 252, .92));
  pointer-events: none;
}
body[data-tpl="whatsapp"] .v-footer-wrap::before { background: linear-gradient(180deg, transparent, rgba(239, 231, 221, .95)); }
.v-bar {
  display: flex; align-items: flex-end; gap: 6px;
  background: #fff; border-radius: 26px; padding: 6px 8px;
  box-shadow: 0 10px 30px rgba(16, 40, 80, .14), 0 0 0 1px rgba(16, 40, 80, .04);
}
.v-icon-btn {
  width: 38px; height: 38px; flex-shrink: 0; border: 0; border-radius: 50%;
  background: #f2f5fa; color: #61708b; display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all .15s;
}
.v-icon-btn:hover { background: #e9eef7; color: var(--theme); }
.v-icon-btn:active { transform: scale(.94); }
.v-icon-btn svg { width: 20px; height: 20px; display: block; }
.v-bar .v-input {
  flex: 1; min-width: 0; border: 0; background: transparent; padding: 9px 4px 9px 6px;
  font-size: 15px; line-height: 1.5; max-height: 110px; resize: none;
}
.v-bar .v-input:focus { outline: none; background: transparent; }
.v-bar .v-btn {
  width: 42px; height: 42px; min-width: 42px; border-radius: 50%; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: #cfd7e3; color: #fff; box-shadow: none;
}
.v-bar .v-btn.ready {
  background: var(--theme-grad);
  box-shadow: 0 8px 20px color-mix(in srgb, var(--theme) 40%, transparent);
}
body[data-tpl="whatsapp"] .v-bar .v-btn.ready { background: linear-gradient(135deg, #008069, #00a884); }
.v-bar .v-btn:disabled { opacity: 1; }
.v-bar .v-hold-btn { flex: 1; height: 42px; border-radius: 21px; border: 0; background: #f2f5fa; margin: 0 4px; }
.v-bar .v-hold-btn.on { background: color-mix(in srgb, var(--theme) 14%, #fff); color: var(--theme); }
.v-bar .v-hold-btn.cancel { background: #fdeeee; color: #e5484d; }

/* 回到最新 */
.v-tobottom {
  position: absolute; right: 18px; bottom: 92px; z-index: 30;
  width: 38px; height: 38px; border-radius: 50%; border: 0; cursor: pointer;
  background: #fff; color: #4b5563; display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 22px rgba(16, 40, 80, .18), 0 0 0 1px rgba(16, 40, 80, .05);
  animation: msgIn .18s ease-out;
}
.v-tobottom svg { width: 19px; height: 19px; }
.v-tobottom:active { transform: scale(.94); }

/* 空状态：更像现代组件 */
.welcome-card {
  background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px);
  box-shadow: 0 20px 50px -20px rgba(16, 40, 80, .35), 0 0 0 1px rgba(255, 255, 255, .6);
}
.w-chip { background: rgba(255, 255, 255, .9); }

/* 语音气泡（播放键 + 波形 + 秒数） */
.voice-bubble { display: flex; align-items: center; gap: 8px; min-width: 128px; cursor: pointer; user-select: none; }
.vb-play {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, .78); color: #1f2937; box-shadow: 0 1px 2px rgba(0, 0, 0, .08);
}
.msg-row.agent .vb-play { background: #eef1f6; color: #4b5563; box-shadow: none; }
.vb-play svg { width: 15px; height: 15px; display: block; }
.vb-wave { display: flex; align-items: center; gap: 2px; height: 22px; flex: 1; }
.vb-wave i { width: 2.5px; border-radius: 2px; background: currentColor; opacity: .38; }
.voice-bubble.playing .vb-wave i { opacity: .9; animation: vbwave .8s infinite ease-in-out; }
.voice-bubble.playing .vb-wave i:nth-child(2n) { animation-delay: .12s; }
.voice-bubble.playing .vb-wave i:nth-child(3n) { animation-delay: .24s; }
@keyframes vbwave { 50% { transform: scaleY(.45); } }
.vb-sec { font-size: 11.5px; opacity: .72; flex-shrink: 0; min-width: 18px; text-align: right; }
.msg-bubble:has(.voice-bubble) { padding: 8px 12px; }

/* ===== v2.43 访客端：引用回复 / 长按菜单 / 视频·文件·位置 ===== */
.v-reply-bar {
  display: flex; align-items: center; gap: 8px; margin: 0 10px 6px;
  background: #f2f5fa; border-left: 3px solid var(--theme, #1677ff);
  border-radius: 10px; padding: 7px 11px;
}
.v-reply-bar .vr-body { flex: 1; min-width: 0; }
.v-reply-bar .vr-who { display: block; font-size: 11.5px; font-weight: 700; color: var(--theme, #1677ff); }
.v-reply-bar .vr-text { display: block; font-size: 12px; color: #6b7688; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v-reply-bar .vr-x { border: 0; background: transparent; color: #8b95a7; font-size: 15px; cursor: pointer; flex-shrink: 0; }

.msg-quote {
  display: flex; flex-direction: column; gap: 1px; max-width: 100%;
  background: rgba(17, 24, 39, .06); border-left: 2px solid rgba(17, 24, 39, .2);
  border-radius: 6px; padding: 4px 8px; margin-bottom: 5px; font-size: 11.5px; cursor: pointer;
}
.msg-quote .mq-who { font-weight: 700; color: #6b7688; }
.msg-quote .mq-text { color: #4e5969; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-row.agent .msg-quote { background: rgba(255, 255, 255, .7); }
.msg-row.flash .msg-bubble { box-shadow: 0 0 0 3px color-mix(in srgb, var(--theme, #1677ff) 40%, transparent); }

.vb-video { display: block; max-width: 220px; border-radius: 12px; margin-top: 2px; background: #000; }
.file-bubble, .loc-bubble {
  display: flex; align-items: center; gap: 10px; border-radius: 12px; padding: 10px 12px;
  margin-top: 2px; text-decoration: none; color: inherit; min-width: 172px;
}
.file-bubble { background: #f7f9fc; border: 1px solid #e8ecf3; }
.loc-bubble { background: #f3f8f4; border: 1px solid #d9ecdf; }
.file-bubble .fb-ic, .loc-bubble .lb-ic { font-size: 20px; }
.file-bubble .fb-body, .loc-bubble .lb-body { flex: 1; min-width: 0; }
.file-bubble .fb-name { display: block; font-size: 13px; color: #1f2329; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-bubble .fb-size { display: block; font-size: 11px; color: #98a1b0; }
.file-bubble .fb-dl { color: var(--theme, #1677ff); font-weight: 700; }
.loc-bubble .lb-name { display: block; font-size: 13px; font-weight: 600; color: #1f2329; }
.loc-bubble .lb-sub { display: block; font-size: 11px; color: #7c8b83; }

.v-sheet-mask { position: fixed; inset: 0; background: rgba(8, 10, 14, .38); z-index: 60; }
.v-sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 61; padding: 8px 10px calc(10px + env(safe-area-inset-bottom));
  background: #fff; border-radius: 16px 16px 0 0; box-shadow: 0 -8px 30px rgba(16, 24, 40, .18);
}
.v-sheet .vs-item {
  display: block; width: 100%; border: 0; background: transparent; color: #1f2329;
  text-align: center; font-size: 15px; padding: 14px 10px; border-radius: 10px; cursor: pointer; font-family: inherit;
}
.v-sheet .vs-item:hover { background: #f4f6fa; }
.v-sheet .vs-item.danger { color: #e5484d; }
.v-sheet .vs-item.ghost { color: #8b95a7; border-top: 1px solid #eef1f5; border-radius: 0; margin-top: 4px; }
body.dark .v-reply-bar { background: #262c34; }
body.dark .v-reply-bar .vr-text { color: #a9b3c2; }
body.dark .msg-quote { background: rgba(255, 255, 255, .08); border-left-color: rgba(255, 255, 255, .25); }
body.dark .msg-quote .mq-who, body.dark .msg-quote .mq-text { color: #c2cad6; }
body.dark .file-bubble { background: #232830; border-color: #333a44; }
body.dark .file-bubble .fb-name { color: #e7eaf0; }
body.dark .loc-bubble { background: #1e2c24; border-color: #2f4a3a; }
body.dark .loc-bubble .lb-name { color: #dfe7e2; }
body.dark .v-sheet { background: #1e2229; }
body.dark .v-sheet .vs-item { color: #e7eaf0; }
body.dark .v-sheet .vs-item:hover { background: #262c34; }
body.dark .v-sheet .vs-item.ghost { border-top-color: #2b313a; color: #8b95a7; }

/* v2.43.1 待发附件托盘（粘贴/选图先放这里，和文字一起发） */
.v-pending { display: flex; align-items: center; gap: 7px; padding: 0 12px 7px; flex-wrap: wrap; }
.v-pending .vp-item { position: relative; }
.v-pending .vp-item img { width: 46px; height: 46px; object-fit: cover; border-radius: 10px; border: 1px solid #e5e6eb; display: block; }
.v-pending .vp-file {
  width: 46px; height: 46px; border-radius: 10px; border: 1px solid #e5e6eb; background: #f7f9fc;
  display: flex; align-items: center; justify-content: center; font-size: 19px;
}
.v-pending .vp-rm {
  position: absolute; top: -6px; right: -6px; width: 17px; height: 17px; border-radius: 50%;
  background: #f53f3f; color: #fff; text-align: center; line-height: 17px; font-size: 10px; cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
}
.v-pending .vp-tip { font-size: 11.5px; color: #8b95a7; }
body.dark .v-pending .vp-item img, body.dark .v-pending .vp-file { border-color: #333a44; }
body.dark .v-pending .vp-file { background: #232830; }
body.dark .v-pending .vp-tip { color: #98a3b4; }

/* ===== v2.69 访客端看图：半透明底 + 文字按钮 + 左右翻图 =====
   v2.91.32：加 touch-action:none —— 打开看图时，双指捏合由页面自己接管（缩放图片），
   不再让浏览器去做页面级缩放；同时补一行操作提示。 */
.img-viewer { background: rgba(16,24,40,.45); backdrop-filter: blur(3px); flex-direction: column; gap: 14px; touch-action: none; }
.img-viewer img { max-width: 94vw; max-height: 78vh; cursor: default; will-change: transform; backface-visibility: hidden; -webkit-backface-visibility: hidden; transform: translate3d(0,0,0); touch-action: none; }
.iv-hint {
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%);
  font-size: 12px; color: rgba(255,255,255,.82); background: rgba(24,28,36,.7);
  padding: 5px 12px; border-radius: 999px; z-index: 102; pointer-events: none; white-space: nowrap;
}
.iv-tools {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; flex-wrap: wrap; justify-content: center; gap: 4px;
  max-width: 94vw; padding: 6px 8px; border-radius: 12px;
  background: rgba(24,28,36,.88); box-shadow: 0 12px 32px -10px rgba(0,0,0,.6); z-index: 102;
}
.iv-btn {
  height: 32px; padding: 0 12px; border-radius: 8px; font-size: 13px; font-weight: 600; white-space: nowrap;
  background: rgba(255,255,255,.1); color: #fff; display: inline-flex; align-items: center; cursor: pointer; user-select: none;
}
.iv-btn:hover { background: rgba(255,255,255,.24); }
.iv-btn.dis { opacity: .38; cursor: default; }
.iv-btn.dis:hover { background: rgba(255,255,255,.1); }
.iv-btn.close { background: rgba(245,63,63,.22); }
.iv-btn.close:hover { background: rgba(245,63,63,.42); }
.iv-count { color: rgba(255,255,255,.72); font-size: 12px; padding: 0 8px; display: inline-flex; align-items: center; white-space: nowrap; }
.iv-sep { width: 1px; height: 18px; background: rgba(255,255,255,.22); margin: 0 5px; }
@media (max-width: 560px) {
  .iv-tools { bottom: 12px; gap: 3px; padding: 5px 6px; }
  .iv-btn { height: 30px; padding: 0 9px; font-size: 12px; }
  .iv-count { padding: 0 4px; }
}

/* ===== v2.73 访客端多图并排 + 文字在下面 ===== */
.msg-bubble .msg-imgs { display: grid; gap: 4px; margin: 0 0 2px; max-width: 78vw; }
.msg-bubble .msg-imgs.n1 { grid-template-columns: 1fr; }
.msg-bubble .msg-imgs.n2 { grid-template-columns: 1fr 1fr; }
.msg-bubble .msg-imgs.n3 { grid-template-columns: 1fr 1fr 1fr; }
.msg-bubble .msg-imgs.n4 { grid-template-columns: 1fr 1fr; }
.msg-bubble .msg-imgs img { width: 100%; height: 92px; object-fit: cover; border-radius: 8px; display: block; margin: 0; }
.msg-bubble .msg-imgs.n1 img { height: auto; max-height: 300px; object-fit: contain; }
/* 表格操作列对齐（工作台里的表格） */
.el-table th.el-table__cell:last-child .cell,
.el-table td.el-table__cell:last-child .cell { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; }
.el-table td.el-table__cell:last-child .cell > * { margin-left: 0 !important; flex-shrink: 0; }

/* ===== v2.56 消息「已编辑」角标 ===== */
.msg-edited { display: inline-block; font-size: 10.5px; color: #a0a6ad; margin-left: 6px; vertical-align: 1px; }

/* ================= v2.60.9 恢复原对话（换设备后用恢复码接回原会话） ================= */
.v-resume-btn {
  margin-left: 8px; flex-shrink: 0; cursor: pointer; font-family: inherit;
  font-size: 11.5px; font-weight: 600; line-height: 1.2; color: #fff;
  background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.35);
  border-radius: 999px; padding: 4px 11px; backdrop-filter: blur(4px);
}
.v-resume-btn:active { background: rgba(255,255,255,.34); }
@media (max-width: 380px) { .v-resume-btn { padding: 4px 9px; font-size: 11px; margin-left: 6px; } }

.v-modal {
  position: fixed; inset: 0; z-index: 60; background: rgba(15,23,42,.45);
  display: flex; align-items: center; justify-content: center; padding: 0 22px;
}
.v-modal-card {
  width: 100%; max-width: 330px; background: #fff; border-radius: 16px;
  padding: 18px 18px 14px; box-shadow: 0 18px 50px -12px rgba(0,0,0,.4);
}
.vm-t { font-size: 16px; font-weight: 700; color: #1a2233; text-align: center; }
.vm-d { margin-top: 8px; font-size: 12.5px; line-height: 1.7; color: #7b8798; text-align: center; }
.vm-in {
  margin-top: 14px; width: 100%; box-sizing: border-box; height: 42px; padding: 0 14px;
  border: 1px solid #e3e8f0; border-radius: 11px; font-size: 15px; font-family: inherit;
  letter-spacing: 1px; color: #1a2233; outline: none;
}
.vm-in:focus { border-color: var(--theme, #1677ff); }
.vm-err { margin-top: 8px; font-size: 12px; color: #e5484d; text-align: center; }
.vm-ops { display: flex; gap: 10px; margin-top: 14px; }
.vm-btn {
  flex: 1; height: 42px; border-radius: 11px; border: 0; cursor: pointer;
  font-size: 14px; font-weight: 600; font-family: inherit; background: var(--theme, #1677ff); color: #fff;
}
.vm-btn:disabled { opacity: .6; }
.vm-btn.ghost { flex: 0 0 92px; background: #f2f4f8; color: #5c6b85; }
.vm-tip { margin-top: 10px; font-size: 11px; color: #a9b3c2; text-align: center; }

/* =====================================================================
   v2.60.20 访客端长按/复制体验
   ① 长按消息不再触发浏览器自带的「全选 / 拷贝 / 查询」菜单（用户反馈"总是全选整页"）；
   ② 每条消息右下角给一个 ⋯ 按钮，点一下出「回复 / 复制文字 / 撤回」，不用长按也能用。
   ===================================================================== */
.msg-row, .msg-bubble, .msg-box { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.msg-bubble a, .msg-bubble img { -webkit-touch-callout: none; }
.visitor .msg-more, .msg-more {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; margin-left: 6px; vertical-align: middle;
  border: 1px solid var(--line, #e3e8f0); border-radius: 50%; background: #fff;
  color: #8b95a7; font-size: 15px; line-height: 1; padding: 0; cursor: pointer; font-family: inherit;
}
.msg-more:active { background: #eef1f7; color: var(--theme, #1677ff); border-color: var(--theme, #1677ff); }
/* 访客自己那条：⋯ 放左边一点，别贴着屏幕边 */
.msg-row.visitor .msg-time { display: flex; justify-content: flex-end; align-items: center; gap: 6px; }

/* v2.60.21 ⋯ 按钮稍微大一点更好点（长按出菜单已移除，复制/回复/撤回全靠它） */
.msg-more { width: 26px !important; height: 26px !important; font-size: 16px !important; }

/* ===== v2.72 手机浏览器发图：透明覆盖的 file 框 =====
   原因：file 框原来 display:none + JS .click() 触发，微信内核认，iOS Safari / 安卓系统浏览器不认
   （它们要求"手指直接点在 input 上"）。这里把它做成按钮上方一层透明覆盖，原生点击 → 能打开相册。
   ===== v2.92.24 修「点输入框弹出选择文件」=====
   访客端同样中招（访客多是 iPhone，点了输入框却弹「选择文件」）。真因与客服端一致：
   file 框上的 font-size:100px 让 WebKit 把内部"选择文件"按钮渲染得很大，
   **命中测试跟着这块溢出的内部按钮走**，而 rect 仍只报 38×38；原来没给 overflow:hidden，
   溢出的命中区就盖到同一行的输入框上（真 WebKit 实测：点输入框命中 in-img、fileChooserOpened=1）。
   对策（与 app.css 同名规则一字不差；两层 CSS + file-ghost-guard.js 第三层）：
     ① .v-file-wrap{overflow:hidden} 把溢出的内部按钮连命中区一起裁掉（治本）；
     ② .v-file-ghost 尺寸给确定值 + 自身溢出也裁掉。 */
.v-file-wrap { position: relative; display: inline-flex; overflow: hidden; }
.v-file-ghost {
  position: absolute; left: 0; top: 0;
  width: 100%; height: 100%; max-width: 100%; max-height: 100%;
  margin: 0; padding: 0; border: 0; overflow: hidden;
  opacity: 0; cursor: pointer; font-size: 100px; z-index: 3;
  -webkit-appearance: none; appearance: none;
}
/* 覆盖层把外画的焦点圈裁掉了 → 圈画进盒子里面 */
.v-file-wrap .v-icon-btn:focus-visible, .v-file-wrap .ac-btn:focus-visible { outline: 2px solid var(--theme, #1677ff); outline-offset: -3px; }

/* v2.91.65 图片加载失败 → 可点重试 */
.kf-img-retry{display:inline-flex;align-items:center;gap:8px;padding:10px 12px;border:1px dashed #d9dee7;border-radius:8px;background:#f7f8fa;font-size:12.5px;color:#86909c}
.kf-img-retry .kf-ir-b{cursor:pointer;border:1px solid #1677ff;background:#fff;color:#1677ff;border-radius:6px;padding:3px 10px;font-size:12.5px}
.kf-img-retry .kf-ir-b:hover{background:#1677ff;color:#fff}
.kf-img-retry .kf-ir-b[disabled]{opacity:.6;cursor:default}
body.dark .kf-img-retry{background:#1b1e24;border-color:#2c313a;color:#a9b0bb}
body.dark .kf-img-retry .kf-ir-b{background:#1b1e24;color:#69b1ff;border-color:#2c313a}