:root {
  --brand: #1a6dff;
  --brand-dark: #0f4fbf;
  --brand-soft: #e8f1ff;
  --bg: #f4f6fa;
  --card: #ffffff;
  --text: #1f2a37;
  --muted: #6b7684;
  --line: #e4e8ef;
  --ok: #16a34a;
  --warn: #d97706;
  --danger: #dc2626;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 6px 20px rgba(16, 24, 40, 0.06);
  --topbar-h: 58px;
  --tabbar-h: 58px;
  --side-w: 208px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand); text-decoration: none; }
[hidden] { display: none !important; }

/* --------------------------------- 登录页 --------------------------------- */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background: linear-gradient(160deg, #eaf2ff 0%, #f6f8fc 45%, #eef2f8 100%);
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border-radius: 16px;
  padding: 32px 28px 26px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}

.login-brand { text-align: center; margin-bottom: 24px; }
.login-brand .brand-mark {
  width: 48px; height: 48px; border-radius: 14px; background: var(--brand);
  color: #fff; display: inline-flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 700; margin-bottom: 12px;
}
.login-brand h1 { font-size: 19px; margin: 0 0 4px; }
.login-brand p { margin: 0; color: var(--muted); font-size: 12.5px; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 10px; background: #fbfcfe; outline: none; transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px rgba(26, 109, 255, .12);
}
.field textarea { resize: vertical; min-height: 72px; }

.checkbox { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; margin: 4px 0 18px; }
.checkbox input { width: 15px; height: 15px; accent-color: var(--brand); }

