/* ============================================
   AI 企业助手 — 样式
   ============================================ */

/* ---- 浮动按钮 ---- */
#aiAssistantBtn {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(102,126,234,0.4);
  z-index: 9000;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}
#aiAssistantBtn:hover {
  transform: scale(1.12);
  box-shadow: 0 8px 32px rgba(102,126,234,0.6);
}
#aiAssistantBtn:active {
  transform: scale(0.95);
}
@keyframes aiBtnPulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(102,126,234,0.4); }
  50% { box-shadow: 0 4px 28px rgba(102,126,234,0.6); }
}
#aiAssistantBtn:not(:hover) {
  animation: aiBtnPulse 2s ease-in-out infinite;
}
#aiAssistantBtn.active {
  transform: rotate(360deg) scale(0.9);
  background: linear-gradient(135deg, #764ba2, #667eea);
}

/* ---- 聊天面板 ---- */
#aiAssistantPanel {
  position: fixed;
  right: 24px;
  bottom: 90px;
  width: clamp(420px, 35vw, 800px);
  height: 600px;
  max-height: calc(100vh - 120px);
  background: var(--bg-card, #fff);
  border-radius: var(--radius-lg, 12px);
  box-shadow: var(--shadow-xl, 0 24px 80px rgba(102,126,234,0.18));
  display: flex;
  flex-direction: column;
  z-index: 9001;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
#aiAssistantPanel.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* ---- 头部 ---- */
.ai-asst-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light, #f0f0f0);
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  border-radius: var(--radius-lg, 12px) var(--radius-lg, 12px) 0 0;
  flex-shrink: 0;
}
.ai-asst-title {
  font-size: var(--text-lg, 16px);
  font-weight: 600;
}
.ai-asst-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.ai-asst-header-actions button {
  background: rgba(255,255,255,0.2);
  border: none;
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.ai-asst-header-actions button:hover {
  background: rgba(255,255,255,0.35);
}

/* ---- 消息区域 ---- */
.ai-asst-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  scroll-behavior: smooth;
}

