/* ==========================================================================
   GEO 资讯站 · 后台管理界面样式
   与前台共用同一套设计语言（主色 #1f4ed8 / 中性灰阶 / 圆角 10-14px）
   ========================================================================== */

:root {
  --ink: #101828;
  --ink-2: #475467;
  --ink-3: #667085;
  --ink-4: #98a2b3;
  --line: #e4e7ec;
  --line-2: #f0f1f4;
  --bg: #ffffff;
  --bg-soft: #f7f8fa;
  --bg-deep: #f1f3f7;
  --brand: #1f4ed8;
  --brand-dark: #163da8;
  --brand-soft: #eef2ff;
  --ok: #0f6e56;
  --ok-bg: #ecfdf3;
  --warn: #b54708;
  --warn-bg: #fffaeb;
  --danger: #b42318;
  --danger-bg: #fef3f2;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .12);
  --sidebar-w: 232px;
}

* { box-sizing: border-box; }

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

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }
h1, h2, h3, h4 { margin: 0; line-height: 1.35; }
p { margin: 0 0 1em; }
code, pre, .mono { font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace; }

.boot-screen { padding: 80px; text-align: center; color: var(--ink-3); }

/* ------------------------------ 布局 ------------------------------ */

.app-shell { min-height: 100vh; }

.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.side-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 8px 18px;
  border-bottom: 1px solid var(--line-2);
  margin-bottom: 12px;
}
.side-mark {
  width: 32px; height: 32px; border-radius: 9px; background: var(--brand); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 15px; flex: 0 0 32px;
}
.side-brand-text { font-weight: 600; font-size: 14px; line-height: 1.3; }
.side-brand-text small { display: block; color: var(--ink-3); font-weight: 400; font-size: 12px; }

.side-group { font-size: 11.5px; color: var(--ink-4); letter-spacing: .08em; text-transform: uppercase; padding: 14px 10px 6px; }
.side-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--radius-sm);
  color: var(--ink-2); font-size: 14px; cursor: pointer; border: none; background: none;
  width: 100%; text-align: left;
}
.side-link:hover { background: var(--bg-soft); color: var(--ink); }
.side-link.is-active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.side-link .ico { width: 18px; text-align: center; font-size: 15px; opacity: .85; }
.side-link .badge {
  margin-left: auto; background: var(--danger-bg); color: var(--danger);
  font-size: 11px; padding: 1px 7px; border-radius: 20px; font-weight: 600;
}
.side-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line-2); }

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

.topbar {
  height: 62px; background: rgba(255,255,255,.94); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); display: flex; align-items: center;
  justify-content: space-between; gap: 16px; padding: 0 24px;
  position: sticky; top: 0; z-index: 30;
}
.topbar h1 { font-size: 17px; font-weight: 600; }
.topbar-sub { font-size: 12.5px; color: var(--ink-3); }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.content { padding: 24px; max-width: 1280px; width: 100%; }
.content-wide { max-width: none; }

/* ------------------------------ 组件 ------------------------------ */

.card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 22px; box-shadow: var(--shadow);
}
.card + .card { margin-top: 18px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.card-head h2 { font-size: 16px; font-weight: 600; }
.card-head p { margin: 4px 0 0; font-size: 13px; color: var(--ink-3); }
.card-sub { font-size: 12.5px; color: var(--ink-3); }

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-editor { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }

@media (max-width: 1100px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-editor { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: -100%; z-index: 60; transition: left .2s ease; }
  .sidebar.is-open { left: 0; box-shadow: var(--shadow-lg); }
  .content { padding: 16px; }
}

.stat-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.stat-card .n { font-size: 26px; font-weight: 700; color: var(--brand); line-height: 1.2; }
.stat-card .l { font-size: 12.5px; color: var(--ink-3); }
.stat-card.is-warn .n { color: var(--warn); }
.stat-card.is-danger .n { color: var(--danger); }
.stat-card.is-ok .n { color: var(--ok); }

/* --------------------------- 数据看板 --------------------------- */

.chart-box { width: 100%; overflow-x: auto; }
.chart-box svg { display: block; width: 100%; height: auto; min-width: 520px; }

.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 12.5px; color: var(--ink-2); margin-bottom: 10px; }
.legend span { display: inline-flex; align-items: center; }
.legend i { width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; flex: 0 0 10px; }

