/* ═════════════════════════════════════════════════════════════════
 * TRIZ-AI Lab — Premium Frontend (v2: world-class design language)
 * 设计参考: Material 3 (Google), Linear, Notion, Vercel, Claude.ai
 *
 *   核心视觉语言:
 *   - 渐变品牌色: purple → pink → orange  (用于 brand mark + 5 个核心阶段)
 *   - 中性配色: Material 3 surface tokens (#f9f9f9 / #ffffff / #eeeeee)
 *   - 主强调色: Material 3 primary pink #b7004f (用于 active state / 主 CTA)
 *   - 5 个核心阶段:每个有专属强调色 (purple / pink / orange / cyan / emerald)
 *   - 字体: Inter (400/500/600/700)
 *   - 图标: Material Symbols Outlined
 *   - 形状: pane (1px border + 8-12px radius + 1-3px shadow)
 * ═════════════════════════════════════════════════════════════════*/

:root {
  /* ── Surface tokens — Claude-style warm cream ── */
  --bg:                 #faf9f5;       /* warm cream canvas (Claude.ai base) */
  --bg-elev:            #ffffff;       /* card surface (highest) */
  --bg-soft:            #f4f2ea;       /* soft cream (sections) */
  --bg-container:       #efece2;       /* container */
  --bg-container-high:  #e8e4d6;       /* high container */
  --bg-hover:           #f0ede2;

  /* ── Text — warm dark grays, no cold blacks ── */
  --text:               #2c2a26;       /* warm near-black */
  --text-muted:         #6b6356;       /* warm medium */
  --text-faint:         #968d7e;       /* warm faint */

  /* ── Border — barely-there warm ── */
  --border:             #e8e3d4;       /* soft warm border */
  --border-soft:        #f0ebde;
  --border-strong:      #d4cdb9;

  /* ── Primary brand — warm coral / amber (Claude orange) ── */
  --accent:             #c15f3c;       /* Anthropic-style warm coral */
  --accent-soft:        #f4dcc8;       /* warm pale */
  --accent-text:        #a04a2a;
  --accent-hover:       #a04a2a;

  /* ── Vibrant gradient (品牌主梯度) ── */
  --gradient:           linear-gradient(135deg, #a855f7 0%, #ec4899 50%, #f97316 100%);
  --gradient-soft:      linear-gradient(135deg, rgba(168, 85, 247, 0.08), rgba(236, 72, 153, 0.08), rgba(249, 115, 22, 0.08));
  --gradient-purple:    #a855f7;
  --gradient-pink:      #ec4899;
  --gradient-orange:    #f97316;

  /* ── 5 个核心阶段专属强调色 ── */
  /*  AI-M  机理库            → purple  */
  /*  AI-2  因果链            → pink    */
  /*  AI-4  创新方案 + 跨证据 → orange  */
  /*  AI-7  混合方案          → cyan    */
  --core-purple:       #a855f7;  --core-purple-soft: rgba(168, 85, 247, 0.10);
  --core-pink:         #ec4899;  --core-pink-soft:   rgba(236, 72, 153, 0.10);
  --core-orange:       #f97316;  --core-orange-soft: rgba(249, 115, 22, 0.10);
  --core-cyan:         #06b6d4;  --core-cyan-soft:   rgba(6, 182, 212, 0.10);
  --core-emerald:      #10b981;  --core-emerald-soft:rgba(16, 185, 129, 0.10);

  /* ── 状态色 ── */
  --link:               #1e40af;
  --success:            #006b2a;       /* M3 tertiary */
  --success-bg:         #ecfdf5;
  --warn:               #b45309;
  --warn-bg:            #fffbeb;
  --danger:             #ba1a1a;
  --danger-bg:          #fef2f2;
  --info-bg:            #eff6ff;
  --info-text:          #1e40af;

  /* ── Elevation ── */
  --shadow-sm:          0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow:             0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-md:          0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg:          0 10px 25px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);

  /* ── Shape ── */
  --radius-xs:          4px;
  --radius-sm:          6px;
  --radius:             8px;
  --radius-lg:          12px;
  --radius-xl:          16px;
  --radius-full:        9999px;

  /* ── Motion ── */
  --transition:         180ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth:  280ms cubic-bezier(0.16, 1, 0.3, 1);

  /* ── Typography — Claude-style:精致 sans + 衬线标题 ── */
  --ff-sans: 'Inter', -apple-system, BlinkMacSystemFont, "SF Pro Text",
              "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
              "Segoe UI", Roboto, sans-serif;
  --ff-serif: 'Source Serif Pro', 'Source Serif 4', 'Tiempos Text',
              'Iowan Old Style', 'Apple Garamond', 'Baskerville',
              "Songti SC", "Source Han Serif SC", "Noto Serif CJK SC",
              Georgia, "Times New Roman", serif;
  --ff-mono: 'JetBrains Mono', ui-monospace, "SF Mono", Monaco, Consolas, monospace;
}

/* ═══════════════════════════════════════════════════════════
 * 暗色模式 token 覆盖 — 由 [data-theme="dark"] 切换
 * 默认 follow system, 用户可手动 toggle (持久化在 localStorage)
 * ═══════════════════════════════════════════════════════════*/
[data-theme="dark"] {
  /* Claude-style dark: warm muted, not cold blue */
  --bg:                 #1f1e1c;
  --bg-elev:            #2a2825;
  --bg-soft:            #252320;
  --bg-container:       #2e2b27;
  --bg-container-high:  #36322d;
  --bg-hover:           #2e2b27;

  --text:               #ece9e2;
  --text-muted:         #a8a195;
  --text-faint:         #75705f;

  --border:             #38332c;
  --border-soft:        #2e2b25;
  --border-strong:      #4a4339;

  /* primary 在 dark 下用更亮的暖珊瑚 (Claude orange dark) */
  --accent:             #e08664;
  --accent-soft:        rgba(224, 134, 100, 0.14);
  --accent-text:        #f0a886;
  --accent-hover:       #f0a886;

  /* gradient: 在 dark 下保持原色但加亮 + 增加饱和度 */
  --gradient:           linear-gradient(135deg, #c084fc 0%, #f472b6 50%, #fb923c 100%);
  --gradient-soft:      linear-gradient(135deg, rgba(192, 132, 252, 0.10), rgba(244, 114, 182, 0.10), rgba(251, 146, 60, 0.10));
  --gradient-purple:    #c084fc;
  --gradient-pink:      #f472b6;
  --gradient-orange:    #fb923c;

  /* 核心色稍微提亮 (低背景对比度需要) */
  --core-purple:       #c084fc;  --core-purple-soft: rgba(192, 132, 252, 0.14);
  --core-pink:         #f472b6;  --core-pink-soft:   rgba(244, 114, 182, 0.14);
  --core-orange:       #fb923c;  --core-orange-soft: rgba(251, 146, 60, 0.14);
  --core-cyan:         #22d3ee;  --core-cyan-soft:   rgba(34, 211, 238, 0.14);
  --core-emerald:      #34d399;  --core-emerald-soft:rgba(52, 211, 153, 0.14);

  --link:               #93c5fd;
  --success:            #34d399;
  --success-bg:         rgba(52, 211, 153, 0.10);
  --warn:               #fbbf24;
  --warn-bg:            rgba(251, 191, 36, 0.10);
  --danger:             #f87171;
  --danger-bg:          rgba(248, 113, 113, 0.10);
  --info-bg:            rgba(96, 165, 250, 0.10);
  --info-text:          #60a5fa;

  --shadow-sm:          0 1px 2px rgba(0, 0, 0, 0.30);
  --shadow:             0 1px 3px rgba(0, 0, 0, 0.40), 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-md:          0 4px 6px -1px rgba(0, 0, 0, 0.45), 0 2px 4px -1px rgba(0, 0, 0, 0.30);
  --shadow-lg:          0 10px 25px -3px rgba(0, 0, 0, 0.55), 0 4px 6px -2px rgba(0, 0, 0, 0.30);
}

/* dark 下:scrollbar 调暗 + 选区 + Codeblock 不动 (已是暗) */
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #2a2f3d; border-color: var(--bg); }
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: #3a4053; }
[data-theme="dark"] ::selection { background: rgba(244, 114, 182, 0.30); color: #fff; }

/* dark 下品牌色文字渐变保持渐变效果 (已经用 transparent + bg-clip) */

/* Material Symbols — Claude-style 精致权重
   全局默认用 Rounded 体 (圆润、更友好,Anthropic/Linear/Notion 系)
   .material-symbols-outlined / .material-symbols-rounded 两个 class 都映射到同字体 */
.material-symbols-outlined,
.material-symbols-rounded {
  font-family: 'Material Symbols Rounded', 'Material Symbols Outlined';
  /* 微减重 + GRAD -25 → 纤细优雅; opsz 24 → 锐利渲染 */
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' -25, 'opsz' 24;
  font-size: 20px;
  line-height: 1;
  display: inline-flex;
  vertical-align: middle;
  user-select: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'liga';
}

/* ═══ Reset ═══ */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 14px; }
body {
  font-family: var(--ff-sans);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  height: 100vh;
  overflow: hidden;
  font-feature-settings: 'cv11', 'ss01', 'ss03';   /* Inter 风格优化 */
  letter-spacing: -0.005em;                         /* Claude 风格细微负字距 */
}
/* Claude-style 衬线大标题 — 用于 hero / page-title 等需要"精致感"的地方 */
.serif-heading {
  font-family: var(--ff-serif);
  font-weight: 400;
  letter-spacing: -0.012em;
  font-feature-settings: 'kern', 'liga';
}

/* 所有 metadata / 数字密集区域: 启用 Inter tabular-nums 让数字等宽
   防止 30s / 1m 17s 之类的实时计时器跳动时格子大小变化 */
.run-card-meta,
.run-card-id,
.run-meta,
.sidebar-count,
.runs-group-count,
.stage-stats,
.stage-title-num,
.live-elapsed,
.brand-version,
.badge,
.cmdk-item-hint,
.llm-health,
.live-run-meta {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum', 'cv11', 'ss01';
}
button { font-family: inherit; }
input, textarea, select { font-family: inherit; font-size: inherit; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
::selection { background: var(--accent-soft); color: var(--accent-text); }

/* ═══ Scrollbar (subtle) ═══ */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: #d6d4d1;
  border-radius: 10px;
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: #b8b5b1; }

/* ═══ 顶栏 — Material 3 风格 ═══ */
.topbar {
  position: sticky; top: 0;
  z-index: 50;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  height: 64px;
  display: flex;
  align-items: center;
  box-shadow: var(--shadow-sm);
}
.topbar-inner {
  display: flex; align-items: center;
  padding: 0 24px;
  width: 100%; max-width: 1640px; margin: 0 auto;
  gap: 24px;
}
.brand { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.brand-mark {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, #d97053 0%, var(--accent) 50%, #a04a2a 100%);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 1px 2px rgba(193, 95, 60, 0.25),
    0 4px 14px rgba(193, 95, 60, 0.18);
  position: relative;
  transition: all var(--transition);
}
.brand-mark::before {
  /* 内部细高光环 */
  content: '';
  position: absolute;
  inset: 1px;
  border-radius: 9px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.18) 0%, transparent 50%);
  pointer-events: none;
}
.brand:hover .brand-mark {
  transform: translateY(-1px) rotate(-2deg);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    0 2px 4px rgba(193, 95, 60, 0.3),
    0 8px 20px rgba(193, 95, 60, 0.25);
}
.brand-mark .material-symbols-outlined,
.brand-mark .material-symbols-rounded {
  font-family: 'Material Symbols Rounded' !important;
  font-size: 20px; color: #fff;
  font-variation-settings: 'FILL' 1, 'wght' 450, 'GRAD' 0, 'opsz' 24;
  position: relative;
  z-index: 1;
}
.brand-mark i[data-lucide] {
  font-size: 19px;
  color: #fff;
  position: relative;
  z-index: 1;
}
.brand-mark i[data-lucide] svg {
  stroke-width: 1.8;
}
.brand-text {
  display: flex; flex-direction: column;
  line-height: 1.1;
}
.brand-name {
  font-family: var(--ff-serif);
  font-weight: 500;
  font-size: 18px;
  letter-spacing: -0.018em;
  color: var(--text);
}
.brand-tagline {
  font-size: 10.5px; font-weight: 500;
  color: var(--text-faint);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-top: 1px;
}
.brand-version {
  font-size: 10.5px; font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-container);
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  margin-left: 4px;
  font-family: var(--ff-mono);
  letter-spacing: 0.02em;
}
.topbar-actions { display: flex; gap: 10px; align-items: center; flex-shrink: 0; }

/* LLM 健康指示器 — 顶部一个小绿/黄/红点 + 文字 */
.llm-health {
  display: inline-flex; align-items: center;
  gap: 6px;
  padding: 5px 10px 5px 8px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  cursor: default;
  transition: all var(--transition);
  font-family: var(--ff-mono);
}
.llm-health-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--text-faint);
  flex-shrink: 0;
}
.llm-health.ok .llm-health-dot {
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(0, 107, 42, 0.10);
}
.llm-health.ok { color: var(--success); border-color: rgba(0, 107, 42, 0.20); }
.llm-health.warn .llm-health-dot {
  background: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.10);
}
.llm-health.warn { color: #b45309; border-color: rgba(245, 158, 11, 0.20); }
.llm-health.error .llm-health-dot {
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(186, 26, 26, 0.10);
  animation: pulse-dot 1.6s ease-out infinite;
}
.llm-health.error { color: var(--danger); border-color: rgba(186, 26, 26, 0.20); }
@media (max-width: 1100px) {
  .llm-health-text { display: none; }
  .llm-health { padding: 5px 8px; }
}

/* Cmd+K 触发按钮 — 顶部右侧的搜索入口 */
.cmdk-trigger {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 7px 10px 7px 12px;
  font-family: var(--ff-sans);
  font-size: 12.5px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  min-width: 200px;
}
.cmdk-trigger:hover {
  background: var(--bg-elev);
  border-color: var(--accent);
  color: var(--accent);
}
.cmdk-trigger-text {
  flex: 1; text-align: left;
}
.cmdk-trigger kbd {
  font-family: var(--ff-mono);
  font-size: 10.5px;
  color: var(--text-muted);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 1px 5px;
  font-weight: 600;
}
@media (max-width: 1100px) {
  .cmdk-trigger { min-width: 0; padding: 7px 10px; }
  .cmdk-trigger-text { display: none; }
  .cmdk-trigger kbd { display: none; }
}

/* 顶部中间导航 — Material 3 tab style */
.topbar-nav {
  display: flex;
  gap: 2px;
  align-items: center;
  margin: 0 auto;
  height: 100%;
}
.topbar-nav-btn {
  display: inline-flex; align-items: center; gap: 9px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0 18px;
  height: 100%;
  font-family: var(--ff-sans);
  font-size: 13.5px; color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  font-weight: 500;
  position: relative;
}
.topbar-nav-btn:hover {
  color: var(--accent);
  background: var(--accent-soft);
}
.topbar-nav-btn:hover .topbar-nav-icon {
  background: linear-gradient(135deg, var(--accent-soft), rgba(193, 95, 60, 0.04));
  border-color: rgba(193, 95, 60, 0.28);
  color: var(--accent);
}
.topbar-nav-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: linear-gradient(180deg, transparent 50%, var(--accent-soft) 100%);
}
.topbar-nav-btn.active .topbar-nav-icon {
  background: linear-gradient(135deg, var(--accent-soft), rgba(193, 95, 60, 0.04));
  border-color: rgba(193, 95, 60, 0.32);
  color: var(--accent);
}
/* 顶部 nav icon — Lucide 在小方块里 */
.topbar-nav-icon {
  font-family: 'Material Symbols Rounded' !important;
  font-size: 15px !important;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--bg-elev), var(--bg-soft));
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
  transition: all var(--transition);
  font-variation-settings: 'FILL' 0, 'wght' 450, 'GRAD' 0, 'opsz' 24;
}
i.topbar-nav-icon[data-lucide] svg {
  stroke-width: 1.85;
  width: 15px;
  height: 15px;
}
@media (max-width: 1000px) {
  .topbar-nav-btn span:last-child { display: none; }
  .topbar-nav-btn { padding: 0 12px; }
  .brand-tagline { display: none; }
}

/* ═══ Buttons ═══ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--ff-sans);
  font-size: 13px; font-weight: 500;
  padding: 8px 16px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
  background: var(--gradient);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(236, 72, 153, 0.20);
}
.btn-primary:hover:not(:disabled) {
  box-shadow: 0 4px 12px rgba(236, 72, 153, 0.35);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }
.btn-ghost {
  background: var(--bg-elev);
  color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--bg-soft);
  border-color: var(--accent);
  color: var(--accent);
}
.btn-icon {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  width: 36px; height: 36px;
  padding: 0;
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.btn-icon:hover {
  background: var(--bg-soft);
  color: var(--accent);
  border-color: var(--accent);
}
.btn-icon .material-symbols-outlined { font-size: 18px; }
.btn-link {
  background: none; border: none;
  color: var(--link); font-size: 13px;
  cursor: pointer; padding: 4px 0;
}
.btn-link:hover { text-decoration: underline; }

/* ═══ Layout ═══ */
:root { --sidebar-width: 320px; }
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) 4px 1fr;
  height: calc(100vh - 64px);  /* topbar 现在 64px */
  overflow: hidden;
  background: var(--bg);
}

/* ─── 拖动条 ─── */
.resizer {
  position: relative;
  background: transparent;
  cursor: col-resize;
  user-select: none;
  outline: none;
  transition: background var(--transition);
}
.resizer-handle {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 2px; height: 28px;
  background: var(--border);
  border-radius: 2px;
  transition: all var(--transition);
}
.resizer:hover .resizer-handle,
.resizer:focus-visible .resizer-handle {
  background: var(--accent);
  height: 40px;
  width: 3px;
}
.resizer:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
/* 拖动时整页禁用文本选择 + 显示十字光标 */
body.resizing { cursor: col-resize !important; user-select: none; }
body.resizing * { user-select: none !important; }

/* ═══ Sidebar ═══ */
.sidebar {
  background: var(--bg-elev);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.sidebar-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 20px 12px;
  border-bottom: 1px solid var(--border-soft);
}
.sidebar-header h3 {
  font-size: 11px; font-weight: 700;
  color: var(--text-faint);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.sidebar-header-actions {
  display: flex; align-items: center; gap: 6px;
}
.sidebar-density-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-faint);
  transition: all var(--transition);
  padding: 0;
}
.sidebar-density-btn:hover {
  background: var(--bg-soft);
  border-color: var(--border);
  color: var(--accent);
}
.sidebar-density-btn .material-symbols-outlined { font-size: 14px; }

/* ─── 紧凑密度模式: 隐藏 meta + query 单行 + 调小 padding ─── */
[data-run-density="compact"] .run-card {
  padding: 8px 10px;
}
[data-run-density="compact"] .run-card-top {
  margin-bottom: 2px;
}
[data-run-density="compact"] .run-card-query {
  -webkit-line-clamp: 1;
  font-size: 12px;
}
[data-run-density="compact"] .run-card-meta {
  font-size: 10px;
  margin-top: 1px;
  opacity: 0.7;
}
[data-run-density="compact"] .runs-group {
  margin-bottom: 8px;
}
[data-run-density="compact"] .runs-group-header {
  padding: 6px 10px 3px;
  font-size: 9.5px;
}
.sidebar-search {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-soft);
}
.sidebar-search input {
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-soft);
  font-family: var(--ff-sans);
  font-size: 13px;
  transition: all var(--transition);
}
.sidebar-search input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg-elev);
  box-shadow: 0 0 0 3px rgba(183, 0, 79, 0.10);
}
.sidebar-count {
  font-size: 11px; color: var(--text-muted);
  font-family: var(--ff-mono);
  font-weight: 600;
  background: var(--bg-container);
  padding: 2px 7px;
  border-radius: var(--radius-xs);
}
.sidebar-list {
  flex: 1; overflow-y: auto;
  padding: 8px 8px 80px;
}

/* RUN 时间分组 — 今天 / 本周 / 本月 / 更早 */
.runs-group { margin-bottom: 14px; }
.runs-group:last-child { margin-bottom: 0; }
.runs-group-header {
  display: flex; align-items: center;
  gap: 7px;
  padding: 10px 12px 6px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-faint);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  position: sticky;
  top: 0;
  background: linear-gradient(180deg, var(--bg-elev) 70%, transparent);
  z-index: 1;
}
.runs-group-header .material-symbols-outlined {
  font-size: 14px;
  color: var(--text-faint);
}
.runs-group-title { flex: 1; }
.runs-group-count {
  font-family: var(--ff-mono);
  font-size: 10px;
  color: var(--text-faint);
  background: var(--bg-container);
  padding: 1px 6px;
  border-radius: var(--radius-xs);
  font-variant-numeric: tabular-nums;
}
/* "运行中" 分组单独着色 */
.runs-group:first-child .runs-group-header {
  color: var(--info-text);
}
.runs-group:first-child .runs-group-header .material-symbols-outlined {
  color: var(--info-text);
  animation: spin 1.6s linear infinite;
}

.run-card {
  padding: 12px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  margin-bottom: 3px;
  border: 1px solid transparent;
  transition: all 120ms cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}
.run-card:hover {
  background: var(--bg-soft);
  border-color: var(--border);
}
.run-card.active {
  background: var(--accent-soft);
  border-color: rgba(183, 0, 79, 0.25);
}
.run-card.active .run-card-id { color: var(--accent-text); font-weight: 600; }
.run-card.active .run-card-query { color: var(--accent-text); }

