/* ============================================
   GEO企业诊断Agent — Premium UI
   云小策 · 暗黑/明亮双主题
   ============================================ */

/* === CSS Variables === */
:root {
  /* Light Theme */
  --bg-primary: #F8F9FC;
  --bg-secondary: #FFFFFF;
  --bg-tertiary: #F1F3F9;
  --bg-glass: rgba(255,255,255,0.7);
  --text-primary: #1A1D2E;
  --text-secondary: #5A5F7A;
  --text-tertiary: #8B90A5;
  --border-color: #E4E7F0;
  --border-subtle: #F0F2F7;
  
  --accent-primary: #6366F1;
  --accent-secondary: #8B5CF6;
  --accent-gradient: linear-gradient(135deg, #6366F1, #8B5CF6, #A855F7);
  --accent-glow: rgba(99,102,241,0.15);
  
  --success: #10B981;
  --warning: #F59E0B;
  --error: #EF4444;
  --info: #3B82F6;
  
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.08);
  --shadow-glow: 0 0 40px rgba(99,102,241,0.12);
  
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  
  --font-sans: 'Inter', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
  
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Dark Theme */
[data-theme="dark"] {
  --bg-primary: #0F1119;
  --bg-secondary: #1A1D2E;
  --bg-tertiary: #242738;
  --bg-glass: rgba(26,29,46,0.8);
  --text-primary: #EAECF5;
  --text-secondary: #9DA3BE;
  --text-tertiary: #6B7094;
  --border-color: #2E3148;
  --border-subtle: #242738;
  
  --accent-glow: rgba(99,102,241,0.2);
  
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.4);
  --shadow-glow: 0 0 40px rgba(99,102,241,0.2);
}

[data-theme="dark"] .sidebar::before {
  opacity: 0.18;
}

/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html.is-capturing-report,
html.is-capturing-report body {
  width: 100%;
  overflow-x: hidden;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
  transition: background var(--transition-smooth), color var(--transition-smooth);
}

/* === App Layout === */
.app-container {
  display: flex;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* === Sidebar === */
.sidebar {
  width: 280px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  gap: 24px;
  overflow: hidden;
  transition: all var(--transition-smooth);
  flex-shrink: 0;
  position: relative;
}

/* AI主题背景 — 科技网格 + 光晕 */
.sidebar::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    /* 节点网格 */
    radial-gradient(circle at center, var(--accent-primary) 1.5px, transparent 1.5px);
  background-size: 20px 20px;
  opacity: 0.12;
  pointer-events: none;
}

.sidebar::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    /* 中央发光球体 — AI核心 */
    radial-gradient(circle at 50% 60%, rgba(99,102,241,0.15) 0%, transparent 35%),
    /* 顶部光晕 */
    radial-gradient(ellipse at 50% 10%, rgba(139,92,246,0.12) 0%, transparent 30%),
    /* 底部光晕 */
    radial-gradient(ellipse at 50% 90%, rgba(99,102,241,0.1) 0%, transparent 40%);
  pointer-events: none;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 1;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-primary);
  position: relative;
  z-index: 1;
}

.theme-toggle {
  width: 36px; height: 36px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}
.theme-toggle:hover { border-color: var(--accent-primary); color: var(--accent-primary); }
[data-theme="dark"] .icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: none; }

