/* 车型收集度 + AI 助手（铁路行迹）
   说明：本文件所有颜色/阴影一律走 theme.css 的主题变量，禁止硬编码色值，
   以保证浅色/深色主题与 5 套配色方案切换时正确联动。 */
.collection-page {
  max-width: 960px;
  margin: 0 auto;
  padding: 16px;
}
.collection-container { animation: fadeIn .2s ease; }
.collection-overview {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--card-background);
  margin-bottom: 18px;
}
.collection-ring { width: 140px; height: 140px; flex: 0 0 140px; }
.collection-summary { flex: 1; }
.collection-big { font-size: 34px; font-weight: 700; line-height: 1.1; color: var(--text-primary); }
.collection-big span { font-size: 18px; color: var(--text-muted); font-weight: 500; }
.collection-pct { color: var(--primary); font-weight: 600; margin-top: 4px; }
.collection-hint { color: var(--text-muted); font-size: 13px; margin: 6px 0 0; }
.collection-groups { margin-top: 8px; }
.collection-brand-title { font-size: 16px; margin: 18px 0 10px; color: var(--text-primary); }
.collection-series-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
  background: var(--background);
}
.collection-series-card.locked { opacity: .9; }
.cs-header { display: flex; justify-content: space-between; align-items: center; font-weight: 600; color: var(--text-primary); }
.cs-count { font-size: 13px; color: var(--text-muted); }
.cs-models { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.cs-model {
  font-size: 12px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--primary);
  color: var(--color-text-inverse);
}
.cs-model.locked { background: var(--color-bg-muted); color: var(--text-muted); }

/* AI 助手悬浮入口 + 面板 */
.ai-fab {
  position: fixed;
  right: 18px;
  bottom: 86px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: var(--color-text-inverse);
  font-size: 24px;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  z-index: 60;
  transition: transform .15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.ai-fab:active { transform: scale(.94); }
.ai-panel {
  position: fixed;
  right: 18px;
  bottom: 152px;
  width: min(380px, 92vw);
  max-height: 70vh;
  background: var(--card-background);
  border: 1px solid var(--border);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  z-index: 61;
  overflow: hidden;
}
.ai-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  color: var(--text-primary);
}
.ai-panel-header button { border: none; background: none; font-size: 20px; cursor: pointer; color: var(--text-primary); }
.ai-messages { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.ai-msg { display: flex; }
.ai-msg.user { justify-content: flex-end; }
.ai-bubble { max-width: 80%; padding: 8px 12px; border-radius: 12px; white-space: pre-wrap; line-height: 1.5; font-size: 14px; }
.ai-msg.assistant .ai-bubble { background: var(--background); color: var(--text-primary); }
.ai-msg.user .ai-bubble { background: var(--primary); color: var(--color-text-inverse); }
.ai-input-row { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--border); }
.ai-input-row input {
  flex: 1; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--background); color: var(--text-primary);
}
.ai-input-row button {
  padding: 8px 14px; border: none; border-radius: 10px;
  background: var(--primary); color: var(--color-text-inverse); cursor: pointer;
}
.ai-input-row button:disabled { opacity: .5; cursor: not-allowed; }
.ai-typing { opacity: .7; }

/* 过程消息与工具消息统一使用 assistant 气泡样式，和最终回答视觉一致。
   process 为半透明状态提示；tool 运行中/完成/失败用不同颜色区分，不再显示原始 JSON。 */
.ai-msg.process .ai-bubble,
.ai-msg.tool .ai-bubble { background: var(--background); color: var(--text-primary); }

.ai-process { opacity: .85; }