/* 对比 checkbox — 卡片左上, hover 时显示, 选中后常驻 */
.run-card-compare {
  position: absolute;
  top: 6px; left: 6px;
  width: 18px; height: 18px;
  opacity: 0;
  transition: opacity var(--transition);
  z-index: 2;
}
.run-card:hover .run-card-compare,
.run-card.is-comparing .run-card-compare {
  opacity: 1;
}
.run-card-compare input {
  width: 16px; height: 16px;
  margin: 0;
  cursor: pointer;
  accent-color: var(--accent);
}
.run-card.is-comparing {
  box-shadow: 0 0 0 2px var(--accent) inset;
  background: var(--accent-soft);
}
.run-card.is-comparing .run-card-id { color: var(--accent-text); font-weight: 600; }

/* 浮动对比 actionbar */
.compare-bar {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  animation: compareBarSlideUp 280ms cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes compareBarSlideUp {
  from { transform: translate(-50%, 20px); opacity: 0; }
  to   { transform: translate(-50%, 0); opacity: 1; }
}
.compare-bar-inner {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 8px 8px 8px 16px;
  box-shadow: var(--shadow-lg);
}
.compare-bar-inner .material-symbols-outlined {
  color: var(--accent);
  font-size: 20px;
}
.compare-bar-text {
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
}
.compare-bar-text strong {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.compare-bar-go { padding: 6px 14px; font-size: 12.5px; border-radius: var(--radius-full); }
.compare-bar-clear { padding: 6px 12px; font-size: 12.5px; border-radius: var(--radius-full); }

/* 对比视图主区域 */
.compare-view {
  padding: 28px 40px 80px;
  max-width: 100%;
  margin: 0;
  animation: fadeIn 240ms ease;
}
.compare-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 20px;
}
.compare-header h2 {
  display: flex; align-items: center; gap: 10px;
  font-size: 20px; font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}
.compare-header h2 .material-symbols-outlined {
  color: var(--accent);
  font-size: 24px;
}
.compare-count {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--gradient);
  color: #fff;
  font-size: 12px; font-weight: 700;
  padding: 2px 9px;
  border-radius: var(--radius-full);
  font-variant-numeric: tabular-nums;
}