.sidebar-stats {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stat-card {
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid var(--border-subtle);
  transition: all var(--transition-fast);
}
.stat-card:hover { border-color: var(--accent-primary); }
.stat-label { font-size: 0.8rem; color: var(--text-tertiary); }
.stat-value { font-size: 1.2rem; font-weight: 700; background: var(--accent-gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }

.sidebar-sections { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.section-title { font-size: 0.75rem; font-weight: 600; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.05em; padding: 0 4px; margin-bottom: 4px; }

.module-list { display: flex; flex-direction: column; gap: 4px; }

.module-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
}
.module-item.active {
  background: var(--accent-glow);
  border-color: rgba(99,102,241,0.2);
}
.module-item.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.module-item.disabled:hover { opacity: 0.7; background: var(--bg-tertiary); }
.module-icon { font-size: 1.1rem; }
.module-info { display: flex; flex-direction: column; gap: 2px; }
.module-name { font-size: 0.85rem; font-weight: 500; color: var(--text-primary); }
.module-status { font-size: 0.7rem; color: var(--text-tertiary); }
.module-item.active .module-status { color: var(--accent-primary); }

/* === Main Content === */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* === Top Bar === */
.top-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 24px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
  backdrop-filter: blur(20px);
}

.mobile-menu-btn {
  display: none;
  width: 36px; height: 36px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  background: var(--bg-tertiary);
  cursor: pointer;
  color: var(--text-secondary);
  align-items: center;
  justify-content: center;
}

.top-bar-title { display: flex; align-items: center; gap: 10px; flex: 1; }
.top-bar-title h1 { font-size: 1rem; font-weight: 600; color: var(--text-primary); }
.badge {
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  background: var(--accent-gradient);
  color: white;
}

.progress-bar-container {
  flex: 2;
  max-width: 300px;
}
.progress-info {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 0.75rem;
  color: var(--text-tertiary);
}
.progress-count { font-weight: 600; color: var(--accent-primary); }
.progress-bar {
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--accent-gradient);
  border-radius: 3px;
  transition: width var(--transition-smooth);
}

.btn-new-session {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}
.btn-new-session:hover { border-color: var(--accent-primary); color: var(--accent-primary); }

/* === Chat Area === */
.chat-area {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}

/* === Welcome Screen === */
.welcome-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  position: relative;
}
.welcome-glow {
  position: absolute;
  width: 400px; height: 400px;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.welcome-content {
  text-align: center;
  position: relative;
  z-index: 1;
  max-width: 540px;
}
.welcome-icon { margin-bottom: 24px; display: inline-block; }
.welcome-content h2 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 12px;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.welcome-content p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.8;
  margin-bottom: 32px;
}

.welcome-features {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 32px;
}
.feature-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--bg-tertiary);
  border-radius: 20px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}
.feature-icon { font-size: 1rem; }

.btn-start {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 36px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--accent-gradient);
  color: white;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-glow);
  transition: all var(--transition-smooth);
  font-family: var(--font-sans);
}
.btn-start:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 50px rgba(99,102,241,0.3);
}
.btn-start:active { transform: translateY(0); }

/* === Chat Messages === */
.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
}

.message {
  display: flex;
  gap: 12px;
  animation: messageIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes messageIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.message-agent { align-self: flex-start; }
.message-user { flex-direction: row-reverse; align-self: flex-end; }

.message-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
}
.message-agent .message-avatar {
  background: var(--accent-gradient);
  color: white;
}
.message-user .message-avatar {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

.message-bubble {
  max-width: 75%;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  line-height: 1.7;
  word-wrap: break-word;
}

.message-agent .message-bubble {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow-sm);
}

.message-user .message-bubble {
  background: var(--accent-gradient);
  color: white;
  border-bottom-right-radius: 4px;
}

.message-bubble strong { font-weight: 600; }
.message-bubble p { margin-bottom: 8px; }
.message-bubble p:last-child { margin-bottom: 0; }

/* Message Options */
.message-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.option-btn {
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: var(--font-sans);
}
.option-btn:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  background: var(--accent-glow);
}

/* === Typing Indicator === */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 14px 18px;
  max-width: 100px;
}
.typing-indicator span {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-tertiary);
  animation: typingBounce 1.4s infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-8px); opacity: 1; }
}

/* === Input Area === */
.input-area {
  padding: 16px 24px 20px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-shrink: 0;
  backdrop-filter: blur(20px);
}

.input-wrapper {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
}