.btn {
  border: 1px solid var(--line); background: #fff; border-radius: 10px;
  padding: 9px 14px; transition: .15s; white-space: nowrap;
}
.btn:hover { border-color: #c9d4e5; background: #f7f9fc; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-danger { color: var(--danger); border-color: #f3c9c9; background: #fff5f5; }
.btn-danger:hover { background: #ffecec; }
.btn-block { width: 100%; padding: 11px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }

.form-error { color: var(--danger); font-size: 13px; min-height: 18px; margin: 10px 0 0; }
.login-foot { margin-top: 18px; text-align: center; font-size: 12px; color: var(--muted); }

/* --------------------------------- 主框架 --------------------------------- */
.app-body { min-height: 100vh; }

.topbar {
  position: fixed; inset: 0 0 auto 0; height: var(--topbar-h); z-index: 30;
  background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 16px;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 10px; background: var(--brand); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700;
}
.brand strong { display: block; font-size: 15px; }
.brand small { color: var(--muted); font-size: 11.5px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.pill {
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px;
  border-radius: 999px; background: #f1f4f9; font-size: 12.5px; color: var(--muted); white-space: nowrap;
}
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: #9aa4b2; flex: none; }
.pill.is-online { background: #eafaf0; color: #15803d; }
.pill.is-online .dot { background: var(--ok); box-shadow: 0 0 0 3px rgba(22, 163, 74, .16); }
.pill.is-error { background: #fdecec; color: #b91c1c; }
.pill.is-error .dot { background: var(--danger); }
.pill.is-connecting { background: #fff7e6; color: #b45309; }
.pill.is-connecting .dot { background: var(--warn); }

.icon-btn {
  position: relative; width: 36px; height: 36px; border-radius: 10px;
  border: 1px solid var(--line); background: #fff; display: grid; place-items: center; font-size: 16px;
}
.icon-btn:hover { background: #f5f8fd; }
.badge {
  position: absolute; top: -5px; right: -5px; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 999px; background: var(--danger); color: #fff; font-size: 10.5px;
  display: grid; place-items: center; border: 2px solid #fff;
}
.user-chip { display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: 999px; background: #f1f4f9; }
.avatar {
  width: 28px; height: 28px; border-radius: 50%; background: var(--brand); color: #fff;
  display: grid; place-items: center; font-size: 12.5px; font-weight: 600;
}
.user-chip .role { font-size: 11px; color: var(--muted); }

.sidenav {
  position: fixed; top: var(--topbar-h); left: 0; bottom: 0; width: var(--side-w);
  background: #fff; border-right: 1px solid var(--line); padding: 14px 10px; overflow-y: auto; z-index: 20;
}
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; margin-bottom: 4px;
  border: none; background: transparent; border-radius: 10px; color: #45505f; text-align: left; font-size: 14px;
}
.nav-item:hover { background: #f4f7fc; }
.nav-item.active { background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; }
.nav-item .ico { width: 18px; text-align: center; }
.nav-item .num { margin-left: auto; font-size: 11.5px; color: var(--muted); }

.content {
  margin: var(--topbar-h) 0 0 var(--side-w);
  padding: 18px 20px 32px;
  min-height: calc(100vh - var(--topbar-h));
}
.tabbar { display: none; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h2 { margin: 0; font-size: 18px; }
.page-head p { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; margin-bottom: 16px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-head h3 { margin: 0; font-size: 15px; }
.card-head .hint { color: var(--muted); font-size: 12px; }

.grid { display: grid; gap: 14px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.stat { display: flex; flex-direction: column; gap: 4px; }
.stat .label { color: var(--muted); font-size: 12.5px; display: flex; align-items: center; gap: 6px; }
.stat .value { font-size: 26px; font-weight: 650; letter-spacing: -.4px; }
.stat .value small { font-size: 13px; font-weight: 400; color: var(--muted); margin-left: 3px; }
.stat .sub { color: var(--muted); font-size: 12px; }
.stat .value.ok { color: var(--ok); }
.stat .value.warn { color: var(--warn); }
.stat .value.danger { color: var(--danger); }

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th, table.data td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
table.data th { color: var(--muted); font-weight: 500; background: #fafbfe; position: sticky; top: 0; }
table.data tbody tr:hover { background: #f8fafd; }
table.data td.wrap { white-space: normal; min-width: 180px; max-width: 420px; }
.empty { padding: 28px 10px; text-align: center; color: var(--muted); font-size: 13px; }

.tag {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px;
  font-size: 11.5px; background: #f1f4f9; color: #4b5563;
}
.tag.ok { background: #eafaf0; color: #15803d; }
.tag.warn { background: #fff7e6; color: #b45309; }
.tag.danger { background: #fdecec; color: #b91c1c; }
.tag.info { background: var(--brand-soft); color: var(--brand-dark); }

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 12px; }
.filters .field { margin: 0; min-width: 132px; }
.filters .field input, .filters .field select { padding: 8px 10px; }

/* ------------------------------ 消息管理页 ------------------------------- */
.msg-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 14px; align-items: start; }
.conv-list { max-height: calc(100vh - 220px); overflow-y: auto; }
.conv-item { padding: 10px 12px; border-radius: 10px; cursor: pointer; border: 1px solid transparent; }
.conv-item:hover { background: #f6f9fe; }
.conv-item.active { background: var(--brand-soft); border-color: #cfe0ff; }
.conv-item .top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.conv-item .name { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-item .time { color: var(--muted); font-size: 11px; flex: none; }
.conv-item .preview { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }

.chat { display: flex; flex-direction: column; height: calc(100vh - 190px); min-height: 420px; }
.chat-head { padding: 10px 14px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.chat-head .title { font-weight: 600; }
.chat-head .sub { color: var(--muted); font-size: 12px; }
.chat-body { flex: 1; overflow-y: auto; padding: 14px; background: #f9fbfe; }
.msg-row { display: flex; gap: 8px; margin-bottom: 12px; }
.msg-row.out { flex-direction: row-reverse; }
.msg-avatar {
  width: 32px; height: 32px; border-radius: 50%; background: #dfe7f5; color: #475569;
  display: grid; place-items: center; font-size: 12px; flex: none;
}
.msg-row.out .msg-avatar { background: var(--brand); color: #fff; }
.bubble {
  max-width: min(560px, 74%); background: #fff; border: 1px solid var(--line); border-radius: 12px;
  min-width: 0;
  padding: 8px 11px; box-shadow: 0 1px 1px rgba(16, 24, 40, .03);
}
.msg-row.out .bubble { background: var(--brand-soft); border-color: #cfe0ff; }
.bubble .meta { font-size: 11px; color: var(--muted); margin-bottom: 3px; display: flex; gap: 8px; }
.bubble .text { white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere; }
.bubble img.pic { max-width: 220px; max-height: 220px; border-radius: 8px; display: block; }
.bubble audio { max-width: 220px; height: 34px; }
.bubble .blocked { color: var(--danger); font-size: 12.5px; }
.bubble .quote {
  border-left: 3px solid #cfe0ff;
  background: #f3f7ff;
  color: var(--muted);
  font-size: 12px;
  padding: 5px 8px;
  border-radius: 6px;
  margin-bottom: 6px;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.msg-row.out .bubble .quote { background: #eef5ff; border-left-color: #a9c9ff; }
.bubble .msg-actions {
  display: flex;
  gap: 12px;
  margin-top: 6px;
  font-size: 12px;
}
.bubble .msg-actions a { color: var(--brand); text-decoration: none; }
.bubble .face-img {
  width: 22px;
  height: 22px;
  vertical-align: -5px;
  margin: 0 1px;
}
.bubble .msg-actions a:hover { text-decoration: underline; }
.msg-row.out .bubble .msg-actions a { color: var(--brand-dark); }
.quote-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f2f5fa;
  border-left: 3px solid var(--brand);
  border-radius: 8px;
  padding: 6px 10px;
  margin-bottom: 8px;
  font-size: 12.5px;
  color: var(--muted);
}
.quote-chip #quote-chip-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bubble .status { font-size: 11px; color: var(--muted); margin-top: 3px; }
.bubble .status.failed { color: var(--danger); }

.composer { border-top: 1px solid var(--line); padding: 10px; background: #fff; }
.composer textarea {
  width: 100%; min-height: 62px; max-height: 140px; border: 1px solid var(--line);
  border-radius: 10px; padding: 9px 11px; outline: none; resize: vertical; background: #fbfcfe;
}
.composer textarea:focus { border-color: var(--brand); background: #fff; }
.composer-bar { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.composer-bar .grow { flex: 1; }
.composer-hint { color: var(--muted); font-size: 12px; }
.attach-preview { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.attach-preview img { max-height: 54px; border-radius: 6px; }

/* ------------------------------ 通话管理页 ------------------------------- */
.call-panel { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.call-active { display: flex; flex-direction: column; gap: 10px; }
.call-card {
  border: 1px solid #ffd9d9; background: #fff8f8; border-radius: 12px; padding: 12px;
  display: flex; flex-direction: column; gap: 8px;
}
.call-card.connect { border-color: #cdebd8; background: #f5fdf8; }
.call-card.manual { border-color: #ffe4b8; background: #fffaf0; }
.call-card .line1 { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.call-card .peer { font-weight: 650; }
.call-card .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ------------------------------- 风控页 --------------------------------- */
.words { display: flex; flex-wrap: wrap; gap: 8px; }
.word-chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 5px 10px; border-radius: 999px;
  background: #f4f7fc; border: 1px solid var(--line); font-size: 12.5px;
}
.word-chip.block { background: #fdf1f1; border-color: #f6d5d5; color: #b91c1c; }
.word-chip.flag { background: #fff8ea; border-color: #f6e3c0; color: #b45309; }
.word-chip .x { cursor: pointer; color: inherit; opacity: .6; }
.word-chip .x:hover { opacity: 1; }

/* ------------------------------- 个人中心 -------------------------------- */
.kv { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 8px 12px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* -------------------------------- 弹层 ---------------------------------- */
.toast-wrap { position: fixed; right: 16px; bottom: 74px; z-index: 60; display: flex; flex-direction: column; gap: 8px; max-width: min(360px, calc(100vw - 32px)); }
.toast {
  background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--brand);
  border-radius: 10px; padding: 10px 12px; box-shadow: var(--shadow); font-size: 13px;
  animation: slide-in .2s ease;
}
.toast.warn { border-left-color: var(--warn); }
.toast.error { border-left-color: var(--danger); }
.toast.ok { border-left-color: var(--ok); }
.toast strong { display: block; margin-bottom: 2px; }
.toast small { color: var(--muted); }
@keyframes slide-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

.modal-root { position: fixed; inset: 0; z-index: 70; display: none; }
.modal-root.open { display: block; }
.modal-mask { position: absolute; inset: 0; background: rgba(15, 23, 42, .45); }
.modal {
  position: relative; margin: 8vh auto 0; width: min(560px, calc(100vw - 32px));
  background: #fff; border-radius: 14px; box-shadow: 0 20px 60px rgba(15, 23, 42, .25);
  max-height: 84vh; display: flex; flex-direction: column;
}
.modal-head { padding: 14px 18px; border-bottom: 1px solid var(--line); font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
.modal-body { padding: 16px 18px; overflow-y: auto; }
.modal-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; color: var(--muted); font-size: 12.5px; }

/* ------------------------------- 响应式 --------------------------------- */
@media (max-width: 1180px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .call-panel { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 900px) {
  .sidenav { display: none; }
  .content { margin: 0; padding: calc(var(--topbar-h) + 12px) 12px calc(var(--tabbar-h) + 18px); }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; inset: auto 0 0 0;
    height: var(--tabbar-h); background: #fff; border-top: 1px solid var(--line); z-index: 30;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .tab-item { border: none; background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); font-size: 11px; }
  .tab-item .ico { font-size: 17px; }
  .tab-item.active { color: var(--brand); }
  .grid-4, .grid-3, .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .msg-layout { grid-template-columns: minmax(0, 1fr); }
  .msg-layout.show-chat .conv-col { display: none; }
  .msg-layout:not(.show-chat) .chat-col { display: none; }
  .conv-list { max-height: none; }
  .chat { height: calc(100vh - var(--topbar-h) - var(--tabbar-h) - 40px); }
  .page-head { align-items: flex-start; }
  .brand small { display: none; }
  .user-chip .name { display: none; }
  .filters .field { min-width: 108px; flex: 1 1 128px; }
  .modal { margin-top: 4vh; }
  .toast-wrap { bottom: calc(var(--tabbar-h) + 12px); right: 12px; left: 12px; max-width: none; }
}

@media (max-width: 520px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat .value { font-size: 22px; }
  .topbar { padding: 0 10px; }
  .brand strong { font-size: 14px; }
}

/* ====================== 聊天式消息界面（QQ / 微信风格） ====================== */

.msg-layout { align-items: stretch; }
.conv-col .card { display: flex; flex-direction: column; height: calc(100vh - 210px); margin-bottom: 0; }
.conv-col .conv-list { flex: 1; overflow-y: auto; max-height: none; }
.conv-item { padding: 10px 10px; border-radius: 12px; }
.conv-item.active { background: #e8f1ff; }
.conv-item .name { font-size: 14px; }
.conv-item .preview { font-size: 12.5px; }

.chat {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 210px);
  min-height: 420px;
  padding: 0;
  overflow: hidden;
}
.chat-head {
  padding: 10px 12px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex: none;
}
.chat-head .chat-back {
  display: none;
  width: 34px;
  height: 34px;
  border: none;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  color: #334155;
}
.chat-body { flex: 1; overflow-y: auto; padding: 14px 12px; background: #f4f6fa; }
.msg-row { display: flex; gap: 8px; margin-bottom: 14px; align-items: flex-start; }
.msg-row.out { flex-direction: row-reverse; }
.msg-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #dfe7f5;
  color: #475569;
  display: grid;
  place-items: center;
  font-size: 13px;
  flex: none;
  overflow: hidden;
}
.msg-avatar img { width: 100%; height: 100%; object-fit: cover; }
.msg-row.out .msg-avatar { background: var(--brand); color: #fff; }
.bubble {
  max-width: min(560px, 72%);
  /* flex 子项默认 min-width:auto，长串内容（长链接/连续字符）会把气泡顶出屏幕导致显示不全 */
  min-width: 0;
  background: #fff;
  border: 1px solid #e6eaf2;
  border-radius: 14px;
  padding: 9px 12px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}
.bubble .meta { font-size: 11px; color: var(--muted); margin-bottom: 4px; display: flex; gap: 8px; }

/* 底部输入区：语音/键盘切换 + 按住说话 + 更多面板 */
.composer { border-top: 1px solid var(--line); padding: 9px 10px calc(9px + env(safe-area-inset-bottom)); background: #fff; flex: none; }
.composer-row { display: flex; align-items: flex-end; gap: 8px; }
.cbtn {
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #f7f9fc;
  font-size: 18px;
  display: grid;
  place-items: center;
  padding: 0;
}
.cbtn:hover { background: #eef3fb; }
.composer-input { flex: 1; min-width: 0; display: flex; align-items: center; }
.composer textarea {
  width: 100%;
  min-height: 40px;
  max-height: 120px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  outline: none;
  resize: none;
  background: #f7f9fc;
  line-height: 1.4;
}
.composer textarea:focus { border-color: var(--brand); background: #fff; }
.talk-btn {
  width: 100%;
  min-height: 40px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #f7f9fc;
  font-weight: 600;
  letter-spacing: 1px;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
}
.talk-btn:active, .talk-btn.recording { background: #e8f1ff; border-color: #cfe0ff; color: var(--brand-dark); }
.composer-tools { display: flex; gap: 10px; padding-top: 10px; flex-wrap: wrap; align-items: center; }
.composer-tools button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 74px;
  padding: 10px 6px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 12px;
}
.composer-tools button:hover { background: #f6f9fe; }
.composer-tools .ico { font-size: 20px; }

/* 录音浮层 */
.rec-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
  display: grid;
  place-items: center;
  z-index: 60;
}
.rec-box {
  background: rgba(28, 32, 40, 0.94);
  color: #fff;
  border-radius: 18px;
  padding: 22px 28px;
  min-width: 190px;
  text-align: center;
}
.rec-mask.cancel .rec-box { background: rgba(190, 40, 40, 0.94); }
.rec-icon { font-size: 34px; line-height: 1; }
.rec-time { font-size: 22px; font-weight: 700; margin-top: 8px; }
.rec-tip { font-size: 12.5px; opacity: 0.85; margin-top: 6px; }

@media (max-width: 900px) {
  /* 移动端：进入会话后整屏聊天，隐藏页面标题与检索卡片 */
  .content:has(.msg-layout.show-chat) .page-head,
  .content:has(.msg-layout.show-chat) > .card { display: none; }
  .content:has(.msg-layout.show-chat) { padding: calc(var(--topbar-h) + 6px) 0 0; }
  .msg-layout.show-chat { gap: 0; }
  .chat { height: calc(100vh - var(--topbar-h) - var(--tabbar-h) - 8px); border-radius: 0; border-left: none; border-right: none; }
  .chat-head .chat-back { display: grid; place-items: center; }
  .chat-body { padding: 12px 10px; }
  .bubble { max-width: 76%; }
  .rec-mask { align-items: center; }
}

/* ============================================================
   微信风格主题（仅接待台 App：body.app-body）
   参考微信：灰底、白卡片、绿色主色、居中标题、底部三tab、圆角方头像
   ============================================================ */
body.app-body {
  --brand: #07c160;
  --brand-dark: #06ad56;
  --brand-soft: #e8f7ee;
  --bg: #ededed;
  --card: #ffffff;
  --text: #191919;
  --muted: #888888;
  --line: #e5e5e5;
  --ok: #07c160;
  --warn: #ffc300;
  --danger: #fa5151;
  --radius: 8px;
  --shadow: none;
  --topbar-h: 52px;
  --tabbar-h: 56px;
  background: #ededed;
}

/* 顶部：居中标题 + 右侧状态/提醒，和微信一级页面一致 */
body.app-body .topbar {
  height: var(--topbar-h);
  background: #ededed;
  border-bottom: 1px solid #dcdcdc;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  box-shadow: none;
}
body.app-body .topbar-left { width: 32px; flex: none; }
body.app-body .topbar-title {
  flex: 1;
  margin: 0;
  text-align: center;
  font-size: 17px;
  font-weight: 500;
  color: #191919;
}
body.app-body .topbar-right { display: flex; align-items: center; gap: 6px; flex: none; }
body.app-body .topbar .pill {
  background: #ffffff;
  border: none;
  color: #7f7f7f;
  font-size: 11.5px;
  padding: 3px 8px;
  border-radius: 999px;
}
body.app-body .topbar .pill .dot { background: #07c160; }
body.app-body .topbar .icon-btn { background: transparent; border: none; font-size: 18px; width: 32px; height: 32px; }
body.app-body .topbar .badge { background: #fa5151; }

/* 底部 tab：白底、顶部细线、选中绿色 */
body.app-body .tabbar {
  background: #f7f7f7;
  border-top: 1px solid #dcdcdc;
  height: var(--tabbar-h);
}
body.app-body .tab-item {
  color: #7f7f7f;
  font-size: 11px;
  gap: 2px;
  background: transparent;
  border: none;
}
body.app-body .tab-item .ico {
  width: 24px;
  height: 24px;
  font-size: 0;
  background: transparent;
}
body.app-body .tab-item .ico svg { width: 24px; height: 24px; }
body.app-body .tab-item.active { color: #07c160; }

/* 内容区：灰底 + 无阴影白卡片（微信列表分组） */
body.app-body .content { background: #ededed; }
body.app-body .card {
  background: #ffffff;
  border-radius: 0;
  box-shadow: none;
  border: none;
  border-top: 1px solid #e5e5e5;
  border-bottom: 1px solid #e5e5e5;
  padding: 0;
}
body.app-body .card + .card { margin-top: 8px; }
body.app-body .card-head { padding: 12px 14px 8px; border-bottom: none; }
body.app-body .card-head h3 { font-size: 15px; font-weight: 500; color: #191919; }
body.app-body .card-head .hint { color: #888; font-size: 12px; }
body.app-body .page-head { padding: 12px 14px; }
body.app-body .page-head h2 { font-size: 17px; font-weight: 500; }
body.app-body .page-head p { color: #888; font-size: 12.5px; }
body.app-body .empty { color: #888; }

/* 会话列表：微信通讯录/聊天列表排版 */
body.app-body .conv-list { background: #ffffff; }
body.app-body .conv-item {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  border-radius: 0;
  background: #ffffff;
  border-bottom: 1px solid #e5e5e5;
  position: relative;
}
body.app-body .conv-avatar {
  width: 48px;
  height: 48px;
  border-radius: 5px;
  overflow: hidden;
  flex: none;
  background: #e5e5e5;
  color: #888888;
  display: grid;
  place-items: center;
  font-size: 18px;
}
body.app-body .conv-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
body.app-body .conv-main .top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
body.app-body .conv-main .bottom {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: #888888;
  font-size: 13px;
}
body.app-body .conv-main .preview {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
body.app-body .conv-item .unread {
  background: #fa5151;
  color: #fff;
  border-radius: 999px;
  min-width: 18px;
  height: 18px;
  line-height: 18px;
  font-size: 11px;
  text-align: center;
  padding: 0 5px;
  flex: none;
}
body.app-body .conv-item .remark-btn {
  background: transparent;
  border: none;
  color: #c8c8c8;
  font-size: 13px;
  padding: 0 2px;
  flex: none;
}
body.app-body .conv-item:active { background: #d9d9d9; }
body.app-body .conv-item.active { background: #d9d9d9; }
body.app-body .conv-item .name { font-size: 16px; color: #191919; font-weight: 400; }
body.app-body .conv-item .preview { font-size: 13px; color: #888; }
body.app-body .conv-item .time { color: #b2b2b2; font-size: 12px; }
body.app-body .conv-item .badge-unread {
  background: #fa5151;
  color: #fff;
  border-radius: 999px;
  min-width: 18px;
  height: 18px;
  line-height: 18px;
  font-size: 11px;
  text-align: center;
  padding: 0 5px;
}
body.app-body .conv-item .avatar,
body.app-body .conv-item .conv-avatar {
  width: 48px;
  height: 48px;
  border-radius: 5px;
  flex: none;
  overflow: hidden;
}

/* 聊天页：灰底 + 绿色/白色气泡 + 圆角方头像（微信同款） */
body.app-body .chat { height: calc(100vh - var(--topbar-h) - var(--tabbar-h)); background: #ededed; border-radius: 0; }
body.app-body .chat-head { background: #ededed; border-bottom: 1px solid #dcdcdc; padding: 8px 10px; }
body.app-body .chat-head .title { font-size: 16px; font-weight: 500; color: #191919; }
body.app-body .chat-head .sub { color: #888; font-size: 11.5px; }
body.app-body .chat-head .btn-sm { font-size: 12.5px; }
body.app-body .chat-body { background: #ededed; padding: 12px 10px; }
body.app-body .msg-row { gap: 10px; margin-bottom: 14px; }
body.app-body .msg-avatar { width: 36px; height: 36px; border-radius: 5px; font-size: 14px; }
body.app-body .bubble {
  background: #ffffff;
  border: none;
  border-radius: 5px;
  box-shadow: none;
  padding: 9px 12px;
  max-width: 70%;
  font-size: 15.5px;
  line-height: 1.45;
  position: relative;
}
body.app-body .msg-row.out .bubble { background: #95ec69; }
body.app-body .bubble .meta { color: #b2b2b2; font-size: 11px; }
body.app-body .bubble .quote { background: rgba(0, 0, 0, .05); border-left: 3px solid #07c160; border-radius: 3px; }
body.app-body .msg-row.out .bubble .quote { background: rgba(0, 0, 0, .06); border-left-color: #6fca4f; }
body.app-body .bubble .status { color: #888; font-size: 11px; }
body.app-body .bubble img.pic { border-radius: 4px; }

/* 输入条：微信底部输入区（白底、圆角输入框、绿色发送） */
body.app-body .composer { background: #f7f7f7; border-top: 1px solid #dcdcdc; padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); }
body.app-body .composer-input textarea {
  background: #ffffff;
  border: none;
  border-radius: 6px;
  font-size: 15.5px;
  padding: 9px 12px;
}
body.app-body .cbtn { background: #ffffff; border: none; color: #333; }
body.app-body .talk-btn { background: #ffffff; border: none; color: #191919; border-radius: 6px; }
body.app-body .btn-primary,
body.app-body .btn.btn-primary {
  background: #07c160;
  border-color: #07c160;
  color: #fff;
  border-radius: 6px;
}
body.app-body .btn { border-radius: 6px; background: #ffffff; border: 1px solid #e5e5e5; color: #191919; }
body.app-body .tag { border-radius: 3px; }
body.app-body .tag.info { background: #e8f7ee; color: #06ad56; }
body.app-body .tag.ok { background: #e8f7ee; color: #06ad56; }
body.app-body .tag.danger { background: #fdecec; color: #fa5151; }
body.app-body .tag.warn { background: #fff7e0; color: #b37f00; }

/* 表单与分组行：微信「我 / 设置」样式 */
body.app-body .field { padding: 10px 14px; border-bottom: 1px solid #e5e5e5; background: #fff; }
body.app-body .field label { color: #191919; font-size: 14px; }
body.app-body .field input,
body.app-body .field select,
body.app-body .field textarea {
  border: none;
  background: transparent;
  padding: 6px 0;
  font-size: 15px;
  color: #191919;
}
body.app-body .kv { padding: 4px 14px; }
body.app-body .kv dt { color: #888; font-size: 13.5px; }
body.app-body .kv dd { color: #191919; font-size: 14px; }
body.app-body .stat { background: #fff; border-radius: 0; box-shadow: none; }
body.app-body .stat strong { color: #191919; }
body.app-body .sidenav { background: #ededed; border-right: 1px solid #dcdcdc; }
body.app-body .nav-item { border-radius: 0; color: #191919; }
body.app-body .nav-item.active { background: #e0e0e0; color: #07c160; }
body.app-body .nav-item .ico { font-size: 0; }
body.app-body .nav-item .ico svg { width: 20px; height: 20px; }

/* ============================================================
   手机端 IM 布局重构（App 内即移动端）
   目标：像微信一样"一屏一件事"——
   会话列表页只有列表（顶部搜索），进入会话后整屏聊天并隐藏底部 tab，
   管理后台式的标题、说明与检索表单在手机上收起（桌面端保持不变）。
   ============================================================ */
@media (max-width: 900px) {
  body.app-body .content { padding: calc(var(--topbar-h)) 0 calc(var(--tabbar-h)) !important; }
  /* 会话列表页 */
  body.app-body .content:has(.msg-layout) .page-head { display: none; }
  body.app-body .content:has(.msg-layout) > .card { display: none; }
  body.app-body .msg-layout { display: block; gap: 0; }
  body.app-body .conv-col { display: block; }
  body.app-body .conv-col .card {
    height: auto;
    margin: 0;
    border: none;
    border-radius: 0;
    box-shadow: none;
    background: #fff;
  }
  body.app-body .conv-col .card-head { display: none; }
  body.app-body #conv-search {
    margin: 8px 12px 4px;
    width: calc(100% - 24px);
    background: #f2f2f2;
    border: none;
    border-radius: 6px;
    padding: 8px 12px;
  }
  body.app-body .conv-col .conv-list { margin: 0 !important; }
  /* 进入会话：整屏聊天 + 隐藏底部 tab（微信同款） */
  body.app-body:has(.msg-layout.show-chat) .tabbar { display: none; }
  body.app-body .msg-layout.show-chat .conv-col { display: none; }
  body.app-body .msg-layout.show-chat .chat-col { display: block; }
  body.app-body .msg-layout:not(.show-chat) .chat-col { display: none; }
  body.app-body:has(.msg-layout.show-chat) .content { padding: var(--topbar-h) 0 0 !important; }
  body.app-body .chat {
    height: calc(100vh - var(--topbar-h));
    border: none;
    border-radius: 0;
  }
  body.app-body .chat-body { padding: 12px 10px calc(12px + env(safe-area-inset-bottom)); }
  body.app-body .bubble { max-width: 72%; }
  /* 其它页面：去掉大标题，只留内容（像微信的设置/我） */
  body.app-body .page-head { padding: 10px 14px 4px; }
  body.app-body .page-head h2 { font-size: 16px; }
  body.app-body .page-head p { display: none; }
}

/* ============================================================
   唐僧叨叨 / 悟空IM 风格主题（开源 IM 配色与动效）
   取自开源项目配色：主色 #5468FF（靛蓝）、底色 #F5F6F7、文字 #090A17、
   次级文字 #51577D、成功 #30A46C、警告 #FFCF8B、点缀紫 #8E5CD9
   动效：页面淡入上浮、列表按压回弹、气泡弹出、tab 切换过渡
   ============================================================ */
body.app-body {
  --brand: #5468ff;
  --brand-dark: #3b4bcc;
  --brand-soft: #eef1ff;
  --bg: #f5f6f7;
  --card: #ffffff;
  --text: #090a17;
  --muted: #51577d;
  --line: #eceef3;
  --ok: #30a46c;
  --warn: #df5d2a;
  --danger: #f5222d;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(9, 10, 23, .04), 0 8px 24px rgba(9, 10, 23, .05);
  background: #f5f6f7;
}

/* 顶部导航：白底、居中标题、细分割线 */
body.app-body .topbar {
  background: #ffffff;
  border-bottom: 1px solid #eceef3;
  box-shadow: 0 1px 2px rgba(9, 10, 23, .03);
}
body.app-body .topbar-title { color: #090a17; font-weight: 600; letter-spacing: .2px; }
body.app-body .topbar .pill { background: #f5f6f7; color: #51577d; }
body.app-body .topbar .pill .dot { background: #30a46c; box-shadow: 0 0 0 3px rgba(48, 163, 108, .12); }

/* 底部 tab：白底、选中主色 + 轻微上浮 */
body.app-body .tabbar { background: #ffffff; border-top: 1px solid #eceef3; }
body.app-body .tab-item { color: #8b90ad; transition: color .2s ease, transform .2s ease; }
body.app-body .tab-item.active { color: #5468ff; }
body.app-body .tab-item.active .ico { transform: translateY(-1px) scale(1.06); }
body.app-body .tab-item .ico { transition: transform .22s cubic-bezier(.34, 1.56, .64, 1); }

/* 卡片 / 列表：圆角白卡 + 悬浮阴影，参考开源 IM 的消息卡 */
body.app-body .content { background: #f5f6f7; }
body.app-body .card {
  background: #ffffff;
  border: none;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0;
  margin: 10px 10px 0;
  overflow: hidden;
}
body.app-body .conv-list { background: #ffffff; }
body.app-body .conv-item { border-bottom: 1px solid #f2f3f7; transition: background .18s ease, transform .18s ease; }
body.app-body .conv-item:active { background: #f3f5ff; transform: scale(.996); }
body.app-body .conv-item.active { background: #eef1ff; }
body.app-body .conv-avatar { border-radius: 10px; background: #eef1ff; color: #5468ff; font-weight: 600; }
body.app-body .conv-main .name { font-weight: 600; }
body.app-body .conv-item .unread { background: #f5222d; box-shadow: 0 1px 4px rgba(245, 34, 45, .35); }

/* 聊天：浅灰底、靛蓝发出气泡（白字）、白色收到气泡，弹出动效 */
body.app-body .chat-body { background: #f5f6f7; }
body.app-body .bubble {
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(9, 10, 23, .05);
  animation: tsdd-pop .22s cubic-bezier(.34, 1.4, .64, 1);
}
body.app-body .msg-row.in .bubble { background: #ffffff; color: #090a17; border-bottom-left-radius: 4px; }
body.app-body .msg-row.out .bubble { background: #5468ff; color: #ffffff; border-bottom-right-radius: 4px; }
/* 气泡宽度严格按内容自适应：短消息窄、长消息才换行变宽；发出的消息靠右显示 */
body.app-body .bubble { width: auto; flex: 0 1 auto; }
body.app-body .msg-row.out { justify-content: flex-end; }
body.app-body .msg-row.out .bubble .status,
body.app-body .msg-row.out .bubble .meta { color: rgba(255, 255, 255, .78); }
body.app-body .msg-row.out .bubble .quote { background: rgba(255, 255, 255, .16); border-left-color: #ffffff; color: #fff; }
body.app-body .msg-avatar { border-radius: 10px; }
@keyframes tsdd-pop {
  from { opacity: 0; transform: translateY(6px) scale(.98); }
  to { opacity: 1; transform: none; }
}

/* 页面切换：淡入上浮（路由挂载时播放） */
body.app-body .content > * { animation: tsdd-page .26s ease both; }
@keyframes tsdd-page {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* 按钮 / 输入：主色靛蓝、圆角、按压缩放 */
body.app-body .btn { border-radius: 10px; border: 1px solid #eceef3; background: #fff; color: #090a17; transition: transform .16s ease, background .18s ease; }
body.app-body .btn:active { transform: scale(.97); }
body.app-body .btn-primary,
body.app-body .btn.btn-primary { background: #5468ff; border-color: #5468ff; color: #fff; box-shadow: 0 6px 16px rgba(84, 104, 255, .24); }
body.app-body .btn-primary:active { background: #3b4bcc; }
body.app-body .field input, body.app-body .field select, body.app-body .field textarea { border-radius: 8px; }
body.app-body #conv-search { background: #f5f6f7; border-radius: 10px; }
body.app-body .tag.info { background: #eef1ff; color: #5468ff; }
body.app-body .tag.ok { background: #e8f7ef; color: #30a46c; }
body.app-body .tag.danger { background: #fdeceb; color: #f5222d; }
body.app-body .tag.warn { background: #fff4e5; color: #df5d2a; }
body.app-body .composer { background: #ffffff; border-top: 1px solid #eceef3; }
body.app-body .composer-input textarea { background: #f5f6f7; border-radius: 10px; }
body.app-body .cbtn { background: #f5f6f7; border: none; border-radius: 10px; }
body.app-body .nav-item.active { background: #eef1ff; color: #5468ff; }

/* ============================================================
   管理后台（body.admin-body）：简约大气、留白充足、不拥挤
   ============================================================ */
body.admin-body {
  --brand: #5468ff;
  --brand-dark: #3b4bcc;
  --brand-soft: #eef1ff;
  --bg: #f5f6f7;
  --card: #ffffff;
  --text: #090a17;
  --muted: #51577d;
  --line: #eceef3;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(9, 10, 23, .04), 0 10px 30px rgba(9, 10, 23, .05);
  --topbar-h: 56px;
  --side-w: 214px;
  background: #f5f6f7;
}
body.admin-body .topbar { background: #fff; border-bottom: 1px solid var(--line); height: var(--topbar-h); padding: 0 24px; gap: 16px; box-shadow: 0 1px 2px rgba(9, 10, 23, .03); }
body.admin-body .brand strong { font-size: 15.5px; letter-spacing: .2px; }
body.admin-body .sidenav { background: #fff; border-right: 1px solid var(--line); padding: 12px 10px; gap: 3px; }
body.admin-body .nav-item { padding: 9px 12px; border-radius: 9px; font-size: 13.5px; gap: 10px; color: #51577d; }
body.admin-body .nav-item.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
body.admin-body .content { margin: var(--topbar-h) 0 0 var(--side-w); padding: 18px 20px 30px; max-width: none; overflow: visible; }
body.admin-body .page-head { align-items: center; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }
body.admin-body .page-head h2 { font-size: 19px; letter-spacing: .2px; }
body.admin-body .page-head p { font-size: 13px; margin-top: 5px; line-height: 1.6; }
body.admin-body .grid-2, body.admin-body .grid-3, body.admin-body .grid-4 { gap: 14px; }
body.admin-body .card { border: none; border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; margin-bottom: 14px; }
body.admin-body .card-head { margin-bottom: 12px; padding-bottom: 9px; border-bottom: 1px solid var(--line); align-items: center; }
body.admin-body .card-head h3 { font-size: 15px; font-weight: 600; }
body.admin-body .card-head .hint { font-size: 12.5px; }
body.admin-body .field { margin-bottom: 12px; }
body.admin-body .field label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 5px; }
body.admin-body .field input, body.admin-body .field select, body.admin-body .field textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: #fff; font-size: 14px;
}
body.admin-body .field input:focus, body.admin-body .field select:focus, body.admin-body .field textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(84, 104, 255, .12);
}
body.admin-body .btn { padding: 7px 14px; border-radius: 9px; font-size: 13.5px; border: 1px solid var(--line); }
body.admin-body .btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 6px 16px rgba(84, 104, 255, .22); }
body.admin-body .page-actions { gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
body.admin-body .stat { background: #fff; border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
body.admin-body .stat strong { font-size: 22px; letter-spacing: .3px; }
body.admin-body .stat .label { font-size: 13px; }
body.admin-body .table-wrap { border: 1px solid var(--line); border-radius: 12px; overflow: auto; }
body.admin-body table.data th { padding: 10px 12px; background: #fafbfd; color: #51577d; font-weight: 600; font-size: 13px; border-bottom: 1px solid var(--line); white-space: nowrap; }
body.admin-body table.data td { padding: 10px 12px; border-bottom: 1px solid #f3f4f8; font-size: 13.5px; }
body.admin-body table.data tr:last-child td { border-bottom: none; }
body.admin-body table.data tr:hover td { background: #fafbff; }
body.admin-body .tag { padding: 3px 9px; border-radius: 6px; font-size: 12px; }
body.admin-body .pager { padding: 12px 2px 0; }
body.admin-body .modal { border-radius: 18px; }
body.admin-body .modal-head { padding: 18px 22px; border-bottom: 1px solid var(--line); font-size: 16px; font-weight: 600; }
body.admin-body .modal-body { padding: 22px; max-height: 66vh; overflow: auto; }
body.admin-body .modal-foot { padding: 16px 22px 20px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; }
body.admin-body .hint, body.admin-body p { line-height: 1.65; }
body.admin-body .kv dt { font-size: 13px; padding: 7px 0; }
body.admin-body .kv dd { font-size: 14px; padding: 7px 0; }
@media (max-width: 900px) {
  body.admin-body .content { margin: 0; padding: calc(var(--topbar-h) + 12px) 12px calc(var(--tabbar-h) + 18px); }
  body.admin-body .card { padding: 16px; }
  body.admin-body .page-head h2 { font-size: 19px; }
}