:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --border: #e3e6ea;
  --text: #1b1f24;
  --muted: #6b7480;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --danger: #dc2626;
  --ok: #16a34a;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .14);
}

* { box-sizing: border-box; }

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

a { color: var(--accent); }

/* ---------------- 登录页 ---------------- */

.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(160deg, #eef2ff 0%, #f5f6f8 45%, #f0fdf4 100%);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  padding: 32px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.auth-brand .mark {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, #2563eb, #16a34a);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 17px;
}

.auth-brand h1 { font-size: 19px; margin: 0; letter-spacing: .5px; }

.auth-sub { color: var(--muted); font-size: 13px; margin: 0 0 22px; }

.tabs {
  display: flex;
  background: #f1f3f6;
  border-radius: 8px;
  padding: 3px;
  margin-bottom: 20px;
}

.tabs button {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 8px;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  color: var(--muted);
  cursor: pointer;
  transition: all .15s;
}

.tabs button.active {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  box-shadow: var(--shadow);
}

.field { margin-bottom: 14px; }

.field label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 5px;
}

input, select, textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

textarea { resize: vertical; min-height: 76px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s;
}

.btn:hover { background: var(--accent-hover); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.block { width: 100%; padding: 11px; }

.btn.ghost {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.btn.ghost:hover { background: #f7f8fa; }

/* 顶栏里的「等级」是个 <a>，不是 <button>：这样能直接右键新窗口打开，
   手机上也能长按复制链接。链接默认有下划线，这里去掉。 */
a.btn { text-decoration: none; }

.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #b91c1c; }

.btn.sm { padding: 5px 11px; font-size: 13px; }

.msg {
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 14px;
  display: none;
}
.msg.show { display: block; }
.msg.err { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.msg.ok  { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }

/* ── 手机号注册：+86 前缀、验证码行、步骤提示 ─────────────────────────── */

/* 手机号输入：左边一个固定的 +86 前缀块，右边是输入框 */
.phone-input {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
}
.phone-input:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.phone-input .phone-prefix {
  display: flex;
  align-items: center;
  padding: 0 11px;
  font-size: 14px;
  color: var(--muted);
  background: #f7f8fa;
  border-right: 1px solid var(--border);
}
/* 输入框自己不再画边框，由外层 .phone-input 统一画，否则会出现双层线 */
.phone-input input {
  border: none;
  border-radius: 0;
  flex: 1;
  min-width: 0;
}
.phone-input input:focus { box-shadow: none; }

/* 验证码行：输入框 + 「获取验证码」按钮 */
.code-input {
  display: flex;
  gap: 8px;
}
.code-input input { flex: 1; min-width: 0; letter-spacing: 2px; }
.code-input .btn { flex: 0 0 auto; white-space: nowrap; }

.field-hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
  min-height: 16px;
}
.field-hint.bad { color: var(--danger); }

/* 第二步顶部：手机号已验证的确认行 */
.done-line {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  margin-bottom: 14px;
  border-radius: 8px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
  font-size: 13px;
}
.done-line .tick { font-weight: 700; }

/* 两个「整宽」按钮叠在一起时给上面那个留点间距 */
.btn.block + .btn.block { margin-top: 8px; }

.auth-foot {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

/* ---------------- 主应用 ---------------- */

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo { display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: 16px; }

.logo .mark {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, #2563eb, #16a34a);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
}

.spacer { flex: 1; }

.user-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--muted);
}

.avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: #e0e7ff;
  color: #3730a3;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 12px;
}

.container { max-width: 1400px; margin: 0 auto; padding: 20px; }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}

.stat .k { font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.stat .v { font-size: 21px; font-weight: 600; letter-spacing: -.5px; }
.stat .v.small { font-size: 16px; }

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.toolbar input[type="search"] { flex: 1; min-width: 200px; max-width: 340px; }

/* 看板 */
.board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(250px, 1fr);
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 12px;
  align-items: start;
}

.col {
  background: #eef0f3;
  border-radius: var(--radius);
  padding: 10px;
  min-height: 130px;
}

.col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 9px;
  padding: 0 2px;
}

.col-head .count {
  background: #d7dbe0;
  color: #4b5563;
  border-radius: 20px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 500;
}

.col.won .count { background: #dcfce7; color: #166534; }
.col.lost .count { background: #fee2e2; color: #991b1b; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 11px;
  margin-bottom: 8px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform .12s, box-shadow .12s;
}

.card:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(16,24,40,.1); }
.card .cname { font-weight: 600; font-size: 14px; margin-bottom: 2px; }
.card .ccomp { font-size: 12px; color: var(--muted); margin-bottom: 7px; }