#userInput {
  flex: 1;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 16px;
  font-family: var(--font-sans);
  resize: none;
  outline: none;
  transition: all var(--transition-fast);
  line-height: 1.5;
  max-height: 120px;
  touch-action: manipulation;
  -webkit-appearance: none;
  appearance: none;
}
#userInput:focus { border-color: var(--accent-primary); box-shadow: 0 0 0 3px var(--accent-glow); }
#userInput::placeholder { color: var(--text-tertiary); }

.btn-send {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--accent-gradient);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-smooth);
  flex-shrink: 0;
  box-shadow: 0 2px 12px rgba(99,102,241,0.3);
  touch-action: manipulation;
}
.btn-send:hover { transform: scale(1.05); box-shadow: 0 4px 20px rgba(99,102,241,0.4); }
.btn-send:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.quick-replies {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
}
.quick-reply-btn {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: var(--font-sans);
  white-space: nowrap;
}
.quick-reply-btn:hover { border-color: var(--accent-primary); color: var(--accent-primary); }

/* === Report Container === */
.report-container {
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 0;
}

.report-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-md);
  animation: messageIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.report-header {
  text-align: center;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 2px solid var(--border-subtle);
}
.report-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 8px;
}
.report-header .company-name {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--accent-primary);
  margin-bottom: 4px;
}
.report-header .report-id { font-size: 0.8rem; color: var(--text-tertiary); }

.report-section {
  margin-bottom: 28px;
}
.report-section:last-child { margin-bottom: 0; }
.report-section h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Summary Grid */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}
.summary-item {
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  border: 1px solid var(--border-subtle);
}
.summary-item .s-label { font-size: 0.75rem; color: var(--text-tertiary); margin-bottom: 4px; }
.summary-item .s-value { font-size: 0.9rem; font-weight: 600; color: var(--text-primary); }

/* Pain Point Cards */
.pain-points-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.pain-point-card {
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--accent-primary);
  transition: all var(--transition-fast);
}
.pain-point-card:hover { border-color: var(--accent-primary); }
.pain-point-card.critical { border-left-color: var(--error); }
.pain-point-card.high { border-left-color: var(--warning); }
.pain-point-card .pp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.pp-title { font-weight: 600; font-size: 1rem; }
.pp-badge {
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 600;
}
.pp-badge.critical { background: rgba(239,68,68,0.1); color: var(--error); }
.pp-badge.high { background: rgba(245,158,11,0.1); color: var(--warning); }
.pp-badge.medium { background: rgba(59,130,246,0.1); color: var(--info); }
.pp-desc { color: var(--text-secondary); font-size: 0.88rem; line-height: 1.7; margin-bottom: 10px; }
.pp-diagnosis { 
  background: rgba(99,102,241,0.05); 
  padding: 12px 16px; 
  border-radius: var(--radius-xs);
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.7;
  border: 1px dashed var(--border-color);
}
.pp-impact {
  display: flex;
  gap: 16px;
  margin-top: 10px;
  font-size: 0.8rem;
  color: var(--text-tertiary);
}
.pp-impact span { display: flex; align-items: center; gap: 4px; }

/* Solution Cards */
.solutions-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}
.solution-card {
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  padding: 24px;
  border: 1px solid var(--border-subtle);
  transition: all var(--transition-fast);
}
.solution-card:hover { border-color: var(--accent-primary); transform: translateY(-2px); }
.solution-card .sol-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.sol-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius-sm);
  background: var(--accent-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}
.sol-name { font-weight: 600; font-size: 0.95rem; }
.sol-desc { color: var(--text-secondary); font-size: 0.85rem; line-height: 1.7; margin-bottom: 14px; }
.sol-steps { display: flex; flex-direction: column; gap: 8px; }
.sol-step {
  display: flex;
  gap: 10px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  align-items: flex-start;
}
.sol-step-num {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--accent-gradient);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 600;
  flex-shrink: 0;
  margin-top: 1px;
}
.sol-result {
  margin-top: 16px;
  padding: 12px;
  background: rgba(16,185,129,0.08);
  border-radius: var(--radius-xs);
  font-size: 0.8rem;
  color: var(--success);
  font-weight: 500;
}
.sol-case {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-top: 8px;
  font-style: italic;
}