.compare-grid {
  display: grid;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.compare-cell {
  padding: 14px 18px;
  border-right: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
  font-size: 13px;
  color: var(--text);
  display: flex; align-items: center;
  min-height: 52px;
  background: var(--bg-elev);
}
.compare-cell:last-child { border-right: none; }
.compare-cell.compare-th {
  background: var(--bg-soft);
  font-weight: 600;
  position: sticky; top: 0;
  z-index: 2;
}
.compare-runhead {
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}
.compare-runhead-id {
  font-family: var(--ff-mono);
  font-size: 11.5px;
  color: var(--text-muted);
}
.compare-runhead-num {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.compare-cell.compare-label {
  display: flex; gap: 8px;
  font-weight: 600;
  font-size: 12.5px;
  color: var(--text);
  background: var(--bg-soft);
}
.compare-cell.compare-label .material-symbols-outlined {
  font-size: 16px;
  color: var(--text-muted);
}
.compare-cell.compare-label.is-core[data-color="purple"] .material-symbols-outlined { color: var(--core-purple); }
.compare-cell.compare-label.is-core[data-color="pink"]   .material-symbols-outlined { color: var(--core-pink); }
.compare-cell.compare-label.is-core[data-color="orange"] .material-symbols-outlined { color: var(--core-orange); }
.compare-cell.compare-label.is-core[data-color="cyan"]   .material-symbols-outlined { color: var(--core-cyan); }
.compare-cell.compare-label.is-core {
  border-left: 3px solid var(--gradient-pink);
  background: linear-gradient(90deg, var(--core-pink-soft) 0%, var(--bg-soft) 30%);
}
.compare-cell.compare-separator {
  background: var(--bg-container);
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 8px 18px;
  min-height: 0;
  justify-content: flex-start;
}

.compare-query {
  font-size: 13px;
  line-height: 1.5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.compare-elapsed {
  font-family: var(--ff-mono);
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.compare-incomplete { color: var(--warn); font-weight: 500; }
.compare-warn { color: var(--warn); font-weight: 500; }
.compare-ok { color: var(--success); font-weight: 500; }
.compare-stat {
  font-size: 12px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* ─── diff highlighting ─── */
/* max — 绿色边 + 微浅绿背景 + ▲ */
.compare-cell-max {
  position: relative;
  background: rgba(16, 185, 129, 0.06);
}
.compare-cell-max::before {
  content: '▲';
  position: absolute;
  top: 4px; right: 6px;
  font-size: 9px;
  color: var(--success);
  font-weight: 700;
}
/* min — 橙色边 + 微浅橙背景 + ▼ */
.compare-cell-min {
  position: relative;
  background: rgba(245, 158, 11, 0.06);
}
.compare-cell-min::before {
  content: '▼';
  position: absolute;
  top: 4px; right: 6px;
  font-size: 9px;
  color: var(--warn);
  font-weight: 700;
}
/* 同值 (所有 RUN 数值相同) — 淡化, 表示这一行没差异 */
.compare-cell-same {
  color: var(--text-muted);
  opacity: 0.65;
}
.compare-cell-mid {
  /* 中间值, 不强调 */
}
.compare-open-btn {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  font-size: 11.5px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}
.compare-open-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* 收藏 (pin) 按钮 — 卡片右上, hover 时显示, 已收藏的常驻 */
.run-card-pin {
  position: absolute;
  top: 6px; right: 6px;
  width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  opacity: 0;
  transition: all var(--transition);
  padding: 0;
  z-index: 2;
}
.run-card:hover .run-card-pin,
.run-card-pin.is-pinned {
  opacity: 1;
}
.run-card-pin:hover {
  color: var(--accent);
  transform: scale(1.15);
}
.run-card-pin.is-pinned {
  color: var(--gradient-orange);
}
.run-card-pin.is-pinned .material-symbols-outlined {
  font-variation-settings: 'FILL' 1, 'wght' 500;
}

/* 继续 RUN 按钮 — 失败/orphan/incomplete 卡片专属 */
.run-card-resume {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 3px 8px 3px 5px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
.run-card-resume .material-symbols-outlined {
  font-size: 14px;
  font-variation-settings: 'FILL' 1, 'wght' 500;
}
.run-card-resume:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(193, 95, 60, 0.25);
}
.run-card-resume:disabled,
.run-card-resume.is-loading {
  opacity: 0.6;
  cursor: progress;
}
.run-card-resume.is-loading .material-symbols-outlined,
.run-card-resume.is-loading i[data-lucide] {
  animation: spin 1s linear infinite;
}

/* 重跑按钮 — 跟「继续」并列,更克制的中性色 */
.run-card-restart {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: var(--bg-elev);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px 8px 3px 6px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  margin-left: 4px;
}
.run-card-restart i[data-lucide] {
  font-size: 13px;
}
.run-card-restart i[data-lucide] svg {
  stroke-width: 2;
  width: 13px;
  height: 13px;
}
.run-card-restart:hover {
  background: var(--bg-soft);
  border-color: var(--text-faint);
  color: var(--text);
  transform: translateY(-1px);
}
.run-card-restart:disabled,
.run-card-restart.is-loading {
  opacity: 0.6;
  cursor: progress;
}
.run-card-restart.is-loading i[data-lucide] {
  animation: spin 1s linear infinite;
}
.run-card-pin .material-symbols-outlined { font-size: 16px; }

/* 收藏分组的 header — 渐变小图标 */
.runs-group:has(.run-card.is-pinned) .runs-group-header {
  /* 不能依赖 :has — fallback 用 nth-of-type 也行, 这里简单些 */
}

/* 删除按钮 — 卡片 hover 时显示, 右下角 */
.run-card-del {
  position: absolute;
  bottom: 6px; right: 6px;
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-faint);
  cursor: pointer;
  opacity: 0;
  transform: translateY(2px);
  transition: opacity var(--transition), transform var(--transition), color var(--transition), border-color var(--transition);
  padding: 0;
  z-index: 2;
}
.run-card:hover .run-card-del {
  opacity: 1;
  transform: translateY(0);
}
.run-card-del:hover {
  color: var(--danger);
  border-color: var(--danger);
  background: var(--danger-bg);
}
.run-card-del .material-symbols-outlined {
  font-size: 16px;
}
.run-card-top {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 4px;
}
.run-card-id {
  font-family: var(--ff-mono);
  font-size: 10.5px;
  color: var(--text-faint);
  font-weight: 500;
}
.run-card-query {
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 4px;
}
.run-card-meta {
  font-size: 10.5px;
  color: var(--text-faint);
  display: flex; align-items: center; gap: 5px;
}
.dot {
  width: 2px; height: 2px;
  border-radius: 50%;
  background: var(--text-faint);
}

.badge {
  display: inline-flex; align-items: center;
  padding: 1px 7px;
  border-radius: 4px;
  font-size: 10px; font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
.badge-pass { background: var(--success-bg); color: var(--success); }
.badge-fail { background: var(--danger-bg); color: var(--danger); }
.badge-incomplete { background: var(--warn-bg); color: var(--warn); }
.badge-done {
  background: var(--bg-container);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.run-card.active .badge-done {
  background: rgba(255, 255, 255, 0.6);
  color: var(--accent-text);
  border-color: rgba(183, 0, 79, 0.2);
}
.run-meta-audit {
  color: var(--warn);
  font-weight: 500;
}

/* ═══════════════════════════════════════════════════════════
 * Hero 执行摘要卡 (Layer 1)
 * ═══════════════════════════════════════════════════════════*/
.hero-summary {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 26px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  animation: heroEnter 320ms cubic-bezier(0.16, 1, 0.3, 1) backwards;
}
.hero-summary::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 4px;
  background: var(--gradient);
}
.hero-summary-header {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 12px;
}
.hero-summary-label {
  font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-summary-title {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap;
  font-family: var(--ff-serif);
  font-size: 22px; font-weight: 500;
  color: var(--text);
  letter-spacing: -0.018em;
  margin-bottom: 18px;
  line-height: 1.3;
}
.hero-summary-id {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px 8px;
  font-family: var(--ff-mono);
  font-size: 13px; font-weight: 700;
  color: var(--accent-text);
}
.hero-summary-score {
  margin-left: auto;
  background: var(--gradient);
  color: #fff;
  font-size: 13px; font-weight: 700;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-variant-numeric: tabular-nums;
  box-shadow: 0 2px 8px rgba(236, 72, 153, 0.25);
}

.hero-summary-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 16px;
  padding: 10px 0;
  border-top: 1px solid var(--border-soft);
  font-size: 13px;
}
.hero-summary-row:first-of-type { border-top: none; padding-top: 0; }
.hero-summary-row-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-faint);
  flex-shrink: 0;
}
.hero-summary-row-label .material-symbols-outlined {
  font-size: 16px;
  color: var(--text-muted);
}
.hero-summary-row-val {
  color: var(--text);
  line-height: 1.65;
}
.hero-summary-row-val code {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 11.5px;
  margin-right: 4px;
  color: var(--accent-text);
}

.hero-summary-warning {
  display: flex; align-items: center; gap: 10px;
  margin-top: 16px;
  background: var(--warn-bg);
  border: 1px solid rgba(180, 83, 9, 0.25);
  border-left: 3px solid var(--warn);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 12.5px;
  color: var(--warn);
  cursor: pointer;
  transition: all var(--transition);
}
.hero-summary-warning:hover {
  background: rgba(245, 158, 11, 0.14);
  transform: translateX(2px);
}
.hero-summary-warning .material-symbols-outlined {
  color: var(--warn);
  flex-shrink: 0;
}
.hero-summary-warning-cta {
  margin-left: auto;
  font-weight: 600;
  white-space: nowrap;
}

.hero-summary-ok {
  display: flex; align-items: center; gap: 8px;
  margin-top: 16px;
  background: var(--success-bg);
  border: 1px solid rgba(0, 107, 42, 0.2);
  border-left: 3px solid var(--success);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 12.5px;
  color: var(--success);
}
.hero-summary-ok .material-symbols-outlined { color: var(--success); flex-shrink: 0; }

.hero-summary-actions {
  display: flex; gap: 8px;
  margin-top: 20px;
  flex-wrap: wrap;
}
.hero-summary-actions .btn { font-size: 12.5px; padding: 7px 14px; }
.hero-summary-actions a.btn { text-decoration: none; }

/* ═══════════════════════════════════════════════════════════
 * Live 模式 — sticky 状态条 + 阶段 chips + 日志折叠
 * ═══════════════════════════════════════════════════════════*/
.live-sticky-banner {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg-elev);
  border: 1px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  margin-bottom: 18px;
  box-shadow: 0 4px 14px rgba(193, 95, 60, 0.10), 0 1px 2px rgba(0, 0, 0, 0.04);
}
.live-sticky-status {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; font-weight: 500;
  color: var(--accent-text);
  margin-bottom: 6px;
}
.live-sticky-status .pulse-dot {
  width: 7px; height: 7px;
  background: var(--accent);
  border-radius: 50%;
}
.live-sticky-status strong { color: var(--text); font-weight: 600; }
.live-sticky-elapsed {
  margin-left: auto;
  font-size: 12px;
  font-family: var(--ff-mono);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.live-sticky-stop { margin-left: 8px; }

/* ─── 发散↔收敛 节奏波形图 ─── */
.live-rhythm {
  position: relative;
  width: 100%;
  height: 78px;
  margin: 8px 0 14px;
  background: linear-gradient(180deg, rgba(168, 85, 247, 0.04) 0%, transparent 50%, rgba(193, 95, 60, 0.04) 100%);
  border-radius: var(--radius);
  padding: 10px 14px 6px;
}
/* 完成模式 — 加边框 + 淡背景, 让"完成路径"作为产物 */
.live-rhythm.is-completed {
  margin: 6px 0 18px;
  border: 1px solid var(--border);
  background:
    linear-gradient(180deg, rgba(168, 85, 247, 0.05) 0%, transparent 50%, rgba(34, 139, 84, 0.04) 100%);
}
.live-rhythm.is-completed .rhythm-dot.is-done {
  fill: var(--success);
}
.live-rhythm-label-top,
.live-rhythm-label-bot {
  position: absolute;
  left: 8px;
  font-size: 9.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--text-faint);
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.live-rhythm-label-top { top: 4px; color: var(--gradient-purple); }
.live-rhythm-label-bot { bottom: 4px; color: var(--accent); }
.live-rhythm-label-top .material-symbols-outlined,
.live-rhythm-label-bot .material-symbols-outlined {
  font-size: 12px;
}
.live-rhythm-svg {
  width: 100%;
  height: 100%;
  display: block;
}
.rhythm-axis-line {
  stroke: var(--border);
  stroke-width: 0.5;
  stroke-dasharray: 1.2 1.2;
  vector-effect: non-scaling-stroke;
  opacity: 0.7;
}
.rhythm-line {
  fill: none;
  stroke: url(#rhythm-grad);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.rhythm-area {
  fill: url(#rhythm-area-grad);
  opacity: 0.45;
}
.rhythm-dot {
  fill: var(--bg-elev);
  stroke: var(--border-strong);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  transition: all var(--transition);
}
.rhythm-dot.is-done {
  fill: var(--success);
  stroke: white;
  stroke-width: 1.2;
}
.rhythm-dot.is-current {
  fill: var(--accent);
  stroke: white;
  stroke-width: 1.2;
  r: 3.5;
  filter: drop-shadow(0 0 4px rgba(193, 95, 60, 0.6));
  animation: rhythm-pulse 1.4s ease-out infinite;
}
.rhythm-tick {
  stroke: var(--border);
  stroke-width: 0.4;
  vector-effect: non-scaling-stroke;
  opacity: 0.5;
}
@keyframes rhythm-pulse {
  0%   { r: 3; opacity: 1; }
  50%  { r: 4.5; opacity: 0.65; }
  100% { r: 3; opacity: 1; }
}

/* ─── 阶段 chip — 带短名 + 节奏图标 ─── */
/* 9 列 grid,纵向堆叠 (顶上 icon+num,下面中文名) — 给名字足够宽度 */
.live-sticky-chips {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: 6px;
}
.live-sticky-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text-muted);
  transition: all var(--transition);
  min-width: 0;
  text-align: center;
}
.live-sticky-chip .live-chip-top {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.live-sticky-chip .live-chip-status {
  font-size: 13px;
  flex-shrink: 0;
}
.live-sticky-chip .live-chip-num {
  font-family: var(--ff-mono);
  font-size: 10px;
  font-weight: 700;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  padding: 0 4px;
  border-radius: 3px;
  min-width: 14px;
  text-align: center;
  color: var(--text-faint);
  flex-shrink: 0;
}
.live-sticky-chip .live-chip-name {
  font-weight: 500;
  font-size: 11px;
  line-height: 1.25;
  width: 100%;
  /* 允许折行,避免一字截断 */
  white-space: normal;
  word-break: keep-all;
  overflow-wrap: break-word;
  color: var(--text);
}
/* 窄屏 fallback: 9 列挤不下时改 wrap */
@media (max-width: 1100px) {
  .live-sticky-chips {
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  }
}
.live-sticky-chip.rhythm-diverge .live-chip-rhythm { color: var(--gradient-purple); }
.live-sticky-chip.rhythm-converge .live-chip-rhythm { color: var(--accent); }
.live-sticky-chip.rhythm-both .live-chip-rhythm { color: var(--core-cyan); }

.live-sticky-chip.done {
  background: var(--success-bg);
  color: var(--success);
  border-color: rgba(0, 107, 42, 0.22);
}
.live-sticky-chip.done .live-chip-num {
  background: rgba(0, 107, 42, 0.10);
  border-color: rgba(0, 107, 42, 0.22);
  color: var(--success);
}
.live-sticky-chip.current {
  background: var(--accent-soft);
  color: var(--accent-text);
  border-color: var(--accent);
  font-weight: 600;
  box-shadow: 0 0 0 3px rgba(193, 95, 60, 0.10);
}
.live-sticky-chip.current .live-chip-num {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.live-sticky-chip.current .live-chip-status {
  animation: spin 1.6s linear infinite;
}

/* 实时日志可折叠面板 (在 stages-grid 下方) */
.live-log-panel {
  margin-top: 18px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.live-log-panel summary {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 12px; font-weight: 600;
  color: var(--text-muted);
  list-style: none;
  user-select: none;
}
.live-log-panel summary::-webkit-details-marker { display: none; }
.live-log-panel summary:hover { background: var(--bg-container); }
.live-log-panel summary .material-symbols-outlined {
  font-size: 16px; color: var(--text-faint);
}
.live-log-panel[open] summary { border-bottom: 1px solid var(--border); }
.live-log-panel .live-run-log {
  margin: 0; border-radius: 0;
}

/* ═══════════════════════════════════════════════════════════
 * Layer 2 — 结构化展示块 (每个 stage card 内)
 * ═══════════════════════════════════════════════════════════*/
.layer2-block {
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 10px;
}
.layer2-block:last-of-type { margin-bottom: 14px; }
.layer2-block-head {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 8px;
}
.layer2-block-icon {
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent-text);
}
.layer2-block-icon .material-symbols-outlined,
.layer2-block-icon .layer2-msym {
  font-size: 14px;
  font-variation-settings: 'FILL' 0, 'wght' 500, 'GRAD' 0, 'opsz' 24;
}
.layer2-block-emoji { font-size: 13px; line-height: 1; }
.layer2-link .material-symbols-outlined {
  font-size: 14px;
  vertical-align: -2px;
  color: var(--accent);
}
.layer2-block-content {
  font-size: 13px;
  line-height: 1.65;
  color: var(--text);
  font-feature-settings: 'tnum', 'cv11', 'ss01';
}
.layer2-block-content code {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 11.5px;
  color: var(--accent-text);
  margin: 0 2px;
}
/* 抽象问题块 — 强调 */
.layer2-block.is-abstract {
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.06), rgba(168, 85, 247, 0.04));
  border-color: rgba(236, 72, 153, 0.25);
  border-left: 3px solid var(--accent);
}
/* 现有方案探查 — 蓝灰色调 */
/* 本行业已有方案 — 警示色调 (绿色, 提醒"这些已经有,不能重做") */
.layer2-block.is-incumbents {
  background: linear-gradient(135deg, rgba(34, 139, 84, 0.05), rgba(34, 139, 84, 0.02));
  border-color: rgba(34, 139, 84, 0.18);
  border-left: 3px solid var(--success);
}
.layer2-pill.is-incumbent-dir {
  background: rgba(34, 139, 84, 0.08);
  border-color: rgba(34, 139, 84, 0.22);
  color: var(--success);
}
.ai4-incumbent-group {
  margin-bottom: 10px;
  padding: 8px 10px;
  background: var(--bg-elev);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.ai4-incumbent-dir-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: -0.005em;
}
.ai4-incumbent-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 6px;
}
.ai4-incumbent-chip {
  display: inline-flex;
  align-items: center;
  font-size: 11.5px;
  padding: 3px 9px;
  background: var(--bg-soft);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  cursor: help;
}
/* mini-card 显示:name + 1-2 行说明 */
.ai4-incumbent-card {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 7px 10px;
  background: var(--bg-soft, #fafafa);
  border: 1px solid var(--border, #e4e4e7);
  border-radius: 6px;
  cursor: help;
  transition: border-color 0.12s, background 0.12s;
}
.ai4-incumbent-card:hover {
  border-color: var(--accent, #ea580c);
  background: var(--bg, #fff);
}
.ai4-incumbent-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text, #1f2937);
  line-height: 1.35;
  word-break: break-word;
}
.ai4-incumbent-desc {
  font-size: 11px;
  color: var(--text-muted, #6b7280);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ai4-incumbent-desc.is-empty {
  color: var(--text-faint, #9ca3af);
  font-style: italic;
}

/* ═══════════════════════════════════════════════════════════════════
   V6.7.50 专利 verify 徽章 — incumbent card 底部 + 顶部 overview
   ═══════════════════════════════════════════════════════════════════ */

/* 卡片底部的 evidence 列表 */
.ai4-incumbent-evidence {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--border-soft, #e4e4e7);
}
.ai4-ev-row {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  padding: 3px 6px;
  border-radius: 4px;
  text-decoration: none;
  color: inherit;
  transition: background 0.1s;
  word-break: break-all;
}
.ai4-ev-row code {
  font-size: 10.5px;
  font-family: var(--ff-mono, monospace);
  background: rgba(0,0,0,0.04);
  padding: 1px 4px;
  border-radius: 3px;
}
a.ai4-ev-row { cursor: pointer; }
a.ai4-ev-row:hover { background: rgba(0,0,0,0.05); }

.ai4-ev-row.ev-verified              { background: rgba(34, 197, 94, 0.08);  color: #166534; }
.ai4-ev-row.ev-verified_no_assignee  { background: rgba(132, 204, 22, 0.08); color: #4d7c0f; }
.ai4-ev-row.ev-partial               { background: rgba(245, 158, 11, 0.08); color: #92400e; }
.ai4-ev-row.ev-hallucinated          { background: rgba(239, 68, 68, 0.08);  color: #991b1b; }
.ai4-ev-row.ev-non_patent            { background: rgba(107, 114, 128, 0.06); color: #4b5563; font-style: italic; }
.ai4-ev-row.ev-unverified            { background: rgba(107, 114, 128, 0.04); color: #6b7280; }

.ai4-ev-meta {
  font-size: 10px;
  color: inherit;
  opacity: 0.75;
  margin-left: 4px;
}

/* 顶部总览块 */
.ai4-verify-overview {
  background: linear-gradient(90deg, rgba(34, 197, 94, 0.05), rgba(245, 158, 11, 0.03), rgba(239, 68, 68, 0.03));
  border: 1px solid var(--border-soft, #e4e4e7);
  border-left: 3px solid #3b82f6;
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 12px;
}
.ai4-verify-overview-head {
  font-size: 12.5px;
  color: var(--text, #1f2937);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.ai4-verify-overview-meta {
  font-size: 10.5px;
  color: var(--text-muted, #6b7280);
  font-weight: 400;
  margin-left: auto;
}
.ai4-verify-overview-stats {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.ai4-verify-stat {
  font-size: 11.5px;
  padding: 3px 8px;
  border-radius: 12px;
  font-weight: 600;
}
.ai4-verify-stat.verified              { background: #dcfce7; color: #166534; }
.ai4-verify-stat.verified_no_assignee  { background: #ecfccb; color: #4d7c0f; }
.ai4-verify-stat.partial               { background: #fef3c7; color: #92400e; }
.ai4-verify-stat.hallucinated          { background: #fee2e2; color: #991b1b; }
.ai4-verify-stat.non_patent            { background: #f3f4f6; color: #4b5563; }
.ai4-verify-stat.unverified            { background: #f3f4f6; color: #6b7280; }
/* 移动端单列 */
@media (max-width: 600px) {
  .ai4-incumbent-items { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════════════════════
   AI-4: 专利密集区 + 机会方向 (来自 AI-2.5 patent_dense_zones / opportunity_directions)
   ═══════════════════════════════════════════════════════════════════ */
.layer2-block.is-dense-zones {
  background: rgba(239, 68, 68, 0.04);
  border-color: rgba(239, 68, 68, 0.20);
  border-left: 3px solid #ef4444;
}
.layer2-block.is-opportunities {
  background: rgba(34, 197, 94, 0.04);
  border-color: rgba(34, 197, 94, 0.20);
  border-left: 3px solid #22c55e;
}

/* V6.7.84 场域覆盖审计 chip 行 */
.layer2-block.is-field-audit {
  background: rgba(99, 102, 241, 0.04);
  border-color: rgba(99, 102, 241, 0.20);
  border-left: 3px solid #6366f1;
}
.ai4-fa-row { display: flex; flex-wrap: wrap; gap: 6px; }
.ai4-fa-pill { cursor: help; font-size: 11.5px; }
.ai4-fa-pill.is-fa-covered { background: rgba(34, 197, 94, 0.10); border: 1px solid rgba(34, 197, 94, 0.35); }
.ai4-fa-pill.is-fa-cross   { background: rgba(245, 158, 11, 0.12); border: 1px solid rgba(245, 158, 11, 0.40); }
.ai4-fa-pill.is-fa-blank   { background: rgba(99, 102, 241, 0.10); border: 1px solid rgba(99, 102, 241, 0.35); }
.ai4-fa-pill.is-fa-na      { background: rgba(0, 0, 0, 0.03); border: 1px solid var(--border-soft, #e4e4e7); color: var(--text-faint); }

.ai4-dense-zones-list, .ai4-opp-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 8px;
}
.ai4-dense-zone-row, .ai4-opp-row {
  background: var(--bg, #fff);
  border: 1px solid var(--border-soft, #e4e4e7);
  border-radius: 6px;
  padding: 9px 11px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.ai4-dense-zone-head, .ai4-opp-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.ai4-dense-zone-name, .ai4-opp-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--text, #1f2937);
  flex: 1;
  min-width: 0;
  word-break: break-word;
}
.ai4-dense-zone-badges {
  display: inline-flex;
  gap: 5px;
  font-size: 11px;
  flex-shrink: 0;
}
.ai4-dense-badge {
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-size: 10px;
}
.ai4-dense-dense       { background: #fee2e2; color: #991b1b; }
.ai4-dense-moderate    { background: #fef3c7; color: #92400e; }
.ai4-dense-sparse      { background: #dcfce7; color: #166534; }
.ai4-dense-blank       { background: #f3f4f6; color: #4b5563; }

.ai4-dense-difficulty {
  font-size: 10.5px;
  color: var(--text-muted, #6b7280);
  padding: 1px 6px;
  background: var(--bg-soft, #fafafa);
  border-radius: 3px;
}

.ai4-dense-players {
  font-size: 11.5px;
  color: var(--text-muted, #6b7280);
}
.ai4-dense-players strong {
  color: var(--text, #1f2937);
  font-weight: 600;
}
.ai4-dense-desc {
  font-size: 11.5px;
  color: var(--text-muted, #6b7280);
  line-height: 1.45;
}

/* 机会方向 */
.ai4-opp-type {
  font-size: 10.5px;
  padding: 1px 6px;
  background: rgba(34, 197, 94, 0.10);
  color: #166534;
  border-radius: 10px;
  font-weight: 600;
  flex-shrink: 0;
}
.ai4-opp-desc, .ai4-opp-why, .ai4-opp-rel {
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--text-muted, #6b7280);
}
.ai4-opp-label {
  color: var(--text, #1f2937);
  font-weight: 600;
}

@media (max-width: 600px) {
  .ai4-dense-zones-list, .ai4-opp-list { grid-template-columns: 1fr; }
}

.layer2-block.is-landscape {
  background: rgba(30, 64, 175, 0.04);
  border-color: rgba(30, 64, 175, 0.15);
  border-left: 3px solid var(--link);
}
/* 创新方案 — 渐变橙 */
.layer2-block.is-innovation {
  background: linear-gradient(90deg, rgba(249, 115, 22, 0.06), transparent 60%);
  border-color: rgba(249, 115, 22, 0.25);
  border-left: 3px solid var(--gradient-orange);
}
/* 审计 fatal 强调 */
.layer2-block.is-fatal {
  background: var(--danger-bg);
  border-color: rgba(186, 26, 26, 0.25);
  border-left: 3px solid var(--danger);
}
.layer2-block.is-pass {
  background: var(--success-bg);
  border-color: rgba(0, 107, 42, 0.2);
  border-left: 3px solid var(--success);
  color: var(--success);
}
/* AI-3 矛盾 → 方向 → 原理 嵌套结构 */
.layer2-block.is-contradiction {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.04), rgba(139, 92, 246, 0.03));
  border-color: rgba(99, 102, 241, 0.18);
  border-left: 3px solid rgba(99, 102, 241, 0.55);
}
.ai3-contradiction {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 10px;
}
.ai3-contradiction.is-tc { border-left: 3px solid #6366f1; }
.ai3-contradiction.is-pc { border-left: 3px solid #ec4899; }
.ai3-c-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px dashed var(--border);
}
.ai3-c-tag {
  background: var(--bg-elev);
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: 0.4px;
}
.ai3-contradiction.is-tc .ai3-c-tag { background: rgba(99, 102, 241, 0.12); color: #6366f1; }
.ai3-contradiction.is-pc .ai3-c-tag { background: rgba(236, 72, 153, 0.12); color: #ec4899; }
.ai3-c-id {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text);
}
.ai3-c-desc {
  color: var(--text);
  font-size: 12.5px;
  line-height: 1.45;
  flex: 1 1 100%;
}
.ai3-c-dirs {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-left: 8px;
  border-left: 2px solid var(--border);
}
.ai3-direction {
  background: var(--bg-soft);
  border-radius: var(--radius-sm);
  padding: 6px 9px;
}
.ai3-dir-head {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 4px;
}
.ai3-dir-id {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--accent-text);
  background: rgba(99, 102, 241, 0.08);
  padding: 1px 5px;
  border-radius: 3px;
}
.ai3-dir-title {
  font-size: 12px;
  color: var(--text);
  font-weight: 500;
}
.ai3-dir-principles {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
}

/* AI-4 — 现有方案探查 + 创新方案 */
.ai4-patent-list { display: flex; flex-direction: column; gap: 4px; }
.ai4-patent-ref {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
  padding: 4px 8px;
  background: var(--bg-soft);
  border-radius: var(--radius-sm);
  font-size: 11.5px;
}
.ai4-patent-meta { color: var(--text-faint); font-size: 10.5px; }
.ai4-patent-owner { color: var(--text-muted); }
.ai4-sol-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--gradient-orange);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 8px;
}
.ai4-sol-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.ai4-sol-rank {
  background: var(--accent);
  color: white;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
}
.ai4-sol-id {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--accent-text);
}
.ai4-sol-title {
  font-size: 13px;
  color: var(--text);
  font-weight: 600;
  flex: 1;
}
.ai4-sol-summary {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.55;
  margin-bottom: 4px;
}
.ai4-sol-principles {
  color: var(--text-faint);
  font-size: 11px;
}
.ai4-sol-principles code {
  background: rgba(99, 102, 241, 0.08);
  color: var(--accent-text);
  padding: 1px 5px;
  border-radius: 3px;
  margin-left: 2px;
}

/* AI-M 机理卡片 — 带 tier / 领域 / 公式 */
.aim-mech-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  margin-bottom: 6px;
}
.aim-mech-card.aim-tier-1 { border-left: 3px solid #d97706; }
.aim-mech-card.aim-tier-2 { border-left: 3px solid #6b7280; }
.aim-mech-card.aim-tier-3 { border-left: 3px solid var(--border-strong); }
.aim-mech-head {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.aim-mech-tier-icon {
  font-size: 14px !important;
  color: var(--accent);
}
.aim-mech-rank {
  background: var(--bg-soft);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  font-family: var(--ff-mono);
}
.aim-mech-id {
  font-family: var(--ff-mono);
  font-size: 10.5px;
  color: var(--accent-text);
}
.aim-mech-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
}
.aim-mech-tier-label {
  font-size: 9.5px;
  font-weight: 700;
  color: var(--text-faint);
  background: var(--bg-soft);
  padding: 1px 5px;
  border-radius: 3px;
  letter-spacing: 0.05em;
}
/* V6.7.68: evidence_tier chip — 行业共识/公开专利/AI 推测 */
.aim-etier {
  font-size: 10.5px;
  font-weight: 600;
  padding: 1.5px 7px;
  border-radius: 10px;
  white-space: nowrap;
  cursor: help;
  border: 1px solid transparent;
}
.aim-etier-consensus {
  color: rgb(22, 101, 52);
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.3);
}
.aim-etier-patent {
  color: rgb(146, 64, 14);
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.3);
}
.aim-etier-inferred {
  color: rgb(153, 27, 27);
  background: rgba(239, 68, 68, 0.10);
  border-color: rgba(239, 68, 68, 0.3);
}

/* V6.7.71: abstraction_level chip — 三层抽象架构(独立于 evidence_tier)*/
.aim-alvl {
  font-size: 10.5px;
  font-weight: 600;
  padding: 1.5px 7px;
  border-radius: 10px;
  white-space: nowrap;
  cursor: help;
  border: 1px solid transparent;
}
.aim-alvl-industry_mechanism {
  /* 🟨 黄 — 行业机理(行业内多源沉淀)*/
  color: rgb(146, 64, 14);
  background: rgba(234, 179, 8, 0.15);
  border-color: rgba(234, 179, 8, 0.4);
}
.aim-alvl-design_specific {
  /* 🟧 橙 — 设计经验(单专利)*/
  color: rgb(154, 52, 18);
  background: rgba(249, 115, 22, 0.15);
  border-color: rgba(249, 115, 22, 0.4);
}
.aim-alvl-heuristic_insight {
  /* 🟥 红 — 行业洞察(统计经验)*/
  color: rgb(153, 27, 27);
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.4);
}
.aim-mech-meta {
  display: flex;
  gap: 10px;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 3px;
}
.aim-mech-domain {
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 3px;
}
.aim-mech-stats { color: var(--text-faint); }
.aim-mech-stats strong { color: var(--text); }
.aim-mech-eq {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 3px;
  font-size: 11px;
}
.aim-mech-eq-label {
  color: var(--text-faint);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.aim-mech-eq code {
  font-family: var(--ff-mono);
  font-size: 11px;
  color: var(--text);
  background: var(--bg-soft);
  padding: 1px 6px;
  border-radius: 3px;
}

/* AI-4 现有方案 (patent landscape) 卡片 — 带标题与迁移点 */
.ai4-patent-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  margin-bottom: 6px;
}
.ai4-patent-head {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.ai4-patent-code {
  font-family: var(--ff-mono);
  font-size: 11px;
  color: var(--accent-text);
}
.ai4-patent-tag {
  background: var(--bg-soft);
  color: var(--text-muted);
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.ai4-patent-tag.is-industry {
  background: rgba(99, 102, 241, 0.08);
  color: var(--accent-text);
  text-transform: none;
  letter-spacing: 0;
}
/* V6.7.72 verdict chip */
.ai4-patent-verdict {
  font-size: 10.5px;
  font-weight: 600;
  padding: 1.5px 7px;
  border-radius: 10px;
  white-space: nowrap;
  cursor: help;
  border: 1px solid transparent;
}
.ai4-patent-verdict.is-exists {
  color: rgb(22, 101, 52);
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.35);
}
.ai4-patent-verdict.is-notfound {
  color: rgb(154, 52, 18);
  background: rgba(249, 115, 22, 0.15);
  border-color: rgba(249, 115, 22, 0.4);
}
.ai4-patent-verdict.is-inferred {
  color: rgb(153, 27, 27);
  background: rgba(239, 68, 68, 0.10);
  border-color: rgba(239, 68, 68, 0.35);
}
.ai4-patent-verdict.is-timeout {
  color: rgb(120, 113, 108);
  background: rgba(168, 162, 158, 0.12);
  border-color: rgba(168, 162, 158, 0.35);
}
.ai4-patent-verify-link {
  font-size: 10.5px;
  color: rgb(67, 56, 202);
  text-decoration: none;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(99, 102, 241, 0.08);
  margin-left: auto;
}
.ai4-patent-verify-link:hover {
  background: rgba(99, 102, 241, 0.18);
  text-decoration: underline;
}
.ai4-patent-owner {
  color: var(--text-muted);
  font-size: 11px;
}
.ai4-patent-title {
  font-size: 12px;
  color: var(--text);
  font-weight: 500;
  line-height: 1.5;
  margin: 2px 0 4px;
}
.ai4-patent-migration {
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--text-muted);
  background: var(--bg-soft);
  padding: 5px 8px;
  border-radius: 3px;
  border-left: 2px solid var(--accent-soft);
}
.ai4-patent-migration strong { color: var(--text); font-weight: 600; }

/* AI-4 创新方案补充 */
.ai4-sol-summary.is-empty { color: var(--text-faint); font-style: italic; }
.ai4-sol-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 4px;
}
.ai4-sol-painpoints { color: var(--text-muted); }

/* AI-1 overview stats — 与 AI-0 一致风格 */
.ai1-overview-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 6px;
  margin-bottom: 10px;
}
.ai1-overview-stat {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}
.ai1-overview-icon {
  font-size: 16px !important;
  color: var(--accent);
}
.ai1-overview-stat strong {
  font-family: var(--ff-serif);
  font-size: 18px;
  font-weight: 500;
  color: var(--text);
}
.ai1-overview-stat span {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* AI-0 已有信息总结 — 让人一眼看到 AI 收集到了什么 */
.layer2-block.is-known {
  background: linear-gradient(135deg, rgba(34, 139, 84, 0.04), rgba(193, 95, 60, 0.02));
  border-color: rgba(34, 139, 84, 0.18);
  border-left: 3px solid var(--success);
}
.ai0-known-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}
.ai0-known-stat {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.ai0-known-stat-icon {
  font-size: 18px !important;
  color: var(--accent);
  margin-bottom: 2px;
}
.ai0-known-stat strong {
  font-family: var(--ff-serif);
  font-size: 22px;
  font-weight: 500;
  line-height: 1.1;
  color: var(--text);
}
.ai0-known-stat span {
  font-size: 10.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.ai0-known-row {
  display: flex;
  gap: 8px;
  padding: 6px 0;
  border-top: 1px dashed var(--border);
  font-size: 12px;
  line-height: 1.55;
}
.ai0-known-row:first-child { border-top: none; }
.ai0-known-row-label {
  flex: 0 0 110px;
  color: var(--text-faint);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  padding-top: 1px;
}
.ai0-known-row-val {
  flex: 1;
  color: var(--text);
}
.ai0-known-objectives {
  padding: 8px 0;
  border-top: 1px dashed var(--border);
}
.ai0-known-obj {
  font-size: 12px;
  line-height: 1.55;
  padding: 3px 0;
  color: var(--text);
}
.ai0-known-obj-type {
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
  margin: 0 4px;
}

/* AI-5 评估逻辑块 — 让用户看见打分方法 */
.layer2-block.is-methodology {
  background: linear-gradient(135deg, rgba(193, 95, 60, 0.05), rgba(245, 158, 11, 0.03));
  border-color: rgba(193, 95, 60, 0.18);
  border-left: 3px solid var(--accent);
}
.ai5-overview {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}
.ai5-overview-stat {
  flex: 1;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  text-align: center;
}
.ai5-overview-stat strong {
  display: block;
  font-family: var(--ff-serif);
  font-size: 22px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.1;
  margin-bottom: 2px;
}
.ai5-overview-stat span {
  font-size: 10.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.ai5-overview-stat.is-pass {
  background: var(--success-bg);
  border-color: rgba(0, 107, 42, 0.18);
}
.ai5-overview-stat.is-pass strong { color: var(--success); }
.ai5-overview-stat.is-fail strong { color: var(--text-faint); }
.ai5-methodology {
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-muted);
  font-style: italic;
  padding: 6px 10px;
  border-left: 2px solid var(--accent-soft);
  background: var(--bg-soft);
  margin-bottom: 10px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.ai5-dim-bar-label {
  font-size: 11px;
  color: var(--text-faint);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}
.ai5-dim-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.ai5-dim-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px 8px 3px 4px;
  font-size: 11px;
  color: var(--text);
  font-weight: 500;
}
.ai5-dim-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px; height: 16px;
  background: var(--accent);
  color: white;
  font-size: 9.5px;
  font-weight: 700;
  border-radius: 50%;
  font-family: var(--ff-mono);
}

/* AI-5 排序卡片 + dim mini bar */
.ai5-sol-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 11px;
  margin-bottom: 6px;
}
.ai5-sol-card.is-top {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.04), transparent 40%);
  border-color: rgba(245, 158, 11, 0.25);
}
.ai5-sol-card.is-pass { border-left: 3px solid var(--success); }
.ai5-sol-card.is-pass.is-top { border-left: 3px solid #f59e0b; }
.ai5-sol-warn-pill {
  background: var(--warn-bg);
  color: var(--warn);
  font-size: 10px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 3px;
}
.ai5-sol-badge.is-fail {
  background: var(--text-faint);
  color: white;
}
.ai5-dim-mini {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 12px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--border);
}
.ai5-dim-mini-row {
  display: grid;
  grid-template-columns: 70px 1fr 32px;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
}
.ai5-dim-mini-name {
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ai5-dim-mini-bar {
  height: 5px;
  background: var(--bg-soft);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}
.ai5-dim-mini-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-text));
  border-radius: 3px;
}
.ai5-dim-mini-val {
  font-family: var(--ff-mono);
  font-size: 10px;
  color: var(--text-faint);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.ai5-sol-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.ai5-sol-rank {
  background: var(--bg-elev);
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
}
.ai5-sol-id {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent-text);
}
.ai5-sol-title {
  font-size: 12.5px;
  color: var(--text);
  flex: 1;
}
.ai5-sol-score {
  font-weight: 700;
  color: var(--text);
}
.ai5-sol-badge {
  background: var(--success);
  color: white;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 3px;
}
.ai5-sol-summary {
  color: var(--text-muted);
  font-size: 11.5px;
  line-height: 1.5;
  margin-top: 4px;
}
.ai5-sol-dims {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 4px;
}

/* AI-7 — 全部复合方案 */
.ai7-csol-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 8px;
}
.ai7-csol-card.is-top {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.05), rgba(249, 115, 22, 0.04));
  border-color: rgba(245, 158, 11, 0.3);
  border-left: 3px solid #f59e0b;
}
.ai7-csol-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.ai7-csol-rank {
  background: #f59e0b;
  color: white;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
}
.ai7-csol-id {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--accent-text);
}
.ai7-csol-title {
  font-size: 13px;
  color: var(--text);
  font-weight: 600;
  flex: 1;
}
.ai7-csol-score {
  font-weight: 500;
  font-size: 11px;
  color: var(--text-faint);
  padding: 2px 6px;
  background: var(--bg-soft);
  border-radius: 4px;
  border: 1px dashed var(--border);
}
/* V6.7.60: 5 维决策评分 mini-table */
.ai7-csol-dims {
  margin: 8px 0 10px;
  padding: 8px 10px;
  background: linear-gradient(to right, rgba(99,102,241,0.04), rgba(99,102,241,0.01));
  border-left: 3px solid rgba(99,102,241,0.5);
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ai7-dim-row {
  display: grid;
  grid-template-columns: 130px 88px 1fr;
  gap: 10px;
  align-items: center;
  font-size: 12px;
  line-height: 1.5;
}
.ai7-dim-label {
  color: var(--text);
  font-weight: 500;
}
.ai7-dim-stars {
  color: #f59e0b;
  letter-spacing: 1px;
  font-size: 13px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}
.ai7-dim-stars[data-score="0"],
.ai7-dim-stars[data-score="1"] { color: #ef4444; }
.ai7-dim-stars[data-score="2"] { color: #f59e0b; }
.ai7-dim-stars[data-score="3"] { color: #eab308; }
.ai7-dim-stars[data-score="4"],
.ai7-dim-stars[data-score="5"] { color: #16a34a; }
.ai7-dim-comment {
  color: var(--text-muted);
  font-size: 11.5px;
}
/* V6.7.60: 顶层推荐表 */
.ai7-rec-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ai7-rec-hint {
  font-size: 11.5px;
  color: var(--text-faint);
  font-style: italic;
  margin-bottom: 4px;
  padding-bottom: 6px;
  border-bottom: 1px dashed var(--border);
}
.ai7-rec-row {
  display: grid;
  grid-template-columns: 230px 18px 90px 1fr;
  gap: 8px;
  align-items: baseline;
  font-size: 12.5px;
  line-height: 1.5;
  padding: 4px 0;
}
.ai7-rec-priority {
  color: var(--text);
  font-weight: 500;
}
.ai7-rec-arrow {
  color: var(--text-faint);
  text-align: center;
}
.ai7-rec-pick {
  color: #4f46e5;
  font-weight: 700;
  background: rgba(99,102,241,0.08);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11.5px;
  text-align: center;
}
.ai7-rec-why {
  color: var(--text-muted);
  font-size: 11.5px;
}
.ai7-csol-subs {
  color: var(--text-faint);
  font-size: 11.5px;
  margin-bottom: 4px;
}
.ai7-csol-summary,
.ai7-csol-synergy,
.ai7-csol-novelty {
  color: var(--text-muted);
  font-size: 11.5px;
  line-height: 1.55;
  margin-top: 4px;
}
.ai7-csol-synergy strong,
.ai7-csol-novelty strong { color: var(--text); }

.layer2-pills { display: inline-flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.layer2-pill {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px 8px;
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
}
.layer2-pill code {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  color: var(--text) !important;
  font-weight: 600;
}
.layer2-pill.is-crit {
  background: var(--danger-bg);
  border-color: rgba(186, 26, 26, 0.3);
  color: var(--danger);
}
.layer2-pill.is-crit code { color: var(--danger) !important; }

.layer2-link {
  display: flex; align-items: center; gap: 6px;
  font-size: 11.5px;
  color: var(--text-faint);
  margin-top: 10px;
  padding: 6px 4px;
  border-top: 1px dashed var(--border);
}
.layer2-link .material-symbols-outlined {
  font-size: 14px;
  color: var(--text-faint);
}

/* ═══════════════════════════════════════════════════════════
 * Layer 3 — 完整 markdown 折叠 (details/summary)
 * ═══════════════════════════════════════════════════════════*/
.stage-fulldetail {
  margin-top: 8px;
  border-top: 1px solid var(--border-soft);
  padding-top: 12px;
}
.stage-fulldetail-trigger {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  list-style: none;
  padding: 8px 12px;
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  user-select: none;
  font-weight: 500;
}
.stage-fulldetail-trigger::-webkit-details-marker { display: none; }
.stage-fulldetail-trigger:hover {
  background: var(--bg-container);
  color: var(--text);
}
.stage-fulldetail[open] .stage-fulldetail-trigger {
  margin-bottom: 14px;
}
.stage-fulldetail[open] .stage-fulldetail-trigger .material-symbols-outlined::before {
  content: 'unfold_less';
}
.stage-fulldetail-trigger .material-symbols-outlined {
  font-size: 16px;
  color: var(--text-faint);
}

/* 审计 stage 视觉降级 — 提示这是"次要内容" */
.stage-card.is-audit-stage {
  opacity: 0.92;
}
.stage-card.is-audit-stage:hover { opacity: 1; }
.stage-card.is-audit-stage .stage-icon {
  background: var(--bg-container);
  color: var(--text-muted);
}

/* ═══ V6.7.36 12 块约束 — 范围边界双列 + 高级约束折叠 ═══ */
.scope-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.scope-sub-label {
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-faint);
  text-transform: uppercase;
  margin-bottom: 4px;
}
@media (max-width: 700px) {
  .scope-grid { grid-template-columns: 1fr; }
}

.advanced-constraints {
  margin-top: 16px;
  border-top: 1px dashed var(--border);
  padding-top: 14px;
}
.advanced-constraints-trigger {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer;
  user-select: none;
  list-style: none;
  padding: 10px 14px;
  background: var(--bg-soft);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  font-size: 12.5px;
  color: var(--text-muted);
  font-weight: 500;
  transition: all var(--transition);
}
.advanced-constraints-trigger::-webkit-details-marker { display: none; }
.advanced-constraints-trigger:hover {
  background: var(--bg-container);
  color: var(--text);
  border-color: var(--border-strong);
}
.advanced-constraints[open] .advanced-constraints-trigger {
  margin-bottom: 14px;
  background: var(--bg-container);
}
.advanced-constraints[open] .advanced-constraints-trigger .material-symbols-outlined::before {
  content: 'unfold_less';
}
.advanced-constraints-trigger .material-symbols-outlined {
  font-size: 16px;
  color: var(--text-faint);
}

/* AI-0 信息完整度条 */
.layer2-block.is-completeness {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.04), rgba(168, 85, 247, 0.03));
  border-color: rgba(99, 102, 241, 0.2);
  border-left: 3px solid #6366f1;
}
.ai0-completeness-bar {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.ai0-completeness-track {
  height: 8px;
  background: var(--bg-container);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 6px;
}
.ai0-completeness-fill {
  height: 100%;
  background: var(--success);
  border-radius: 4px;
  transition: width 0.6s ease;
}
.ai0-completeness-bar.is-low .ai0-completeness-fill { background: var(--danger); }
.ai0-completeness-bar.is-mid .ai0-completeness-fill { background: var(--warn); }
.ai0-completeness-bar.is-good .ai0-completeness-fill { background: var(--success); }
.ai0-completeness-meta {
  font-size: 11.5px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.ai0-completeness-meta strong { color: var(--text); }

/* AI-M cold-start banner — inline 提示库空 */
.cold-start-banner {
  display: flex; gap: 12px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.06), rgba(168, 85, 247, 0.04));
  border: 1px solid rgba(245, 158, 11, 0.30);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--text);
}
.cold-start-banner .material-symbols-outlined {
  color: #b45309;
  font-size: 20px;
  flex-shrink: 0;
  margin-top: 1px;
}
.cold-start-banner code {
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 11.5px;
  font-family: var(--ff-mono);
}
.badge-running {
  background: var(--info-bg); color: var(--info-text);
  gap: 4px;
}
.badge-orphaned {
  background: var(--warn-bg); color: var(--warn);
  border: 1px solid var(--warn);
}
.badge-unknown { background: var(--bg-soft); color: var(--text-muted); }

/* 脉冲圆点 — 运行中徽章里那个一闪一闪的小球 */
.pulse-dot {
  display: inline-block; width: 6px; height: 6px;
  border-radius: 50%; background: currentColor;
  box-shadow: 0 0 0 0 currentColor;
  animation: pulse-dot 1.6s ease-out infinite;
}
@keyframes pulse-dot {
  0%   { box-shadow: 0 0 0 0 rgba(0, 95, 204, 0.6); }
  70%  { box-shadow: 0 0 0 6px rgba(0, 95, 204, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 95, 204, 0); }
}

/* 运行中的 run-card 整体高亮 (蓝色左边框) */
.run-card.is-running {
  border-left: 3px solid var(--info-text);
  background: linear-gradient(90deg, rgba(0, 95, 204, 0.03), transparent 40%);
}

/* 实时耗时数字用等宽字体, 避免数字跳动时格子大小变 */
.live-elapsed {
  font-family: var(--ff-mono, ui-monospace, SFMono-Regular, monospace);
  color: var(--info-text);
  font-weight: 600;
}

/* ═══ 架构流程图 (Arch modal) ═══ */
.arch-flow {
  display: flex; flex-direction: column;
  gap: 4px;
}
.arch-stage {
  display: flex; gap: 14px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  transition: all var(--transition);
  position: relative;
}
.arch-stage:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}
.arch-stage.is-core::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
}
.arch-stage.is-core[data-color="purple"]::before { background: var(--core-purple); }
.arch-stage.is-core[data-color="pink"]::before   { background: var(--core-pink); }
.arch-stage.is-core[data-color="orange"]::before { background: var(--core-orange); }
.arch-stage.is-core[data-color="cyan"]::before   { background: var(--core-cyan); }
.arch-stage-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: var(--text-muted);
}
.arch-stage-icon .material-symbols-outlined { font-size: 20px; }
.arch-stage.is-core[data-color="purple"] .arch-stage-icon { background: var(--core-purple-soft); border-color: rgba(168, 85, 247, 0.3); color: var(--core-purple); }
.arch-stage.is-core[data-color="pink"]   .arch-stage-icon { background: var(--core-pink-soft);   border-color: rgba(236, 72, 153, 0.3); color: var(--core-pink); }
.arch-stage.is-core[data-color="orange"] .arch-stage-icon { background: var(--core-orange-soft); border-color: rgba(249, 115, 22, 0.3); color: var(--core-orange); }
.arch-stage.is-core[data-color="cyan"]   .arch-stage-icon { background: var(--core-cyan-soft);   border-color: rgba(6, 182, 212, 0.3); color: var(--core-cyan); }
.arch-stage-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px;
  background: var(--bg-container);
  color: var(--text-muted);
  border-radius: var(--radius-xs);
  font-family: var(--ff-mono);
  font-size: 11px; font-weight: 700;
  margin-right: 6px;
}
.arch-stage-body {
  flex: 1; min-width: 0;
}
.arch-stage-name {
  display: flex; align-items: center;
  font-size: 14.5px; font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}
.arch-stage-role {
  font-size: 12.5px; color: var(--text-muted);
  margin-bottom: 8px; line-height: 1.6;
}
.arch-stage-io {
  font-size: 11.5px; color: var(--text-muted);
  background: var(--bg-soft);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  line-height: 1.7;
  margin-bottom: 6px;
}
.arch-stage-io > div { margin-bottom: 2px; }
.arch-stage-io > div:last-child { margin-bottom: 0; }
.arch-io-label {
  display: inline-block;
  font-size: 9.5px; font-weight: 700;
  background: var(--bg-container); color: var(--text-muted);
  padding: 1px 6px; border-radius: 3px;
  margin-right: 6px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-family: var(--ff-mono);
}
.arch-stage-note {
  font-size: 11.5px; color: var(--text-faint);
  line-height: 1.6;
  display: flex; align-items: flex-start; gap: 4px;
}
.arch-arrow {
  display: flex; justify-content: center;
  color: var(--text-faint);
  padding: 2px 0;
  font-variation-settings: 'wght' 300;
}
.arch-arrow .material-symbols-outlined { font-size: 16px; }

/* ═══ 使用指南 (Howto modal) ═══ */
.howto-step {
  display: flex; gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.howto-step:last-child { border-bottom: none; }
.howto-step-num {
  flex-shrink: 0;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-text);
  font-weight: 700; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}
.howto-step-body { flex: 1; }
.howto-step-title {
  font-size: 14px; font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.howto-step-text {
  font-size: 12.5px; color: var(--text-muted);
  line-height: 1.7;
}
.howto-step-text code {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 11.5px;
  color: var(--accent-text);
}

/* ═══ Live RUN view (主区域显示正在跑的 job) ═══ */
.live-run-view { padding: 0; }

.live-run-hero {
  background: linear-gradient(135deg, rgba(0, 95, 204, 0.05), transparent 70%);
  border: 1px solid var(--border);
  border-left: 4px solid var(--info-text);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin-bottom: 18px;
}
.live-run-status {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 10px;
}
.live-run-status-label {
  font-size: 13px; font-weight: 600;
  color: var(--info-text);
}
.live-run-elapsed {
  font-size: 12.5px;
  color: var(--text-muted);
  font-family: var(--ff-mono);
}
.live-run-status .btn-stop { margin-left: auto; }
.live-run-query {
  font-size: 22px; font-weight: 600;
  color: var(--text); margin: 4px 0 10px;
  line-height: 1.4;
}
.live-run-meta {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--text-muted);
  flex-wrap: wrap;
}
.live-run-meta code {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  padding: 1px 5px; border-radius: 3px;
  font-size: 11.5px;
}
.live-run-meta .dot {
  width: 3px; height: 3px;
  background: var(--text-faint);
  border-radius: 50%;
  display: inline-block;
}

.live-run-section {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 14px;
}
.live-run-section-title {
  font-size: 12.5px; font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 10px;
}

/* 9 阶段 chips */
.live-stages {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 6px;
}
.live-stage-chip {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-size: 11.5px;
  transition: all var(--transition);
}
.live-stage-chip.done {
  background: rgba(34, 139, 84, 0.08);
  border-color: rgba(34, 139, 84, 0.3);
  color: var(--success);
}
.live-stage-chip.current {
  background: rgba(0, 95, 204, 0.08);
  border-color: var(--info-text);
  color: var(--info-text);
  font-weight: 600;
  box-shadow: 0 0 0 3px rgba(0, 95, 204, 0.08);
  animation: live-stage-pulse 2s ease-in-out infinite;
}
.live-stage-chip.pending {
  color: var(--text-faint);
  opacity: 0.6;
}
@keyframes live-stage-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(0, 95, 204, 0.08); }
  50%      { box-shadow: 0 0 0 5px rgba(0, 95, 204, 0.15); }
}
.live-stage-icon { font-size: 14px !important; flex-shrink: 0; }
.live-stage-chip .live-stage-icon.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 500, 'GRAD' 0, 'opsz' 20;
}
.live-stage-chip.current .live-stage-icon {
  animation: spin 1.6s linear infinite;
}
@keyframes spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }
.live-stage-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
  flex: 1;
}
.live-stage-num {
  font-family: var(--ff-mono);
  font-size: 10px;
  font-weight: 700;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  padding: 0 4px;
  border-radius: 3px;
  min-width: 14px;
  text-align: center;
  color: var(--text-faint);
  flex-shrink: 0;
}
.live-stage-chip.done .live-stage-num {
  background: rgba(0, 107, 42, 0.10);
  border-color: rgba(0, 107, 42, 0.22);
  color: var(--success);
}
.live-stage-chip.current .live-stage-num {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.live-stage-rhythm {
  font-size: 12px !important;
  opacity: 0.55;
  flex-shrink: 0;
}
.live-stage-chip.rhythm-diverge .live-stage-rhythm { color: var(--gradient-purple); }
.live-stage-chip.rhythm-converge .live-stage-rhythm { color: var(--accent); }
.live-stage-chip.rhythm-both .live-stage-rhythm { color: var(--core-cyan); }
/* current 用 accent — 不要冷蓝 */
.live-stage-chip.current {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-text);
}
@keyframes live-stage-pulse-warm {
  0%, 100% { box-shadow: 0 0 0 3px rgba(193, 95, 60, 0.08); }
  50%      { box-shadow: 0 0 0 5px rgba(193, 95, 60, 0.16); }
}
.live-stage-chip.current { animation: live-stage-pulse-warm 2s ease-in-out infinite; }
/* 核心阶段标记 (右上小渐变点) */
.live-stage-chip.is-core::after {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}
/* 给 chip 一点最小宽度 — 防短名挤一团 */
.run-progress .live-stage-chip { min-width: 130px; }

/* 实时日志 */
.live-run-log {
  background: #1a1d23; color: #d6d8de;
  font-family: var(--ff-mono);
  font-size: 11.5px;
  line-height: 1.6;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  max-height: 320px;
  overflow-y: auto;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-all;
}

/* job-toast 上的"终止"按钮 */
.btn-stop {
  background: #fff;
  border: 1px solid #e3b5b5;
  color: #c4322f;
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 5px;
  cursor: pointer;
  font-weight: 600;
  transition: all var(--transition);
}
.btn-stop:hover {
  background: #fff0f0;
  border-color: #c4322f;
}
.btn-stop:active { transform: scale(0.97); }

/* ═══ Main Area ═══ */
.main-area {
  overflow-y: auto;
  padding: 0;
  position: relative;
}

.empty-state {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  height: 100%;
  padding: 0 48px;
  text-align: center;
  color: var(--text-muted);
  animation: fadeIn 300ms ease;
}
.empty-mark {
  width: 72px; height: 72px;
  border-radius: var(--radius-lg);
  background: var(--gradient);
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; color: #fff;
  margin-bottom: 28px;
  box-shadow: 0 12px 32px rgba(236, 72, 153, 0.28);
  animation: floatY 3s ease-in-out infinite;
}
.empty-mark .material-symbols-outlined {
  font-size: 36px; color: #fff;
  font-variation-settings: 'FILL' 0, 'wght' 500;
}
@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.empty-state h1 {
  font-size: 28px; font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  letter-spacing: -0.02em;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.empty-state .empty-subtitle {
  font-size: 12px; font-weight: 600;
  color: var(--text-faint);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 18px;
}
.empty-state p { font-size: 14px; max-width: 480px; line-height: 1.65; color: var(--text-muted); }
.empty-state .empty-cta {
  margin-top: 24px;
  display: flex; gap: 8px;
  align-items: center;
}

/* ═══ RUN Detail ═══ */
.run-detail { padding: 28px 40px 80px; max-width: 1100px; margin: 0 auto; animation: fadeIn 240ms ease; }

/* ═══ RUN 详情 with 右侧 TOC (2 列布局) ═══ */
.run-detail-with-toc {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 32px;
  max-width: 1320px;
  align-items: start;
}
.run-detail-main { min-width: 0; }

/* 右侧吸顶 TOC */
.run-toc {
  position: sticky;
  top: 24px;
  align-self: start;
  padding: 14px 12px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}
.run-toc-title {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 4px 10px 10px;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 6px;
}
.run-toc-list {
  list-style: none;
  margin: 0; padding: 0;
}
.run-toc-list li { margin: 0; }
.run-toc-extra { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border-soft); }

.run-toc-link {
  display: flex; align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 120ms ease;
  text-decoration: none;
  position: relative;
}
.run-toc-link:hover {
  background: var(--bg-soft);
  color: var(--text);
  text-decoration: none;
}
.run-toc-link.active {
  background: var(--accent-soft);
  color: var(--accent-text);
  font-weight: 600;
}
.run-toc-link.active::before {
  content: '';
  position: absolute;
  left: 0; top: 6px; bottom: 6px;
  width: 2px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}
.run-toc-link.is-empty {
  opacity: 0.5;
}
.run-toc-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px;
  background: var(--bg-container);
  color: var(--text-muted);
  border-radius: var(--radius-xs);
  font-family: var(--ff-mono);
  font-size: 10px; font-weight: 700;
  flex-shrink: 0;
}
.run-toc-link.active .run-toc-num {
  background: var(--accent);
  color: #fff;
}
.run-toc-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--gradient);
  flex-shrink: 0;
}
.run-toc-dot-spacer {
  width: 6px; flex-shrink: 0;
}
.run-toc-name {
  flex: 1; min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.run-toc-empty {
  font-size: 12px !important;
  color: var(--text-faint);
  flex-shrink: 0;
}

/* 窄屏: TOC 隐藏, 单列 */
@media (max-width: 1100px) {
  .run-detail-with-toc {
    grid-template-columns: 1fr;
  }
  .run-toc { display: none; }
}

.run-hero {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  animation: heroEnter 320ms cubic-bezier(0.16, 1, 0.3, 1) backwards;
}
@keyframes heroEnter {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.run-hero::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--gradient);
}
.run-hero-top {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 12px;
}
.run-id-chip {
  font-family: var(--ff-mono);
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-soft);
  padding: 4px 10px;
  border-radius: 5px;
  letter-spacing: 0.2px;
}
.run-status-badge {
  padding: 3px 9px;
  border-radius: 5px;
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.3px;
}
.run-query {
  font-size: 16px; font-weight: 500;
  color: var(--text);
  line-height: 1.55;
  margin-bottom: 14px;
}
.run-meta {
  display: flex; gap: 12px; align-items: center;
  font-size: 12px;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.run-meta a {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--link); font-weight: 500;
}

/* ═══ Stage Cards ═══ */
.stages-grid {
  display: flex; flex-direction: column;
  gap: 12px;
}

.stage-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color var(--transition), box-shadow var(--transition);
  position: relative;
  /* Stagger 入场动画 — 由 nth-child 控制 delay */
  animation: stageEnter 360ms cubic-bezier(0.16, 1, 0.3, 1) backwards;
}
.stage-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }

/* 9 阶段 stagger: 60ms 间隔 */
.stages-grid .stage-card:nth-child(1) { animation-delay:  20ms; }
.stages-grid .stage-card:nth-child(2) { animation-delay:  80ms; }
.stages-grid .stage-card:nth-child(3) { animation-delay: 140ms; }
.stages-grid .stage-card:nth-child(4) { animation-delay: 200ms; }
.stages-grid .stage-card:nth-child(5) { animation-delay: 260ms; }
.stages-grid .stage-card:nth-child(6) { animation-delay: 320ms; }
.stages-grid .stage-card:nth-child(7) { animation-delay: 380ms; }
.stages-grid .stage-card:nth-child(8) { animation-delay: 440ms; }
.stages-grid .stage-card:nth-child(9) { animation-delay: 500ms; }
@keyframes stageEnter {
  from {
    opacity: 0;
    transform: translateY(12px);
    filter: blur(2px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}
/* 用户偏好减少动画时 → 禁用 */
@media (prefers-reduced-motion: reduce) {
  .stage-card { animation: none; }
}

/* ─── 核心阶段:左侧 4px 渐变条 + 微微着色 + ★ 徽章 ─── */
.stage-card.is-core {
  border-color: transparent;
  box-shadow: var(--shadow);
}
.stage-card.is-core::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  z-index: 1;
}
.stage-card.is-core[data-color="purple"]::before  { background: var(--core-purple); }
.stage-card.is-core[data-color="purple"]          { background: linear-gradient(90deg, var(--core-purple-soft) 0%, var(--bg-elev) 18%); }
.stage-card.is-core[data-color="pink"]::before    { background: var(--core-pink); }
.stage-card.is-core[data-color="pink"]            { background: linear-gradient(90deg, var(--core-pink-soft) 0%, var(--bg-elev) 18%); }
.stage-card.is-core[data-color="orange"]::before  { background: var(--core-orange); }
.stage-card.is-core[data-color="orange"]          { background: linear-gradient(90deg, var(--core-orange-soft) 0%, var(--bg-elev) 18%); }
.stage-card.is-core[data-color="cyan"]::before    { background: var(--core-cyan); }
.stage-card.is-core[data-color="cyan"]            { background: linear-gradient(90deg, var(--core-cyan-soft) 0%, var(--bg-elev) 18%); }
.stage-card.is-core[data-color="emerald"]::before { background: var(--core-emerald); }
.stage-card.is-core[data-color="emerald"]         { background: linear-gradient(90deg, var(--core-emerald-soft) 0%, var(--bg-elev) 18%); }

.stage-card-header {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 22px 16px 24px;
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid var(--border-soft);
  transition: background var(--transition);
}
.stage-card.collapsed .stage-card-header { border-bottom: none; }
.stage-card-header:hover { background: rgba(0, 0, 0, 0.015); }
.stage-card-header:focus-visible {
  outline: none;
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 2px var(--accent);
}
[data-theme="dark"] .stage-card-header:hover { background: rgba(255, 255, 255, 0.025); }
.run-card:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ─── Lucide SVG 默认样式 — 1.5px stroke, 跟随 currentColor ─── */
i[data-lucide],
[data-lucide] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1em;
  height: 1em;
  font-size: inherit;
  flex-shrink: 0;
  vertical-align: middle;
}
i[data-lucide] svg,
[data-lucide] svg {
  width: 100%;
  height: 100%;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

/* ─── Stage 卡片头图标 — 高级感升级 (Material Rounded + 渐变 + 阴影) ─── */
.stage-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background:
    linear-gradient(135deg, var(--bg-elev) 0%, var(--bg-soft) 100%);
  border: 1px solid var(--border);
  color: var(--text-muted);
  position: relative;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.6),
    0 1px 2px rgba(0, 0, 0, 0.04);
  transition: transform var(--transition), box-shadow var(--transition);
}
.stage-icon::after {
  /* 微妙顶部高光 — 让 icon 有立体感 */
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.25) 0%, transparent 50%);
  pointer-events: none;
}
.stage-card:hover .stage-icon {
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    0 4px 10px rgba(0, 0, 0, 0.08);
}
/* 默认 icon — Rounded 变体 (比 Outlined 更友好,Anthropic-like) */
.stage-icon .material-symbols-outlined,
.stage-icon .material-symbols-rounded {
  font-family: 'Material Symbols Rounded';
  font-size: 22px;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  position: relative;
  z-index: 1;
}
/* Lucide SVG 在 stage-icon 里的尺寸 */
.stage-icon i[data-lucide] {
  font-size: 22px;
  position: relative;
  z-index: 1;
}
.stage-icon i[data-lucide] svg {
  stroke-width: 1.5;
}
/* 核心 stage 的 Lucide — 稍粗一点 */
.stage-card.is-core .stage-icon i[data-lucide] svg {
  stroke-width: 1.85;
}
/* 核心阶段:实色 tint 渐变 + 填充 icon + 彩色阴影 */
.stage-card.is-core[data-color="purple"] .stage-icon {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.18), rgba(168, 85, 247, 0.06));
  border-color: rgba(168, 85, 247, 0.32);
  color: var(--core-purple);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 2px 8px rgba(168, 85, 247, 0.14);
}
.stage-card.is-core[data-color="pink"] .stage-icon {
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.18), rgba(236, 72, 153, 0.06));
  border-color: rgba(236, 72, 153, 0.32);
  color: var(--core-pink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 2px 8px rgba(236, 72, 153, 0.14);
}
.stage-card.is-core[data-color="orange"] .stage-icon {
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.18), rgba(249, 115, 22, 0.06));
  border-color: rgba(249, 115, 22, 0.32);
  color: var(--core-orange);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 2px 8px rgba(249, 115, 22, 0.14);
}
.stage-card.is-core[data-color="cyan"] .stage-icon {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.18), rgba(6, 182, 212, 0.06));
  border-color: rgba(6, 182, 212, 0.32);
  color: var(--core-cyan);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 2px 8px rgba(6, 182, 212, 0.14);
}
.stage-card.is-core[data-color="emerald"] .stage-icon {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.18), rgba(16, 185, 129, 0.06));
  border-color: rgba(16, 185, 129, 0.32);
  color: var(--core-emerald);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 2px 8px rgba(16, 185, 129, 0.14);
}
/* 核心阶段 icon FILL 1 + wght 500 → 实心更醒目 */
.stage-card.is-core .stage-icon .material-symbols-outlined,
.stage-card.is-core .stage-icon .material-symbols-rounded {
  font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24;
}