.ai-tool {
  display: flex; align-items: center; gap: 6px;
  flex-wrap: wrap;
}
.ai-tool.running { opacity: .7; }
.ai-tool.running .ai-tool-status::before {
  content: ''; width: 10px; height: 10px;
  border: 2px solid var(--primary); border-top-color: transparent;
  border-radius: 50%; animation: ai-spin .7s linear infinite;
  display: inline-block; margin-right: 4px; vertical-align: middle;
}
.ai-tool-icon { font-size: 14px; width: 16px; height: 16px; flex-shrink: 0; color: var(--color-muted); }
.ai-tool-label { font-weight: 600; }
.ai-tool-args { color: var(--text-muted); font-size: 12px; }
.ai-tool-status { color: var(--text-muted); font-size: 12px; }
.ai-tool.error { background: var(--color-bg-error, #fff0f0); color: var(--color-danger, #d32f2f); border: 1px solid var(--color-danger, #d32f2f); }
.ai-tool-error {
  flex-basis: 100%; margin-top: 4px;
  font-size: 13px; color: var(--color-danger, #d32f2f); white-space: pre-wrap;
}

@keyframes ai-spin { to { transform: rotate(360deg); } }

/* ===== 最终回答下方的操作卡片 ===== */
.ai-action-cards {
  display: flex; flex-direction: column; gap: 8px;
  margin-top: 10px; max-width: 92%;
}
.ai-action-card {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--card-background);
  cursor: pointer; transition: border-color .15s, background .15s;
  font-size: 14px; color: var(--text-primary);
}
.ai-action-card:hover { border-color: var(--primary); background: var(--color-bg-muted); }
.ai-action-card-icon { font-size: 18px; display: flex; align-items: center; justify-content: center; }
.ai-action-card-icon svg { width: 20px; height: 20px; }
.action-icon-svg { width: 20px; height: 20px; display: block; }
.ai-action-card-label { font-weight: 600; flex: 1; min-width: 0; }
.ai-action-card-detail { color: var(--text-muted); font-size: 12px; }
.ai-action-card.action-train .ai-action-card-icon { color: var(--primary); }
.ai-action-card.action-trip .ai-action-card-icon { color: var(--color-success); }

/* ===== 下一站去哪：目的地结果卡片 ===== */
.ai-dest-card {
  margin-top: 10px; max-width: 92%;
  border-radius: 14px; overflow: hidden;
  border: 1px solid var(--border); background: var(--card-background);
}
.ai-dest-card.is-cross-border { border-color: var(--primary); }
.ai-dest-visa-banner {
  padding: 8px 14px; font-size: 12.5px; line-height: 1.5;
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  color: var(--text-primary); border-bottom: 1px solid var(--border);
}
.ai-dest-main { padding: 14px 16px; }
.ai-dest-city-row { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.ai-dest-city { font-size: 22px; font-weight: 700; color: var(--text-primary); }
.ai-dest-region { font-size: 13px; color: var(--text-muted); }
.ai-dest-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.ai-dest-tag {
  font-size: 12px; padding: 2px 8px; border-radius: 10px;
  background: color-mix(in srgb, var(--primary) 10%, transparent);
  color: var(--primary);
}
.ai-dest-reasons { margin: 0 0 10px; padding-left: 18px; font-size: 13.5px; line-height: 1.7; color: var(--text-primary); }
.ai-dest-reasons li { margin-bottom: 2px; }
.ai-dest-trains { margin-bottom: 10px; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.ai-dest-train-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 7px 10px; font-size: 12.5px; border-bottom: 1px solid var(--border);
}
.ai-dest-train-row:last-child { border-bottom: none; }
.ai-dest-train-no { font-weight: 600; color: var(--primary); min-width: 64px; }
.ai-dest-train-route { flex: 1; min-width: 120px; color: var(--text-primary); }
.ai-dest-train-time { color: var(--text-muted); }
.ai-dest-train-price { color: var(--text-muted); font-size: 12px; }
.ai-dest-duration-hint { font-size: 12px; color: var(--text-muted); margin: 4px 0 0; padding: 0 10px 6px; }
.ai-dest-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.ai-dest-btn {
  padding: 6px 14px; border-radius: 8px; font-size: 13px; cursor: pointer;
  border: 1px solid var(--border); background: var(--background); color: var(--text-primary);
  transition: border-color .15s, background .15s;
}
.ai-dest-btn:hover { border-color: var(--primary); background: var(--color-bg-muted); }
.ai-dest-btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.ai-dest-btn.primary:hover { background: color-mix(in srgb, var(--primary) 88%, #000); }
.ai-dest-btn.small { padding: 4px 10px; font-size: 12px; }
.ai-dest-alts { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.ai-dest-alt-card {
  padding: 10px 12px; border-radius: 10px; border: 1px dashed var(--border); background: var(--background);
}
.ai-dest-alt-head { display: flex; align-items: baseline; gap: 6px; margin-bottom: 4px; }
.ai-dest-alt-city { font-size: 16px; font-weight: 600; color: var(--text-primary); }
.ai-dest-alt-region { font-size: 12px; color: var(--text-muted); }
.ai-dest-alt-cross { font-size: 11px; color: var(--primary); }
.ai-dest-draw { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.ai-dest-footer { font-size: 12.5px; color: var(--text-muted); margin: 0; }

/* ===== 面板内车次列表 ===== */
.train-detail-train-list {
  display: flex; flex-direction: column; gap: 8px;
}
.train-detail-train-item {
  padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--background);
  cursor: pointer; transition: all .12s ease;
}
.train-detail-train-item:hover {
  border-color: var(--primary); background: var(--color-bg-muted);
  transform: translateY(-1px);
}
.train-detail-train-item.active {
  border-color: var(--primary); background: var(--color-bg-muted);
  box-shadow: 0 0 0 1px var(--primary) inset;
}
.tdti-main {
  display: flex; align-items: center; gap: 8px; margin-bottom: 4px;
  font-size: 13px; color: var(--text-primary);
}
.tdti-code { font-weight: 700; color: var(--primary); min-width: 56px; }
.tdti-time { color: var(--text-secondary); }
.tdti-dur { margin-left: auto; color: var(--text-muted); font-size: 12px; }
.tdti-route {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-secondary);
}
.tdti-arrow { color: var(--text-muted); font-size: 11px; }

@keyframes ai-spin { to { transform: rotate(360deg); } }

/* AI 气泡内 Markdown 渲染（紧凑版，复用全局 renderMarkdown 输出的 .md-* 结构） */
.ai-bubble.ai-md { white-space: normal; }
.ai-md > :first-child { margin-top: 0; }
.ai-md > :last-child { margin-bottom: 0; }

/* AI 对话报错气泡 + 重试按钮 */
.ai-bubble.ai-error {
  background: var(--color-bg-muted, #f5f5f5);
  color: var(--text-primary);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}
.ai-error-text { white-space: pre-wrap; line-height: 1.5; }
.ai-retry-btn {
  align-self: flex-start;
  border: 1px solid var(--primary);
  background: var(--primary);
  color: var(--color-text-inverse, #fff);
  border-radius: 999px;
  padding: 4px 14px;
  font-size: 13px;
  cursor: pointer;
}
.ai-retry-btn:hover { opacity: .9; }
.ai-md p { margin: 6px 0; line-height: 1.6; }
.ai-md h1, .ai-md h2, .ai-md h3, .ai-md h4 {
  margin: 10px 0 6px; font-weight: 600; line-height: 1.3; color: var(--text-primary);
}
.ai-md h1 { font-size: 17px; }
.ai-md h2 { font-size: 16px; }
.ai-md h3 { font-size: 15px; }
.ai-md h4 { font-size: 14px; }
.ai-md ul, .ai-md ol { margin: 6px 0; padding-left: 20px; }
.ai-md li { margin: 3px 0; }
.ai-md a { color: var(--primary); text-decoration: underline; }
.ai-md strong { font-weight: 600; }
.ai-md code, .ai-md .md-inline-code {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--color-bg-muted);
  color: var(--text-primary);
}
.ai-md pre, .ai-md .md-code-block {
  margin: 8px 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--color-bg-muted);
  border: 1px solid var(--border);
  overflow-x: auto;
}
.ai-md pre code, .ai-md .md-code-block code {
  background: none;
  padding: 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-primary);
}
.ai-md blockquote {
  margin: 8px 0;
  padding: 4px 12px;
  border-left: 3px solid var(--primary);
  color: var(--text-muted);
}
.ai-md table {
  border-collapse: collapse;
  margin: 8px 0;
  font-size: 13px;
  width: 100%;
}
.ai-md th, .ai-md td {
  border: 1px solid var(--border);
  padding: 5px 8px;
  text-align: left;
}
.ai-md th { background: var(--color-bg-muted); font-weight: 600; }
.ai-md hr { border: none; border-top: 1px solid var(--border); margin: 10px 0; }

/* 洞察加载骨架屏（shimmer 扫光，使用主题变量，无硬编码色） */
.insights-loading { padding: 8px 0; }
.skeleton-line {
  position: relative; overflow: hidden;
  border-radius: 6px; background: var(--color-bg-muted);
}
.skeleton-line::after {
  content: ''; position: absolute; inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, var(--card-background), transparent);
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
}
@keyframes skeleton-shimmer {
  100% { transform: translateX(100%); }
}

/* 洞察空态 / 错误态（生成失败、未配置、限流、网络异常）—— 不白屏 */
.insights-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 40px 16px; margin: 8px 0;
  border: 1px dashed var(--border); border-radius: 12px;
  background: var(--card-background); text-align: center;
}
.insights-empty-icon { font-size: 34px; line-height: 1; opacity: .85; display: flex; align-items: center; justify-content: center; }
.insights-empty-icon svg { width: 40px; height: 40px; color: var(--text-muted); }
.insights-empty-text {
  margin: 0; color: var(--text-muted); font-size: 14px; max-width: 80%;
}
.insights-retry-btn {
  padding: 7px 18px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: var(--color-bg-muted);
  color: var(--text-primary); font-size: 13px; transition: opacity .15s;
}
.insights-retry-btn:hover { opacity: .82; }

/* ===== 全屏 AI 对话页（DeepSeek / Kimi 风格）===== */
/* 仅在 AI 模式下让 .home-page 变成 flex 布局；经典首页保持块级布局不被压缩 */
.home-page--ai {
  position: fixed;
  top: 68px;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(100vh - 68px);  /* 显式高度，避免被 .home-page 的 min-height 影响 */
  min-height: auto;           /* 覆盖 .home-page 的 min-height: 100vh */
  display: flex;
  flex-direction: column;
  overflow: hidden;  /* 外层不滚动，由 .ai-chat-main 内部滚动 */
}

@media (max-width: 768px) {
  .home-page--ai {
    top: 76px;
    bottom: 80px; /* 为移动端底部导航栏留出空间，避免遮挡输入框 */
    height: calc(100vh - 76px - 80px);
    min-height: auto;
  }
}

.ai-chat-page {
  flex: 1;
  min-height: 0;
  height: 100%;      /* 确保填满固定高度的父容器 */
  display: flex;
  flex-direction: column;
  overflow: hidden;  /* 自身不滚动，内部 .ai-chat-main 滚动 */
  background: var(--background);
  color: var(--text-primary);
}

/* Header */
.ai-chat-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--card-background);
  gap: 12px;
}
.ai-chat-header-left,
.ai-chat-header-actions { display: flex; align-items: center; gap: 10px; }
.ai-chat-history-btn {
  width: 36px; height: 36px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--background);
  color: var(--text-primary); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.ai-chat-header-title { font-size: 16px; font-weight: 600; color: var(--text-primary); }
