/* ==========================================================
   私信客服运营工作台 · 样式
   浅色主题 · 中性灰 + 单一强调色
   ========================================================== */

:root {
  --bg: #F5F6F8;
  --surface: #FFFFFF;
  --surface-2: #FAFBFC;
  --surface-3: #F2F4F7;
  --border: #E4E7EC;
  --border-strong: #D0D5DD;
  --text: #101828;
  --text-2: #667085;
  --text-3: #98A2B3;
  --accent: #2C6BED;
  --accent-hover: #1F55C4;
  --accent-soft: #EBF1FE;
  --accent-line: #B8CDFB;
  --success: #039855;
  --success-soft: #E7F6EE;
  --warn: #DC6803;
  --warn-soft: #FEF3E2;
  --danger: #D92D20;
  --danger-soft: #FEE9E7;
  --purple: #7A5AF8;
  --purple-soft: #F1EDFE;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-md: 0 4px 12px rgba(16, 24, 40, .08);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .14);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

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

.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea { font-family: inherit; }
a { color: inherit; text-decoration: none; }
svg { flex-shrink: 0; }

/* ==================== 登录 ==================== */
.login-screen {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 24px;
  background:
    radial-gradient(circle at 12% 18%, #E9F0FE 0%, transparent 42%),
    radial-gradient(circle at 88% 82%, #E8F6EF 0%, transparent 42%),
    var(--bg);
}

.login-card {
  width: 100%; max-width: 384px;
  padding: 42px 36px 34px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
}

.login-logo { margin-bottom: 22px; }
.login-card h1 { font-size: 20px; font-weight: 600; letter-spacing: -.3px; }
.login-sub { margin: 7px 0 30px; color: var(--text-2); font-size: 13px; }

.login-card label {
  display: block; margin-bottom: 8px;
  font-size: 13px; font-weight: 500; color: var(--text-2);
}

.login-card input[type="password"] {
  width: 100%; height: 44px; padding: 0 14px;
  font-size: 14px; color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.login-card input[type="password"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.login-card button[type="submit"] {
  width: 100%; height: 44px; margin-top: 20px;
  font-size: 14px; font-weight: 500; color: #fff;
  background: var(--accent); border-radius: var(--radius-sm);
  transition: background .15s;
}
.login-card button[type="submit"]:hover { background: var(--accent-hover); }
.login-card button[type="submit"]:disabled { opacity: .6; cursor: default; }

.login-error { margin-top: 12px; min-height: 18px; font-size: 13px; color: var(--danger); }

/* ==================== 布局 ==================== */
.app { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  display: flex; flex-direction: column;
  width: 200px; flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
}

.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 17px 16px;
  border-bottom: 1px solid var(--border);
}

.brand-mark {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; flex-shrink: 0;
  font-size: 14px; font-weight: 600; color: #fff;
  background: var(--accent); border-radius: 8px;
}

.brand-text { min-width: 0; }
.brand-name { font-size: 13.5px; font-weight: 600; }
.brand-sub {
  font-size: 11.5px; color: var(--text-3); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.nav { flex: 1; padding: 10px 8px; overflow-y: auto; }

.nav-item {
  display: flex; align-items: center; gap: 9px;
  width: 100%; padding: 8px 10px; margin-bottom: 2px;
  font-size: 13.5px; color: var(--text-2);
  border-radius: var(--radius-sm);
  transition: background .12s, color .12s;
  text-align: left;
}
.nav-item:hover { background: var(--surface-3); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 500; }

.nav-icon { width: 15px; height: 15px; opacity: .8; }
.nav-item.active .nav-icon { opacity: 1; }

.nav-divider { height: 1px; margin: 8px 10px; background: var(--border); }

.badge {
  margin-left: auto; min-width: 18px; padding: 1px 5px;
  font-size: 11px; font-weight: 500; color: #fff;
  background: var(--danger); border-radius: 9px; text-align: center;
}
.badge.warn { background: var(--warn); }
.badge.ghost { background: var(--surface-3); color: var(--text-2); }

/* 账号切换 */
.acc-switch select {
  height: 26px;
  padding: 0 22px 0 9px;
  font-size: 12px;
  color: var(--text);
  background: var(--surface)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2398A2B3' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E")
    no-repeat right 7px center;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  appearance: none;
  cursor: pointer;
  max-width: 170px;
  outline: none;
}
.acc-switch select:focus { border-color: var(--accent); }

/* 巨量引擎同步面板 */
.oe-panel {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 14px 18px; margin-bottom: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--text-3);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.oe-panel.ok { border-left-color: var(--success); }
.oe-panel.warn { border-left-color: var(--warn); }
.oe-panel.bad { border-left-color: var(--danger); }

.oe-left { min-width: 0; }
.oe-title {
  display: flex; align-items: center; gap: 7px;
  font-size: 13.5px; font-weight: 600;
}
.oe-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--text-3); flex-shrink: 0;
}
.oe-panel.ok .oe-dot { background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.oe-panel.warn .oe-dot { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.oe-panel.bad .oe-dot { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }

.oe-sub {
  margin-top: 4px; font-size: 12px; color: var(--text-3);
  line-height: 1.6; word-break: break-all;
}
.oe-right { display: flex; gap: 8px; flex-shrink: 0; }

/* 原始样本查看 */
.sample-box {
  margin-bottom: 12px; padding: 11px 13px;
  background: var(--surface-3); border-radius: var(--radius-sm);
}
.sample-head {
  display: flex; align-items: center; gap: 8px;
  font-size: 11.5px; color: var(--text-3); margin-bottom: 7px;
}
.sample-json {
  max-height: 220px; overflow: auto; padding: 10px;
  font-family: var(--mono); font-size: 11px; line-height: 1.65;
  color: #D6D9E0; background: #16181D; border-radius: 6px;
  white-space: pre-wrap; word-break: break-all;
}
.key-chip {
  display: inline-block; margin: 2px 3px 2px 0; padding: 2px 7px;
  font-family: var(--mono); font-size: 10.5px;
  background: var(--surface-3); color: var(--text-2);
  border-radius: 4px;
}
.key-chip.hit {
  background: var(--success-soft); color: var(--success); font-weight: 500;
}

/* 账号卡片网格 */
.acc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 12px;
}

.acc-card {
  padding: 15px 17px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
}
.acc-card.off { opacity: .72; }
.acc-card.err { border-left: 3px solid var(--danger); }
.acc-card.on { border-left: 3px solid var(--success); }

.acc-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.acc-name { font-size: 13.5px; font-weight: 600; flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.acc-rows { display: flex; flex-direction: column; gap: 5px; font-size: 12px; flex: 1; }
.acc-row { display: flex; justify-content: space-between; gap: 10px; }
.acc-k { color: var(--text-3); flex-shrink: 0; }
.acc-v { text-align: right; word-break: break-all; }
.acc-v.ok { color: var(--success); }
.acc-v.bad { color: var(--danger); }
.acc-v.warn { color: var(--warn); }

.acc-foot {
  display: flex; gap: 6px; margin-top: 12px;
  padding-top: 11px; border-top: 1px solid var(--surface-3);
  flex-wrap: wrap;
}
.acc-foot button { font-size: 11.5px; }
.acc-foot .spacer { flex: 1; }

.pill {
  padding: 1px 7px; font-size: 10.5px; border-radius: 9px;
  background: var(--surface-3); color: var(--text-2); white-space: nowrap;
}
.pill.on { background: var(--success-soft); color: var(--success); }
.pill.off { background: var(--surface-3); color: var(--text-3); }
.pill.err { background: var(--danger-soft); color: var(--danger); }
.pill.live { background: var(--danger-soft); color: var(--danger); }
.pill.dry { background: var(--warn-soft); color: var(--warn); }

.sidebar-foot {
  display: flex; align-items: center; gap: 7px;
  padding: 12px 14px; font-size: 12px; color: var(--text-2);
  border-top: 1px solid var(--border);
}

.status-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-3); flex-shrink: 0;
}
.status-dot.ok { background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.status-dot.bad { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }

.link-btn { margin-left: auto; font-size: 12px; color: var(--text-2); padding: 2px 4px; }
.link-btn:hover { color: var(--accent); }

/* ==================== 主区 ==================== */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 0 22px; height: 56px; flex-shrink: 0;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.topbar-left { display: flex; align-items: baseline; gap: 12px; }
.topbar h2 { font-size: 15px; font-weight: 600; }
.topbar-meta { font-size: 12.5px; color: var(--text-3); }
.topbar-right { display: flex; align-items: center; gap: 7px; }

.chip {
  padding: 4px 9px; font-size: 11.5px; color: var(--text-2);
  background: var(--surface-3); border: 1px solid var(--border);
  border-radius: 6px; white-space: nowrap;
}
.chip.ok { color: var(--success); background: var(--success-soft); border-color: transparent; }
.chip.bad { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.chip.warn { color: var(--warn); background: var(--warn-soft); border-color: transparent; }

.view { flex: 1; overflow-y: auto; padding: 18px 22px 28px; }
.view.no-pad { padding: 0; overflow: hidden; }

/* ==================== 卡片 ==================== */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 18px; border-bottom: 1px solid var(--border);
}
.card-head h3 { font-size: 13.5px; font-weight: 600; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.kv-list { padding: 8px 18px 14px; }
.kv-row {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 7px 0; font-size: 13px;
  border-bottom: 1px solid var(--surface-3);
}
.kv-row:last-child { border-bottom: none; }
.kv-key { color: var(--text-2); flex-shrink: 0; }
.kv-val { text-align: right; word-break: break-all; }
.kv-val.ok { color: var(--success); }
.kv-val.bad { color: var(--danger); }

.empty { padding: 30px 18px; text-align: center; font-size: 13px; color: var(--text-3); line-height: 1.7; }

/* ==================== 收件箱三栏 ==================== */
.inbox {
  display: grid;
  grid-template-columns: 306px minmax(0, 1fr) 292px;
  /* 关键：行高锁死为容器高度，否则 grid 会按内容撑开，
     把聊天输入框挤到屏幕外（子栏高度 1619 > 容器 884） */
  grid-template-rows: 100%;
  height: 100%;
  overflow: hidden;
}

/* 三个子栏都要 min-height:0，否则 flex 子项不会在 overflow 场景下收缩 */
.inbox-list-col,
.inbox-chat-col,
.inbox-side-col {
  min-height: 0;
}

.inbox-list-col {
  display: flex; flex-direction: column;
  border-right: 1px solid var(--border);
  background: var(--surface);
  min-width: 0;
}

.inbox-toolbar { padding: 12px 12px 8px; }

.search-wrap { position: relative; }
.search-icon {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  width: 14px; height: 14px; color: var(--text-3); pointer-events: none;
}
.search-wrap input {
  width: 100%; height: 34px; padding: 0 10px 0 31px;
  font-size: 13px; color: var(--text);
  background: var(--surface-3); border: 1px solid transparent;
  border-radius: var(--radius-sm); outline: none;
  transition: background .15s, border-color .15s;
}
.search-wrap input:focus { background: var(--surface); border-color: var(--accent); }
.search-wrap input::placeholder { color: var(--text-3); }

.filter-tabs {
  display: flex; gap: 3px; padding: 0 10px 10px;
  overflow-x: auto; scrollbar-width: none;
}
.filter-tabs::-webkit-scrollbar { display: none; }

.ftab {
  display: flex; align-items: center; gap: 3px;
  padding: 4px 7px; font-size: 12px; color: var(--text-2);
  border-radius: 6px; white-space: nowrap;
  transition: background .12s, color .12s;
}
.ftab:hover { background: var(--surface-3); }
.ftab.active { background: var(--accent); color: #fff; font-weight: 500; }

.ftab-n {
  min-width: 16px; padding: 0 4px;
  font-size: 10.5px; line-height: 15px; text-align: center;
  color: #fff; background: var(--danger); border-radius: 8px;
}
.ftab.active .ftab-n { background: rgba(255, 255, 255, .28); }
.ftab-n.warn { background: var(--warn); }

.conv-list { flex: 1; overflow-y: auto; }

.conv-item {
  display: flex; gap: 10px; padding: 11px 12px;
  cursor: pointer; border-bottom: 1px solid var(--surface-3);
  transition: background .12s;
  position: relative;
}
.conv-item:hover { background: var(--surface-2); }
.conv-item.active { background: var(--accent-soft); }
.conv-item.unread .conv-name { font-weight: 600; }
.conv-item.unread::before {
  content: ''; position: absolute; left: 4px; top: 50%;
  width: 3px; height: 22px; margin-top: -11px;
  background: var(--accent); border-radius: 2px;
}

.avatar {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; flex-shrink: 0;
  font-size: 12px; font-weight: 500;
  color: var(--accent); background: var(--accent-soft);
  border-radius: 50%;
}
.avatar.lg { width: 40px; height: 40px; font-size: 14px; }

.conv-main { flex: 1; min-width: 0; }
.conv-top { display: flex; align-items: center; gap: 6px; }
.conv-name {
  font-size: 13px; flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.conv-time { font-size: 11px; color: var(--text-3); flex-shrink: 0; }
.conv-preview {
  margin-top: 3px; font-size: 12px; color: var(--text-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.conv-tags { display: flex; gap: 4px; margin-top: 5px; flex-wrap: wrap; }

.tag {
  padding: 1px 6px; font-size: 10.5px; border-radius: 4px;
  background: var(--surface-3); color: var(--text-2);
  border: 1px solid var(--border); white-space: nowrap;
}
.tag.hot { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.tag.manual { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.tag.stage { color: var(--purple); background: var(--purple-soft); border-color: transparent; }
.tag.topic { color: var(--accent); background: var(--accent-soft); border-color: transparent; }
.tag.done { color: var(--success); background: var(--success-soft); border-color: transparent; }
.tag.ad {
  color: var(--purple); background: var(--purple-soft); border-color: transparent;
  max-width: 110px; overflow: hidden; text-overflow: ellipsis;
}
.tag.acc {
  color: var(--text-2); background: var(--surface);
  border-color: var(--border-strong);
  max-width: 92px; overflow: hidden; text-overflow: ellipsis;
}

.unread-pill {
  min-width: 17px; padding: 0 5px;
  font-size: 10.5px; line-height: 16px; text-align: center;
  color: #fff; background: var(--danger); border-radius: 8px;
}

/* ==================== 聊天列 ==================== */
.inbox-chat-col {
  display: flex; flex-direction: column; min-width: 0;
  background: var(--surface-2);
}

.empty-state {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 12px;
  color: var(--text-3); font-size: 13px;
}

.chat-head {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 16px; flex-shrink: 0;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.chat-head-info { flex: 1; min-width: 0; }
.chat-name { font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.chat-facts { font-size: 11.5px; color: var(--text-3); margin-top: 3px; }
.chat-actions { display: flex; gap: 7px; }

.chat-body { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 18px 10px; }

.bubble-row { display: flex; margin-bottom: 12px; }
.bubble-row.customer { justify-content: flex-start; }
.bubble-row.assistant { justify-content: flex-end; }

.bubble {
  max-width: 70%; padding: 9px 13px;
  font-size: 13px; line-height: 1.62;
  border-radius: 11px; word-break: break-word; white-space: pre-wrap;
}
.bubble-row.customer .bubble {
  background: var(--surface); border: 1px solid var(--border);
  border-bottom-left-radius: 3px;
}
.bubble-row.assistant .bubble {
  background: var(--accent); color: #fff;
  border-bottom-right-radius: 3px;
}
.bubble-meta { margin-top: 5px; font-size: 10.5px; opacity: .55; text-align: right; }

.chat-foot {
  padding: 11px 16px 14px; flex-shrink: 0;
  background: var(--surface); border-top: 1px solid var(--border);
}

.chat-notice {
  padding: 7px 11px; margin-bottom: 9px;
  font-size: 12px; border-radius: var(--radius-sm);
  color: var(--warn); background: var(--warn-soft);
}
.chat-notice.manual { color: var(--purple); background: var(--purple-soft); }

.chat-input-row { display: flex; gap: 8px; align-items: flex-end; }

.chat-input-wrap { flex: 1; position: relative; }
.chat-input-row textarea {
  width: 100%; height: 42px; min-height: 42px; max-height: 110px;
  padding: 11px 12px; font-size: 13px; line-height: 1.5;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  outline: none; resize: none; transition: border-color .15s;
}
.chat-input-row textarea:focus { border-color: var(--accent); }

.quick-btn {
  display: flex; align-items: center; gap: 4px;
  height: 42px; padding: 0 11px;
  font-size: 12.5px; color: var(--text-2);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); white-space: nowrap;
}
.quick-btn:hover { color: var(--accent); border-color: var(--accent); }

/* 快捷回复浮层 */
.quick-pop {
  position: absolute; left: 0; right: 0; bottom: 50px;
  max-height: 280px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  z-index: 20;
}
.quick-item { padding: 10px 13px; cursor: pointer; border-bottom: 1px solid var(--surface-3); }
.quick-item:hover { background: var(--accent-soft); }
.quick-item-t { font-size: 12.5px; font-weight: 500; display: flex; gap: 6px; align-items: center; }
.quick-item-c {
  font-size: 12px; color: var(--text-3); margin-top: 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ==================== 客户侧栏 ==================== */
.inbox-side-col {
  border-left: 1px solid var(--border);
  background: var(--surface);
  overflow-y: auto; min-width: 0;
}
.side-empty { padding: 30px 18px; text-align: center; font-size: 12.5px; color: var(--text-3); line-height: 1.7; }

.side-block { padding: 15px 16px; border-bottom: 1px solid var(--border); }
.side-block:last-child { border-bottom: none; }
.side-title {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11.5px; font-weight: 500; color: var(--text-3);
  letter-spacing: .4px; margin-bottom: 10px;
}
.side-title button { font-size: 11.5px; color: var(--accent); }

.side-person { display: flex; align-items: center; gap: 10px; }
.side-person-name { font-size: 14px; font-weight: 600; }
.side-person-sub { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }

.fact-list { display: flex; flex-direction: column; gap: 7px; }
.fact-row { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; }
.fact-k { color: var(--text-3); flex-shrink: 0; }
.fact-v { text-align: right; word-break: break-all; }
.fact-v.muted { color: var(--text-3); }

/* 阶段选择 */
.stage-list { display: flex; flex-direction: column; gap: 3px; }
.stage-opt {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 9px; font-size: 12.5px; color: var(--text-2);
  border-radius: var(--radius-sm); text-align: left;
  transition: background .12s;
}
.stage-opt:hover { background: var(--surface-3); }
.stage-opt.on { background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.stage-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.stage-dot.new { background: var(--text-3); }
.stage-dot.valid { background: var(--accent); }
.stage-dot.converted { background: var(--success); }

/* 标签选择 */
.tag-picker { display: flex; flex-wrap: wrap; gap: 5px; }
.tag-opt {
  padding: 3px 8px; font-size: 11.5px; color: var(--text-2);
  background: var(--surface-3); border: 1px solid transparent;
  border-radius: 5px; transition: all .12s;
}
.tag-opt:hover { border-color: var(--border-strong); }
.tag-opt.on { background: var(--accent); color: #fff; }

.note-box {
  width: 100%; min-height: 62px; padding: 8px 10px;
  font-size: 12.5px; line-height: 1.6; color: var(--text);
  background: var(--surface-3); border: 1px solid transparent;
  border-radius: var(--radius-sm); outline: none; resize: vertical;
}
.note-box:focus { background: var(--surface); border-color: var(--accent); }

/* ==================== 线索看板 ==================== */
.leads-bar, .an-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; margin-bottom: 14px;
}
.leads-bar-left, .leads-bar-right,
.an-bar-left, .an-bar-right { display: flex; align-items: center; gap: 8px; }

.kanban {
  display: flex; gap: 12px;
  overflow-x: auto; padding-bottom: 10px;
  align-items: flex-start;
  min-height: calc(100vh - 56px - 100px);
}

.kcol {
  flex: 0 0 258px; width: 258px;
  background: var(--surface-3);
  border-radius: var(--radius);
  display: flex; flex-direction: column;
  max-height: calc(100vh - 56px - 100px);
}
.kcol.drop { background: var(--accent-soft); outline: 2px dashed var(--accent-line); outline-offset: -2px; }

.kcol-head {
  padding: 11px 13px 9px; flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}
.kcol-title { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; }
.kcol-n {
  min-width: 19px; padding: 0 5px;
  font-size: 11px; line-height: 17px; text-align: center;
  color: var(--text-2); background: var(--surface);
  border-radius: 9px; font-weight: 500;
}
.kcol-hint { font-size: 11px; color: var(--text-3); margin-top: 4px; }

.kcol-body { flex: 1; overflow-y: auto; padding: 9px; display: flex; flex-direction: column; gap: 8px; }

.kcard {
  padding: 10px 11px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  cursor: grab; box-shadow: var(--shadow);
  transition: border-color .12s, box-shadow .12s;
}
.kcard:hover { border-color: var(--accent-line); box-shadow: var(--shadow-md); }
.kcard:active { cursor: grabbing; }
.kcard.dragging { opacity: .4; }

.kcard-top { display: flex; align-items: center; gap: 7px; margin-bottom: 6px; }
.kcard-name { font-size: 12.5px; font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kcard-facts { font-size: 11.5px; color: var(--text-2); line-height: 1.6; }
.kcard-foot {
  display: flex; align-items: center; gap: 5px; margin-top: 7px;
  flex-wrap: wrap;
}
.kcard-topic { font-size: 10.5px; color: var(--accent); }
.kcard-time { margin-left: auto; font-size: 10.5px; color: var(--text-3); }

/* ==================== 数据分析 ==================== */
.an-grid { display: grid; gap: 14px; margin-bottom: 14px; }
.an-grid.c4 { grid-template-columns: repeat(4, 1fr); }
.an-grid.c2 { grid-template-columns: 1fr 1fr; }

.stat { padding: 15px 17px; }
.stat-label { font-size: 12.5px; color: var(--text-2); }
.stat-value {
  margin-top: 7px; font-size: 25px; font-weight: 600;
  letter-spacing: -.5px; font-variant-numeric: tabular-nums;
}
.stat-foot { margin-top: 4px; font-size: 11.5px; color: var(--text-3); }
.stat-value .unit { font-size: 14px; font-weight: 500; color: var(--text-3); margin-left: 2px; }

.chart-box { padding: 4px 16px 16px; }
.chart-svg { width: 100%; height: auto; display: block; }

.legend { display: flex; gap: 14px; padding: 0 18px 12px; font-size: 11.5px; color: var(--text-2); }
.legend-item { display: flex; align-items: center; gap: 5px; }
.legend-dot { width: 8px; height: 8px; border-radius: 2px; }

/* 漏斗 */
.funnel { padding: 8px 18px 18px; display: flex; flex-direction: column; gap: 9px; }
.funnel-row { display: flex; align-items: center; gap: 10px; }
.funnel-label { width: 62px; font-size: 12.5px; color: var(--text-2); flex-shrink: 0; }
.funnel-track { flex: 1; height: 26px; background: var(--surface-3); border-radius: 5px; overflow: hidden; }
.funnel-fill {
  height: 100%; border-radius: 5px;
  display: flex; align-items: center; padding-left: 9px;
  font-size: 11.5px; color: #fff; font-weight: 500;
  transition: width .4s ease;
}
.funnel-n { width: 34px; text-align: right; font-size: 12.5px; font-variant-numeric: tabular-nums; }

/* 表格 */
.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tbl th {
  padding: 9px 12px; text-align: left; font-weight: 500;
  color: var(--text-3); font-size: 11.5px;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--surface-3); }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: var(--surface-2); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .rate { font-weight: 500; }

.bar-mini { height: 5px; background: var(--surface-3); border-radius: 3px; overflow: hidden; min-width: 60px; }
.bar-mini-fill { height: 100%; background: var(--accent); border-radius: 3px; }

/* ==================== 快捷回复管理 ==================== */
.canned-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.canned-card {
  padding: 14px 16px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); display: flex; flex-direction: column;
}
.canned-head { display: flex; align-items: center; gap: 7px; margin-bottom: 8px; }
.canned-title { font-size: 13px; font-weight: 600; flex: 1; min-width: 0; }
.canned-cat {
  font-size: 10.5px; color: var(--purple);
  background: var(--purple-soft); padding: 1px 6px; border-radius: 4px;
}
.canned-content { font-size: 12.5px; color: var(--text-2); line-height: 1.65; flex: 1; }
.canned-foot { display: flex; gap: 6px; margin-top: 11px; justify-content: flex-end; }
.canned-foot button { font-size: 11.5px; color: var(--text-3); padding: 2px 6px; }
.canned-foot button:hover { color: var(--accent); }
.canned-foot button.del:hover { color: var(--danger); }

/* ==================== 分段控件 ==================== */
.seg { display: flex; background: var(--surface-3); padding: 3px; border-radius: 7px; gap: 2px; }
.seg-item {
  padding: 5px 12px; font-size: 12.5px; color: var(--text-2);
  border-radius: 5px; transition: all .12s;
}
.seg-item:hover { color: var(--text); }
.seg-item.active { background: var(--surface); color: var(--text); font-weight: 500; box-shadow: var(--shadow); }

/* ==================== 编辑器 ==================== */
.editor-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 11px 16px; margin-bottom: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.editor-info { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.editor-info strong { font-size: 13.5px; }
.editor-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.mono-dim {
  font-family: var(--mono); font-size: 11px; color: var(--text-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 340px;
}

.save-state { font-size: 12px; color: var(--text-3); }
.save-state.ok { color: var(--success); }
.save-state.bad { color: var(--danger); }

.editor {
  width: 100%; height: calc(100vh - 56px - 52px - 62px);
  padding: 16px 18px; font-family: var(--mono);
  font-size: 12.5px; line-height: 1.75; color: var(--text);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); outline: none; resize: none; tab-size: 2;
}
.editor:focus { border-color: var(--accent); }

.auto-label { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-2); cursor: pointer; }

.log-view {
  height: calc(100vh - 56px - 52px - 62px);
  padding: 14px 16px; font-family: var(--mono);
  font-size: 12px; line-height: 1.7; color: #D6D9E0;
  background: #16181D; border: 1px solid #262A33;
  border-radius: var(--radius); overflow: auto;
  white-space: pre-wrap; word-break: break-all;
}

/* ==================== 按钮 ==================== */
.btn-primary, .btn-ghost, .btn-danger {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  padding: 7px 14px; font-size: 12.5px; font-weight: 500;
  border-radius: var(--radius-sm); white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}

.btn-primary { color: #fff; background: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: .55; cursor: default; }

.btn-ghost { color: var(--text-2); background: var(--surface); border: 1px solid var(--border-strong); }
.btn-ghost:hover { color: var(--text); border-color: var(--text-3); }

.btn-danger { color: var(--danger); background: var(--danger-soft); }
.btn-danger:hover { background: #FDD9D5; }

.btn-sm { padding: 4px 9px; font-size: 11.5px; }

.btn-row { display: flex; gap: 8px; padding: 0 18px 16px; flex-wrap: wrap; }

/* ==================== 弹窗 ==================== */
.modal {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 24px; background: rgba(16, 24, 40, .45);
}
.modal-card {
  width: 100%; max-width: 480px; max-height: 86vh;
  display: flex; flex-direction: column;
  background: var(--surface); border-radius: 13px;
  box-shadow: var(--shadow-lg);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.modal-head h3 { font-size: 14.5px; font-weight: 600; }
.modal-x { font-size: 15px; color: var(--text-3); padding: 2px 5px; }
.modal-x:hover { color: var(--text); }

.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 13px 20px; border-top: 1px solid var(--border);
}

.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field label { display: block; font-size: 12.5px; color: var(--text-2); margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%; padding: 9px 11px; font-size: 13px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); outline: none;
}
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.field textarea { min-height: 96px; line-height: 1.6; resize: vertical; }

/* ==================== 提示 ==================== */
.problems { padding: 8px 18px 16px; }
.problem-item {
  display: flex; gap: 8px; padding: 9px 12px; margin-bottom: 7px;
  font-size: 12.5px; color: var(--warn); background: var(--warn-soft);
  border-radius: var(--radius-sm); line-height: 1.55;
}
.problem-item.ok { color: var(--success); background: var(--success-soft); }

.toast {
  position: fixed; left: 50%; bottom: 32px;
  transform: translate(-50%, 16px);
  padding: 10px 20px; font-size: 13px; color: #fff;
  background: #1D2939; border-radius: 8px;
  box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; z-index: 999; max-width: 80vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.ok { background: #046C4E; }
.toast.bad { background: #B42318; }

/* ==================== 响应式 ==================== */
@media (max-width: 1320px) {
  .inbox { grid-template-columns: 286px minmax(0, 1fr) 268px; }
  .an-grid.c4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 1080px) {
  .inbox { grid-template-columns: 272px minmax(0, 1fr); }
  .inbox-side-col { display: none; }
  .an-grid.c2 { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .sidebar { width: 60px; }
  .brand-text, .nav-item > span:not(.badge), .sidebar-foot > span { display: none; }
  .brand { justify-content: center; padding: 16px 8px; }
  .nav-item { justify-content: center; }
  .inbox { grid-template-columns: 1fr; }
  .inbox-chat-col { display: none; }
  .inbox.detail-open .inbox-list-col { display: none; }
  .inbox.detail-open .inbox-chat-col { display: flex; }
  .topbar-right { display: none; }
  .view { padding: 14px; }
  .an-grid.c4 { grid-template-columns: 1fr 1fr; }
}