.stage-info { flex: 1; min-width: 0; }
.stage-title {
  font-weight: 600; font-size: 14.5px;
  letter-spacing: -0.01em;
  color: var(--text);
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap;
}
.stage-title-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
  background: var(--bg-container);
  color: var(--text-muted);
  border-radius: var(--radius-xs);
  font-family: var(--ff-mono);
  font-size: 11.5px; font-weight: 700;
}
.stage-card.is-core .stage-title-num {
  background: rgba(0, 0, 0, 0.06);
  color: var(--text);
}
.stage-title-text { font-weight: 600; }

/* ★ 核心徽章 (旧, 已废) */
.core-badge { display: none; }

/* 核心标识 — 克制版: 6px 渐变圆点 + 小字 */
.core-mark {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}
.core-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--gradient);
  box-shadow: 0 0 0 2px rgba(236, 72, 153, 0.08);
  flex-shrink: 0;
}
.core-text {
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.stage-subtitle-note {
  color: var(--text-faint);
  font-size: 11.5px;
  font-style: normal;
  margin-left: 4px;
}

/* Inline highlights — 自动提取的重点条 (折叠状态下可见, 展开时淡化) */
.stage-highlights {
  margin-top: 10px;
  display: flex; flex-direction: column;
  gap: 4px;
}
.stage-highlight {
  display: flex; align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 5px 9px 5px 8px;
  line-height: 1.4;
  transition: all var(--transition);
}
.stage-highlight:hover {
  border-color: var(--border);
  color: var(--text);
}
.stage-highlight .material-symbols-outlined {
  font-size: 14px;
  color: var(--text-faint);
  flex-shrink: 0;
}
.stage-highlight-text {
  flex: 1; min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--ff-sans);
  font-feature-settings: 'tnum', 'cv11', 'ss01';
}
/* 各 kind 着色 */
.stage-highlight[data-kind="fatal"] .material-symbols-outlined { color: var(--danger); }
.stage-highlight[data-kind="fatal"] { background: var(--danger-bg); border-color: rgba(186, 26, 26, 0.2); color: var(--danger); }
.stage-highlight[data-kind="pass"] .material-symbols-outlined { color: var(--success); }
.stage-highlight[data-kind="pass"] { background: var(--success-bg); border-color: rgba(0, 107, 42, 0.2); color: var(--success); }
.stage-highlight[data-kind="crit"] .material-symbols-outlined { color: var(--warn); }
.stage-highlight[data-kind="csol"] .material-symbols-outlined,
.stage-highlight[data-kind="rank"] .material-symbols-outlined {
  color: var(--gradient-pink);
}
/* 展开时淡化高亮条 (避免重复信息) */
.stage-card:not(.collapsed) .stage-highlights {
  opacity: 0.5;
  max-height: 0;
  margin: 0;
  overflow: hidden;
  transition: opacity 200ms, max-height 200ms;
}