.ai-chat-header-action {
  width: 36px; height: 36px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--background);
  color: var(--text-primary); font-size: 22px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.ai-chat-header .home-style-toggle { margin-top: 0; padding: 7px 14px; }

/* 历史对话抽屉 */
.ai-conversation-overlay {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.35); z-index: 30;
}
.ai-conversation-drawer {
  width: 280px; max-width: 78vw; height: 100%;
  background: var(--card-background); border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
}
.ai-conversation-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  font-weight: 600; color: var(--text-primary);
}
.ai-conversation-header button { border: none; background: none; font-size: 20px; color: var(--text-primary); cursor: pointer; }
.ai-conversation-list { flex: 1; overflow-y: auto; padding: 10px; }
.ai-conversation-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border-radius: 10px; margin-bottom: 6px;
  background: var(--background); color: var(--text-primary);
  border: 1px solid transparent; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.ai-conversation-item:hover { border-color: var(--border); }
.ai-conversation-item.active { border-color: var(--primary); background: var(--color-bg-muted); }
.ai-conversation-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.ai-conversation-delete { border: none; background: none; color: var(--text-muted); cursor: pointer; padding: 4px; margin-left: 6px; }
.ai-conversation-delete:hover { color: var(--color-error); }
.ai-conversation-empty { padding: 24px; text-align: center; color: var(--text-muted); font-size: 13px; }
.ai-conversation-new {
  flex: 0 0 auto; margin: 12px; padding: 10px;
  border-radius: 10px; border: 1px dashed var(--border);
  background: var(--background); color: var(--text-primary); cursor: pointer;
}

