:root {
  --bg: #f4f6fa;
  --card: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #1d4ed8;
  --brand-dark: #0f172a;
  --ok: #059669;
  --warn: #d97706;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Microsoft YaHei', 'PingFang SC', sans-serif; background: var(--bg); color: var(--ink); min-height: 100vh; }

header { background: var(--brand-dark); color: #fff; padding: 14px 28px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 10; }
.logo { font-size: 20px; font-weight: 700; letter-spacing: 1px; }
.logo span { font-weight: 400; font-size: 14px; opacity: .75; margin-left: 12px; }
nav { display: flex; gap: 8px; }
.nav-btn { background: transparent; border: 1px solid rgba(255,255,255,.25); color: #cbd5e1; padding: 7px 16px; border-radius: 6px; cursor: pointer; font-size: 14px; }
.nav-btn.active { background: #fff; color: var(--brand-dark); border-color: #fff; font-weight: 600; }

main { max-width: 960px; margin: 0 auto; padding: 28px 20px 60px; }
.tab { display: none; }
.tab.active { display: block; }
.hidden { display: none !important; }

h2 { font-size: 22px; margin-bottom: 8px; }
.hint { color: var(--muted); font-size: 13px; margin-bottom: 16px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; background: var(--card); padding: 22px; border-radius: 10px; border: 1px solid var(--line); margin-bottom: 18px; align-items: start; }
/* 2026-08-19: 固定 label 高度 = 文字行 + 6px gap + input 高度 (≈64px)
   保证"公司名称*" 撑高 label 时, 行业 / 规模 label 也不会错位 */
.form-grid label { font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 6px; min-height: 64px; }
/* 2026-08-19: label 内文字统一包在 .lbl span 里 (避免裸 text node 被 flex 当独立行)
   必填标记 * 用 .lbl::before, 跟 .lbl 文字同行 — 不再因 <i> 元素撑高 label 21px */
.form-grid .lbl { font-size: 13px; color: var(--muted); }
.form-grid label[data-required] .lbl::before { content: '*'; color: #dc2626; margin-right: 3px; font-weight: 600; }
.form-grid .full { grid-column: 1 / -1; min-height: 0; }
.form-grid input, .form-grid select, .form-grid textarea { font-size: 15px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; font-family: inherit; }
.form-grid input:focus, .form-grid textarea:focus { outline: 2px solid var(--brand); border-color: transparent; }

button.primary { background: var(--brand); color: #fff; border: none; padding: 10px 22px; border-radius: 6px; font-size: 15px; cursor: pointer; }
button.primary:hover { background: #1e40af; }
button.big { padding: 13px 32px; font-size: 16px; }
button.ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); padding: 7px 14px; border-radius: 6px; cursor: pointer; font-size: 13px; }
button.ghost:hover { border-color: var(--brand); color: var(--brand); }

/* 聊天 */
.chat-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; flex-wrap: wrap; gap: 8px; }
.chat-meta { display: flex; gap: 10px; align-items: center; font-size: 13px; color: var(--muted); }
.chat-box { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 18px; height: 46vh; min-height: 300px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 78%; padding: 10px 14px; border-radius: 12px; font-size: 15px; line-height: 1.65; white-space: pre-wrap; }
.msg.assistant { background: #eef2ff; color: #1e293b; align-self: flex-start; border-bottom-left-radius: 3px; }
.msg.user { background: var(--brand); color: #fff; align-self: flex-end; border-bottom-right-radius: 3px; }
.msg.system { background: #fef9c3; color: #713f12; align-self: center; font-size: 13px; max-width: 90%; text-align: center; }
.chat-input-row { display: flex; gap: 10px; margin-top: 14px; }
.chat-input-row input { flex: 1; font-size: 15px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; }
.mic { width: 52px; height: 52px; border-radius: 50%; border: none; background: var(--brand); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: background .15s; }
.mic.listening { background: #dc2626; animation: pulse 1.2s infinite; }
@keyframes pulse { 0%{box-shadow:0 0 0 0 rgba(220,38,38,.45)} 70%{box-shadow:0 0 0 16px rgba(220,38,38,0)} 100%{box-shadow:0 0 0 0 rgba(220,38,38,0)} }
.mic-status { text-align: center; color: var(--muted); font-size: 13px; min-height: 20px; margin-top: 8px; }
.voice-tip { text-align: center; color: var(--muted); font-size: 12px; margin-top: 10px; }
/* 2026-08-18: 阶段徽章 — 让用户看到 [思考 1.2s] / [AI 打字中 0.3s] / [合成语音 3.8s] / [播放中 2.1s] */
.stage-badge { font-size: 11px; color: var(--muted); padding: 2px 8px; align-self: flex-start; background: #f1f5f9; border-radius: 4px; font-family: ui-monospace, SFMono-Regular, monospace; margin-bottom: -4px; }

/* 报告 */
.report-card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 26px; margin-bottom: 16px; }
.level-badge { display: inline-flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.level-badge .lv { font-size: 44px; font-weight: 800; color: var(--brand); }
.level-badge .lv-name { font-size: 17px; color: var(--ink); font-weight: 600; }
.level-badge .conf { font-size: 12px; color: var(--muted); }
.strategy-coop { border-left: 5px solid var(--ok); }
.strategy-exch { border-left: 5px solid var(--warn); }
.dim-list { display: flex; flex-direction: column; gap: 12px; }
.dim-item .dim-head { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 5px; }
.dim-item .dim-head b { font-weight: 600; }
.dim-bar { height: 10px; background: #eef2f7; border-radius: 5px; overflow: hidden; }
.dim-bar i { display: block; height: 100%; background: linear-gradient(90deg,#3b82f6,#1d4ed8); border-radius: 5px; }
.dim-ev { font-size: 12px; color: var(--muted); margin-top: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font-size: 13px; background: #f1f5f9; padding: 6px 12px; border-radius: 20px; color: #334155; }
.chip.warn { background: #fef3c7; color: #92400e; }
.report-actions { display: flex; gap: 12px; margin-top: 6px; flex-wrap: wrap; align-items: center; }
/* 2026-08-19: 报告页"客户邮箱"输入框 — 跟按钮齐高, 默认偏暗, 聚焦变蓝 */
.client-email { font-size: 15px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 6px; min-width: 280px; font-family: inherit; }
.client-email:focus { outline: 2px solid var(--brand); border-color: transparent; }

/* 记录 */
.records { display: flex; flex-direction: column; gap: 10px; }
.record-item { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 14px 18px; display: flex; justify-content: space-between; align-items: center; cursor: pointer; }
.record-item:hover { border-color: var(--brand); }
.record-item .r-company { font-weight: 600; font-size: 15px; }
.record-item .r-meta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.record-lv { font-weight: 800; color: var(--brand); font-size: 18px; }
.record-lv.exch { color: var(--warn); }

/* 设置 */
.settings-card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 22px; margin-bottom: 18px; }
.settings-card h3 { font-size: 16px; margin-bottom: 14px; }
.settings-card .form-grid { border: none; padding: 0; margin-bottom: 6px; }

.toast { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(80px); background: var(--ink); color: #fff; padding: 11px 22px; border-radius: 8px; font-size: 14px; opacity: 0; transition: all .3s; z-index: 100; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
  header { padding: 12px 16px; flex-direction: column; gap: 10px; }
  .msg { max-width: 92%; }
}

@media print {
  header, nav, .report-actions, .toast, .voice-tip, #tab-settings, #tab-records { display: none !important; }
  body { background: #fff; }
  main { max-width: 100%; padding: 0; }
  .report-card { border: none; padding: 10px 0; page-break-inside: avoid; }
}

/* 2026-08-19: 字幕带 — 手机浏览器 TTS 不可靠, 用显眼字幕让用户"看到" AI 说什么 */
.subtitle-band {
  display: none;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  color: #92400e;
  border-left: 4px solid #f59e0b;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 15px;
  line-height: 1.6;
  margin-bottom: 10px;
  animation: subtitlePulse 1.6s ease-in-out infinite;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.18);
}
.subtitle-band.show { display: block; }
@keyframes subtitlePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}