/* ---- 消息气泡 ---- */
.ai-asst-msg {
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  max-width: 90%;
  animation: aiMsgEnter 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes aiMsgEnter {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.ai-asst-msg-user {
  align-self: flex-end;
  align-items: flex-end;
}
.ai-asst-msg-bot {
  align-self: flex-start;
  align-items: flex-start;
}
.ai-asst-msg-content {
  padding: 10px 14px;
  border-radius: 12px;
  font-size: var(--text-base, 14px);
  line-height: 1.6;
  word-break: break-word;
}
.ai-asst-msg-user .ai-asst-msg-content {
  background: var(--primary, #667eea);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.ai-asst-msg-bot .ai-asst-msg-content {
  background: var(--bg-panel, #f8f9fc);
  color: var(--text, #1a1a2e);
  border-bottom-left-radius: 4px;
}

/* ---- 时间轴（阶段步骤串联） ---- */
.ai-asst-timeline {
  margin: 0 0 8px 0;
  padding: 12px 14px;
  background: linear-gradient(135deg, rgba(102,126,234,0.03), rgba(118,75,162,0.02));
  border: 1px solid rgba(102,126,234,0.12);
  border-radius: 12px;
  animation: aiMsgEnter 0.3s ease;
}
.ai-asst-timeline-step {
  display: flex;
  gap: 12px;
  position: relative;
  animation: aiMsgEnter 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.ai-asst-timeline-step + .ai-asst-timeline-step {
  margin-top: 4px;
}
/* 左侧指示器列：图标 + 连接线 */
.ai-step-indicator {
  position: relative;
  width: 24px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.ai-step-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-card, #fff);
  border: 2px solid var(--border, #e0e0e0);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
  transition: all 0.3s ease;
  z-index: 1;
}
.ai-step-line {
  position: absolute;
  top: 24px;
  bottom: -4px;
  width: 2px;
  background: var(--border-light, #eee);
  left: 50%;
  transform: translateX(-50%);
}
.ai-asst-timeline-step:last-child .ai-step-line {
  display: none;
}
/* 活跃步骤：图标脉动 + 蓝色边框 */
.ai-step-active .ai-step-icon {
  border-color: var(--primary, #667eea);
  box-shadow: 0 0 0 0 rgba(102,126,234,0.4);
  animation: aiStepPulse 1.8s ease-in-out infinite;
}
@keyframes aiStepPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(102,126,234,0.4); }
  50% { box-shadow: 0 0 0 6px rgba(102,126,234,0); }
}
/* 完成步骤：绿色勾 */
.ai-step-done .ai-step-icon {
  border-color: var(--success, #22c55e);
  background: linear-gradient(135deg, #22c55e, #16a34a);
}
.ai-step-check {
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  animation: aiCheckPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
/* 步骤内容 */
.ai-step-body {
  flex: 1;
  min-width: 0;
  padding: 2px 0 12px 0;
}
.ai-step-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.ai-step-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text, #333);
}
.ai-step-active .ai-step-label {
  color: var(--primary, #667eea);
}
.ai-step-done .ai-step-label {
  color: var(--text-secondary, #555);
}
.ai-step-time {
  font-size: 11px;
  color: var(--text-hint, #999);
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono, monospace);
  min-width: 38px;
  text-align: right;
}
.ai-step-detail {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-secondary, #666);
}
/* 思考中的 spinner（在 step-icon 内） */
.ai-step-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--border-light, #e0e0e0);
  border-top-color: var(--primary, #667eea);
  border-radius: 50%;
  animation: aiToolSpin 0.8s linear infinite;
}

/* 工具子步骤（嵌套在"调用工具"步骤内） */
.ai-tool-substep {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  margin: 4px 0;
  border-radius: 8px;
  background: var(--bg-card, #fff);
  border: 1px solid var(--border-light, #eee);
  font-size: 12px;
  animation: aiToolSlideIn 0.3s ease;
  transition: all 0.3s ease;
}
.ai-tool-substep + .ai-tool-substep {
  margin-top: 4px;
}
.ai-tool-substep-name {
  font-weight: 600;
  color: var(--text, #333);
  flex-shrink: 0;
}
.ai-tool-substep-desc {
  flex: 1;
  min-width: 0;
  color: var(--text-hint, #888);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
}
.ai-tool-substep-time {
  font-size: 10px;
  color: var(--text-hint, #aaa);
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono, monospace);
  flex-shrink: 0;
  min-width: 36px;
  text-align: right;
}
.ai-tool-substep-spinner {
  display: inline-flex;
  flex-shrink: 0;
}
.ai-tool-substep-spinner::before {
  content: '';
  width: 12px;
  height: 12px;
  border: 2px solid var(--border-light, #ddd);
  border-top-color: var(--primary, #667eea);
  border-radius: 50%;
  animation: aiToolSpin 0.8s linear infinite;
  display: block;
}
.ai-tool-substep-check {
  display: inline-flex;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  align-items: center;
  justify-content: center;
  animation: aiCheckPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.ai-tool-done .ai-tool-substep-name {
  color: var(--text-secondary, #555);
}
.ai-tool-done .ai-tool-substep-desc {
  color: var(--success, #22c55e);
}

/* 时间轴底部 */
.ai-asst-timeline-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  padding: 6px 10px;
  border-top: 1px dashed rgba(102,126,234,0.15);
  font-size: 11px;
  color: var(--text-hint, #888);
  animation: aiMsgEnter 0.3s ease;
}
.ai-asst-timeline-footer span:first-child {
  color: var(--success, #22c55e);
  font-weight: 600;
}

/* ---- 错误卡片 ---- */
.ai-asst-error-card {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  margin: 8px 0;
  background: linear-gradient(135deg, rgba(239,68,68,0.04), rgba(220,38,38,0.02));
  border: 1px solid rgba(239,68,68,0.2);
  border-radius: 10px;
  animation: aiMsgEnter 0.3s ease;
}
.ai-error-icon {
  font-size: 20px;
  flex-shrink: 0;
}
.ai-error-body {
  flex: 1;
  min-width: 0;
}
.ai-error-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--danger, #dc2626);
  margin-bottom: 4px;
}
.ai-error-msg {
  font-size: 12px;
  color: var(--text-secondary, #555);
  line-height: 1.5;
  word-break: break-word;
}

/* ---- 工具调用标签（历史消息中） ---- */
.ai-asst-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}
.ai-asst-tool-tag {
  font-size: var(--text-xs, 11px);
  background: var(--primary-light, #eef1ff);
  color: var(--primary, #667eea);
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
}

/* ---- 加载动画 — AI 品牌化轨道脉冲 ---- */
.ai-asst-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px !important;
}
.ai-asst-loading-orb {
  position: relative;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}
.ai-asst-loading-orb::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: var(--primary, #667eea);
  border-right-color: var(--primary, #667eea);
  animation: aiOrbitSpin 1s linear infinite;
}
.ai-asst-loading-orb::after {
  content: '';
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  border: 2px solid transparent;
  border-bottom-color: #764ba2;
  border-left-color: #764ba2;
  animation: aiOrbitSpin 0.7s linear infinite reverse;
}
.ai-asst-loading-orb-core {
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea, #764ba2);
  animation: aiCorePulse 1.4s ease-in-out infinite;
}
.ai-asst-loading-text {
  font-size: 12px;
  color: var(--text-hint, #888);
  animation: aiTextFade 2s ease-in-out infinite;
}
@keyframes aiOrbitSpin {
  to { transform: rotate(360deg); }
}
@keyframes aiCorePulse {
  0%, 100% { transform: scale(0.8); opacity: 0.6; }
  50% { transform: scale(1.1); opacity: 1; }
}
@keyframes aiTextFade {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* 兼容旧版 3-dot 结构（平滑降级） */
.ai-asst-loading span {
  display: none;
}

/* ---- 快捷问题 ---- */
.ai-asst-quick {
  padding: 8px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  border-top: 1px solid var(--border-light, #f0f0f0);
  flex-shrink: 0;
}
.ai-asst-quick-btn {
  font-size: var(--text-xs, 11px);
  padding: 5px 12px;
  border: 1px solid var(--border, #e0e0e0);
  border-radius: 16px;
  background: #fff;
  color: var(--text-secondary, #555);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}
.ai-asst-quick-btn:hover {
  border-color: var(--primary, #667eea);
  color: var(--primary, #667eea);
  background: var(--primary-light, #eef1ff);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(102,126,234,0.15);
}
.ai-asst-quick-btn:active {
  transform: translateY(0) scale(0.96);
  box-shadow: none;
}

/* ---- 流式回复光标 ---- */
.ai-asst-msg-content .ai-streaming-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--primary, #667eea);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: aiCursorBlink 0.8s steps(2) infinite;
}
@keyframes aiCursorBlink {
  0% { opacity: 1; }
  50% { opacity: 0; }
}

/* ---- 阶段指示器（思考→工具→回答） ---- */
.ai-asst-phase-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  margin: 4px 0;
  font-size: 11px;
  color: var(--text-hint, #888);
  animation: aiMsgEnter 0.3s ease;
}
.ai-asst-phase-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border, #ddd);
  transition: all 0.3s ease;
}
.ai-asst-phase-dot.ai-phase-active {
  background: var(--primary, #667eea);
  box-shadow: 0 0 6px rgba(102,126,234,0.5);
  animation: aiPhasePulse 1.2s ease-in-out infinite;
}
.ai-asst-phase-dot.ai-phase-done {
  background: var(--success, #22c55e);
}
.ai-asst-phase-label {
  font-weight: 500;
  transition: color 0.3s;
}
.ai-asst-phase-label.ai-phase-active {
  color: var(--primary, #667eea);
}
@keyframes aiPhasePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.4); }
}

/* ---- 文件上传区域 ---- */
.ai-asst-upload-zone {
  padding: 0 12px;
  flex-shrink: 0;
}
.ai-asst-drop-area {
  border: 2px dashed var(--border, #e0e0e0);
  border-radius: var(--radius, 8px);
  padding: 10px;
  text-align: center;
  font-size: var(--text-xs, 11px);
  color: var(--text-hint, #999);
  transition: all 0.2s;
  cursor: pointer;
  display: none;
}
.ai-asst-drop-area.visible {
  display: block;
}
.ai-asst-drop-area.dragover {
  border-color: var(--primary, #667eea);
  background: var(--primary-light, #eef1ff);
  color: var(--primary, #667eea);
}

/* ---- 文件预览列表 ---- */
.ai-asst-files {
  padding: 0 12px;
  flex-shrink: 0;
}
.ai-asst-file-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--bg-panel, #f8f9fc);
  border-radius: var(--radius-sm, 6px);
  margin-bottom: 4px;
  font-size: var(--text-xs, 11px);
}
.ai-asst-file-icon {
  font-size: 16px;
}
.ai-asst-file-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text, #1a1a2e);
}
.ai-asst-file-remove {
  background: none;
  border: none;
  color: var(--text-hint, #999);
  cursor: pointer;
  font-size: 14px;
  padding: 0 2px;
}
.ai-asst-file-remove:hover {
  color: var(--danger, #c62828);
}

/* ---- 输入区域 ---- */
.ai-asst-input-area {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border-light, #f0f0f0);
  flex-shrink: 0;
}
.ai-asst-input-area textarea {
  flex: 1;
  border: 1px solid var(--border, #e0e0e0);
  border-radius: var(--radius, 8px);
  padding: 8px 12px;
  font-size: var(--text-base, 14px);
  font-family: var(--font, sans-serif);
  resize: none;
  outline: none;
  min-height: 36px;
  max-height: 100px;
  transition: border-color 0.15s;
}
.ai-asst-input-area textarea:focus {
  border-color: var(--primary, #667eea);
}
.ai-asst-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary, #667eea);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}
.ai-asst-send-btn:hover {
  background: var(--primary-dark, #5a6fd6);
  transform: scale(1.08);
  box-shadow: 0 4px 12px rgba(102,126,234,0.35);
}
.ai-asst-send-btn:active {
  transform: scale(0.92);
}
.ai-asst-send-btn:disabled {
  background: var(--text-disabled, #bbb);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* 停止按钮 — 从发送按钮 morph 过来 */
.ai-asst-stop-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  animation: aiStopBtnAppear 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
  overflow: hidden;
}
.ai-asst-stop-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 12px rgba(239,68,68,0.35);
}
.ai-asst-stop-btn:active {
  transform: scale(0.92);
}
@keyframes aiStopBtnAppear {
  from { transform: scale(0) rotate(-180deg); opacity: 0; }
  to { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* 按钮涟漪效果 */
.ai-asst-send-btn::after,
.ai-asst-stop-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(255,255,255,0.3);
  transform: scale(0);
  opacity: 0;
  transition: none;
}
.ai-asst-send-btn:active::after,
.ai-asst-stop-btn:active::after {
  animation: aiBtnRipple 0.4s ease-out;
}
@keyframes aiBtnRipple {
  from { transform: scale(0); opacity: 1; }
  to { transform: scale(2.5); opacity: 0; }
}

/* ---- 附加文件按钮 ---- */
.ai-asst-attach-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: transparent;
  color: var(--text-hint, #999);
  border: none;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color 0.15s;
}
.ai-asst-attach-btn:hover {
  color: var(--primary, #667eea);
}

/* ---- 配置修改确认面板 ---- */
.ai-asst-change-panel {
  background: var(--bg-panel, #f8f9fc);
  border: 1px solid var(--border, #e0e0e0);
  border-radius: var(--radius, 8px);
  padding: 14px;
  margin-top: 8px;
}
.ai-asst-change-title {
  font-size: var(--text-sm, 12px);
  font-weight: 600;
  color: var(--text, #1a1a2e);
  margin-bottom: 8px;
}
.ai-asst-change-desc {
  font-size: var(--text-sm, 12px);
  color: var(--text-secondary, #555);
  margin-bottom: 10px;
  line-height: 1.5;
}
.ai-asst-change-list {
  margin: 0;
  padding: 0;
  list-style: none;
}
.ai-asst-change-list li {
  font-size: var(--text-sm, 12px);
  color: var(--text, #1a1a2e);
  padding: 4px 0;
  border-bottom: 1px solid var(--border-light, #f0f0f0);
}
.ai-asst-change-list li:last-child {
  border-bottom: none;
}
.ai-asst-change-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.ai-asst-change-actions button {
  flex: 1;
  padding: 8px;
  border-radius: var(--radius-sm, 6px);
  border: none;
  font-size: var(--text-sm, 12px);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.ai-asst-btn-confirm {
  background: var(--success, #2e7d32);
  color: #fff;
}
.ai-asst-btn-confirm:hover {
  background: #1b5e20;
}
.ai-asst-btn-cancel {
  background: var(--border, #e0e0e0);
  color: var(--text, #1a1a2e);
}
.ai-asst-btn-cancel:hover {
  background: #d0d0d0;
}

/* ---- 代码块 ---- */
.ai-asst-msg-content pre {
  background: #1e1e2e;
  color: #cdd6f4;
  padding: 10px 12px;
  border-radius: 6px;
  overflow-x: auto;
  font-size: var(--text-sm, 12px);
  font-family: var(--font-mono, monospace);
  margin: 8px 0;
}
.ai-asst-msg-content code {
  font-family: var(--font-mono, monospace);
  font-size: var(--text-sm, 12px);
}
.ai-asst-msg-content code:not(pre code) {
  background: rgba(102,126,234,0.1);
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--primary, #667eea);
}

/* ---- 表格 ---- */
.ai-asst-msg-content table {
  border-collapse: collapse;
  margin: 8px 0;
  font-size: var(--text-sm, 12px);
  width: 100%;
}
.ai-asst-msg-content th,
.ai-asst-msg-content td {
  border: 1px solid var(--border, #e0e0e0);
  padding: 6px 10px;
  text-align: left;
}
.ai-asst-msg-content th {
  background: var(--bg-panel, #f8f9fc);
  font-weight: 600;
}

/* ---- mermaid 图表 ---- */
.ai-asst-msg-content .mermaid {
  max-height: 600px;
  overflow: auto;
  cursor: zoom-in;
  background: #fff;
  border-radius: 6px;
  padding: 16px;
  margin: 8px 0;
  border: 1px solid #e8e8e8;
}
.ai-asst-msg-content .mermaid svg {
  min-width: 100%;
  height: auto;
}

/* ---- 响应式 ---- */
@media (max-width: 480px) {
  #aiAssistantPanel {
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
  }
  .ai-asst-header {
    border-radius: 0;
  }
}

/* ---- 缩放把手 ---- */
.ai-asst-resize-handle {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 16px;
  height: 16px;
  cursor: nwse-resize;
  background: linear-gradient(135deg, transparent 50%, rgba(0,0,0,0.15) 50%);
  border-radius: 0 0 var(--radius-lg, 12px) 0;
  z-index: 10;
}

/* ---- 拖动头部 ---- */
.ai-asst-header {
  cursor: move;
  user-select: none;
}
.ai-asst-header-actions {
  pointer-events: auto;
}

/* ---- 全屏模式 ---- */
#aiAssistantPanel.ai-asst-maximized {
  border-radius: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- 工具执行状态 — 卡片化 ---- */
.ai-asst-tool-status {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  margin: 6px 0;
  font-size: 12px;
  color: var(--text, #333);
  background: var(--bg-card, #fff);
  border: 1px solid var(--border-light, #e8e8e8);
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  animation: aiToolSlideIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  transition: all 0.3s ease;
}
.ai-asst-tool-done {
  opacity: 0.75;
  border-color: rgba(34,197,94,0.25);
  background: linear-gradient(135deg, rgba(34,197,94,0.04), var(--bg-card, #fff));
}
.ai-asst-tool-icon {
  position: relative;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ai-asst-tool-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-light, #e0e0e0);
  border-top-color: var(--primary, #667eea);
  border-radius: 50%;
  animation: aiToolSpin 0.8s linear infinite;
}
.ai-asst-tool-check {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #fff;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: aiCheckPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.ai-asst-tool-detail {
  flex: 1;
  min-width: 0;
  line-height: 1.5;
}
.ai-asst-tool-name {
  font-weight: 600;
  color: var(--text, #333);
  font-size: 12px;
}
.ai-asst-tool-desc {
  color: var(--text-hint, #888);
  font-size: 11px;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ai-asst-tool-time {
  font-size: 10px;
  color: var(--text-hint, #aaa);
  flex-shrink: 0;
  margin-top: 2px;
}

@keyframes aiToolSpin {
  to { transform: rotate(360deg); }
}
@keyframes aiToolSlideIn {
  from { opacity: 0; transform: translateY(8px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes aiCheckPop {
  0% { transform: scale(0); }
  60% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* ---- 思考过程 — 呼吸光效 ---- */
.ai-asst-reasoning {
  margin: 8px 0;
  font-size: 12px;
  color: var(--text-secondary, #555);
  background: linear-gradient(135deg, rgba(102,126,234,0.04), rgba(118,75,162,0.03));
  border-radius: 10px;
  border: 1px solid rgba(102,126,234,0.15);
  animation: aiReasonFadeIn 0.4s ease;
  overflow: hidden;
}
.ai-asst-reasoning summary {
  padding: 8px 14px;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  color: var(--primary, #667eea);
  transition: background 0.2s;
  list-style: none;
}
.ai-asst-reasoning summary::-webkit-details-marker { display: none; }
.ai-asst-reasoning summary::before {
  content: '💭';
  font-size: 14px;
}
.ai-asst-reasoning summary::after {
  content: '▸';
  margin-left: auto;
  font-size: 10px;
  transition: transform 0.25s ease;
  color: var(--text-hint, #aaa);
}
.ai-asst-reasoning[open] summary::after {
  transform: rotate(90deg);
}
.ai-asst-reasoning summary:hover {
  background: rgba(102,126,234,0.06);
}
.ai-asst-reasoning-content {
  padding: 10px 14px;
  white-space: pre-wrap;
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  line-height: 1.6;
  max-height: 300px;
  overflow-y: auto;
  border-top: 1px solid rgba(102,126,234,0.1);
  color: var(--text-secondary, #666);
  animation: aiReasonContentSlide 0.3s ease;
}
/* 思考进行中 — 活跃态呼吸光效 */
.ai-asst-reasoning.ai-reasoning-active {
  border-color: rgba(102,126,234,0.35);
  animation: aiReasonBreath 2s ease-in-out infinite;
}
.ai-asst-reasoning.ai-reasoning-active summary::before {
  animation: aiReasonBrainPulse 1.2s ease-in-out infinite;
}
@keyframes aiReasonFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes aiReasonContentSlide {
  from { opacity: 0; max-height: 0; }
  to { opacity: 1; max-height: 300px; }
}
@keyframes aiReasonBreath {
  0%, 100% { box-shadow: 0 0 0 0 rgba(102,126,234,0); border-color: rgba(102,126,234,0.15); }
  50% { box-shadow: 0 0 12px 0 rgba(102,126,234,0.08); border-color: rgba(102,126,234,0.3); }
}
@keyframes aiReasonBrainPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

/* ---- 文件下载按钮 ---- */
.ai-file-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  margin: 8px 0;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff !important;
  border-radius: 8px;
  text-decoration: none !important;
  font-size: 13px;
  font-weight: 500;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 2px 8px rgba(102,126,234,0.3);
}
.ai-file-download-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(102,126,234,0.5);
}
.ai-file-download-btn:active {
  transform: translateY(0);
}

/* ---- 技能管理抽屉 ---- */
#aiSkillsDrawer {
  position: fixed;
  width: 360px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.18), 0 4px 16px rgba(0,0,0,0.08);
  z-index: 9002;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}
@media (max-width: 780px) {
  #aiSkillsDrawer {
    width: calc(100vw - 16px);
    left: 8px !important;
  }
}