/* 中间内容区：普通模式独占一行，分屏模式与右侧面板横向并排 */
.ai-chat-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: row;
  overflow: hidden;
}

/* 消息区 */
.ai-chat-main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  padding: 16px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;  /* 只有消息区滚动，顶栏/底栏固定 */
  scroll-behavior: smooth;
}
.ai-chat-main .ai-msg { max-width: 760px; width: 100%; margin: 0 auto 10px; display: flex; flex-direction: column; }
/* 主聊天页面下：覆盖悬浮面板遗留的 flex-end 对齐（column 布局下语义错误）。
   用户气泡靠右、assistant/tool/process/question 靠左占满宽度。 */
.ai-chat-main .ai-msg.user { justify-content: initial; align-items: flex-end; }
.ai-chat-main .ai-msg.assistant,
.ai-chat-main .ai-msg.tool,
.ai-chat-main .ai-msg.process,
.ai-chat-main .ai-msg.question { align-items: stretch; }
.ai-chat-main .ai-msg.user .ai-bubble { align-self: flex-end; max-width: 80%; }
.ai-chat-main .ai-msg.assistant .ai-bubble,
.ai-chat-main .ai-msg.tool .ai-bubble,
.ai-chat-main .ai-msg.process .ai-bubble { align-self: stretch; max-width: 100%; width: 100%; }
.ai-chat-main .ai-question-card,
.ai-chat-main .ai-dest-card,
.ai-chat-main .ai-action-cards { max-width: 100%; width: 100%; box-sizing: border-box; }

