/* ==========================================================================
   ReachAgent · ChatGPT 风格界面
   深色官网 VI：背景 #0B1220 · 卡片 #1F2937 · 主色 emerald #10B981
   ========================================================================== */

/* ---------- 布局骨架 ---------- */
html, body {
  height: 100%;
  margin: 0;
}
body.ra-app {
  display: flex;
  flex-direction: column;
  background: var(--color-bg, #0B1220);
  color: var(--color-text, #F9FAFB);
  font-family: var(--font-sans, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif);
  height: 100vh;
  overflow: hidden;
}

/* ---------- 顶栏 ---------- */
.ra-topbar {
  flex-shrink: 0;
  border-bottom: 1px solid var(--color-border, #1F2937);
  background: rgba(11, 18, 32, 0.9);
  backdrop-filter: blur(12px);
  z-index: 10;
}
.ra-topbar__inner {
  max-width: 980px;
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.ra-topbar__left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ra-topbar__logo {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--color-brand, #10B981), #059669);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 15px;
  text-decoration: none;
  flex-shrink: 0;
}
.ra-topbar__brand { display: flex; flex-direction: column; min-width: 0; }
.ra-topbar__title { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.2; }
.ra-topbar__sub { font-size: 11px; color: var(--color-text-muted, #9CA3AF); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ra-topbar__right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.ra-topbar__status {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--color-text-muted, #9CA3AF);
  padding: 5px 10px; border-radius: 999px;
  background: rgba(255,255,255,0.04);
  white-space: nowrap;
}
.ra-topbar__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--color-brand, #10B981); box-shadow: 0 0 8px rgba(16,185,129,0.8); }
.ra-topbar__btn {
  font-size: 13px; color: var(--color-text-muted, #9CA3AF);
  background: transparent; border: 1px solid var(--color-border, #1F2937);
  border-radius: 8px; padding: 6px 12px; cursor: pointer;
  transition: all 0.2s; text-decoration: none; white-space: nowrap;
}
.ra-topbar__btn:hover { color: var(--color-text, #F9FAFB); border-color: var(--color-brand, #10B981); background: rgba(16,185,129,0.08); }

/* ---------- 聊天主区（滚动） ---------- */
.ra-chat {
  flex: 1;
  overflow-y: auto;
  scroll-behavior: smooth;
  display: flex;
  flex-direction: column;
}
.ra-chat::-webkit-scrollbar { width: 6px; }
.ra-chat::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 3px; }
.ra-chat::-webkit-scrollbar-track { background: transparent; }

/* 消息流容器：居中窄栏 */
.ra-messages {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 20px 8px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  box-sizing: border-box;
}

/* ---------- 欢迎态 ---------- */
.ra-welcome {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 60px 20px 20px;
  text-align: center;
  box-sizing: border-box;
  animation: ra-fade-up 0.5s ease-out;
}
.ra-welcome__logo {
  width: 64px; height: 64px;
  margin: 0 auto 18px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--color-brand, #10B981), #059669);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 800;
  box-shadow: 0 8px 30px rgba(16,185,129,0.35);
}
.ra-welcome__title { font-size: 26px; font-weight: 700; margin: 0 0 10px; letter-spacing: -0.02em; }
.ra-welcome__desc { font-size: 14px; color: var(--color-text-muted, #9CA3AF); line-height: 1.7; margin: 0 0 26px; }
.ra-welcome__desc strong { color: var(--color-brand-light, #6EE7B7); }
.ra-welcome__chips {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 10px; margin-bottom: 22px;
}
.ra-welcome__hint { font-size: 12px; color: var(--color-text-light, #6B7280); margin: 0; }

/* 建议 chips */
.ra-chip {
  font-size: 13px;
  color: var(--color-text, #F9FAFB);
  background: var(--color-surface-2, #1F2937);
  border: 1px solid var(--color-border, #1F2937);
  border-radius: 999px;
  padding: 8px 16px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.ra-chip:hover {
  border-color: var(--color-brand, #10B981);
  background: rgba(16,185,129,0.1);
  color: var(--color-brand-light, #6EE7B7);
}

/* ---------- 消息气泡 ---------- */
.ra-msg {
  display: flex;
  gap: 12px;
  animation: ra-fade-up 0.3s ease-out;
}
.ra-msg--user { flex-direction: row-reverse; }
.ra-msg__avatar {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
  flex-shrink: 0;
}
.ra-msg--assistant .ra-msg__avatar {
  background: linear-gradient(135deg, var(--color-brand, #10B981), #059669);
  color: #fff;
}
.ra-msg--user .ra-msg__avatar {
  background: var(--color-surface-2, #1F2937);
  color: var(--color-brand-light, #6EE7B7);
}
.ra-msg__body { display: flex; flex-direction: column; gap: 6px; max-width: calc(100% - 60px); }
.ra-msg__meta { font-size: 11px; color: var(--color-text-light, #6B7280); }
.ra-msg--user .ra-msg__meta { text-align: right; }
.ra-msg__text {
  font-size: 15px;
  line-height: 1.75;
  padding: 12px 16px;
  border-radius: 14px;
  word-break: break-word;
  white-space: pre-wrap;
}
.ra-msg--assistant .ra-msg__text {
  background: var(--color-surface-2, #1F2937);
  border: 1px solid var(--color-border, #1F2937);
  border-top-left-radius: 4px;
  color: var(--color-text, #F9FAFB);
}
.ra-msg--user .ra-msg__text {
  background: linear-gradient(135deg, var(--color-brand, #10B981), #059669);
  color: #fff;
  border-top-right-radius: 4px;
}

/* 模式 + 来源标签 */
.ra-srcs { display: flex; flex-wrap: wrap; gap: 6px; }
.ra-srcs__mode {
  font-size: 11px;
  color: var(--color-brand-light, #6EE7B7);
  background: rgba(16,185,129,0.1);
  border: 1px solid rgba(16,185,129,0.25);
  border-radius: 6px;
  padding: 2px 8px;
}
.ra-srcs__label { font-size: 11px; color: var(--color-text-light, #6B7280); align-self: center; }
.ra-srcs__tag {
  font-size: 11px;
  color: var(--color-accent-light, #60A5FA);
  background: rgba(59,130,246,0.1);
  border: 1px solid rgba(59,130,246,0.25);
  border-radius: 6px;
  padding: 2px 8px;
}

/* ---------- Markdown 深色样式 ---------- */
.ra-md p { margin: 0.5rem 0; }
.ra-md p:first-child { margin-top: 0; }
.ra-md p:last-child { margin-bottom: 0; }
.ra-md ul, .ra-md ol { padding-left: 1.25rem; margin: 0.5rem 0; }
.ra-md li { margin: 0.25rem 0; }
.ra-md strong { color: var(--color-brand-light, #6EE7B7); font-weight: 700; }
.ra-md h3, .ra-md h4 { color: var(--color-brand-light, #6EE7B7); margin: 0.8rem 0 0.4rem; font-size: 1.05em; }
.ra-md code {
  background: rgba(255,255,255,0.08);
  border-radius: 5px;
  padding: 1px 6px;
  font-size: 0.9em;
  font-family: var(--font-mono, "SF Mono", Menlo, monospace);
}
.ra-md pre {
  background: #0B1220;
  border: 1px solid var(--color-border, #1F2937);
  border-radius: 10px;
  padding: 12px 14px;
  overflow-x: auto;
  margin: 0.6rem 0;
}
.ra-md pre code { background: transparent; padding: 0; }
.ra-md table {
  border-collapse: collapse;
  width: 100%;
  margin: 0.6rem 0;
  font-size: 13px;
}
.ra-md th, .ra-md td {
  border: 1px solid var(--color-border, #1F2937);
  padding: 6px 10px;
  text-align: left;
}
.ra-md th { background: rgba(255,255,255,0.05); color: var(--color-text, #F9FAFB); }
.ra-md blockquote {
  border-left: 3px solid var(--color-brand, #10B981);
  margin: 0.6rem 0;
  padding: 4px 12px;
  color: var(--color-text-muted, #9CA3AF);
  background: rgba(16,185,129,0.05);
  border-radius: 0 8px 8px 0;
}
.ra-md a { color: var(--color-accent-light, #60A5FA); }

/* ---------- 动画 ---------- */
@keyframes ra-fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- 响应式 ---------- */
@media (max-width: 640px) {
  .ra-topbar__sub { display: none; }
  .ra-topbar__btn { padding: 5px 9px; font-size: 12px; }
  .ra-welcome { padding: 40px 16px 16px; }
  .ra-welcome__title { font-size: 22px; }
  .ra-messages { padding: 16px 12px 6px; gap: 14px; }
  .ra-msg__body { max-width: calc(100% - 52px); }
  .ra-msg__text { font-size: 14px; padding: 10px 14px; }
}

/* ==========================================================================
   ReachAgent · 专家方案引擎（5 步拆解）
   ========================================================================== */

/* 方案需求卡 */
.ra-plan-card__inner {
  background: var(--color-surface-2, #1F2937);
  border: 1px solid var(--color-border, #1F2937);
  border-radius: 14px;
  padding: 18px;
  max-width: 640px;
}
.ra-plan-card__title { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.ra-plan-card__sub { font-size: 12px; color: var(--color-text-muted, #9CA3AF); line-height: 1.7; margin-bottom: 14px; }

/* 表单 */
.ra-plan-form { display: flex; flex-direction: column; gap: 12px; }
.ra-field { display: flex; flex-direction: column; gap: 5px; }
.ra-field-row { display: flex; gap: 10px; }
.ra-field-row .ra-field { flex: 1; }
.ra-field__label { font-size: 12px; color: var(--color-text-muted, #9CA3AF); }
.ra-field__input {
  background: #0B1220;
  border: 1px solid var(--color-border, #1F2937);
  border-radius: 9px;
  color: var(--color-text, #F9FAFB);
  font-size: 13px;
  padding: 9px 12px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}
.ra-field__input:focus { border-color: var(--color-brand, #10B981); }
.ra-field__input::placeholder { color: var(--color-text-light, #6B7280); }
select.ra-field__input { appearance: none; }

/* 上传 */
.ra-upload { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ra-upload__btn {
  font-size: 12px;
  color: var(--color-accent-light, #60A5FA);
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: 9px;
  padding: 8px 14px;
  cursor: pointer;
  transition: all 0.2s;
}
.ra-upload__btn:hover { background: rgba(59, 130, 246, 0.18); }
.ra-upload__info { font-size: 11px; color: var(--color-text-muted, #9CA3AF); }

/* 提交 */
.ra-plan-actions { margin-top: 4px; }
.ra-plan-submit {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, var(--color-brand, #10B981), #059669);
  border: none;
  border-radius: 10px;
  padding: 10px 20px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.ra-plan-submit:hover { filter: brightness(1.1); }
.ra-plan-submit--ghost {
  background: rgba(255, 255, 255, 0.07);
  color: var(--color-text-light, #E2E8F0);
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.ra-plan-submit--ghost:hover { background: rgba(255, 255, 255, 0.12); filter: none; }
.ra-plan-hint {
  font-size: 12px;
  color: #FBBF24;
  background: rgba(251, 191, 36, 0.08);
  border: 1px solid rgba(251, 191, 36, 0.25);
  border-radius: 8px;
  padding: 8px 12px;
  margin: 4px 0 10px;
  line-height: 1.6;
}
.ra-plan-qcard__actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.ra-plan-qcard__skipped {
  font-size: 12px;
  color: var(--color-text-light, #94A3B8);
  background: rgba(110, 231, 183, 0.06);
  border: 1px dashed rgba(110, 231, 183, 0.3);
  border-radius: 8px;
  padding: 8px 12px;
  margin-top: 8px;
  line-height: 1.6;
}

/* 5 步进度 */
.ra-steps { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ra-step {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px;
  color: var(--color-text-light, #6B7280);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 999px;
  padding: 6px 12px;
}
.ra-step__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--color-text-light, #6B7280); }
.ra-step--done { color: var(--color-brand-light, #6EE7B7); border-color: rgba(16,185,129,0.3); }
.ra-step--done .ra-step__dot { background: var(--color-brand, #10B981); box-shadow: 0 0 8px rgba(16,185,129,0.6); }

/* 结果区 */
.ra-plan-result { display: flex; flex-direction: column; gap: 14px; }
.ra-plan-result__head {
  font-size: 14px; font-weight: 600;
  color: var(--color-brand-light, #6EE7B7);
  padding: 10px 14px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 10px;
}
.ra-plan-error {
  color: #FCA5A5;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.7;
}
.ra-plan-sec { display: flex; flex-direction: column; gap: 8px; }
.ra-plan-sec__title { font-size: 14px; font-weight: 700; color: var(--color-text, #F9FAFB); }
.ra-plan-sec__note { font-size: 11px; color: var(--color-text-light, #6B7280); line-height: 1.6; }
.ra-plan-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ra-plan-table th, .ra-plan-table td { border: 1px solid var(--color-border, #1F2937); padding: 7px 10px; text-align: left; }
.ra-plan-table th { background: rgba(255, 255, 255, 0.05); }
.ra-plan-table__total td { font-weight: 700; color: var(--color-brand-light, #6EE7B7); }
.ra-plan-risk { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.ra-plan-risk li {
  font-size: 12px; line-height: 1.6;
  background: rgba(245, 158, 11, 0.06);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: 9px;
  padding: 9px 12px;
  color: var(--color-text-muted, #9CA3AF);
}
.ra-plan-risk b { color: var(--color-warning, #F59E0B); }
.ra-plan-risk i { color: var(--color-text-light, #6B7280); font-size: 11px; }
.ra-plan-ev { display: flex; flex-wrap: wrap; gap: 6px; }
.ra-plan-ev__tag {
  font-size: 11px;
  color: var(--color-accent-light, #60A5FA);
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: 6px;
  padding: 3px 9px;
}
.ra-plan-report {
  background: #0B1220;
  border: 1px solid var(--color-border, #1F2937);
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 13px;
  max-height: 480px;
  overflow-y: auto;
}
.ra-plan-qcard {
  background: rgba(59, 130, 246, 0.06);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: 10px;
  padding: 12px 14px;
}
.ra-plan-qcard__title { font-size: 13px; font-weight: 600; color: var(--color-accent-light, #60A5FA); margin-bottom: 6px; }
.ra-plan-qcard__list { margin: 0 0 10px; padding-left: 18px; font-size: 13px; line-height: 1.8; }
.ra-plan-qcard__answer textarea {
  width: 100%;
  background: #0B1220;
  border: 1px solid var(--color-border, #1F2937);
  border-radius: 9px;
  color: var(--color-text, #F9FAFB);
  font-size: 13px;
  padding: 9px 12px;
  font-family: inherit;
  resize: vertical;
  box-sizing: border-box;
  margin-bottom: 8px;
  outline: none;
}
.ra-plan-qcard__answer textarea:focus { border-color: var(--color-accent, #3B82F6); }
.ra-plan-qcard__why { font-size: 11px; color: var(--color-text-light, #6B7280); }

/* ---------- 四步工作法（①深度理解意图 ②识别关键信息缺口 ③精准提问 ④定制化方案） ---------- */
.ra-workflow {
  background: rgba(16, 185, 129, 0.05);
  border: 1px solid rgba(16, 185, 129, 0.18);
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
}
.ra-workflow__title { font-size: 12px; font-weight: 700; color: var(--color-brand-light, #6EE7B7); width: 100%; margin-bottom: 2px; }
.ra-workflow__list { margin: 0; padding-left: 18px; font-size: 12px; line-height: 1.9; color: var(--color-text-muted, #9CA3AF); width: 100%; }
.ra-workflow--intent { background: rgba(59, 130, 246, 0.05); border-color: rgba(59, 130, 246, 0.2); }
.ra-workflow__tag {
  font-size: 11px; font-weight: 600;
  color: var(--color-accent-light, #60A5FA);
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: 6px; padding: 2px 8px;
}
.ra-workflow__kv { font-size: 12px; color: var(--color-text-muted, #9CA3AF); }
.ra-workflow__kv b { color: var(--color-text, #F9FAFB); font-weight: 600; }

@media (max-width: 640px) {
  .ra-plan-card__inner { padding: 14px; }
  .ra-field-row { flex-direction: column; gap: 10px; }
}

/* 打字机光标 */
.ra-msg__typing {
  color: var(--color-text-muted, #9CA3AF);
  animation: ra-blink 1s step-end infinite;
}
@keyframes ra-blink { 50% { opacity: 0.35; } }

/* 思考过程面板（DeepSeek 风：生成中展开 → 完成折叠可点击展开） */
.ra-think {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--color-border, #1F2937);
  border-radius: 10px;
  padding: 8px 12px;
  margin-bottom: 8px;
  font-size: 12px;
  max-width: 640px;
}
.ra-think__toggle {
  color: var(--color-text-muted, #9CA3AF);
  cursor: pointer;
  user-select: none;
}
.ra-think__steps {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--color-text-light, #6B7280);
}
.ra-think__step { line-height: 1.7; }
.ra-think:not(.ra-think--done) .ra-think__step {
  animation: ra-fadein 0.3s ease;
}
@keyframes ra-fadein { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; } }
.ra-think--done .ra-think__steps { display: none; }
.ra-think--done.ra-think--open .ra-think__steps { display: flex; }
.ra-think--done .ra-think__toggle { color: var(--color-brand-light, #6EE7B7); }

/* 业务矩阵分类标签 + VendorHub CTA（2026-08-07 业务能力矩阵） */
.ra-classify {
  margin-top: 12px;
  padding: 10px 14px;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: 10px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.ra-classify__tag {
  color: #C4B5FD;
  background: rgba(99, 102, 241, 0.18);
  padding: 3px 9px;
  border-radius: 6px;
  font-weight: 600;
}
.ra-classify__out {
  color: var(--color-text-muted, #9CA3AF);
  flex: 1 1 auto;
  min-width: 0;
}
.ra-classify__cta {
  color: #fff;
  background: linear-gradient(135deg, #6366F1, #4F46E5);
  padding: 5px 12px;
  border-radius: 7px;
  font-weight: 600;
  text-decoration: none;
  font-size: 12px;
  white-space: nowrap;
}
.ra-classify__cta:hover { filter: brightness(1.1); }

/* ============ 工作台工具栏（在线/重置，紧贴 nav 下方） ============ */
.ra-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  max-width: 1080px;
  margin: 12px auto 0;
  padding: 0 24px;
}
.ra-toolbar__status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--color-text-muted, #94A3B8);
}
.ra-toolbar__dot {
  width: 8px;
  height: 8px;
  background: #34d399;
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(52,211,153,0.5);
  display: inline-block;
}
.ra-toolbar__btn {
  padding: 6px 14px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04);
  color: inherit;
  border-radius: 7px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
}
.ra-toolbar__btn:hover {
  background: rgba(110,231,183,0.08);
  border-color: rgba(110,231,183,0.3);
}