/* Roadmap */
.roadmap-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
}
.roadmap-list::before {
  content: '';
  position: absolute;
  left: 20px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border-color);
}
.roadmap-item {
  display: flex;
  gap: 16px;
  padding-left: 40px;
  position: relative;
}
.roadmap-dot {
  position: absolute;
  left: 11px;
  top: 6px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--accent-gradient);
  border: 3px solid var(--bg-secondary);
  z-index: 1;
}
.roadmap-content {
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  border: 1px solid var(--border-subtle);
  flex: 1;
}
.roadmap-phase { font-size: 0.75rem; color: var(--accent-primary); font-weight: 600; }
.roadmap-timeline { font-size: 0.78rem; color: var(--text-tertiary); margin-bottom: 8px; }
.roadmap-name { font-weight: 600; font-size: 0.95rem; margin-bottom: 10px; }
.roadmap-tasks { display: flex; flex-direction: column; gap: 6px; }
.roadmap-task { font-size: 0.83rem; color: var(--text-secondary); display: flex; align-items: flex-start; gap: 8px; }
.roadmap-task::before { content: '•'; color: var(--accent-primary); }
.roadmap-deliverable {
  margin-top: 12px;
  padding: 10px 14px;
  background: rgba(99,102,241,0.06);
  border-radius: var(--radius-xs);
  font-size: 0.8rem;
  color: var(--accent-primary);
  font-weight: 500;
}

/* Benchmark Table */
.benchmark-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.benchmark-table th {
  text-align: left;
  padding: 12px 16px;
  background: var(--bg-tertiary);
  border-bottom: 2px solid var(--border-color);
  font-weight: 600;
  color: var(--text-primary);
}
.benchmark-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}
.benchmark-table .target { color: var(--accent-primary); font-weight: 500; }

/* Consultant Message */
.consultant-msg {
  background: linear-gradient(135deg, rgba(99,102,241,0.05), rgba(139,92,246,0.05));
  border: 1px solid rgba(99,102,241,0.15);
  border-radius: var(--radius-lg);
  padding: 28px;
  position: relative;
  overflow: hidden;
}
.consultant-msg::before {
  content: '"';
  position: absolute;
  top: -10px; left: 16px;
  font-size: 6rem;
  color: var(--accent-primary);
  opacity: 0.1;
  font-family: serif;
  line-height: 1;
}
.consultant-msg .cm-title { font-size: 1.1rem; font-weight: 600; margin-bottom: 16px; }
.consultant-msg .cm-content { font-size: 0.88rem; color: var(--text-secondary); line-height: 1.9; white-space: pre-line; }
.consultant-msg .cm-signature { font-size: 0.85rem; color: var(--text-tertiary); margin-top: 20px; font-style: italic; }

/* Report Actions */
.report-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 24px;
  flex-wrap: wrap;
}
.btn-report {
  padding: 12px 28px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--transition-smooth);
  font-family: var(--font-sans);
}
.btn-report-primary {
  background: var(--accent-gradient);
  color: white;
  border: none;
  box-shadow: var(--shadow-glow);
}
.btn-report-primary:hover { transform: translateY(-2px); }
.btn-report-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}
.btn-report-secondary:hover { border-color: var(--accent-primary); }

/* === Error State === */
.error-message {
  color: var(--error);
  font-size: 0.85rem;
  padding: 12px 16px;
  background: rgba(239,68,68,0.08);
  border-radius: var(--radius-xs);
  border: 1px solid rgba(239,68,68,0.2);
}