/* 空状态 / 欢迎页：欢迎标题靠上，建议卡片沉到底部输入框上方，整体空间更舒展 */
.ai-chat-empty {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  padding: 24px 16px 16px; text-align: center;
}
.ai-chat-welcome { margin-top: min(8vh, 72px); margin-bottom: auto; }
.ai-chat-avatar { font-size: 52px; line-height: 1; margin-bottom: 14px; display: flex; align-items: center; justify-content: center; }
.ai-chat-avatar svg { width: 52px; height: 52px; color: var(--primary); }
.ai-chat-title { font-size: 24px; font-weight: 700; color: var(--text-primary); margin-bottom: 6px; }
.ai-chat-subtitle { font-size: 14px; color: var(--text-muted); }
.ai-chat-suggestion-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px; width: 100%; max-width: 640px;
}
.ai-chat-suggestion {
  padding: 12px 16px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--card-background);
  color: var(--text-primary); font-size: 14px; text-align: left;
  cursor: pointer; transition: border-color .15s, background .15s;
}
.ai-chat-suggestion:hover { border-color: var(--primary); background: var(--color-bg-muted); }
.ai-chat-suggestion:disabled { opacity: .55; cursor: not-allowed; }

/* 对话后建议 */
.ai-chat-followups {
  max-width: 760px; width: 100%; margin: 0 auto 16px; padding: 0 8px;
}
.ai-chat-followups-label { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.ai-chat-followup-chips {
  display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px;
  -webkit-overflow-scrolling: touch; scrollbar-width: thin;
}
.ai-chat-followup-chip {
  flex: 0 0 auto; padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--card-background);
  color: var(--text-primary); font-size: 13px; white-space: nowrap; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.ai-chat-followup-chip:hover { border-color: var(--primary); background: var(--color-bg-muted); }
.ai-chat-followup-chip:disabled { opacity: .55; cursor: not-allowed; }

/* 底部固定输入 */
.ai-chat-footer {
  flex: 0 0 auto;
  padding: 12px 16px 16px;
  background: var(--background);
  border-top: 1px solid var(--border);
}
.ai-chat-input-card {
  max-width: 760px; margin: 0 auto; padding: 10px 14px;
  border: 1px solid var(--border); border-radius: 16px;
  background: var(--card-background); box-shadow: var(--shadow-sm);
}
.ai-chat-input-row { display: flex; align-items: center; gap: 8px; }
.ai-chat-input {
  flex: 1; min-width: 0; padding: 8px 4px;
  border: none; background: transparent; color: var(--text-primary);
  font-size: 15px; outline: none;
}
.ai-chat-input::placeholder { color: var(--text-muted); }
.ai-chat-send {
  width: 36px; height: 36px; border-radius: 50%; border: none;
  background: var(--primary); color: var(--color-text-inverse);
  font-size: 16px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.ai-chat-send:disabled { opacity: .5; cursor: not-allowed; }
.ai-chat-stop {
  width: 36px; height: 36px; border-radius: 50%; border: none;
  background: var(--color-error); color: var(--color-text-inverse);
  font-size: 14px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.ai-chat-stop:hover { opacity: .88; }
.ai-img-btn {
  width: 36px; height: 36px; border-radius: 50%; border: none;
  background: var(--background); color: var(--text-primary); font-size: 18px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.ai-img-btn:hover { background: var(--color-bg-muted); }
.ai-pending-img { position: relative; display: inline-block; margin-bottom: 8px; max-width: 100px; }
.ai-pending-img img { width: 100%; border-radius: 8px; display: block; }
.ai-pending-remove {
  position: absolute; top: -6px; right: -6px; width: 20px; height: 20px;
  border-radius: 50%; border: none; background: var(--text-primary); color: var(--color-text-inverse);
  font-size: 12px; cursor: pointer;
}
.ai-msg-img { margin-bottom: 4px; max-width: 180px; }
.ai-msg-img img { width: 100%; border-radius: 10px; display: block; border: 1px solid var(--border); }
.ai-msg.user .ai-bubble { display: flex; flex-direction: column; align-items: flex-end; }

/* 移动端适配 */
@media (max-width: 600px) {
  .ai-chat-header { padding: 8px 12px; }
  .ai-chat-header-title { font-size: 15px; }
  .ai-chat-main { padding: 12px; }
  .ai-chat-suggestion-grid { grid-template-columns: 1fr; max-width: 100%; }
  .ai-chat-footer { padding: 8px 12px 12px; }
  .ai-chat-input-card { border-radius: 14px; }
  .ai-chat-welcome { margin-top: min(6vh, 48px); }
  .ai-chat-title { font-size: 20px; }
}

/* ===== 纯 AI 首页：内联对话英雄块 + 洞察穿插 + 经典版切换 ===== */
/* 问候区改为「左侧文字 + 右侧切换按钮」的 flex 布局（覆盖 handdrawn.css 的块级默认） */
.hd-greeting {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.hd-greeting-main { flex: 1; min-width: 0; }

.home-style-toggle {
  flex: 0 0 auto;
  margin-top: 4px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card-background);
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s;
}
.home-style-toggle:hover { background: var(--color-bg-muted); }

.ai-hero {
  margin: 8px 0 24px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--card-background);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.ai-hero-head { margin-bottom: 10px; }
.ai-hero-title { font-size: 17px; font-weight: 700; color: var(--text-primary); }
.ai-hero-sub { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

.ai-home-messages {
  max-height: 360px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 2px 8px;
  border-radius: 12px;
  background: var(--background);
}

/* 用户消息内的图片缩略图 */
.ai-msg-img { margin-bottom: 4px; max-width: 180px; }
.ai-msg-img img { width: 100%; border-radius: 10px; display: block; border: 1px solid var(--border); }
.ai-msg.user .ai-bubble { display: flex; flex-direction: column; align-items: flex-end; }

/* 快捷提问 chips */
.ai-quick-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 0 6px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.ai-quick-chips::-webkit-scrollbar { height: 4px; }
.ai-quick-chips::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.ai-quick-chip {
  flex: 0 0 auto;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--background);
  color: var(--text-primary);
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.ai-quick-chip:hover { background: var(--primary); color: var(--color-text-inverse); border-color: var(--primary); }
.ai-quick-chip:disabled { opacity: .55; cursor: not-allowed; }

/* 待发送图片缩略图 */
.ai-pending-img {
  position: relative;
  display: inline-block;
  margin-top: 8px;
  max-width: 120px;
}
.ai-pending-img img { width: 100%; border-radius: 10px; border: 1px solid var(--border); display: block; }
.ai-pending-remove {
  position: absolute; top: -8px; right: -8px;
  width: 22px; height: 22px; border-radius: 50%;
  border: none; background: var(--text-primary); color: var(--color-text-inverse);
  font-size: 14px; line-height: 1; cursor: pointer;
}

/* 输入行 */
.ai-home-input-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  align-items: center;
}
.ai-img-btn {
  flex: 0 0 auto;
  width: 40px; height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--background);
  color: var(--text-primary);
  font-size: 18px;
  cursor: pointer;
  transition: background .15s;
}
.ai-img-btn:hover { background: var(--color-bg-muted); }
.ai-home-input {
  flex: 1;
  min-width: 0;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--background);
  color: var(--text-primary);
  font-size: 14px;
}
.ai-home-input:focus { outline: none; border-color: var(--primary); }
.ai-home-send {
  flex: 0 0 auto;
  padding: 9px 16px;
  border: none;
  border-radius: 10px;
  background: var(--primary);
  color: var(--color-text-inverse);
  font-size: 14px;
  cursor: pointer;
}
.ai-home-send:disabled { opacity: .5; cursor: not-allowed; }

/* 洞察穿插块 */
.ai-insight-interlude {
  margin: 4px 0 24px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--card-background);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.ai-insight-title { font-size: 15px; font-weight: 700; color: var(--text-primary); margin-bottom: 10px; }
.ai-insight-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.ai-insight-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  background: var(--background);
  cursor: pointer;
  transition: border-color .15s, transform .15s;
}
.ai-insight-card:hover { border-color: var(--primary); transform: translateY(-1px); }
.ai-insight-card-title { font-weight: 600; color: var(--text-primary); font-size: 14px; margin-bottom: 4px; }
.ai-insight-card-body {
  color: var(--text-muted); font-size: 13px; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.ai-insight-more {
  margin-top: 12px;
  border: none; background: none; cursor: pointer;
  color: var(--primary); font-size: 13px; padding: 0;
}
.ai-insight-skeleton {
  height: 56px; border-radius: 12px; margin-bottom: 10px;
  background: var(--color-bg-muted); position: relative; overflow: hidden;
}
.ai-insight-skeleton::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, var(--card-background), transparent);
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
}
.ai-insight-empty { color: var(--text-muted); font-size: 13px; padding: 6px 0; }