.stage-stats {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  letter-spacing: 0;
  line-height: 1.5;
}
.stage-toggle {
  color: var(--text-faint);
  transition: transform 220ms cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
}
.stage-toggle .material-symbols-outlined { font-size: 22px; }
.stage-card.collapsed .stage-toggle { transform: rotate(-90deg); }

/* 折叠用 grid-template-rows: 1fr → 0fr 实现真正的自适应高度过渡
   (代替旧的 max-height: 6000px 估值方案, 大内容也能丝滑过渡) */
.stage-content {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows 320ms cubic-bezier(0.4, 0, 0.2, 1);
}
.stage-content-inner {
  overflow: hidden;
  min-height: 0;        /* 关键: 让 grid 子项可以缩小 */
  padding: 20px 24px 24px;
  transition: padding 200ms ease, opacity 200ms ease;
}
.stage-card.collapsed .stage-content {
  grid-template-rows: 0fr;
}
.stage-card.collapsed .stage-content-inner {
  padding-top: 0;
  padding-bottom: 0;
  opacity: 0;
}

/* ═══ Markdown ═══ */
.markdown {
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--text);
}
.markdown h1, .markdown h2, .markdown h3, .markdown h4, .markdown h5 {
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.2px;
  color: var(--text);
}
.markdown h1 { font-size: 18px; margin: 20px 0 10px; }
.markdown h2 { font-size: 16px; margin: 18px 0 8px; }
.markdown h3 { font-size: 14.5px; margin: 14px 0 6px; }
.markdown h4 { font-size: 13.5px; margin: 12px 0 5px; color: var(--text-muted); }
.markdown p { margin: 8px 0; }
.markdown ul, .markdown ol { padding-left: 22px; margin: 6px 0 10px; }
.markdown li { margin-bottom: 3px; }
.markdown li > p { margin: 2px 0; }
.markdown code {
  background: var(--bg-soft);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 12px;
  font-family: var(--ff-mono);
  color: var(--accent-text);
  font-weight: 500;
  border: 1px solid var(--border-soft);
}
[data-theme="dark"] .markdown code { color: var(--gradient-orange); }
.markdown pre {
  background: #1e1e1e;
  color: #d4d4d4;
  padding: 14px 16px;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 10px 0;
  font-size: 12px;
  line-height: 1.55;
  border: 1px solid #2d2d2d;
}
.markdown pre code {
  background: transparent;
  color: inherit;
  border: none;
  padding: 0;
  font-weight: 400;
}
.markdown blockquote {
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  padding: 10px 16px;
  margin: 10px 0;
  font-size: 13px;
  color: var(--text);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.markdown blockquote p { margin: 4px 0; }
.markdown table {
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 12px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.markdown th, .markdown td {
  border: 1px solid var(--border-soft);
  padding: 7px 11px;
  text-align: left;
  vertical-align: top;
}
.markdown th {
  background: var(--bg-soft);
  font-weight: 600;
  font-size: 11.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.markdown tr:nth-child(even) td { background: rgba(0,0,0,0.012); }
.markdown hr {
  border: none;
  border-top: 1px solid var(--border-soft);
  margin: 20px 0;
}
.markdown strong { font-weight: 600; }
.markdown em { font-style: italic; color: var(--text-muted); }

/* ═══ Modal / Wizard ═══ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(20, 18, 16, 0.5);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  padding: 24px;
  animation: fadeIn 200ms ease;
}
.modal-panel {
  background: var(--bg-elev);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 720px;
  max-height: 92vh;
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  animation: slideUp 240ms cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-soft);
}
.modal-title { font-size: 15px; font-weight: 600; letter-spacing: -0.2px; }
.modal-subtitle { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

.modal-footer {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 24px;
  border-top: 1px solid var(--border-soft);
  background: var(--bg-soft);
}
.modal-footer-spacer { flex: 1; }

/* ═══ Wizard Steps ═══ */
.wizard-stepper {
  display: flex;
  padding: 12px 24px;
  gap: 4px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--bg-soft);
}
.wizard-step {
  flex: 1;
  display: flex; align-items: center; gap: 7px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}
.wizard-step.active {
  background: var(--bg-elev);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  font-weight: 500;
}
.wizard-step.done {
  color: var(--success);
}
.wizard-step-num {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 600;
}
.wizard-step.active .wizard-step-num {
  background: var(--accent); color: #fff;
  border-color: var(--accent);
}
.wizard-step.done .wizard-step-num {
  background: var(--success); color: #fff;
  border-color: var(--success);
}

.wizard-content {
  padding: 24px 28px;
  min-height: 360px;
}
.wizard-section-title {
  font-size: 16px; font-weight: 600;
  letter-spacing: -0.2px;
  margin-bottom: 4px;
}
.wizard-section-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 18px;
  line-height: 1.55;
}

.field-group { margin-bottom: 18px; }
.field-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: 0.1px;
}
.field-label .required {
  color: var(--accent); font-weight: 700;
}
.field-help {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.5;
}

.field-input, .field-textarea, .field-select {
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text);
  font-size: 13px;
  transition: all var(--transition);
}
.field-input:focus, .field-textarea:focus, .field-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field-textarea { min-height: 80px; resize: vertical; line-height: 1.6; }

/* ═══ V6.7.64 文档上传拖放区 ═══ */
.doc-drop-zone {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 18px;
  background: var(--bg-soft);
  transition: all 0.18s ease;
  cursor: pointer;
}
.doc-drop-zone[data-empty="false"] {
  border-style: solid;
  background: var(--bg-elev);
  cursor: default;
  padding: 12px;
}
.doc-drop-zone.is-dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.doc-drop-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  padding: 8px;
}
.doc-drop-zone[data-empty="false"] .doc-drop-empty { display: none; }
.doc-drop-icon {
  width: 36px; height: 36px;
  color: var(--text-faint);
}
.doc-drop-zone.is-dragover .doc-drop-icon { color: var(--accent); }
.doc-drop-hint { font-size: 13px; color: var(--text); }
.doc-drop-hint a { color: var(--accent); text-decoration: underline; }
.doc-drop-sub { font-size: 11.5px; color: var(--text-faint); max-width: 520px; line-height: 1.55; }
.doc-drop-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.doc-drop-zone[data-empty="false"] .doc-drop-list { padding-top: 4px; }
.doc-row {
  display: grid;
  grid-template-columns: 24px 1fr 24px;
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.doc-row.is-uploading {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
}
.doc-row-icon { width: 18px; height: 18px; color: var(--text-faint); margin-top: 2px; }
.doc-row-icon.spin { animation: doc-spin 1s linear infinite; }
@keyframes doc-spin { to { transform: rotate(360deg); } }
.doc-row-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.doc-row-name { font-size: 13px; font-weight: 500; color: var(--text); word-break: break-all; }
.doc-row-meta { font-size: 11px; color: var(--text-faint); }
.doc-row-err {
  color: rgb(217, 119, 6);
  margin-left: 6px;
}
.doc-row-preview {
  margin-top: 4px;
  padding: 6px 8px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-muted);
  background: var(--bg-soft);
  border-radius: 4px;
  white-space: pre-wrap;
  word-break: break-word;
  border-left: 2px solid var(--border);
}
.doc-row-del {
  width: 22px; height: 22px;
  border: none;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.doc-row-del:hover { background: var(--bg-soft); color: var(--danger); }

.field-checkbox-row {
  display: flex; gap: 10px; flex-wrap: wrap;
  margin-top: 4px;
}
.field-checkbox {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elev);
  cursor: pointer;
  font-size: 12px;
  transition: all var(--transition);
  user-select: none;
}
.field-checkbox input { accent-color: var(--accent); }
.field-checkbox.checked {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-text);
  font-weight: 500;
}

.repeater-list {
  display: flex; flex-direction: column; gap: 8px;
  margin-bottom: 6px;
}
.repeater-item {
  display: flex; gap: 6px; align-items: center;
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
}
.repeater-item input {
  flex: 1; border: none; background: transparent;
  font-size: 12.5px;
  padding: 4px 6px;
  outline: none;
}
.repeater-item .repeater-del {
  background: none; border: none;
  color: var(--text-muted);
  cursor: pointer; padding: 2px 6px;
  font-size: 14px;
}
.repeater-item .repeater-del:hover { color: var(--danger); }
.repeater-add {
  font-size: 12px; color: var(--link);
  cursor: pointer; padding: 4px 0;
  background: none; border: none;
}
.repeater-add:hover { text-decoration: underline; }

.section-toggle {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%;
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px; font-weight: 500;
  color: var(--text);
  cursor: pointer;
  margin-bottom: 8px;
  transition: all var(--transition);
}
.section-toggle:hover { background: var(--bg-hover); }
.section-toggle .toggle-arrow {
  font-size: 11px;
  color: var(--text-muted);
  transition: transform 200ms ease;
}
.section.expanded .toggle-arrow { transform: rotate(90deg); }
.section-body {
  padding: 14px 8px 4px 16px;
  display: none;
  border-left: 2px solid var(--border-soft);
  margin-left: 8px;
}
.section.expanded .section-body { display: block; }

.tag-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: 100px;
  padding: 3px 10px;
  font-size: 11.5px;
  color: var(--text);
  margin: 2px 4px 2px 0;
}
.tag-chip .tag-remove {
  cursor: pointer; color: var(--text-muted);
  font-weight: 600; line-height: 1;
}
.tag-chip .tag-remove:hover { color: var(--danger); }
.tag-input {
  display: inline-block;
  border: none; background: transparent;
  font-size: 12.5px;
  padding: 2px 4px;
  outline: none;
  min-width: 100px;
}

/* Question card (AI-0 反问) */
.question-card {
  background: var(--bg-soft);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 14px 16px;
  margin-bottom: 14px;
}
.question-id {
  font-family: var(--ff-mono);
  font-size: 10.5px;
  color: var(--accent-text);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.question-text {
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.55;
  margin-bottom: 6px;
}
.question-why {
  font-size: 11.5px;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 8px;
}
.question-input {
  width: 100%;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 13px;
  resize: vertical;
  min-height: 56px;
  transition: all var(--transition);
}
.question-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.hypothesis-card {
  background: var(--info-bg);
  border-left: 3px solid var(--info-text);
  padding: 12px 14px;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-bottom: 10px;
  font-size: 12.5px;
  line-height: 1.55;
}
.hypothesis-card-header {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  margin-bottom: 6px;
}
.hypothesis-card-label {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--info-text);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  background: rgba(0, 95, 204, 0.08);
  padding: 2px 7px;
  border-radius: 4px;
}
.hypothesis-card-direction {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 8px;
  line-height: 1.55;
}
.hyp-chip {
  display: inline-block;
  font-size: 10.5px;
  padding: 1.5px 7px;
  border-radius: 4px;
  font-weight: 500;
  letter-spacing: 0.2px;
}
.hyp-chip-layer {
  background: var(--info-bg); color: var(--info-text); border: 1px solid var(--info-text);
}
.hyp-chip-conf {
  background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn);
}
.hyp-chain {
  background: rgba(255, 255, 255, 0.6);
  border-radius: 6px;
  padding: 8px 10px 8px 12px;
  margin: 8px 0 6px;
}
.hyp-chain-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
  letter-spacing: 0.3px;
}
.hyp-chain-list {
  margin: 0; padding-left: 18px;
  font-size: 12px; line-height: 1.65;
  color: var(--text);
}
.hyp-chain-list li {
  margin-bottom: 2px;
}
.hyp-chain-list li:not(:last-child)::marker {
  color: var(--text-faint);
}
.hyp-meta {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.55;
}
.hyp-meta-label {
  font-weight: 600;
  color: var(--text);
  margin-right: 4px;
}
.hyp-pill {
  display: inline-block;
  font-size: 10.5px;
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  margin-right: 3px;
  color: var(--text-muted);
}
.question-discrim {
  font-size: 11.5px;
  color: #c8501c;
  margin-bottom: 6px;
  line-height: 1.55;
}