/* === Scrollbar === */
.chat-area::-webkit-scrollbar { width: 6px; }
.chat-area::-webkit-scrollbar-track { background: transparent; }
.chat-area::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }
.chat-area::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

/* === Responsive === */
/* Mobile first: 默认适配小屏，768px以上用桌面增强 */

@media (max-width: 767px) {
  html { font-size: 15px; }

  /* 侧边栏 - 隐藏，通过汉堡菜单滑出 */
  .sidebar {
    position: fixed;
    left: -280px;
    top: 0; bottom: 0;
    z-index: 100;
    box-shadow: var(--shadow-lg);
    transition: left var(--transition-smooth);
    width: 260px;
  }
  .sidebar.open { left: 0; }
  .mobile-menu-btn { display: flex; }

  /* 顶部栏精简 */
  .top-bar {
    padding: 10px 12px;
    gap: 8px;
  }
  .top-bar-title h1 { font-size: 0.85rem; }
  .progress-bar-container { display: none; }
  .btn-new-session {
    font-size: 0.72rem;
    padding: 6px 10px;
  }
  .btn-new-session span { display: none; }

  /* 聊天区域 */
  .chat-area {
    padding: 12px 8px;
    gap: 12px;
  }

  /* 欢迎页 */
  .welcome-screen { padding: 20px 16px; }
  .welcome-content { max-width: 100%; }
  .welcome-content h2 { font-size: 1.35rem; }
  .welcome-content p { font-size: 0.88rem; line-height: 1.7; }
  .welcome-features { gap: 6px; }
  .feature-item { font-size: 0.75rem; padding: 6px 10px; }
  .btn-start { width: 100%; justify-content: center; }

  /* 消息气泡 */
  .chat-messages { gap: 14px; }
  .message { gap: 8px; }
  .message-avatar {
    width: 30px; height: 30px;
    font-size: 0.75rem;
  }
  .message-bubble {
    max-width: 88%;
    padding: 10px 14px;
    font-size: 0.88rem;
    line-height: 1.6;
  }

  /* 输入区域 */
  .input-area {
    padding: 10px 8px 14px;
    gap: 8px;
    position: sticky;
    bottom: 0;
    z-index: 10;
  }
  .input-wrapper { gap: 8px; }
  #userInput {
    padding: 10px 14px;
    font-size: 16px;
    border-radius: var(--radius-sm);
  }
  .btn-send {
    width: 40px; height: 40px;
  }

  /* 多选按钮 */
  .message-options { gap: 6px; margin-top: 10px; }
  .option-btn {
    padding: 6px 12px;
    font-size: 0.8rem;
  }
  .option-checkbox {
    padding: 10px 12px;
    font-size: 0.82rem;
    gap: 8px;
  }
  .confirm-btn { padding: 12px 0; font-size: 0.88rem; }

  /* 完成弹窗 */
  .completion-modal { padding: 32px 16px; }
  .completion-icon { width: 52px; height: 52px; font-size: 1.6rem; }
  .completion-modal h2 { font-size: 1.2rem; }

  /* 进度条 */
  .top-bar .progress-bar-container {
    display: flex;
    flex: 1;
    max-width: none;
  }
  .top-bar .progress-bar-container .progress-label {
    display: none;
  }

  /* 选项区域 */
  .quick-replies { gap: 6px; }
  .quick-reply-btn {
    padding: 5px 10px;
    font-size: 0.75rem;
  }

  /* 暗色主题侧边栏阴影 */
  [data-theme="dark"] .sidebar.open {
    box-shadow: 0 0 40px rgba(0,0,0,0.5);
  }
}

/* 平板/桌面增强 */
@media (min-width: 768px) {
  .chat-messages { gap: 20px; }
  .message-bubble {
    max-width: 72%;
    padding: 14px 18px;
  }
  .top-bar { padding: 16px 24px; }
  .top-bar-title h1 { font-size: 1rem; }
}