/* ===== AI 车次详情弹窗（仿行程详情弹窗，表格样式） ===== */
.td-count { font-size: 12px; color: var(--text-secondary); font-weight: 400; margin-left: 6px; }

/* 多车次列表 */
.td-train-list { margin-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.td-train-item {
  padding: 12px 14px;
  background: var(--card-background);
  border: 1px solid var(--border);
  border-radius: var(--radius-base);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color .15s, background .15s;
}
.td-train-item:hover { border-color: var(--primary); }
.td-train-item.active { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 8%, transparent); }
.td-train-code { font-size: 15px; font-weight: 700; color: var(--text-primary); }
.td-train-route { font-size: 13px; color: var(--text-secondary); }
.td-train-meta { font-size: 13px; color: var(--text-primary); display: flex; justify-content: space-between; gap: 8px; }
.td-train-dur { color: var(--text-secondary); }

/* 路线代码徽标 */
.td-route-code {
  display: inline-flex; align-items: baseline; gap: 8px;
  font-size: 18px; font-weight: 700; color: var(--primary);
  font-family: var(--font-mono, monospace);
  margin-bottom: 12px;
}
.td-route-date { font-size: 12px; color: var(--text-secondary); font-weight: 400; }

/* 路线中间（历时 + 箭头） */
.td-route-mid { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 56px; }
.td-route-dur { font-size: 12px; color: var(--text-secondary); }
.td-route-arrow { font-size: 18px; color: var(--text-secondary); }

