/* ==========================================================================
   OmniLead-AI 管理台样式（零构建、零 CDN、原生 CSS）
   设计：深色侧栏 + 浅色内容区；系统字体栈；移动端优先可用
   ========================================================================== */

:root {
  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2f7;
  --border: #e4e8ef;
  --border-strong: #d3dae5;
  --text: #1b2333;
  --text-2: #5c6779;
  --text-3: #8b95a7;
  --primary: #2563eb;
  --primary-strong: #1d4ed8;
  --primary-weak: #e8f0fe;
  --success: #15803d;
  --success-weak: #e7f6ec;
  --warn: #b45309;
  --warn-weak: #fdf3e2;
  --danger: #b91c1c;
  --danger-weak: #fdeaea;
  --sidebar: #151b28;
  --sidebar-2: #1c2434;
  --sidebar-line: rgba(255, 255, 255, 0.08);
  --sidebar-text: #a9b3c5;
  --sidebar-text-active: #ffffff;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.08), 0 8px 24px -12px rgba(16, 24, 40, 0.18);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4, p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
pre { margin: 0; }
.hidden { display: none !important; }
.muted { color: var(--text-2); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 启动占位 ---------- */
.boot {
  position: fixed; inset: 0; display: grid; place-items: center;
  background: var(--bg); color: var(--text-2); z-index: 90; font-size: 13px;
}

/* ---------- 登录页 ---------- */
.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
  background:
    radial-gradient(1200px 600px at 15% -10%, rgba(37, 99, 235, 0.35), transparent 60%),
    radial-gradient(900px 500px at 110% 110%, rgba(13, 148, 136, 0.28), transparent 55%),
    linear-gradient(160deg, #0f1522 0%, #151d2e 55%, #101725 100%);
}

.login-card {
  width: 100%;
  max-width: 404px;
  background: var(--surface);
  border-radius: 18px;
  padding: 36px 34px 28px;
  box-shadow: 0 24px 60px -20px rgba(4, 10, 24, 0.65);
}

.login-brand { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; }
.brand-mark {
  width: 46px; height: 46px; border-radius: 13px;
  display: grid; place-items: center;
  background: linear-gradient(140deg, #2563eb, #0d9488);
  color: #fff; font-weight: 700; font-size: 17px; letter-spacing: 0.5px;
  box-shadow: 0 6px 16px -6px rgba(37, 99, 235, 0.75);
}
.login-card h1 { font-size: 22px; font-weight: 650; letter-spacing: 0.2px; }
.login-sub { color: var(--text-2); font-size: 13px; }

.login-form { margin-top: 26px; display: flex; flex-direction: column; gap: 14px; }
.login-form .field { display: flex; flex-direction: column; gap: 6px; }
.login-form .field > span { font-size: 12.5px; color: var(--text-2); font-weight: 550; }
.form-error { min-height: 18px; font-size: 12.5px; color: var(--danger); margin: 0; }

.btn-block { width: 100%; }

.login-hint {
  margin-top: 24px; padding-top: 18px; border-top: 1px dashed var(--border);
  font-size: 12px; color: var(--text-2);
}
.login-hint > p { margin-bottom: 8px; color: var(--text-3); }
.hint-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 12px; }
.hint-grid code { font-family: var(--mono); font-size: 11.5px; color: var(--text); }
.hint-grid span { color: var(--text-3); }

/* ---------- 应用骨架 ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 228px; flex: 0 0 228px;
  background: linear-gradient(180deg, var(--sidebar) 0%, #121824 100%);
  color: var(--sidebar-text);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  border-right: 1px solid var(--sidebar-line);
}

.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 22px 20px 18px; }
.sidebar-brand .brand-mark { width: 38px; height: 38px; border-radius: 11px; font-size: 14px; }
.sidebar-brand strong { display: block; color: #fff; font-size: 15px; letter-spacing: 0.2px; }
.sidebar-brand small { display: block; color: var(--sidebar-text); font-size: 11.5px; margin-top: 1px; }

.nav { padding: 6px 12px; display: flex; flex-direction: column; gap: 3px; flex: 1; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 10px 12px;
  background: none; border: 0; border-radius: var(--radius-sm);
  color: var(--sidebar-text); font-size: 13.5px; text-align: left;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-item svg { width: 17px; height: 17px; flex: 0 0 17px; opacity: 0.85; }
.nav-item:hover { background: rgba(255, 255, 255, 0.06); color: #e8edf6; }
.nav-item.active { background: rgba(37, 99, 235, 0.22); color: #fff; box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.28); }
.nav-item.active svg { opacity: 1; color: #93c5fd; }
.nav-item .nav-badge { margin-left: auto; font-size: 10.5px; color: #c7d2fe; background: rgba(99, 102, 241, 0.28); padding: 1px 7px; border-radius: 999px; }

.sidebar-foot { padding: 14px 16px 18px; border-top: 1px solid var(--sidebar-line); display: flex; flex-direction: column; gap: 12px; }
.user-chip { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar {
  width: 34px; height: 34px; flex: 0 0 34px; border-radius: 50%;
  display: grid; place-items: center; font-size: 13px; font-weight: 650;
  background: linear-gradient(140deg, #334155, #1e293b); color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.user-chip strong { display: block; color: #f1f5f9; font-size: 13px; font-weight: 600; }
.user-chip small { display: block; color: var(--sidebar-text); font-size: 11.5px; }
.sidebar-foot .btn { justify-content: center; width: 100%; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  padding: 22px 28px 14px;
}
.topbar h2 { font-size: 20px; font-weight: 650; letter-spacing: 0.2px; }
.page-desc { color: var(--text-2); font-size: 12.5px; margin-top: 2px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.content { padding: 6px 28px 32px; width: 100%; max-width: 1400px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px; border-radius: var(--radius-sm);
  border: 1px solid transparent; background: var(--surface);
  color: var(--text); font-size: 13px; font-weight: 550; line-height: 1.3;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, opacity 0.15s;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn svg { width: 15px; height: 15px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-strong); }
.btn-outline { border-color: var(--border-strong); background: var(--surface); color: var(--text); }
.btn-outline:hover:not(:disabled) { border-color: #b9c4d4; background: var(--surface-2); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
.sidebar .btn-ghost { color: var(--sidebar-text); border-color: rgba(255, 255, 255, 0.14); }
.sidebar .btn-ghost:hover:not(:disabled) { background: rgba(255, 255, 255, 0.08); color: #fff; }
.btn-danger { background: var(--danger-weak); color: var(--danger); border-color: transparent; }
.btn-danger:hover:not(:disabled) { background: #fbd5d5; }
.btn-sm { padding: 6px 10px; font-size: 12.5px; border-radius: 7px; }
.btn-xs { padding: 4px 9px; font-size: 12px; border-radius: 6px; }

/* ---------- 卡片 / 面板 ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.panel-head h3 { font-size: 14px; font-weight: 650; }
.panel-head .panel-sub { color: var(--text-3); font-size: 12px; }
.panel-body { padding: 18px; }
.panel-body.tight { padding: 0; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(178px, 1fr)); gap: 14px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.stat-card::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--primary); opacity: 0.85; }
.stat-card.accent-green::after { background: var(--success); }
.stat-card.accent-amber::after { background: var(--warn); }
.stat-card.accent-teal::after { background: #0d9488; }
.stat-label { color: var(--text-2); font-size: 12.5px; display: flex; align-items: center; gap: 6px; }
.stat-value { font-size: 28px; font-weight: 650; letter-spacing: -0.5px; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat-value .unit { font-size: 14px; font-weight: 500; color: var(--text-2); margin-left: 3px; letter-spacing: 0; }
.stat-foot { margin-top: 6px; font-size: 11.5px; color: var(--text-3); }

.section-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin-top: 16px; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 22px 0 12px; }
.section-title h3 { font-size: 14.5px; font-weight: 650; }
.section-title .muted { font-size: 12px; }

/* 条形分布 */
.bar-list { display: flex; flex-direction: column; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 96px 1fr 42px; align-items: center; gap: 10px; font-size: 12.5px; }
.bar-row .bar-label { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #3b82f6, #0d9488); min-width: 2px; }
.bar-row .bar-value { text-align: right; font-variant-numeric: tabular-nums; color: var(--text); }

/* 代码片段 */
.code-snip {
  background: #0f172a; color: #d7e2f4; border-radius: var(--radius-sm);
  padding: 12px 14px; font-family: var(--mono); font-size: 11.5px; line-height: 1.7;
  overflow-x: auto; white-space: pre;
}

/* ---------- 表单 ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12.5px; color: var(--text-2); font-weight: 550; }
.field .hint { font-size: 11.5px; color: var(--text-3); }
.input, .select, .textarea {
  width: 100%; padding: 9px 11px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font-size: 13px;
  outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
.input::placeholder, .textarea::placeholder { color: #a6b0c0; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14); }
.textarea { resize: vertical; min-height: 96px; line-height: 1.6; }
.form-grid { display: grid; gap: 14px; }
.form-actions { display: flex; gap: 10px; align-items: center; }

/* ---------- 徽标 ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 550; line-height: 1.6; white-space: nowrap;
  background: var(--surface-3); color: var(--text-2);
}
.badge-green { background: var(--success-weak); color: var(--success); }
.badge-blue { background: var(--primary-weak); color: var(--primary-strong); }
.badge-amber { background: var(--warn-weak); color: var(--warn); }
.badge-red { background: var(--danger-weak); color: var(--danger); }
.badge-gray { background: var(--surface-3); color: var(--text-2); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; }

/* ---------- 表格 ---------- */
.table-wrap { width: 100%; overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 12.8px; }
table.table th {
  text-align: left; font-size: 11.5px; font-weight: 600; text-transform: none;
  color: var(--text-2); background: var(--surface-2);
  padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.table tbody tr:last-child td { border-bottom: 0; }
table.table tbody tr:hover { background: #fbfcfe; }
table.table .cell-actions { display: flex; gap: 6px; flex-wrap: wrap; }
table.table .cell-mono { font-family: var(--mono); font-size: 11.5px; color: var(--text-2); }
table.table .cell-wrap { max-width: 320px; white-space: normal; word-break: break-word; }
.table-empty { padding: 34px 16px; text-align: center; color: var(--text-3); font-size: 13px; }

/* ---------- 工具栏 ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 18px; border-bottom: 1px solid var(--border); background: var(--surface); }
.toolbar .spacer { flex: 1; }
.toolbar .input, .toolbar .select { width: auto; min-width: 132px; }
.search-field { position: relative; flex: 1 1 220px; max-width: 320px; }
.search-field .input { padding-left: 32px; }
.search-field svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--text-3); }

/* ---------- 状态块（空 / 错误 / 加载） ---------- */
.state-block { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 52px 24px; text-align: center; }
.state-icon { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--text-3); }
.state-icon svg { width: 22px; height: 22px; }
.state-block h4 { font-size: 14px; font-weight: 650; }
.state-block p { font-size: 12.5px; color: var(--text-2); max-width: 460px; }
.state-block .mono { font-size: 11.5px; color: var(--text-3); background: var(--surface-2); border: 1px dashed var(--border); border-radius: 6px; padding: 2px 8px; }

.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 60px 20px; color: var(--text-2); font-size: 13px; }
.spinner {
  width: 17px; height: 17px; border-radius: 50%;
  border: 2px solid var(--border-strong); border-top-color: var(--primary);
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 收件箱 ---------- */
.inbox { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; height: calc(100vh - 168px); min-height: 500px; }
.conv-panel, .chat-panel { display: flex; flex-direction: column; min-height: 0; }
.conv-panel .panel-head { padding: 13px 16px; }
.conv-list { flex: 1; overflow-y: auto; }
.conv-item {
  width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--border);
  padding: 12px 16px; display: flex; flex-direction: column; gap: 5px;
  border-left: 3px solid transparent; transition: background 0.15s, border-color 0.15s;
}
.conv-item:hover { background: var(--surface-2); }
.conv-item.active { background: var(--primary-weak); border-left-color: var(--primary); }
.conv-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.conv-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-time { font-size: 11px; color: var(--text-3); white-space: nowrap; }
.conv-meta { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-3); }

.chat-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.chat-head .chat-title { font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chat-head .chat-sub { font-size: 11.5px; color: var(--text-3); margin-top: 1px; font-family: var(--mono); }
.chat-body { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 14px; background: linear-gradient(180deg, #fbfcfe, #ffffff 240px); }
.msg { display: flex; flex-direction: column; gap: 4px; max-width: 82%; }
.msg.user { align-self: flex-end; align-items: flex-end; }
.msg.assistant { align-self: flex-start; align-items: flex-start; }
.msg-bubble { padding: 9px 13px; border-radius: 12px; font-size: 13.2px; line-height: 1.62; white-space: pre-wrap; word-break: break-word; }
.msg.user .msg-bubble { background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.msg.assistant .msg-bubble { background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.msg-meta { font-size: 10.5px; color: var(--text-3); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.msg-meta .badge { font-size: 10px; padding: 0 6px; }

.composer { border-top: 1px solid var(--border); padding: 12px 14px; display: flex; gap: 10px; align-items: flex-end; background: var(--surface); }
.composer .textarea { min-height: 42px; max-height: 140px; resize: none; padding: 10px 12px; }
.composer .btn { height: 42px; }
.composer-tip { font-size: 11px; color: var(--text-3); padding: 0 14px 10px; background: var(--surface); }

/* 输入中动画 */
.typing { display: inline-flex; gap: 3px; align-items: center; padding: 4px 2px; }
.typing i { width: 5px; height: 5px; border-radius: 50%; background: var(--text-3); animation: typing 1.2s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: 0.15s; }
.typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing { 0%, 60%, 100% { opacity: 0.25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-2px); } }

/* ---------- 知识库 ---------- */
.kb-grid { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 16px; align-items: start; }
.kb-list { display: flex; flex-direction: column; }
.kb-item { padding: 13px 18px; border-bottom: 1px solid var(--border); }
.kb-item:last-child { border-bottom: 0; }
.kb-item .kb-title { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.kb-item .kb-body { margin-top: 4px; font-size: 12.3px; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.kb-item .kb-foot { margin-top: 6px; font-size: 11.5px; color: var(--text-3); display: flex; gap: 10px; flex-wrap: wrap; }
.search-results { display: flex; flex-direction: column; }
.hit { padding: 14px 18px; border-bottom: 1px solid var(--border); }
.hit:last-child { border-bottom: 0; }
.hit .hit-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.hit .hit-text { margin-top: 6px; font-size: 12.6px; color: var(--text-2); white-space: pre-wrap; }
.hit .hit-score { font-size: 11px; color: var(--text-3); font-family: var(--mono); }

/* ---------- 渠道 ---------- */
.channel-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.channel-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 10px; }
.channel-card .cc-head { display: flex; align-items: center; gap: 11px; }
.channel-icon {
  width: 38px; height: 38px; flex: 0 0 38px; border-radius: 10px; display: grid; place-items: center;
  background: var(--primary-weak); color: var(--primary-strong); font-weight: 700; font-size: 12px; letter-spacing: 0.3px;
}
.channel-card .cc-name { font-size: 13.5px; font-weight: 650; }
.channel-card .cc-type { font-size: 11.5px; color: var(--text-3); font-family: var(--mono); }
.channel-card .cc-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 11.5px; color: var(--text-3); }
.channel-card .cc-webhook { font-family: var(--mono); font-size: 11px; color: var(--text-2); background: var(--surface-2); border: 1px dashed var(--border); border-radius: 6px; padding: 5px 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 弹窗 ---------- */
.modal-root {
  position: fixed; inset: 0; z-index: 120;
  background: rgba(15, 23, 42, 0.48);
  display: grid; place-items: center; padding: 20px;
  animation: fade-in 0.14s ease;
}
.modal-card { width: 100%; max-width: 440px; background: var(--surface); border-radius: 14px; box-shadow: 0 30px 70px -20px rgba(2, 8, 23, 0.55); overflow: hidden; animation: pop-in 0.16s ease; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 15px; font-weight: 650; }
.modal-body { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { padding: 14px 20px 18px; display: flex; justify-content: flex-end; gap: 10px; }
.modal-close { background: none; border: 0; color: var(--text-3); font-size: 20px; line-height: 1; padding: 2px 6px; border-radius: 6px; }
.modal-close:hover { background: var(--surface-3); color: var(--text); }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(8px) scale(0.985); } to { opacity: 1; transform: none; } }

/* ---------- Toast ---------- */
.toast-root { position: fixed; right: 20px; bottom: 20px; z-index: 140; display: flex; flex-direction: column; gap: 9px; align-items: flex-end; pointer-events: none; }
.toast {
  pointer-events: auto; min-width: 220px; max-width: 380px;
  background: #101828; color: #f1f5f9;
  border-radius: 10px; padding: 11px 15px; font-size: 12.8px; line-height: 1.5;
  box-shadow: 0 16px 40px -14px rgba(2, 8, 23, 0.6);
  border-left: 3px solid #64748b;
  animation: toast-in 0.18s ease;
}
.toast.success { border-left-color: #22c55e; }
.toast.error { border-left-color: #ef4444; }
.toast.info { border-left-color: #60a5fa; }
.toast.warn { border-left-color: #f59e0b; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- 提示条 ---------- */
.alert { margin: 0; padding: 10px 14px; border-radius: 10px; font-size: 12.5px; line-height: 1.55; border: 1px solid transparent; }
.alert + .alert { margin-top: 8px; }
.alert-info { background: var(--primary-weak); color: var(--primary-strong); border-color: #dbe7fd; }
.alert-success { background: var(--success-weak); color: var(--success); border-color: #cdecd8; }
.alert-warn { background: var(--warn-weak); color: var(--warn); border-color: #f5e1bd; }
.alert-danger { background: var(--danger-weak); color: var(--danger); border-color: #f7d4d4; }
#leads-notice:not(:empty) { padding: 12px 18px 0; }

/* ---------- 看板迷你指标 ---------- */
.inline-stats { display: flex; flex-wrap: wrap; gap: 12px 32px; }
.inline-stat { display: flex; flex-direction: column; gap: 2px; min-width: 84px; }
.inline-stat .k { font-size: 11.5px; color: var(--text-3); }
.inline-stat .v { font-size: 16px; font-weight: 650; font-variant-numeric: tabular-nums; }

/* 蓝色强调（留资卡） */
.stat-card.accent-blue::after { background: #3b82f6; }

/* ---------- 响应式 ---------- */
@media (max-width: 1180px) {
  .sidebar { width: 204px; flex-basis: 204px; }
  .inbox { grid-template-columns: 260px minmax(0, 1fr); }
  .kb-grid { grid-template-columns: 340px minmax(0, 1fr); }
}

@media (max-width: 900px) {
  .app { flex-direction: column; }
  .sidebar {
    position: static; width: 100%; flex-basis: auto; height: auto;
    border-right: 0; border-bottom: 1px solid var(--sidebar-line);
  }
  .sidebar-brand { padding: 14px 16px 10px; }
  .nav { flex-direction: row; overflow-x: auto; padding: 4px 10px 10px; gap: 6px; }
  .nav-item { width: auto; white-space: nowrap; padding: 8px 12px; }
  .nav-item .nav-badge { display: none; }
  .sidebar-foot { flex-direction: row; align-items: center; justify-content: space-between; padding: 10px 16px; }
  .sidebar-foot .btn { width: auto; }
  .topbar { padding: 16px 18px 10px; }
  .content { padding: 4px 18px 26px; }
  .inbox { grid-template-columns: 1fr; height: auto; }
  .conv-panel { max-height: 236px; }
  .conv-panel .conv-list { max-height: 170px; }
  .chat-panel { min-height: 460px; }
  .chat-body { min-height: 260px; }
  .kb-grid { grid-template-columns: 1fr; }
  .toast-root { left: 12px; right: 12px; bottom: 12px; align-items: stretch; }
  .toast { max-width: none; }
}

@media (max-width: 560px) {
  .topbar { flex-direction: column; align-items: flex-start; gap: 10px; }
  .topbar-actions { width: 100%; }
  .stat-value { font-size: 24px; }
  .login-card { padding: 28px 22px 22px; border-radius: 15px; }
  .hint-grid { grid-template-columns: 1fr; }
  .panel-head { padding: 12px 14px; }
  .panel-body { padding: 14px; }
  table.table th, table.table td { padding: 9px 11px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* ==========================================================================
   v1.1 多语言双语消息 + 看板「来源分布」
   ========================================================================== */

/* 收件箱消息：原文气泡（.msg-bubble）下方附「原文语言 + 中文译文」卡片 */
.msg-translation {
  max-width: 100%;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px dashed var(--border-strong);
  background: var(--surface-2);
  font-size: 12.6px;
  line-height: 1.62;
  white-space: pre-wrap;
  word-break: break-word;
}
.msg-translation-tag {
  display: inline-block;
  margin-bottom: 3px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--primary-weak);
  color: var(--primary-strong);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.3px;
  line-height: 16px;
}
.msg-translation-text { color: var(--text); }
.msg.user .msg-translation {
  align-self: flex-end;
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.32);
}
.msg.user .msg-translation-tag { background: rgba(255, 255, 255, 0.24); color: #fff; }
.msg.user .msg-translation-text { color: #fff; }
.msg-meta .badge[title] { cursor: help; }

/* 来源分布：来源名多为域名，标签列略加宽 + 等宽字体（字段缺失时整块不渲染） */
.source-panel .bar-row { grid-template-columns: 130px 1fr 42px; }
.source-panel .bar-label { font-family: var(--mono); font-size: 11.5px; }

@media (max-width: 560px) {
  .msg-translation { font-size: 12.2px; padding: 7px 10px; }
  .source-panel .bar-row { grid-template-columns: 96px 1fr 34px; }
}

/* ==========================================================================
   v1.2 坐席工作台 / 流量 / 站点
   ========================================================================== */

/* ---------- 收件箱筛选与未读 ---------- */
.inbox-toolbar { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--surface); flex-wrap: wrap; }
.scope-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.scope-tab {
  border: 1px solid transparent; background: transparent; color: var(--text-2);
  padding: 5px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 550; cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.scope-tab:hover { background: var(--surface-3); color: var(--text); }
.scope-tab.active { background: var(--primary-weak); color: var(--primary-strong); border-color: #dbe7fd; }
.inbox-notice:not(:empty) { padding: 10px 12px 0; }
.inbox-notice .alert { font-size: 12px; }
.unread-badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 600;
  display: inline-grid; place-items: center; line-height: 1; flex: 0 0 auto;
}
.conv-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 2px; }
.conv-tags .badge { font-size: 10px; padding: 0 6px; }

/* ---------- 会话详情：状态 / 操作 / 标签 ---------- */
.chat-head-main { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.chat-head-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.chat-head-actions .select-sm { width: auto; min-width: 96px; }
.chat-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 2px; }
.chat-tags .badge { font-size: 10.5px; }
.chat-toolbar { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-top: 1px solid var(--border); background: var(--surface-2); flex-wrap: wrap; }
.chat-toolbar .select-sm { width: auto; min-width: 150px; max-width: 240px; }
.select-sm { padding: 5px 8px; font-size: 12.5px; border-radius: 7px; }
.rating { color: #f59e0b; letter-spacing: 1px; font-size: 13px; white-space: nowrap; }
.rating .muted { letter-spacing: 0; }
.msg.agent { align-self: flex-start; align-items: flex-start; }
.msg.agent .msg-bubble { background: #ecfdf5; border: 1px solid #a7f3d0; border-bottom-left-radius: 4px; }

/* ---------- 流量 ---------- */
.traffic-toolbar { margin-bottom: 14px; }
.traffic-toolbar .toolbar { border-bottom: 0; }
.trend-chart { display: flex; align-items: flex-end; gap: 8px; height: 160px; padding: 8px 2px 0; overflow-x: auto; }
.trend-col { flex: 1 0 34px; min-width: 34px; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; }
.trend-bar { width: 70%; max-width: 38px; min-height: 3px; border-radius: 6px 6px 2px 2px; background: linear-gradient(180deg, #60a5fa, #2563eb); }
.trend-label { font-size: 10px; color: var(--text-3); font-family: var(--mono); white-space: nowrap; }

/* ---------- 站点 ---------- */
.site-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 14px; }
.site-card { overflow: visible; }
.site-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.site-name { font-size: 14.5px; font-weight: 650; }
.site-domain { font-size: 11.5px; color: var(--text-3); font-family: var(--mono); margin-top: 2px; word-break: break-all; }
.site-key-row {
  display: flex; align-items: center; gap: 8px; margin-top: 12px;
  padding: 7px 10px; background: var(--surface-2);
  border: 1px dashed var(--border-strong); border-radius: 8px;
}
.site-key-label { flex: 0 0 auto; font-size: 10.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.4px; }
.site-code { flex: 1; min-width: 0; font-family: var(--mono); font-size: 11.5px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-meta { display: flex; gap: 8px 16px; flex-wrap: wrap; margin-top: 10px; font-size: 11.5px; color: var(--text-2); }
.site-welcome { margin-top: 10px; font-size: 12.5px; color: var(--text-2); line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.site-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.site-rules { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border); display: flex; flex-direction: column; gap: 10px; }
.site-rules .spinner { margin-right: 4px; }
.rule-list { display: flex; flex-direction: column; gap: 8px; }
.rule-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px;
}
.rule-pattern { font-family: var(--mono); font-size: 11.5px; color: var(--primary-strong); background: var(--primary-weak); padding: 2px 7px; border-radius: 5px; }
.rule-meta { flex: 1; min-width: 120px; }
.rule-form { display: grid; grid-template-columns: 1.2fr 1fr 1fr 72px auto; gap: 8px; align-items: center; }
.rule-form .input { padding: 7px 9px; font-size: 12px; }
.rule-form .input-priority { text-align: center; }

@media (max-width: 900px) {
  .rule-form { grid-template-columns: 1fr 1fr; }
  .rule-form .btn { grid-column: 1 / -1; }
}

@media (max-width: 560px) {
  .site-grid { grid-template-columns: 1fr; }
  .inbox-toolbar { padding: 8px 10px; }
  .chat-head { flex-direction: column; align-items: flex-start; }
  .chat-head-actions { margin-left: 0; width: 100%; justify-content: flex-start; }
  .chat-toolbar { padding: 8px 10px; }
}

/* ==========================================================================
   v1.3 平台控制台 / 代理商控制台 / 用户管理 / OEM 品牌 / 脱敏
   ========================================================================== */

/* ---------- OEM 品牌 ---------- */
.brand-mark.has-logo { background: #fff; padding: 3px; overflow: hidden; }
.brand-mark.has-logo img { width: 100%; height: 100%; object-fit: contain; border-radius: 8px; display: block; }
.topbar .brand-tenant { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-3); }

.brand-card .panel-body { display: flex; flex-direction: column; gap: 10px; }
.brand-preview { display: flex; align-items: center; gap: 10px; font-size: 14.5px; flex-wrap: wrap; }
.brand-logo-preview { height: 30px; max-width: 140px; object-fit: contain; border-radius: 6px; background: var(--surface-2); padding: 2px 6px; }
.color-swatch { width: 16px; height: 16px; border-radius: 5px; display: inline-block; border: 1px solid rgba(0, 0, 0, 0.12); vertical-align: middle; flex: 0 0 auto; }

input[type="color"].input { height: 38px; padding: 3px; cursor: pointer; }

/* ---------- 控制台通用 ---------- */
.console-toolbar { margin: 16px 0 4px; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.form-grid.two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.credential-box {
  display: flex; flex-direction: column; gap: 8px;
  padding: 12px 14px; background: var(--surface-2);
  border: 1px dashed var(--border-strong); border-radius: 10px;
}
.credential-box > div { display: flex; align-items: center; gap: 10px; }
.credential-box .k { flex: 0 0 72px; font-size: 12px; color: var(--text-3); }
.credential-box code { font-family: var(--mono); font-size: 13px; color: var(--text); word-break: break-all; }

.badge-teal { background: #e6f7f5; color: #0f766e; }

/* ---------- 线索脱敏 ---------- */
#content table.table td .btn[data-action="reveal"] { margin-left: 4px; }
.masked-hint { color: var(--text-3); font-size: 11.5px; }

@media (max-width: 720px) {
  .form-grid.two-col { grid-template-columns: 1fr; }
  .console-toolbar { flex-direction: row; }
}

@media (max-width: 560px) {
  .brand-preview { font-size: 13.5px; }
  .credential-box .k { flex-basis: 64px; }
  .console-toolbar { padding: 10px; }
}

/* ==========================================================================
   v1.4 TOTP 双因子 / 域名自动验证 / 租户配额 / 导出删除
   ========================================================================== */

/* ---------- TOTP 密钥 / otpauth ---------- */
.totp-secret {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 9px 11px; margin-bottom: 8px;
  background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: 9px;
}
.totp-secret .k { flex: 0 0 96px; font-size: 11.5px; color: var(--text-3); }
.totp-secret code { flex: 1 1 180px; min-width: 0; font-size: 12px; color: var(--text); word-break: break-all; }
.totp-secret .btn { flex: 0 0 auto; }

/* ---------- 配额进度 ---------- */
.quota-line { margin-bottom: 14px; }
.quota-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--text-2); }
.quota-head .mono { color: var(--text); }
.quota-track { height: 8px; margin-top: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.quota-fill { display: block; height: 100%; min-width: 2px; border-radius: 999px; background: linear-gradient(90deg, #3b82f6, #0d9488); }
.quota-fill.warn { background: linear-gradient(90deg, #f59e0b, #d97706); }
.quota-fill.danger { background: linear-gradient(90deg, #ef4444, #b91c1c); }
.quota-foot { margin-top: 4px; font-size: 11px; color: var(--text-3); }
.quota-td { min-width: 92px; }
.quota-cell { font-size: 11.5px; line-height: 1.5; color: var(--text-2); white-space: nowrap; }

/* ---------- 域名验证信息 ---------- */
.domain-verify { display: flex; flex-direction: column; gap: 5px; align-items: flex-start; }
.verify-token {
  font-family: var(--mono); font-size: 10.5px; color: var(--text-2);
  background: var(--surface-2); border: 1px dashed var(--border); border-radius: 5px;
  padding: 1px 6px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
p.small.danger { color: var(--danger); }

@media (max-width: 720px) {
  .totp-secret .k { flex-basis: 100%; }
}

@media (max-width: 560px) {
  .quota-cell { font-size: 11px; }
  .totp-secret { padding: 8px 9px; }
}

/* ==========================================================================
   v1.5 多端与权限视图：动态导航 / 无权访问 / 移动端折叠 / 表格横向滚动
   ========================================================================== */

.nav-toggle { display: none; }
.quick-links { display: flex; gap: 10px; flex-wrap: wrap; }
.no-access-card .state-block { padding: 72px 24px; }
.no-access-card .state-block p { max-width: 520px; }
.notice-inline { margin-bottom: 12px; }

/* 动态导航：图标与文字保持 v1.2 侧栏风格 */
.nav-item svg { flex: 0 0 17px; }

/* 移动端：导航默认折叠，点 ☰ 菜单展开 */
@media (max-width: 900px) {
  .nav-toggle { display: inline-flex; }
  .nav {
    display: none;
    flex-direction: column;
    gap: 4px;
    padding: 6px 10px 10px;
    max-height: 48vh;
    overflow-y: auto;
  }
  .nav.open { display: flex; }
  .nav-item { width: 100%; padding: 10px 12px; }
  .nav-item .nav-badge { display: inline-block; }
  .sidebar-foot { padding: 10px 16px; }
}

/* 移动端：表格横向滚动（不再压缩列），卡片/统计自然堆叠 */
@media (max-width: 720px) {
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-wrap table.table { min-width: 640px; }
  .section-grid, .site-grid { grid-template-columns: 1fr; }
  .quick-links { flex-direction: column; align-items: stretch; }
  .quick-links .btn { width: 100%; justify-content: center; }
  .no-access-card .state-block { padding: 48px 16px; }
}


/* ==========================================================================
   v1.6 订阅 banner / 附件 / 待人工 / 健康
   ========================================================================== */
.sub-banner { padding: 9px 28px; background: #fdf3e2; border-bottom: 1px solid #f5e1bd; color: #92400e; font-size: 12.5px; }
.sub-banner.hidden { display: none; }
.sub-banner-inner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.sub-banner-title { font-weight: 650; }
.sub-banner-meta { color: #a16207; }
body.sub-blocked #content button.btn-primary,
body.sub-blocked #content button.btn-danger,
body.sub-blocked #composer-send,
body.sub-blocked #composer-attach { opacity: 0.5; cursor: not-allowed; }
body.sub-blocked .composer textarea { background: var(--surface-2); }

.hidden-file { display: none; }
.attachment-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 14px; border-top: 1px solid var(--border); background: var(--surface-2);
}
.attachment-chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  padding: 3px 9px; border-radius: 999px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text-2); font-size: 11.5px; cursor: pointer;
  font-family: var(--font); line-height: 1.6;
}
.attachment-chip:hover { border-color: var(--primary); color: var(--primary-strong); }
.attachment-chip .chip-clear {
  border: 0; background: transparent; color: var(--text-3); cursor: pointer;
  font-size: 13px; line-height: 1; padding: 0 2px;
}
.attachment-chip .chip-clear:hover { color: var(--danger); }
.msg-attachments { margin-top: 6px; }
.msg-attachments .attachment-chip { font-size: 11px; }


/* ==========================================================================
   v1.7 知识库上传/版本/评测 + 服务设置 + SLA/CSAT 报表
   ========================================================================== */
.kb-page .console-toolbar { margin-top: 0; }
.kb-filter-panel { margin-bottom: 14px; }
.kb-filter-panel .toolbar { border-bottom: 0; gap: 8px; }
.kb-filter-panel .input { min-width: 150px; width: auto; }
.kb-table .kb-doc-title { font-size: 13px; font-weight: 600; }
.kb-doc-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 3px; }
.kb-doc-tags .badge { font-size: 10px; }
.kb-actions { flex-wrap: wrap; }
.kb-preview-results { margin-top: 10px; max-height: 320px; overflow-y: auto; }
.kb-preview-results .hit:first-child { padding-top: 0; }
.kb-page .search-field { max-width: 360px; }

@media (max-width: 720px) {
  .kb-filter-panel .toolbar { flex-wrap: wrap; }
  .kb-filter-panel .input, .kb-filter-panel .select { flex: 1 1 140px; }
}


/* ==========================================================================
   v1.8 导入/撞单/自动化规则/全局搜索/经营看板
   ========================================================================== */
.global-search { position: relative; display: flex; align-items: center; gap: 6px; }
.global-search .input { width: 250px; height: 32px; font-size: 12px; }
.global-search .search-toggle { display: none; }
.search-dropdown {
  position: absolute; right: 0; top: calc(100% + 8px); width: 420px; max-height: 62vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 12px;
  box-shadow: var(--shadow-lg); padding: 8px; z-index: 80;
}
.search-total { padding: 6px 8px; }
.search-group { padding: 4px 0; border-top: 1px solid var(--border); }
.search-group:first-of-type { border-top: 0; }
.search-group-title { font-size: 11px; color: var(--text-3); padding: 6px 8px 3px; letter-spacing: 0.04em; }
.search-item {
  display: block; width: 100%; text-align: left; border: 0; background: transparent;
  padding: 7px 8px; border-radius: 7px; font: inherit; font-size: 12.5px; color: var(--text-2); cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.search-item:hover { background: var(--surface-2); color: var(--text); }
.search-empty { padding: 16px 12px; text-align: center; color: var(--text-3); font-size: 12.5px; }
@media (max-width: 900px) {
  .global-search .input { width: 170px; }
}
@media (max-width: 700px) {
  .global-search .input { display: none; }
  .global-search .search-toggle { display: inline-flex; }
  .global-search.search-open .input {
    display: block; position: absolute; right: 0; top: 38px; width: min(78vw, 320px); z-index: 90;
    box-shadow: var(--shadow-lg);
  }
  .global-search.search-open .search-dropdown { top: 78px; width: min(88vw, 360px); }
}
.funnel-list { display: flex; flex-direction: column; gap: 9px; }
.funnel-row { display: flex; align-items: center; gap: 10px; }
.funnel-label { flex: 0 0 84px; font-size: 12px; color: var(--text-2); }
.funnel-track { flex: 1; height: 16px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.funnel-fill { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--primary), var(--primary-strong)); }
.funnel-value { flex: 0 0 60px; text-align: right; font-family: var(--font-mono); font-size: 12px; color: var(--text-2); }
.dedupe-list { display: flex; flex-direction: column; gap: 12px; max-height: 58vh; overflow-y: auto; }
.dedupe-group { border: 1px solid var(--border); border-radius: 10px; padding: 10px; background: var(--surface-2); }
.dedupe-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.dedupe-leads { display: flex; flex-direction: column; gap: 5px; margin-bottom: 8px; }
.dedupe-item { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-2); }
.dedupe-item input { margin: 0; }


/* ==========================================================================
   v1.9 渠道接入中心（验签/缺配置/联调）+ 邮件设置
   ========================================================================== */
.channel-card-v19 { gap: 8px; }
.cc-status-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cc-docs { font-size: 11.5px; color: var(--primary-strong); text-decoration: none; }
.cc-docs:hover { text-decoration: underline; }
.cc-note { margin: 2px 0; }
.cc-missing { border: 1px solid #f3d3a3; background: #fdf6ea; border-radius: 9px; padding: 9px 11px; font-size: 12px; color: #8a5a12; }
.cc-missing ul { margin: 6px 0 4px 16px; padding: 0; }
.cc-missing li { margin: 3px 0; word-break: break-word; }
.cc-missing code { background: rgba(255,255,255,0.65); padding: 1px 5px; border-radius: 4px; font-family: var(--font-mono); font-size: 11px; }
.cc-stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.cc-stat-grid .k { display: block; font-size: 10.5px; color: var(--text-3); margin-bottom: 2px; }
.cc-stat-grid .v { display: block; font-size: 12px; color: var(--text-2); word-break: break-all; }
.cc-stat-grid .danger-text { color: var(--danger); }
.cc-test-badges { display: flex; gap: 8px; flex-wrap: wrap; }
.cc-test-result pre { max-height: 260px; overflow: auto; }
@media (max-width: 720px) {
  .cc-stat-grid { grid-template-columns: 1fr; }
}


/* ==========================================================================
   v1.10 站点嵌入码 / 渠道矩阵 / 新渠道与规划渠道
   ========================================================================== */
.channel-matrix td { vertical-align: top; }
.cc-matrix-name { font-weight: 600; font-size: 13px; }
.cc-matrix-missing code { display: inline-block; margin: 1px 3px 1px 0; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; font-size: 10.5px; font-family: var(--font-mono); }
.cc-template { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; padding: 6px 9px; background: var(--surface-2); border-radius: 8px; }
.cc-template code { font-size: 11px; font-family: var(--font-mono); word-break: break-all; color: var(--text-2); }
.planned-card { opacity: 0.92; border-style: dashed; }
.planned-card .cc-head { align-items: center; }
.site-embed-hint { margin-top: 10px; }


/* v1.10 长弹窗（联调测试）内部滚动，避免确认按钮超出视口 */
.modal-card { max-height: calc(100vh - 40px); display: flex; flex-direction: column; }
#modal-form { display: flex; flex-direction: column; min-height: 0; }
.modal-body { overflow-y: auto; min-height: 0; }
.modal-foot { flex: 0 0 auto; }


/* ==========================================================================
   v1.11 报价单 + 客户档案时间线
   ========================================================================== */
.quote-items-table .input { min-width: 92px; }
.quote-items-table td { vertical-align: middle; }
.quote-total-line { text-align: right; font-size: 13px; color: var(--text-2); }
.quote-total-line strong { font-size: 16px; color: var(--text); font-family: var(--font-mono); }
.customer-name { font-weight: 600; font-size: 13px; }
.timeline { display: flex; flex-direction: column; gap: 2px; max-height: 300px; overflow-y: auto; padding-left: 4px; }
.timeline-item { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--border); }
.timeline-item:last-child { border-bottom: 0; }
.timeline-dot { flex: 0 0 8px; width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: var(--primary); }
.timeline-dot.quote { background: #d97706; }
.timeline-body { flex: 1; min-width: 0; }
.timeline-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; }
.timeline-detail { margin-top: 3px; white-space: pre-wrap; }
@media (max-width: 720px) {
  .quote-items-table { min-width: 620px; }
}


/* ==========================================================================
   v1.12 邮件营销 + PWA 安装提示
   ========================================================================== */
.scope-tabs { display: inline-flex; gap: 4px; background: var(--surface-2); padding: 3px; border-radius: 9px; }
.pwa-install-banner {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 200;
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 12px;
  box-shadow: var(--shadow-lg); font-size: 12.5px; color: var(--text-2); max-width: calc(100vw - 28px);
}
@media (max-width: 720px) {
  .pwa-install-banner { left: 12px; right: 12px; transform: none; flex-wrap: wrap; }
}


/* ==========================================================================
   v1.13 会话转接 / 内部备注 / 今日待跟进
   ========================================================================== */
.notes-panel { border-top: 1px solid var(--border); background: #fffaf0; padding: 10px 14px; }
.notes-panel.hidden { display: none; }
.notes-head { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 650; color: #8a5a12; margin-bottom: 8px; }
.notes-list { max-height: 160px; overflow-y: auto; display: flex; flex-direction: column; gap: 7px; margin-bottom: 8px; }
.note-item { background: #fff; border: 1px solid #f3e2c0; border-radius: 8px; padding: 7px 9px; }
.note-meta { font-size: 11px; color: var(--text-3); margin-bottom: 3px; }
.note-text { font-size: 12.5px; color: var(--text-2); white-space: pre-wrap; word-break: break-word; }
.notes-compose { display: flex; gap: 8px; align-items: flex-end; }
.notes-compose .textarea { flex: 1; min-height: 42px; }


/* ==========================================================================
   v1.15 开发者（API Key / Webhook）+ 报表订阅
   ========================================================================== */
.check-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 12px; }
.check-item { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-2); }
.check-item input { margin: 0; }
.check-item code { font-size: 10.5px; }
.mono { font-family: var(--font-mono); }
@media (max-width: 640px) {
  .check-grid { grid-template-columns: 1fr; }
}


/* ==========================================================================
   v1.16 设计系统升级：层级/组件/导航/通知/看板/移动端
   ========================================================================== */
:root {
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 24px; --space-6: 32px;
  --text-xs: 11px; --text-sm: 12px; --text-base: 13.5px; --text-lg: 16px; --text-xl: 20px; --text-2xl: 26px;
  --radius-lg: 16px; --radius-pill: 999px;
  --shadow-lg: 0 20px 45px -20px rgba(16, 24, 40, 0.35);
}
body { font-size: var(--text-base); }
.btn { border-radius: var(--radius-sm); font-weight: 600; transition: background .15s ease, border-color .15s ease, box-shadow .15s ease, transform .05s ease; }
.btn:active { transform: translateY(1px); }
.btn-primary { box-shadow: 0 6px 16px -8px rgba(37, 99, 235, 0.65); }
.input, .select, .textarea { border-radius: var(--radius-sm); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14); outline: 0; }
.table thead th { font-size: var(--text-xs); letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); background: var(--surface-2); }
.table tbody tr { transition: background .12s ease; }
.table tbody tr:hover { background: #f7faff; }
.panel { border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.badge { border-radius: var(--radius-pill); font-weight: 600; }
.skeleton-wrap { display: flex; flex-direction: column; gap: 12px; padding: 4px 0; }
.skeleton { background: linear-gradient(90deg, #eef2f7 25%, #f8fafc 37%, #eef2f7 63%); background-size: 400% 100%; animation: shimmer 1.3s ease infinite; border-radius: 8px; }
.skeleton-title { height: 22px; width: 220px; }
.skeleton-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.skeleton-card { height: 86px; }
.skeleton-row { height: 44px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 34px 16px; text-align: center; color: var(--text-3); }
.empty-state .empty-icon { width: 44px; height: 44px; opacity: .55; }
.empty-state h4 { margin: 0; font-size: var(--text-lg); color: var(--text-2); }
.empty-state p { margin: 0; font-size: var(--text-sm); }
.empty-inline { padding: 10px 2px; color: var(--text-3); font-size: var(--text-sm); text-align: center; }
.pagination { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.batch-bar { display: flex; align-items: center; gap: 10px; padding: 8px 14px; margin: 0 0 8px; background: var(--primary-weak); border: 1px solid #cfe0fd; border-radius: var(--radius-sm); font-size: var(--text-sm); }
.batch-bar.hidden { display: none; }
.check-col { width: 34px; text-align: center; }
.nav-group-label { padding: 12px 14px 4px; font-size: 10px; letter-spacing: .12em; color: #6b778c; text-transform: uppercase; }
.breadcrumb { display: flex; align-items: center; gap: 7px; padding: 10px 24px 0; font-size: var(--text-xs); color: var(--text-3); }
.breadcrumb .crumb-current { color: var(--text-2); font-weight: 600; }
.breadcrumb .crumb-sep { color: var(--border-strong); }
.notif-wrap { position: relative; }
.notif-bell { position: relative; font-size: 15px; }
.notif-badge { position: absolute; top: 1px; right: 0; min-width: 15px; height: 15px; padding: 0 4px; border-radius: var(--radius-pill); background: var(--danger); color: #fff; font-size: 9.5px; line-height: 15px; text-align: center; }
.notif-badge.hidden { display: none; }
.notif-panel { position: absolute; right: 0; top: calc(100% + 8px); width: 340px; max-height: 60vh; overflow: hidden; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); z-index: 90; }
.notif-panel.hidden { display: none; }
.notif-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: var(--text-sm); }
.notif-list { overflow-y: auto; }
.notif-item { display: flex; gap: 9px; width: 100%; text-align: left; border: 0; background: transparent; padding: 10px 12px; cursor: pointer; border-bottom: 1px dashed var(--border); }
.notif-item:hover { background: var(--surface-2); }
.notif-item.read { opacity: .62; }
.notif-dot { flex: 0 0 7px; width: 7px; height: 7px; margin-top: 5px; border-radius: 50%; background: var(--primary); }
.notif-item.read .notif-dot { background: var(--border-strong); }
.notif-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.notif-title { font-size: var(--text-sm); font-weight: 650; color: var(--text); }
.notif-text { font-size: var(--text-xs); color: var(--text-2); }
.notif-time { font-size: 10.5px; color: var(--text-3); }
.notif-empty { padding: 26px 12px; text-align: center; color: var(--text-3); font-size: var(--text-sm); }
.kpi-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px 16px; box-shadow: var(--shadow-sm); }
.kpi-label { font-size: var(--text-xs); color: var(--text-3); letter-spacing: .03em; }
.kpi-value { font-size: var(--text-2xl); font-weight: 700; color: var(--text); margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.kpi-foot { font-size: var(--text-xs); color: var(--text-3); }
.kpi-card.accent-green .kpi-value { color: var(--success); }
.kpi-card.accent-blue .kpi-value { color: var(--primary); }
.kpi-card.accent-teal .kpi-value { color: #0f766e; }
.kpi-card.accent-amber .kpi-value { color: var(--warn); }
.dash-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.dash-trend { grid-column: 1 / -1; }
.trend-svg { width: 100%; height: 170px; }
.trend-line { fill: none; stroke: var(--primary); stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.trend-dot { fill: #fff; stroke: var(--primary); stroke-width: 2; }
.trend-axis { stroke: var(--border); stroke-dasharray: 4 4; }
.trend-label { font-size: 10px; fill: var(--text-3); }
.activity-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.activity-item { display: flex; gap: 9px; font-size: var(--text-sm); color: var(--text-2); }
.activity-dot { flex: 0 0 7px; width: 7px; height: 7px; margin-top: 6px; border-radius: 50%; background: var(--primary-weak); border: 2px solid var(--primary); }
.mobile-nav { display: none; }
@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dash-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .breadcrumb { padding: 8px 14px 0; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-value { font-size: var(--text-xl); }
  .mobile-nav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 120; background: var(--surface); border-top: 1px solid var(--border); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .mobile-nav button { flex: 1; border: 0; background: transparent; font-size: 11px; color: var(--text-3); padding: 5px 0; display: flex; flex-direction: column; align-items: center; gap: 2px; }
  .mobile-nav button:hover { color: var(--primary); }
  .main { padding-bottom: 66px; }
  .modal-root { align-items: flex-end; }
  .modal-card { max-width: none; border-radius: var(--radius-lg) var(--radius-lg) 0 0; max-height: 88vh; }
  .notif-panel { position: fixed; left: 12px; right: 12px; width: auto; top: 58px; }
}


/* v1.16 会话智能建议 */
.chat-suggest { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 7px 14px; border-top: 1px solid var(--border); background: var(--surface-2); }
.chat-suggest.hidden { display: none; }
.suggest-label { font-size: 11px; color: var(--text-3); }
.suggest-chip { border: 1px solid #cfe0fd; background: var(--primary-weak); color: var(--primary-strong); border-radius: var(--radius-pill); padding: 3px 10px; font-size: 11.5px; cursor: pointer; }
.suggest-chip:hover { background: #dbe8fe; }


/* ==========================================================================
   v1.17 客服质检 / 客户合并
   ========================================================================== */
.qc-stars { display: flex; align-items: center; gap: 4px; margin-bottom: 8px; }
.qc-star { border: 0; background: transparent; font-size: 26px; line-height: 1; color: var(--border-strong); cursor: pointer; padding: 0 2px; }
.qc-star.active { color: #f59e0b; }
.qc-score-text { margin-left: 8px; font-size: 12px; color: var(--text-2); }
.qc-tag-list { display: flex; flex-wrap: wrap; gap: 8px; }
.qc-tag-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: var(--radius-pill); background: var(--surface-2); border: 1px solid var(--border); font-size: 12px; color: var(--text-2); }
.qc-tag-chip strong { color: var(--primary); }


/* ==========================================================================
   v1.18 目标与业绩 / 成交金额 / 向量索引卡
   ========================================================================== */
.perf-progress { margin: 8px 0; }
.perf-progress-head { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-2); margin-bottom: 5px; }
.perf-track { height: 10px; background: var(--surface-3); border-radius: var(--radius-pill); overflow: hidden; }
.perf-fill { height: 100%; border-radius: var(--radius-pill); background: linear-gradient(90deg, var(--primary), var(--primary-strong)); }
.kb-embed-card { margin-bottom: 12px; }
.kb-embed-card .panel-body { padding: 10px 14px; }


/* v1.19 手机推送 / 话术库语言 */
.notif-foot { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-top: 1px solid var(--border); background: var(--surface-2); flex-wrap: wrap; }
.notif-foot .btn { flex: 0 0 auto; }


/* v1.20 账单收款 */
.pay-list { display: flex; flex-direction: column; gap: 6px; }
.pay-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.pay-row .k { flex: 0 0 78px; font-size: 12px; color: var(--text-3); }
.pay-row .v { flex: 1; font-size: 12.5px; color: var(--text-2); word-break: break-all; }


/* ==========================================================================
   v1.21 订单 / 工单 / 分佣
   ========================================================================== */
.ticket-messages { display: flex; flex-direction: column; gap: 8px; max-height: 240px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px; background: var(--surface-2); }
.ticket-msg { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 7px 9px; }
.ticket-msg.internal { background: #fffaf0; border-color: #f3e2c0; }
.ticket-msg-text { font-size: 12.5px; color: var(--text-2); white-space: pre-wrap; margin-top: 3px; }


/* v1.23 AI 会话摘要 / 意向评分 */
.score-cell { display: inline-flex; align-items: center; gap: 5px; }
.score-big { font-size: 18px; font-weight: 700; color: var(--text-1); }
.summary-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.summary-text { font-size: 13px; line-height: 1.65; color: var(--text-2); margin: 0 0 12px; white-space: pre-wrap; }
.summary-section h4 { font-size: 12px; color: var(--text-3); margin: 10px 0 5px; font-weight: 600; }
.summary-list { margin: 0; padding-left: 18px; font-size: 12.5px; color: var(--text-2); line-height: 1.7; }
.score-line { display: flex; align-items: center; gap: 10px; }
.detail-grid { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.detail-row { display: flex; gap: 10px; font-size: 12.5px; }
.detail-row .k { flex: 0 0 74px; color: var(--text-3); }
.detail-row .v { flex: 1; color: var(--text-2); }


/* v1.25 页脚版本 */
.app-footer { display: flex; align-items: center; gap: 6px; padding: 12px 24px 16px; color: var(--text-3); font-size: 11.5px; flex-wrap: wrap; }
.app-footer-dot { opacity: .5; }
@media (max-width: 640px) { .app-footer { padding: 10px 14px 76px; } }


/* v1.26 信息架构 / 设置中心 / 扫码接入 */
.nav-group-label { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); padding: 12px 12px 4px; font-weight: 600; }
.settings-hero { margin-bottom: 14px; }
.settings-hero h3 { margin: 0 0 4px; font-size: 16px; }
.settings-hero p { margin: 0; font-size: 12.5px; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.settings-card { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 14px; display: flex; flex-direction: column; gap: 6px; box-shadow: var(--shadow-xs); }
.settings-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.settings-card-head h3 { margin: 0; font-size: 13.5px; }
.settings-card-value { font-size: 17px; font-weight: 700; color: var(--text-1); }
.settings-card-meta { margin: 0; font-size: 12px; color: var(--text-3); line-height: 1.5; min-height: 18px; }
.settings-card-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; padding-top: 4px; }
.oauth-qr-wrap { display: flex; justify-content: center; padding: 10px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 10px; }
.oauth-qr { width: 220px; height: 220px; object-fit: contain; image-rendering: pixelated; }
@media (max-width: 640px) {
  .settings-grid { grid-template-columns: 1fr; }
  .oauth-qr { width: 180px; height: 180px; }
}


/* v1.27 异步任务中心 / 上传进度 / 自助门户 */
.progress { height: 8px; background: var(--surface-3); border-radius: var(--radius-pill); overflow: hidden; }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--primary), var(--primary-strong)); border-radius: var(--radius-pill); transition: width .25s ease; }
.kb-job-panel { margin-bottom: 12px; }
.kb-job-panel .panel-body { padding: 10px 14px; }
.kb-job-head { display: flex; align-items: center; gap: 10px; }


/* v1.28 平台经营看板 */
.kb-bar { fill: rgba(59, 130, 246, .18); }


/* v1.31 AI 摘要结构化区 */
.summary-facts { border-top: 1px dashed var(--border); padding-top: 10px; }
.summary-facts-grid { display: flex; flex-direction: column; gap: 6px; }
.summary-fact { display: flex; gap: 10px; font-size: 12.5px; align-items: flex-start; }
.summary-fact .k { flex: 0 0 72px; color: var(--text-3); font-size: 12px; }
.summary-fact .v { flex: 1; color: var(--text-2); line-height: 1.6; }
.summary-chip { margin: 0 3px 3px 0; display: inline-block; }


/* v1.36 站内公告 */
.announcement-bar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; margin-bottom: 14px; border: 1px solid #bfdbfe; background: #eff6ff; border-radius: var(--radius-md); font-size: 13px; }
.announcement-bar.warn { border-color: #fcd34d; background: #fffbeb; }
.announcement-bar .announcement-text { flex: 1; color: var(--text-2); }
.announcement-item { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 8px; background: var(--surface-1); }
.announcement-item.read { opacity: .75; }
.announcement-item-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.announcement-item-body { margin-top: 6px; font-size: 12.5px; color: var(--text-2); white-space: pre-wrap; line-height: 1.6; }


/* v1.37 公告分页/正文滚动 + 深度健康 */
.announcement-item-body { max-height: 240px; overflow-y: auto; }
.announcement-item-body p { margin: 0 0 4px; }
.ann-pager { display: flex; align-items: center; gap: 8px; margin-top: 8px; }


/* v1.38 公告轻量 markdown */
.announcement-item-body ul, .announcement-item-body ol { margin: 4px 0 6px; padding-left: 22px; }
.announcement-item-body li { margin: 2px 0; }
.announcement-item-body strong { color: var(--text-1); }


/* v1.39 全局搜索标题/副标题 */
.search-item-title { display: block; font-size: 12.5px; color: var(--text-1); }
.search-item-sub { display: block; font-size: 11px; margin-top: 2px; }


/* v1.40 演示环境徽标 */
.env-demo-badge { margin-right: 4px; white-space: nowrap; }


/* ==========================================================================
   v1.41 P3：深色模式 / PWA 顶部一次提示 / 移动端菜单高度
   ========================================================================== */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e131c;
    --surface: #171e2a;
    --surface-1: #171e2a;
    --surface-2: #1d2533;
    --surface-3: #263043;
    --border: #2a3547;
    --border-strong: #3a475d;
    --text: #e8edf6;
    --text-2: #b3bfd1;
    --text-3: #8b99ad;
    --primary: #60a5fa;
    --primary-strong: #3b82f6;
    --primary-weak: rgba(96, 165, 250, 0.16);
    --success: #4ade80;
    --success-weak: rgba(74, 222, 128, 0.14);
    --warn: #fbbf24;
    --warn-weak: rgba(251, 191, 36, 0.14);
    --danger: #f87171;
    --danger-weak: rgba(248, 113, 113, 0.14);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.5), 0 8px 24px -12px rgba(0, 0, 0, 0.65);
  }
  html, body { background: var(--bg); color: var(--text); }
  .boot { background: var(--bg); color: var(--text-2); }
  .table tbody tr:hover { background: rgba(255, 255, 255, 0.03); }
  .notes-panel { background: #2a2418; border-color: #4a3b1f; }
  .note-item { background: var(--surface-2); border-color: var(--border); }
  .ticket-msg { background: var(--surface-2); }
  .ticket-msg.internal { background: #2a2418; border-color: #4a3b1f; }
  .sub-banner { background: #2a2418; border-color: #4a3b1f; color: #fcd34d; }
  .sub-banner-meta { color: #fbbf24; }
  .announcement-bar { background: rgba(59, 130, 246, 0.14); border-color: #1e3a5f; }
  .announcement-bar.warn { background: rgba(245, 158, 11, 0.14); border-color: #5a4418; }
  .input::placeholder, .textarea::placeholder { color: var(--text-3); }
  .oauth-qr-wrap { background: #fff; }
  .brand-mark.has-logo { background: #fff; }
}

/* PWA 安装提示改为顶部一次性 toast，不遮挡底部移动导航 */
.pwa-install-banner {
  top: 12px;
  bottom: auto;
  z-index: 200;
}
@media (max-width: 720px) {
  .pwa-install-banner { top: 10px; bottom: auto; left: 12px; right: 12px; transform: none; }
}

/* 移动端汉堡菜单：展开后限制高度并可滚动 */
@media (max-width: 900px) {
  .nav { max-height: 60vh; overflow-y: auto; }
  .nav.open { display: flex; max-height: 60vh; overflow-y: auto; -webkit-overflow-scrolling: touch; }
}


/* 小屏（375×667 等）汉堡菜单进一步收紧，保证正文仍在首屏可见 */
@media (max-width: 900px) and (max-height: 700px) {
  .nav.open { max-height: 52vh; }
}


/* ==========================================================================
   v1.42 N-4/N-5/N-17：移动端触控尺寸 / 输入字号 / 深色表格 hover 特异性
   ========================================================================== */
@media (max-width: 720px) {
  .mobile-nav button { min-height: 44px; min-width: 44px; padding: 6px 0; }
  .pwa-install-banner .btn { min-height: 44px; min-width: 44px; }
  .input, .select, .textarea, .global-search .input { font-size: 16px; }
}
@media (prefers-color-scheme: dark) {
  table.table tbody tr:hover { background: rgba(255, 255, 255, 0.03); }
}


/* v1.42 P2 复验：移动端全局可点元素 ≥44px */
@media (max-width: 720px) {
  button, a.btn { min-height: 44px; }
  .btn, .btn-xs, .btn-sm, .btn-outline, .btn-primary, .btn-danger, .btn-ghost {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .nav-item { min-height: 44px; }
  .cell-actions { flex-wrap: wrap; }
}


/* v1.44 列表分页加载更多 */
.load-more-bar { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 12px; border-top: 1px solid var(--border); }
