:root {
  --navy: #1B2A4A;
  --navy-2: #24375f;
  --blue: #2f6fed;
  --bg: #F4F6FA;
  --card: #ffffff;
  --text: #1f2733;
  --muted: #8A93A6;
  --line: #e9edf3;
  --red: #e0573e;
  --green: #2bb673;
  --gold: #c79a3a;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  padding-bottom: 60px;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* 顶部返回条（子页面） */
.sub-header {
  display: flex; align-items: center; gap: 8px;
  background: var(--navy); color: #fff;
  padding: 14px 16px; position: sticky; top: 0; z-index: 5;
}
.sub-header .back {
  background: rgba(255,255,255,.15); border: none; color: #fff;
  padding: 4px 12px; border-radius: 16px; font-size: 14px;
}
.sub-header .title { font-size: 16px; font-weight: 600; }

/* 通用容器 */
.wrap { padding: 16px; }
.section-title { font-size: 15px; font-weight: 700; color: var(--navy); margin: 18px 0 10px; }
.muted { color: var(--muted); font-size: 13px; }

/* 卡片 */
.card {
  background: var(--card); border-radius: 14px; padding: 16px;
  margin-bottom: 12px; box-shadow: 0 2px 10px rgba(27,42,74,.05);
}

/* 首页 hero */
.hero {
  position: relative;
  background:
    radial-gradient(120% 70% at 85% -10%, rgba(199,154,58,.28), transparent 55%),
    linear-gradient(150deg, #16233e 0%, var(--navy) 45%, #2a4069 100%);
  color: #fff; padding: 16px 18px 18px;
  border-radius: 0 0 22px 22px;
  overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; right: -40px; top: -40px;
  width: 160px; height: 160px; border-radius: 50%;
  background: rgba(199,154,58,.15); pointer-events: none;
}
.hero-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.hero h1 { margin: 0 0 6px; font-size: 22px; letter-spacing: 1px; }
.hero p { margin: 0; color: #c5d0e4; font-size: 13px; }
.hero-badge {
  flex: none; margin-top: 4px; font-size: 11px; color: #ffe9c2;
  background: rgba(199,154,58,.22); border: 1px solid rgba(199,154,58,.45);
  padding: 4px 10px; border-radius: 12px;
}

/* 顾问形象卡（首页正中）——高度受控，保证首屏能看到两个按钮 */
.advisor-card {
  position: relative; z-index: 1;
  margin: 12px auto 0; max-width: 230px;
  background: rgba(255,255,255,.97); border-radius: 16px; padding: 6px 6px 0;
  box-shadow: 0 8px 22px rgba(0,0,0,.26);
}
.advisor-img {
  display: block; width: 100%; max-height: 25vh; object-fit: cover; object-position: center 18%;
  border-radius: 11px 11px 0 0;
}
.advisor-cap {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 8px 6px 9px; text-align: center;
}
.advisor-cap b { color: var(--navy); font-size: 13.5px; }
.advisor-cap span { color: var(--muted); font-size: 11px; }

/* hero 双按钮 */
.hero-actions {
  position: relative; z-index: 1;
  display: flex; gap: 10px; margin-top: 12px;
}
.ha {
  flex: 1; text-align: center; padding: 12px 0; border-radius: 12px;
  font-size: 14.5px; font-weight: 700;
}
.ha.primary { background: var(--blue); color: #fff; box-shadow: 0 4px 14px rgba(47,111,237,.4); }
.ha.gold { background: rgba(255,255,255,.12); color: #ffe9c2; border: 1px solid rgba(199,154,58,.55); }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.tile {
  background: var(--card); border-radius: 14px; padding: 16px 14px;
  text-align: center; box-shadow: 0 2px 10px rgba(27,42,74,.05);
}
.tile .em { font-size: 26px; }
.tile .lb { display: block; margin-top: 6px; font-size: 14px; font-weight: 600; color: var(--navy); }
.tile .desc { display: block; margin-top: 3px; font-size: 11.5px; color: var(--muted); }

/* 咨询流程 */
.steps-card {
  background: var(--card); border-radius: 14px; padding: 16px; margin-top: 12px;
  box-shadow: 0 2px 10px rgba(27,42,74,.05);
}
.steps { display: flex; gap: 8px; }
.step { flex: 1; text-align: center; }
.step i {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%;
  background: linear-gradient(135deg, var(--navy), #2a4069); color: #ffe9c2;
  font-style: normal; font-size: 13px; font-weight: 700;
}
.step b { display: block; margin-top: 6px; font-size: 13px; color: var(--navy); }
.step span { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }

/* 按钮 */
.btn {
  display: block; width: 100%; border: none; border-radius: 12px;
  padding: 13px; font-size: 16px; font-weight: 600; color: #fff;
  background: var(--blue); margin-top: 12px;
}
.btn.ghost { background: #eef2f8; color: var(--navy); }
.btn.gold { background: var(--gold); }
.btn:active { opacity: .85; }
.btn[disabled] { opacity: .5; }

/* 列表 */
.list-item {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--card); border-radius: 12px; padding: 14px 16px; margin-bottom: 10px;
  box-shadow: 0 2px 10px rgba(27,42,74,.04);
}
.list-item .name { font-weight: 600; color: var(--navy); }
.list-item .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.list-item .arrow { color: var(--muted); font-size: 18px; }

/* 表单 */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--navy); margin-bottom: 6px; font-weight: 600; }
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 12px; font-size: 15px; background: #fff; color: var(--text);
}
.field textarea { min-height: 96px; resize: vertical; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* 进度条 */
.progress { height: 8px; background: #eef2f8; border-radius: 6px; overflow: hidden; margin: 6px 0 4px; }
.progress > i { display: block; height: 100%; background: var(--blue); width: 0; transition: width .3s; }

/* 状态徽标 */
.badge-st { font-size: 12px; padding: 2px 9px; border-radius: 10px; }
.badge-pending { background: #fff3e0; color: #c77c1a; }
.badge-paid { background: #e6f7ee; color: var(--green); }
.badge-cancelled { background: #f0f1f3; color: var(--muted); }

/* 通话条 */
.call-bar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--navy); color: #fff; border-radius: 12px; padding: 12px 14px; margin-top: 12px;
}
.call-bar a { color: #fff; font-weight: 700; }

/* 聊天气泡 */
.chat-box { padding: 14px; }
.msg { display: flex; margin-bottom: 12px; }
.msg .bubble {
  max-width: 78%; padding: 10px 13px; border-radius: 14px; font-size: 14px; white-space: pre-wrap;
  word-break: break-word;
}
.msg.user { justify-content: flex-end; }
.msg.user .bubble { background: var(--blue); color: #fff; border-bottom-right-radius: 4px; }
.msg.bot .bubble { background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.chat-input { display: flex; gap: 8px; padding: 10px 12px; position: sticky; bottom: 60px; background: var(--bg); }
.chat-input input { flex: 1; border: 1px solid var(--line); border-radius: 20px; padding: 10px 14px; font-size: 15px; }
.chat-input button { background: var(--blue); color: #fff; border: none; border-radius: 20px; padding: 0 18px; font-size: 15px; }
.notice { background: #fff7e6; border: 1px solid #ffe0a3; color: #9a6b00; border-radius: 10px; padding: 10px 12px; font-size: 13px; margin: 8px 14px; }

/* ===== 结构化采集流程 ===== */
.step-bar { padding: 14px 16px 4px; }
.step-dots { display: flex; gap: 6px; }
.step-dots i {
  flex: 1; height: 4px; border-radius: 2px; background: #e2e7ef;
}
.step-dots i.on { background: var(--blue); }
.step-label { margin-top: 6px; font-size: 12px; color: var(--muted); }

.q-title { font-size: 17px; font-weight: 700; color: var(--navy); margin: 10px 16px 4px; }
.q-sub { font-size: 13px; color: var(--muted); margin: 0 16px 14px; line-height: 1.7; }

/* 类型选择卡（九宫格） */
.pick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pick {
  background: var(--card); border: 1.5px solid var(--line); border-radius: 12px;
  padding: 12px 6px; text-align: center; transition: .15s;
}
.pick.on { border-color: var(--blue); background: #eef4ff; box-shadow: 0 2px 8px rgba(47,111,237,.15); }
.pick .pi { display: block; font-size: 22px; }
.pick b { display: block; font-size: 13px; color: var(--navy); margin-top: 4px; }
.pick .ph { display: block; font-size: 10.5px; color: var(--muted); margin-top: 2px; line-height: 1.4; }

/* 选项 chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-block; padding: 8px 14px; border-radius: 18px;
  background: #fff; border: 1px solid var(--line); color: var(--text);
  font-size: 13.5px; line-height: 1.4;
}
.chip.on { background: var(--blue); border-color: var(--blue); color: #fff; }

/* 风险 / 安全提示 */
.risk-tip {
  margin: 14px 0 0; padding: 12px 14px; border-radius: 12px;
  background: #fff1ee; border: 1px solid #ffd0c4; color: #b3412a;
  font-size: 13px; line-height: 1.7;
}
.safe-note {
  margin-top: 6px; padding: 10px 12px; border-radius: 10px;
  background: #eef7f0; border: 1px solid #c9e7d3; color: #1f7a45;
  font-size: 12.5px; line-height: 1.6;
}

/* 聊天阶段 */
.chat-meta { padding: 8px 16px 0; font-size: 12px; color: var(--muted); }
.chat-sug {
  padding: 4px 14px 8px; background: var(--bg);
}
.sug-title { font-size: 12px; color: var(--muted); margin: 6px 0 8px; }
.chat-sug textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; font-size: 15px; font-family: inherit; resize: vertical;
}
.chat-sug .btn { margin-top: 8px; }
.chat-foot { padding: 0 16px 12px; }

/* 摘要预览 */
.summary {
  margin: 0; white-space: pre-wrap; word-break: break-all;
  font-family: inherit; font-size: 13px; line-height: 1.8; color: var(--text);
}

/* 设置 */
.setting-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.setting-row input { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 60%; font-size: 13px; }

/* 底部导航 */
#nav {
  position: fixed; left: 0; right: 0; bottom: 0; height: 56px;
  background: #fff; border-top: 1px solid var(--line);
  display: flex; z-index: 10;
}
#nav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); font-size: 11px; gap: 2px; }
#nav a .ic { font-size: 20px; }
#nav a.active { color: var(--navy); }

/* toast / loading */
.toast {
  position: fixed; left: 50%; top: 40%; transform: translate(-50%,-50%);
  background: rgba(0,0,0,.8); color: #fff; padding: 10px 16px; border-radius: 10px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 99; max-width: 80%; text-align: center;
}
.toast.show { opacity: 1; }
.loading {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%,-50%);
  background: rgba(0,0,0,.7); color: #fff; padding: 12px 18px; border-radius: 10px; font-size: 14px;
  display: none; z-index: 99;
}
.loading.show { display: block; }
.service-desc { font-size: 13px; color: var(--muted); margin-top: 4px; }
.price-note { color: var(--gold); font-weight: 600; }

/* 首页连接状态横幅 */
.conn-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: #fff4e5; color: #b45309; border-bottom: 1px solid #f0c987;
  padding: 8px 12px; font-size: 13px; position: sticky; top: 0; z-index: 40;
}
.conn-banner .cb-text { flex: 1; line-height: 1.3; }
.conn-banner .cb-fix {
  flex: 0 0 auto; background: #b45309; color: #fff; padding: 5px 10px;
  border-radius: 8px; text-decoration: none; font-weight: 600; white-space: nowrap;
}

/* ============ 多角色系统：意向登记 / 代理工作台 / 总部后台 ============ */
.lead-hero { background: linear-gradient(135deg, var(--navy), #1b2f55); color: #fff; padding: 22px 16px; display: flex; flex-direction: column; gap: 6px; }
.lead-hero b { font-size: 18px; }
.lead-hero span { font-size: 13px; opacity: .85; }
.req { color: #d33; font-style: normal; }
textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 10px; font-size: 14px; font-family: inherit; box-sizing: border-box; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.stat-row { display: flex; gap: 8px; margin-bottom: 12px; }
.stat { flex: 1; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 6px; text-align: center; }
.stat b { display: block; font-size: 20px; color: var(--navy); }
.stat span { font-size: 12px; color: var(--muted); }
.tab-line { display: flex; gap: 6px; margin-bottom: 10px; }
.tl { flex: 1; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 9px 4px; font-size: 14px; color: var(--muted); position: relative; }
.tl.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.tl-badge { display: none; background: #d33; color: #fff; border-radius: 9px; font-size: 11px; padding: 1px 6px; font-style: normal; margin-left: 4px; }
.lead-card { margin-bottom: 10px; }
.lc-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.lc-top b { font-size: 15px; color: var(--navy); }
.lc-line { font-size: 13px; color: var(--text); margin-top: 3px; word-break: break-all; }
.lc-desc { font-size: 13px; color: var(--muted); margin-top: 6px; background: var(--bg); border-radius: 8px; padding: 8px 10px; }
.lc-note { font-size: 12px; color: #8a6d1c; background: #fdf6e3; border-radius: 8px; padding: 6px 10px; margin-top: 6px; }
.lc-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; align-items: center; }
.badge { font-size: 12px; border-radius: 10px; padding: 2px 10px; background: #eef1f6; color: var(--muted); }
.b-ok { background: #e6f6ec; color: #1a7f4b; }
.b-off { background: #fdecec; color: #c0392b; }
.b-urg-urgent { background: #fdecec; color: #c0392b; }
.b-urg-high { background: #fdf3e0; color: #b9770e; }
.empty-card { text-align: center; padding: 26px 12px; color: var(--muted); line-height: 1.8; }
.invite-card { text-align: center; }
.inv-code { font-size: 30px; font-weight: 800; letter-spacing: 6px; color: var(--navy); margin: 8px 0; }
.inv-link { font-size: 12px; background: var(--bg); border-radius: 8px; padding: 8px 10px; word-break: break-all; margin-bottom: 10px; }
.inv-mini { color: var(--navy); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.sel { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 8px; padding: 9px; font-size: 14px; background: #fff; }
.btn.sm { padding: 7px 14px; font-size: 13px; }
.ok-card { text-align: center; padding: 26px 14px; }
.ok-icon { font-size: 40px; margin-bottom: 8px; }
.ok-card b { font-size: 17px; color: var(--navy); }
.ok-card p { margin: 10px 0 14px; }
@media (min-width: 760px) {
  .wrap { max-width: 720px; margin: 0 auto; }
  .form-grid { grid-template-columns: 1fr 1fr; }
  .stat-row { max-width: 720px; margin-left: auto; margin-right: auto; }
}

/* ===== 采集页悬浮操作条：吸附在底部导航上方，不出画面 ===== */
.action-dock {
  position: fixed; left: 0; right: 0; bottom: 56px;
  padding: 12px 16px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(244,246,250,0), var(--bg) 40%);
  z-index: 40;
}
.action-dock .btn { box-shadow: 0 8px 20px rgba(0,0,0,.22); }

/* ===== 聊天页防呆：记录限高内部滚，答题区常驻吸底 ===== */
.chat-box {
  max-height: 34vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  margin: 8px 14px; padding: 12px;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
}
.chat-bottom {
  position: sticky; bottom: 56px; z-index: 30;
  background: var(--bg); padding-bottom: 4px;
}
.chat-bottom .chat-input { position: static; }
.chat-sug {
  background: #eef4ff; border: 1px solid #c7d8f8; border-radius: 12px;
  margin: 8px 14px; padding: 10px 12px;
}
.sug-title { font-weight: 600; color: var(--navy); }
@keyframes sugPulse {
  0% { box-shadow: 0 0 0 0 rgba(37,99,235,.45); }
  100% { box-shadow: 0 0 0 18px rgba(37,99,235,0); }
}
.chat-sug.pulse { animation: sugPulse 1.1s ease-out 2; }
.chat-foot { padding: 4px 16px 6px; }

/* ===== 首页 AI 悬浮对话按钮（律师形象右下角） ===== */
.advisor-card .ai-fab {
  position: absolute; right: 10px; bottom: 52px; z-index: 5;
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--blue); color: #fff; font-size: 20px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 16px rgba(0,0,0,.3); text-decoration: none;
  animation: fabBreath 2.4s ease-in-out infinite;
}
@keyframes fabBreath { 0%,100% { transform: scale(1); } 50% { transform: scale(1.08); } }

/* ===== 聊天语音按钮与录音状态 ===== */
.chat-input .mic { background: #fff; color: var(--navy); border: 1px solid var(--line); border-radius: 20px; padding: 0 14px; font-size: 16px; }
.chat-input .mic.rec { background: #e74c3c; color: #fff; border-color: #e74c3c; animation: fabBreath 1s ease-in-out infinite; }
.rec-tip {
  position: fixed; left: 50%; bottom: 130px; transform: translateX(-50%);
  background: rgba(0,0,0,.75); color: #fff; font-size: 13px;
  padding: 8px 16px; border-radius: 20px; z-index: 60; pointer-events: none;
}
/* 即时反馈占位气泡 */
.bubble.typing { color: var(--muted); }
.bubble.typing::after {
  content: '…'; display: inline-block; overflow: hidden; vertical-align: bottom;
  animation: typingDots 1.2s steps(4) infinite; width: 1.2em;
}
@keyframes typingDots { 0% { width: 0; } 100% { width: 1.2em; } }