/* 大屏桌面 */
@media (min-width: 900px) {
  .sidebar {
    position: relative;
    left: 0;
  }
  .progress-bar-container { display: block !important; }
}

/* === Insight Cards (New) === */
.insight-card {
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  border: 1px solid var(--border-subtle);
  margin-bottom: 14px;
}
.insight-card h4 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent-primary);
  margin-bottom: 10px;
}
.insight-body {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.8;
}
.insight-body p { margin-bottom: 8px; }
.insight-body p:last-child { margin-bottom: 0; }

/* === Action Overview === */
.action-overview {
  padding: 16px 20px;
  background: linear-gradient(135deg, rgba(99,102,241,0.06), rgba(139,92,246,0.04));
  border-radius: var(--radius-sm);
  border: 1px solid rgba(99,102,241,0.12);
  margin-bottom: 24px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.7;
}

/* === Expected Outcome === */
.expected-outcome {
  margin-top: 20px;
  padding: 16px 20px;
  background: rgba(16,185,129,0.06);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(16,185,129,0.15);
  font-size: 0.88rem;
  color: var(--text-primary);
  line-height: 1.7;
  font-weight: 500;
}

/* === Completion Modal (重新设计) === */
.completion-modal {
  text-align: center;
  padding: 22px 18px 28px;
  animation: fadeInUp 0.5s ease-out;
}

.completion-header {
  margin-bottom: 12px;
}

.completion-icon {
  width: 48px; height: 48px;
  margin: 0 auto 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10B981, #06D6A0);
  color: white;
  font-size: 1.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.25);
}

.completion-modal h2 {
  font-size: 1.32rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}

.completion-subtitle {
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.5;
  margin: 0;
}

/* === 二维码卡片 === */
.completion-card {
  display: grid;
  grid-template-columns: minmax(240px, 0.88fr) minmax(300px, 1.12fr);
  align-items: center;
  gap: 20px;
  max-width: min(820px, 94vw);
  margin: 0 auto 18px;
  padding: 18px;
  background:
    radial-gradient(circle at 92% 12%, rgba(14,165,233,0.16), transparent 34%),
    linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,250,252,0.95));
  border: 1px solid rgba(59,130,246,0.14);
  border-radius: 26px;
  box-shadow: 0 24px 62px rgba(15,23,42,0.16), 0 0 0 1px rgba(255,255,255,0.72) inset;
  text-align: left;
}

.qr-code-wrap {
  width: 100%;
  max-width: 390px;
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  padding: 8px;
  background: linear-gradient(135deg, rgba(14,165,233,0.18), rgba(37,99,235,0.12));
  border-radius: 24px;
  box-shadow: 0 18px 44px rgba(2,132,199,0.22), 0 0 0 1px rgba(255,255,255,0.9) inset;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.qr-code-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  border-radius: 18px;
}

.qr-card-content {
  display: grid;
  justify-items: start;
  padding: 4px 4px 4px 8px;
}

.qr-card-title {
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
  line-height: 1.35;
}

.qr-card-desc {
  max-width: 360px;
  margin: 0 0 12px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.65;
}

.qr-benefits {
  list-style: none;
  padding: 0;
  margin: 0 0 12px;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 8px 12px;
}

.qr-benefits li {
  font-size: 0.86rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.check-dot {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366F1, #8B5CF6);
  flex-shrink: 0;
  position: relative;
}

.check-dot::after {
  content: '';
  position: absolute;
  top: 4px;
  left: 5px;
  width: 5px;
  height: 7px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.qr-card-note {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(59,130,246,0.08);
  color: #2563EB;
  font-size: 0.84rem;
  font-weight: 600;
  margin: 0;
}

/* === 生成中动画 === */
.generating-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 8px;
}

.gen-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-primary);
  animation: genPulse 1.4s ease-in-out infinite;
}

