:root {
  --bg: #f4f6fb;
  --bg-2: #eef1f8;
  --panel: #ffffff;
  --panel-2: #fafbfe;
  --line: #e7eaf2;
  --line-2: #dfe3ee;
  --text: #1c2233;
  --text-2: #4a5468;
  --muted: #8b94a8;
  --brand: #2f6bff;
  --brand-2: #1b4fd8;
  --brand-soft: #eaf0ff;
  --green: #12b886;
  --green-soft: #e6f8f2;
  --amber: #f08c00;
  --amber-soft: #fff5e6;
  --red: #e5484d;
  --red-soft: #fdeced;
  --purple: #7048e8;
  --shadow-sm: 0 1px 2px rgba(24, 39, 75, 0.06), 0 1px 3px rgba(24, 39, 75, 0.04);
  --shadow: 0 4px 16px rgba(24, 39, 75, 0.08);
  --shadow-lg: 0 18px 48px rgba(24, 39, 75, 0.14);
  --radius: 12px;
  --radius-lg: 18px;
}

* { box-sizing: border-box; }

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

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

/* ================= 登录 ================= */
.login-wrap {
  min-height: 100%;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
}
.login-brand {
  position: relative;
  padding: 64px 56px;
  color: #fff;
  background: linear-gradient(150deg, #1b3bb8 0%, #2f6bff 45%, #24b2c9 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
}
.login-brand::after {
  content: "";
  position: absolute;
  width: 620px; height: 620px;
  right: -220px; bottom: -280px;
  background: radial-gradient(circle, rgba(255,255,255,.22), transparent 62%);
}
.login-brand h1 { font-size: 34px; line-height: 1.34; margin: 22px 0 14px; font-weight: 700; letter-spacing: .5px; }
.login-brand .lead { font-size: 15px; line-height: 1.9; opacity: .92; margin: 0 0 30px; }
.brand-points { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; max-width: 480px; }
.brand-points li {
  position: relative; padding-left: 26px; font-size: 13.5px; line-height: 1.75; opacity: .95;
}
.brand-points li::before {
  content: ""; position: absolute; left: 2px; top: 7px;
  width: 12px; height: 7px; border-left: 2px solid #fff; border-bottom: 2px solid #fff;
  transform: rotate(-45deg); opacity: .9;
}
.brand-points b { font-weight: 600; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px; color: var(--brand);
  display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.brand-mark svg { width: 100%; height: 100%; display: block; }
.brand-mark.big { width: 54px; height: 54px; color: rgba(255,255,255,.22); }

.login-panel { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.login-card {
  width: 100%; max-width: 400px; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 34px 32px 28px; box-shadow: var(--shadow);
}
.login-card h2 { margin: 0 0 6px; font-size: 21px; }
.login-card .sub { margin: 0 0 22px; color: var(--muted); font-size: 13px; }
.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-size: 12.5px; color: var(--text-2); margin-bottom: 7px; font-weight: 500; }
.field input {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line-2); border-radius: 10px;
  background: var(--panel-2); outline: none; transition: border-color .15s, box-shadow .15s;
}
.field input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); background: #fff; }
.form-error {
  background: var(--red-soft); color: var(--red); border-radius: 9px;
  padding: 9px 12px; font-size: 13px; margin-bottom: 14px;
}
.login-hint { margin-top: 18px; font-size: 12.5px; color: var(--muted); line-height: 1.8; }
.login-hint code { background: var(--bg-2); padding: 1px 6px; border-radius: 5px; color: var(--text-2); }