/* 价格表强调 */
.schedule-mini-table td.td-price { color: var(--primary); font-weight: 600; }

/* 空态 */
.td-empty { padding: 24px 12px; display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--text-secondary); text-align: center; }
.td-empty-tip { font-size: 12px; }
/* 移动端：chips 横滑、输入行紧凑、对话区略矮 + 车次面板全屏覆盖 */
@media (max-width: 600px) {
  .ai-hero, .ai-insight-interlude { padding: 12px; border-radius: 14px; }
  .ai-home-messages { max-height: 300px; }
  .ai-home-send { padding: 9px 12px; }
  .ai-insight-list { grid-template-columns: 1fr; }
  /* 车次详情面板在移动端全屏覆盖 */
  .train-detail-panel {
    flex: 1 1 100%; max-width: 100%; min-width: 100%;
    position: absolute; inset: 0; z-index: 20;
    border-left: none;
  }
}

/* ===== ask_user 提问卡片（一卡多题） ===== */
.ai-msg.question { display: block; }
.ai-question-card {
  max-width: 88%;
  background: var(--card-background);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 14px;
  color: var(--text-primary);
}
.ai-question-header {
  display: flex; align-items: center; gap: 6px;
  font-weight: 600; font-size: 14px;
  padding-bottom: 8px; margin-bottom: 4px;
  border-bottom: 1px dashed var(--border);
}
.ai-question-header-icon { font-size: 16px; width: 18px; height: 18px; vertical-align: -3px; }
.ai-question-item { padding: 8px 0; }
.ai-question-item + .ai-question-item { border-top: 1px dashed var(--border); }
.ai-question-title { font-weight: 600; margin-bottom: 8px; line-height: 1.5; }
/* 选项 chip：流式换行 */
.ai-question-options { display: flex; flex-wrap: wrap; gap: 8px; }
.ai-question-option {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--background);
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.ai-question-option:hover { border-color: var(--primary); }
.ai-question-option.selected {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--color-text-inverse);
}
.ai-question-option-check {
  display: inline-block; width: 14px; text-align: center;
  font-weight: 700;
}
.ai-question-option-label { white-space: nowrap; }
.ai-question-option-desc { font-size: 12px; opacity: .75; }
/* 补充输入框 */
.ai-question-custom {
  width: 100%; box-sizing: border-box;
  margin-top: 8px; padding: 7px 10px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--background); color: var(--text-primary);
  font-size: 13px; outline: none;
}
.ai-question-custom:focus { border-color: var(--primary); }
/* 卡底操作 */
.ai-question-footer { display: flex; gap: 10px; margin-top: 10px; }
.ai-question-submit {
  padding: 8px 18px; border: none; border-radius: 10px;
  background: var(--primary); color: var(--color-text-inverse);
  font-size: 14px; font-weight: 600; cursor: pointer;
}
.ai-question-submit.disabled { opacity: .45; cursor: not-allowed; }
.ai-question-skip {
  padding: 8px 14px;
  border: 1px solid var(--border); border-radius: 10px;
  background: transparent; color: var(--text-muted);
  font-size: 13px; cursor: pointer;
}
.ai-question-skip:hover { border-color: var(--primary); color: var(--primary); }
/* 已答 / 跳过态：降透明度、置灰锁定 */
.ai-question-answered, .ai-question-skipped { opacity: .65; }
.ai-question-answered { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ai-question-answered-chip {
  padding: 4px 10px; border-radius: 999px;
  background: var(--color-bg-muted, var(--background));
  border: 1px solid var(--border);
  font-size: 12px; color: var(--text-primary);
}
.ai-question-answered-custom { font-size: 12px; color: var(--text-muted); }
.ai-question-skipped {
  margin-top: 8px; font-size: 12px; color: var(--text-muted); text-align: right;
}
.ai-question-card.ai-question-skipped, .ai-question-card.ai-question-answered { opacity: .82; }
