/* 悦信商户台 - 像素级复刻样式（2026-07-21 重建版） */
:root {
  /* 品牌色 */
  --brand: #0ea5a5;
  --brand-dark: #0a8a8a;
  --brand-2: #22c1c1;
  --brand-soft: #e6fafa;
  --brand-light: #f0fbfb;
  /* 功能色 */
  --secondary: #2f6bff;
  --ok: #10b981;
  --warn: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  /* 中性 / 表面 */
  --bg: #eef2f7;
  --card: #ffffff;
  --text: #1f2937;
  --text-2: #374151;
  --text-3: #6b7280;
  --muted: #8b9aaf;
  --border: #e4eaf3;
  --border-light: #eef2f7;
  /* 圆角 / 间距 / 阴影 */
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 20px;
  --shadow-sm: 0 1px 3px rgba(15,23,42,.06), 0 1px 2px rgba(15,23,42,.04);
  --shadow: 0 6px 24px rgba(15,23,42,.08);
  --shadow-md: 0 12px 40px rgba(15,23,42,.12);
  --ring: 0 0 0 3px rgba(14,165,165,.18);
  /* 布局 */
  --sidebar-w: 220px;
  --topbar-h: 56px;
  --ease: cubic-bezier(.4,0,.2,1);
  --t-fast: .14s var(--ease);
  --t: .2s var(--ease);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* 全局 SVG 图标默认尺寸：ic() 渲染的 SVG 没有 width/height，需统一约束避免撑开容器 */
button svg, .btn svg { width: 1em; height: 1em; flex-shrink: 0; }
.btn.sm svg { width: 14px; height: 14px; }
.btn svg + span, .btn svg + .label { display: inline-block; }

body {
  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;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

button, input, textarea { font-family: inherit; }

/* 暗色主题（body.dark 由顶栏主题按钮切换） */
body.dark {
  --bg: #0e1521; --card: #182232; --text: #e7eef7; --text-2: #b3c0d2; --text-3: #8595a9;
  --muted: #7c8aa0; --border: #2a374a; --border-light: #212d3d;
  --brand-light: #0d2b2b; --brand-soft: #0d2b2b;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.4); --shadow: 0 8px 28px rgba(0,0,0,.45); --shadow-md: 0 16px 48px rgba(0,0,0,.55);
}
body, .card, .sidebar, .topbar, .view, .page-card, .chat-list, .chat-panel, .chat-right,
.yx-modal, .api-channel-card, .stat-card, .yx-table th, .btn.secondary, .btn.outline,
.quick-phrase, .row-item, .faq-q, .tpl-card, .price-card, .plan-card, .member-card .mc-stat,
.invite-card, .config-banner, .channel-health, .announce-box, .compliance-card, .hero-card {
  transition: background-color var(--t), border-color var(--t), color var(--t), box-shadow var(--t);
}
body.dark .sidebar, body.dark .topbar, body.dark .view,
body.dark .page-card, body.dark .chat-list, body.dark .chat-panel, body.dark .chat-right,
body.dark .yx-modal, body.dark .api-channel-card, body.dark .stat-card, body.dark .yx-table th,
body.dark .btn.secondary, body.dark .btn.outline, body.dark .quick-phrase, body.dark .row-item,
body.dark .faq-q, body.dark .tpl-card, body.dark .price-card, body.dark .member-card .mc-stat,
body.dark .invite-card, body.dark .config-banner, body.dark .channel-health, body.dark .announce-box,
body.dark .hero-card { background: var(--card); border-color: var(--border); color: var(--text); }
body.dark .chat-body { background: #131c2a; }
body.dark .msg.in .msg-bubble { background: #1e2a3c; border-color: #2a374a; color: var(--text); }
body.dark .gmsg-bubble { background: #1e2a3c; border-color: #2a374a; color: var(--text); }
body.dark input, body.dark textarea, body.dark select, body.dark .field .input-wrap,
body.dark .chat-search input, body.dark .chat-input-area textarea, body.dark .form-group input {
  background: #111a27; color: var(--text); border-color: var(--border);
}
body.dark .yx-table tbody tr:hover, body.dark .nav-item:hover, body.dark .nav-group:hover,
body.dark .chat-item:hover, body.dark .icon-btn:hover, body.dark .btn.ghost:hover { background: #1f2c3e; }


/* ============ 登录页 ============ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #e6f1ff 0%, #f2f9ff 45%, #eef6ff 100%);
  position: relative;
  overflow: hidden;
}
.login-page::before,
.login-page::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: .5;
  pointer-events: none;
}
.login-page::before { width: 360px; height: 360px; background: #a5d8ff; left: 4%; top: 10%; }
.login-page::after { width: 420px; height: 420px; background: #d6eeff; right: 2%; bottom: 5%; }
.login-orb {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 22%, rgba(255,255,255,.98), rgba(219,238,255,.75) 42%, rgba(165,207,255,.45) 68%, rgba(59,130,246,.15));
  box-shadow: inset -14px -14px 42px rgba(255,255,255,.9), inset 14px 14px 42px rgba(59,130,246,.12), 0 24px 80px rgba(59,130,246,.18);
  pointer-events: none;
}
.login-orb::after {
  content: '';
  position: absolute;
  top: 16%; left: 20%;
  width: 26%; height: 26%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.95), rgba(255,255,255,0) 70%);
  filter: blur(1px);
}
.login-orb.o1 { width: 150px; height: 150px; left: 8%; top: 55%; }
.login-orb.o2 { width: 100px; height: 100px; right: 14%; top: 18%; }
.login-orb.o3 { width: 64px; height: 64px; left: 24%; bottom: 14%; }
.login-ring {
  position: absolute;
  width: 480px; height: 480px;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%) rotate(-12deg);
  pointer-events: none;
  opacity: .3;
}
.login-ring svg { width: 100%; height: 100%; fill: none; stroke: url(#ringGrad); stroke-width: 1.1; }

.login-card {
  width: 420px;
  max-width: 92vw;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(14px) saturate(120%);
  border: 1px solid rgba(255,255,255,.7);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.1), 0 0 0 1px rgba(255,255,255,.5) inset;
  padding: 38px 36px 34px;
  position: relative;
  z-index: 2;
}
.login-brand {
  display: flex; align-items: center; gap: 12px; margin-bottom: 6px;
}
.login-brand .logo {
  width: 42px; height: 42px; border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), #22c1c1);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 18px;
  box-shadow: 0 6px 16px rgba(14, 165, 165, .25);
}
.login-brand .logo svg { width: 22px; height: 22px; }
.login-brand .name { font-size: 18px; font-weight: 700; color: var(--text); line-height: 1.2; }
.login-brand .subname { font-size: 12px; color: var(--muted); margin-top: 2px; }
.login-sub { color: var(--muted); font-size: 13px; margin: 22px 0 24px; }
.login-title { font-size: 22px; font-weight: 700; margin-bottom: 22px; color: var(--text); }

.login-extra { display: flex; align-items: center; justify-content: space-between; margin: 4px 2px 18px; }
.login-extra .remember { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); cursor: pointer; user-select: none; }
.login-extra .remember input { width: 15px; height: 15px; accent-color: var(--brand); cursor: pointer; }

.segmented {
  display: flex; background: #f1f5f9; border-radius: 10px; padding: 4px; margin-bottom: 24px;
}
.segmented button {
  flex: 1; border: none; background: transparent; padding: 9px 0; border-radius: 8px;
  font-size: 14px; color: var(--muted); cursor: pointer; transition: all .15s;
}
.segmented button.active { background: #fff; color: var(--text); font-weight: 600; box-shadow: 0 1px 4px rgba(0,0,0,.06); }

.field { margin-bottom: 18px; }
.field label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 8px; font-weight: 500; }
.field label .required { color: var(--danger); margin-right: 4px; }
.field .input-wrap {
  display: flex; align-items: center; border: 1px solid var(--border);
  border-radius: 10px; padding: 0 14px; transition: border-color .15s, box-shadow .15s;
  background: #fff;
}
.field .input-wrap:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(14, 165, 165, .08); }
.field .input-wrap svg { width: 18px; height: 18px; color: var(--muted); flex-shrink: 0; }
.field input {
  flex: 1; height: 46px; border: none; outline: none; font-size: 15px;
  padding: 0 12px; background: transparent; color: var(--text);
}
.field .toggle {
  border: none; background: transparent; cursor: pointer; color: var(--muted);
  display: flex; align-items: center; padding: 4px;
}
.btn {
  width: 100%; height: 46px; border: none; border-radius: 10px;
  background: var(--brand); color: #fff; font-size: 16px; font-weight: 600;
  cursor: pointer; transition: background .15s, transform .05s; margin-top: 4px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn:hover { background: var(--brand-dark); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .65; cursor: not-allowed; }
.btn.secondary { background: #fff; color: var(--brand); border: 1px solid var(--brand); }
.btn.secondary:hover { background: var(--brand-light); }
.btn.sm { width: auto; height: 34px; padding: 0 16px; font-size: 13px; white-space: nowrap; }
.btn.outline { background: #fff; color: var(--text-2); border: 1px solid var(--border); }
.btn.outline:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-light); }
.btn.danger { background: var(--danger); }
.btn.warn { background: #f59e0b; }
.btn.warn:hover { background: #d97706; }
.btn.ghost { background: transparent; color: var(--text-2); border: 1px solid transparent; }
.btn.ghost:hover { background: var(--border-light); }
.btn.sm.danger { background: #fff; color: var(--danger); border: 1px solid #fecdd3; }
.btn.sm.danger:hover { background: #fff1f2; }
.login-err { color: var(--danger); font-size: 13px; min-height: 18px; margin-top: 10px; text-align: center; }
.login-float {
  position: fixed; right: 28px; bottom: 28px;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--brand); color: #fff; border: none;
  box-shadow: 0 8px 24px rgba(14, 165, 165, .35);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  z-index: 10; transition: transform .2s, box-shadow .2s;
}
.login-float:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(14, 165, 165, .45); }
.login-float:active { transform: translateY(0); }
.login-float svg { width: 26px; height: 26px; }
.login-float-tip {
  position: fixed; right: 92px; bottom: 36px;
  max-width: 220px; padding: 10px 14px;
  background: rgba(15,23,42,.85); color: #fff;
  font-size: 13px; border-radius: 10px;
  opacity: 0; transform: translateX(10px);
  animation: tipIn .3s forwards;
  pointer-events: none; z-index: 11;
}
@keyframes tipIn { to { opacity: 1; transform: translateX(0); } }
.login-float-tip.out { opacity: 0; transform: translateX(10px); transition: all .3s; }
.login-torus {
  position: absolute; right: 4%; bottom: 6%;
  width: 320px; height: 320px;
  pointer-events: none; opacity: .55; z-index: 1;
  transform: rotate(-15deg);
}
.login-torus svg { width: 100%; height: 100%; }

/* ============ 控制台布局 ============ */
.console { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w); background: var(--card); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: fixed; left: 0; top: 0; height: 100vh;
  z-index: 20;
}
.side-brand {
  display: flex; align-items: center; gap: 10px; padding: 18px 16px 16px;
  border-bottom: 1px solid var(--border-light);
}
.side-brand .logo {
  width: 34px; height: 34px; border-radius: 8px;
  background: linear-gradient(135deg, var(--brand), #22c1c1);
  display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 15px;
  flex-shrink: 0;
}
.side-brand .logo svg { width: 18px; height: 18px; }
.side-brand .name { font-size: 15px; font-weight: 700; line-height: 1.2; color: var(--text); }
.side-brand .role { font-size: 11px; color: var(--muted); margin-top: 1px; }
.side-menu { flex: 1; overflow-y: auto; padding: 8px 10px 14px; }
.nav-group-title { font-size: 11px; color: var(--muted); padding: 12px 10px 6px; font-weight: 500; }

.nav-item, .nav-group {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px;
  color: var(--text-2); cursor: pointer; font-size: 13px; margin-bottom: 2px; user-select: none;
  transition: background .12s, color .12s;
  position: relative;
}
.nav-item svg, .nav-group svg { width: 16px; height: 16px; flex-shrink: 0; }
.nav-item:hover, .nav-group:hover { background: #f8fafc; color: var(--text); }
.nav-item.active, .nav-group.active {
  background: var(--brand-light); color: var(--brand); font-weight: 600;
}
.nav-item.active::before, .nav-group.active::before {
  content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px;
  background: var(--brand); border-radius: 0 3px 3px 0;
}
.nav-item .arrow { margin-left: auto; font-size: 11px; transition: transform .2s; }
.nav-item.expanded .arrow { transform: rotate(180deg); }
.nav-sub { padding-left: 26px; margin-bottom: 4px; display: none; }
.nav-sub.open { display: block; }
.nav-sub .nav-item { font-size: 13px; padding: 8px 12px; margin-bottom: 1px; }
.nav-sub .nav-item.active::before { top: 6px; bottom: 6px; }
.nav-unread {
  margin-left: auto; min-width: 18px; height: 18px; border-radius: 9px; background: var(--danger);
  color: #fff; font-size: 11px; display: flex; align-items: center; justify-content: center; padding: 0 5px;
}

.main-area { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: var(--topbar-h); background: var(--card); border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; justify-content: space-between; padding: 0 20px;
  position: sticky; top: 0; z-index: 10;
}
.topbar-left { display: flex; align-items: center; gap: 10px; }
.topbar h1 { font-size: 16px; font-weight: 600; color: var(--text); }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.topbar-btn {
  height: 34px; padding: 0 14px; border: 1px solid var(--border); background: #fff; border-radius: 8px;
  color: var(--text-2); font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.topbar-btn:hover { border-color: var(--brand); color: var(--brand); }
.topbar-btn svg { width: 15px; height: 15px; }
.icon-btn {
  width: 34px; height: 34px; border: none; background: transparent; border-radius: 50%;
  cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--muted);
  transition: background .12s, color .12s;
}
.icon-btn:hover { background: #f1f5f9; color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; background: #e2e8f0; display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 12px; cursor: pointer;
}

.view { padding: 20px; flex: 1; }

/* ============ 通用组件 ============ */
.page-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-sm);
  padding: 20px; margin-bottom: 16px;
}
.page-card .pc-title {
  font-size: 15px; font-weight: 600; margin-bottom: 16px; display: flex; align-items: center; justify-content: space-between;
}

.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 16px; }
.stat-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 18px 16px;
  box-shadow: var(--shadow-sm); display: flex; align-items: center; justify-content: space-between; position: relative;
}
.stat-card .info { flex: 1; }
.stat-card .label { color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.stat-card .value { font-size: 26px; font-weight: 700; color: var(--text); line-height: 1; }
.stat-card .unit { font-size: 13px; color: var(--text); font-weight: 600; margin-left: 2px; }
.stat-card .delta { font-size: 12px; color: #94a3b8; margin-top: 6px; }
.stat-card .icon {
  width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  color: #fff; flex-shrink: 0;
}
.stat-card .icon svg { width: 22px; height: 22px; }

.banner {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 10px;
  margin-bottom: 16px; font-size: 13px; border: 1px solid transparent;
}
.banner.info { background: #eff6ff; border-color: #dbeafe; color: #1e40af; }
.banner.warn { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.banner.danger { background: #fff1f2; border-color: #fecdd3; color: #9f1239; }
.banner .b-icon { width: 20px; height: 20px; flex-shrink: 0; }
.banner .b-main { flex: 1; }
.banner .b-title { font-weight: 600; margin-bottom: 3px; }
.banner .b-action {
  margin-left: auto; border: none; padding: 7px 16px; border-radius: 8px; cursor: pointer; font-size: 13px; white-space: nowrap;
  font-weight: 500;
}
.banner.info .b-action { background: var(--brand); color: #fff; }
.banner.info .b-action:hover { background: var(--brand-dark); }
.banner.warn .b-action { background: var(--ok); color: #fff; }
.banner.warn .b-action:hover { background: #059669; }
.banner.danger .b-action { background: #fff; color: var(--danger); border: 1px solid var(--danger); }

.empty-state { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty-state svg { width: 64px; height: 64px; margin-bottom: 16px; color: #cbd5e1; }
.empty-state .title { font-size: 15px; color: var(--text); margin-bottom: 6px; }
.empty-state .desc { font-size: 13px; }

/* 表格 */
.yx-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.yx-table th, .yx-table td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border-light); }
.yx-table th { color: var(--text-2); font-weight: 600; font-size: 13px; background: #fafbfc; }
.yx-table tbody tr:hover { background: #f8fafc; }
.yx-table .actions { display: flex; gap: 8px; flex-wrap: nowrap; align-items: center; }
.yx-table .action { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; cursor: pointer; white-space: nowrap; }
.yx-table .action.edit { color: var(--brand); }
.yx-table .action.del { color: var(--danger); }
.yx-table .action:hover { opacity: .8; }
.yx-table .tag { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px; }
.yx-table .tag.online { background: #dcfce7; color: #166534; }
.yx-table .tag.offline { background: #f1f5f9; color: #64748b; }

/* 分页 */
.pagination { display: flex; justify-content: flex-end; align-items: center; gap: 6px; margin-top: 16px; }
.pagination button {
  width: 30px; height: 30px; border: 1px solid var(--border); background: #fff; border-radius: 6px;
  color: var(--text-2); cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.pagination button:hover { border-color: var(--brand); color: var(--brand); }
.pagination button.active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* 搜索框 */
.search-bar { position: relative; }
.search-bar input {
  width: 260px; height: 36px; border: 1px solid var(--border); border-radius: 8px; padding: 0 32px 0 12px;
  font-size: 13px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.search-bar input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(14, 165, 165, .08); }
.search-bar svg { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--muted); }

/* 标签 */
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 4px; font-size: 12px; }
.tag.primary { background: var(--brand-light); color: var(--brand); }
.tag.success { background: #dcfce7; color: #166534; }
.tag.warn { background: #fef3c7; color: #92400e; }
.tag.danger { background: #fee2e2; color: #991b1b; }
.tag.info { background: #dbeafe; color: #1e40af; }
.tag.light { background: #f1f5f9; color: #475569; }

/* 表单 */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 8px; font-weight: 500; }
.form-group label .required { color: var(--danger); margin-right: 4px; }
.form-group input, .form-group textarea, .form-group select {
  width: 100%; height: 40px; border: 1px solid var(--border); border-radius: 8px; padding: 0 12px;
  font-size: 14px; outline: none; transition: border-color .15s, box-shadow .15s; background: #fff;
}
.form-group textarea { height: auto; padding: 10px 12px; resize: vertical; min-height: 80px; }
.form-group input:focus, .form-group textarea:focus, .form-group select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(14, 165, 165, .08); }
.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }

/* Tabs */
.tabs { display: flex; border-bottom: 1px solid var(--border-light); margin-bottom: 20px; gap: 24px; }
.tabs .tab { padding: 10px 0; font-size: 14px; color: var(--muted); cursor: pointer; position: relative; }
.tabs .tab:hover { color: var(--text); }
.tabs .tab.active { color: var(--brand); font-weight: 600; }
.tabs .tab svg { width: 14px; height: 14px; vertical-align: middle; margin-right: 4px; }
.tabs .tab.active::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--brand); border-radius: 2px 2px 0 0; }

/* Segmented inline */
.seg {
  display: inline-flex; background: #f1f5f9; border-radius: 8px; padding: 3px;
}
.seg button {
  border: none; background: transparent; padding: 6px 14px; border-radius: 6px;
  font-size: 13px; color: var(--muted); cursor: pointer; transition: all .12s;
}
.seg button.active { background: #fff; color: var(--text); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.06); }

/* ============ 首页 ============ */
.home-hero { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.hero-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 22px; box-shadow: var(--shadow-sm); flex: 1; }
.hero-card .eyebrow { font-size: 12px; color: var(--brand); font-weight: 600; letter-spacing: .5px; text-transform: uppercase; margin-bottom: 8px; }
.hero-card h2 { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.hero-card p { color: var(--muted); font-size: 13px; line-height: 1.6; }
.hero-card .btn { width: auto; min-width: 120px; margin-top: 14px; padding: 0 22px; white-space: nowrap; }

.announce-box { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px; box-shadow: var(--shadow-sm); }
.announce-box h3 { font-size: 14px; font-weight: 600; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.announce-box h3 svg { width: 16px; height: 16px; }
.announce-box p { color: var(--text-2); font-size: 13px; line-height: 1.6; }

.compliance-card { background: #fff5f7; border: 1px solid #fecdd3; border-radius: 12px; padding: 18px 20px; }
.compliance-card h3 { font-size: 14px; font-weight: 600; color: #9f1239; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.compliance-card h3 svg { width: 16px; height: 16px; }
.compliance-card p { color: #9f1239; font-size: 13px; line-height: 1.6; margin-bottom: 8px; }
.compliance-card .btn { background: #fff1f2; color: #9f1239; border: 1px solid #fecdd3; margin-top: 6px; }
.compliance-card .btn:hover { background: #ffe4e6; }

.channel-health { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px; box-shadow: var(--shadow-sm); }
.channel-health h3 { font-size: 14px; font-weight: 600; margin-bottom: 14px; }
.ch-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border-light); }
.ch-item:last-child { border-bottom: none; }
.ch-item .name { font-weight: 600; width: 80px; }
.ch-item .tag { margin-right: auto; }
.ch-item .meta { color: var(--muted); font-size: 13px; }
.ch-item .bar { width: 120px; height: 6px; background: #e2e8f0; border-radius: 3px; overflow: hidden; }
.ch-item .bar i { display: block; height: 100%; background: var(--brand); border-radius: 3px; }
.ch-icon { width: 36px; height: 36px; border-radius: 8px; background: var(--brand-light); color: var(--brand); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ch-icon svg { width: 18px; height: 18px; }
.num-cell { font-weight: 600; font-size: 14px; }
.api-stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.api-stat { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.api-stat .label { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.api-stat .value { font-size: 22px; font-weight: 700; color: var(--text); }
.api-stat .sub { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ============ API 接入渠道卡片 ============ */
.api-channel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 16px; }
.api-channel-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 18px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.api-channel-card:hover { border-color: var(--brand); box-shadow: 0 4px 16px rgba(14, 165, 165, .08); }
.api-channel-card.is-offline { background: linear-gradient(180deg, #fff 0%, #fafbfc 100%); }
.api-card-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.api-card-icon {
  width: 44px; height: 44px; border-radius: 11px; background: var(--brand-light);
  color: var(--brand); display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.api-card-icon svg { width: 22px; height: 22px; }
.api-card-info { flex: 1; min-width: 0; }
.api-card-title { font-size: 16px; font-weight: 700; color: var(--text); line-height: 1.3; margin-bottom: 4px; }
.api-card-desc { font-size: 12px; color: var(--muted); line-height: 1.5; margin-bottom: 8px; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.api-card-tags { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.api-card-kind { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; padding: 2px 8px; border-radius: 10px; background: var(--brand-light); color: var(--brand); font-weight: 500; }
.api-card-kind svg { width: 11px; height: 11px; }
.api-card-code-mini { font-family: "SFMono-Regular", Consolas, monospace; font-size: 11px; color: var(--muted); padding: 2px 6px; background: var(--border-light); border-radius: 4px; }
.api-card-status { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 4px 10px; border-radius: 20px; font-weight: 500; flex-shrink: 0; }
.api-card-status .api-card-dot { width: 6px; height: 6px; border-radius: 50%; }
.api-card-status.online { background: #e6fffa; color: #0d9488; }
.api-card-status.online .api-card-dot { background: #0d9488; box-shadow: 0 0 0 2px rgba(13, 148, 136, .2); }
.api-card-status.offline { background: #f1f5f9; color: #64748b; }
.api-card-status.offline .api-card-dot { background: #94a3b8; }
.api-card-code {
  position: relative;
  background: #f8fafc; border: 1px solid var(--border-light); border-radius: 8px;
  overflow: hidden; margin-bottom: 14px;
}
.api-card-code-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; background: #fff; border-bottom: 1px solid var(--border-light); font-size: 12px; color: var(--text-2); }
.api-card-code-head > span { display: inline-flex; align-items: center; gap: 4px; font-weight: 500; }
.api-card-code-head > span svg { width: 12px; height: 12px; color: var(--muted); }
.api-card-code pre {
  margin: 0; padding: 10px 12px; font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 11.5px; line-height: 1.6; color: var(--text-2); white-space: pre; word-break: normal;
  max-height: 140px; overflow: auto;
}
.api-card-copy {
  height: 24px; padding: 0 8px; border-radius: 5px;
  border: 1px solid var(--border); background: #fff; color: var(--brand);
  font-size: 11.5px; font-weight: 500; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 3px;
  transition: all .15s;
}
.api-card-copy:hover { background: var(--brand-light); border-color: var(--brand); }
.api-card-copy svg { width: 11px; height: 11px; flex-shrink: 0; }
.api-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 4px; border-top: 1px dashed var(--border-light); padding-top: 12px; }
.api-card-actions { display: flex; gap: 6px; }
.api-card-actions .btn.sm { height: 30px; padding: 0 10px; font-size: 12px; gap: 4px; }
.api-card-actions .btn.sm.ghost.danger { width: 30px; padding: 0; }
.api-card-actions .btn.sm.ghost.danger svg { width: 14px; height: 14px; }

/* 渠道启用/停用 iOS 风格开关 */
.api-switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.api-switch input { position: absolute; opacity: 0; pointer-events: none; }
.api-switch-track { position: relative; width: 32px; height: 18px; background: #cbd5e1; border-radius: 10px; transition: background .2s; flex-shrink: 0; }
.api-switch-thumb { position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; background: #fff; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: left .2s; }
.api-switch input:checked + .api-switch-track { background: var(--brand); }
.api-switch input:checked + .api-switch-track .api-switch-thumb { left: 16px; }
.api-switch-text { font-size: 12px; color: var(--text-2); font-weight: 500; }

/* ============ 在线聊天 ============ */
.chat-view { display: grid; grid-template-columns: 280px 1fr 260px; gap: 14px; height: calc(100vh - var(--topbar-h) - 40px); min-height: 0; }
.chat-list { background: var(--card); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; }
.chat-tabs { display: flex; border-bottom: 1px solid var(--border-light); }
.chat-tabs .ct { flex: 1; text-align: center; padding: 12px 0; font-size: 13px; color: var(--muted); cursor: pointer; position: relative; }
.chat-tabs .ct.active { color: var(--brand); font-weight: 600; background: var(--brand-light); }
.chat-tabs .ct.active::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--brand); }
.chat-status-bar { display: flex; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border-light); align-items: center; }
.chat-status-bar .s { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 20px; font-size: 12px; cursor: pointer; border: 1px solid transparent; }
.chat-status-bar .s.active { background: var(--brand-light); color: var(--brand); border-color: var(--brand); }
.chat-status-bar .s { background: #f1f5f9; color: var(--text-2); }
.chat-status-bar .s:not(.active) .status-dot { display: none; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.status-dot.online { background: #22c55e; box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.2); }
.status-dot.busy { background: #f59e0b; }
.status-dot.offline { background: #94a3b8; }
.chat-sub-tabs { display: flex; gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--border-light); }
.chat-sub-tabs .st { font-size: 13px; color: var(--muted); cursor: pointer; }
.chat-sub-tabs .st.active { color: var(--brand); font-weight: 600; }
.chat-search { padding: 8px 12px; border-bottom: 1px solid var(--border-light); }
.chat-search input { width: 100%; height: 34px; border: 1px solid var(--border); border-radius: 8px; padding: 0 28px 0 10px; font-size: 13px; outline: none; }
.chat-search input:focus { border-color: var(--brand); }
.chat-count { padding: 8px 12px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--border-light); }
.chat-items { flex: 1; overflow-y: auto; }
.chat-item { padding: 12px 14px; border-bottom: 1px solid var(--border-light); cursor: pointer; transition: background .12s; display: flex; gap: 10px; align-items: flex-start; }
.chat-item:hover { background: #f8fafc; }
.chat-item.active { background: var(--brand-light); border-left: 3px solid var(--brand); }
.chat-item.has-unread { background: color-mix(in srgb, var(--danger) 7%, #fff); border-left: 3px solid var(--danger); }
.chat-item .ci-avatar { flex-shrink: 0; }
.chat-item .ci-avatar .msg-av { width: 40px; height: 40px; font-size: 15px; }
.chat-item .ci-main { flex: 1; min-width: 0; }
.chat-item .ci-rated { background: #f0fdf4; color: #15803d; font-size: 11px; padding: 1px 7px; border-radius: 10px; margin-left: 6px; }
.chat-item .ci-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.chat-item .ci-name { font-weight: 600; font-size: 14px; }
.chat-item .ci-time { font-size: 12px; color: var(--muted); }
.chat-item .ci-msg { font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 4px; }
.chat-item .ci-bottom { display: flex; align-items: center; justify-content: space-between; font-size: 12px; }
.chat-item .ci-agent { color: var(--muted); }
.chat-item .ci-ip { color: var(--brand); background: color-mix(in srgb, var(--brand) 12%, transparent); padding: 1px 6px; border-radius: 6px; font-size: 11px; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-item .ci-count { display: inline-block; background: var(--brand); color: #fff; border-radius: 10px; font-size: 11px; line-height: 16px; padding: 0 6px; margin-left: 6px; font-weight: 600; }
.ci-vid { font-size: 11px; color: #9aa3b2; font-weight: 400; margin-left: 4px; background: #f3f4f6; padding: 1px 6px; border-radius: 4px; vertical-align: middle; }
.chat-item .ci-merge { background: color-mix(in srgb, var(--brand) 16%, transparent); color: var(--brand); margin-left: 4px; }
.chat-item .ci-unread { background: var(--danger); color: #fff; font-size: 11px; min-width: 18px; height: 18px; border-radius: 9px; display: flex; align-items: center; justify-content: center; padding: 0 5px; }

.chat-panel { background: var(--card); border: 1px solid var(--border); border-radius: 12px; display: flex; flex-direction: column; overflow: hidden; }
.chat-head { padding: 12px 16px; border-bottom: 1px solid var(--border-light); display: flex; align-items: center; justify-content: space-between; }
.chat-head .ch-left { display: flex; flex-direction: column; gap: 2px; }
.chat-head .ch-name { font-weight: 600; font-size: 15px; }
.chat-head .ch-agent { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.chat-head .ch-agent-av { width: 18px; height: 18px; border-radius: 50%; background: var(--brand); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; overflow: hidden; flex-shrink: 0; }
.chat-head .ch-agent-av img { width: 100%; height: 100%; object-fit: cover; }
.chat-head .ch-agent-name { color: var(--text-2); font-weight: 500; }
.chat-head .ch-agent-group { color: var(--muted); }
.chat-head .ch-actions { display: flex; align-items: center; gap: 8px; }
.chat-head .ch-actions .icon-btn { width: 32px; height: 32px; }
.chat-head .ch-actions .btn.sm { height: 32px; }
.chat-head .dropdown { position: relative; }
.chat-head .dropdown-menu {
  position: absolute; right: 0; top: 38px; background: #fff; border: 1px solid var(--border); border-radius: 8px;
  box-shadow: var(--shadow); min-width: 120px; z-index: 10; padding: 6px 0; display: none;
}
.chat-head .dropdown-menu.open { display: block; }
.chat-head .dropdown-menu .dm-item { padding: 8px 14px; font-size: 13px; cursor: pointer; }
.chat-head .dropdown-menu .dm-item:hover { background: #f8fafc; }
.chat-head .transfer-menu { min-width: 160px; }
.chat-head .transfer-menu .tm-item { display: flex; align-items: center; justify-content: space-between; }
.chat-head .transfer-menu .dot { width: 8px; height: 8px; border-radius: 50%; }
.chat-head .transfer-menu .dot.on { background: var(--ok); }
.chat-head .transfer-menu .dot.off { background: var(--muted); }
.chat-head .transfer-menu .tm-group { padding: 6px 14px 2px; font-size: 11px; color: var(--muted); font-weight: 600; }
.chat-head .transfer-menu .tm-item { display: flex; align-items: center; gap: 8px; padding: 7px 14px; font-size: 13px; cursor: pointer; }
.chat-head .transfer-menu .tm-item:hover { background: #f1f5f9; }
.chat-head .transfer-menu .tm-item.cur { cursor: default; opacity: .7; }
.chat-head .transfer-menu .tm-item.cur:hover { background: transparent; }
.chat-head .transfer-menu .tm-av { width: 24px; height: 24px; border-radius: 50%; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; flex-shrink: 0; }
.chat-head .transfer-menu .tm-name { flex: 1; }
.chat-head .transfer-menu .tm-active { font-size: 11px; color: var(--muted); }
.chat-head .transfer-menu .tm-cur { font-size: 11px; color: var(--brand); background: #e6fafa; padding: 1px 6px; border-radius: 8px; }
.chat-head .transfer-menu .tm-empty { padding: 12px 14px; font-size: 12px; color: var(--muted); }

.chat-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; background: #fafbfc; }
.chat-loadmore {
  align-self: center; padding: 6px 14px; border: 1px dashed var(--border); border-radius: 20px; font-size: 12px;
  color: var(--muted); cursor: pointer; background: #fff; margin-bottom: 8px;
}
.chat-loadmore:hover { border-color: var(--brand); color: var(--brand); }
.agent-cell { display: flex; align-items: center; gap: 8px; }
.agent-av { width: 30px; height: 30px; border-radius: 50%; overflow: hidden; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 13px; font-weight: 600; }
.agent-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.agent-name { font-weight: 500; }
.yx-modal-mask { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: none; align-items: center; justify-content: center; z-index: 1000; }
.yx-modal { width: 440px; max-width: calc(100vw - 32px); background: #fff; border-radius: 14px; padding: 22px 22px 18px; box-shadow: 0 24px 60px rgba(15, 23, 42, .25); position: relative; }
.yx-modal-close { position: absolute; top: 12px; right: 14px; width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 20px; color: var(--muted); cursor: pointer; }
.yx-modal-close:hover { background: #f1f5f9; }
.yx-modal-title { font-size: 16px; font-weight: 700; margin-bottom: 16px; }
.yx-modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
/* ========== 单聊消息气泡（参考截图：头像 + meta[名字+时间] + 气泡 三段式） ========== */
.msg { display: flex; gap: 10px; align-items: flex-start; margin: 8px 0; }
.msg.in { flex-direction: row; }
.msg.out { flex-direction: row-reverse; }
.msg.consecutive { margin-top: -4px; }
.msg .msg-av { width: 36px; height: 36px; border-radius: 50%; overflow: hidden; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; background: var(--brand); color: #fff; }
.msg .msg-av img { width: 100%; height: 100%; object-fit: cover; }
.msg-av-spacer { width: 36px; flex-shrink: 0; }
.msg-content { display: flex; flex-direction: column; min-width: 0; max-width: 70%; }
.msg.out .msg-content { align-items: flex-end; }
.msg-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 12px; }
.msg.out .msg-meta { flex-direction: row-reverse; }
.msg-name { font-weight: 600; color: var(--text); }
.msg-time { color: var(--muted); font-size: 11px; }
.msg-time-only { align-self: flex-end; margin-top: 2px; }
.msg .msg-bubble { padding: 9px 13px; border-radius: 10px; font-size: 14px; line-height: 1.55; max-width: 100%; word-break: break-word; white-space: pre-wrap; }
.msg.in .msg-bubble { background: #fff; border: 1px solid var(--border-light); }
.msg.out .msg-bubble { background: var(--brand); color: #fff; }
.msg .msg-img { max-width: 220px; max-height: 200px; border-radius: 8px; display: block; }
.msg .msg-cap { margin-top: 6px; font-size: 12px; opacity: .9; }
.msg .msg-rich a { color: inherit; text-decoration: underline; }
.msg .msg-rich b { font-weight: 700; }
.msg .msg-rich em { font-style: italic; }
.msg.system { max-width: 100%; align-self: center; justify-content: center; margin: 6px 0; }
.msg.system .msg-bubble.sys { background: #f3f4f6; color: #6b7280; font-size: 12px; border: none; border-radius: 12px; padding: 4px 12px; text-align: center; max-width: 90%; }
.msg-day { align-self: center; font-size: 12px; color: var(--muted); margin: 4px 0; }
.msg-day span { background: #eef1f7; padding: 2px 10px; border-radius: 10px; }
.msg-day { align-self: center; font-size: 12px; color: var(--muted); margin: 4px 0; }
.msg.system { max-width: 100%; align-self: center; justify-content: center; margin: 6px 0; }
.msg.system .msg-bubble.sys { background: #f3f4f6; color: #6b7280; font-size: 12px; border: none; border-radius: 12px; padding: 4px 12px; text-align: center; max-width: 90%; border: none; }
.msg .read-tick { font-size: 11px; opacity: .85; }
.msg-day span { background: #eef1f7; padding: 2px 10px; border-radius: 10px; }

/* ========== 右侧 常用语 / 详情 / 标签 ========== */
.chat-right { display: flex; flex-direction: column; min-width: 0; }
.chat-right .cr-tabs { display: flex; border-bottom: 1px solid var(--border-light); background: #fff; border-radius: 12px 12px 0 0; }
.chat-right .cr-tab { flex: 1; text-align: center; padding: 12px 0; font-size: 13px; color: var(--muted); cursor: pointer; }
.chat-right .cr-tab.active { color: var(--brand); font-weight: 600; border-bottom: 2px solid var(--brand); }
.chat-right .cr-body { flex: 1; overflow-y: auto; padding: 10px; background: #fff; border: 1px solid var(--border); border-top: none; border-radius: 0 0 12px 12px; }
.quick-phrase { padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 8px; font-size: 13px; color: var(--text-2); cursor: pointer; transition: all .12s; background: #fafbfc; line-height: 1.5; }
.quick-phrase:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-light); }
.cr-detail-row { display: flex; justify-content: space-between; padding: 8px 4px; border-bottom: 1px solid var(--border-light); font-size: 13px; }
.cr-detail-row:last-child { border-bottom: none; }
.cr-k { color: var(--muted); }
.cr-v { color: var(--text); font-weight: 500; }
.cr-tag-input { display: flex; gap: 6px; margin-bottom: 10px; }
.cr-tag-input input { flex: 1; border: 1px solid var(--border); border-radius: 6px; padding: 6px 10px; font-size: 13px; outline: none; }
.cr-tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.cr-tag { background: var(--brand-light); color: var(--brand); padding: 4px 10px; border-radius: 12px; font-size: 12px; display: inline-flex; align-items: center; gap: 4px; }
.cr-tag-x { cursor: pointer; opacity: .6; font-size: 14px; line-height: 1; }
.cr-tag-x:hover { opacity: 1; }

/* ========== 群聊消息气泡（按发送者分栏：头像 + 昵称 + 气泡 + 时间） ========== */
.gmsg { display: flex; gap: 10px; align-items: flex-start; max-width: 86%; margin: 2px 0; }
.gmsg.mine { align-self: flex-end; flex-direction: row-reverse; }
.gmsg.consecutive { margin-top: -4px; }
.gmsg-av { width: 36px; height: 36px; border-radius: 50%; overflow: hidden; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 600; background: var(--brand); color: #fff; }
.gmsg-av-spacer { width: 36px; flex-shrink: 0; }
.gmsg-main { display: flex; flex-direction: column; min-width: 0; max-width: 460px; }
.gmsg.mine .gmsg-main { align-items: flex-end; }
.gmsg-name { font-size: 12px; color: var(--muted); margin-bottom: 4px; padding: 0 2px; }
.gmsg-row { display: flex; align-items: flex-end; gap: 8px; }
.gmsg.mine .gmsg-row { flex-direction: row-reverse; }
.gmsg-bubble { padding: 9px 13px; border-radius: 12px; background: #fff; border: 1px solid var(--border-light); font-size: 13px; line-height: 1.6; word-break: break-word; white-space: pre-wrap; max-width: 460px; min-width: 40px; }
.gmsg:not(.mine) .gmsg-bubble { border-top-left-radius: 3px; }
.gmsg.mine .gmsg-bubble { background: var(--brand); color: #fff; border-color: transparent; border-top-right-radius: 3px; }
.gmsg-time { font-size: 11px; color: var(--muted); white-space: nowrap; opacity: .75; flex-shrink: 0; padding-bottom: 2px; }
.gmsg-recalled { color: var(--muted); font-style: italic; }
.gmsg-divider { align-self: center; margin: 12px 0 4px; }
.gmsg-divider span { background: #eef1f7; color: var(--muted); font-size: 11px; padding: 2px 10px; border-radius: 10px; }

/* ========== 群聊列表 ⋮ 菜单 / 禁言标签 ========== */
.chat-item { position: relative; }
.chat-item .ci-actions { opacity: 0; transition: opacity .15s; }
.chat-item:hover .ci-actions, .chat-item.active .ci-actions { opacity: 1; }
.chat-item .ci-actions { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); }
.ci-more { width: 28px; height: 28px; border: 1px solid var(--border); background: #fff; border-radius: 6px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }
.ci-more:hover { color: var(--brand); border-color: var(--brand); }
.ci-more svg { width: 14px; height: 14px; }
.chat-item .dropdown { position: relative; }
.ci-menu { position: absolute; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,.1); min-width: 170px; z-index: 200; display: none; padding: 6px 0; }
.ci-menu.open { display: block; }
.ci-menu .dm-item { padding: 9px 16px; font-size: 13px; cursor: pointer; color: var(--text); display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.ci-menu .dm-item:hover { background: #f8fafc; }
.ci-menu .dm-item.danger { color: #dc2626; }
.ci-menu .dm-item.danger:hover { background: #fef2f2; }
.ci-menu .dm-item svg { width: 15px; height: 15px; flex-shrink: 0; }
.chat-item.muted { opacity: .65; }
.mute-tag { font-size: 11px; color: #d97706; background: #fff7ed; padding: 1px 6px; border-radius: 4px; margin-left: 4px; font-weight: 500; }

/* ========== 群成员管理弹窗 ========== */
.gm-mem-row { display: flex; align-items: center; gap: 10px; padding: 10px 4px; border-bottom: 1px solid var(--border-light); }
.gm-mem-row:last-child { border-bottom: 0; }
.gm-mem-row.gm-mem-pick { cursor: pointer; }
.gm-mem-row.gm-mem-pick:hover { background: #f8fafc; }
.gm-mem-row.gm-mem-pick.disabled { opacity: .5; cursor: not-allowed; }
.gm-mem-row .gm-mem-chk { width: 16px; height: 16px; flex-shrink: 0; }
.gm-mem-av { width: 36px; height: 36px; border-radius: 50%; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 600; flex-shrink: 0; overflow: hidden; }
.gm-mem-av img { width: 100%; height: 100%; object-fit: cover; }
.gm-mem-info { flex: 1; min-width: 0; }
.gm-mem-name { font-size: 14px; font-weight: 500; color: var(--text); display: flex; align-items: center; gap: 6px; }
.gm-mem-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.gm-mem-row .btn { flex-shrink: 0; }

/* ========== 客服专属登录码 / 地址 ========== */
.login-code-cell { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.code-chip { display: inline-block; padding: 2px 8px; background: #eef2ff; color: #4338ca; border-radius: 6px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; letter-spacing: .5px; }
.code-row { display: flex; align-items: center; gap: 8px; }
.code-row .code-chip { font-size: 14px; padding: 4px 10px; }
.form-tip { font-size: 12px; color: var(--muted); margin-top: 6px; line-height: 1.6; }
.code-url { color: var(--brand); word-break: break-all; }
.btn.sm.tiny { padding: 3px 8px; font-size: 12px; }
.action.setdefault { color: #d97706; }
.action.setdefault:hover { color: #b45309; }
.tag.warning { background: #fff7ed; color: #c2410c; }
.chat-ended-bar { padding: 8px 16px; background: #fff7ed; color: #b45309; font-size: 13px; text-align: center; border-bottom: 1px solid var(--border-light); }
.rating-result { padding: 14px 16px; background: #f0fdf4; border-top: 1px solid var(--border-light); font-size: 13px; }
.rating-result .rr-title { font-weight: 600; color: #15803d; margin-bottom: 6px; }
.rating-result .rr-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.rating-result .rr-tags span { background: #dcfce7; color: #166534; padding: 2px 8px; border-radius: 10px; font-size: 12px; }
.rating-result .rr-comment { color: var(--text-2); font-style: italic; }
.typing-row { padding: 0 16px; font-size: 12px; color: var(--muted); min-height: 18px; }

.chat-search-bar {
  display: flex; align-items: center; gap: 10px; padding: 8px 16px; border-bottom: 1px solid var(--border-light); background: #fff;
}
.chat-search-bar input { flex: 1; height: 34px; border: 1px solid var(--border); border-radius: 8px; padding: 0 10px; outline: none; }
.chat-search-bar input:focus { border-color: var(--brand); }
.chat-search-bar .count { font-size: 12px; color: var(--muted); }
.search-results {
  position: absolute; left: 294px; right: 294px; top: var(--topbar-h); background: #fff; border: 1px solid var(--border);
  border-radius: 0 0 8px 8px; box-shadow: var(--shadow); max-height: 240px; overflow-y: auto; z-index: 15; display: none;
}
.search-results.open { display: block; }
.sr-item { padding: 10px 14px; border-bottom: 1px solid var(--border-light); cursor: pointer; font-size: 13px; }
.sr-item:hover { background: #f8fafc; }
.sr-item .sr-role { display: inline-block; width: 36px; font-size: 11px; color: #fff; background: var(--brand); border-radius: 4px; text-align: center; margin-right: 8px; }
.sr-item .sr-role.visitor { background: var(--muted); }
.sr-empty { padding: 14px; text-align: center; color: var(--muted); font-size: 13px; }

.chat-input { padding: 10px 14px; border-top: 1px solid var(--border-light); background: #fff; }
.chat-input-tools { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.chat-input-tools .tool { width: 28px; height: 28px; border: none; background: transparent; border-radius: 6px; cursor: pointer; color: var(--muted); display: flex; align-items: center; justify-content: center; }
.chat-input-tools .tool:hover { background: #f1f5f9; color: var(--brand); }
.chat-input-tools .tool svg { width: 17px; height: 17px; }
.chat-input-area { display: flex; gap: 10px; align-items: flex-end; }
.chat-input-area textarea {
  flex: 1; width: 100%; box-sizing: border-box; min-height: 60px; max-height: 160px;
  border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; font-size: 14px;
  outline: none; resize: none; line-height: 1.5; transition: border-color .15s; caret-color: var(--text);
}
.chat-input-area textarea:focus { border-color: var(--brand); }
.chat-input-area .send {
  width: 80px; height: 40px; border: none; border-radius: 8px; background: var(--brand); color: #fff; font-weight: 600; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 4px;
}
.chat-input-area .send:hover { background: var(--brand-dark); }
.chat-input-area .send svg { width: 16px; height: 16px; }

.chat-head .dropdown-menu .dm-item:hover { background: #f8fafc; }

/* ============ 历史会话 / 服务报表 / 客服列表等 ============ */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.page-header h2 { font-size: 16px; font-weight: 600; }
.page-header .actions { display: flex; gap: 10px; align-items: center; }
.page-header .search-bar input { width: 220px; }

.invite-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.invite-card .ic-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.invite-card .ic-header h3 { font-size: 15px; font-weight: 600; }
.invite-card .ic-tag { background: var(--brand-light); color: var(--brand); padding: 2px 8px; border-radius: 4px; font-size: 12px; }
.invite-card .code-box { background: #eff6ff; border: 1px dashed #bfdbfe; border-radius: 8px; padding: 12px; text-align: center; margin-bottom: 12px; }
.invite-card .code-box .label { font-size: 12px; color: #3b82f6; margin-bottom: 4px; }
.invite-card .code-box .code { font-size: 20px; font-weight: 700; color: #2563eb; letter-spacing: 3px; }
.invite-card .code-box .tip { font-size: 12px; color: #64748b; margin-top: 4px; }
.invite-card .link-row { display: flex; align-items: center; gap: 10px; }
.invite-card .link-row input { flex: 1; height: 40px; border: 1px solid var(--border); border-radius: 8px; padding: 0 12px; font-size: 13px; }
.invite-card .link-row .btn { width: auto; margin: 0; padding: 0 18px; }
.invite-card .reset { color: var(--muted); font-size: 13px; cursor: pointer; margin-left: auto; display: inline-flex; align-items: center; gap: 4px; }
.invite-card .reset:hover { color: var(--brand); }
.invite-card .reset svg { width: 14px; height: 14px; }

/* 客服成员列表 */
.member-card { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.member-card .mc-stat { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px; flex: 1; margin-right: 14px; display: flex; align-items: center; justify-content: space-between; }
.member-card .mc-stat:last-child { margin-right: 0; }
.member-card .mc-stat .mc-label { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.member-card .mc-stat .mc-value { font-size: 22px; font-weight: 700; color: var(--text); }
.member-card .mc-stat .mc-value.purple { color: #8b5cf6; }
.member-card .mc-stat .mc-icon { width: 38px; height: 38px; border-radius: 8px; display: flex; align-items: center; justify-content: center; }

/* 配置中心 */
.config-banner { background: #eff6ff; border: 1px solid #dbeafe; border-radius: 10px; padding: 14px 16px; margin-bottom: 20px; display: flex; align-items: center; gap: 10px; }
.config-banner .cb-icon { color: var(--secondary); }
.config-banner .cb-title { font-size: 14px; font-weight: 600; color: #1e40af; margin-bottom: 2px; }
.config-banner .cb-title .tag { font-size: 11px; margin-left: 6px; }
.config-banner .cb-desc { font-size: 12px; color: #3b82f6; }
.config-banner .cb-link { display: flex; flex: 1; gap: 10px; margin: 0 16px; }
.config-banner .cb-link input { flex: 1; height: 38px; border: 1px solid #bfdbfe; border-radius: 8px; padding: 0 12px; font-size: 13px; }
.config-banner .cb-link .btn { width: auto; margin: 0; padding: 0 16px; height: 38px; font-size: 13px; }

.avatar-upload { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.avatar-upload .av { width: 64px; height: 64px; border-radius: 50%; background: #f1f5f9; display: flex; align-items: center; justify-content: center; color: #cbd5e1; }
.avatar-upload .av svg { width: 28px; height: 28px; }
.avatar-upload .av-actions { display: flex; gap: 8px; }

/* APP下载 */
.app-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.app-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 30px; text-align: center; box-shadow: var(--shadow-sm); }
.app-card .ac-icon { width: 64px; height: 64px; border-radius: 16px; background: var(--brand-light); color: var(--brand); display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; }
.app-card .ac-icon svg { width: 32px; height: 32px; }
.app-card h3 { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.app-card p { color: var(--muted); font-size: 13px; margin-bottom: 18px; }
.app-card .ac-btn { border: 1px solid var(--brand); color: var(--brand); background: #fff; padding: 8px 24px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.app-card .ac-btn:hover { background: var(--brand-light); }

/* 弹层/快捷键帮助 */
.yxw-pop {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .35); z-index: 100; display: flex; align-items: center; justify-content: center;
}
.yxw-pop.yxw-hidden { display: none; }
.yxw-pop-box { background: #fff; border-radius: 12px; box-shadow: var(--shadow); width: 420px; max-width: 92vw; padding: 20px; }
.yxw-pop-title { font-size: 15px; font-weight: 600; display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.yxw-pop-close { cursor: pointer; color: var(--muted); font-size: 20px; }
.yxw-pop-close:hover { color: var(--text); }
.sh-list { list-style: none; }
.sh-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; font-size: 13px; color: var(--text-2); border-bottom: 1px solid var(--border-light); }
.sh-list li:last-child { border-bottom: none; }
.sh-list kbd { display: inline-block; min-width: 24px; padding: 3px 8px; border: 1px solid var(--border); border-radius: 5px; background: #f8fafc; font-family: monospace; font-size: 12px; color: var(--text); }

.yxw-hidden { display: none !important; }

/* ============ 新增组件：开关/常用语/FAQ/模板/套餐 ============ */
.switch-row { display: flex; align-items: center; gap: 12px; }
.switch { position: relative; display: inline-block; width: 42px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; cursor: pointer; inset: 0; background: #cbd5e1; border-radius: 12px; transition: .25s; }
.switch .slider::before { content: ''; position: absolute; width: 18px; height: 18px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: .25s; }
.switch input:checked + .slider { background: var(--brand); }
.switch input:checked + .slider::before { transform: translateX(18px); }
.switch-label { font-size: 13px; color: var(--text-2); }

.row-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 8px; transition: box-shadow .15s; }
.row-item:hover { box-shadow: 0 0 0 2px var(--brand-light); }
.ri-idx { width: 24px; height: 24px; border-radius: 50%; background: var(--brand-light); color: var(--brand); font-size: 12px; font-weight: 600; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ri-text { flex: 1; font-size: 14px; color: var(--text); }
.ri-actions { display: flex; gap: 8px; flex-shrink: 0; }
.ri-actions .action { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; color: var(--muted); padding: 4px 8px; border-radius: 6px; cursor: pointer; background: none; border: 1px solid transparent; }
.ri-actions .action.edit:hover { color: var(--brand); border-color: var(--brand-light); background: var(--brand-light); }
.ri-actions .action.danger:hover { color: var(--danger); border-color: #fecaca; background: #fef2f2; }
.ri-actions .action svg { width: 13px; height: 13px; }
.phrase-list { max-height: 480px; overflow-y: auto; }

.faq-list {  }
.faq-item { border: 1px solid var(--border); border-radius: 10px; margin-bottom: 10px; overflow: hidden; }
.faq-q { padding: 14px 16px; cursor: pointer; font-size: 14px; font-weight: 500; color: var(--text); display: flex; align-items: center; gap: 10px; background: #fff; user-select: none; }
.faq-q span { display: inline-flex; width: 24px; height: 24px; border-radius: 6px; background: var(--brand-light); color: var(--brand); font-size: 12px; font-weight: 700; align-items: center; justify-content: center; flex-shrink: 0; }
.faq-a { padding: 0 16px; font-size: 13px; color: var(--text-2); line-height: 1.7; max-height: 0; overflow: hidden; transition: all .25s; }
.faq-item.open .faq-a { padding: 0 16px 14px; max-height: 200px; }

.pc-desc { font-size: 13px; color: var(--muted); margin-bottom: 18px; }
.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }
.form-row.cols-2 .form-group { flex: 1; }
select { width: 100%; height: 42px; border: 1px solid var(--border); border-radius: 8px; padding: 0 12px; font-size: 14px; color: var(--text); background: #fff; outline: none; }
select:focus { border-color: var(--brand); }
.checkbox-row { display: flex; gap: 20px; flex-wrap: wrap; }
.checkbox-row label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); cursor: pointer; white-space: nowrap; }

.avatar-section { display: flex; align-items: center; gap: 20px; margin-bottom: 22px; padding-bottom: 20px; border-bottom: 1px solid var(--border-light); }
.av-circle { width: 56px; height: 56px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 20px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.av-actions { display: flex; gap: 8px; }

.template-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.tpl-card { border: 2px solid var(--border); border-radius: 12px; overflow: hidden; cursor: pointer; transition: all .2s; background: #fff; }
.tpl-card:hover { border-color: var(--brand-light); box-shadow: 0 4px 12px rgba(0,0,0,.06); }
.tpl-card.active { border-color: var(--brand); box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.tpl-thumb { height: 96px; position: relative; display: flex; align-items: center; justify-content: center; }
.tpl-preview { display: flex; flex-direction: column; gap: 6px; width: 65%; padding: 8px; border-radius: 10px; }
.tpl-msg { font-size: 11px; padding: 5px 9px; border-radius: 8px; max-width: 75%; }
.tpl-msg.l { background: #e5e7eb; color: #374151; align-self: flex-start; border-bottom-left-radius: 3px; }
.tpl-msg.r { color: #fff; align-self: flex-end; border-bottom-right-radius: 3px; }
.tpl-badge { position: absolute; left: 8px; top: 8px; background: var(--brand); color: #fff; font-size: 11px; padding: 2px 8px; border-radius: 4px; }
.tpl-name { padding: 10px 12px 4px; font-size: 14px; font-weight: 600; color: var(--text); }
.tpl-sizes { display: flex; gap: 8px; padding: 0 12px; margin-bottom: 4px; }
.tpl-sizes label { font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.tpl-sizes input { width: 52px; padding: 3px 6px; border: 1px solid var(--border); border-radius: 6px; font-size: 12px; }
.tpl-color { display: flex; align-items: center; gap: 6px; padding: 0 12px 8px; font-size: 11px; color: var(--muted); }
.tpl-color input[type="color"] { width: 24px; height: 24px; border: 1px solid var(--border); border-radius: 6px; padding: 1px; cursor: pointer; }
.tpl-tag { display: inline-block; margin: 0 12px 10px; font-size: 11px; color: var(--brand); background: var(--brand-light); padding: 2px 8px; border-radius: 4px; }

.plan-card { border: 1px solid var(--brand); border-radius: 12px; padding: 24px; background: linear-gradient(135deg, #f0fdfa, #fff); }
.plan-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.plan-name { font-size: 20px; font-weight: 700; color: var(--brand); }
.plan-price { font-size: 28px; font-weight: 700; color: var(--text); }
.plan-meta { font-size: 13px; color: var(--muted); margin-bottom: 18px; }
.plan-features { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 20px; }
.pf-item { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); }
.pf-item svg { width: 16px; height: 16px; color: var(--ok); }
.pf-item.off { color: var(--muted); }
.pf-item.off svg { color: var(--muted); }

.pricing-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.price-card { border: 1px solid var(--border); border-radius: 12px; padding: 24px 20px; text-align: center; transition: box-shadow .2s; }
.price-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.08); }
.price-card.popular { border-color: var(--brand); position: relative; }
.p-badge { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: var(--brand); color: #fff; font-size: 12px; padding: 3px 14px; border-radius: 10px; font-weight: 600; }
.p-name { font-size: 15px; font-weight: 600; margin-bottom: 10px; color: var(--text); }
.p-amount { font-size: 28px; font-weight: 700; color: var(--brand); margin-bottom: 16px; }
.p-amount sub { font-size: 14px; font-weight: 400; color: var(--muted); }
.p-feats { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.p-feats span { font-size: 13px; color: var(--text-2); }
.p-feats span::before { content: '✓ '; color: var(--ok); font-weight: 600; }

.required { color: var(--danger); margin-right: 2px; }
.tab-content { padding-top: 18px; }

/* 客服编辑弹窗头像上传 */
.av-upload-row { display:flex; align-items:center; gap:10px; }
.av-circle-box { width:40px; height:40px; border-radius:50%; overflow:hidden; background:var(--brand); color:#fff; display:flex; align-items:center; justify-content:center; font-size:16px; flex-shrink:0; }

/* ===== 移动端适配（仅 ≤820px 生效，桌面端完全不受影响） ===== */
.m-hamburger, .m-back, .m-detail-btn, .nav-scrim { display: none; }
@media (max-width: 820px) {
  .console { position: relative; }
  /* 侧栏 -> 左侧抽屉 */
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 60;
    width: 80vw; max-width: 280px; transform: translateX(-100%);
    transition: transform .25s ease; box-shadow: 2px 0 16px rgba(0,0,0,.18);
    overflow-y: auto;
  }
  .console.nav-open .sidebar { transform: translateX(0); }
  .nav-scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 55; }
  .m-hamburger { display: inline-flex !important; align-items: center; justify-content: center; }
  .main-area { width: 100%; }
  .topbar { padding: 8px 10px; }
  .topbar-left { gap: 8px; }
  .topbar-left h1 { font-size: 16px; }
  .topbar-right .topbar-btn#backToStore, .topbar-right .icon-btn[title="通知"] { display: none; }
  .view { padding: 10px; }
  /* 三栏聊天 -> 单栏：列表/会话视图切换 */
  .chat-view { grid-template-columns: 1fr; height: calc(100vh - var(--topbar-h) - 20px); min-height: 0; }
  .chat-list { grid-column: 1; }
  .chat-panel { grid-column: 1; display: none; }
  .console.chat-open .chat-list { display: none; }
  .console.chat-open .chat-panel { display: flex; flex-direction: column; height: calc(100vh - var(--topbar-h) - 20px); }
  .m-back { display: inline-flex !important; align-items: center; margin-right: 4px; font-size: 13px; }
  .m-detail-btn { display: inline-flex !important; align-items: center; }
  .chat-body { flex: 1; min-height: 0; }
  .chat-input { position: sticky; bottom: 0; background: var(--card); }
  /* 右侧详情 -> 右侧滑出抽屉 */
  .chat-right {
    position: fixed; top: 0; right: 0; bottom: 0; z-index: 60; width: 84vw; max-width: 320px;
    transform: translateX(100%); transition: transform .25s ease; background: var(--card);
    box-shadow: -2px 0 16px rgba(0,0,0,.18); overflow-y: auto;
  }
  .console.right-open .chat-right { transform: translateX(0); }
  /* 首页卡片等栅格折叠 */
  .cards, .api-stat-row { grid-template-columns: repeat(2, 1fr); }
  .api-channel-grid { grid-template-columns: minmax(0, 1fr); }
  /* API 渠道卡片：约束宽度，避免 <pre> 长串把卡片撑到 1500px+ 撑爆整页 */
  .api-channel-card { max-width: 100%; min-width: 0; }
  .api-card-code { max-width: 100%; }
  .api-card-code pre { max-width: 100%; white-space: pre-wrap; word-break: break-all; }
  /* 搜索结果在窄屏改为全宽浮层，避免 294px 内边距溢出 */
  .search-results { position: fixed; left: 0; right: 0; top: var(--topbar-h); bottom: auto; max-height: 60vh; }
  .topbar-right .search-bar { display: none; }
  .sidebar { width: 78vw; max-width: 260px; }
  .chat-panel { height: calc(100vh - var(--topbar-h) - 12px); }
  .cards, .api-stat-row, .mc-stat { grid-template-columns: 1fr; }
  .member-card { flex-direction: column; align-items: stretch; }
  .member-card .mc-stat { margin-right: 0; margin-bottom: 12px; }
  .app-grid { grid-template-columns: 1fr; }
  .form-row { flex-direction: column; gap: 0; }
  .home-hero { flex-direction: column; align-items: stretch; }
  .invite-card .link-row { flex-direction: column; }
  .config-banner { flex-direction: column; align-items: stretch; gap: 8px; }
  .config-banner .cb-link { margin: 0; }

  /* ===== 手机端打磨（交互可用性，桌面零影响） ===== */
  /* 关键：主区去掉侧栏占位，否则内容被推偏 220px、右侧被裁 */
  .main-area { margin-left: 0; }
  /* 聊天页占满视图、去内边距，避免双滚动条 */
  .console.chat-open .view { padding: 0; }
  .console.chat-open .chat-view { height: 100%; min-height: 0; }
  .console.chat-open .chat-panel { height: 100%; }
  /* 顶部栏间距收敛 */
  .topbar-right { gap: 6px; }
  /* 登录页手机微调 */
  .login-page { padding: 16px; }
  .login-card { padding: 26px 20px 22px; }
  .login-title { font-size: 19px; margin-bottom: 16px; }
  .login-orb, .login-ring, .login-torus { display: none; }
  /* 聊天头收敛：隐藏次要按钮、负责客服行，避免挤爆 */
  .chat-head { flex-wrap: wrap; gap: 8px 10px; padding: 10px 12px; }
  .chat-head .ch-left { flex: 1 1 auto; min-width: 0; }
  .chat-head .ch-name { font-size: 15px; }
  .chat-head .ch-agent { display: none; }
  .chat-head .ch-actions { flex-shrink: 0; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
  #searchBtn, #exportDropdown, #helpBtn { display: none !important; }
  .chat-head .ch-actions .btn.sm { height: 30px; padding: 0 10px; font-size: 12px; }
  /* 会话列表头部精简，释放纵向空间 */
  .chat-status-bar { padding: 8px 10px; gap: 6px; }
  .chat-sub-tabs { display: none; }
  .chat-filter-tabs { padding: 8px 10px; }
  .chat-search { padding: 8px 10px; }
  .chat-count { padding: 4px 10px; font-size: 12px; }
  /* 会话项：隐藏 hover 操作菜单（手机无 hover，避免遮挡） */
  .chat-item .ci-actions { display: none; }
  .chat-item { padding: 10px 12px; }
  /* 消息气泡手机上更宽 */
  .msg.in .msg-bubble, .msg.out .msg-bubble { max-width: 82%; }
  /* 输入区：发送按钮不被挤压，工具栏可横滚 */
  .chat-input-tools { overflow-x: auto; padding-bottom: 2px; }
  .chat-input-area .send { flex-shrink: 0; width: 64px; }
  /* 转接/导出菜单：手机上居中弹层，避免溢出右侧 */
  .chat-head .dropdown-menu.open {
    position: fixed; left: 50%; top: 50%; right: auto; bottom: auto;
    transform: translate(-50%, -50%); z-index: 90;
    max-width: 90vw; max-height: 70vh; overflow: auto;
  }
  /* 触摸友好 */
  .m-hamburger { width: 38px; height: 38px; font-size: 20px; }
  .m-back { height: 32px; }
  /* 窄屏表格自适应：固定布局 + 换行，避免整页被表格横向撑爆 */
  .yx-table { table-layout: fixed; }
  .yx-table td, .yx-table th { word-break: break-word; white-space: normal; }
  .yx-table .actions { white-space: normal; flex-wrap: wrap; }
}


button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible,
select:focus-visible, .nav-item:focus-visible, .chat-item:focus-visible, .icon-btn:focus-visible {
  outline: none; box-shadow: var(--ring);
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ===== 平板断点（821~1100px） ===== */
@media (min-width: 821px) and (max-width: 1100px) {
  .chat-view { grid-template-columns: 240px 1fr; height: calc(100vh - var(--topbar-h) - 40px); }
  .chat-right { display: none; }
  .console.right-open .chat-right {
    display: flex; position: fixed; top: 0; right: 0; bottom: 0; z-index: 60;
    width: 320px; box-shadow: -2px 0 16px rgba(0,0,0,.18);
  }
  .m-detail-btn { display: inline-flex !important; align-items: center; }
  .cards, .api-stat-row { grid-template-columns: repeat(2, 1fr); }
  .pricing-grid { grid-template-columns: 1fr; }
  .api-channel-grid { grid-template-columns: repeat(2, 1fr); }
  .template-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ===== 补齐：原缺失的组件样式（重构时一并补全） ===== */
.msg-av-def { color: #fff; font-weight: 600; }
.chat-filter-tabs .ft {
  font-size: 13px; color: var(--muted); cursor: pointer; padding: 6px 4px; position: relative;
}
.chat-filter-tabs .ft.active { color: var(--brand); font-weight: 600; }
.chat-filter-tabs .ft.active::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--brand); border-radius: 2px; }
.cr-panel { padding: 10px; background: #fff; border: 1px solid var(--border); border-top: none; border-radius: 0 0 var(--radius) var(--radius); flex: 1; overflow-y: auto; }
.ci-act-edit { color: var(--brand); }
.ci-act-del { color: var(--danger); }
.ci-act-mute { color: var(--warn); }
.sr-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.loading { text-align: center; padding: 40px 20px; color: var(--muted); font-size: 14px; }
.loading::before { content: ''; display: inline-block; width: 18px; height: 18px; margin-right: 8px; vertical-align: -3px; border: 2px solid var(--border); border-top-color: var(--brand); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.ch-right { display: flex; align-items: center; gap: 8px; }
.hl { animation: hlFlash 1.5s ease; border-radius: 8px; }
@keyframes hlFlash { 0% { background: rgba(14,165,165,.28); } 100% { background: transparent; } }
.delTplBtn { color: var(--danger); border-color: #fecaca; }
.gm-mem-tab.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.gm-mem-remove { width: 28px; height: 28px; border-radius: 6px; border: 1px solid var(--border); background: #fff; color: var(--danger); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.gm-mem-remove:hover { background: #fef2f2; }
.c1, .c2, .c3, .c4, .c5, .c6 { display: block; width: 100%; height: 100%; }
.tpl-c, .tpl-h, .tpl-row, .tpl-w { font-size: 13px; color: var(--text-2); }
.tpl-content-section { border: 1px solid var(--border-light); }
.ft { cursor: pointer; }
.gm-mem-mode { display: flex; gap: 8px; margin-bottom: 12px; }