/* ================= 按钮 / 表单 ================= */
.btn {
  border: 1px solid var(--line-2); background: #fff; color: var(--text);
  padding: 9px 16px; border-radius: 10px; font-weight: 500;
  transition: all .15s; display: inline-flex; align-items: center; gap: 7px; justify-content: center;
}
.btn:hover { border-color: #c8cfe0; background: var(--panel-2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 2px 8px rgba(47,107,255,.28); }
.btn.primary:hover { background: var(--brand-2); border-color: var(--brand-2); }
.btn.danger { color: var(--red); border-color: #f2c9cb; }
.btn.danger:hover { background: var(--red-soft); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--bg-2); }
.btn.block { width: 100%; padding: 11px; }
.btn.sm { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.icon-btn {
  border: none; background: transparent; width: 30px; height: 30px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center; color: var(--muted);
}
.icon-btn:hover { background: var(--bg-2); color: var(--text); }
.icon-btn svg { width: 17px; height: 17px; }

/* ================= 结构 ================= */
.app { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  height: 58px; flex: none; background: var(--panel); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 18px; padding: 0 18px; z-index: 20;
}
.tb-left { display: flex; align-items: center; gap: 11px; flex: none; }
.tb-title { display: flex; flex-direction: column; line-height: 1.25; }
.tb-title b { font-size: 14.5px; }
.tb-title span { font-size: 11.5px; color: var(--muted); }
.tabs { display: flex; gap: 4px; flex: 1; justify-content: center; }
.tab {
  border: none; background: transparent; padding: 8px 15px; border-radius: 9px;
  color: var(--text-2); font-weight: 500;
}
.tab:hover { background: var(--bg-2); }
.tab.active { background: var(--brand-soft); color: var(--brand-2); }
.tb-right { display: flex; align-items: center; gap: 12px; flex: none; }
.bot-picker {
  display: flex; align-items: center; gap: 7px; background: var(--panel-2);
  border: 1px solid var(--line-2); border-radius: 10px; padding: 4px 6px 4px 10px;
}
.bot-picker select { border: none; background: transparent; outline: none; max-width: 190px; padding: 5px 2px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.online { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.dot.connecting { background: var(--amber); box-shadow: 0 0 0 3px var(--amber-soft); animation: pulse 1.4s infinite; }
.dot.error { background: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
@keyframes pulse { 50% { opacity: .35; } }
.user-chip {
  position: relative; display: flex; align-items: center; gap: 8px;
  padding: 5px 10px 5px 5px; border-radius: 999px; cursor: pointer; user-select: none;
}
.user-chip:hover { background: var(--bg-2); }
.avatar {
  width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(135deg, var(--brand), var(--purple));
  color: #fff; display: inline-flex; align-items: center; justify-content: center;
  font-size: 12.5px; font-weight: 600; flex: none;
}
.uname { font-size: 13px; }
.user-menu {
  position: absolute; right: 0; top: 44px; background: #fff; border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; min-width: 150px; z-index: 30;
}
.user-menu button {
  display: block; width: 100%; text-align: left; border: none; background: transparent;
  padding: 9px 12px; border-radius: 8px; color: var(--text-2);
}
.user-menu button:hover { background: var(--bg-2); color: var(--text); }

.main { flex: 1; min-height: 0; position: relative; }
.view { height: 100%; }

#view-console {
  display: grid;
  grid-template-columns: 306px minmax(0, 1fr) 284px;
  gap: 0;
}

.pane-head {
  height: 52px; flex: none; display: flex; align-items: center; justify-content: space-between;
  padding: 0 14px; border-bottom: 1px solid var(--line);
}
.pane-title { display: flex; align-items: center; gap: 8px; }
.pane-title b { font-size: 14px; }
.badge-soft {
  background: var(--bg-2); color: var(--text-2); border-radius: 999px;
  padding: 1px 8px; font-size: 11.5px; font-weight: 600;
}

/* 会话列表 */
.conv-pane { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.pane-search { padding: 10px 12px 6px; }
.pane-search input {
  width: 100%; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line-2);
  background: var(--panel-2); outline: none;
}
.pane-search input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); background: #fff; }
.chips { display: flex; gap: 6px; padding: 6px 12px 10px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: #fff; color: var(--text-2);
  padding: 4px 10px; border-radius: 999px; font-size: 12px;
}
.chip:hover { border-color: #c8cfe0; }
.chip.active { background: var(--brand-soft); border-color: #c3d4ff; color: var(--brand-2); font-weight: 500; }
.conv-list { flex: 1; overflow-y: auto; padding: 4px 8px 12px; }
.conv-item {
  display: grid; grid-template-columns: 40px 1fr auto; gap: 10px; padding: 11px 10px;
  border-radius: 12px; cursor: pointer; align-items: start; transition: background .12s;
}
.conv-item:hover { background: var(--bg-2); }
.conv-item.active { background: var(--brand-soft); }
.conv-avatar {
  width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  font-weight: 600; color: #fff; font-size: 14px; flex: none;
}
.conv-main { min-width: 0; }
.conv-title { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13.5px; }
.conv-title .tag {
  font-size: 10.5px; font-weight: 500; padding: 1px 6px; border-radius: 5px;
  background: var(--bg-2); color: var(--muted);
}
.conv-title .tag.group { background: #eef4e9; color: #5b8a3c; }
.conv-title .tag.c2c { background: #eef1fd; color: #4b63c8; }
.conv-preview {
  color: var(--muted); font-size: 12.5px; margin-top: 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.conv-meta { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.conv-time { font-size: 11px; color: var(--muted); white-space: nowrap; }
.unread {
  min-width: 19px; height: 19px; padding: 0 5px; border-radius: 999px; background: var(--red); color: #fff;
  font-size: 11px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center;
}
.list-empty { padding: 46px 20px; text-align: center; color: var(--muted); font-size: 13px; line-height: 2; }

/* 聊天区 */
.chat-pane { background: var(--bg); display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.chat-head {
  height: 62px; flex: none; background: var(--panel); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; padding: 0 16px; gap: 12px;
}
.ch-info { display: flex; align-items: center; gap: 11px; min-width: 0; }
.ch-info .nm { font-weight: 600; }
.ch-info .sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.ch-actions { display: flex; gap: 8px; align-items: center; flex: none; }
.chat-body { flex: 1; overflow-y: auto; padding: 18px 20px 8px; min-height: 0; }
.day-sep { text-align: center; margin: 14px 0; }
.day-sep span { background: rgba(28,34,51,.06); color: var(--muted); font-size: 11.5px; padding: 3px 10px; border-radius: 999px; }
.msg-row { display: flex; gap: 10px; margin-bottom: 14px; align-items: flex-start; }
.msg-row.out { flex-direction: row-reverse; }
.msg-avatar {
  width: 34px; height: 34px; border-radius: 10px; flex: none; display: flex; align-items: center;
  justify-content: center; color: #fff; font-weight: 600; font-size: 13px;
}
.msg-avatar.user { background: linear-gradient(135deg, #7a8ba8, #5b6b85); }
.msg-avatar.bot { background: linear-gradient(135deg, var(--brand), #6f5cff); }
.msg-col { max-width: min(74%, 620px); min-width: 0; }
.msg-row.out .msg-col { align-items: flex-end; display: flex; flex-direction: column; }
.msg-head { font-size: 11.5px; color: var(--muted); margin-bottom: 5px; display: flex; gap: 8px; align-items: center; }
.bubble {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 10px 14px; line-height: 1.72; white-space: pre-wrap; word-break: break-word;
  box-shadow: var(--shadow-sm);
}
.msg-row.out .bubble { background: #e8f0ff; border-color: #d3e0ff; }
.msg-row.out.passive .bubble { background: #e6f8f2; border-color: #c9ece0; }
.msg-row.failed .bubble { background: var(--red-soft); border-color: #f5ccce; color: #a3282c; }
.bubble img { max-width: 260px; border-radius: 10px; display: block; }
.bubble img + img { margin-top: 6px; }
.bubble .with-media { margin-top: 7px; }
.bubble.markdown { font-family: inherit; }
.bubble .md-code { background: rgba(28,34,51,.06); border-radius: 6px; padding: 1px 5px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; }
.sys-line { text-align: center; margin: 12px 0; }
.sys-line span { font-size: 12px; color: var(--muted); background: rgba(28,34,51,.05); padding: 4px 12px; border-radius: 999px; display: inline-block; max-width: 92%; line-height: 1.7; }
.msg-flags { display: flex; gap: 7px; margin-top: 5px; font-size: 11px; color: var(--muted); align-items: center; }
.flag { border-radius: 5px; padding: 1px 6px; background: var(--bg-2); }
.flag.passive { background: var(--green-soft); color: #0b8a68; }
.flag.proactive { background: var(--amber-soft); color: #a86300; }
.flag.error { background: var(--red-soft); color: var(--red); }
.flag.link {
  border: 1px solid var(--line-2); background: #fff; color: var(--text-2); cursor: pointer;
  font-family: inherit;
}
.flag.link:hover { border-color: var(--red); color: var(--red); background: var(--red-soft); }
.msg-row.recalled .bubble { background: var(--bg-2); border-style: dashed; color: var(--muted); font-style: italic; }

.empty-state {
  height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; color: var(--muted);
}
.empty-state svg { width: 74px; height: 74px; color: #cfd6e6; }
.empty-state b { color: var(--text-2); font-size: 15px; }
.empty-state span { font-size: 12.5px; }

/* 输入区 */
.composer { flex: none; background: var(--panel); border-top: 1px solid var(--line); padding: 10px 14px 12px; }
.composer-tools { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.tool-btn {
  border: none; background: transparent; color: var(--text-2); padding: 6px 9px; border-radius: 8px;
  display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px;
}
.tool-btn:hover { background: var(--bg-2); color: var(--text); }
.tool-btn.on { background: var(--brand-soft); color: var(--brand-2); }
.tool-btn svg { width: 16px; height: 16px; }
.md-icon { font-weight: 700; font-size: 12px; }
.spacer { flex: 1; }
.passive-state { font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.passive-state .ok { color: var(--green); font-weight: 600; }
.passive-state .warn { color: var(--amber); font-weight: 600; }
.passive-state .bad { color: var(--red); font-weight: 600; }
.image-preview { display: flex; align-items: center; gap: 10px; padding: 6px 0 10px; }
.image-preview img { height: 62px; border-radius: 9px; border: 1px solid var(--line); }
.composer-input { display: flex; gap: 10px; align-items: flex-end; }
.composer-input textarea {
  flex: 1; resize: none; padding: 11px 13px; border: 1px solid var(--line-2); border-radius: 12px;
  background: var(--panel-2); outline: none; line-height: 1.65; max-height: 180px; min-height: 68px;
}
.composer-input textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); background: #fff; }
.composer-actions { display: flex; flex-direction: column; gap: 8px; align-items: stretch; min-width: 168px; }
.send-mode select {
  width: 100%; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line-2);
  background: var(--panel-2); outline: none;
}
.quick-panel {
  border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2);
  margin-bottom: 10px; padding: 8px; max-height: 190px; overflow-y: auto;
}
.quick-item { padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 13px; color: var(--text-2); }
.quick-item:hover { background: #fff; color: var(--text); box-shadow: var(--shadow-sm); }

/* 客户档案 */
.profile-pane {
  background: var(--panel); border-left: 1px solid var(--line);
  overflow-y: auto; padding: 16px 16px 24px;
}
.profile-head { text-align: center; padding-bottom: 14px; border-bottom: 1px dashed var(--line); }
.profile-head .conv-avatar { margin: 0 auto 10px; width: 54px; height: 54px; border-radius: 16px; font-size: 19px; }
.profile-head b { display: block; font-size: 15px; }
.profile-head span { color: var(--muted); font-size: 12px; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; font-size: 12.5px; border-bottom: 1px solid var(--bg-2); }
.kv .k { color: var(--muted); flex: none; }
.kv .v { text-align: right; word-break: break-all; color: var(--text-2); }
.profile-section { margin-top: 16px; }
.profile-section h4 { margin: 0 0 8px; font-size: 12.5px; color: var(--muted); font-weight: 600; letter-spacing: .4px; }
.profile-section input, .profile-section textarea {
  width: 100%; padding: 8px 10px; border-radius: 9px; border: 1px solid var(--line-2);
  background: var(--panel-2); outline: none; font-size: 12.5px; resize: vertical;
}
.profile-section input:focus, .profile-section textarea:focus { border-color: var(--brand); background: #fff; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.tag-pill { background: var(--brand-soft); color: var(--brand-2); border-radius: 999px; padding: 3px 9px; font-size: 11.5px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; font-size: 12.5px; }
.switch { position: relative; width: 38px; height: 21px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; position: absolute; z-index: 2; }
.switch i {
  position: absolute; inset: 0; background: #d9deeb; border-radius: 999px; transition: background .18s;
}
.switch i::after {
  content: ""; position: absolute; width: 17px; height: 17px; border-radius: 50%; background: #fff;
  top: 2px; left: 2px; transition: transform .18s; box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.switch input:checked + i { background: var(--brand); }
.switch input:checked + i::after { transform: translateX(17px); }

/* 通用视图容器 */
.page { height: 100%; overflow-y: auto; padding: 22px 26px 40px; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; gap: 14px; flex-wrap: wrap; }
.page-head h2 { margin: 0; font-size: 19px; }
.page-head .desc { color: var(--muted); font-size: 12.5px; margin-top: 5px; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 16px; }
.grid-cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.stat-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin-bottom: 20px; }
.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow-sm);
}
.stat .label { color: var(--muted); font-size: 12.5px; }
.stat .value { font-size: 26px; font-weight: 700; margin-top: 6px; letter-spacing: -.5px; }
.stat .value small { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 3px; }
.stat .foot { color: var(--muted); font-size: 11.5px; margin-top: 6px; }

.bot-card { display: flex; flex-direction: column; gap: 12px; }
.bot-card .bc-head { display: flex; align-items: center; gap: 11px; }
.bot-card .bc-head .avatar { width: 38px; height: 38px; border-radius: 11px; font-size: 15px; }
.bot-card .bc-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bot-card .bc-meta b { font-size: 14.5px; }
.bot-card .bc-meta span { color: var(--muted); font-size: 12px; }
.status-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600;
}
.status-pill.online { background: var(--green-soft); color: #0b8a68; }
.status-pill.connecting { background: var(--amber-soft); color: #a86300; }
.status-pill.error { background: var(--red-soft); color: var(--red); }
.status-pill.offline { background: var(--bg-2); color: var(--muted); }
.status-pill.disabled { background: var(--bg-2); color: var(--muted); }
.bc-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); }
.table th { color: var(--muted); font-weight: 600; font-size: 12px; background: var(--panel-2); }
.table tr:hover td { background: var(--panel-2); }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; }

.bar-chart { display: flex; align-items: flex-end; gap: 12px; height: 190px; padding: 10px 4px 0; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bar-stack { display: flex; align-items: flex-end; gap: 4px; height: 100%; width: 100%; justify-content: center; }
.bar { width: 40%; max-width: 22px; border-radius: 5px 5px 0 0; min-height: 3px; transition: height .3s; }
.bar.in { background: var(--brand); }
.bar.out { background: #9ec2ff; }
.bar-label { font-size: 11px; color: var(--muted); }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--text-2); margin-top: 10px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 5px; }

.log-list { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; }
.log-row { display: grid; grid-template-columns: 150px 58px 1fr; gap: 10px; padding: 6px 8px; border-radius: 7px; }
.log-row:nth-child(odd) { background: var(--panel-2); }
.log-row .lv { font-weight: 700; }
.lv.info { color: var(--muted); }
.lv.success { color: var(--green); }
.lv.warn { color: var(--amber); }
.lv.error { color: var(--red); }

.qr-row { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; background: var(--panel-2); }
.qr-row span { flex: 1; font-size: 13px; }

.banner {
  border-radius: 11px; padding: 11px 14px; font-size: 13px; margin-bottom: 16px;
  display: flex; gap: 10px; align-items: flex-start; line-height: 1.7;
}
.banner.warn { background: var(--amber-soft); color: #8a5200; }
.banner.info { background: var(--brand-soft); color: #1c3fa8; }
.banner.err { background: var(--red-soft); color: #a3282c; }

.toast-wrap { position: fixed; top: 16px; right: 16px; z-index: 900; display: flex; flex-direction: column; gap: 9px; }
.toast {
  background: #232a3d; color: #fff; padding: 10px 15px; border-radius: 10px; font-size: 13px;
  box-shadow: var(--shadow-lg); max-width: 340px; animation: slidein .2s ease; line-height: 1.6;
}
.toast.ok { background: #0d8a68; }
.toast.err { background: #c93034; }
@keyframes slidein { from { opacity: 0; transform: translateX(14px); } }

.modal-wrap {
  position: fixed; inset: 0; background: rgba(20, 26, 40, .45); z-index: 800;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  backdrop-filter: blur(2px);
}
.modal {
  background: #fff; border-radius: var(--radius-lg); width: 100%; max-width: 560px;
  max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg); padding: 22px 24px 20px;
}
.modal h3 { margin: 0 0 6px; font-size: 17px; }
.modal .mdesc { color: var(--muted); font-size: 12.5px; margin-bottom: 18px; line-height: 1.7; }
.modal .modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.form-grid { display: grid; gap: 14px; }
.form-grid.two { grid-template-columns: 1fr 1fr; }
.checkline { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.checkline input { width: 16px; height: 16px; }
.modal .hint { color: var(--muted); font-size: 12px; margin-top: 6px; line-height: 1.6; }
.modal textarea { width: 100%; font: inherit; font-size: 13px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--text); resize: vertical; }

.drawer-mask { position: fixed; inset: 0; background: rgba(20,26,40,.35); z-index: 40; }

/* 滚动条 */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #d3d9e6; border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: #bcc4d6; }
::-webkit-scrollbar-track { background: transparent; }

/* ================= 响应式 ================= */
@media (max-width: 1180px) {
  #view-console { grid-template-columns: 280px minmax(0, 1fr); }
  .profile-pane { display: none; }
  .profile-pane.mobile-show { display: block; position: fixed; right: 0; top: 58px; bottom: 0; width: 300px; z-index: 50; box-shadow: var(--shadow-lg); }
}
@media (max-width: 860px) {
  .login-wrap { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .tabs { justify-content: flex-start; overflow-x: auto; }
  .tab { white-space: nowrap; padding: 8px 11px; font-size: 13px; }
  .tb-title, .bot-picker select { display: none; }
  .bot-picker { padding: 4px 8px; }
  #view-console { grid-template-columns: 1fr; position: relative; }
  .conv-pane {
    position: absolute; inset: 0; z-index: 10; transition: transform .22s ease;
  }
  .conv-pane.hide-mobile { transform: translateX(-102%); }
  .chat-pane { position: absolute; inset: 0; z-index: 5; }
  .composer-actions { min-width: 0; }
  .composer-actions .btn { padding: 9px 14px; }
  .chat-body { padding: 14px 12px 6px; }
  .msg-col { max-width: 84%; }
  .back-btn { display: inline-flex !important; }
  .page { padding: 16px 14px 40px; }
}
.back-btn { display: none; border: none; background: transparent; color: var(--text-2); align-items: center; gap: 4px; padding: 6px 8px; border-radius: 8px; }
.back-btn:hover { background: var(--bg-2); }

/* ================= 表情 / AI 面板 ================= */
.emoji-panel {
  border: 1px solid var(--line); border-radius: 12px; background: var(--panel);
  margin-bottom: 10px; padding: 10px 12px; max-height: 240px; overflow-y: auto;
  box-shadow: var(--shadow-sm);
}
.emoji-tabs { margin: 4px 0 8px; font-size: 12px; color: var(--muted); }
.face-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; margin-bottom: 10px; }
.face-cell {
  border: 1px solid var(--line-2); background: var(--panel-2); border-radius: 8px;
  padding: 6px 4px; font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.face-cell:hover { border-color: var(--brand); color: var(--brand-2); background: var(--brand-soft); }
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(34px, 1fr)); gap: 4px; }
.emoji-cell { border: none; background: transparent; font-size: 19px; line-height: 1; padding: 5px; border-radius: 7px; }
.emoji-cell:hover { background: var(--bg-2); }
.face-chip {
  display: inline-block; background: var(--brand-soft); color: var(--brand-2);
  border-radius: 5px; padding: 0 5px; font-size: 12px; margin: 0 1px;
}
.ai-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ai-hint { font-size: 12px; color: var(--muted); margin-top: 9px; line-height: 1.7; }
.ai-input {
  width: 100%; padding: 8px 10px; border-radius: 9px; border: 1px solid var(--line-2);
  background: var(--panel-2); outline: none; font-size: 13px; margin-bottom: 8px;
}
.cap-list { display: flex; flex-wrap: wrap; gap: 10px 18px; padding: 4px 0; }
.quick-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.pre-block {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px; font-size: 12.5px; line-height: 1.9; white-space: pre-wrap; margin: 0;
  font-family: inherit; color: var(--text-2);
}

/* ================= 顶部状态 / 团队切换 ================= */
.scope-select {
  border: 1px solid var(--line-2); background: var(--panel-2); border-radius: 10px;
  padding: 7px 9px; outline: none; max-width: 200px;
}
.agent-state { display: flex; align-items: center; }
.status-toggle {
  border: 1px solid var(--line-2); background: var(--panel-2); border-radius: 999px;
  padding: 6px 12px; font-size: 12.5px; color: var(--text-2);
}
.status-toggle.online { background: var(--green-soft); color: #0b8a68; border-color: #bfe8da; font-weight: 500; }
.status-toggle.busy { background: var(--amber-soft); color: #a86300; border-color: #f5dcb0; font-weight: 500; }
.status-toggle.offline { background: var(--bg-2); color: var(--muted); }

.pill { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 500; }
.pill.assigned { background: var(--brand-soft); color: var(--brand-2); }
.pill.queue { background: var(--amber-soft); color: #a86300; }
.pill.ai { background: var(--green-soft); color: #0b8a68; }
.tag.queue { background: var(--amber-soft); color: #a86300; }
.tag.assigned { background: var(--brand-soft); color: var(--brand-2); }
.flag.ai { background: var(--green-soft); color: #0b8a68; }

/* ================= 团队卡片 / 看板 ================= */
.stat-mini { display: flex; gap: 14px; flex-wrap: wrap; }
.stat-mini > div { display: flex; flex-direction: column; }
.stat-mini b { font-size: 17px; }
.stat-mini span { font-size: 11.5px; color: var(--muted); }
.load-bar { width: 90px; height: 6px; background: var(--bg-2); border-radius: 3px; overflow: hidden; }
.load-bar i { display: block; height: 100%; background: var(--brand); border-radius: 3px; }
.dash-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.dash-head h4 { margin: 0 0 4px; font-size: 14px; }
.dash-head .desc { color: var(--muted); font-size: 12px; }
.dash-actions { display: flex; gap: 8px; flex-shrink: 0; }
.flat-input {
  padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line-2);
  background: var(--panel-2); outline: none;
}
@media (max-width: 860px) {
  .scope-select { max-width: 120px; font-size: 12px; }
  .agent-state { display: none; }
  .dash-head { flex-direction: column; }
}