.card .cmeta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
}

.card .amt { color: var(--ok); font-weight: 600; }
.card .cnt { background: #f1f3f6; border-radius: 20px; padding: 0 7px; }

.empty-hint {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 10px 4px;
}

.empty-state {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 48px 20px;
  text-align: center;
  color: var(--muted);
}

.empty-state h3 { color: var(--text); margin: 0 0 6px; font-size: 16px; }

/* 抽屉 */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, .38);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
  z-index: 40;
}
.overlay.show { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(560px, 100%);
  background: var(--surface);
  border-left: 1px solid var(--border);
  transform: translateX(100%);
  transition: transform .24s ease;
  z-index: 50;
  display: flex;
  flex-direction: column;
}
.drawer.show { transform: translateX(0); }

.drawer-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.drawer-head h2 { margin: 0; font-size: 17px; }
.drawer-head .sub { font-size: 13px; color: var(--muted); }

.drawer-body { padding: 18px 20px; overflow-y: auto; flex: 1; }

.x-btn {
  border: 0;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
}
.x-btn:hover { background: #f1f3f6; color: var(--text); }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .6px;
  margin: 22px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.timeline { position: relative; }

.tl-item {
  position: relative;
  padding: 0 0 16px 20px;
  border-left: 2px solid var(--border);
}
.tl-item:last-child { border-left-color: transparent; padding-bottom: 0; }

.tl-item::before {
  content: '';
  position: absolute;
  left: -6px; top: 5px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--surface);
}

.tl-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 3px;
}

.tag {
  background: #eef2ff;
  color: #3730a3;
  border-radius: 20px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 500;
}

.tl-summary { font-size: 14px; white-space: pre-wrap; word-break: break-word; }

.tl-next {
  margin-top: 6px;
  font-size: 12px;
  color: #92400e;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 6px;
  padding: 5px 9px;
  display: inline-block;
}

.tl-del {
  background: none;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  padding: 0;
  text-decoration: underline;
}
.tl-del:hover { color: var(--danger); }

.stage-badge {
  display: inline-block;
  border-radius: 20px;
  padding: 1px 10px;
  font-size: 12px;
  font-weight: 500;
  background: #eef2ff;
  color: #3730a3;
}