.bar-list { display: flex; flex-direction: column; gap: 11px; }
.bar-row { display: grid; grid-template-columns: minmax(110px, 1.2fr) minmax(60px, 2fr) auto; gap: 12px; align-items: center; font-size: 13px; }
.bar-label { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-label a { color: var(--ink); }
.bar-label a:hover { color: var(--brand); }
.bar-track { height: 8px; background: var(--bg-deep); border-radius: 4px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--brand); border-radius: 4px; transition: width .3s ease; }
.bar-fill.is-ai { background: #7c3aed; }
.bar-fill.is-bot { background: var(--ok); }
.bar-fill.is-warn { background: var(--warn); }
.bar-val { min-width: 76px; text-align: right; font-size: 12.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

.dash-mini > div { min-width: 0; }
.dash-mini .mini-n { font-size: 19px; font-weight: 700; color: var(--ink); line-height: 1.3; }
.dash-mini .mini-l { font-size: 12px; color: var(--ink-3); }

@media (max-width: 760px) {
  .bar-row { grid-template-columns: minmax(90px, 1fr) 1.4fr auto; gap: 8px; font-size: 12.5px; }
  .bar-val { min-width: 60px; }
}

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: var(--radius-sm); border: 1px solid var(--brand);
  background: var(--brand); color: #fff; font-size: 13.5px; font-weight: 500;
  cursor: pointer; font-family: inherit; transition: .16s ease; white-space: nowrap;
}
.btn:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-ghost { background: #fff; color: var(--ink-2); border-color: var(--line); }
.btn-ghost:hover { background: var(--bg-soft); color: var(--ink); border-color: #d0d5dd; }
.btn-danger { background: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: #912018; border-color: #912018; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-block { width: 100%; }
.btn-link {
  background: none; border: none; color: var(--brand); cursor: pointer;
  padding: 2px 4px; font-size: 13px; font-family: inherit;
}
.btn-link:hover { text-decoration: underline; }
.btn-link.is-danger { color: var(--danger); }

/* 表单 */
.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--ink); }
.field .hint { font-size: 12px; color: var(--ink-3); margin-top: 5px; line-height: 1.5; }
.field .hint.is-warn { color: var(--warn); }
.field .hint.is-ok { color: var(--ok); }
.field .hint.is-err { color: var(--danger); }
.field input.is-invalid { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(220, 38, 38, .12); }
.modal .form-alert { margin-bottom: 14px; }

input[type="text"], input[type="search"], input[type="password"], input[type="number"],
input[type="email"], input[type="url"], input[type="datetime-local"], select, textarea {
  width: 100%; padding: 8px 11px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-size: 14px; font-family: inherit; color: var(--ink); background: #fff;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(31,78,216,.12);
}
textarea { line-height: 1.65; resize: vertical; }
textarea.code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 13px; line-height: 1.7; min-height: 420px; white-space: pre;
}
.row { display: flex; gap: 12px; }
.row > * { flex: 1; min-width: 0; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.check input { width: auto; }

/* 分享图选择行 + 预览 */
.og-pick-row { display: flex; gap: 8px; align-items: center; }
.og-pick-row input { flex: 1; min-width: 0; }
.og-pick-row .btn { flex: none; white-space: nowrap; }
.og-preview { margin-top: 8px; display: flex; align-items: center; gap: 10px; }
.og-preview img { width: 120px; height: 63px; object-fit: cover; border: 1px solid var(--line); border-radius: 6px; background: var(--bg-soft); }

/* 表格 */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 720px; }
table.data th, table.data td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line-2); }
table.data thead th { background: var(--bg-soft); font-weight: 600; font-size: 12.5px; color: var(--ink-2); white-space: nowrap; }
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: #fcfcfd; }
table.data .col-actions { white-space: nowrap; text-align: right; }