.gen-dot:nth-child(2) { animation-delay: 0.2s; }
.gen-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes genPulse {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

.generating-text {
  font-size: 0.82rem;
  color: var(--text-tertiary);
  margin: 0;
}

.generating-bar.is-ready .gen-dot {
  width: 9px;
  height: 9px;
  background: #10B981;
  animation: none;
  opacity: 1;
}

.generating-text.is-ready {
  color: #059669;
  font-weight: 700;
}

/* === 响应式 === */
@media (max-width: 480px) {
  .completion-modal { padding: 14px 10px 22px; }
  .completion-header { margin-bottom: 8px; }
  .completion-icon { width: 42px; height: 42px; margin-bottom: 8px; }
  .completion-modal h2 { font-size: 1.12rem; margin-bottom: 4px; }
  .completion-subtitle { font-size: 0.82rem; line-height: 1.45; }
  .completion-card {
    max-width: calc(100vw - 24px);
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 12px;
    border-radius: 22px;
    text-align: center;
    margin-bottom: 14px;
  }
  .qr-card-content {
    justify-items: center;
    text-align: center;
    padding: 0 4px;
  }
  .qr-card-title { font-size: 0.98rem; margin-bottom: 6px; }
  .qr-card-desc { font-size: 0.82rem; line-height: 1.5; margin-bottom: 8px; }
  .qr-benefits { gap: 6px 8px; margin-bottom: 8px; }
  .qr-benefits li { font-size: 0.78rem; }
  .qr-card-note { min-height: 28px; padding: 5px 10px; font-size: 0.78rem; }
  .qr-benefits li { justify-content: center; }
  .qr-code-wrap {
    width: min(355px, calc(100vw - 52px));
    max-width: min(355px, calc(100vw - 52px));
    border-radius: 20px;
    padding: 6px;
  }
  .qr-code-img { border-radius: 15px; }
}

/* === Multi-Select Checkboxes === */
.multi-select {
  flex-direction: column;
  gap: 6px;
}
.option-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 0.85rem;
  color: var(--text-primary);
  user-select: none;
}
.option-checkbox:hover {
  border-color: var(--accent-primary);
  background: var(--accent-glow);
}
.option-checkbox input[type="checkbox"] {
  accent-color: var(--accent-primary);
  width: 16px; height: 16px;
}
.confirm-btn {
  display: block;
  width: 100%;
  padding: 10px 0;
  margin-top: 10px;
  border: none;
  border-radius: var(--radius-xs);
  background: var(--accent-gradient);
  color: white;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all var(--transition-fast);
  font-family: var(--font-sans);
}
.confirm-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(99,102,241,0.3);
}

/* === Report Content (DeepSeek Markdown) === */
.report-content {
  max-width: 800px;
  margin: 0 auto;
  line-height: 1.85;
}
.report-content h1 {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 8px 0 20px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--border-color);
}
.report-content h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 28px 0 14px;
  color: var(--accent-primary);
}
.report-content h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 16px 0 8px;
  color: var(--text-primary);
}
.report-content p {
  font-size: 0.88rem;
  margin-bottom: 10px;
  color: var(--text-secondary);
}
.report-content strong {
  color: var(--text-primary);
}
.report-content ul, .report-content ol {
  padding-left: 20px;
  margin-bottom: 12px;
}
.report-content li {
  font-size: 0.86rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.report-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 0.84rem;
}
.report-content th {
  text-align: left;
  padding: 10px 14px;
  background: var(--bg-tertiary);
  border-bottom: 2px solid var(--border-color);
  font-weight: 600;
  color: var(--text-primary);
}
.report-content td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}
.report-content hr {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 24px 0;
}
.report-content blockquote {
  border-left: 3px solid var(--accent-primary);
  padding: 8px 16px;
  margin: 12px 0;
  background: var(--accent-glow);
  border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
  font-size: 0.86rem;
  color: var(--text-secondary);
}