/* ═══ Job Progress Toast ═══ */
.job-toast {
  position: fixed; bottom: 20px; right: 20px;
  width: 420px;
  max-height: 64vh;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 900;
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: slideUpRight 320ms cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes slideUpRight {
  from { opacity: 0; transform: translate(20px, 20px); }
  to { opacity: 1; transform: translate(0, 0); }
}
.job-toast-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--bg-soft);
  font-size: 13px; font-weight: 600;
}
.job-toast-body { padding: 14px 16px; overflow-y: auto; flex: 1; }

.job-status {
  font-size: 12px;
  margin-bottom: 10px;
  font-weight: 500;
  display: flex; align-items: center; gap: 6px;
}
.job-status .pulse {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}
/* 多 RUN 并发切换器 */
.job-multi-switcher {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin: 6px 0 10px;
  padding: 6px 8px;
  background: var(--bg-soft);
  border: 1px dashed var(--accent);
  border-radius: var(--radius-sm);
  font-size: 11px;
  color: var(--text-muted);
}
.job-multi-switcher strong { color: var(--accent); }
.job-switch-btn {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 10.5px;
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition);
}
.job-switch-btn:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-text);
}

.job-stages {
  display: flex; flex-wrap: wrap; gap: 4px;
  margin-bottom: 12px;
}
.job-stage-chip {
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 10px;
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  color: var(--text-muted);
  font-family: var(--ff-mono);
  letter-spacing: 0.3px;
}
.job-stage-chip.done {
  background: var(--success-bg); color: var(--success);
  border-color: rgba(26, 127, 78, 0.2);
}
.job-stage-chip.active {
  background: var(--info-bg); color: var(--info-text);
  border-color: rgba(31, 100, 214, 0.2);
}
.job-log {
  font-family: var(--ff-mono);
  font-size: 10.5px;
  line-height: 1.5;
  background: #1d1d1f;
  color: #c2d1de;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  max-height: 220px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ═══ Chat Area (RUN 详情底部) ═══ */
.chat-panel {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-top: 24px;
  box-shadow: var(--shadow-sm);
}
.chat-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-soft);
}
.chat-title {
  display: flex; align-items: center; gap: 8px;
  font-weight: 600; font-size: 14px;
  letter-spacing: -0.1px;
}
.chat-target-select {
  font-size: 11.5px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-soft);
}
.chat-messages {
  padding: 18px 20px;
  max-height: 540px;
  overflow-y: auto;
  display: flex; flex-direction: column;
  gap: 14px;
}
.chat-message { display: flex; gap: 10px; }
.chat-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
}
.chat-message.user .chat-avatar {
  background: var(--accent-soft); color: var(--accent-text);
}
.chat-message.assistant .chat-avatar {
  background: linear-gradient(135deg, #ed5a35 0%, #ffa07a 100%);
  color: #fff; border: none;
}
.chat-bubble {
  flex: 1;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  line-height: 1.6;
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  min-width: 0;
}
.chat-message.user .chat-bubble {
  background: var(--accent-soft);
  border-color: rgba(237, 90, 53, 0.15);
}
.chat-bubble .markdown { font-size: 13px; line-height: 1.6; }
.chat-bubble .markdown p { margin: 4px 0; }

.chat-empty {
  text-align: center;
  padding: 30px 16px;
  color: var(--text-muted);
  font-size: 13px;
}
.chat-empty-emoji { font-size: 24px; margin-bottom: 8px; opacity: 0.7; }

.chat-input-area {
  display: flex; gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border-soft);
  background: var(--bg-soft);
  align-items: flex-end;
}
.chat-input {
  flex: 1;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 12px;
  font-size: 13px;
  line-height: 1.5;
  resize: none;
  min-height: 38px;
  max-height: 160px;
  transition: all var(--transition);
  font-family: var(--ff-sans);
}
.chat-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.chat-send {
  padding: 9px 18px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
.chat-send:hover:not(:disabled) {
  background: #d54d2c;
  box-shadow: 0 2px 8px rgba(237, 90, 53, 0.25);
}
.chat-send:disabled { opacity: 0.5; cursor: not-allowed; }
.chat-suggested {
  display: flex; gap: 6px; flex-wrap: wrap;
  padding: 8px 16px 4px;
  border-top: 1px solid var(--border-soft);
}
.chat-suggested-chip {
  font-size: 11.5px;
  padding: 4px 10px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 100px;
  cursor: pointer;
  color: var(--text-muted);
  transition: all var(--transition);
}
.chat-suggested-chip:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-text);
}

/* ═══ Loading skeleton — Linear/Vercel 风格 "光泽掠过" 动画 ═══
 * 基础灰底 + 一道从左到右的细高光条划过 (1.6s),
 * 比单纯 bg-position shift 更有"质感反射"的感觉 */
.skeleton {
  position: relative;
  background: var(--bg-soft);
  border-radius: var(--radius-sm);
  overflow: hidden;
  isolation: isolate;
}
.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.0) 30%,
    rgba(255, 255, 255, 0.55) 50%,
    rgba(255, 255, 255, 0.0) 70%,
    transparent 100%
  );
  background-size: 220% 100%;
  background-position: -100% 0;
  animation: shimmer 1.6s cubic-bezier(0.4, 0.0, 0.6, 1) infinite;
  pointer-events: none;
  z-index: 1;
}
@keyframes shimmer {
  0%   { background-position: -100% 0; }
  100% { background-position:  220% 0; }
}
/* 暗色模式下高光降到极淡 (避免刺眼) */
[data-theme="dark"] .skeleton::after {
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.0) 30%,
    rgba(255, 255, 255, 0.06) 50%,
    rgba(255, 255, 255, 0.0) 70%,
    transparent 100%
  );
  background-size: 220% 100%;
}
@media (prefers-reduced-motion: reduce) {
  .skeleton::after { animation: none; opacity: 0; }
}
.skeleton-line { height: 12px; margin-bottom: 8px; }
.skeleton-block { height: 80px; }
.skeleton-block-tall { height: 140px; }

/* ═══ Spinner ═══ */
.spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid var(--accent-soft);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 720ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══ Auth overlay (登录/注册) ═══ */
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(168, 85, 247, 0.16), transparent 60%),
    radial-gradient(ellipse at 80% 80%, rgba(193, 95, 60, 0.20), transparent 60%),
    var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 36px 32px 28px;
  box-shadow: 0 20px 50px -10px rgba(0, 0, 0, 0.16),
              0 8px 16px -4px rgba(0, 0, 0, 0.08);
}
.auth-brand {
  text-align: center;
  margin-bottom: 24px;
}
.auth-brand .brand-mark {
  margin: 0 auto 14px;
}
.auth-title {
  font-family: var(--ff-serif);
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.018em;
  color: var(--text);
  margin: 0 0 4px;
}
.auth-subtitle {
  font-size: 12px;
  color: var(--text-faint);
  margin: 0;
  letter-spacing: 0.04em;
}
.auth-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-soft);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 18px;
}
.auth-tab {
  flex: 1;
  background: transparent;
  border: none;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-xs);
  transition: all var(--transition);
}
.auth-tab.active {
  background: var(--bg-elev);
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-field { display: flex; flex-direction: column; gap: 5px; }
.auth-field[data-show="register"] { display: none; }
.auth-form.is-register .auth-field[data-show="register"] { display: flex; }
.auth-field label {
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.02em;
}
.auth-field input {
  font-family: var(--ff-sans);
  font-size: 14px;
  padding: 10px 12px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  transition: all var(--transition);
}
.auth-field input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg-elev);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.auth-error {
  font-size: 12px;
  color: var(--danger);
  background: var(--danger-bg);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  display: none;
}
.auth-error.is-visible { display: block; }
.auth-submit {
  margin-top: 4px;
  padding: 11px 18px;
  background: linear-gradient(135deg, #d97053 0%, var(--accent) 100%);
  color: white;
  font-weight: 600;
  font-size: 14px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}
.auth-submit:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(193, 95, 60, 0.24);
}
.auth-submit:disabled { opacity: 0.6; cursor: progress; }
.auth-hint {
  font-size: 11.5px;
  color: var(--text-faint);
  text-align: center;
  margin: 20px 0 0;
  line-height: 1.6;
}
.auth-hint strong { color: var(--accent-text); font-weight: 600; }

/* ═══ Topbar user chip ═══ */
.user-chip { position: relative; margin-left: 6px; }
.user-chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 8px 4px 4px;
  cursor: pointer;
  transition: all var(--transition);
}
.user-chip-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}
.user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #d97053);
  color: white;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-transform: uppercase;
}
.user-name {
  font-size: 12.5px;
  color: var(--text);
  font-weight: 500;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-chip-caret { font-size: 14px; color: var(--text-faint); }
.user-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 200px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 100;
  overflow: hidden;
}
.user-menu-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.user-menu-head strong { font-size: 13px; color: var(--text); }
.user-menu-head span { font-size: 11.5px; color: var(--text-muted); }
.user-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: transparent;
  border: none;
  padding: 9px 14px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: background var(--transition);
}
.user-menu-item:hover { background: var(--bg-hover); }
.user-menu-item i[data-lucide] { font-size: 14px; color: var(--text-muted); }

/* ═══ Toast notifications ═══ */
.toast-stack {
  position: fixed; bottom: 20px; left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  display: flex; flex-direction: column;
  gap: 8px; pointer-events: none;
}
.toast-item {
  background: #1d1d1f; color: #fff;
  padding: 9px 16px;
  border-radius: var(--radius);
  font-size: 12.5px;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: toastIn 200ms ease;
}
.toast-item.success { background: var(--success); }
.toast-item.error { background: var(--danger); }
@keyframes toastIn {
  from { transform: translateY(8px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ═══ 响应式 ═══ */
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    border-right: none; border-bottom: 1px solid var(--border);
    max-height: 240px;
  }
  .run-detail { padding: 20px 16px 80px; }
  .job-toast { width: calc(100vw - 32px); right: 16px; bottom: 16px; }
  .modal-panel { max-width: 100%; }
}

/* ═══ Focus 可访问性 ═══ */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

/* ═══ 工作台概览 (空状态升级) ═══ */
.workspace-overview {
  max-width: 880px;
  margin: 0 auto;
  padding: 48px 40px;
  animation: fadeIn 280ms ease;
  width: 100%;
}
.workspace-mark {
  width: 56px; height: 56px;
  background: var(--gradient);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 18px;
  box-shadow: 0 10px 24px rgba(236, 72, 153, 0.20);
}
.workspace-mark .material-symbols-outlined {
  font-size: 28px; color: #fff;
  font-variation-settings: 'FILL' 0, 'wght' 500;
}
.workspace-greeting h1 {
  font-size: 32px; font-weight: 700;
  letter-spacing: -0.02em;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 4px;
}
.workspace-greeting p {
  font-size: 13.5px;
  color: var(--text-faint);
}

.workspace-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin: 32px 0 24px;
}
.workspace-stat {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  transition: all var(--transition);
}
.workspace-stat:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}
.workspace-stat-num {
  font-size: 28px; font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  margin-bottom: 6px;
}
.workspace-stat-label {
  font-size: 11.5px;
  color: var(--text-faint);
  letter-spacing: 0.04em;
  font-weight: 500;
}

.workspace-section {
  margin-top: 28px;
}
.workspace-section-title {
  display: flex; align-items: center; gap: 7px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-faint);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 12px;
}
.workspace-section-title .material-symbols-outlined {
  font-size: 16px;
  color: var(--text-muted);
}

.workspace-tags {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.workspace-tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12.5px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 4px 10px 4px 12px;
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition);
}
.workspace-tag:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}
.workspace-tag-count {
  font-size: 10.5px;
  background: var(--bg-container);
  color: var(--text-muted);
  border-radius: var(--radius-xs);
  padding: 1px 6px;
  font-weight: 600;
  font-family: var(--ff-mono);
  font-variant-numeric: tabular-nums;
}

.workspace-recent {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}
.workspace-recent-item {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  cursor: pointer;
  transition: all var(--transition);
  text-align: left;
}
.workspace-recent-item:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
.workspace-recent-meta {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 6px;
}
.workspace-recent-id {
  font-family: var(--ff-mono);
  font-size: 11px;
  color: var(--text-faint);
}
.workspace-recent-query {
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 6px;
}
.workspace-recent-elapsed {
  font-size: 11px;
  color: var(--text-faint);
  font-family: var(--ff-mono);
}

.workspace-cta {
  display: flex; gap: 8px;
  margin-top: 32px;
}

/* 侧栏搜索高亮 */
.search-mark {
  background: var(--accent-soft);
  color: var(--accent-text);
  padding: 0 2px;
  border-radius: 2px;
  font-weight: 600;
}

/* ═══ Chat 流式输出 (光标 + 容器) ═══ */
.chat-streaming {
  font-size: 14px;
  line-height: 1.65;
  min-height: 18px;
}
.chat-streaming .markdown { display: inline; }
.chat-cursor {
  display: inline-block;
  width: 6px; height: 14px;
  background: var(--accent);
  vertical-align: -2px;
  margin-left: 2px;
  border-radius: 1px;
  animation: chatCursorBlink 1s steps(2, start) infinite;
}
@keyframes chatCursorBlink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* ═══════════════════════════════════════════════════════════
 * 行业知识库管理
 * ═══════════════════════════════════════════════════════════*/
.industries-gcp-ok, .industries-gcp-err {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 12.5px;
  line-height: 1.5;
}
.industries-gcp-ok { background: var(--success-bg); color: var(--success); border: 1px solid rgba(0,107,42,0.2); }
.industries-gcp-err { background: var(--warn-bg); color: var(--warn); border: 1px solid rgba(180,83,9,0.25); border-left: 3px solid var(--warn); }
.industries-gcp-ok .material-symbols-outlined,
.industries-gcp-err .material-symbols-outlined { font-size: 18px; flex-shrink: 0; }

.industries-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 14px;
}
.industry-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  transition: all var(--transition);
}
.industry-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.industry-card-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
}
.industry-card-name {
  font-family: var(--ff-mono);
  font-size: 14px; font-weight: 700;
  color: var(--text);
}
.ind-badge {
  font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.06em;
  padding: 3px 9px;
  border-radius: var(--radius-full);
}
.ind-badge-ok   { background: var(--success-bg); color: var(--success); border: 1px solid rgba(0,107,42,0.2); }
.ind-badge-warn { background: var(--warn-bg); color: var(--warn); border: 1px solid rgba(180,83,9,0.25); }
.ind-badge-cold { background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(186,26,26,0.2); }