/* 标签 / 徽章 */
.tag {
  display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11.5px;
  font-weight: 600; background: var(--bg-deep); color: var(--ink-2);
}
.tag-ok { background: var(--ok-bg); color: var(--ok); }
.tag-warn { background: var(--warn-bg); color: var(--warn); }
.tag-danger { background: var(--danger-bg); color: var(--danger); }
.tag-brand { background: var(--brand-soft); color: var(--brand); }

/* 检查项 */
.check-list { display: flex; flex-direction: column; gap: 8px; }
.check-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; }
.check-item .dot-ico { width: 18px; height: 18px; border-radius: 50%; flex: 0 0 18px; display: grid; place-items: center; font-size: 11px; color: #fff; margin-top: 1px; }
.check-item.pass .dot-ico { background: var(--ok); }
.check-item.warn .dot-ico { background: var(--warn); }
.check-item.fail .dot-ico { background: var(--danger); }
.check-item .ci-body { min-width: 0; }
.check-item .ci-label { font-weight: 600; font-size: 13px; }
.check-item .ci-detail { font-size: 12.5px; color: var(--ink-3); word-break: break-all; }

/* 富文本编辑器 */
.editor-toolbar {
  display: flex; flex-wrap: wrap; gap: 4px; padding: 8px; border: 1px solid var(--line);
  border-bottom: none; border-radius: var(--radius-sm) var(--radius-sm) 0 0; background: var(--bg-soft);
  position: sticky; top: 62px; z-index: 20;
}
.tb-btn {
  min-width: 32px; height: 30px; padding: 0 8px; border: 1px solid transparent; background: #fff;
  border-radius: 6px; cursor: pointer; font-size: 13px; font-family: inherit; color: var(--ink-2);
}
.tb-btn:hover { background: var(--brand-soft); color: var(--brand); border-color: #c7d2fe; }
.tb-btn.is-strong { font-weight: 700; }
.tb-btn.is-em { font-style: italic; }
.tb-sep { width: 1px; background: var(--line); margin: 4px 4px; }

.editor-area {
  min-height: 520px; padding: 22px 26px; border: 1px solid var(--line); background: #fff;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm); outline: none; font-size: 15.5px; line-height: 1.85;
}
.editor-area:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(31,78,216,.08); }
.editor-area h2 { font-size: 22px; margin: 26px 0 12px; }
.editor-area h3 { font-size: 18px; margin: 22px 0 10px; }
.editor-area p { margin: 0 0 14px; color: var(--ink-2); }
.editor-area ul, .editor-area ol { padding-left: 24px; margin: 0 0 14px; color: var(--ink-2); }
.editor-area blockquote { border-left: 3px solid var(--brand); background: var(--brand-soft); padding: 12px 16px; margin: 0 0 16px; border-radius: 0 8px 8px 0; }
.editor-area blockquote p { margin: 0; }
.editor-area img { max-width: 100%; height: auto; border-radius: 8px; }
.editor-area img.is-missing-alt { outline: 2px dashed var(--danger); outline-offset: 2px; }
.editor-area pre { background: var(--ink); color: #e4e7ec; padding: 14px 16px; border-radius: 8px; overflow-x: auto; font-size: 13px; }
.editor-area code { background: var(--bg-deep); padding: 1px 5px; border-radius: 4px; font-size: .92em; }
.editor-area pre code { background: none; padding: 0; }
.editor-area table { width: 100%; border-collapse: collapse; margin: 0 0 16px; font-size: 14px; }
.editor-area th, .editor-area td { border: 1px solid var(--line); padding: 8px 10px; }
.editor-area th { background: var(--bg-soft); }
.editor-area a { color: var(--brand); }

/* 图库 */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.media-item { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #fff; }
.media-item.is-missing-alt { border-color: #fda29b; }
.media-thumb { aspect-ratio: 4 / 3; background: var(--bg-deep); display: grid; place-items: center; overflow: hidden; }
.media-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-body { padding: 10px 12px; }
.media-name { font-size: 12px; color: var(--ink-3); word-break: break-all; margin-bottom: 8px; }
.media-body input { font-size: 12.5px; padding: 6px 9px; }
.media-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.media-pick { cursor: pointer; }
.media-pick:hover { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(31,78,216,.1); }

/* 模态 */
.modal-host {
  position: fixed; inset: 0; background: rgba(16,24,40,.45); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.modal-host[hidden] { display: none; }
.modal {
  background: #fff; border-radius: 14px; width: 100%; max-width: 880px; max-height: 86vh;
  display: flex; flex-direction: column; box-shadow: var(--shadow-lg); overflow: hidden;
}
.modal.is-sm { max-width: 460px; }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { font-size: 15.5px; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; background: var(--bg-soft); }
.x-btn { background: none; border: none; font-size: 20px; line-height: 1; color: var(--ink-3); cursor: pointer; padding: 2px 6px; }

/* Toast */
.toast-host { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 10px;
  font-size: 13.5px; box-shadow: var(--shadow-lg); max-width: 380px; animation: toastIn .18s ease;
}
.toast.is-ok { background: var(--ok); }
.toast.is-err { background: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* 账号安全 · 内联结果提示（不随时间消失，替代仅 3 秒的 toast） */
.pwd-msg { margin-top: 12px; font-size: 13px; line-height: 1.6; border-radius: 8px; padding: 10px 12px; }
.pwd-msg.is-err { background: rgba(220, 38, 38, .08); color: var(--danger); border: 1px solid rgba(220, 38, 38, .25); }
.pwd-msg.is-ok { background: rgba(22, 163, 74, .08); color: var(--ok); border: 1px solid rgba(22, 163, 74, .25); }

/* API Key 诊断 */
.key-diag { margin-top: 4px; }
.key-diag:empty { display: none; }
.key-diag ul { margin: 0; padding: 10px 12px 10px 28px; font-size: 12.5px; line-height: 1.7; border-radius: 8px; list-style: disc; }
.key-diag.is-err ul { background: rgba(220, 38, 38, .07); color: var(--danger); border: 1px solid rgba(220, 38, 38, .22); }
.key-diag.is-ok ul { background: rgba(22, 163, 74, .07); color: var(--ok); border: 1px solid rgba(22, 163, 74, .22); }

/* 登录 */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(180deg,#fbfcfe,#eef2ff); }
.login-card { width: 100%; max-width: 400px; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 32px 30px; box-shadow: var(--shadow-lg); }
.login-card h1 { font-size: 20px; margin-bottom: 6px; }
.login-card .sub { color: var(--ink-3); font-size: 13px; margin-bottom: 22px; }
.login-note { font-size: 12.5px; color: var(--ink-3); background: var(--bg-soft); border-radius: 8px; padding: 10px 12px; margin-top: 16px; line-height: 1.6; }

/* 预览面板 */
.preview-box {
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 14px 16px; font-family: "SFMono-Regular", Consolas, monospace; font-size: 12.5px;
  line-height: 1.7; white-space: pre-wrap; word-break: break-word; max-height: 460px; overflow: auto;
}
.serp { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px; background: #fff; }
.serp .s-url { font-size: 12.5px; color: var(--ok); margin-bottom: 4px; word-break: break-all; }
.serp .s-title { font-size: 17px; color: #1a0dab; margin-bottom: 4px; }
.serp .s-desc { font-size: 13px; color: var(--ink-2); }

.empty { text-align: center; color: var(--ink-3); padding: 36px 16px; font-size: 13.5px; }
.split-line { height: 1px; background: var(--line-2); margin: 18px 0; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 18px; }
.mb-1 { margin-bottom: 10px; }
.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 20px;
  border: 1px solid var(--line); background: #fff; color: var(--ink-2); font-size: 13px; cursor: pointer;
}
.chip:hover { border-color: #c7d2fe; color: var(--brand); }
.chip.is-active { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip i { font-style: normal; font-size: 11px; opacity: .75; }

.progress { height: 6px; border-radius: 4px; background: var(--bg-deep); overflow: hidden; margin-top: 6px; }
.progress > span { display: block; height: 100%; background: var(--ok); }
.progress.is-warn > span { background: var(--warn); }
.progress.is-danger > span { background: var(--danger); }

.spinner {
  width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff;
  border-radius: 50%; animation: spin .7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.var-table { width: 100%; font-size: 12.5px; border-collapse: collapse; }
.var-table td { padding: 5px 8px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.var-table code { background: var(--brand-soft); color: var(--brand); padding: 1px 6px; border-radius: 4px; }

/* ==========================================================================
   在线咨询线索（leads）
   ========================================================================== */
.chip-n {
  display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--bg-deep); color: var(--ink-2); font-size: 11.5px; line-height: 18px;
  text-align: center; font-weight: 600;
}
.chip.is-active .chip-n { background: rgba(255,255,255,.22); color: #fff; }

.lead-list { display: flex; flex-direction: column; gap: 12px; }
.lead-item {
  display: flex; gap: 16px; align-items: flex-start; justify-content: space-between;
  border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px;
  background: var(--bg); transition: border-color .15s, box-shadow .15s;
}
.lead-item:hover { border-color: #c7d2fe; box-shadow: var(--shadow); }
.lead-item.is-done { background: var(--bg-soft); opacity: .82; }
.lead-main { flex: 1 1 auto; min-width: 0; }
.lead-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.lead-contact { font-weight: 600; color: var(--ink); word-break: break-all; }
.lead-time { margin-left: auto; color: var(--ink-4); font-size: 12px; white-space: nowrap; }
.lead-msg {
  color: var(--ink); line-height: 1.65; word-break: break-word;
  background: var(--bg-soft); border-radius: var(--radius-sm); padding: 8px 12px;
  margin-bottom: 6px; font-size: 13.5px;
}
.lead-meta { color: var(--ink-4); font-size: 12px; margin-bottom: 2px; }
.lead-meta code { background: var(--brand-soft); color: var(--brand); padding: 1px 6px; border-radius: 4px; }
.lead-actions {
  display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: 0 0 auto; min-width: 132px;
}
.lead-actions .btn, .lead-actions .btn-link { white-space: nowrap; }

.lead-tag {
  display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight: 600;
  background: var(--bg-deep); color: var(--ink-2);
}
.lead-tag.is-new { background: var(--warn-bg); color: var(--warn); }
.lead-tag.is-done { background: var(--ok-bg); color: var(--ok); }
.lead-tag.is-spam { background: var(--danger-bg); color: var(--danger); }
.lead-tag.is-merge { background: var(--brand-soft); color: var(--brand); }
.lead-tag.is-need { background: var(--bg-deep); color: var(--ink-2); font-weight: 500; }

/* 同一访客的完整对话时间线（折叠） */
.lead-thread { margin: 6px 0 8px; }
.lead-thread > summary {
  cursor: pointer; font-size: 12.5px; color: var(--brand); list-style: none;
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 0;
}
.lead-thread > summary::-webkit-details-marker { display: none; }
.lead-thread > summary::before { content: '▸'; transition: transform .15s ease; }
.lead-thread[open] > summary::before { transform: rotate(90deg); }
.lead-thread-list {
  border-left: 2px solid var(--line); padding: 4px 0 4px 12px; margin: 6px 0 2px;
  display: flex; flex-direction: column; gap: 8px;
}
.lead-thread-item { font-size: 13px; line-height: 1.6; }
.lead-thread-role {
  display: inline-block; min-width: 52px; font-size: 11.5px; font-weight: 600; color: var(--ink-4); margin-right: 6px;
}
.lead-thread-item.is-user .lead-thread-role { color: var(--brand); }
.lead-thread-item.is-user .lead-thread-text { color: var(--ink); }
.lead-thread-item.is-bot .lead-thread-text { color: var(--ink-3); }
.lead-thread-text { word-break: break-word; }

.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 18px; }
.pager-info { color: var(--ink-3); font-size: 13px; }
.btn.is-disabled { opacity: .45; pointer-events: none; }

@media (max-width: 720px) {
  .lead-item { flex-direction: column; }
  .lead-actions { flex-direction: row; align-items: center; flex-wrap: wrap; min-width: 0; width: 100%; }
  .lead-time { margin-left: 0; width: 100%; }
}