.row-actions { display: flex; gap: 8px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #1b1f24;
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  opacity: 0;
  transition: all .25s;
  z-index: 100;
  pointer-events: none;
}
/* 客户档案里的删除操作：单独一条记录用文字按钮，整个客户用红色按钮 */
.d-del {
  display: inline-block;
  margin-top: 6px;
  padding: 0;
  border: none;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.d-del:hover { color: var(--danger); }

.d-danger {
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.d-hint {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: #991b1b; }

/* ---------------- 账户等级页（/plan） ----------------
   这一页同时是要拿去给微信支付审「自动续费」的材料，所以：
   权益逐条可读、价目清楚、当前档有标记、取消入口点得到。 */

.plan-main {
  max-width: 980px;
  margin: 0 auto;
  padding: 22px 20px 60px;
}

.plan-loading {
  padding: 40px 0;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

/* 当前等级 */
.plan-hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  margin-bottom: 20px;
}
.plan-hero-label { font-size: 12.5px; color: var(--muted); }
.plan-hero-name { font-size: 26px; font-weight: 650; margin: 2px 0 6px; letter-spacing: .5px; }
.plan-hero-meta { font-size: 14px; color: var(--accent); font-weight: 500; }
.plan-hero-note { font-size: 13px; color: var(--muted); margin-top: 6px; }
.plan-hero-actions { margin-top: 14px; }

.plan-section { margin-bottom: 26px; }
.plan-h2 {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 12px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.plan-period { font-size: 12px; color: var(--muted); font-weight: 400; }

/* 用量条 */
.usage-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 10px;
}
.usage-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.usage-label { font-size: 13.5px; }
.usage-num { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.usage-track {
  height: 6px;
  background: #eef0f3;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 9px;
}
.usage-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width .3s;
}
.usage-fill.full { background: var(--danger); }

/* 价目表 */
.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}
.plan-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 16px 18px;
  box-shadow: var(--shadow);
}
.plan-card.current {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
}
.plan-badge {
  position: absolute;
  top: -9px;
  right: 12px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  padding: 2px 9px;
  border-radius: 999px;
}
.plan-name { font-size: 15px; font-weight: 600; }
.plan-price { font-size: 20px; font-weight: 650; margin: 4px 0 10px; color: var(--accent); }
.plan-features { margin: 0; padding-left: 18px; font-size: 13px; color: var(--muted); }
.plan-features li { margin-bottom: 4px; }

.plan-notice {
  background: #f8f9fb;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 12.5px;
  color: var(--muted);
}
.plan-notice-line + .plan-notice-line { margin-top: 6px; }

@media (max-width: 560px) {
  .plan-main { padding: 16px 14px 48px; }
  .plan-hero-name { font-size: 22px; }
  .plan-grid { grid-template-columns: 1fr; }
}


/* 待跟进面板 */
.panel {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 16px;
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #92400e;
  margin-bottom: 9px;
}

.panel-head .count {
  background: #fde68a;
  color: #78350f;
  border-radius: 20px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 500;
}

.fu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 9px;
  background: var(--surface);
  border: 1px solid #fde68a;
  border-radius: 7px;
  margin-bottom: 6px;
  cursor: pointer;
  font-size: 13px;
}
.fu-item:last-child { margin-bottom: 0; }
.fu-item:hover { background: #fffdf5; }
.fu-item .fu-name { font-weight: 600; }
.fu-item .fu-date { color: #b45309; font-weight: 600; }
.fu-item .fu-next { color: var(--muted); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Agent 建议卡片 */
.agent-run {
  border: 1px solid #ddd6fe;
  background: #faf5ff;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
}

.agent-run-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #6b21a8;
  margin-bottom: 7px;
  flex-wrap: wrap;
}

.agent-run .conf {
  border-radius: 20px;
  padding: 0 8px;
  font-size: 12px;
  background: #ede9fe;
  color: #5b21b6;
}

.agent-field { margin-bottom: 7px; }
.agent-field .lbl {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .5px;
}
.agent-field .val { font-size: 13px; white-space: pre-wrap; word-break: break-word; }

.fb-row {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 9px;
  padding-top: 9px;
  border-top: 1px solid #e9d5ff;
}

.fb-done {
  font-size: 12px;
  border-radius: 20px;
  padding: 2px 10px;
  font-weight: 500;
}
.fb-done.accepted { background: #dcfce7; color: #166534; }
.fb-done.rejected { background: #fee2e2; color: #991b1b; }
.fb-done.partial  { background: #fef3c7; color: #92400e; }

/* ── 画像条目的三层来源徽章：必须一眼可分 ───────────────────────────── */
.src {
  display: inline-block;
  border-radius: 20px;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  vertical-align: middle;
}
.src.customer_said   { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.src.broker_observed { background: #e0f2fe; color: #075985; border: 1px solid #bae6fd; }
.src.agent_inferred  { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }

.fact-group { margin-bottom: 10px; }
.fact-group-head { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }

.fact-item {
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 8px 10px;
  margin-bottom: 6px;
  background: #fcfcfd;
}
.fact-item.dead { opacity: .55; }
.fact-item .fact-top { display: flex; align-items: flex-start; gap: 7px; font-size: 13px; }
.fact-item .fact-body { flex: 1; word-break: break-word; }
.fact-item.dead .fact-body { text-decoration: line-through; }
.fact-quote {
  font-size: 12px;
  color: #166534;
  background: #f0fdf4;
  border-left: 2px solid #86efac;
  padding: 4px 8px;
  margin-top: 5px;
  border-radius: 0 4px 4px 0;
  word-break: break-word;
}
.fact-meta { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* ── 待弄清的问题 ─────────────────────────────────────────────────── */
.q-item {
  border: 1px solid #fde68a;
  background: #fffbeb;
  border-radius: 7px;
  padding: 9px 11px;
  margin-bottom: 7px;
}
.q-item .q-top { display: flex; gap: 7px; align-items: flex-start; font-size: 13px; }
.q-item .q-body { flex: 1; font-weight: 600; }
.q-item .q-pri {
  border-radius: 20px; padding: 0 7px; font-size: 11px; font-weight: 600;
  background: #fde68a; color: #78350f;
}
.q-item .q-why { font-size: 12px; color: #92400e; margin-top: 5px; }
.q-item .q-ask { font-size: 12px; color: var(--muted); margin-top: 3px; }

/* ── 建议的依据 ───────────────────────────────────────────────────── */
.ev-list { margin-top: 6px; }
.ev-item {
  font-size: 12px;
  color: #5b21b6;
  background: #f5f3ff;
  border-left: 2px solid #c4b5fd;
  padding: 4px 8px;
  margin-top: 4px;
  border-radius: 0 4px 4px 0;
  word-break: break-word;
}
.adv-field { margin-bottom: 6px; }
.adv-field .k { font-size: 11px; color: var(--muted); font-weight: 600; }
.adv-field .v { font-size: 13px; white-space: pre-wrap; word-break: break-word; }
.adv-draft {
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 6px;
  padding: 7px 9px;
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-word;
  margin-top: 3px;
}

/* ── 折叠表单（补充画像 / 新增问题）───────────────────────────────── */
details.inline-form {
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 8px 11px;
  margin-top: 8px;
  background: #fbfbfc;
}
details.inline-form > summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--accent);
  font-weight: 500;
  list-style: none;
}
details.inline-form > summary::-webkit-details-marker { display: none; }
details.inline-form > summary::before { content: '＋ '; }
details.inline-form[open] > summary::before { content: '− '; }
details.inline-form .inner { padding-top: 10px; }

.raw-note {
  background: #f8fafc;
  border-left: 2px solid #cbd5e1;
  padding: 6px 9px;
  margin-top: 4px;
  border-radius: 0 4px 4px 0;
  font-size: 12.5px;
  color: #334155;
  white-space: pre-wrap;
  word-break: break-word;
}

.parties { font-size: 12px; color: #0369a1; margin-top: 3px; }

.outcome-box {
  margin-top: 7px;
  padding: 9px 10px;
  border: 1px solid #bae6fd;
  background: #f0f9ff;
  border-radius: 6px;
}
.outcome-box .oc-head { font-size: 12px; font-weight: 600; color: #075985; margin-bottom: 6px; }
.outcome-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 7px; }

/* ── 对话界面（网站的主要入口）───────────────────────────────────────── */
.nav { display: flex; gap: 4px; margin-left: 18px; }
.nav-item {
  font-size: 13px;
  padding: 5px 12px;
  border-radius: 7px;
  color: var(--muted);
  text-decoration: none;
}
.nav-item:hover { background: #f1f3f6; }
.nav-item.active { background: #eef2ff; color: #3730a3; font-weight: 600; }

/* ================================================================
   对话界面 · 手机优先
   ================================================================
   设计目标（2026-10 改版）：
     · 主要在手机上看 —— 上下拖动必须顺，输入框不能被键盘/地址栏顶飞
     · 登录进来就是一个对话框，不再是"看板 + 表单"
     · 客户列表放在输入框**下面**，它是索引，不是要逐个进去归类的档案
     · 说过话之后进入 GPT 那样的对话态：消息自己滚，输入框粘底
   ================================================================ */

/* ---- 视口高度：这是手机端"不能上下拖动"的根因 ----
   100vh 在手机浏览器里包含地址栏高度，底部输入框会被顶出可视区；
   再加上 overflow:hidden，用户根本没机会把它拖上来。
   dvh 跟随"实际可视高度"，地址栏收起/展开都正确。 */
.chat-body {
  height: 100vh;                  /* 老浏览器回退 */
  height: var(--app-h, 100dvh);   /* JS 在键盘弹起时接管；否则跟随动态视口高度 */
  overflow: hidden;
  display: flex;
  flex-direction: column;
  overscroll-behavior-y: none;   /* 关掉下拉刷新，免得拖动时误触 */
}

.chat-body .topbar { padding-top: env(safe-area-inset-top, 0px); }

/* ---- 顶栏按钮收紧（手机上要给三个按钮留位置） ---- */
.chat-body .topbar-inner { gap: 6px; }
.chat-body .topbar-inner .btn.sm { padding: 5px 9px; font-size: 12.5px; }
.pill {
  display: inline-block;
  min-width: 17px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  line-height: 17px;
  text-align: center;
  vertical-align: 1px;
}

/* ---- 主区：两种模式 ---- */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

/* 首页态：整页一起滚。输入框和客户列表都在正常文档流里，
   于是"客户列表在输入框下面"这句话在视觉上真的成立。 */
.chat-main.mode-home {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.chat-main.mode-home .chat-scroll { flex: none; overflow: visible; }
.chat-main.mode-home .composer-wrap {
  border-top: 0;
  background: transparent;
  padding-top: 2px;
}
.chat-main.mode-home .composer-hint { display: none; }

/* 对话态：消息区自己滚，输入框粘底，客户列表收起 */
.chat-main.mode-chat .chat-scroll {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}
.chat-main.mode-chat .home-customers { display: none; }

.chat-scroll { flex: 1; overflow-y: auto; min-height: 0; }
.chat-inner { max-width: 780px; margin: 0 auto; padding: 20px 16px 8px; }

/* ---- 欢迎块 ---- */
.chat-welcome { padding: 30px 0 14px; }
.chat-welcome h2 { font-size: 20px; margin: 0 0 8px; }
.chat-welcome p { color: var(--muted); font-size: 13.5px; margin: 0 0 18px; line-height: 1.7; }
.examples { display: flex; flex-direction: column; gap: 8px; }
.ex {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 9px;
  padding: 11px 14px;
  font-size: 13px;
  color: #334155;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.ex:hover { border-color: var(--accent); background: #f8faff; }

/* ---- 消息 ---- */
.turn { margin-bottom: 18px; }
.turn.user { display: flex; flex-direction: column; align-items: flex-end; }
.turn.user .bubble {
  background: var(--accent);
  color: #fff;
  border-radius: 14px 14px 4px 14px;
  padding: 10px 14px;
  max-width: 88%;
}
.turn.user .bubble-text { white-space: pre-wrap; word-break: break-word; font-size: 14.5px; }
.turn-time { font-size: 11px; color: var(--muted); margin-top: 4px; }

.turn.assistant .bubble {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px 14px 14px 4px;
  padding: 12px 15px;
  box-shadow: var(--shadow);
}
.turn.assistant .bubble-text {
  font-size: 14.5px;
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-word;
}
.turn.assistant .bubble-text strong { font-weight: 600; }
.turn.assistant .bubble-text code {
  background: #f1f3f6;
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 12.5px;
}

/* 工具活动 chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips:empty { display: none; }
/* 标签和答复文字之间的间距，**只有两者都在**的时候才留。
   用 margin-bottom 的话，「只有标签没有文字」的气泡底部会多出一截空白 ——
   一屏好几个这种气泡就会看成"一排空信息框"。 */
.chips:not(:empty) + .bubble-text:not(:empty) { margin-top: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  border-radius: 20px;
  padding: 3px 11px;
  border: 1px solid var(--border);
  background: #f8fafc;
  color: var(--muted);
}
.chip-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #cbd5e1;
  flex-shrink: 0;
}
.chip.running { background: #eef2ff; border-color: #c7d2fe; color: #3730a3; }
.chip.running .chip-dot { background: var(--accent); animation: pulse 1s infinite; }
.chip.ok { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.chip.ok .chip-dot { background: #22c55e; }
.chip.fail { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.chip.fail .chip-dot { background: #ef4444; }
.chip-err { font-weight: 600; }

@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .35 } }

.typing { display: inline-flex; gap: 4px; align-items: center; height: 18px; }
.typing i {
  width: 6px; height: 6px; border-radius: 50%;
  background: #cbd5e1;
  animation: bounce 1.2s infinite;
}
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%,60%,100% { transform: translateY(0) } 30% { transform: translateY(-4px) } }

/* ---- 输入区 ----
   底部留出 iPhone 小白条的安全区，否则输入框会被 Home 指示条压住 */
.composer-wrap {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  flex-shrink: 0;
}
.composer {
  max-width: 780px;
  margin: 0 auto;
  display: flex;
  gap: 9px;
  align-items: flex-end;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 8px 8px 8px 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: border-color .15s, box-shadow .15s;
}
.composer:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.composer textarea {
  flex: 1;
  border: 0;
  padding: 6px 0;
  resize: none;
  font-size: 16px;        /* 16px：iOS 上小于 16px 会触发自动放大页面 */
  line-height: 1.6;
  max-height: 200px;
  background: transparent;
  font-family: inherit;
}
.composer textarea:focus { outline: none; box-shadow: none; }
.btn.send {
  width: 36px; height: 36px;
  padding: 0;
  border-radius: 10px;
  font-size: 17px;
  flex-shrink: 0;
}
.btn.send:disabled { opacity: .4; }
.composer-hint {
  max-width: 780px;
  margin: 8px auto 0;
  font-size: 11.5px;
  color: var(--muted);
  text-align: center;
}

/* ================================================================
   客户列表（输入框下面）
   ================================================================ */

.home-customers { padding: 6px 16px 28px; max-width: 812px; margin: 0 auto; width: 100%; }

.sec-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 18px 0 10px;
}
.sec-head h3 { font-size: 15px; margin: 0; }
.sec-head .sec-sub { font-size: 12px; color: var(--muted); }

.cust-list { display: flex; flex-direction: column; gap: 9px; }

.cust-card {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 12px;
  padding: 13px 15px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.cust-card:hover { border-color: #c7d2fe; box-shadow: var(--shadow); }
.cc-top { display: flex; align-items: center; gap: 8px; }
.cc-name { font-size: 15.5px; font-weight: 600; flex: 1; min-width: 0;
           overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-stage {
  font-size: 11.5px;
  padding: 2px 9px;
  border-radius: 20px;
  background: #eef2ff;
  color: #3730a3;
  flex-shrink: 0;
}
.cc-stage.won { background: #f0fdf4; color: #166534; }
.cc-stage.lost { background: #fef2f2; color: #991b1b; }
.cc-intent { font-size: 13px; color: #475569; margin-top: 5px; line-height: 1.6; }
.cc-meta { font-size: 11.5px; color: var(--muted); margin-top: 6px; }
.cc-empty {
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 22px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

/* ================================================================
   底部抽屉：客户列表 / 客户档案。可上下拖动。
   ================================================================ */

.sheet-mask {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity .26s;
  z-index: 55;
}
.sheet-mask.show { opacity: 1; pointer-events: auto; }

.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: 78vh;
  height: 78dvh;
  background: var(--surface);
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -10px 44px rgba(15,23,42,.2);
  transform: translateY(calc(100% + 30px));
  transition: transform .26s cubic-bezier(.22,.61,.36,1);
  z-index: 60;
  display: flex;
  flex-direction: column;
  will-change: transform;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.sheet.show { transform: translateY(var(--sheet-y, 0px)); }
.sheet.dragging { transition: none; }

.sheet-grip {
  padding: 9px 0 4px;
  display: flex;
  justify-content: center;
  cursor: grab;
  touch-action: none;      /* 拖动手柄时不触发页面滚动 */
  flex-shrink: 0;
}
.sheet-grip span {
  width: 40px; height: 4px;
  border-radius: 3px;
  background: #d7dce3;
  display: block;
}
.sheet-head {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 16px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sheet-head h2 { font-size: 15.5px; margin: 0; flex: 1; min-width: 0;
                 overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px 16px 32px;
}

/* ---- 客户档案（抽屉内的详情） ---- */
.d-sec { margin-bottom: 20px; }
.d-sec > h4 {
  font-size: 13px;
  margin: 0 0 9px;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: .02em;
}
.d-kv { display: flex; gap: 8px; font-size: 13.5px; margin-bottom: 6px; line-height: 1.6; }
.d-kv .k { color: var(--muted); width: 62px; flex-shrink: 0; }
.d-kv .v { color: #334155; flex: 1; min-width: 0; word-break: break-word; }

.d-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 13px;
  margin-bottom: 8px;
  background: #fcfdfe;
}
.d-item .d-top { display: flex; align-items: center; gap: 7px; margin-bottom: 5px; flex-wrap: wrap; }
.d-item .d-body { font-size: 13.5px; line-height: 1.65; color: #1e293b; word-break: break-word; }
.d-item .d-quote {
  font-size: 13px;
  color: #475569;
  background: #f8fafc;
  border-left: 3px solid #cbd5e1;
  border-radius: 0 6px 6px 0;
  padding: 7px 10px;
  margin-top: 7px;
  line-height: 1.65;
  word-break: break-word;
}
.d-item .d-why { font-size: 12.5px; color: var(--muted); margin-top: 6px; line-height: 1.6; }
.d-item.pri-1 { border-color: #fca5a5; background: #fffafa; }
.d-item.pri-2 { border-color: #fdba74; }
.d-none { font-size: 13px; color: var(--muted); }

/* 三层来源色标 —— 全系统的认知底线，颜色必须一直可见 */
.src {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
  flex-shrink: 0;
  white-space: nowrap;
}
.src.customer_said   { background: #dbeafe; color: #1e40af; }
.src.broker_observed { background: #dcfce7; color: #166534; }
.src.agent_inferred  { background: #fef3c7; color: #92400e; }
.conf { font-size: 11px; color: var(--muted); }
.d-dead { opacity: .55; }
.d-dead .d-body { text-decoration: line-through; }

/* ---- 更窄的屏幕 ---- */
@media (max-width: 420px) {
  .chat-body .topbar-inner .btn.sm { padding: 5px 7px; font-size: 12px; }
  .chat-inner { padding: 16px 13px 6px; }
  .home-customers { padding-left: 13px; padding-right: 13px; }
  .sheet-body { padding: 12px 13px 28px; }
}