.industry-card-stats {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  margin-bottom: 14px;
}
.industry-stat {
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.industry-stat.has-data { background: var(--accent-soft); border-color: rgba(183,0,79,0.2); }
.industry-stat-label {
  font-size: 10px; font-weight: 700; letter-spacing: 0.06em;
  color: var(--text-faint); text-transform: uppercase;
  margin-bottom: 4px;
}
.industry-stat-value {
  font-size: 22px; font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.industry-stat.has-data .industry-stat-value { color: var(--accent-text); }
.industry-stat-hint {
  font-size: 10.5px;
  color: var(--text-faint);
  font-family: var(--ff-mono);
  margin-top: 3px;
}

.industry-card-steps {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}
.industry-step-btn {
  display: flex; flex-direction: column; align-items: flex-start;
  gap: 2px;
  padding: 10px 12px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--ff-sans);
}
.industry-step-btn:hover:not([disabled]) {
  border-color: var(--accent);
  background: var(--bg-elev);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.industry-step-btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.industry-step-btn .material-symbols-outlined { font-size: 18px; color: var(--text-muted); }
.industry-step-btn.is-done .material-symbols-outlined { color: var(--success); }
.industry-step-btn span:nth-child(2) {
  font-size: 12.5px; font-weight: 600;
  color: var(--text);
}
.industry-step-sub {
  font-size: 11px; color: var(--text-faint);
}

/* Bootstrap 表单 + 进度 */
.bs-field { margin-bottom: 14px; }
.bs-field label {
  display: block;
  font-size: 11.5px; font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  margin-bottom: 5px;
}
.bs-actions { margin-top: 18px; display: flex; gap: 8px; }

.bs-progress {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.bs-progress-head {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 12px;
  font-size: 13.5px;
  color: var(--text);
}
.bs-progress-elapsed {
  margin-left: auto;
  font-family: var(--ff-mono);
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.bs-progress-status {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.bs-progress-detail {
  background: var(--bg-elev);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 12px;
}
.bs-progress-row {
  display: flex; justify-content: space-between; padding: 4px 0;
  border-bottom: 1px solid var(--border-soft);
  font-family: var(--ff-mono);
}
.bs-progress-row:last-child { border-bottom: none; }

/* ─ 进度条 ───────────────────────────────────── */
.bs-progress-bar-wrap {
  margin-bottom: 8px;
}
.bs-progress-bar-track {
  width: 100%;
  height: 8px;
  background: var(--bg-elev, #f1f1f4);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}
.bs-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent, #ea580c), #f59e0b);
  border-radius: 4px;
  transition: width 0.4s ease-out;
  position: relative;
  overflow: hidden;
}
.bs-progress-bar-fill::after {
  /* 流动光带 - 让人感觉「在动」 */
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.35) 50%,
    transparent 100%);
  animation: bs-progress-shimmer 1.6s linear infinite;
}
.bs-progress-bar-fill.is-done {
  background: linear-gradient(90deg, #22c55e, #16a34a);
}
.bs-progress-bar-fill.is-done::after { display: none; }
.bs-progress-bar-fill.is-failed {
  background: linear-gradient(90deg, #ef4444, #b91c1c);
}
.bs-progress-bar-fill.is-failed::after { display: none; }
@keyframes bs-progress-shimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%);  }
}
.bs-progress-bar-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
  font-size: 11.5px;
  font-family: var(--ff-mono);
}
.bs-progress-stage {
  color: var(--text-muted, #6b7280);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}
.bs-progress-stage[data-stage="done"] { color: #15803d; }
.bs-progress-stage[data-stage="error"] { color: #b91c1c; }
.bs-progress-pct {
  color: var(--text, #1f2937);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.bs-progress-message {
  font-size: 13px;
  color: var(--text, #1f2937);
  margin: 4px 0 12px;
  line-height: 1.5;
  min-height: 19px;
}

/* ─ 进行中后台任务面板 (行业知识库 modal 顶部) ───────────── */
.industries-inflight {
  background: linear-gradient(135deg, rgba(234, 88, 12, 0.06), rgba(245, 158, 11, 0.06));
  border: 1px solid rgba(234, 88, 12, 0.18);
  border-radius: var(--radius, 8px);
  padding: 12px 14px;
  margin-bottom: 16px;
}
.industries-inflight-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text, #1f2937);
  margin-bottom: 10px;
}
.inflight-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  padding: 8px 10px;
  margin-bottom: 6px;
  background: var(--bg, #fff);
  border: 1px solid var(--border-soft, #e4e4e7);
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, transform 0.05s;
}
.inflight-row:last-child { margin-bottom: 0; }
.inflight-row:hover {
  border-color: var(--accent, #ea580c);
  transform: translateY(-1px);
}
.inflight-row-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
}
.inflight-step {
  font-weight: 600;
  color: var(--accent, #ea580c);
  font-size: 11px;
  letter-spacing: 0.02em;
}
.inflight-ind {
  color: var(--text, #1f2937);
  font-weight: 500;
}
.inflight-pct {
  margin-left: auto;
  font-family: var(--ff-mono);
  font-weight: 700;
  color: var(--text, #1f2937);
}
.inflight-row-bar {
  width: 100%;
  height: 4px;
  background: var(--bg-elev, #f1f1f4);
  border-radius: 2px;
  overflow: hidden;
}
.inflight-row-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent, #ea580c), #f59e0b);
  border-radius: 2px;
  transition: width 0.4s ease-out;
}
.inflight-row-msg {
  font-size: 11px;
  color: var(--text-muted, #6b7280);
  line-height: 1.4;
}

/* ─ 最近 24h 完成 ───────────────────────────────────── */
.industries-recent-done {
  margin-top: 20px;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft, #e4e4e7);
}
.industries-recent-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint, #9ca3af);
  margin-bottom: 8px;
}
.recent-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 6px 10px;
  margin-bottom: 4px;
  background: var(--bg, #fff);
  border: 1px solid var(--border-soft, #e4e4e7);
  border-radius: 5px;
  font-size: 12px;
  cursor: pointer;
  text-align: left;
}
.recent-row:hover {
  background: var(--bg-hover, #f3f4f6);
}
.recent-row.is-ok { color: #15803d; }
.recent-row.is-failed { color: #b91c1c; }

/* ═══ 快捷键面板 ═══ */
.shortcut-group {
  margin-bottom: 22px;
}
.shortcut-group:last-child { margin-bottom: 0; }
.shortcut-group-title {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-soft);
}
.shortcut-row {
  display: flex; align-items: center;
  padding: 7px 0;
  font-size: 13px;
}
.shortcut-keys {
  flex-shrink: 0;
  width: 180px;
  display: flex; align-items: center; gap: 4px;
}
.shortcut-keys kbd {
  font-family: var(--ff-mono);
  font-size: 11px;
  font-weight: 600;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  color: var(--text-muted);
  min-width: 22px;
  text-align: center;
}
.shortcut-or {
  font-size: 11px;
  color: var(--text-faint);
  margin: 0 4px;
}
.shortcut-desc {
  flex: 1;
  color: var(--text-muted);
}
.modal-header .modal-title kbd {
  font-family: var(--ff-mono);
  font-size: 12px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 1px 6px;
  margin: 0 2px;
}

/* ═══ 代码块"一键复制"按钮 ═══ */
.markdown pre {
  position: relative;
}
.code-copy-btn {
  position: absolute;
  top: 8px; right: 8px;
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  color: rgba(255, 255, 255, 0.72);
  cursor: pointer;
  opacity: 0;
  transition: all var(--transition);
  padding: 0;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.markdown pre:hover .code-copy-btn { opacity: 1; }
.code-copy-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}
.code-copy-btn.copied {
  background: rgba(16, 185, 129, 0.25);
  color: #10b981;
  border-color: rgba(16, 185, 129, 0.4);
  opacity: 1;
}
.code-copy-btn .material-symbols-outlined {
  font-size: 16px;
  font-variation-settings: 'FILL' 0, 'wght' 500;
}

/* ═══════════════════════════════════════════════════════════
 * Cmd+K 命令面板
 * ═══════════════════════════════════════════════════════════*/
.cmdk-overlay {
  position: fixed; inset: 0;
  background: rgba(20, 18, 22, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 200;
  display: flex; justify-content: center; align-items: flex-start;
  padding-top: 12vh;
  animation: cmdkFadeIn 140ms cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes cmdkFadeIn { from { opacity: 0; } to { opacity: 1; } }

.cmdk-panel {
  width: 640px; max-width: calc(100% - 32px);
  max-height: 60vh;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 50px -10px rgba(0, 0, 0, 0.18),
              0 8px 16px -4px rgba(0, 0, 0, 0.08);
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: cmdkSlideDown 200ms cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes cmdkSlideDown {
  from { transform: translateY(-12px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

.cmdk-input-wrap {
  display: flex; align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.cmdk-input-icon { color: var(--text-faint); font-size: 22px !important; }

/* 作用域 chip — 输入 > # @ 后显示在搜索框左侧 */
.cmdk-scope-chip {
  display: inline-flex; align-items: center;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 11.5px; font-weight: 700;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  letter-spacing: 0.05em;
  flex-shrink: 0;
}
.cmdk-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--ff-sans);
  font-size: 15px;
  color: var(--text);
}
.cmdk-input::placeholder { color: var(--text-faint); }
.cmdk-esc {
  font-family: var(--ff-mono);
  font-size: 10.5px;
  color: var(--text-faint);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 2px 6px;
  font-weight: 600;
}

.cmdk-results {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}
.cmdk-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-faint);
  font-size: 13px;
}
.cmdk-group { margin-bottom: 6px; }
.cmdk-group:last-child { margin-bottom: 0; }
.cmdk-group-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 8px 10px 6px;
}

.cmdk-item {
  display: flex; align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13.5px;
  color: var(--text);
  position: relative;
}
.cmdk-item.active {
  background: var(--accent-soft);
  color: var(--accent-text);
}
.cmdk-item.active .cmdk-item-icon { color: var(--accent); }
.cmdk-item.active .cmdk-item-hint { color: var(--accent-text); opacity: 0.7; }
.cmdk-item.is-core::before {
  content: '';
  position: absolute;
  left: 0; top: 8px; bottom: 8px;
  width: 3px;
  background: var(--gradient);
  border-radius: 0 2px 2px 0;
}
.cmdk-item-icon {
  font-size: 18px !important;
  color: var(--text-muted);
  flex-shrink: 0;
}
.cmdk-item-label {
  flex: 1; min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}
.cmdk-item-hint {
  font-size: 11.5px;
  color: var(--text-faint);
  font-family: var(--ff-mono);
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: auto;
}

.cmdk-footer {
  display: flex; gap: 16px;
  padding: 10px 18px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-faint);
  background: var(--bg-soft);
}
.cmdk-footer kbd {
  font-family: var(--ff-mono);
  font-size: 10px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 5px;
  margin-right: 3px;
  font-weight: 600;
  color: var(--text-muted);
}

/* ═══════════════════════════════════════════════════════════
 * 暗色模式末尾兜底:几处用了 rgba(255,255,255) / rgba(0,0,0)
 * 半透明的细节需要倒过来
 * ═══════════════════════════════════════════════════════════*/
[data-theme="dark"] .hyp-chain {
  background: rgba(255, 255, 255, 0.04);
}
[data-theme="dark"] .hyp-pill {
  background: rgba(255, 255, 255, 0.06);
}
[data-theme="dark"] .stage-card.is-core[data-color="purple"]  { background: linear-gradient(90deg, rgba(192, 132, 252, 0.08) 0%, var(--bg-elev) 18%); }
[data-theme="dark"] .stage-card.is-core[data-color="pink"]    { background: linear-gradient(90deg, rgba(244, 114, 182, 0.08) 0%, var(--bg-elev) 18%); }
[data-theme="dark"] .stage-card.is-core[data-color="orange"]  { background: linear-gradient(90deg, rgba(251, 146, 60, 0.08) 0%, var(--bg-elev) 18%); }
[data-theme="dark"] .stage-card.is-core[data-color="cyan"]    { background: linear-gradient(90deg, rgba(34, 211, 238, 0.08) 0%, var(--bg-elev) 18%); }
[data-theme="dark"] .live-run-hero {
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.05), transparent 70%);
}
[data-theme="dark"] .arch-stage:hover { box-shadow: 0 0 0 1px var(--border-strong); }
[data-theme="dark"] .stage-card-header:hover { background: rgba(255, 255, 255, 0.025); }
[data-theme="dark"] .run-toc-link.active::before { background: var(--accent); }

/* 暗色下:cold-start banner 调整 */
[data-theme="dark"] .cold-start-banner {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.08), rgba(192, 132, 252, 0.06));
  border-color: rgba(251, 191, 36, 0.35);
}
[data-theme="dark"] .cold-start-banner .material-symbols-outlined { color: var(--warn); }
[data-theme="dark"] .cold-start-banner code {
  background: rgba(255, 255, 255, 0.04);
}

/* 暗色下:LLM warning banner 在空状态那条 */
[data-theme="dark"] #llm-warning {
  background: rgba(245, 158, 11, 0.08) !important;
  color: var(--warn) !important;
  border-color: rgba(245, 158, 11, 0.35) !important;
}
[data-theme="dark"] #llm-warning code {
  background: rgba(0, 0, 0, 0.30);
  color: var(--warn);
}

/* 暗色下 hljs atom-one-dark 已是暗的, 不需要调 */


/* ═══════════════════════════════════════════════════════════════════════
 *                     📱 Mobile / Responsive
 *  ────────────────────────────────────────────────────────────────────
 *  桌面 (>= 768px):      3 列布局 (sidebar | resizer | main)
 *  平板 (480-767px):     单列, sidebar 抽屉, 顶部 hamburger
 *  手机 (< 480px):       同上 + 紧凑模式
 * ═══════════════════════════════════════════════════════════════════════*/

/* ── hamburger 按钮:桌面隐藏,手机出 ── */
.m-hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text);
  flex-shrink: 0;
  padding: 0;
}
.m-hamburger i[data-lucide] { font-size: 18px; }
.m-hamburger:hover { background: var(--bg-hover); }

/* ────────── 平板 + 手机 (max-width: 767px) ────────── */
@media (max-width: 767px) {
  /* 顶部 — 简化 */
  .topbar { padding: 0 12px; }
  .topbar-inner { gap: 8px; }
  .m-hamburger { display: inline-flex; }
  .brand-tagline { display: none; }   /* 副标语隐藏 */
  .brand-name { font-size: 16px; }
  .brand-mark { width: 32px; height: 32px; }
  .topbar-nav { display: none; }       /* 中间 nav 隐藏 */
  .cmdk-trigger,
  .cmdk-trigger-text { display: none; }/* 搜索条隐藏 */
  .llm-health-text { display: none; }
  .llm-health { padding: 0 6px; }
  .topbar-actions { gap: 6px; }
  #btn-refresh { display: none; }      /* 刷新按钮 (loadRunsList 30s 自动刷) */
  #btn-theme { width: 32px; height: 32px; }
  /* 新建 RUN 按钮 — 只显图标 */
  #btn-new-run span:not(.material-symbols-outlined) { display: none; }
  #btn-new-run {
    padding: 0 10px;
    min-width: 38px; min-height: 38px;
  }
  /* 用户 chip — 只显头像 */
  .user-name, .user-chip-caret { display: none; }
  .user-chip-btn { padding: 4px; }

  /* ── 主布局:3 列 → 单列 ── */
  :root { --sidebar-width: 86vw; }     /* 抽屉宽度,留 14vw 给点击关闭 */
  .app-shell {
    grid-template-columns: 1fr;        /* sidebar + resizer 用 fixed/transform */
    height: calc(100vh - 56px);
    overflow: hidden;
  }
  .topbar { height: 56px; }
  .topbar, .topbar-inner { height: 56px; }

  /* sidebar 变抽屉:绝对定位,默认隐藏 (translateX 移出),滑入 */
  .sidebar {
    position: fixed;
    left: 0; top: 56px;
    width: var(--sidebar-width);
    max-width: 340px;
    height: calc(100vh - 56px);
    z-index: 50;
    background: var(--bg-elev);
    border-right: 1px solid var(--border);
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.16);
    transform: translateX(-100%);
    transition: transform var(--transition-smooth);
  }
  body.m-drawer-open .sidebar { transform: translateX(0); }

  /* 拖动条隐藏 */
  .resizer { display: none; }

  /* main 区域占满 */
  .main-area { padding: 12px 14px; }
  .run-detail-with-toc {
    grid-template-columns: 1fr;        /* TOC 不并排 */
    gap: 0;
  }
  .run-toc {
    position: static !important;       /* 不再 sticky */
    margin-bottom: 18px;
    max-height: none;
    width: 100%;
  }

  /* ── Backdrop 遮罩:抽屉打开时显示 ── */
  body.m-drawer-open::before {
    content: '';
    position: fixed;
    inset: 56px 0 0 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 49;
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
  }

  /* ── Stage 卡片:紧凑 ── */
  .stages-grid { gap: 8px; }
  .stage-card { padding: 12px 12px; }
  .stage-icon { width: 36px; height: 36px; border-radius: 9px; }
  .stage-icon i[data-lucide] { font-size: 18px; }
  .stage-title { font-size: 13.5px; gap: 6px; }
  .stage-title-num { font-size: 10.5px; padding: 1px 5px; }
  .stage-card-header { gap: 10px; }

  /* hero / banner 精简 */
  .run-hero { padding: 14px 14px; }
  .run-query { font-size: 17px; }
  .hero-summary-title { font-size: 18px; }
  .live-sticky-banner { padding: 10px 12px; }
  .live-sticky-status { font-size: 12px; }
  .live-rhythm { height: 60px; padding: 8px 10px 4px; }

  /* ── 9 阶段 chip:9 列太挤 → 5 列 ── */
  .live-sticky-chips {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
  }
  .live-sticky-chip { padding: 4px 3px; }
  .live-sticky-chip .live-chip-name {
    font-size: 10px;
    line-height: 1.2;
  }
  .live-sticky-chip .live-chip-num { font-size: 9.5px; min-width: 12px; padding: 0 3px; }
  .live-sticky-chip .live-chip-status { font-size: 12px; }

  /* ── 节奏波 labels 缩小 ── */
  .live-rhythm-label-top, .live-rhythm-label-bot { font-size: 9px; }
  .live-rhythm-label-top .material-symbols-outlined,
  .live-rhythm-label-bot .material-symbols-outlined { font-size: 11px; }

  /* ── Job toast:全宽底部 ── */
  .job-toast {
    width: calc(100vw - 16px) !important;
    right: 8px !important;
    bottom: 8px !important;
    max-height: 50vh;
  }
  .job-stages { gap: 3px; }
  .job-stage-chip { font-size: 9.5px; padding: 2px 6px; }
  .job-multi-switcher { font-size: 10.5px; }
  .job-switch-btn { font-size: 10px; padding: 2px 6px; }

  /* ── Modals 全屏化 ── */
  .modal-overlay { padding: 0; align-items: stretch; }
  .modal-panel {
    width: 100% !important;
    max-width: 100% !important;
    height: 100vh; max-height: 100vh;
    border-radius: 0;
    margin: 0;
  }
  .modal-header { padding: 14px 16px; position: sticky; top: 0; background: var(--bg-elev); z-index: 5; }
  .modal-body { padding: 14px 16px; }
  .modal-footer { padding: 12px 16px; }

  /* Wizard 整步导航条紧凑 */
  .wizard-steps { gap: 4px; font-size: 11px; }
  .wizard-step-num { width: 22px; height: 22px; font-size: 11px; }
  .wizard-step-label { display: none; }

  /* ── Auth overlay 全屏 ── */
  .auth-overlay { padding: 0; align-items: stretch; }
  .auth-card {
    width: 100%; max-width: 100%;
    border-radius: 0;
    padding: 36px 22px 24px;
    height: 100vh;
    border: none;
    display: flex; flex-direction: column;
    justify-content: center;
  }
  .auth-field input {
    font-size: 16px !important;       /* iOS 防 zoom (字号 >= 16px) */
    padding: 12px 14px;
    min-height: 44px;
  }
  .auth-submit { padding: 13px 18px; font-size: 15px; min-height: 48px; }
  .auth-tab { min-height: 38px; }

  /* ── RUN 卡片:点击区域加大 ── */
  .run-card { padding: 11px 12px; min-height: 56px; }
  .run-card-id { font-size: 11.5px; }
  .run-card-query { font-size: 13px; }
  .run-card-meta { font-size: 11px; }
  .run-card-resume, .run-card-restart {
    min-height: 28px;
    padding: 4px 8px;
    font-size: 11.5px;
  }

  /* ── Chat 面板紧凑 ── */
  .chat-panel { padding: 14px 14px; }
  .chat-input { font-size: 16px; min-height: 48px; }   /* 防 iOS zoom */
  .chat-send { min-height: 48px; padding: 0 16px; }

  /* ── AI-5 / AI-7 评估卡片紧凑 ── */
  .ai5-dim-mini { grid-template-columns: 1fr; gap: 3px 0; }
  .ai5-overview-stat strong { font-size: 18px; }
  .ai5-dim-mini-row { grid-template-columns: 60px 1fr 28px; font-size: 10px; }

  /* ── AI-4 incumbent 卡片紧凑 ── */
  .ai4-patent-card { padding: 8px 9px; font-size: 11.5px; }
  .ai4-sol-card { padding: 8px 10px; }

  /* ── AI-0 known stats 紧凑 ── */
  .ai0-known-stats { grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .ai0-known-stat strong { font-size: 18px; }

  /* ── 实时日志 ── */
  .live-run-log { font-size: 10.5px; padding: 8px 10px; max-height: 200px; }

  /* TOC 下拉 (折叠到顶部一个简短目录) */
  .run-toc-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .run-toc-item { font-size: 11px; padding: 6px 8px; }
}

/* ────────── 小屏手机 (< 480px) ────────── */
@media (max-width: 479px) {
  /* 9 阶段 chip 改 3 列,每行 3 个 */
  .live-sticky-chips { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px; }
  .live-sticky-chip { padding: 5px 2px; }
  .live-sticky-chip .live-chip-name {
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
    max-width: 100%;
  }
  /* 节奏波再缩小 */
  .live-rhythm { height: 52px; }
  /* run hero 字体再小 */
  .run-query { font-size: 15.5px; }
  /* sidebar 抽屉再宽一点 */
  :root { --sidebar-width: 92vw; }
  /* TOC 一行 2 列 */
  .run-toc-list { grid-template-columns: repeat(2, 1fr); }
  /* AI-0 stats 单列 */
  .ai0-known-stats { grid-template-columns: 1fr; }
  /* Brand text 只留 LOGO */
  .brand-name { font-size: 14.5px; }
}

/* iOS Safe-area (刘海/底部 home bar) */
@supports (padding: max(0px)) {
  .topbar { padding-top: env(safe-area-inset-top); height: calc(56px + env(safe-area-inset-top)); }
  @media (max-width: 767px) {
    .sidebar { top: calc(56px + env(safe-area-inset-top)); height: calc(100vh - 56px - env(safe-area-inset-top)); }
    .job-toast { bottom: max(8px, env(safe-area-inset-bottom)) !important; }
    body.m-drawer-open::before { top: calc(56px + env(safe-area-inset-top)); }
  }
}

/* ═══════════════════════════════════════════════════════════════════
   行业 Combobox — 新建 RUN 第 1 步的行业选择器
   ═══════════════════════════════════════════════════════════════════ */
.industry-combo {
  position: relative;
}
.industry-combo-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  background: var(--bg-input, #fff);
  border: 1px solid var(--border, #d4d4d8);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text, #1f2937);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.industry-combo-trigger:hover {
  border-color: var(--border-strong, #a1a1aa);
}
.industry-combo-trigger:focus,
.industry-combo[aria-expanded="true"] .industry-combo-trigger,
.industry-combo-trigger[aria-expanded="true"] {
  outline: none;
  border-color: var(--accent, #ea580c);
  box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.12);
}
.industry-combo-value {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.industry-combo-placeholder {
  color: var(--text-faint, #9ca3af);
}
.industry-combo-caret {
  width: 16px;
  height: 16px;
  color: var(--text-muted, #6b7280);
  flex-shrink: 0;
  transition: transform 0.2s;
}
.industry-combo-trigger[aria-expanded="true"] .industry-combo-caret {
  transform: rotate(180deg);
}

.industry-combo-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--bg, #fff);
  border: 1px solid var(--border, #d4d4d8);
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  max-height: 340px;
  display: flex;
  flex-direction: column;
}
.industry-combo-dropdown[hidden] { display: none; }

.industry-combo-search-wrap {
  position: relative;
  padding: 8px;
  border-bottom: 1px solid var(--border-subtle, #f1f1f4);
}
.industry-combo-search-icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--text-faint, #9ca3af);
  pointer-events: none;
}
.industry-combo-search {
  width: 100%;
  padding: 7px 8px 7px 30px;
  border: 1px solid var(--border, #d4d4d8);
  border-radius: 6px;
  font-size: 13px;
  outline: none;
  background: var(--bg-subtle, #fafafa);
}
.industry-combo-search:focus {
  border-color: var(--accent, #ea580c);
  background: var(--bg, #fff);
}

.industry-combo-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}
.industry-combo-loading,
.industry-combo-empty {
  padding: 18px 12px;
  font-size: 13px;
  color: var(--text-muted, #6b7280);
  text-align: center;
}

.industry-combo-section-header {
  padding: 8px 12px 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-faint, #9ca3af);
}

.industry-combo-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  padding: 8px 12px;
  background: transparent;
  border: none;
  text-align: left;
  cursor: pointer;
  font-size: 13px;
  color: var(--text, #1f2937);
}
.industry-combo-item:hover,
.industry-combo-item.is-active {
  background: var(--bg-hover, #f3f4f6);
}
.industry-combo-item.is-selected {
  background: rgba(234, 88, 12, 0.06);
}
.industry-combo-item-main {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.industry-combo-item-emoji {
  font-size: 14px;
  line-height: 1;
}
.industry-combo-item-name {
  font-weight: 500;
}
.industry-combo-item-name-en {
  color: var(--text-muted, #6b7280);
  font-weight: 400;
  font-size: 12px;
}
.industry-combo-item-meta {
  font-size: 11px;
  color: var(--text-muted, #6b7280);
}
.industry-combo-item-desc {
  font-size: 11px;
  color: var(--text-faint, #9ca3af);
  font-weight: 400;
}

.industry-mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.industry-mode-fast { background: #dcfce7; color: #166534; }
.industry-mode-partial { background: #fef3c7; color: #92400e; }
.industry-mode-discovery { background: #dbeafe; color: #1e40af; }
.industry-mode-unknown { background: #f3f4f6; color: #4b5563; }

.industry-combo-divider {
  height: 1px;
  background: var(--border-subtle, #f1f1f4);
  margin: 6px 8px;
}

.industry-combo-new {
  padding: 8px 12px;
  font-size: 13px;
  color: var(--accent, #ea580c);
  font-weight: 500;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.industry-combo-new strong {
  color: var(--text, #1f2937);
  font-weight: 600;
}

/* 已选行业的状态横幅 */
.industry-status {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.5;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.industry-status[hidden] { display: none; }
.industry-status-ready {
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.2);
  color: #166534;
}
.industry-status-partial {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.22);
  color: #92400e;
}
.industry-status-coldstart {
  background: rgba(59, 130, 246, 0.06);
  border: 1px solid rgba(59, 130, 246, 0.18);
  color: #1e40af;
}
.industry-status-ai-auto {
  background: rgba(124, 58, 237, 0.06);
  border: 1px solid rgba(124, 58, 237, 0.16);
  color: #5b21b6;
}
.industry-status-text {
  flex: 1;
}
.industry-status-text strong { font-weight: 600; }
.industry-status-actions {
  margin-top: 6px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.industry-status-btn {
  padding: 5px 10px;
  background: #fff;
  border: 1px solid currentColor;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  color: inherit;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.industry-status-btn:hover { background: rgba(0,0,0,0.04); }
.industry-status-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* 移动端: dropdown 占满更大 */
@media (max-width: 480px) {
  .industry-combo-dropdown { max-height: 60vh; }
}

/* ═══ 管理后台 ═══ */
.admin-tabs {
  display: flex;
  gap: 4px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
}
.admin-tab {
  padding: 10px 16px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.2s, border-color 0.2s;
}
.admin-tab:hover { color: var(--text); }
.admin-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* KPI cards */
.admin-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 8px;
}
.admin-kpi-card {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
}
.admin-kpi-label {
  font-size: 12px;
  color: var(--text-faint);
  margin-bottom: 6px;
}
.admin-kpi-value {
  font-size: 28px;
  font-weight: 600;
  line-height: 1.1;
}
.admin-kpi-sub {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 4px;
}

/* RUN row list */
.admin-runs-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 56vh;
  overflow-y: auto;
}
.admin-run-row {
  padding: 10px 12px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.admin-run-row:hover {
  border-color: var(--accent);
  background: var(--bg-soft-hover, var(--bg-soft));
}
.admin-run-row-head {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 4px;
}
.admin-run-id {
  font-family: var(--font-mono, monospace);
  font-size: 12px;
  color: var(--text-faint);
}
.admin-run-row-user {
  font-size: 12px;
  color: var(--text-faint);
  margin-bottom: 2px;
}
.admin-run-row-query {
  font-size: 13px;
  color: var(--text);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* user table */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.admin-table th,
.admin-table td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.admin-table th {
  font-weight: 600;
  color: var(--text-faint);
  background: var(--bg-soft);
}
.admin-user-row {
  cursor: pointer;
  transition: background 0.15s;
}
.admin-user-row:hover { background: var(--bg-soft); }

/* badges */
.admin-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--bg-soft);
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 500;
}
.admin-badge-ok {
  background: rgba(34, 197, 94, 0.15);
  color: rgb(22, 163, 74);
}
.admin-badge-err {
  background: rgba(239, 68, 68, 0.15);
  color: rgb(220, 38, 38);
}

/* mobile responsive */
@media (max-width: 768px) {
  .admin-kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-table { font-size: 12px; }
  .admin-table th, .admin-table td { padding: 6px 8px; }
}

/* ═══ RUN 分享链接 ═══ */
.share-url-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.share-url-input {
  flex: 1;
  font-family: var(--font-mono, monospace);
  font-size: 12px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-soft);
  color: var(--text);
  min-width: 0;
}
.btn-sm { padding: 6px 12px; font-size: 13px; }

/* ═══ 分享视图(/share/{token})顶部横幅 ═══ */
.share-banner {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.12), rgba(168, 85, 247, 0.12));
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text);
  backdrop-filter: blur(8px);
}
.share-banner-text { flex: 1; }
.share-banner-text strong { color: var(--accent); }
.share-banner-views {
  color: var(--text-faint);
  font-size: 12px;
}

/* share-mode body 调整: sidebar 收起、main 全宽 */
body.share-mode .sidebar { display: none !important; }
body.share-mode .app-shell { grid-template-columns: 1fr !important; }
body.share-mode #share-banner { display: flex !important; }
body.share-mode .topbar { padding-top: 40px; /* 给 banner 让位 */ }
body.share-mode #chat-anchor,
body.share-mode #chat-panel,
body.share-mode .chat-panel,
body.share-mode #hero-chat-jump,
body.share-mode .btn-delete-run,
body.share-mode .btn-restart-run,
body.share-mode .run-actions { display: none !important; }

/* mobile share banner */
@media (max-width: 768px) {
  .share-banner { font-size: 12px; padding: 6px 10px; }
  .share-banner-views { display: none; }
}

/* ═══ run-hero 分享按钮 ═══ */
.run-hero-share {
  margin-left: auto;
}
.run-hero-top {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ═══ 单方案 ⭐ 按钮(SOL/CSOL 卡片) ═══ */
.item-fav-btn {
  border: none;
  background: transparent;
  padding: 4px 6px;
  cursor: pointer;
  margin-left: auto;
  border-radius: 4px;
  color: var(--text-faint);
  transition: color 0.15s, background 0.15s, transform 0.1s;
  display: inline-flex;
  align-items: center;
}
.item-fav-btn:hover {
  background: var(--bg-soft);
  color: var(--accent);
  transform: scale(1.1);
}
.item-fav-btn.is-favorited {
  color: var(--accent);
}
.item-fav-btn.is-favorited .material-symbols-outlined {
  font-variation-settings: 'FILL' 1;
}

/* ═══ 我的收藏 modal ═══ */
.fav-section {
  margin-bottom: 24px;
}
.fav-section:last-child { margin-bottom: 0; }
.fav-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 12px;
  color: var(--text);
}
.fav-count {
  background: var(--bg-soft);
  color: var(--text-faint);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 400;
}
.fav-empty {
  padding: 24px;
  text-align: center;
  color: var(--text-faint);
  font-size: 13px;
  background: var(--bg-soft);
  border-radius: 6px;
}
.fav-runs-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.fav-card {
  padding: 12px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.fav-card:hover { border-color: var(--accent); }
.fav-card-head {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
}
.fav-run-id {
  font-size: 11px;
  color: var(--text-faint);
  font-family: var(--font-mono, monospace);
}
.fav-card-query {
  font-size: 13px;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 4px;
}
.fav-card-meta {
  font-size: 11px;
  color: var(--text-faint);
}

.fav-items-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.fav-items-group {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.fav-items-group-head {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.fav-items-group-head:hover { background: var(--bg-soft-hover, var(--bg-soft)); }
.fav-item-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.fav-item-row:last-child { border-bottom: none; }
.fav-item-type {
  display: inline-block;
  padding: 1px 8px;
  background: var(--accent);
  color: white;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
}
.fav-item-id {
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  color: var(--text-faint);
}
.fav-item-label { flex: 1; }
.fav-unfav-btn { margin-left: auto; }

@media (max-width: 768px) {
  .fav-runs-grid { grid-template-columns: 1fr; }
}

/* ═══ 群聊 / 协作分享 chat 面板 ═══ */
.share-chat-panel {
  margin-top: 32px;
  padding: 16px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.share-chat-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.share-chat-meta {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-faint);
  font-weight: 400;
}
.share-chat-body {
  max-height: 480px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 0 12px;
}
.share-chat-empty {
  padding: 32px;
  text-align: center;
  color: var(--text-faint);
  font-size: 13px;
  border: 1px dashed var(--border);
  border-radius: 6px;
}
.share-chat-msg {
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  line-height: 1.5;
  background: var(--bg);
  border: 1px solid var(--border);
}
.share-chat-msg.is-me {
  background: rgba(99, 102, 241, 0.08);
  border-color: rgba(99, 102, 241, 0.3);
}
.share-chat-msg.is-ai {
  background: rgba(168, 85, 247, 0.08);
  border-color: rgba(168, 85, 247, 0.3);
}
.share-chat-msg.is-other {
  background: rgba(34, 197, 94, 0.06);
  border-color: rgba(34, 197, 94, 0.25);
}
.share-chat-msg-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  font-size: 12px;
}
.share-chat-badge {
  display: inline-block;
  padding: 1px 6px;
  background: var(--bg-soft);
  border-radius: 8px;
  font-size: 10px;
  color: var(--text-faint);
}
.share-chat-time {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-faint);
}
.share-chat-msg-body { white-space: pre-wrap; word-wrap: break-word; }
.share-chat-input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.share-chat-input {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  resize: vertical;
}
.share-chat-input:focus {
  outline: none;
  border-color: var(--accent);
}

body.share-collaborate #chat-panel,
body.share-collaborate #chat-anchor { display: none !important; }

/* ═══ 群聊 v2 — 工具栏 / 成员 chip / stage 标签 / 退群 ═══ */
.share-chat-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 10px;
  padding: 8px 0 0;
  border-top: 1px solid var(--border);
}
.share-chat-target-select {
  font-size: 12px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
  margin-left: 4px;
}
.share-chat-participants {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 0;
  align-items: center;
}
.share-participant-chip {
  display: inline-block;
  padding: 2px 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  font-size: 11px;
  color: var(--text);
  background: var(--bg);
}
.share-participant-chip.is-owner {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.35);
  font-weight: 600;
}
.share-chat-stage-tag {
  display: inline-block;
  padding: 1px 6px;
  background: rgba(99, 102, 241, 0.12);
  color: var(--accent);
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  font-family: var(--font-mono, monospace);
}

/* ═══ AI 正在思考 动画 ═══ */
.ai-typing-indicator {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  padding: 6px 0;
}
.ai-typing-dot {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  display: inline-block;
  animation: ai-typing 1.4s ease-in-out infinite;
}
.ai-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.ai-typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes ai-typing {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1.15); }
}

/* ═══ chat 消息删除按钮 ═══ */
.share-chat-del-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  margin-left: 6px;
  padding: 2px 4px;
  border-radius: 3px;
  color: var(--text-faint);
  opacity: 0;
  transition: opacity 0.15s, color 0.15s, background 0.15s;
}
.share-chat-msg:hover .share-chat-del-btn { opacity: 1; }
.share-chat-del-btn:hover {
  color: var(--danger);
  background: rgba(220, 38, 38, 0.08);
}

/* ═══ 群聊 AI 消息 markdown 内嵌样式 ═══ */
.share-chat-md { font-size: 13.5px; line-height: 1.6; }
.share-chat-md > :first-child { margin-top: 0; }
.share-chat-md > :last-child { margin-bottom: 0; }
.share-chat-md h1, .share-chat-md h2, .share-chat-md h3, .share-chat-md h4 {
  margin: 12px 0 6px; line-height: 1.3;
}
.share-chat-md h2 { font-size: 16px; font-weight: 600; }
.share-chat-md h3 { font-size: 14px; font-weight: 600; }
.share-chat-md h4 { font-size: 13.5px; font-weight: 600; }
.share-chat-md p { margin: 6px 0; }
.share-chat-md ul, .share-chat-md ol { margin: 6px 0; padding-left: 22px; }
.share-chat-md li { margin: 2px 0; }
.share-chat-md table {
  border-collapse: collapse;
  margin: 8px 0;
  font-size: 12.5px;
  width: 100%;
}
.share-chat-md th, .share-chat-md td {
  border: 1px solid var(--border);
  padding: 4px 8px;
  text-align: left;
}
.share-chat-md th {
  background: var(--bg-soft);
  font-weight: 600;
}
.share-chat-md code {
  background: rgba(0,0,0,0.06);
  padding: 1px 5px;
  border-radius: 3px;
  font-family: var(--font-mono, monospace);
  font-size: 12px;
}
.share-chat-md pre {
  background: var(--bg-soft);
  padding: 10px;
  border-radius: 4px;
  overflow-x: auto;
  margin: 8px 0;
}
.share-chat-md pre code { background: transparent; padding: 0; }
.share-chat-md hr { border: 0; border-top: 1px solid var(--border); margin: 10px 0; }
.share-chat-md blockquote {
  margin: 6px 0;
  padding: 4px 12px;
  border-left: 3px solid var(--accent);
  background: var(--bg-soft);
  color: var(--text-faint);
}

/* ═══ share chat code 块对比度修正 ═══ */
.share-chat-md pre {
  background: var(--bg, #fafafa);
  border: 1px solid var(--border);
  padding: 12px 14px;
  border-radius: 6px;
  overflow-x: auto;
  margin: 8px 0;
  font-size: 12.5px;
  line-height: 1.55;
}
.share-chat-md pre code {
  background: transparent !important;
  padding: 0 !important;
  color: var(--text) !important;  /* 强制用主文本色,不继承 .markdown 的淡色 */
  font-family: var(--font-mono, 'SF Mono', Menlo, Consolas, monospace);
  font-weight: 500;
  font-size: 13px;
  white-space: pre-wrap;  /* 长行能自动折,不强求横向滚 */
  word-break: break-word;
}
.share-chat-md p code,
.share-chat-md li code,
.share-chat-md td code {
  /* 行内 code */
  background: rgba(99, 102, 241, 0.1);
  color: var(--accent);
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 12.5px;
  font-weight: 500;
}

/* 暗黑主题下加强对比 */
@media (prefers-color-scheme: dark) {
  .share-chat-md pre {
    background: rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.1);
  }
}
[data-theme="dark"] .share-chat-md pre {
  background: rgba(0, 0, 0, 0.3);
  border-color: rgba(255, 255, 255, 0.1);
}

/* AI 消息整体文字也加重一点(避免在浅紫底色上 muted 看不清)*/
.share-chat-msg.is-ai .share-chat-md {
  color: var(--text);
}
.share-chat-msg.is-ai .share-chat-md p,
.share-chat-msg.is-ai .share-chat-md li,
.share-chat-msg.is-ai .share-chat-md td {
  color: var(--text);
}

/* ═══ AI-M 机理卡片 展开详情按钮 ═══ */
.aim-mech-expand-btn {
  margin-left: auto;
  background: rgba(99, 102, 241, 0.06);
  border: 1px solid rgba(99, 102, 241, 0.2);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11.5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: background 0.15s, border-color 0.15s;
}
.aim-mech-expand-btn:hover {
  background: rgba(99, 102, 241, 0.14);
  border-color: rgba(99, 102, 241, 0.4);
}
.aim-mech-detail {
  margin-top: 8px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.025);
  border-radius: 6px;
  border-left: 3px solid var(--accent);
  font-size: 12.5px;
}
.aim-detail-grid { display: flex; flex-direction: column; gap: 10px; }
.aim-detail-row { display: flex; flex-direction: column; gap: 4px; }
.aim-detail-label {
  font-weight: 600;
  color: var(--text);
  font-size: 12px;
}
.aim-detail-val { color: var(--text); font-size: 12px; }
.aim-detail-why, .aim-detail-triggers {
  margin: 4px 0 0;
  padding-left: 18px;
  color: var(--text);
  line-height: 1.55;
}
.aim-detail-why li, .aim-detail-triggers li { margin: 3px 0; }
.aim-detail-params {
  margin-top: 4px;
  border-collapse: collapse;
  font-size: 12px;
}
.aim-detail-params td {
  padding: 3px 8px;
  border-bottom: 1px solid var(--border);
}
.aim-detail-params td:first-child {
  color: var(--accent);
  font-family: var(--font-mono, monospace);
  font-size: 11.5px;
}
.aim-detail-tag {
  display: inline-block;
  background: var(--bg-soft);
  color: var(--text-faint);
  padding: 1px 8px;
  border-radius: 9px;
  font-size: 10.5px;
  margin: 2px 4px 2px 0;
}
.aim-detail-tag-comp {
  background: rgba(34, 197, 94, 0.1);
  color: rgb(22, 163, 74);
}

/* ═══ "📖 展开完整分析" 按钮加强可见(还不喧宾夺主) ═══ */
.show-full-md-text {
  color: var(--accent) !important;
  font-weight: 500;
}
/* 它外面那个 details summary 是浏览器默认样式; 加点边框暗示是可点击的 */
details > summary:has(.show-full-md-text) {
  cursor: pointer;
  padding: 6px 10px;
  border: 1px dashed rgba(99, 102, 241, 0.3);
  border-radius: 6px;
  background: rgba(99, 102, 241, 0.04);
  transition: background 0.15s;
}
details > summary:has(.show-full-md-text):hover {
  background: rgba(99, 102, 241, 0.08);
}
details[open] > summary:has(.show-full-md-text) {
  background: rgba(99, 102, 241, 0.1);
  border-style: solid;
}

/* ═══ 机理详情:一句话说明 + 专利 chip ═══ */
.aim-detail-desc {
  background: rgba(99, 102, 241, 0.06);
  border-left: 4px solid var(--accent);
  padding: 10px 14px !important;
  border-radius: 0 6px 6px 0;
  margin-bottom: 4px !important;
}
.aim-detail-desc-text {
  font-size: 14px !important;
  line-height: 1.65;
  color: var(--text);
  font-weight: 500;
}
.aim-detail-patent-chip {
  display: inline-block;
  padding: 1px 7px;
  margin: 0 4px 4px 0;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: var(--font-mono, monospace);
  font-size: 10.5px;
  color: var(--text-faint);
  text-decoration: none;
  white-space: nowrap;
}
.aim-detail-patent-link:hover {
  background: rgba(99, 102, 241, 0.1);
  color: var(--accent);
  border-color: var(--accent);
}
.aim-detail-patents {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin-top: 4px;
}
.aim-detail-tag-flow {
  background: rgba(245, 158, 11, 0.12);
  color: rgb(180, 83, 9);
}

/* ═══ AI-M 机理卡片"说明"行(默认显示,3 行截断,hover 全文)═══ */
.aim-mech-desc {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--border);
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text-soft, var(--text));
}
.aim-mech-desc-label {
  flex-shrink: 0;
  font-weight: 600;
  font-size: 11px;
  padding: 1px 6px;
  background: rgba(99, 102, 241, 0.08);
  color: var(--accent);
  border-radius: 3px;
  margin-top: 2px;
}
.aim-mech-desc-text {
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* 鼠标 hover 整张卡片时,说明展开成全文 */
.aim-mech-card:hover .aim-mech-desc-text {
  -webkit-line-clamp: unset;
  overflow: visible;
}

/* ═══ V6.7.57 SOL/CSOL 推理链(可展开)═══ */
.sol-reasoning-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  margin-top: 8px;
  background: rgba(99, 102, 241, 0.06);
  border: 1px solid rgba(99, 102, 241, 0.15);
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
  color: var(--accent);
  transition: background 0.15s, border-color 0.15s;
  user-select: none;
}
.sol-reasoning-toggle:hover {
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.3);
}
.sol-reasoning-toggle.is-open {
  background: rgba(99, 102, 241, 0.12);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}
.sol-reasoning-body {
  padding: 12px 14px;
  background: rgba(99, 102, 241, 0.04);
  border: 1px solid rgba(99, 102, 241, 0.15);
  border-top: none;
  border-radius: 0 0 5px 5px;
  font-size: 12.5px;
  line-height: 1.65;
  margin-bottom: 4px;
}
.sol-reasoning-body > :first-child { margin-top: 0; }
.sol-reasoning-body > :last-child { margin-bottom: 0; }
.sol-reasoning-body ul { padding-left: 20px; margin: 4px 0; }
.sol-reasoning-body li { margin: 3px 0; }
.sol-reasoning-body code {
  background: rgba(99, 102, 241, 0.1);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 11.5px;
  color: var(--accent);
}

/* ═══ V6.7.57 "再生成一批" 按钮 ═══ */
.regen-stage-btn {
  background: linear-gradient(135deg, rgba(99,102,241,0.08), rgba(168,85,247,0.08));
  border: 1px solid rgba(99,102,241,0.3);
  color: var(--accent);
  font-weight: 500;
  padding: 8px 16px;
  transition: all 0.2s;
}
.regen-stage-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, rgba(99,102,241,0.15), rgba(168,85,247,0.15));
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}
.regen-stage-btn:disabled {
  opacity: 0.7;
  cursor: wait;
}

/* ═══ V6.7.59 IFR 双形态展示 ═══ */
.ifr-headline, .ifr-full {
  padding: 10px 14px;
  margin: 8px 0;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.65;
}
.ifr-headline {
  background: rgba(99, 102, 241, 0.06);
  border-left: 3px solid var(--accent);
}
.ifr-full {
  background: rgba(34, 197, 94, 0.05);
  border-left: 3px solid rgb(34, 197, 94);
}
.ifr-headline strong, .ifr-full strong {
  display: inline-block;
  margin-right: 6px;
  font-size: 13px;
}
.ifr-tag {
  display: inline-block;
  padding: 1px 8px;
  font-size: 10.5px;
  background: rgba(0, 0, 0, 0.06);
  color: var(--text-faint);
  border-radius: 10px;
  vertical-align: middle;
}
.ifr-text {
  margin-top: 6px;
  color: var(--text);
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* ═══ V6.7.62 IFR 分层子目标展示 ═══ */
.ifr-subgoals {
  margin-top: 12px;
  padding: 12px 14px;
  background: linear-gradient(to right, rgba(245, 158, 11, 0.05), rgba(245, 158, 11, 0.01));
  border-left: 3px solid rgb(245, 158, 11);
  border-radius: 6px;
}
.ifr-subgoals-head {
  margin-bottom: 10px;
  font-size: 13px;
}
.ifr-subgoals-head strong { margin-right: 6px; }
.ifr-sg-row {
  display: grid;
  grid-template-columns: 70px 130px 1fr;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px dashed rgba(245, 158, 11, 0.2);
  font-size: 12.5px;
  line-height: 1.55;
  align-items: start;
}
.ifr-sg-row:first-of-type { border-top: none; }
.ifr-sg-id {
  color: rgb(217, 119, 6);
  font-weight: 700;
  font-size: 11.5px;
  background: rgba(245, 158, 11, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  height: fit-content;
}
.ifr-sg-layer {
  color: var(--text);
  font-weight: 600;
  font-size: 12.5px;
}
.ifr-sg-body { display: flex; flex-direction: column; gap: 4px; }
.ifr-sg-goal { color: var(--text); }
.ifr-sg-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 11.5px;
}
.ifr-sg-metrics > span {
  color: var(--text-muted);
}
.ifr-sg-metrics strong {
  color: var(--text-faint);
  font-weight: 500;
  margin-right: 3px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.ifr-sg-tgt strong { color: rgb(22, 163, 74); }
.ifr-sg-imp strong { color: rgb(217, 119, 6); }
.ifr-sg-rat {
  font-size: 11.5px;
  color: var(--text-faint);
  font-style: italic;
  margin-top: 2px;
}


/* ── V6.7.100 方案结构示意图 ────────────────────────────────── */
.ai4-sol-figure {
  margin: 12px 0 10px;
  padding: 10px;
  background: var(--bg-subtle, #fafaf9);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.ai4-sol-figure img {
  display: block;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  border-radius: 4px;
  background: #fff;          /* 线稿是透明/白底, 深色主题下必须垫白, 否则黑线看不见 */
  cursor: zoom-in;
}
.ai4-sol-legend {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.7;
  color: var(--text-secondary, #57534e);
}
.ai4-sol-legend b {
  display: inline-block;
  min-width: 17px; height: 17px; line-height: 17px;
  margin-right: 2px;
  text-align: center;
  border-radius: 50%;
  background: var(--text-secondary, #57534e);
  color: #fff;
  font-size: 11px; font-weight: 700;
}
.ai4-sol-disclaimer {
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-faint);
}
