/* MetaForge · 赛博朋克主题（霓虹网格 / 故障艺术 / 全息磨砂）
   性能约定：持续动画只使用 transform、opacity 与 background-position，
   避免大面积 filter / box-shadow 的关键帧动画，确保滚动与交互帧率稳定。 */

:root {
  /* 霓虹色板：荧光蓝 / 电光紫 / 霓虹粉 */
  --neon-cyan: #00eaff;
  --neon-blue: #2f7bff;
  --neon-purple: #9d5cff;
  --neon-pink: #ff2e88;
  --neon-green: #00ffa3;
  --neon-amber: #ffc857;

  --brand: #00eaff;
  --brand-strong: #00b9d6;
  --brand-soft: rgba(0, 234, 255, 0.1);
  --accent: #9d5cff;
  --accent-soft: #c7adff;

  --gradient: linear-gradient(105deg, #00eaff 0%, #7b5cff 52%, #ff2e88 100%);
  --gradient-soft: linear-gradient(135deg, rgba(0, 234, 255, 0.1), rgba(157, 92, 255, 0.1));

  /* 深色底：暗黑 / 深灰，留出霓虹对比空间 */
  --bg-page: #04060c;
  --bg-sidebar: rgba(6, 10, 18, 0.92);
  --bg-panel: rgba(10, 16, 27, 0.74);
  --bg-card: linear-gradient(158deg, rgba(13, 21, 35, 0.88), rgba(6, 10, 18, 0.72));
  --bg-canvas: #03050a;
  --bg-topbar: rgba(4, 8, 15, 0.84);
  --bg-composer: rgba(4, 7, 13, 0.9);
  --bg-hover: rgba(0, 234, 255, 0.07);
  --bg-active: rgba(0, 234, 255, 0.12);
  --modal-mask: rgba(2, 5, 10, 0.78);

  --text-main: #e6f7ff;
  --text-sub: #9fbdd1;
  --text-muted: #6a869c;
  --text-faint: #41536a;

  --border: rgba(0, 234, 255, 0.14);
  --border-strong: rgba(0, 234, 255, 0.32);
  --border-glow: rgba(0, 234, 255, 0.66);
  --border-pink: rgba(255, 46, 136, 0.42);
  /* 四角 HUD 括号颜色：暗色为荧光蓝，亮色单独覆盖为深青蓝 */
  --bracket-color: var(--neon-cyan);

  --user-bubble: linear-gradient(135deg, rgba(0, 234, 255, 0.2), rgba(123, 92, 255, 0.28) 55%, rgba(255, 46, 136, 0.2));
  --assistant-bubble: rgba(8, 14, 24, 0.78);
  --assistant-border: rgba(0, 234, 255, 0.16);

  --grid-line: rgba(0, 234, 255, 0.05);
  --scan-opacity: 0.16;

  --radius-sm: 3px;
  --radius-md: 5px;
  --radius-lg: 8px;
  --radius-xl: 10px;
  --radius-full: 999px;

  --font-ui: 'Segoe UI', 'Microsoft YaHei', 'PingFang SC', 'Hiragino Sans GB', sans-serif;
  --font-tech: 'Bahnschrift', 'DIN Alternate', 'Segoe UI', 'Microsoft YaHei', sans-serif;
  --font-mono: 'Cascadia Mono', 'Consolas', 'SFMono-Regular', 'Courier New', monospace;

  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.55), 0 0 24px rgba(0, 234, 255, 0.05);
  --shadow-lg: 0 24px 70px rgba(0, 0, 0, 0.7), 0 0 48px rgba(0, 234, 255, 0.07);
  --shadow-glow: 0 0 18px rgba(0, 234, 255, 0.35), 0 0 42px rgba(157, 92, 255, 0.16);

  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out-soft: cubic-bezier(0.22, 1, 0.36, 1);
}

/* 亮色主题：全息实验室风格，白底 + 高饱和霓虹描边，保持与暗色一致的赛博结构 */
html.light {
  /* 亮色下的霓虹改用高饱和深色描边，保证白底对比度 */
  --neon-cyan: #00a5c4;
  --neon-blue: #0369a1;
  --neon-purple: #7c3aed;
  --neon-pink: #db2777;
  --neon-green: #059669;
  --neon-amber: #b45309;

  --brand: #087f9c;
  --brand-strong: #066a82;
  --brand-soft: rgba(8, 127, 156, 0.08);
  --accent: #6d28d9;
  --accent-soft: #6d28d9;

  --gradient: linear-gradient(105deg, #0891b2 0%, #6d28d9 52%, #db2777 100%);
  --gradient-soft: linear-gradient(135deg, rgba(8, 145, 178, 0.1), rgba(109, 40, 217, 0.08));

  --bg-page: #eef6fa;
  --bg-sidebar: rgba(255, 255, 255, 0.9);
  --bg-panel: rgba(255, 255, 255, 0.82);
  --bg-card: linear-gradient(158deg, rgba(255, 255, 255, 0.96), rgba(238, 248, 252, 0.9));
  --bg-canvas: #f2f9fc;
  --bg-topbar: rgba(255, 255, 255, 0.8);
  --bg-composer: rgba(238, 246, 250, 0.92);
  --bg-hover: rgba(0, 150, 190, 0.07);
  --bg-active: rgba(0, 150, 190, 0.12);
  --modal-mask: rgba(6, 40, 58, 0.38);

  --text-main: #05202f;
  --text-sub: #1f4a60;
  --text-muted: #4f7288;
  --text-faint: #7f9cae;

  --border: rgba(0, 130, 165, 0.24);
  --border-strong: rgba(0, 130, 165, 0.42);
  --border-glow: rgba(0, 165, 200, 0.75);
  --border-pink: rgba(219, 39, 119, 0.4);

  --user-bubble: linear-gradient(135deg, rgba(8, 145, 178, 0.22), rgba(124, 58, 237, 0.2) 60%, rgba(219, 39, 119, 0.16));
  --assistant-bubble: rgba(255, 255, 255, 0.9);
  --assistant-border: rgba(0, 140, 175, 0.22);

  --grid-line: rgba(0, 130, 165, 0.09);
  --scan-opacity: 0.04;
  --bracket-color: rgba(0, 140, 175, 0.8);

  --shadow-sm: 0 1px 4px rgba(6, 45, 65, 0.1);
  --shadow-md: 0 10px 28px rgba(6, 45, 65, 0.12), 0 0 20px rgba(0, 165, 200, 0.08);
  --shadow-lg: 0 24px 60px rgba(6, 45, 65, 0.18), 0 0 36px rgba(0, 165, 200, 0.1);
  --shadow-glow: 0 0 20px rgba(0, 165, 200, 0.22), 0 0 40px rgba(124, 58, 237, 0.12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

/* 原生下拉框深色适配：
   原生 select 展开的列表会继承控件背景，半透明底色会合成出白底、浅色字看不见，
   这里统一声明 color-scheme 与不透明的选项底色，避免下拉时整片白色。 */
select {
  color-scheme: dark;
}

select option {
  background-color: #071019;
  color: #e6f7ff;
}

html.light select {
  color-scheme: light;
}

html.light select option {
  background-color: #ffffff;
  color: #10202c;
}

html,
body {
  height: 100%;
  margin: 0;
}

html {
  scrollbar-color: rgba(0, 234, 255, 0.35) transparent;
}

body {
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-main);
  background: radial-gradient(1100px 620px at 84% -12%, rgba(157, 92, 255, 0.16), transparent 62%),
    radial-gradient(920px 540px at 4% 108%, rgba(0, 234, 255, 0.12), transparent 60%),
    var(--bg-page);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* 全息网格背景 */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(ellipse 120% 90% at 50% 0%, #000 20%, transparent 78%);
  mask-image: radial-gradient(ellipse 120% 90% at 50% 0%, #000 20%, transparent 78%);
}

/* CRT 扫描线 */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: var(--scan-opacity);
  background: repeating-linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.55) 0px,
    rgba(0, 0, 0, 0.55) 1px,
    transparent 1px,
    transparent 3px
  );
}

html.light body {
  background: radial-gradient(1000px 560px at 86% -10%, rgba(124, 58, 237, 0.1), transparent 62%),
    radial-gradient(860px 520px at 2% 110%, rgba(0, 150, 200, 0.12), transparent 60%),
    var(--bg-page);
}

::selection {
  background: rgba(0, 234, 255, 0.3);
  color: #fff;
}

button,
textarea,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 1px solid var(--neon-cyan);
  outline-offset: 2px;
}

svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(0, 234, 255, 0.4), rgba(157, 92, 255, 0.4));
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(0, 234, 255, 0.7), rgba(255, 46, 136, 0.55));
}

.app {
  position: relative;
  z-index: 1;
  display: flex;
  height: 100vh;
  overflow: hidden;
  background: transparent;
}

/* ================= 侧栏 ================= */
.sidebar {
  width: 286px;
  flex: none;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(9, 14, 24, 0.96), rgba(5, 8, 15, 0.94));
  border-right: 1px solid var(--border);
  position: relative;
  z-index: 20;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

html.light .sidebar {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(238, 247, 251, 0.92));
}

/* 侧栏右侧霓虹光带 */
.sidebar::after {
  content: '';
  position: absolute;
  top: 0;
  right: -1px;
  width: 1px;
  height: 100%;
  pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(0, 234, 255, 0.5) 30%, rgba(255, 46, 136, 0.32) 68%, transparent);
  opacity: 0.55;
}

.sidebar-backdrop {
  display: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 14px;
}

.logo {
  width: 46px;
  height: 46px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  clip-path: polygon(25% 0, 100% 0, 100% 75%, 75% 100%, 0 100%, 0 25%);
  background: linear-gradient(135deg, #00eaff 0%, #7b5cff 55%, #ff2e88 100%);
  color: #020a10;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.5px;
  filter: drop-shadow(0 0 12px rgba(0, 234, 255, 0.42));
}

.brand-name {
  font-family: var(--font-tech);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 2.4px;
  text-transform: uppercase;
  color: var(--text-main);
}

.brand-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 2px;
}

.brand-sub::before {
  content: '// ';
  color: var(--neon-pink);
  opacity: 0.8;
}

/* 故障文字：仅悬停时触发，避免持续动画 */
.glitch {
  position: relative;
  display: inline-block;
}

.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

.glitch:hover::before {
  opacity: 0.85;
  color: var(--neon-pink);
  clip-path: inset(0 0 56% 0);
  animation: glitchSliceTop 0.42s steps(2, end) infinite;
}

.glitch:hover::after {
  opacity: 0.85;
  color: var(--neon-cyan);
  clip-path: inset(52% 0 0 0);
  animation: glitchSliceBottom 0.36s steps(2, end) infinite;
}

.new-chat {
  position: relative;
  margin: 10px 16px 16px;
  /* 固定块不参与 flex 压缩，短屏由侧栏滚动而不是裁切按钮 */
  flex: none;
  min-height: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid rgba(0, 234, 255, 0.55);
  background: linear-gradient(90deg, rgba(0, 234, 255, 0.16), rgba(157, 92, 255, 0.14) 55%, rgba(255, 46, 136, 0.12));
  color: #d9fbff;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 2px;
  clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px);
  overflow: hidden;
  filter: drop-shadow(0 0 8px rgba(0, 234, 255, 0.22));
  transition: filter var(--transition-fast), transform var(--transition-fast), background var(--transition-fast);
}

.new-chat::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(0, 234, 255, 0.35) 50%, transparent 80%);
  transform: translateX(-130%);
  transition: transform 0.5s var(--ease-out-soft);
}

.new-chat:hover {
  background: linear-gradient(90deg, rgba(0, 234, 255, 0.24), rgba(157, 92, 255, 0.2) 55%, rgba(255, 46, 136, 0.18));
  filter: drop-shadow(0 0 14px rgba(0, 234, 255, 0.5));
  transform: translateY(-1px);
}

.new-chat:hover::before {
  transform: translateX(130%);
}

.new-chat svg {
  width: 16px;
  height: 16px;
  stroke-width: 2.2;
}

html.light .new-chat {
  color: #06303d;
  border-color: rgba(0, 140, 180, 0.5);
  background: linear-gradient(90deg, rgba(0, 190, 220, 0.2), rgba(140, 92, 255, 0.14));
}

.side-section {
  padding: 8px 12px;
  min-height: 0;
}

.side-section.grow {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text-faint);
  text-transform: uppercase;
}

.section-title::before {
  content: '//';
  color: var(--neon-cyan);
  opacity: 0.55;
  letter-spacing: 0;
}

.count {
  margin-left: auto;
  font-size: 10.5px;
  color: var(--text-muted);
  letter-spacing: 0;
}

.quick-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  margin-bottom: 4px;
  border: 1px solid transparent;
  border-left: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  text-align: left;
  position: relative;
  transition: background var(--transition-fast), border-color var(--transition-fast),
    box-shadow var(--transition-fast);
}

.quick-item:hover {
  background: var(--bg-hover);
  border-color: var(--border);
  border-left-color: var(--neon-cyan);
  box-shadow: inset 0 0 18px rgba(0, 234, 255, 0.06);
}

.quick-icon,
.pc-icon {
  width: 34px;
  height: 34px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.4px;
  background: var(--gradient-soft);
  color: var(--accent-soft);
  border: 1px solid rgba(157, 92, 255, 0.24);
}

.quick-icon.erp,
.pc-icon.erp {
  background: rgba(0, 234, 255, 0.12);
  border-color: rgba(0, 234, 255, 0.35);
  color: #7df2ff;
}

.quick-icon.fin,
.pc-icon.fin {
  background: rgba(0, 255, 163, 0.1);
  border-color: rgba(0, 255, 163, 0.32);
  color: #6dffc4;
}

.quick-icon.mes,
.pc-icon.mes {
  background: rgba(255, 200, 87, 0.1);
  border-color: rgba(255, 200, 87, 0.32);
  color: #ffd77e;
}

.pc-icon.sync {
  background: rgba(157, 92, 255, 0.14);
  border-color: rgba(157, 92, 255, 0.4);
  color: #c9b3ff;
}

.pc-icon.data {
  background: rgba(255, 46, 136, 0.12);
  border-color: rgba(255, 46, 136, 0.36);
  color: #ff86b5;
}

.quick-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.quick-text b {
  font-size: 13px;
  font-weight: 650;
}

.quick-text small {
  font-size: 11px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-list {
  flex: 1;
  overflow-y: auto;
  padding: 2px 0;
}

.session-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  margin-bottom: 3px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  color: var(--text-sub);
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast),
    color var(--transition-fast);
}

.session-item:hover {
  background: var(--bg-hover);
  border-color: var(--border);
  color: var(--text-main);
}

.session-item.active {
  background: var(--bg-active);
  border-color: var(--border-strong);
  color: var(--text-main);
  box-shadow: inset 2px 0 0 var(--neon-cyan), inset 0 0 20px rgba(0, 234, 255, 0.05);
}

.session-dot {
  width: 6px;
  height: 6px;
  flex: none;
  border-radius: 50%;
  background: var(--text-faint);
}

.session-item.active .session-dot {
  background: var(--neon-cyan);
  box-shadow: 0 0 8px var(--neon-cyan), 0 0 0 3px rgba(0, 234, 255, 0.12);
}

.session-name {
  flex: 1;
  min-width: 0;
  font-size: 12.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-del {
  opacity: 0;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
  transition: opacity var(--transition-fast), color var(--transition-fast);
}

.session-item:hover .session-del {
  opacity: 1;
}

.session-del:hover {
  color: var(--neon-pink);
}

.session-empty,
.agent-empty {
  padding: 10px 12px;
  font-size: 12px;
  color: var(--text-faint);
  font-family: var(--font-mono);
  letter-spacing: 0.5px;
}

.agent-list {
  max-height: 170px;
  overflow-y: auto;
}

.agent-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.agent-item:hover {
  background: var(--bg-hover);
  border-color: var(--border);
}

.agent-avatar {
  width: 28px;
  height: 28px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  clip-path: polygon(5px 0, 100% 0, 100% calc(100% - 5px), calc(100% - 5px) 100%, 0 100%, 0 5px);
  background: rgba(157, 92, 255, 0.16);
  border: 1px solid rgba(157, 92, 255, 0.3);
  color: var(--accent-soft);
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 800;
}

.agent-meta {
  min-width: 0;
  flex: 1;
}

.agent-name {
  font-size: 12.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

.status-dot {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--neon-green);
  box-shadow: 0 0 8px rgba(0, 255, 163, 0.7);
}

.status-dot.frozen {
  background: var(--neon-amber);
  box-shadow: 0 0 8px rgba(255, 200, 87, 0.7);
}

.status-dot.archived {
  background: var(--text-faint);
  box-shadow: none;
}

.userbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--border);
  /* 固定在内容流末尾：短屏下侧栏整体滚动，避免吸底遮住上方菜单/列表 */
  flex: none;
  position: relative;
}

html.light .userbar {
  background: rgba(255, 255, 255, 0.96);
}

.avatar {
  width: 34px;
  height: 34px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #00eaff, #7b5cff);
  color: #031018;
  font-family: var(--font-mono);
  font-weight: 800;
  box-shadow: 0 0 0 1px rgba(0, 234, 255, 0.4), 0 0 14px rgba(0, 234, 255, 0.28);
}

.user-meta {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: 12.5px;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-role {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.ghost-btn {
  border: 1px solid var(--border);
  background: rgba(0, 234, 255, 0.03);
  color: var(--text-sub);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1px;
  transition: border-color var(--transition-fast), color var(--transition-fast),
    box-shadow var(--transition-fast);
}

.ghost-btn:hover {
  border-color: var(--border-glow);
  color: var(--neon-cyan);
  box-shadow: 0 0 12px rgba(0, 234, 255, 0.2);
}

/* ================= 主区 ================= */
.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

/* 数字雨画布：低透明度，限帧绘制 */
.fx-rain {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  opacity: 0.16;
  pointer-events: none;
}

html.light .fx-rain {
  display: none;
}

/* 滚动数据流：随滚动位移的背景光带 */
.fx-stream {
  --stream-y: 0px;
  position: absolute;
  top: 0;
  right: 10px;
  width: 2px;
  height: 100%;
  z-index: 1;
  pointer-events: none;
  opacity: 0.45;
  background: repeating-linear-gradient(
    180deg,
    transparent 0px,
    transparent 58px,
    rgba(0, 234, 255, 0.6) 58px,
    rgba(0, 234, 255, 0.6) 96px,
    rgba(255, 46, 136, 0.35) 96px,
    rgba(255, 46, 136, 0.35) 104px,
    transparent 104px,
    transparent 188px
  );
  background-position-y: calc(var(--stream-y) * -1);
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 18%, #000 82%, transparent);
  mask-image: linear-gradient(180deg, transparent, #000 18%, #000 82%, transparent);
}

html.light .fx-stream {
  opacity: 0.22;
}

/* HUD 取景框：四角全息标记 */
.hud-frame {
  position: absolute;
  inset: 14px;
  z-index: 2;
  pointer-events: none;
}

.hud-frame i {
  position: absolute;
  width: 22px;
  height: 22px;
  border: 0 solid rgba(0, 234, 255, 0.32);
}

.hud-frame i:nth-child(1) {
  top: 0;
  left: 0;
  border-top-width: 1px;
  border-left-width: 1px;
}

.hud-frame i:nth-child(2) {
  top: 0;
  right: 0;
  border-top-width: 1px;
  border-right-width: 1px;
}

.hud-frame i:nth-child(3) {
  bottom: 0;
  left: 0;
  border-bottom-width: 1px;
  border-left-width: 1px;
}

.hud-frame i:nth-child(4) {
  bottom: 0;
  right: 0;
  border-bottom-width: 1px;
  border-right-width: 1px;
}

.orbs {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.orb {
  position: absolute;
  border-radius: 50%;
  opacity: 0.55;
  animation: floatOrb 26s ease-in-out infinite;
  will-change: transform;
}

.orb-1 {
  width: 520px;
  height: 520px;
  top: -190px;
  right: -120px;
  background: radial-gradient(circle, rgba(157, 92, 255, 0.3), transparent 66%);
}

.orb-2 {
  width: 420px;
  height: 420px;
  bottom: -170px;
  left: -120px;
  background: radial-gradient(circle, rgba(0, 234, 255, 0.2), transparent 66%);
  animation-direction: reverse;
}

.orb-3 {
  width: 340px;
  height: 340px;
  top: 42%;
  left: 40%;
  background: radial-gradient(circle, rgba(255, 46, 136, 0.12), transparent 68%);
  animation-duration: 34s;
}

html.light .orb {
  opacity: 0.4;
}

.topbar {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 62px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-topbar);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  overflow: hidden;
}

/* 顶部扫描光束 */
.topbar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 150px;
  height: 100%;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(0, 234, 255, 0.08), transparent);
  animation: scanBeam 7.5s linear infinite;
  will-change: transform;
}

/* 顶部霓虹分隔线 */
.topbar::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(0, 234, 255, 0.55), rgba(255, 46, 136, 0.35), transparent);
  opacity: 0.7;
}

.menu-btn {
  display: none;
}

.icon-btn {
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-sub);
  border-radius: var(--radius-sm);
  padding: 6px 9px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast), color var(--transition-fast),
    border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.icon-btn:hover {
  background: var(--bg-hover);
  color: var(--neon-cyan);
  border-color: var(--border);
  box-shadow: 0 0 12px rgba(0, 234, 255, 0.16);
}

.top-title {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
}

.top-title span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-title .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--neon-cyan);
  box-shadow: 0 0 8px var(--neon-cyan), 0 0 18px rgba(0, 234, 255, 0.55);
  animation: pulseDot 2.4s ease-in-out infinite;
}

.agent-badge {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(157, 92, 255, 0.4);
  background: rgba(157, 92, 255, 0.1);
  color: var(--accent-soft);
  font-weight: 650;
  letter-spacing: 0.5px;
  clip-path: polygon(5px 0, 100% 0, 100% calc(100% - 5px), calc(100% - 5px) 100%, 0 100%, 0 5px);
}

/* HUD 状态指示 */
.hud-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: 4px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 1.6px;
  color: var(--text-faint);
}

.hud-bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 12px;
}

.hud-bars i {
  width: 3px;
  background: var(--neon-cyan);
  box-shadow: 0 0 6px rgba(0, 234, 255, 0.7);
  animation: barPulse 1.8s ease-in-out infinite;
}

.hud-bars i:nth-child(1) {
  height: 4px;
  animation-delay: 0s;
}

.hud-bars i:nth-child(2) {
  height: 7px;
  animation-delay: 0.2s;
}

.hud-bars i:nth-child(3) {
  height: 10px;
  animation-delay: 0.4s;
}

.hud-bars i:nth-child(4) {
  height: 12px;
  animation-delay: 0.6s;
}

.top-actions {
  margin-left: auto;
  display: flex;
  gap: 4px;
}

.chat-list {
  position: relative;
  z-index: 1;
  flex: 1;
  overflow-y: auto;
  padding: 26px 30px 12px;
  scroll-behavior: smooth;
}

/* 页面切换故障转场 */
.chat-list.glitch-in {
  animation: screenGlitch 0.45s steps(3, end) both;
}

.messages {
  max-width: 920px;
  margin: 0 auto;
}

/* ================= 欢迎页 ================= */
.welcome {
  max-width: 820px;
  margin: 5vh auto 0;
  text-align: center;
  animation: fadeInUp 0.45s var(--ease-out-soft);
}

.welcome-mark {
  width: 68px;
  height: 68px;
  margin: 0 auto 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  clip-path: polygon(25% 0, 100% 0, 100% 75%, 75% 100%, 0 100%, 0 25%);
  background: linear-gradient(135deg, #00eaff 0%, #7b5cff 55%, #ff2e88 100%);
  color: #020a10;
  font-family: var(--font-mono);
  font-size: 21px;
  font-weight: 800;
  filter: drop-shadow(0 0 16px rgba(0, 234, 255, 0.35));
}

.boot-line {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 20px;
  padding: 4px 12px;
  border: 1px solid var(--border);
  background: rgba(0, 234, 255, 0.04);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1.8px;
  color: var(--text-muted);
}

.boot-tag {
  padding: 0 6px;
  background: var(--neon-cyan);
  color: #031018;
  font-weight: 800;
  letter-spacing: 1px;
}

.welcome h1 {
  font-family: var(--font-tech);
  font-size: 30px;
  font-weight: 700;
  margin: 0 0 10px;
  letter-spacing: 1px;
}

.welcome-sub {
  margin: 0 0 30px;
  color: var(--text-muted);
  font-size: 14px;
  letter-spacing: 0.3px;
}

.gradient-text {
  background: var(--gradient);
  background-size: 220% 220%;
  animation: gradientShift 6s ease infinite;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.prompt-grid {
  counter-reset: promptCard;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.prompt-card {
  position: relative;
  text-align: left;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text-main);
  overflow: hidden;
  transition: transform var(--transition-fast) var(--ease-spring),
    box-shadow var(--transition), border-color var(--transition);
  animation: fadeInUp 0.5s var(--ease-out-soft) backwards;
}

/* 四角全息括号 */
.prompt-card::before,
.source-card::before,
.plan-card::before,
.modal-card::before,
.input-box::before {
  content: '';
  position: absolute;
  inset: 6px;
  pointer-events: none;
  opacity: 0.55;
  transition: opacity var(--transition-fast);
  background-image: linear-gradient(var(--bracket-color), var(--bracket-color)),
    linear-gradient(var(--bracket-color), var(--bracket-color)),
    linear-gradient(var(--bracket-color), var(--bracket-color)),
    linear-gradient(var(--bracket-color), var(--bracket-color)),
    linear-gradient(var(--bracket-color), var(--bracket-color)),
    linear-gradient(var(--bracket-color), var(--bracket-color)),
    linear-gradient(var(--bracket-color), var(--bracket-color)),
    linear-gradient(var(--bracket-color), var(--bracket-color));
  background-repeat: no-repeat;
  background-size: 12px 1px, 1px 12px, 12px 1px, 1px 12px, 12px 1px, 1px 12px, 12px 1px, 1px 12px;
  background-position: left top, left top, right top, right top, left bottom, left bottom, right bottom,
    right bottom;
}

.prompt-card::after {
  counter-increment: promptCard;
  content: '0' counter(promptCard);
  position: absolute;
  top: 12px;
  right: 16px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--text-faint);
  opacity: 0.8;
}

.prompt-card:nth-child(2) {
  animation-delay: 0.06s;
}

.prompt-card:nth-child(3) {
  animation-delay: 0.12s;
}

.prompt-card:nth-child(4) {
  animation-delay: 0.18s;
}

.prompt-card:nth-child(5) {
  animation-delay: 0.24s;
}

.prompt-card:hover {
  transform: translateY(-4px);
  border-color: rgba(0, 234, 255, 0.55);
  box-shadow: 0 0 0 1px rgba(0, 234, 255, 0.12), 0 12px 34px rgba(0, 0, 0, 0.55),
    0 0 30px rgba(0, 234, 255, 0.16);
}

.prompt-card:hover::before {
  opacity: 1;
}

.prompt-card:hover .pc-title {
  animation: textGlitch 0.36s steps(2, end);
}

.pc-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 9px;
}

.pc-icon {
  width: 32px;
  height: 32px;
}

.pc-title {
  font-family: var(--font-tech);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.6px;
}

.pc-desc {
  display: block;
  font-size: 12.5px;
  color: var(--text-sub);
  line-height: 1.6;
}

.welcome-features {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 26px;
}

.welcome-features span {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1.2px;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: rgba(0, 234, 255, 0.03);
}

/* ================= 消息 ================= */
.msg {
  display: flex;
  gap: 10px;
  margin-bottom: 22px;
  animation: fadeInUp 0.25s var(--ease-out-soft);
}

.msg.user {
  justify-content: flex-end;
}

.msg-avatar {
  width: 34px;
  height: 34px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  clip-path: polygon(7px 0, 100% 0, 100% calc(100% - 7px), calc(100% - 7px) 100%, 0 100%, 0 7px);
  background: linear-gradient(135deg, #00eaff, #7b5cff);
  color: #020a10;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 800;
  filter: drop-shadow(0 0 8px rgba(0, 234, 255, 0.35));
}

.msg-body {
  max-width: min(760px, 82%);
  min-width: 0;
}

.msg.user .msg-body {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.bubble {
  padding: 13px 17px;
  border-radius: 2px var(--radius-lg) var(--radius-lg) var(--radius-lg);
  background: var(--assistant-bubble);
  border: 1px solid var(--assistant-border);
  border-left: 2px solid rgba(0, 234, 255, 0.45);
  color: var(--text-main);
  font-size: 14px;
  line-height: 1.75;
  word-break: break-word;
  box-shadow: var(--shadow-sm), inset 0 0 24px rgba(0, 234, 255, 0.02);
}

.msg.user .bubble {
  background: var(--user-bubble);
  border: 1px solid rgba(0, 234, 255, 0.32);
  color: #f2fdff;
  border-radius: var(--radius-lg) 2px var(--radius-lg) var(--radius-lg);
  box-shadow: 0 0 20px rgba(157, 92, 255, 0.16), inset 0 0 22px rgba(0, 234, 255, 0.06);
}

html.light .msg.user .bubble {
  color: var(--text-main);
  border-color: rgba(0, 150, 200, 0.34);
}

.bubble p {
  margin: 0 0 8px;
}

.bubble p:last-child {
  margin-bottom: 0;
}

.bubble h1,
.bubble h2,
.bubble h3 {
  margin: 14px 0 8px;
  font-family: var(--font-tech);
  font-size: 16px;
  font-weight: 750;
  letter-spacing: 0.4px;
}

.bubble h1:first-child,
.bubble h2:first-child,
.bubble h3:first-child {
  margin-top: 0;
}

.bubble ul,
.bubble ol {
  margin: 6px 0 10px;
  padding-left: 22px;
}

.bubble li {
  margin: 3px 0;
}

.bubble code {
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  background: rgba(0, 234, 255, 0.1);
  border: 1px solid rgba(0, 234, 255, 0.14);
  color: #9df4ff;
  font-family: var(--font-mono);
  font-size: 12.5px;
}

.msg.user .bubble code {
  background: rgba(2, 12, 20, 0.4);
  border-color: rgba(0, 234, 255, 0.3);
  color: #dffaff;
}

.bubble pre {
  margin: 10px 0;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-canvas);
  border: 1px solid var(--border);
  border-left: 2px solid rgba(0, 234, 255, 0.4);
  overflow-x: auto;
}

.bubble pre code {
  padding: 0;
  background: transparent;
  border: none;
  color: var(--text-sub);
}

.bubble table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0;
  font-size: 13px;
}

.bubble th,
.bubble td {
  border: 1px solid var(--border);
  padding: 7px 10px;
  text-align: left;
}

.bubble th {
  background: var(--bg-hover);
  color: var(--text-sub);
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.5px;
  font-weight: 650;
}

.bubble blockquote {
  margin: 8px 0;
  padding: 8px 12px;
  border-left: 2px solid var(--neon-pink);
  background: rgba(255, 46, 136, 0.06);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  color: var(--text-sub);
}

.msg-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin-top: 7px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.msg.user .msg-meta {
  justify-content: flex-end;
}

/* 对话日期分割线：日期文字居中，两侧渐隐横线 */
.chat-date {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 2px 0 18px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.4px;
  user-select: none;
}

.chat-date::before,
.chat-date::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-strong), transparent);
}

.aw-date {
  margin: 0 0 2px;
}

.msg-time {
  margin-left: 2px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.3px;
  color: var(--text-muted);
  opacity: 0.85;
  white-space: nowrap;
}

.intent-chip {
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-hover);
  border: 1px solid var(--border);
  font-weight: 650;
}

.intent-chip.FORGE {
  color: #c9b3ff;
  border-color: rgba(157, 92, 255, 0.45);
}

.intent-chip.PROXY {
  color: #7df2ff;
  border-color: rgba(0, 234, 255, 0.45);
}

.intent-chip.ORCHESTRATE {
  color: #ffd77e;
  border-color: rgba(255, 200, 87, 0.45);
}

.intent-chip.CONFIRM {
  color: #6dffc4;
  border-color: rgba(0, 255, 163, 0.45);
}

.intent-chip.NAVIGATE {
  color: #7df2ff;
  border-color: rgba(0, 234, 255, 0.45);
}

/* 推荐选项卡：锻造完成 / 对话跳转后的可继续操作 */
.msg-recommend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 9px;
}

.mr-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}

.mr-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mr-tab {
  padding: 5px 10px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-full);
  background: rgba(0, 234, 255, 0.04);
  color: var(--text-sub);
  font-size: 11px;
  cursor: pointer;
  transition:
    color var(--transition-fast),
    border-color var(--transition-fast),
    background var(--transition-fast),
    transform var(--transition-fast);
}

.mr-tab:hover {
  color: var(--text-main);
  border-color: rgba(0, 234, 255, 0.45);
  background: rgba(0, 234, 255, 0.09);
  transform: translateY(-1px);
}

.mr-tab.primary {
  border-style: solid;
  border-color: rgba(0, 234, 255, 0.45);
  color: #7df2ff;
}

/* 计划卡片 */
.plan-card {
  position: relative;
  margin-top: 10px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(157, 92, 255, 0.45);
  background: linear-gradient(135deg, rgba(157, 92, 255, 0.14), rgba(0, 234, 255, 0.06));
  padding: 13px 15px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 0 22px rgba(157, 92, 255, 0.12);
}

.plan-info {
  flex: 1;
  min-width: 0;
}

.plan-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-main);
}

.plan-id {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

.plan-actions {
  display: flex;
  gap: 8px;
  flex: none;
}

.primary-btn,
.danger-btn {
  border: none;
  border-radius: var(--radius-sm);
  padding: 7px 13px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.8px;
  transition: transform var(--transition-fast), opacity var(--transition-fast),
    filter var(--transition-fast), box-shadow var(--transition-fast);
}

.primary-btn {
  background: linear-gradient(105deg, #00eaff, #7b5cff 60%, #ff2e88);
  color: #031018;
  clip-path: polygon(7px 0, 100% 0, 100% calc(100% - 7px), calc(100% - 7px) 100%, 0 100%, 0 7px);
  filter: drop-shadow(0 0 8px rgba(0, 234, 255, 0.28));
}

.danger-btn {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text-sub);
}

.primary-btn:hover {
  filter: drop-shadow(0 0 13px rgba(0, 234, 255, 0.5));
  transform: translateY(-1px);
}

.danger-btn:hover {
  border-color: var(--border-pink);
  color: var(--neon-pink);
  box-shadow: 0 0 12px rgba(255, 46, 136, 0.18);
  transform: translateY(-1px);
}

.primary-btn:disabled,
.danger-btn:disabled {
  opacity: 0.5;
  cursor: default;
  transform: none;
  filter: none;
}

/* ================= 数据源建模卡片 ================= */
.source-card {
  position: relative;
  margin-top: 10px;
  padding: 15px 17px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glow);
  background: linear-gradient(160deg, rgba(0, 234, 255, 0.08), rgba(157, 92, 255, 0.05));
  box-shadow: 0 0 26px rgba(0, 234, 255, 0.1);
  max-width: 100%;
}

.source-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.source-title {
  font-family: var(--font-tech);
  font-size: 13px;
  font-weight: 750;
  letter-spacing: 0.8px;
  color: var(--text-main);
}

.source-sub {
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-muted);
}

.source-tag {
  flex: none;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(0, 255, 163, 0.35);
  background: rgba(0, 255, 163, 0.1);
  color: #6dffc4;
}

.source-tables {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.source-table {
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: rgba(3, 8, 15, 0.5);
}

html.light .source-table {
  background: rgba(240, 248, 252, 0.7);
}

.st-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
}

.st-head b {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--neon-cyan);
  letter-spacing: 0.5px;
}

.st-head span {
  font-size: 10.5px;
  color: var(--text-muted);
}

.st-cols {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.col-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  color: var(--text-sub);
  background: var(--bg-panel);
}

.col-chip em {
  font-style: normal;
  font-size: 9px;
  letter-spacing: 0.3px;
  color: var(--text-faint);
}

.st-sample {
  margin-top: 9px;
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.st-sample table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 10px;
  white-space: nowrap;
}

.st-sample th,
.st-sample td {
  padding: 5px 8px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  color: var(--text-sub);
}

.st-sample th {
  color: var(--text-muted);
  font-weight: 650;
  background: var(--bg-panel);
}

.st-sample tr:last-child td {
  border-bottom: none;
}

.st-warnings {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--neon-amber);
}

.source-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.source-name {
  flex: 1;
  min-width: 180px;
  height: 34px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-panel);
  color: var(--text-main);
  font-size: 12px;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.source-name:focus {
  border-color: var(--border-glow);
  box-shadow: 0 0 14px rgba(0, 234, 255, 0.16);
}

.source-discarded {
  font-size: 11.5px;
  color: var(--text-muted);
}

.typing {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 2px 0 16px 44px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.6px;
  color: var(--text-muted);
}

.typing-dots {
  display: inline-flex;
  gap: 4px;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--neon-cyan);
  box-shadow: 0 0 6px rgba(0, 234, 255, 0.6);
  animation: dotBounce 1.2s ease-in-out infinite;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.15s;
}

.typing-dots span:nth-child(3) {
  animation-delay: 0.3s;
}

/* ================= 输入区 ================= */
.composer {
  position: relative;
  z-index: 2;
  flex: none;
  padding: 10px 24px 18px;
  background: linear-gradient(180deg, transparent, var(--bg-composer) 46%);
}

.composer-inner {
  max-width: 920px;
  margin: 0 auto;
}

.input-box {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(0, 234, 255, 0.24);
  background: var(--bg-panel);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: inset 0 0 24px rgba(0, 234, 255, 0.04), var(--shadow-sm);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.input-box:focus-within {
  border-color: var(--border-glow);
  box-shadow: 0 0 0 1px rgba(0, 234, 255, 0.16), 0 0 28px rgba(0, 234, 255, 0.16),
    inset 0 0 30px rgba(0, 234, 255, 0.06);
}

.input-box:focus-within::before {
  opacity: 1;
}

.input-box textarea {
  flex: 1;
  min-height: 28px;
  max-height: 160px;
  resize: none;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text-main);
  line-height: 1.65;
  padding: 4px 2px;
}

.input-box textarea::placeholder {
  color: var(--text-faint);
}

.attach-btn {
  width: 34px;
  height: 34px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  transition: color var(--transition-fast), border-color var(--transition-fast),
    background var(--transition-fast), box-shadow var(--transition-fast);
}

.attach-btn:hover {
  color: var(--neon-cyan);
  border-color: var(--border-glow);
  background: rgba(0, 234, 255, 0.08);
  box-shadow: 0 0 12px rgba(0, 234, 255, 0.2);
}

.attach-btn svg {
  width: 17px;
  height: 17px;
  stroke-width: 1.9;
}

.send-btn {
  width: 40px;
  height: 40px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #00eaff, #7b5cff 60%, #ff2e88);
  color: #031018;
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
  filter: drop-shadow(0 0 9px rgba(0, 234, 255, 0.35));
  transition: transform var(--transition-fast), opacity var(--transition-fast),
    filter var(--transition-fast);
}

.send-btn:hover:not(:disabled) {
  transform: translateY(-1px) scale(1.03);
  filter: drop-shadow(0 0 16px rgba(0, 234, 255, 0.55));
}

.send-btn:disabled {
  opacity: 0.38;
  cursor: default;
  filter: none;
}

.send-btn svg {
  width: 19px;
  height: 19px;
  fill: currentColor;
  stroke: none;
}

.composer-hint {
  margin-top: 7px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.8px;
  color: var(--text-faint);
}

/* ================= 弹窗 / 提示 ================= */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--modal-mask);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.modal[hidden] {
  display: none;
}

.modal-card {
  position: relative;
  width: min(420px, 90vw);
  padding: 24px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(0, 234, 255, 0.3);
  background: linear-gradient(165deg, rgba(11, 18, 30, 0.97), rgba(5, 9, 16, 0.97));
  box-shadow: 0 0 0 1px rgba(0, 234, 255, 0.06), var(--shadow-lg);
  animation: glitchIn 0.32s steps(3, end) both;
}

html.light .modal-card {
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.98), rgba(240, 248, 252, 0.98));
}

.modal-card::before {
  inset: 8px;
  opacity: 0.6;
}

.modal-card h3 {
  margin: 0 0 8px;
  font-family: var(--font-tech);
  font-size: 17px;
  letter-spacing: 0.8px;
}

.modal-card p {
  margin: 0 0 14px;
  font-size: 12.5px;
  color: var(--text-sub);
}

.modal-card p code {
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  background: rgba(0, 234, 255, 0.1);
  color: var(--neon-cyan);
  font-family: var(--font-mono);
  font-size: 11.5px;
}

.modal-card input {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-canvas);
  color: var(--text-main);
  font-family: var(--font-mono);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.modal-card input:focus {
  border-color: var(--border-glow);
  box-shadow: 0 0 16px rgba(0, 234, 255, 0.16);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

/* ================= 知识库（RAG）弹窗 ================= */
.rag-card {
  width: min(780px, 94vw);
  max-height: 86vh;
  overflow-y: auto;
}

.rag-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.rag-head h3 {
  margin: 0 0 4px;
}

.rag-sub {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.rag-tip {
  margin: 10px 0 14px;
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--text-muted);
}

.rag-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.rag-stats {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.4px;
  color: var(--text-muted);
}

.rag-progress {
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: rgba(0, 234, 255, 0.07);
  border: 1px solid var(--border-glow);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--neon-cyan);
}

.rag-docs {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rag-empty {
  padding: 18px 14px;
  border-radius: var(--radius-md);
  border: 1px dashed var(--border-strong);
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}

.rag-doc {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-hover);
}

.rag-doc-icon {
  width: 34px;
  height: 34px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  clip-path: polygon(5px 0, 100% 0, 100% calc(100% - 5px), calc(100% - 5px) 100%, 0 100%, 0 5px);
  background: rgba(0, 255, 163, 0.1);
  border: 1px solid rgba(0, 255, 163, 0.32);
  color: #6dffc4;
  font-family: var(--font-mono);
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.rag-doc-meta {
  flex: 1;
  min-width: 0;
}

.rag-doc-name {
  font-size: 12.5px;
  font-weight: 650;
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rag-doc-sub {
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

.rag-doc-del {
  flex: none;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 5px 9px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.rag-doc-del:hover {
  color: var(--neon-pink);
  border-color: var(--border-pink);
}

.rag-search {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.modal-card .rag-search input {
  flex: 1;
  width: auto;
  padding: 9px 12px;
}

.rag-results {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.rag-hit {
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  border-left: 2px solid rgba(0, 234, 255, 0.4);
  background: rgba(3, 8, 15, 0.55);
}

html.light .rag-hit {
  background: rgba(255, 255, 255, 0.7);
}

.rag-hit-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

.rag-hit-head b {
  color: var(--neon-cyan);
  font-size: 11px;
  letter-spacing: 0.4px;
}

.rag-hit-text {
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.75;
  color: var(--text-sub);
  white-space: pre-wrap;
}

.toast-wrap {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  min-width: 220px;
  max-width: 360px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  border-left: 2px solid var(--neon-cyan);
  background: var(--bg-panel);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.3px;
  box-shadow: 0 0 20px rgba(0, 234, 255, 0.14), var(--shadow-md);
  animation: fadeInUp 0.25s var(--ease-out-soft);
}

.toast.error {
  border-color: var(--border-pink);
  border-left-color: var(--neon-pink);
  color: #ffa9c8;
  box-shadow: 0 0 20px rgba(255, 46, 136, 0.18), var(--shadow-md);
}

/* ================= 亮色主题赛博强化 =================
   仅在 html.light 下生效，暗色模式规则保持不变；
   通过高饱和霓虹描边 + 彩色光晕 + 几何纹理，避免白底发灰和风格割裂。 */

/* 背景：冰白全息网格 + 斜向电路纹理 + 双色光晕 */
html.light body {
  background: radial-gradient(1000px 560px at 88% -8%, rgba(124, 58, 237, 0.14), transparent 62%),
    radial-gradient(880px 520px at 0% 108%, rgba(0, 165, 200, 0.18), transparent 60%),
    repeating-linear-gradient(
      135deg,
      rgba(0, 130, 165, 0.045) 0px,
      rgba(0, 130, 165, 0.045) 1px,
      transparent 1px,
      transparent 22px
    ),
    var(--bg-page);
}

/* 亮色下让网格延伸到整页，避免滚动后只剩纯白底 */
html.light body::before {
  -webkit-mask-image: radial-gradient(ellipse 150% 130% at 50% 0%, #000 30%, rgba(0, 0, 0, 0.5) 72%, transparent 100%);
  mask-image: radial-gradient(ellipse 150% 130% at 50% 0%, #000 30%, rgba(0, 0, 0, 0.5) 72%, transparent 100%);
}

/* 侧栏与顶栏 */
html.light .sidebar {
  border-right-color: rgba(0, 150, 190, 0.28);
  box-shadow: 12px 0 36px rgba(6, 45, 65, 0.06);
}

html.light .sidebar::after {
  background: linear-gradient(180deg, transparent, rgba(0, 165, 200, 0.75) 30%, rgba(219, 39, 119, 0.45) 68%, transparent);
  opacity: 0.75;
}

html.light .section-title {
  color: var(--text-muted);
}

html.light .section-title::before {
  opacity: 0.85;
}

html.light .new-chat {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(100deg, #0891b2, #6d28d9 58%, #db2777);
  filter: drop-shadow(0 4px 12px rgba(8, 145, 178, 0.35));
}

html.light .new-chat::before {
  background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, 0.45) 50%, transparent 80%);
}

html.light .new-chat:hover {
  filter: drop-shadow(0 6px 20px rgba(109, 40, 217, 0.45));
}

html.light .logo,
html.light .welcome-mark,
html.light .msg-avatar,
html.light .avatar {
  background: var(--gradient);
  color: #fff;
}

html.light .logo {
  filter: drop-shadow(0 0 10px rgba(8, 145, 178, 0.35));
}

html.light .welcome-mark {
  filter: drop-shadow(0 0 14px rgba(8, 145, 178, 0.3));
}

html.light .msg-avatar {
  filter: drop-shadow(0 0 8px rgba(8, 145, 178, 0.3));
}

html.light .avatar {
  box-shadow: 0 0 0 1px rgba(8, 145, 178, 0.35), 0 0 14px rgba(8, 145, 178, 0.22);
}

html.light .topbar {
  border-bottom-color: rgba(0, 150, 190, 0.22);
  box-shadow: 0 8px 24px rgba(6, 45, 65, 0.05);
}

html.light .topbar::before {
  background: linear-gradient(90deg, transparent, rgba(0, 165, 200, 0.18), transparent);
}

html.light .topbar::after {
  background: linear-gradient(90deg, transparent, rgba(0, 150, 190, 0.8), rgba(219, 39, 119, 0.5), transparent);
  opacity: 1;
}

html.light .top-title .dot {
  background: #0891b2;
  box-shadow: 0 0 8px rgba(8, 145, 178, 0.85), 0 0 16px rgba(8, 145, 178, 0.35);
}

html.light .icon-btn:hover {
  color: #087f9c;
  border-color: rgba(0, 150, 190, 0.3);
  background: rgba(0, 165, 200, 0.08);
  box-shadow: 0 0 12px rgba(0, 165, 200, 0.18);
}

html.light .ghost-btn {
  background: rgba(255, 255, 255, 0.7);
}

html.light .ghost-btn:hover {
  color: #087f9c;
  box-shadow: 0 0 12px rgba(0, 165, 200, 0.18);
}

html.light .agent-badge {
  background: rgba(109, 40, 217, 0.12);
  border-color: rgba(109, 40, 217, 0.42);
  color: #5b21b6;
}

html.light .hud-status {
  color: var(--text-muted);
}

html.light .hud-bars i {
  background: #0891b2;
  box-shadow: 0 0 6px rgba(8, 145, 178, 0.75);
}

html.light .fx-stream {
  opacity: 0.38;
}

html.light .hud-frame i {
  border-color: rgba(0, 140, 175, 0.45);
}

/* 快速铸造图标：亮色下提升饱和度与对比度 */
html.light .quick-icon,
html.light .pc-icon {
  background: rgba(109, 40, 217, 0.1);
  border-color: rgba(109, 40, 217, 0.35);
  color: #5b21b6;
}

html.light .quick-icon.erp,
html.light .pc-icon.erp {
  background: rgba(8, 145, 178, 0.14);
  border-color: rgba(8, 145, 178, 0.45);
  color: #087f9c;
}

html.light .quick-icon.fin,
html.light .pc-icon.fin {
  background: rgba(5, 150, 105, 0.12);
  border-color: rgba(5, 150, 105, 0.4);
  color: #047857;
}

html.light .quick-icon.mes,
html.light .pc-icon.mes {
  background: rgba(180, 83, 9, 0.12);
  border-color: rgba(180, 83, 9, 0.38);
  color: #a16207;
}

html.light .pc-icon.sync {
  background: rgba(109, 40, 217, 0.12);
  border-color: rgba(109, 40, 217, 0.4);
  color: #6d28d9;
}

html.light .pc-icon.data {
  background: rgba(219, 39, 119, 0.1);
  border-color: rgba(219, 39, 119, 0.4);
  color: #be185d;
}

/* 欢迎页 */
html.light .boot-line {
  background: rgba(0, 165, 200, 0.08);
  border-color: rgba(0, 150, 190, 0.32);
  color: #2c5b70;
}

html.light .boot-tag {
  background: linear-gradient(100deg, #0891b2, #6d28d9);
  color: #fff;
}

html.light .welcome-features span {
  background: rgba(255, 255, 255, 0.78);
  border-color: rgba(0, 140, 175, 0.26);
  color: #2c5b70;
}

/* 提示卡片：白玻璃 + 全息渐变微光 */
html.light .prompt-card {
  background: linear-gradient(125deg, rgba(0, 165, 200, 0.06), rgba(255, 255, 255, 0) 42%, rgba(219, 39, 119, 0.045)),
    rgba(255, 255, 255, 0.9);
  border-color: rgba(0, 140, 175, 0.26);
  box-shadow: 0 2px 8px rgba(6, 45, 65, 0.06);
}

html.light .prompt-card:hover {
  border-color: rgba(0, 165, 200, 0.7);
  box-shadow: 0 12px 32px rgba(6, 45, 65, 0.14), 0 0 26px rgba(0, 165, 200, 0.2);
}

html.light .prompt-card::after {
  color: rgba(8, 80, 105, 0.55);
}

html.light .pc-title {
  color: #05202f;
}

html.light .pc-desc {
  color: var(--text-sub);
}

/* 消息气泡 */
html.light .bubble {
  border-left-color: rgba(0, 165, 200, 0.65);
  box-shadow: 0 4px 16px rgba(6, 45, 65, 0.06);
}

html.light .msg.user .bubble {
  color: #05202f;
  border-color: rgba(0, 165, 200, 0.42);
  box-shadow: 0 6px 20px rgba(109, 40, 217, 0.12), inset 0 0 18px rgba(255, 255, 255, 0.3);
}

html.light .bubble code {
  background: rgba(0, 165, 200, 0.1);
  border-color: rgba(0, 165, 200, 0.24);
  color: #087f9c;
}

html.light .msg.user .bubble code {
  background: rgba(255, 255, 255, 0.6);
  border-color: rgba(0, 140, 175, 0.3);
  color: #0b3d52;
}

html.light .intent-chip.FORGE {
  color: #6d28d9;
  border-color: rgba(109, 40, 217, 0.45);
}

html.light .intent-chip.PROXY {
  color: #087f9c;
  border-color: rgba(8, 145, 178, 0.45);
}

html.light .intent-chip.ORCHESTRATE {
  color: #a16207;
  border-color: rgba(180, 83, 9, 0.45);
}

html.light .intent-chip.CONFIRM {
  color: #047857;
  border-color: rgba(5, 150, 105, 0.45);
}

html.light .typing-dots span {
  background: #0891b2;
  box-shadow: 0 0 6px rgba(8, 145, 178, 0.55);
}

/* 计划卡片与数据源卡片 */
html.light .plan-card {
  border-color: rgba(109, 40, 217, 0.42);
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.1), rgba(8, 145, 178, 0.06));
  box-shadow: 0 0 20px rgba(109, 40, 217, 0.1);
}

html.light .source-card {
  border-color: rgba(0, 165, 200, 0.6);
  background: linear-gradient(160deg, rgba(0, 165, 200, 0.09), rgba(109, 40, 217, 0.05));
  box-shadow: 0 0 22px rgba(0, 165, 200, 0.12);
}

html.light .source-tag {
  color: #047857;
  border-color: rgba(5, 150, 105, 0.4);
  background: rgba(5, 150, 105, 0.1);
}

html.light .st-head b {
  color: #087f9c;
}

html.light .st-warnings {
  color: #a16207;
}

html.light .col-chip {
  background: #ffffff;
}

/* 主按钮：亮色下使用深饱和霓虹渐变 + 白字，保证可读性 */
html.light .primary-btn,
html.light .send-btn {
  background: linear-gradient(105deg, #0891b2, #6d28d9 58%, #db2777);
  color: #fff;
  filter: drop-shadow(0 0 8px rgba(8, 145, 178, 0.32));
}

html.light .send-btn {
  background: linear-gradient(135deg, #0891b2, #6d28d9 60%, #db2777);
}

html.light .primary-btn:hover,
html.light .send-btn:hover:not(:disabled) {
  filter: drop-shadow(0 0 14px rgba(109, 40, 217, 0.45));
}

html.light .primary-btn:disabled,
html.light .send-btn:disabled {
  filter: none;
}

html.light .danger-btn:hover {
  color: #be185d;
}

/* 输入区 */
html.light .input-box {
  border-color: rgba(0, 140, 175, 0.34);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: inset 0 0 20px rgba(0, 165, 200, 0.04), 0 4px 16px rgba(6, 45, 65, 0.06);
}

html.light .input-box:focus-within {
  border-color: rgba(0, 165, 200, 0.82);
  box-shadow: 0 0 0 1px rgba(0, 165, 200, 0.18), 0 0 26px rgba(0, 165, 200, 0.24),
    inset 0 0 26px rgba(0, 165, 200, 0.06);
}

html.light .attach-btn:hover {
  color: #087f9c;
  border-color: rgba(0, 165, 200, 0.6);
  background: rgba(0, 165, 200, 0.08);
  box-shadow: 0 0 12px rgba(0, 165, 200, 0.18);
}

/* 弹窗、知识库、Toast */
html.light .modal-card {
  border-color: rgba(0, 150, 190, 0.35);
  box-shadow: 0 0 0 1px rgba(0, 150, 190, 0.08), var(--shadow-lg);
}

html.light .modal-card input {
  background: #f4fafd;
}

html.light .modal-card input:focus {
  box-shadow: 0 0 16px rgba(0, 165, 200, 0.2);
}

html.light .modal-card p code {
  color: #087f9c;
}

html.light .rag-doc-icon {
  color: #047857;
  background: rgba(5, 150, 105, 0.12);
  border-color: rgba(5, 150, 105, 0.38);
}

html.light .rag-hit {
  border-left-color: rgba(0, 165, 200, 0.6);
}

html.light .rag-hit-head b {
  color: #087f9c;
}

html.light .toast {
  box-shadow: 0 0 18px rgba(0, 165, 200, 0.18), var(--shadow-md);
}

html.light .toast.error {
  color: #be123c;
}

/* 滚动条 */
html.light ::-webkit-scrollbar-track {
  background: rgba(0, 130, 165, 0.04);
}

html.light ::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(8, 145, 178, 0.55), rgba(109, 40, 217, 0.5));
}

/* ================= 动画 ================= */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

@keyframes floatOrb {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  33% {
    transform: translate3d(34px, -40px, 0) scale(1.06);
  }
  66% {
    transform: translate3d(-26px, 26px, 0) scale(0.95);
  }
}

@keyframes dotBounce {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  40% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

@keyframes pulseDot {
  0%,
  100% {
    opacity: 1;
    box-shadow: 0 0 8px var(--neon-cyan), 0 0 18px rgba(0, 234, 255, 0.55);
  }
  50% {
    opacity: 0.55;
    box-shadow: 0 0 4px var(--neon-cyan), 0 0 10px rgba(0, 234, 255, 0.3);
  }
}

@keyframes barPulse {
  0%,
  100% {
    opacity: 0.35;
    transform: scaleY(0.7);
  }
  50% {
    opacity: 1;
    transform: scaleY(1);
  }
}

@keyframes scanBeam {
  0% {
    transform: translateX(-20vw);
  }
  100% {
    transform: translateX(110vw);
  }
}

@keyframes glitchSliceTop {
  0% {
    transform: translate(-2px, -1px);
  }
  50% {
    transform: translate(2px, 1px);
  }
  100% {
    transform: translate(-1px, 0);
  }
}

@keyframes glitchSliceBottom {
  0% {
    transform: translate(2px, 1px);
  }
  50% {
    transform: translate(-2px, -1px);
  }
  100% {
    transform: translate(1px, 0);
  }
}

@keyframes textGlitch {
  0%,
  100% {
    text-shadow: none;
    transform: none;
  }
  25% {
    text-shadow: -2px 0 rgba(255, 46, 136, 0.8), 2px 0 rgba(0, 234, 255, 0.8);
    transform: translateX(1px);
  }
  50% {
    text-shadow: 2px 0 rgba(0, 234, 255, 0.8), -2px 0 rgba(255, 46, 136, 0.8);
    transform: translateX(-1px);
  }
  75% {
    text-shadow: -1px 0 rgba(255, 46, 136, 0.7), 1px 0 rgba(0, 234, 255, 0.7);
    transform: none;
  }
}

/* 页面切换故障转场：短时长、仅一次 */
@keyframes screenGlitch {
  0% {
    transform: translate3d(0, 0, 0);
    filter: none;
    opacity: 1;
  }
  18% {
    transform: translate3d(-6px, 2px, 0);
    filter: hue-rotate(35deg) saturate(1.7) contrast(1.1);
    opacity: 0.86;
  }
  36% {
    transform: translate3d(5px, -3px, 0) skewX(-1deg);
    filter: hue-rotate(-25deg) saturate(1.5);
    opacity: 1;
  }
  56% {
    transform: translate3d(-3px, 1px, 0);
    filter: contrast(1.18);
    opacity: 0.92;
  }
  78% {
    transform: translate3d(2px, 0, 0);
    filter: none;
    opacity: 1;
  }
  100% {
    transform: none;
    filter: none;
    opacity: 1;
  }
}

@keyframes glitchIn {
  0% {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
    filter: hue-rotate(25deg) saturate(1.6);
  }
  55% {
    opacity: 1;
    transform: translateY(0) scale(1.004);
    filter: none;
  }
  100% {
    opacity: 1;
    transform: none;
    filter: none;
  }
}

/* ================= 响应式 ================= */
@media (max-width: 1100px) {
  .hud-status {
    display: none;
  }
}

@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    transform: translateX(-100%);
    transition: transform var(--transition);
    box-shadow: var(--shadow-lg), 0 0 40px rgba(0, 234, 255, 0.12);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 15;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(2px);
  }

  .sidebar-backdrop.show {
    display: block;
  }

  .menu-btn {
    display: inline-flex;
  }

  .chat-list {
    padding: 18px 14px 10px;
  }

  .composer {
    padding: 6px 10px 12px;
  }

  .prompt-grid {
    grid-template-columns: 1fr;
  }

  .welcome h1 {
    font-size: 24px;
  }

  .msg-body {
    max-width: 88%;
  }

  .plan-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .hud-frame {
    inset: 8px;
  }
}

@media (max-width: 640px) {
  .topbar {
    padding: 0 14px;
    height: 56px;
  }

  .fx-rain {
    opacity: 0.1;
  }

  .fx-stream {
    display: none;
  }

  .hud-frame {
    display: none;
  }

  .welcome {
    margin-top: 3vh;
  }

  .welcome h1 {
    font-size: 21px;
  }

  .welcome-sub {
    font-size: 12.5px;
  }

  .boot-line {
    font-size: 9px;
    letter-spacing: 1px;
    padding: 3px 9px;
  }

  .prompt-card {
    padding: 15px 16px;
  }

  .composer-hint {
    display: none;
  }

  .modal-card {
    padding: 20px;
  }

  .toast-wrap {
    top: 12px;
    right: 12px;
    left: 12px;
  }

  .toast {
    min-width: 0;
    max-width: none;
  }
}

/* 尊重系统减弱动效偏好 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}


/* ================= 无人值守版：Agent 目录双分类 ================= */
.catalog {
  display: flex;
  flex-direction: column;
  gap: 26px;
  width: 100%;
}

.catalog-block {
  text-align: left;
}

.catalog-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.catalog-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-family: var(--font-tech);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.6px;
  color: var(--text-main);
}

.catalog-tag {
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(0, 234, 255, 0.4);
  background: rgba(0, 234, 255, 0.1);
  color: #7df2ff;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 1px;
}

.catalog-tag.personal {
  border-color: rgba(255, 46, 136, 0.42);
  background: rgba(255, 46, 136, 0.1);
  color: #ff86b5;
}

.catalog-tag.tools {
  border-color: rgba(157, 92, 255, 0.45);
  background: rgba(157, 92, 255, 0.12);
  color: #c9b3ff;
}

.catalog-sub {
  margin: 0;
  font-size: 11.5px;
  color: var(--text-muted);
}

/* 领域配色：OA / PM / HR / CRM / ITSM / KM / ASSET / CUSTOM */
.quick-icon.oa,
.pc-icon.oa {
  background: rgba(0, 234, 255, 0.1);
  border-color: rgba(0, 234, 255, 0.3);
  color: #8ef4ff;
}

.quick-icon.pm,
.pc-icon.pm {
  background: rgba(157, 92, 255, 0.14);
  border-color: rgba(157, 92, 255, 0.4);
  color: #c9b3ff;
}

.quick-icon.hr,
.pc-icon.hr {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.24);
  color: #dfe9f2;
}

.quick-icon.crm,
.pc-icon.crm {
  background: rgba(255, 46, 136, 0.12);
  border-color: rgba(255, 46, 136, 0.36);
  color: #ff86b5;
}

.quick-icon.itsm,
.pc-icon.itsm {
  background: rgba(0, 255, 163, 0.1);
  border-color: rgba(0, 255, 163, 0.32);
  color: #6dffc4;
}

.quick-icon.km,
.pc-icon.km {
  background: rgba(255, 200, 87, 0.1);
  border-color: rgba(255, 200, 87, 0.32);
  color: #ffd77e;
}

.quick-icon.asset,
.pc-icon.asset {
  background: rgba(47, 123, 255, 0.14);
  border-color: rgba(47, 123, 255, 0.4);
  color: #9dbcff;
}

.quick-icon.custom,
.pc-icon.custom {
  background: linear-gradient(135deg, rgba(0, 234, 255, 0.16), rgba(255, 46, 136, 0.16));
  border-color: rgba(255, 46, 136, 0.4);
  color: #ffb3d0;
}

.quick-custom {
  margin-top: 6px;
  border: 1px dashed rgba(255, 46, 136, 0.35);
}

.quick-custom:hover {
  border-color: rgba(255, 46, 136, 0.6);
  border-left-color: var(--neon-pink);
  box-shadow: inset 0 0 18px rgba(255, 46, 136, 0.08);
}

/* 提示词定制区 */
.custom-forge {
  margin-bottom: 14px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
}

.custom-forge textarea {
  width: 100%;
  resize: vertical;
  min-height: 72px;
  max-height: 200px;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-canvas);
  color: var(--text-main);
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1.6;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.custom-forge textarea:focus {
  border-color: var(--border-glow);
  box-shadow: 0 0 16px rgba(0, 234, 255, 0.14);
}

.custom-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.custom-actions input {
  flex: 1;
  min-width: 0;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-canvas);
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 12px;
  outline: none;
}

.custom-actions input:focus {
  border-color: var(--border-glow);
}

.custom-tip {
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.4px;
  color: var(--text-faint);
}

/* 锻造中：卡片禁用态 */
.prompt-card.busy {
  opacity: 0.55;
  pointer-events: none;
}

/* ================= 无人值守版：Agent 管理窗口 ================= */
.manage-card {
  width: min(940px, 96vw);
  max-height: 88vh;
  overflow-y: auto;
}

.manage-tabs {
  display: flex;
  gap: 8px;
  margin: 14px 0 16px;
  border-bottom: 1px solid var(--border);
}

.manage-tab {
  padding: 8px 14px;
  border: 1px solid transparent;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-tech);
  font-size: 12.5px;
  letter-spacing: 0.6px;
  cursor: pointer;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.manage-tab:hover {
  color: var(--text-main);
}

.manage-tab.active {
  color: var(--neon-cyan);
  border-bottom-color: var(--neon-cyan);
}

.manage-group {
  margin-bottom: 18px;
}

.manage-group-title {
  margin-bottom: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--text-muted);
}

.manage-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.manage-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
}

.manage-row-main {
  flex: 1;
  min-width: 0;
}

.manage-row-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 650;
  color: var(--text-main);
}

.manage-row-sub {
  margin-top: 3px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.manage-badge {
  padding: 1px 6px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.5px;
  color: var(--text-sub);
}

.manage-badge.active {
  border-color: rgba(0, 255, 163, 0.4);
  color: #6dffc4;
}

.manage-badge.frozen {
  border-color: rgba(255, 200, 87, 0.45);
  color: #ffd77e;
}

.manage-badge.archived {
  border-color: rgba(255, 46, 136, 0.4);
  color: #ff86b5;
}

.manage-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.manage-actions button {
  padding: 5px 9px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-sub);
  font-size: 11.5px;
  cursor: pointer;
  transition: border-color var(--transition-fast), color var(--transition-fast);
}

.manage-actions button:hover {
  border-color: var(--border-glow);
  color: var(--neon-cyan);
}

.manage-actions button.danger {
  border-color: var(--border-pink);
  color: #ff86b5;
}

.manage-actions button.danger:hover {
  border-color: var(--neon-pink);
  color: var(--neon-pink);
}

.manage-empty {
  padding: 14px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

.manage-agent-picker {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.manage-agent-picker label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

.manage-agent-picker select {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-canvas);
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 12px;
  outline: none;
}

.memory-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.memory-block {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  min-width: 0;
}

.memory-title {
  margin-bottom: 8px;
  font-family: var(--font-tech);
  font-size: 12.5px;
  letter-spacing: 0.5px;
  color: var(--text-main);
}

.memory-meta {
  margin-bottom: 10px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  line-height: 1.7;
  color: var(--text-muted);
}

.memory-sub {
  margin: 10px 0 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.8px;
  color: var(--text-faint);
}

.memory-summary {
  margin: 0;
  max-height: 150px;
  overflow-y: auto;
  padding: 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-canvas);
  color: var(--text-sub);
  font-family: var(--font-ui);
  font-size: 12px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

.memory-prefs {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 150px;
  overflow-y: auto;
}

.memory-pref {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-canvas);
  font-size: 12px;
  color: var(--text-sub);
}

.memory-pref b {
  color: var(--text-main);
  font-weight: 600;
}

.memory-pref button {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
}

.memory-pref button:hover {
  color: var(--neon-pink);
}

.memory-pref-form {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.memory-pref-form input,
.memory-search input {
  flex: 1;
  min-width: 0;
  padding: 7px 9px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-canvas);
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 11.5px;
  outline: none;
}

.memory-pref-form input:focus,
.memory-search input:focus {
  border-color: var(--border-glow);
}

.memory-facts {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 190px;
  overflow-y: auto;
}

.memory-fact {
  padding: 8px 10px;
  border-left: 2px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-canvas);
  font-size: 11.5px;
  line-height: 1.65;
  color: var(--text-sub);
  word-break: break-word;
}

.memory-fact span {
  display: block;
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--text-faint);
}

.memory-search {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}

.memory-hits {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
  max-height: 160px;
  overflow-y: auto;
}

.memory-hit {
  padding: 8px 10px;
  border: 1px solid rgba(0, 234, 255, 0.22);
  border-radius: var(--radius-sm);
  background: rgba(0, 234, 255, 0.04);
  font-size: 11.5px;
  line-height: 1.65;
  color: var(--text-sub);
  word-break: break-word;
}

.memory-hit em {
  display: block;
  margin-top: 4px;
  font-family: var(--font-mono);
  font-style: normal;
  font-size: 9.5px;
  color: var(--neon-cyan);
}

.manage-danger {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

@media (max-width: 900px) {
  .memory-grid {
    grid-template-columns: 1fr;
  }

  .catalog-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
}


/* 卡片元信息与空态 */
.pc-meta {
  display: block;
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.5px;
  color: var(--text-faint);
}

.catalog-empty {
  grid-column: 1 / -1;
  padding: 18px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

/* 侧边栏快速铸造：企业级蓝图较多时内部滚动，避免挤掉会话列表 */
#quick-forge {
  max-height: 268px;
  overflow-y: auto;
  padding-right: 2px;
}

#quick-forge::-webkit-scrollbar,
.memory-facts::-webkit-scrollbar,
.memory-prefs::-webkit-scrollbar,
.memory-hits::-webkit-scrollbar,
.memory-summary::-webkit-scrollbar {
  width: 4px;
}

#quick-forge::-webkit-scrollbar-thumb,
.memory-facts::-webkit-scrollbar-thumb,
.memory-prefs::-webkit-scrollbar-thumb,
.memory-hits::-webkit-scrollbar-thumb,
.memory-summary::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-full);
}


/* ================= 侧边栏高度分配修正 =================
   侧边栏内容变多（10 类快捷铸造 + 子Agent 列表）后，必须让各区块
   在有限高度内正确收缩与内部滚动，避免压到左下角用户栏。 */
.sidebar {
  height: 100%;
  min-height: 0;
  /* 窄窗口（内嵌预览/高分屏缩放）不能让侧栏超过视口，否则右侧菜单会被裁切 */
  width: min(286px, 100vw);
  max-width: 100vw;
  /* 内容高于可视区时整栏滚动，避免底部入口与快速铸造区被裁掉 */
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
}

.brand-text {
  min-width: 0;
}

/* 品牌副标题不换行，过长时省略 */
.brand-sub {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 1.6px;
}

/* 快速铸造区：分到固定上限的高度，列表内部滚动 */
.quick-section {
  display: flex;
  flex-direction: column;
  flex: 0 1 240px;
  min-height: 110px;
  overflow: hidden;
}

.quick-section #quick-forge {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
}

/* 子Agent 区：分到固定上限的高度，列表内部滚动 */
.agent-section {
  display: flex;
  flex-direction: column;
  flex: 0 1 200px;
  min-height: 96px;
  overflow: hidden;
}

.agent-section .agent-list {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
}

/* 会话区优先让出空间：高度不足时压缩，滚动仍可用 */
.side-section.grow {
  min-height: 56px;
}


/* 高度再平衡：快速铸造区优先拿到可见高度，子Agent区适当让位 */
.quick-section {
  flex: 0 1 260px;
}

.agent-section {
  flex: 0 1 160px;
}

/* 品牌、工作区与固定按钮不参与压缩，短屏统一由侧栏滚动 */
.brand,
.workspace-bar {
  flex: none;
}


/* 短屏（笔记本 / 小窗口）：侧栏整体滚动 + 底部用户栏吸底，
   各列表恢复自然高度，避免区块被压扁或与用户栏重叠 */
@media (max-height: 780px) {
  .sidebar {
    overflow-y: auto;
    overflow-x: hidden;
  }

  .quick-section {
    flex: 0 0 auto;
    min-height: 0;
  }

  .quick-section #quick-forge {
    flex: none;
    max-height: 190px;
  }

  .side-section.grow {
    flex: 0 0 auto;
    min-height: 0;
  }

  .session-list {
    max-height: 132px;
  }

  .agent-section {
    flex: 0 0 auto;
    min-height: 0;
  }

  .agent-section .agent-list {
    flex: none;
    max-height: 150px;
  }

  .userbar {
    /* 短屏跟随内容滚动，不做吸底，避免覆盖上方菜单与列表 */
    position: relative;
  }

  html.light .userbar {
    background: rgba(255, 255, 255, 0.96);
  }
}


/* 短屏：为吸底用户栏预留高度，保证滚到底时最后一条不被遮住 */
@media (max-height: 780px) {
  .agent-section {
    margin-bottom: 66px;
  }
}


/* ================= 子Agent专属对话场景 =================
   独立于主界面创造对话：绿色业务控制台语汇 + 三栏结构 + 执行轨迹，
   与主界面的霓虹蓝紫创造对话形成明确区隔。 */
.agent-workspace {
  --aw-accent: #00ffa3;
  --aw-accent-soft: rgba(0, 255, 163, 0.08);
  --aw-accent-border: rgba(0, 255, 163, 0.28);
  --aw-warn: #ffc857;
  --aw-bg: rgba(3, 10, 9, 0.92);
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(rgba(0, 255, 163, 0.035) 1px, transparent 1px) 0 0 / 100% 34px,
    linear-gradient(90deg, rgba(0, 255, 163, 0.035) 1px, transparent 1px) 0 0 / 34px 100%,
    linear-gradient(160deg, rgba(3, 14, 12, 0.97), rgba(2, 7, 9, 0.98));
}

.agent-workspace[hidden] {
  display: none;
}

html.light .agent-workspace {
  --aw-accent: #047857;
  --aw-accent-soft: rgba(4, 120, 87, 0.07);
  --aw-accent-border: rgba(4, 120, 87, 0.3);
  background:
    linear-gradient(rgba(4, 120, 87, 0.05) 1px, transparent 1px) 0 0 / 100% 34px,
    linear-gradient(90deg, rgba(4, 120, 87, 0.05) 1px, transparent 1px) 0 0 / 34px 100%,
    linear-gradient(160deg, #f4fbf8, #eef7f4);
}

/* 进入业务场景后关闭主界面的数字雨与光球特效，强化场景差异 */
body.agent-scene .fx-rain,
body.agent-scene .orbs {
  display: none;
}

.aw-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--aw-accent-border);
  background: linear-gradient(90deg, var(--aw-accent-soft), transparent 62%);
  flex-wrap: wrap;
}

.aw-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--aw-accent-border);
  background: transparent;
  color: var(--aw-accent);
  font-size: 12px;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.aw-back:hover {
  background: var(--aw-accent-soft);
  border-color: var(--aw-accent);
}

.aw-back svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.aw-agent {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.aw-avatar {
  width: 34px;
  height: 34px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  clip-path: polygon(5px 0, 100% 0, 100% calc(100% - 5px), calc(100% - 5px) 100%, 0 100%, 0 5px);
  background: var(--aw-accent-soft);
  border: 1px solid var(--aw-accent-border);
  color: var(--aw-accent);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.aw-meta {
  min-width: 0;
}

.aw-name {
  font-family: var(--font-tech);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.aw-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.aw-tags {
  display: flex;
  gap: 6px;
}

.aw-tag {
  padding: 2px 8px;
  border-radius: var(--radius-full);
  border: 1px solid var(--aw-accent-border);
  color: var(--aw-accent);
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.8px;
}

.aw-tag.live::before {
  content: '';
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-right: 5px;
  border-radius: 50%;
  background: var(--aw-accent);
  box-shadow: 0 0 8px var(--aw-accent);
}

.aw-actions {
  display: flex;
  gap: 6px;
  margin-left: auto;
  flex-wrap: wrap;
}

.aw-btn {
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-sub);
  font-size: 11.5px;
  cursor: pointer;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.aw-btn:hover {
  color: var(--aw-accent);
  border-color: var(--aw-accent-border);
}

.aw-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 188px minmax(0, 1fr);
}

.aw-history {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 12px 10px;
  border-right: 1px solid rgba(0, 255, 163, 0.14);
  background: rgba(0, 255, 163, 0.02);
}

.aw-history-title {
  padding: 0 6px 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1.4px;
  color: var(--text-faint);
  text-transform: uppercase;
}

.aw-history-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.aw-history-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 8px;
  margin-bottom: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  color: var(--text-sub);
  font-size: 12px;
}

.aw-history-item:hover {
  background: var(--aw-accent-soft);
  border-color: var(--aw-accent-border);
}

.aw-history-item.active {
  background: var(--aw-accent-soft);
  border-color: var(--aw-accent);
  color: var(--text-main);
}

.aw-history-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.aw-history-turns {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--text-faint);
}

.aw-history-del {
  border: none;
  background: transparent;
  color: var(--text-faint);
  font-size: 13px;
  cursor: pointer;
  padding: 0 2px;
}

.aw-history-del:hover {
  color: var(--neon-pink);
}

.aw-history-empty {
  padding: 12px 8px;
  font-size: 11.5px;
  color: var(--text-muted);
}

.aw-new {
  margin-top: 8px;
  padding: 7px 8px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--aw-accent-border);
  background: transparent;
  color: var(--aw-accent);
  font-size: 11.5px;
  cursor: pointer;
}

.aw-new:hover {
  background: var(--aw-accent-soft);
}

.aw-history-tip {
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  line-height: 1.6;
  color: var(--text-faint);
}

.aw-chat {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.aw-banner {
  margin: 12px 16px 0;
  padding: 10px 14px;
  border: 1px solid var(--aw-accent-border);
  border-left: 3px solid var(--aw-accent);
  border-radius: var(--radius-sm);
  background: var(--aw-accent-soft);
}

.aw-banner-title {
  font-family: var(--font-tech);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--aw-accent);
}

.aw-banner-text {
  margin-top: 4px;
  font-size: 11.5px;
  line-height: 1.65;
  color: var(--text-sub);
}

.aw-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.aw-msg {
  max-width: 88%;
  animation: fadeInUp 0.22s var(--ease-out-soft) backwards;
}

.aw-msg.user {
  align-self: flex-end;
  padding: 9px 14px;
  border-radius: 8px 8px 2px 8px;
  border: 1px solid rgba(255, 200, 87, 0.32);
  background: linear-gradient(135deg, rgba(255, 200, 87, 0.16), rgba(255, 200, 87, 0.05));
  font-size: 13px;
  line-height: 1.65;
  color: var(--text-main);
  white-space: pre-wrap;
  word-break: break-word;
}

.aw-msg.agent {
  align-self: flex-start;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid rgba(0, 255, 163, 0.16);
  border-left: 3px solid var(--aw-accent);
  border-radius: 2px 8px 8px 2px;
  background: rgba(4, 14, 12, 0.86);
}

html.light .aw-msg.agent {
  background: rgba(255, 255, 255, 0.92);
}

.aw-msg.system {
  align-self: stretch;
  padding: 10px 12px;
  border: 1px dashed rgba(157, 92, 255, 0.32);
  border-radius: var(--radius-sm);
  background: rgba(157, 92, 255, 0.06);
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--text-sub);
  white-space: pre-wrap;
  word-break: break-word;
}

.aw-system-tag {
  margin-bottom: 6px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 1px;
  color: #c9b3ff;
}

.aw-msg-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.8px;
  color: var(--text-muted);
}

.aw-msg-time {
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.3px;
  color: var(--text-muted);
  opacity: 0.85;
}

.aw-msg.user .aw-msg-time {
  text-align: right;
}

.aw-role.agent {
  padding: 1px 6px;
  border-radius: 3px;
  border: 1px solid var(--aw-accent-border);
  color: var(--aw-accent);
  font-weight: 700;
}

.aw-msg-id {
  color: var(--text-faint);
}

.aw-intent {
  padding: 1px 6px;
  border-radius: 3px;
  border: 1px solid var(--border);
  color: var(--text-sub);
}

.aw-intent.proxy {
  border-color: var(--aw-accent-border);
  color: var(--aw-accent);
}

.aw-intent.error {
  border-color: var(--border-pink);
  color: #ff86b5;
}

.aw-msg-body {
  font-size: 13px;
  line-height: 1.75;
  color: var(--text-main);
  word-break: break-word;
}

.aw-msg-body p {
  margin: 0 0 8px;
}

.aw-msg-body p:last-child {
  margin-bottom: 0;
}

.aw-msg-body ul,
.aw-msg-body ol {
  margin: 6px 0;
  padding-left: 20px;
}

.aw-msg-body table {
  margin: 8px 0;
}

.aw-trace {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed rgba(0, 255, 163, 0.2);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.aw-trace-title {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.8px;
  color: var(--text-faint);
}

.aw-trace-item {
  padding: 2px 7px;
  border-radius: 3px;
  border: 1px solid var(--aw-accent-border);
  background: var(--aw-accent-soft);
  color: var(--aw-accent);
  font-family: var(--font-mono);
  font-size: 10px;
}

.aw-trace-item.error {
  border-color: var(--border-pink);
  background: rgba(255, 46, 136, 0.08);
  color: #ff86b5;
}

.aw-typing {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 18px 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--aw-accent);
}

.aw-typing[hidden] {
  display: none;
}

.aw-composer {
  padding: 10px 16px 14px;
  border-top: 1px solid rgba(0, 255, 163, 0.14);
  background: rgba(2, 9, 8, 0.72);
}

html.light .aw-composer {
  background: rgba(240, 250, 246, 0.85);
}

.aw-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.aw-chip {
  padding: 4px 10px;
  border-radius: var(--radius-full);
  border: 1px solid var(--aw-accent-border);
  background: var(--aw-accent-soft);
  color: var(--text-sub);
  font-size: 11px;
  cursor: pointer;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.aw-chip:hover {
  color: var(--aw-accent);
  border-color: var(--aw-accent);
}

.aw-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--aw-accent-border);
  border-radius: var(--radius-md);
  background: rgba(3, 14, 12, 0.9);
}

html.light .aw-input-row {
  background: #ffffff;
}

.aw-input-row textarea {
  flex: 1;
  min-height: 38px;
  max-height: 140px;
  resize: none;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text-main);
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1.6;
}

.aw-send {
  flex: none;
  padding: 9px 18px;
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--aw-accent), #00c9a7);
  color: #02120c;
  font-family: var(--font-tech);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.8px;
  cursor: pointer;
  transition: filter var(--transition-fast);
}

.aw-send:hover:not(:disabled) {
  filter: brightness(1.12);
}

.aw-send:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.aw-hint {
  margin-top: 7px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.4px;
  color: var(--text-faint);
}

@media (max-width: 900px) {
  .aw-body {
    grid-template-columns: minmax(0, 1fr);
  }

  .aw-history {
    display: none;
  }
}


/* 子Agent列表项改为按钮后重置默认样式，保持原有视觉 */
.agent-item {
  width: 100%;
  background: transparent;
  text-align: left;
  font-family: inherit;
  color: inherit;
  cursor: pointer;
}


/* 窄屏：专线历史改为顶部横向会话条，保留“新建专线会话”入口 */
@media (max-width: 900px) {
  .aw-body {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
  }

  .aw-history {
    display: block;
    padding: 8px 10px 6px;
    border-right: none;
    border-bottom: 1px solid rgba(0, 255, 163, 0.14);
  }

  .aw-history-title {
    padding: 0 0 6px;
  }

  .aw-history-list {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    max-height: 44px;
  }

  .aw-history-item {
    flex: 0 0 auto;
    margin-bottom: 0;
    white-space: nowrap;
  }

  .aw-history-tip {
    display: none;
  }

  .aw-new {
    margin-top: 6px;
    width: 100%;
  }
}


/* ================= 数据呈现优化（主对话 + 子Agent场景共用） ================= */

/* ---- 分节标题：左侧信息栏 + 分级字号，便于快速扫读 ---- */
.bubble h1,
.bubble h2,
.bubble h3,
.bubble h4,
.aw-msg-body h1,
.aw-msg-body h2,
.aw-msg-body h3,
.aw-msg-body h4 {
  padding-left: 10px;
  border-left: 2px solid rgba(0, 234, 255, 0.42);
  line-height: 1.5;
  scroll-margin-top: 14px;
}

.bubble h1,
.aw-msg-body h1 {
  font-size: 17px;
}

.bubble h2,
.aw-msg-body h2 {
  font-size: 15.5px;
}

.bubble h3,
.aw-msg-body h3 {
  font-size: 14.5px;
}

.bubble h4,
.aw-msg-body h4 {
  font-size: 13.5px;
  color: var(--text-sub);
  border-left-color: rgba(0, 234, 255, 0.24);
}

/* ---- 内容导航（分节 ≥3 时自动生成） ---- */
.md-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0 0 14px;
  padding: 8px 10px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: rgba(0, 234, 255, 0.03);
}

.md-nav-label {
  margin-right: 2px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 1.2px;
  color: var(--text-faint);
}

.md-nav-item {
  padding: 2px 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-sub);
  font-size: 11px;
  cursor: pointer;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.md-nav-item:hover {
  color: var(--neon-cyan);
  border-color: var(--border-glow);
}

.md-nav-item.lv3 {
  font-size: 10.5px;
  opacity: 0.85;
}

/* ---- 数据表：卡片容器 + 吸顶表头 + 斑马纹 + 数值右对齐 ---- */
.md-table {
  margin: 12px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgba(3, 10, 18, 0.45);
  overflow: hidden;
}

html.light .md-table {
  background: rgba(255, 255, 255, 0.9);
}

.md-table-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-hover);
}

.md-table-title {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 1.4px;
  color: var(--neon-cyan);
}

.md-table-meta {
  margin-right: auto;
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--text-faint);
}

.md-copy {
  padding: 2px 9px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: transparent;
  color: var(--text-muted);
  font-size: 10px;
  cursor: pointer;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.md-copy:hover {
  color: var(--neon-cyan);
  border-color: var(--border-glow);
}

.md-table-scroll {
  max-height: 420px;
  overflow: auto;
}

.md-table table {
  width: 100%;
  min-width: 100%;
  margin: 0;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12.5px;
}

.md-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 8px 10px;
  border: none;
  border-bottom: 1px solid var(--border-strong);
  background: #0a1622;
  color: var(--text-sub);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-align: left;
  white-space: nowrap;
}

html.light .md-table th {
  background: #e9f4f9;
  color: var(--text-sub);
}

.md-table td {
  padding: 8px 10px;
  border: none;
  border-bottom: 1px solid rgba(0, 234, 255, 0.09);
  color: var(--text-sub);
  line-height: 1.6;
  vertical-align: top;
  min-width: 84px;
  word-break: break-word;
}

.md-table tbody tr:nth-child(even) {
  background: rgba(0, 234, 255, 0.03);
}

.md-table tbody tr:hover {
  background: rgba(0, 234, 255, 0.07);
}

.md-table tbody tr:last-child td {
  border-bottom: none;
}

.md-table th.num,
.md-table td.num {
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.md-table td.key {
  color: var(--text-main);
  font-weight: 600;
  white-space: nowrap;
}

/* ---- 状态徽标 ---- */
.md-badge {
  display: inline-block;
  padding: 1px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
  font-size: 10.5px;
  line-height: 1.65;
  white-space: nowrap;
}

.md-badge.success {
  border-color: rgba(0, 255, 163, 0.45);
  background: rgba(0, 255, 163, 0.1);
  color: #6dffc4;
}

.md-badge.warn {
  border-color: rgba(255, 200, 87, 0.45);
  background: rgba(255, 200, 87, 0.1);
  color: #ffd77e;
}

.md-badge.danger {
  border-color: rgba(255, 46, 136, 0.45);
  background: rgba(255, 46, 136, 0.1);
  color: #ff86b5;
}

.md-badge.info {
  border-color: rgba(0, 234, 255, 0.4);
  background: rgba(0, 234, 255, 0.08);
  color: #9df4ff;
}

html.light .md-badge.success {
  color: #047857;
  border-color: rgba(4, 120, 87, 0.45);
  background: rgba(4, 120, 87, 0.08);
}

html.light .md-badge.warn {
  color: #b45309;
  border-color: rgba(180, 83, 9, 0.4);
  background: rgba(180, 83, 9, 0.08);
}

html.light .md-badge.danger {
  color: #be185d;
  border-color: rgba(190, 24, 93, 0.4);
  background: rgba(190, 24, 93, 0.08);
}

html.light .md-badge.info {
  color: #087f9c;
  border-color: rgba(8, 127, 156, 0.4);
  background: rgba(8, 127, 156, 0.08);
}

/* ---- 键值卡：字段与值的两列网格 ---- */
.md-kv {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0;
}

.md-kv-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-left: 2px solid rgba(0, 234, 255, 0.35);
  border-radius: var(--radius-sm);
  background: var(--bg-canvas);
  min-width: 0;
}

.md-kv-key {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.6px;
  color: var(--text-muted);
}

.md-kv-value {
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--text-main);
  word-break: break-word;
}

/* ---- 代码块：语言标签 + 复制 ---- */
.md-code {
  margin: 10px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-canvas);
  overflow: hidden;
}

.md-code-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-hover);
}

.md-code-lang {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 1px;
  color: var(--text-faint);
}

.md-code pre {
  margin: 0;
  padding: 10px 12px;
  border: none;
  border-radius: 0;
  background: transparent;
  overflow-x: auto;
}

.md-code pre code {
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-sub);
  font-size: 12px;
  line-height: 1.7;
}

/* ---- 提示块 / 分隔线 / 行内强调 ---- */
.md-callout {
  margin: 10px 0;
  padding: 9px 12px;
  border-left: 2px solid var(--neon-amber);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: rgba(255, 200, 87, 0.07);
  color: var(--text-sub);
  font-size: 13px;
  line-height: 1.7;
}

.md-rule {
  margin: 14px 0;
  border: none;
  border-top: 1px dashed var(--border);
}

.md-null {
  color: var(--text-faint);
}

.bubble mark,
.aw-msg-body mark {
  padding: 0 2px;
  border-radius: 2px;
  background: rgba(255, 200, 87, 0.24);
  color: inherit;
}

.bubble del,
.aw-msg-body del {
  opacity: 0.6;
}

/* ---- 列表排版 ---- */
.bubble ul,
.bubble ol,
.aw-msg-body ul,
.aw-msg-body ol {
  margin: 8px 0 10px;
  padding-left: 20px;
}

.bubble li,
.aw-msg-body li {
  margin: 4px 0;
  line-height: 1.72;
}

.bubble li::marker,
.aw-msg-body li::marker {
  color: var(--neon-cyan);
}

.bubble ul ul,
.bubble ol ol,
.bubble ul ol,
.bubble ol ul,
.aw-msg-body ul ul,
.aw-msg-body ol ol,
.aw-msg-body ul ol,
.aw-msg-body ol ul {
  margin: 4px 0;
}

@media (max-width: 640px) {
  .md-kv {
    grid-template-columns: 1fr;
  }

  .md-table-scroll {
    max-height: 60vh;
  }
}

/* ============================================================
   科技风图表（viz.js 渲染结果）
   原始数据表始终保留，图表是叠加的可视化展示层
   ============================================================ */
.md-chart {
  padding: 10px 12px 12px;
  border-top: 1px dashed var(--border);
  background:
    linear-gradient(180deg, rgba(0, 234, 255, 0.05), transparent 60%),
    rgba(2, 8, 16, 0.35);
}

html.light .md-chart {
  background:
    linear-gradient(180deg, rgba(0, 144, 176, 0.06), transparent 60%),
    rgba(255, 255, 255, 0.6);
}

.md-chart-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.md-chart-title {
  margin-right: auto;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 1.2px;
  color: var(--neon-cyan);
  text-transform: uppercase;
}

.md-chart-switch {
  display: inline-flex;
  gap: 4px;
}

.md-chart-type {
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: transparent;
  color: var(--text-muted);
  font-size: 10px;
  cursor: pointer;
  transition: color var(--transition-fast), border-color var(--transition-fast),
    background var(--transition-fast);
}

.md-chart-type:hover {
  color: var(--neon-cyan);
  border-color: var(--border-glow);
}

.md-chart-type.active {
  color: var(--neon-cyan);
  border-color: var(--border-glow);
  background: rgba(0, 234, 255, 0.1);
  box-shadow: 0 0 8px rgba(0, 234, 255, 0.18);
}

.md-chart-body {
  min-height: 40px;
  color: var(--text-sub);
}

/* 图表基础元素 */
.mfv-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
  /* 图表内部元素各自用属性指定描边，必须切断全局 svg 的 currentColor 描边，
     否则文字/条形会被 1.8px 白边描一圈，显示发亮且发虚 */
  stroke: none;
}

.mfv-label {
  fill: var(--text-sub);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
}

.mfv-value {
  fill: var(--neon-cyan);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  filter: drop-shadow(0 0 3px rgba(0, 234, 255, 0.45));
}

/* 条形/柱状生长动画：按索引 stagger 60ms */
.mfv-bar {
  transform-box: fill-box;
  transform-origin: left center;
  animation: viz-grow 300ms cubic-bezier(0.22, 1, 0.36, 1) backwards;
  animation-delay: calc(var(--mfv-index, 0) * 60ms);
  filter: drop-shadow(0 0 4px rgba(0, 234, 255, 0.28));
}

.mfv-col {
  transform-box: fill-box;
  transform-origin: center bottom;
  animation: viz-grow-y 300ms cubic-bezier(0.22, 1, 0.36, 1) backwards;
  animation-delay: calc(var(--mfv-index, 0) * 60ms);
  filter: drop-shadow(0 0 4px rgba(157, 92, 255, 0.24));
}

/* 环形图与图例 */
.mfv-donut-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.mfv-donut-wrap .mfv-donut {
  flex: 0 0 auto;
  width: 168px;
  max-width: 45%;
}

.mfv-donut-total {
  fill: var(--neon-cyan);
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 700;
  filter: drop-shadow(0 0 6px rgba(0, 234, 255, 0.4));
}

.mfv-donut-label {
  fill: var(--text-sub);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.8px;
}

.mfv-arc {
  filter: drop-shadow(0 0 4px rgba(0, 234, 255, 0.24));
}

.mfv-legend {
  flex: 1 1 160px;
  min-width: 140px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.mfv-legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-sub);
}

.mfv-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: 0 0 auto;
  box-shadow: 0 0 5px currentColor;
}

.mfv-legend-name {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-sub);
}

.mfv-legend-value {
  color: var(--text-main);
  font-variant-numeric: tabular-nums;
}

.mfv-legend-percent {
  width: 46px;
  text-align: right;
  color: var(--neon-purple);
  font-variant-numeric: tabular-nums;
}

/* 趋势线 */
.mfv-spark-dot {
  filter: drop-shadow(0 0 3px rgba(0, 234, 255, 0.8));
}

.mfv-spark-caption {
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.6px;
  color: var(--text-sub);
}

.mfv-empty {
  padding: 14px 0;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-sub);
}

@keyframes viz-grow {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

@keyframes viz-grow-y {
  from {
    transform: scaleY(0);
  }
  to {
    transform: scaleY(1);
  }
}

@media (max-width: 640px) {
  .mfv-donut-wrap {
    flex-direction: column;
    align-items: flex-start;
  }

  .mfv-donut-wrap .mfv-donut {
    max-width: 100%;
  }
}

/* ============================================================
   赛博科技风看板（AGENT GRID）
   ============================================================ */
.side-entry {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 10px 16px 0;
  /* 固定高度且禁止被 flex 压缩：短屏时改为整栏滚动，避免菜单文字被上下裁切 */
  flex: 0 0 34px;
  min-height: 34px;
  height: 34px;
  border: 1px dashed rgba(157, 92, 255, 0.5);
  background: linear-gradient(90deg, rgba(157, 92, 255, 0.12), rgba(0, 234, 255, 0.08));
  color: #d9d1ff;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 1.2px;
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
  transition: border-color var(--transition-fast), filter var(--transition-fast), color var(--transition-fast);
}

.side-entry svg {
  width: 14px;
  height: 14px;
  stroke-width: 1.8;
}

.side-entry:hover {
  color: #ffffff;
  border-color: var(--neon-purple);
  filter: drop-shadow(0 0 8px rgba(157, 92, 255, 0.45));
}

html.light .side-entry {
  color: #4b2f8f;
  border-color: rgba(109, 63, 209, 0.45);
  background: linear-gradient(90deg, rgba(140, 92, 255, 0.12), rgba(0, 190, 220, 0.1));
}

.dashboard-view {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(rgba(0, 234, 255, 0.035) 1px, transparent 1px) 0 0 / 100% 38px,
    linear-gradient(90deg, rgba(0, 234, 255, 0.035) 1px, transparent 1px) 0 0 / 38px 100%,
    radial-gradient(900px 380px at 12% -10%, rgba(0, 234, 255, 0.12), transparent 70%),
    radial-gradient(760px 360px at 92% 0%, rgba(157, 92, 255, 0.12), transparent 70%),
    linear-gradient(160deg, rgba(3, 9, 17, 0.98), rgba(2, 6, 12, 0.99));
}

.dashboard-view[hidden] {
  display: none;
}

html.light .dashboard-view {
  background:
    linear-gradient(rgba(0, 150, 190, 0.05) 1px, transparent 1px) 0 0 / 100% 38px,
    linear-gradient(90deg, rgba(0, 150, 190, 0.05) 1px, transparent 1px) 0 0 / 38px 100%,
    radial-gradient(900px 380px at 12% -10%, rgba(0, 190, 220, 0.14), transparent 70%),
    radial-gradient(760px 360px at 92% 0%, rgba(140, 92, 255, 0.12), transparent 70%),
    linear-gradient(160deg, #f3fafd, #eef4fb);
}

body.dashboard-scene .fx-rain,
body.dashboard-scene .orbs {
  display: none;
}

.dash-head {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  background: linear-gradient(180deg, rgba(0, 234, 255, 0.07), transparent);
}

.dash-head-main {
  flex: 1;
  min-width: 0;
}

.dash-title {
  font-family: var(--font-tech);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 2px;
  background: linear-gradient(90deg, var(--neon-cyan), var(--neon-purple));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 10px rgba(0, 234, 255, 0.28));
}

.dash-title span {
  color: var(--neon-pink);
  -webkit-text-fill-color: var(--neon-pink);
}

.dash-sub {
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.6px;
  color: var(--text-faint);
}

.dash-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 1;
}

.dash-btn {
  padding: 5px 12px;
  border: 1px solid var(--border-glow);
  border-radius: 3px;
  background: rgba(0, 234, 255, 0.08);
  color: var(--neon-cyan);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.8px;
  cursor: pointer;
  transition: background var(--transition-fast), box-shadow var(--transition-fast);
}

.dash-btn:hover {
  background: rgba(0, 234, 255, 0.18);
  box-shadow: 0 0 12px rgba(0, 234, 255, 0.3);
}

.dash-scanline {
  position: absolute;
  top: 0;
  left: 0;
  width: 26%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--neon-cyan), transparent);
  filter: drop-shadow(0 0 6px rgba(0, 234, 255, 0.8));
  animation: dash-scanline 5.5s linear infinite;
  pointer-events: none;
}

.dash-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 22px 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* 统计卡 */
.dash-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.dash-kpi {
  position: relative;
  padding: 14px 16px 12px;
  border: 1px solid var(--border);
  background: linear-gradient(160deg, rgba(0, 234, 255, 0.08), rgba(157, 92, 255, 0.05));
  clip-path: polygon(14px 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%, 0 14px);
  animation: fadeInUp 0.32s var(--ease-out-soft) backwards;
  animation-delay: calc(var(--i, 0) * 60ms);
  overflow: hidden;
}

.dash-kpi::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 46px;
  height: 2px;
  background: var(--neon-cyan);
  box-shadow: 0 0 10px var(--neon-cyan);
}

.dash-kpi-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1.4px;
  color: var(--text-muted);
}

.dash-kpi-value {
  margin-top: 6px;
  font-family: var(--font-tech);
  font-size: 30px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--neon-cyan);
  filter: drop-shadow(0 0 10px rgba(0, 234, 255, 0.35));
  font-variant-numeric: tabular-nums;
}

.dash-kpi-hint {
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.5px;
  color: var(--text-faint);
}

/* 分区与 Agent 卡片 */
.dash-section-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 10px;
}

.dash-section-head h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-tech);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text-main);
}

.dash-tag {
  padding: 2px 7px;
  border: 1px solid var(--border-glow);
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 1.2px;
  color: var(--neon-cyan);
  background: rgba(0, 234, 255, 0.08);
}

.dash-tag.personal {
  border-color: rgba(157, 92, 255, 0.5);
  color: #c9b3ff;
  background: rgba(157, 92, 255, 0.1);
}

.dash-hint {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-muted);
}

.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
}

.dash-agent {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  background: rgba(4, 12, 20, 0.72);
  clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px);
  animation: fadeInUp 0.3s var(--ease-out-soft) backwards;
  animation-delay: calc(var(--i, 0) * 40ms);
  transition: border-color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
}

.dash-agent:hover {
  border-color: var(--border-glow);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 234, 255, 0.12);
}

html.light .dash-agent {
  background: rgba(255, 255, 255, 0.9);
}

.dash-agent-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.dash-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.6px;
  color: var(--text-muted);
}

.dash-status i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}

.dash-status.active {
  color: var(--neon-green, #00ffa3);
}

.dash-status.active i {
  animation: dash-status-breathe 2.2s ease-in-out infinite;
}

.dash-status.frozen {
  color: var(--neon-amber);
}

.dash-status.archived {
  color: var(--neon-pink);
}

.dash-agent-name {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dash-agent-id {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--text-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dash-agent-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

.dash-agent-actions {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.dash-agent-actions button {
  flex: 1;
  padding: 3px 0;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: transparent;
  color: var(--text-sub);
  font-size: 10.5px;
  cursor: pointer;
  transition: color var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
}

.dash-agent-actions button:hover {
  color: var(--neon-cyan);
  border-color: var(--border-glow);
  background: rgba(0, 234, 255, 0.08);
}

.dash-empty {
  grid-column: 1 / -1;
  padding: 18px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}

/* 图表行 */
.dash-charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.dash-chart-card {
  padding: 12px 14px 14px;
  border: 1px solid var(--border);
  background: rgba(4, 12, 20, 0.62);
  border-radius: var(--radius-md);
}

html.light .dash-chart-card {
  background: rgba(255, 255, 255, 0.88);
}

.dash-chart-title {
  margin-bottom: 8px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 1.2px;
  color: var(--neon-purple);
}

.dash-chart-body {
  min-height: 60px;
}

html.light .dash-title {
  filter: none;
}

html.light .dash-kpi {
  background: linear-gradient(160deg, rgba(0, 190, 220, 0.1), rgba(140, 92, 255, 0.06));
}

html.light .dash-kpi-value {
  color: #007c96;
  filter: none;
}

html.light .dash-head {
  background: linear-gradient(180deg, rgba(0, 190, 220, 0.1), transparent);
}

@keyframes dash-scanline {
  0% {
    transform: translateX(-120%);
  }
  100% {
    transform: translateX(460%);
  }
}

@keyframes dash-status-breathe {
  0%,
  100% {
    opacity: 1;
    box-shadow: 0 0 8px currentColor;
  }
  50% {
    opacity: 0.45;
    box-shadow: 0 0 2px currentColor;
  }
}

@media (max-width: 720px) {
  .dash-head {
    flex-wrap: wrap;
  }

  .dash-scroll {
    padding: 14px 14px 22px;
  }

  .dash-kpi-value {
    font-size: 24px;
  }
}

/* ============================================================
   多Agent编组协作（CREW LINK）
   ============================================================ */
.crew-workspace {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(rgba(157, 92, 255, 0.03) 1px, transparent 1px) 0 0 / 100% 36px,
    linear-gradient(90deg, rgba(157, 92, 255, 0.03) 1px, transparent 1px) 0 0 / 36px 100%,
    radial-gradient(800px 340px at 80% -10%, rgba(0, 234, 255, 0.1), transparent 70%),
    radial-gradient(700px 320px at 8% 0%, rgba(157, 92, 255, 0.12), transparent 70%),
    linear-gradient(160deg, rgba(6, 6, 16, 0.98), rgba(3, 6, 12, 0.99));
}

.crew-workspace[hidden] {
  display: none;
}

html.light .crew-workspace {
  background:
    linear-gradient(rgba(109, 63, 209, 0.05) 1px, transparent 1px) 0 0 / 100% 36px,
    linear-gradient(90deg, rgba(109, 63, 209, 0.05) 1px, transparent 1px) 0 0 / 36px 100%,
    radial-gradient(800px 340px at 80% -10%, rgba(0, 190, 220, 0.12), transparent 70%),
    radial-gradient(700px 320px at 8% 0%, rgba(140, 92, 255, 0.12), transparent 70%),
    linear-gradient(160deg, #f6f5fd, #eef5fb);
}

body.crew-scene .fx-rain,
body.crew-scene .orbs {
  display: none;
}

.crew-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(157, 92, 255, 0.08), transparent);
}

.crew-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10.5px;
  cursor: pointer;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.crew-back svg {
  width: 14px;
  height: 14px;
  stroke-width: 2;
}

.crew-back:hover {
  color: var(--neon-cyan);
  border-color: var(--border-glow);
}

.crew-head-main {
  flex: 1;
  min-width: 0;
}

.crew-title {
  font-family: var(--font-tech);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1.6px;
  background: linear-gradient(90deg, var(--neon-cyan), var(--neon-purple));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.crew-title span {
  -webkit-text-fill-color: var(--neon-pink);
}

.crew-sub {
  margin-top: 3px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.crew-head-tags {
  display: flex;
  align-items: center;
  gap: 6px;
}

.crew-tag {
  padding: 2px 8px;
  border: 1px solid rgba(157, 92, 255, 0.45);
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.8px;
  color: #c9b3ff;
  background: rgba(157, 92, 255, 0.1);
}

.crew-tag.running {
  border-color: rgba(0, 234, 255, 0.5);
  color: var(--neon-cyan);
  background: rgba(0, 234, 255, 0.1);
  animation: crew-node-breathe 1.8s ease-in-out infinite;
}

.crew-tag.completed {
  border-color: rgba(0, 255, 163, 0.5);
  color: var(--neon-green, #00ffa3);
  background: rgba(0, 255, 163, 0.1);
}

.crew-tag.failed {
  border-color: rgba(255, 46, 136, 0.5);
  color: var(--neon-pink);
  background: rgba(255, 46, 136, 0.1);
}

.crew-tag.cancelled {
  border-color: rgba(255, 200, 87, 0.5);
  color: var(--neon-amber);
  background: rgba(255, 200, 87, 0.1);
}

.crew-head-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.crew-action {
  padding: 4px 10px;
  border: 1px solid var(--border-glow);
  border-radius: 3px;
  background: rgba(0, 234, 255, 0.07);
  color: var(--neon-cyan);
  font-family: var(--font-mono);
  font-size: 10.5px;
  cursor: pointer;
  transition: background var(--transition-fast), box-shadow var(--transition-fast);
}

.crew-action:hover {
  background: rgba(0, 234, 255, 0.16);
  box-shadow: 0 0 10px rgba(0, 234, 255, 0.28);
}

.crew-action.danger {
  border-color: rgba(255, 46, 136, 0.45);
  color: #ff86b5;
  background: rgba(255, 46, 136, 0.08);
}

.crew-action.danger:hover {
  background: rgba(255, 46, 136, 0.18);
  box-shadow: 0 0 10px rgba(255, 46, 136, 0.3);
}

.crew-body {
  flex: 1;
  min-height: 0;
  display: flex;
}

.crew-side {
  width: 216px;
  flex: none;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: rgba(2, 7, 14, 0.4);
}

html.light .crew-side {
  background: rgba(255, 255, 255, 0.55);
}

.crew-side-title {
  padding: 12px 12px 6px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 1.2px;
  color: var(--text-faint);
}

.crew-runs {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 4px 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.crew-runs-empty,
.crew-members-empty,
.crew-pick-empty {
  padding: 12px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  text-align: center;
  font-size: 11px;
  color: var(--text-faint);
}

.crew-run-item {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(6, 14, 24, 0.6);
  cursor: pointer;
  transition: border-color var(--transition-fast), transform var(--transition-fast);
}

html.light .crew-run-item {
  background: rgba(255, 255, 255, 0.9);
}

.crew-run-item:hover {
  border-color: var(--border-glow);
  transform: translateX(2px);
}

.crew-run-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.crew-run-top b {
  font-size: 11.5px;
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.crew-run-status {
  flex: none;
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-muted);
}

.crew-run-status.running {
  color: var(--neon-cyan);
}

.crew-run-status.completed {
  color: var(--neon-green, #00ffa3);
}

.crew-run-status.failed {
  color: var(--neon-pink);
}

.crew-run-status.cancelled {
  color: var(--neon-amber);
}

.crew-run-sub {
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-faint);
}

.crew-main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* 编排台 */
.crew-setup {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 18px 22px;
}

.crew-setup[hidden] {
  display: none;
}

.crew-setup-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  align-items: start;
}

.crew-panel {
  padding: 12px 14px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgba(4, 12, 20, 0.62);
  clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px);
}

html.light .crew-panel {
  background: rgba(255, 255, 255, 0.9);
}

.crew-panel-title {
  margin-bottom: 8px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 1.2px;
  color: var(--neon-cyan);
}

.crew-panel-title span {
  margin-left: 6px;
  color: var(--text-faint);
}

#crew-task {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(2, 8, 16, 0.55);
  color: var(--text-main);
  font-size: 12.5px;
  line-height: 1.65;
  resize: vertical;
  outline: none;
}

html.light #crew-task {
  background: #ffffff;
}

#crew-task:focus {
  border-color: var(--border-glow);
  box-shadow: 0 0 0 2px rgba(0, 234, 255, 0.12);
}

#crew-name {
  width: 100%;
  margin-top: 8px;
  padding: 7px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(2, 8, 16, 0.55);
  color: var(--text-main);
  font-size: 12px;
  outline: none;
}

html.light #crew-name {
  background: #ffffff;
}

.crew-modes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 8px;
}

.crew-mode {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(2, 8, 16, 0.45);
  color: var(--text-sub);
  text-align: left;
  cursor: pointer;
  transition: border-color var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);
}

.crew-mode b {
  font-size: 12px;
  color: var(--text-main);
}

.crew-mode small {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-faint);
}

.crew-mode-icon svg {
  width: 32px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
}

.crew-mode.active {
  border-color: rgba(0, 234, 255, 0.55);
  background: rgba(0, 234, 255, 0.08);
  box-shadow: 0 0 12px rgba(0, 234, 255, 0.16);
  color: var(--neon-cyan);
}

.crew-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.crew-picker-sub {
  margin-bottom: 6px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 1px;
  color: var(--text-faint);
}

.crew-pick-list {
  max-height: 230px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 2px;
}

.crew-pick {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 7px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: transparent;
  color: var(--text-sub);
  text-align: left;
  cursor: pointer;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}

.crew-pick:hover {
  border-color: var(--border-glow);
  background: rgba(0, 234, 255, 0.06);
}

.crew-pick.selected {
  opacity: 0.5;
  cursor: default;
}

.crew-pick .pc-icon {
  width: 26px;
  height: 26px;
  font-size: 8.5px;
}

.crew-pick-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11.5px;
}

.crew-pick-mark {
  flex: none;
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--neon-cyan);
}

.crew-members {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 52px;
}

.crew-member {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: rgba(0, 234, 255, 0.04);
}

.crew-member-index {
  width: 18px;
  height: 18px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-glow);
  border-radius: 50%;
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--neon-cyan);
}

.crew-member .pc-icon {
  width: 26px;
  height: 26px;
  font-size: 8.5px;
}

.crew-member-name {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.crew-manager {
  flex: none;
  padding: 1px 5px;
  border: 1px solid rgba(255, 200, 87, 0.5);
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 8px;
  font-style: normal;
  letter-spacing: 0.8px;
  color: var(--neon-amber);
  background: rgba(255, 200, 87, 0.1);
}

.crew-member-ops {
  display: flex;
  gap: 4px;
}

.crew-member-ops button {
  width: 22px;
  height: 22px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: transparent;
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
}

.crew-member-ops button:hover:not(:disabled) {
  color: var(--neon-cyan);
  border-color: var(--border-glow);
}

.crew-member-ops button:disabled {
  opacity: 0.3;
  cursor: default;
}

.crew-member-ops button.danger:hover {
  color: #ff86b5;
  border-color: rgba(255, 46, 136, 0.45);
}

.crew-start {
  width: 100%;
  margin-top: 12px;
  height: 38px;
  border: 1px solid rgba(0, 234, 255, 0.55);
  background: linear-gradient(90deg, rgba(0, 234, 255, 0.2), rgba(157, 92, 255, 0.18));
  color: #d9fbff;
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 2px;
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
  cursor: pointer;
  transition: filter var(--transition-fast), transform var(--transition-fast);
}

.crew-start:hover:not(:disabled) {
  filter: drop-shadow(0 0 12px rgba(0, 234, 255, 0.5));
  transform: translateY(-1px);
}

.crew-start:disabled {
  opacity: 0.4;
  cursor: default;
}

.crew-tip {
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 9px;
  line-height: 1.6;
  color: var(--text-faint);
}

/* 动画舞台 */
.crew-stage {
  flex: 1;
  min-height: 0;
  display: flex;
}

.crew-stage[hidden] {
  display: none;
}

.crew-stage-main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.crew-stage-top {
  padding: 10px 16px 8px;
  border-bottom: 1px solid var(--border);
}

.crew-progress-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

.crew-progress-label b {
  color: var(--neon-cyan);
  font-size: 11px;
}

.crew-progress-bar {
  height: 3px;
  margin-top: 6px;
  border-radius: 2px;
  background: rgba(128, 128, 128, 0.16);
  overflow: hidden;
}

.crew-progress-bar i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--neon-cyan), var(--neon-purple));
  box-shadow: 0 0 10px rgba(0, 234, 255, 0.6);
  transition: width 0.4s var(--ease-out-soft);
}

.crew-canvas {
  position: relative;
  flex: none;
  height: 252px;
  margin: 8px 14px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background:
    radial-gradient(420px 200px at 50% 20%, rgba(0, 234, 255, 0.06), transparent 70%),
    rgba(2, 7, 14, 0.4);
  overflow: hidden;
}

html.light .crew-canvas {
  background:
    radial-gradient(420px 200px at 50% 20%, rgba(0, 190, 220, 0.08), transparent 70%),
    rgba(255, 255, 255, 0.6);
}

.crew-links {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  z-index: 0;
}

.crew-link {
  fill: none;
  stroke: rgba(128, 128, 128, 0.28);
  stroke-width: 1.6;
  stroke-dasharray: 5 7;
  transition: stroke 0.25s ease;
}

.crew-link.active {
  stroke: rgba(0, 234, 255, 0.5);
}

.crew-link-flow {
  fill: none;
  stroke: #00eaff;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-dasharray: 14 120;
  opacity: 0;
  filter: drop-shadow(0 0 5px rgba(0, 234, 255, 0.9));
}

.crew-link-flow.active {
  opacity: 1;
  animation: crew-flow-dash 1s linear infinite;
}

.crew-nodes {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: clamp(18px, 5vw, 70px);
  padding: 18px 30px;
}

.crew-nodes.hier .crew-node {
  position: absolute;
  transform: translate(-50%, -50%);
}

.crew-nodes.hier .crew-node.manager {
  left: 50%;
  top: 40%;
}

.crew-node {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  width: 118px;
}

.crew-node-core {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  clip-path: none;
  border-width: 2px;
  font-size: 14px;
  letter-spacing: 0.6px;
  transition: transform 0.25s var(--ease-out-soft), box-shadow 0.25s ease, border-color 0.25s ease;
}

.crew-node-name {
  max-width: 118px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-sub);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.crew-node-role {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  padding: 1px 5px;
  border: 1px solid rgba(255, 200, 87, 0.55);
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: 0.8px;
  color: var(--neon-amber);
  background: rgba(8, 8, 14, 0.9);
  white-space: nowrap;
}

.crew-node-check {
  position: absolute;
  top: 0;
  right: 8px;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--neon-green, #00ffa3);
  color: #03110b;
  font-size: 11px;
  font-weight: 800;
  opacity: 0;
  transform: scale(0.3);
  transition: opacity 0.25s ease, transform 0.25s var(--ease-out-soft);
  box-shadow: 0 0 10px rgba(0, 255, 163, 0.6);
}

.crew-node.done .crew-node-check {
  opacity: 1;
  transform: scale(1);
}

.crew-node.thinking .crew-node-core {
  border-color: rgba(255, 200, 87, 0.8);
  animation: crew-node-breathe 1.4s ease-in-out infinite;
}

.crew-node.speaking .crew-node-core {
  transform: scale(1.08);
  border-color: var(--neon-cyan);
  animation: crew-node-pulse 1.2s ease-out infinite;
}

.crew-node.done .crew-node-core {
  border-color: rgba(0, 255, 163, 0.7);
  box-shadow: 0 0 16px rgba(0, 255, 163, 0.35);
}

.crew-node.failed .crew-node-core {
  border-color: var(--neon-pink);
  box-shadow: 0 0 16px rgba(255, 46, 136, 0.5);
}

.crew-canvas-empty {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--text-faint);
}

/* 消息流 */
.crew-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 10px 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.crew-msg {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-left: 2px solid var(--neon-cyan);
  border-radius: 2px 8px 8px 2px;
  background: rgba(4, 12, 20, 0.7);
  animation: crew-msg-in 0.3s var(--ease-out-soft) backwards;
}

html.light .crew-msg {
  background: rgba(255, 255, 255, 0.92);
}

.crew-msg-head {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

.crew-msg-head b {
  color: var(--text-main);
  font-size: 11px;
}

.crew-msg-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--neon-cyan);
  box-shadow: 0 0 6px currentColor;
}

.crew-msg-dot.finance {
  background: var(--neon-green, #00ffa3);
}

.crew-msg-dot.mes {
  background: var(--neon-amber);
}

.crew-msg-dot.custom {
  background: var(--neon-purple);
}

.crew-msg-tag {
  padding: 0 5px;
  border: 1px solid var(--border);
  border-radius: 2px;
  font-size: 8.5px;
  color: var(--text-faint);
}

.crew-msg-time {
  margin-left: auto;
  font-size: 9px;
  color: var(--text-faint);
}

.crew-msg-body {
  font-size: 12.5px;
  line-height: 1.72;
  color: var(--text-sub);
  word-break: break-word;
}

.crew-msg-body p {
  margin: 4px 0;
}

.crew-msg-body ul,
.crew-msg-body ol {
  margin: 6px 0;
  padding-left: 20px;
}

.crew-msg-body li::marker {
  color: var(--neon-cyan);
}

.crew-msg-body strong {
  color: var(--text-main);
}

.crew-summary {
  padding: 12px 14px;
  border: 1px solid rgba(0, 255, 163, 0.4);
  border-radius: var(--radius-md);
  background: linear-gradient(160deg, rgba(0, 255, 163, 0.09), rgba(0, 234, 255, 0.04));
  animation: crew-msg-in 0.35s var(--ease-out-soft) backwards;
}

.crew-summary-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--neon-green, #00ffa3);
}

.crew-summary-head b {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 500;
}

.crew-summary-body {
  font-size: 12.5px;
  line-height: 1.72;
  color: var(--text-sub);
}

.crew-summary-body p {
  margin: 5px 0;
}

.crew-summary-traces {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.crew-trace-chip {
  padding: 2px 7px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-faint);
}

.crew-notice {
  padding: 10px 12px;
  border: 1px solid rgba(255, 200, 87, 0.4);
  border-radius: var(--radius-sm);
  background: rgba(255, 200, 87, 0.07);
  animation: crew-msg-in 0.3s var(--ease-out-soft) backwards;
}

.crew-notice.failed {
  border-color: rgba(255, 46, 136, 0.45);
  background: rgba(255, 46, 136, 0.08);
}

.crew-notice-head {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 1px;
  color: var(--neon-amber);
}

.crew-notice.failed .crew-notice-head {
  color: var(--neon-pink);
}

.crew-notice-body {
  margin-top: 5px;
  font-size: 12px;
  line-height: 1.7;
  color: var(--text-sub);
  white-space: pre-wrap;
  word-break: break-word;
}

/* 时间轴 */
.crew-timeline {
  width: 208px;
  flex: none;
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: rgba(2, 7, 14, 0.4);
}

html.light .crew-timeline {
  background: rgba(255, 255, 255, 0.55);
}

.crew-timeline-title {
  padding: 12px 12px 6px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 1.2px;
  color: var(--text-faint);
}

.crew-timeline-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 4px 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.crew-tl-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  opacity: 0.65;
}

.crew-tl-item.active,
.crew-tl-item.done {
  opacity: 1;
}

.crew-tl-dot {
  width: 9px;
  height: 9px;
  flex: none;
  margin-top: 4px;
  border-radius: 50%;
  background: var(--text-faint);
}

.crew-tl-item.active .crew-tl-dot {
  background: var(--neon-cyan);
  box-shadow: 0 0 10px var(--neon-cyan);
  animation: crew-node-breathe 1.4s ease-in-out infinite;
}

.crew-tl-item.done .crew-tl-dot {
  background: var(--neon-green, #00ffa3);
  box-shadow: 0 0 8px rgba(0, 255, 163, 0.6);
}

.crew-tl-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.crew-tl-main b {
  font-size: 11px;
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.crew-tl-main small {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-faint);
}

html.light .crew-title {
  filter: none;
}

html.light .crew-tag.running {
  animation: none;
}

@keyframes crew-node-breathe {
  0%,
  100% {
    box-shadow: 0 0 4px rgba(255, 200, 87, 0.25);
  }
  50% {
    box-shadow: 0 0 18px 4px rgba(255, 200, 87, 0.4);
  }
}

@keyframes crew-node-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(0, 234, 255, 0.45), 0 0 18px rgba(0, 234, 255, 0.5);
  }
  100% {
    box-shadow: 0 0 0 14px rgba(0, 234, 255, 0), 0 0 18px rgba(0, 234, 255, 0.45);
  }
}

@keyframes crew-flow-dash {
  to {
    stroke-dashoffset: -134;
  }
}

@keyframes crew-msg-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 1100px) {
  .crew-body {
    flex-direction: column;
  }

  .crew-side {
    width: 100%;
    max-height: 148px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .crew-runs {
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 10px;
  }

  .crew-run-item {
    min-width: 190px;
  }

  .crew-timeline {
    display: none;
  }
}

@media (max-width: 760px) {
  .crew-head {
    flex-wrap: wrap;
    gap: 8px;
  }

  .crew-setup-grid,
  .crew-picker,
  .crew-modes {
    grid-template-columns: 1fr;
  }

  .crew-canvas {
    height: 210px;
    margin: 8px 10px 0;
  }

  .crew-node {
    width: 92px;
  }

  .crew-node-core {
    width: 54px;
    height: 54px;
    font-size: 12px;
  }

  .crew-actions {
    width: 100%;
  }
}

/* ============================================================
   团队协作：工作区切换、团队管理、共享标识
   ============================================================ */
.workspace-bar {
  margin: 10px 14px 2px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(0, 234, 255, 0.04);
}

html.light .workspace-bar {
  background: rgba(0, 190, 220, 0.06);
}

.workspace-label {
  margin-bottom: 6px;
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 1.4px;
  color: var(--text-faint);
}

.workspace-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

#workspace-select {
  flex: 1;
  min-width: 0;
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--border-glow);
  border-radius: 3px;
  /* 不透明深色底：原生下拉列表会继承该背景，半透明会渲染成白底 */
  background-color: #050c16;
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 10.5px;
  outline: none;
}

html.light #workspace-select {
  background-color: #ffffff;
}

.workspace-manage {
  flex: none;
  height: 28px;
  padding: 0 9px;
  border: 1px solid rgba(157, 92, 255, 0.45);
  border-radius: 3px;
  background: rgba(157, 92, 255, 0.12);
  color: #c9b3ff;
  font-family: var(--font-mono);
  font-size: 10px;
  cursor: pointer;
}

.workspace-manage:hover {
  border-color: var(--neon-purple);
  box-shadow: 0 0 10px rgba(157, 92, 255, 0.3);
}

.team-badge {
  border-color: rgba(157, 92, 255, 0.5);
  color: #c9b3ff;
  background: rgba(157, 92, 255, 0.12);
}

.agent-share-badge {
  margin-left: 6px;
  padding: 0 4px;
  border: 1px solid rgba(157, 92, 255, 0.5);
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 8px;
  font-style: normal;
  color: #c9b3ff;
  vertical-align: middle;
}

/* 团队管理窗口 */
.team-card {
  width: min(940px, 94vw);
  max-height: 88vh;
  overflow: hidden;
}

.team-toolbar {
  display: flex;
  gap: 8px;
  margin: 10px 0 14px;
}

#team-name {
  flex: 1;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(2, 8, 16, 0.6);
  color: var(--text-main);
  font-size: 12px;
  outline: none;
}

html.light #team-name {
  background: #ffffff;
}

#team-name:focus {
  border-color: var(--border-glow);
}

.team-layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 14px;
  min-height: 320px;
}

.team-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-height: 58vh;
  overflow-y: auto;
  padding-right: 2px;
}

.team-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  text-align: left;
  color: var(--text-sub);
  cursor: pointer;
}

.team-item b {
  font-size: 12px;
  color: var(--text-main);
}

.team-item small {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-faint);
}

.team-item:hover,
.team-item.active {
  border-color: rgba(157, 92, 255, 0.55);
  background: rgba(157, 92, 255, 0.1);
}

.team-item.active b {
  color: #d9d1ff;
}

.team-list-empty,
.team-empty {
  padding: 18px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  text-align: center;
  font-size: 11.5px;
  color: var(--text-faint);
}

.team-detail {
  min-width: 0;
  max-height: 58vh;
  overflow-y: auto;
  padding-right: 4px;
}

.team-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--border);
}

.team-head b {
  font-size: 16px;
  color: var(--text-main);
}

.team-head small {
  margin-left: 8px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--neon-purple);
}

.team-meta {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--text-faint);
}

.team-block {
  margin-bottom: 16px;
}

.team-block-title {
  margin-bottom: 7px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 1.1px;
  color: var(--neon-cyan);
}

.team-members,
.team-agents {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}

.team-member,
.team-agent-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: rgba(0, 234, 255, 0.03);
}

.team-member-main,
.team-agent-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.team-member-main b,
.team-agent-main b {
  font-size: 12px;
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-member-main small,
.team-agent-main small {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-faint);
}

.team-member select,
.team-agent-item select,
.team-add select {
  height: 27px;
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: 3px;
  /* 不透明深色底：避免原生下拉列表继承半透明背景后变成白底 */
  background-color: #050c16;
  color: var(--text-sub);
  font-size: 10.5px;
  outline: none;
}

html.light .team-member select,
html.light .team-agent-item select,
html.light .team-add select {
  background: #ffffff;
}

.team-remove {
  width: 24px;
  height: 24px;
  flex: none;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.team-remove:hover:not(:disabled) {
  color: #ff86b5;
  border-color: rgba(255, 46, 136, 0.45);
}

.team-remove:disabled {
  opacity: 0.3;
  cursor: default;
}

.team-add {
  display: flex;
  gap: 6px;
  align-items: center;
}

.team-add select {
  flex: 1;
  min-width: 0;
}

.team-add .ghost-btn {
  flex: none;
}

.team-hint {
  margin-top: 6px;
  font-size: 10px;
  line-height: 1.6;
  color: var(--text-faint);
}

@media (max-width: 760px) {
  .team-layout {
    grid-template-columns: 1fr;
  }

  .team-list {
    max-height: 150px;
  }

  .team-detail {
    max-height: 46vh;
  }

  .team-add {
    flex-wrap: wrap;
  }

  .team-add select {
    flex: 1 1 40%;
  }
}

/* ================= 团队群聊：QQ / 微信式消息流 ================= */

.group-side {
  flex: none;
}

.group-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 176px;
  overflow-y: auto;
  padding-right: 2px;
}

.group-empty {
  padding: 8px 10px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-faint);
  font-size: 11px;
}

.group-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 9px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-sub);
  text-align: left;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.group-item:hover {
  background: var(--bg-hover);
  border-color: var(--border);
}

.group-item.active {
  background: var(--bg-active);
  border-color: var(--border-strong);
  color: var(--text-main);
}

.group-item-icon {
  width: 26px;
  height: 26px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(157, 92, 255, 0.28), rgba(0, 234, 255, 0.18));
  border: 1px solid rgba(157, 92, 255, 0.4);
  color: var(--neon-cyan);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 800;
}

.group-item-meta {
  min-width: 0;
  flex: 1;
}

.group-item-name {
  font-size: 12.5px;
  font-weight: 600;
  color: inherit;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-item-sub {
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--text-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-new {
  width: 100%;
  margin-top: 6px;
  padding: 6px 8px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--brand);
  font-size: 11.5px;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.group-new:hover {
  background: var(--bg-hover);
  border-color: var(--brand);
}

/* ---- 群聊工作区 ---- */

.group-workspace {
  --gw-accent: #9d5cff;
  --gw-accent-soft: rgba(157, 92, 255, 0.08);
  --gw-accent-border: rgba(157, 92, 255, 0.3);
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(rgba(157, 92, 255, 0.035) 1px, transparent 1px) 0 0 / 100% 34px,
    linear-gradient(90deg, rgba(157, 92, 255, 0.035) 1px, transparent 1px) 0 0 / 34px 100%,
    linear-gradient(160deg, rgba(9, 6, 18, 0.97), rgba(3, 5, 10, 0.98));
}

.group-workspace[hidden] {
  display: none;
}

html.light .group-workspace {
  --gw-accent: #6d28d9;
  --gw-accent-soft: rgba(109, 40, 217, 0.06);
  --gw-accent-border: rgba(109, 40, 217, 0.26);
  background:
    linear-gradient(rgba(109, 40, 217, 0.04) 1px, transparent 1px) 0 0 / 100% 34px,
    linear-gradient(90deg, rgba(109, 40, 217, 0.04) 1px, transparent 1px) 0 0 / 34px 100%,
    linear-gradient(160deg, #faf7ff, #f2f5fb);
}

body.group-scene .fx-rain,
body.group-scene .orbs {
  display: none;
}

.gw-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--gw-accent-border);
  background: linear-gradient(90deg, var(--gw-accent-soft), transparent 62%);
  flex-wrap: wrap;
}

.gw-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--gw-accent-border);
  background: transparent;
  color: var(--gw-accent);
  font-size: 12px;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.gw-back:hover {
  background: var(--gw-accent-soft);
  border-color: var(--gw-accent);
}

.gw-back svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.gw-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.gw-avatar {
  width: 34px;
  height: 34px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  clip-path: polygon(5px 0, 100% 0, 100% calc(100% - 5px), calc(100% - 5px) 100%, 0 100%, 0 5px);
  background: var(--gw-accent-soft);
  border: 1px solid var(--gw-accent-border);
  color: var(--gw-accent);
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 800;
}

.gw-meta {
  min-width: 0;
}

.gw-name {
  font-family: var(--font-tech);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gw-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gw-tags {
  display: flex;
  gap: 6px;
}

.gw-tag {
  padding: 2px 8px;
  border-radius: var(--radius-full);
  border: 1px solid var(--gw-accent-border);
  color: var(--gw-accent);
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.8px;
}

.gw-tag.live::before {
  content: '';
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-right: 5px;
  border-radius: 50%;
  background: var(--gw-accent);
  box-shadow: 0 0 8px var(--gw-accent);
}

.gw-actions {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

.gw-btn {
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-sub);
  font-size: 11.5px;
  cursor: pointer;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.gw-btn:hover {
  color: var(--gw-accent);
  border-color: var(--gw-accent-border);
}

.gw-member-strip {
  display: flex;
  gap: 6px;
  padding: 8px 18px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  background: rgba(4, 7, 13, 0.55);
}

html.light .gw-member-strip {
  background: rgba(255, 255, 255, 0.72);
}

.gw-person {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: none;
  padding: 3px 8px 3px 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  color: var(--text-sub);
  font-size: 10.5px;
  white-space: nowrap;
}

.gw-person.agent {
  border-color: var(--gw-accent-border);
  color: var(--text-main);
}

.gw-person-avatar {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--bg-active);
  color: var(--brand);
  font-family: var(--font-mono);
  font-size: 8.5px;
  font-weight: 800;
}

.gw-person.agent .gw-person-avatar {
  background: var(--gw-accent-soft);
  color: var(--gw-accent);
}

.gw-person-role {
  color: var(--text-faint);
  font-size: 9px;
}

.gw-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.gw-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 22px 10px;
}

.gm-date {
  margin: 6px auto 16px;
  padding: 2px 10px;
  width: fit-content;
  border-radius: var(--radius-full);
  background: rgba(0, 234, 255, 0.06);
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.5px;
}

.gm-row {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  align-items: flex-start;
}

.gm-row.self {
  flex-direction: row-reverse;
}

.gm-avatar {
  width: 34px;
  height: 34px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-active);
  color: var(--brand);
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 800;
}

.gm-row.agent .gm-avatar {
  border-color: var(--gw-accent-border);
  background: var(--gw-accent-soft);
  color: var(--gw-accent);
}

.gm-row.self .gm-avatar {
  background: linear-gradient(135deg, rgba(0, 234, 255, 0.25), rgba(157, 92, 255, 0.3));
  color: #021018;
  border-color: var(--border-glow);
}

.gm-main {
  max-width: min(760px, 74%);
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.gm-row.self .gm-main {
  align-items: flex-end;
}

.gm-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  font-size: 10.5px;
  color: var(--text-muted);
}

.gm-row.self .gm-head {
  flex-direction: row-reverse;
}

.gm-name {
  color: var(--text-sub);
  font-weight: 600;
}

.gm-row.self .gm-name {
  color: var(--brand);
}

.gm-role {
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
  font-size: 8.5px;
  color: var(--text-faint);
  letter-spacing: 0.4px;
}

.gm-role.agent {
  border-color: var(--gw-accent-border);
  color: var(--gw-accent);
}

.gm-bubble {
  padding: 10px 13px;
  border-radius: 2px var(--radius-lg) var(--radius-lg) var(--radius-lg);
  background: var(--assistant-bubble);
  border: 1px solid var(--assistant-border);
  border-left: 2px solid rgba(157, 92, 255, 0.55);
  color: var(--text-main);
  font-size: 13.5px;
  line-height: 1.72;
  word-break: break-word;
  box-shadow: var(--shadow-sm);
}

.gm-row.self .gm-bubble {
  background: var(--user-bubble);
  border: 1px solid rgba(0, 234, 255, 0.32);
  border-radius: var(--radius-lg) 2px var(--radius-lg) var(--radius-lg);
  color: #f2fdff;
}

html.light .gm-row.self .gm-bubble {
  color: var(--text-main);
  border-color: rgba(0, 150, 200, 0.34);
}

.gm-bubble p {
  margin: 0 0 7px;
}

.gm-bubble p:last-child {
  margin-bottom: 0;
}

.gm-time {
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--text-faint);
  letter-spacing: 0.3px;
}

.gm-row.self .gm-time {
  text-align: right;
}

.gm-row.system {
  justify-content: center;
  margin: 8px 0 14px;
}

.gm-row.system .gm-main {
  max-width: 86%;
  align-items: center;
}

.gm-system-bubble {
  padding: 4px 12px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-full);
  background: rgba(0, 234, 255, 0.04);
  color: var(--text-muted);
  font-size: 10.5px;
  line-height: 1.6;
  text-align: center;
}

.gm-mentions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 5px;
}

.gm-mention {
  padding: 0 6px;
  border: 1px solid var(--gw-accent-border);
  border-radius: var(--radius-full);
  color: var(--gw-accent);
  font-family: var(--font-mono);
  font-size: 9px;
}

.gm-report {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 9px;
  padding: 10px 12px;
  border: 1px solid rgba(0, 255, 163, 0.34);
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(0, 255, 163, 0.08), rgba(0, 234, 255, 0.05));
}

.gm-report-info {
  min-width: 0;
  flex: 1;
}

.gm-report-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gm-report-file {
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--text-faint);
}

.gm-report-btn {
  flex: none;
  padding: 5px 10px;
  border: 1px solid rgba(0, 255, 163, 0.42);
  border-radius: var(--radius-sm);
  background: rgba(0, 255, 163, 0.1);
  color: var(--neon-green);
  font-size: 11px;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.gm-report-btn:hover {
  background: rgba(0, 255, 163, 0.2);
}

.gw-typing {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 22px;
  color: var(--gw-accent);
  font-size: 11.5px;
}

.gw-typing[hidden] {
  display: none;
}

.gw-composer {
  flex: none;
  padding: 10px 18px 14px;
  border-top: 1px solid var(--border);
  background: var(--bg-composer);
}

.gw-mentions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.gw-mention-chip {
  padding: 3px 9px;
  border: 1px solid var(--gw-accent-border);
  border-radius: var(--radius-full);
  background: var(--gw-accent-soft);
  color: var(--gw-accent);
  font-family: var(--font-mono);
  font-size: 10px;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.gw-mention-chip:hover {
  background: rgba(157, 92, 255, 0.18);
  border-color: var(--gw-accent);
}

.gw-input-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

#gw-input {
  flex: 1;
  min-height: 44px;
  max-height: 160px;
  resize: none;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgba(6, 10, 18, 0.78);
  color: var(--text-main);
  font-family: var(--font-ui);
  font-size: 13.5px;
  line-height: 1.55;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

#gw-input:focus {
  border-color: var(--gw-accent-border);
  box-shadow: 0 0 0 2px var(--gw-accent-soft);
}

html.light #gw-input {
  background: rgba(255, 255, 255, 0.9);
}

.gw-send {
  flex: none;
  height: 44px;
  min-width: 76px;
  padding: 0 16px;
  border: 1px solid var(--gw-accent-border);
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(157, 92, 255, 0.28), rgba(0, 234, 255, 0.18));
  color: var(--text-main);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}

.gw-send:hover:not(:disabled) {
  border-color: var(--gw-accent);
  background: linear-gradient(135deg, rgba(157, 92, 255, 0.4), rgba(0, 234, 255, 0.26));
}

.gw-send:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.gw-hint {
  margin-top: 6px;
  font-size: 10px;
  line-height: 1.6;
  color: var(--text-faint);
}

/* ---- 群聊弹窗 ---- */

.group-card {
  width: min(620px, 92vw);
}

.group-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 0 2px;
}

.group-preview-chip {
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  color: var(--text-sub);
  font-size: 10.5px;
}

.group-members-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 56vh;
  overflow-y: auto;
}

.group-member-agents,
.group-member-humans {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}

.group-member-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(0, 234, 255, 0.03);
}

.group-member-name {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-member-tag {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-faint);
}

.group-member-remove {
  padding: 2px 7px;
  border: 1px solid var(--border-pink);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--neon-pink);
  font-size: 10px;
  cursor: pointer;
}

.group-member-remove:hover {
  background: rgba(255, 46, 136, 0.12);
}

@media (max-width: 900px) {
  .gw-head {
    gap: 10px;
  }

  .gw-tags {
    display: none;
  }

  .gw-actions {
    margin-left: 0;
  }

  .gm-main {
    max-width: 84%;
  }

  .gw-messages {
    padding: 14px 12px 8px;
  }

  .gw-composer {
    padding: 8px 12px 12px;
  }
}

/* ------------------------------------------------------------------
   CSV 批量导入（P0-2）：上传入口 + 预览面板
   ------------------------------------------------------------------ */

.import-card {
  width: min(760px, 94vw);
}

.import-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.import-toolbar input[type='text'] {
  flex: 1 1 220px;
  min-width: 160px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(4, 8, 15, 0.7);
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 12px;
}

.import-toolbar input[type='text']:focus {
  outline: none;
  border-color: var(--border-glow);
}

html.light .import-toolbar input[type='text'] {
  background: rgba(255, 255, 255, 0.92);
  color: #10202c;
}

.import-hint {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-muted);
}

.import-result {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}

.import-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px 16px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(0, 234, 255, 0.04);
}

.import-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 11.5px;
}

.import-line span {
  color: var(--text-muted);
}

.import-line b {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-main);
}

.import-bad,
.import-warn,
.import-ok {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  line-height: 1.7;
}

.import-bad {
  border: 1px solid rgba(255, 46, 136, 0.45);
  background: rgba(255, 46, 136, 0.08);
  color: #ff9cbf;
}

.import-warn {
  border: 1px solid rgba(255, 200, 87, 0.42);
  background: rgba(255, 200, 87, 0.08);
  color: #ffd98a;
}

.import-ok {
  border: 1px solid rgba(0, 255, 163, 0.38);
  background: rgba(0, 255, 163, 0.08);
  color: #7ff5c6;
}

.import-table {
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.import-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.import-table th,
.import-table td {
  padding: 6px 10px;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

.import-table th {
  position: sticky;
  top: 0;
  background: rgba(6, 12, 20, 0.96);
  color: var(--neon-cyan);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.4px;
}

html.light .import-table th {
  background: rgba(240, 248, 252, 0.98);
  color: #0b6c80;
}

.import-table td {
  color: var(--text-sub);
  font-family: var(--font-mono);
}

.import-note {
  font-size: 10.5px;
  color: var(--text-muted);
}

.import-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

/* ------------------------------------------------------------------
   首启向导（P0-4）：四步开通
   ------------------------------------------------------------------ */

.setup-card {
  width: min(560px, 94vw);
  max-height: 88vh;
  overflow-y: auto;
}

.setup-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0 16px;
}

.setup-step {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.4px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.setup-step.active {
  border-color: var(--border-glow);
  color: var(--neon-cyan);
  background: rgba(0, 234, 255, 0.08);
}

.setup-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 12px;
  font-size: 11.5px;
  color: var(--text-sub);
}

.setup-field input,
.setup-field select {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(4, 8, 15, 0.7);
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 12px;
}

/* 下拉框单独使用不透明深色底，避免原生下拉列表渲染成白色 */
.setup-field select {
  background-color: #050c16;
}

.setup-field input:focus,
.setup-field select:focus {
  outline: none;
  border-color: var(--border-glow);
}

html.light .setup-field input,
html.light .setup-field select {
  background: rgba(255, 255, 255, 0.92);
  color: #10202c;
}

html.light .setup-field select {
  background-color: #ffffff;
}

.setup-token-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.setup-token-row input {
  flex: 1;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-glow);
  background: rgba(0, 234, 255, 0.06);
  color: var(--neon-cyan);
  font-family: var(--font-mono);
  font-size: 11.5px;
}

.setup-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin: 8px 0 12px;
}

/* ------------------------------------------------------------------
   首屏简报（P0-5）：欢迎页顶部资产卡
   ------------------------------------------------------------------ */

.brief-card {
  margin: 18px auto 6px;
  max-width: 860px;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: linear-gradient(150deg, rgba(0, 234, 255, 0.06), rgba(157, 92, 255, 0.05));
  text-align: left;
}

.brief-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.brief-head b {
  font-size: 13px;
  color: var(--text-main);
  letter-spacing: 0.4px;
}

.brief-head span {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

.brief-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.brief-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(4, 8, 15, 0.35);
}

.brief-stat b {
  font-family: var(--font-mono);
  font-size: 17px;
  color: var(--neon-cyan);
  line-height: 1.1;
}

.brief-stat span {
  font-size: 10px;
  color: var(--text-muted);
}

.brief-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}

.brief-row em {
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  min-width: 72px;
}

.brief-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(0, 234, 255, 0.05);
  font-size: 11px;
  color: var(--text-sub);
}

.brief-chip i {
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--text-faint);
}

.brief-logs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.brief-log {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
}

.brief-foot {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  font-size: 11px;
  color: var(--text-muted);
}

.brief-empty {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.brief-empty b {
  font-size: 13px;
  color: var(--text-main);
}

.brief-empty span {
  font-size: 11.5px;
  color: var(--text-muted);
}

.brief-empty-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.brief-empty-actions button {
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: rgba(0, 234, 255, 0.07);
  color: var(--neon-cyan);
  font-size: 11.5px;
}

.brief-empty-actions button:hover {
  background: rgba(0, 234, 255, 0.14);
}

/* 套餐额度提醒（P1-2） */
.quota-badge {
  padding: 3px 9px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 200, 87, 0.55);
  background: rgba(255, 200, 87, 0.1);
  color: var(--neon-amber);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.3px;
  cursor: pointer;
}

.quota-badge.danger {
  border-color: rgba(255, 46, 136, 0.6);
  background: rgba(255, 46, 136, 0.12);
  color: var(--neon-pink);
}

.quota-badge:hover {
  filter: brightness(1.2);
}

/* 到期提醒（P1-11） */
.expiry-badge {
  padding: 3px 9px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(0, 234, 255, 0.45);
  background: rgba(0, 234, 255, 0.08);
  color: var(--neon-cyan);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.3px;
  cursor: pointer;
}

.expiry-badge.danger {
  border-color: rgba(255, 46, 136, 0.65);
  background: rgba(255, 46, 136, 0.14);
  color: var(--neon-pink);
}

.expiry-badge:hover {
  filter: brightness(1.2);
}

/* 到期降级后的冻结清单（P1-11） */
.billing-frozen {
  margin-top: 10px;
  padding: 8px 10px;
  border-left: 2px solid rgba(255, 46, 136, 0.7);
  background: rgba(255, 46, 136, 0.07);
  border-radius: var(--radius-sm);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.billing-frozen b {
  width: 100%;
  font-size: 10.5px;
  color: var(--neon-pink);
}

.billing-frozen span {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-muted);
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

/* ------------------------------------------------------------------
   套餐与订单（P1-3）
   ------------------------------------------------------------------ */

.billing-view {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(rgba(0, 234, 255, 0.03) 1px, transparent 1px) 0 0 / 100% 38px,
    radial-gradient(900px 380px at 10% -10%, rgba(0, 234, 255, 0.1), transparent 70%),
    linear-gradient(160deg, rgba(3, 9, 17, 0.98), rgba(2, 6, 12, 0.99));
}

.billing-view[hidden] {
  display: none;
}

html.light .billing-view {
  background:
    linear-gradient(rgba(0, 150, 190, 0.05) 1px, transparent 1px) 0 0 / 100% 38px,
    linear-gradient(160deg, #f3fafd, #eef4fb);
}

.billing-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 22px 28px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-content: start;
}

.billing-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  background: rgba(6, 12, 20, 0.55);
}

.billing-card:last-child {
  grid-column: 1 / -1;
}

/* 整行卡片（订单/发票/合同，P1-11） */
.billing-card.billing-wide {
  grid-column: 1 / -1;
}

.billing-card h3 {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--text-main);
  letter-spacing: 0.4px;
}

html.light .billing-card {
  background: rgba(255, 255, 255, 0.72);
}

.billing-plan-name {
  font-size: 22px;
  font-weight: 600;
  color: var(--neon-cyan);
}

.billing-plan-price {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-sub);
  margin-top: 4px;
}

.billing-plan-quota {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0 8px;
}

.billing-plan-quota span {
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.billing-plan-status {
  font-size: 11.5px;
  color: var(--text-muted);
}

.billing-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.billing-form select,
.billing-form input {
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(4, 8, 15, 0.7);
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 11.5px;
}

.billing-form select {
  flex: 1 1 220px;
  /* 下拉框使用不透明深色底，避免原生下拉列表渲染成白色 */
  background-color: #050c16;
}

.billing-form input[type='number'] {
  width: 80px;
}

.billing-form input[type='text'] {
  flex: 1 1 160px;
}

html.light .billing-form select,
html.light .billing-form input {
  background: rgba(255, 255, 255, 0.9);
  color: #10202c;
}

html.light .billing-form select {
  background-color: #ffffff;
}

.billing-orders {
  overflow-x: auto;
}

.billing-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
}

.billing-table th,
.billing-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}

.billing-table th {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 500;
}

.billing-table .num {
  text-align: right;
  font-family: var(--font-mono);
}

.billing-table .mono {
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.billing-status {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  color: var(--text-sub);
}

.billing-status.paid,
.billing-status.invoiced {
  border-color: rgba(0, 255, 163, 0.45);
  color: var(--neon-green);
}

.billing-status.pending {
  border-color: rgba(255, 200, 87, 0.5);
  color: var(--neon-amber);
}

/* 合同状态（P1-11） */
.billing-status.signed {
  border-color: rgba(0, 255, 163, 0.45);
  color: var(--neon-green);
}

.billing-status.generated {
  border-color: rgba(255, 200, 87, 0.5);
  color: var(--neon-amber);
}

.billing-status.archived {
  color: var(--text-faint);
}

.billing-actions {
  display: flex;
  gap: 6px;
}

.billing-actions button {
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: rgba(0, 234, 255, 0.07);
  color: var(--neon-cyan);
  font-size: 10.5px;
}

.billing-actions button:hover {
  background: rgba(0, 234, 255, 0.16);
}

/* 交付人天补录（P1-10） */
.billing-days-cell {
  white-space: nowrap;
}

.billing-days-input {
  width: 64px;
  padding: 3px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(4, 8, 15, 0.6);
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 10.5px;
}

.billing-days-cell button {
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: rgba(0, 234, 255, 0.07);
  color: var(--neon-cyan);
  font-size: 10.5px;
}

html.light .billing-days-input {
  background: rgba(255, 255, 255, 0.85);
  color: #10202c;
}

.billing-empty {
  padding: 18px;
  text-align: center;
  font-size: 11.5px;
  color: var(--text-muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
}

html.light .billing-view .dash-title,
html.light .billing-card h3 {
  color: #10202c;
}

@media (max-width: 900px) {
  .billing-body {
    grid-template-columns: 1fr;
  }
}

/* ------------------------------------------------------------------
   模板库与开箱引导（P1-7 / P1-8）
   ------------------------------------------------------------------ */

.packs-view {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(rgba(0, 234, 255, 0.03) 1px, transparent 1px) 0 0 / 100% 38px,
    radial-gradient(900px 380px at 12% -10%, rgba(0, 234, 255, 0.1), transparent 70%),
    linear-gradient(160deg, rgba(3, 9, 17, 0.98), rgba(2, 6, 12, 0.99));
}

.packs-view[hidden] {
  display: none;
}

html.light .packs-view {
  background:
    linear-gradient(rgba(0, 150, 190, 0.05) 1px, transparent 1px) 0 0 / 100% 38px,
    linear-gradient(160deg, #f3fafd, #eef4fb);
}

.packs-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 22px 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.packs-onboarding {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  background: rgba(0, 234, 255, 0.05);
}

.onboard-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.onboard-head b {
  font-size: 13px;
  color: var(--neon-cyan);
}

.onboard-head span {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-muted);
}

.onboard-scenes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.onboard-scene {
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(4, 8, 15, 0.5);
  color: var(--text-sub);
  font-size: 11.5px;
}

.onboard-scene.active {
  border-color: var(--border-glow);
  color: var(--neon-cyan);
  background: rgba(0, 234, 255, 0.1);
}

.onboard-config {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 12px;
  align-items: end;
}

.onboard-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 11px;
  color: var(--text-sub);
}

.onboard-field input {
  padding: 7px 9px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(4, 8, 15, 0.7);
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 11px;
}

html.light .onboard-field input {
  background: #fff;
  color: #10202c;
}

.onboard-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
}

.onboard-check {
  font-size: 11px;
  color: var(--text-muted);
}

.onboard-check.done {
  color: var(--neon-green);
}

.packs-section-title {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--text-main);
}

.packs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.pack-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  background: rgba(6, 12, 20, 0.55);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

html.light .pack-card {
  background: rgba(255, 255, 255, 0.75);
}

.pack-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.pack-head b {
  font-size: 13.5px;
  color: var(--text-main);
}

.pack-head span {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-faint);
}

.pack-audience {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--text-muted);
}

.pack-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pack-meta span {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.pack-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
}

.pack-actions button {
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: rgba(0, 234, 255, 0.07);
  color: var(--neon-cyan);
  font-size: 11px;
}

.pack-actions button.primary {
  background: rgba(0, 234, 255, 0.16);
  border-color: var(--border-glow);
}

.pack-actions button:hover {
  filter: brightness(1.2);
}

.packs-installed {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pack-installed {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  background: rgba(6, 12, 20, 0.5);
}

html.light .pack-installed {
  background: rgba(255, 255, 255, 0.75);
}

.pack-installed-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  color: var(--text-main);
}

.pack-installed-head span {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-faint);
}

.pack-installed-agents {
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-muted);
}

.pack-installed-reports {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.pack-installed-reports button {
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(0, 234, 255, 0.05);
  color: var(--text-sub);
  font-size: 10.5px;
}

html.light .packs-section-title,
html.light .pack-head b {
  color: #10202c;
}

html.light .brief-card {
  background: linear-gradient(150deg, rgba(0, 120, 160, 0.06), rgba(120, 90, 200, 0.05));
}

html.light .brief-stat,
html.light .brief-chip {
  background: rgba(255, 255, 255, 0.7);
}

/* ------------------------------------------------------------------
   运营看板（P1-10）
   北极星 + 五级漏斗 + 健康分 + Token 成本 + 交付人天
   ------------------------------------------------------------------ */

.analytics-view {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(rgba(0, 234, 255, 0.03) 1px, transparent 1px) 0 0 / 100% 38px,
    radial-gradient(900px 380px at 88% -10%, rgba(120, 90, 255, 0.12), transparent 70%),
    linear-gradient(160deg, rgba(3, 9, 17, 0.98), rgba(2, 6, 12, 0.99));
}

.analytics-view[hidden] {
  display: none;
}

html.light .analytics-view {
  background:
    linear-gradient(rgba(0, 150, 190, 0.05) 1px, transparent 1px) 0 0 / 100% 38px,
    linear-gradient(160deg, #f3fafd, #eef4fb);
}

.analytics-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 22px 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.analytics-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.analytics-kpi {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  background: rgba(6, 12, 20, 0.55);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.analytics-kpi span {
  font-size: 11.5px;
  color: var(--text-muted);
}

.analytics-kpi b {
  font-family: var(--font-mono);
  font-size: 22px;
  color: var(--neon-cyan);
}

.analytics-kpi em {
  font-style: normal;
  font-size: 10.5px;
  color: var(--text-faint);
}

html.light .analytics-kpi {
  background: rgba(255, 255, 255, 0.72);
}

.analytics-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.analytics-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  background: rgba(6, 12, 20, 0.55);
}

.analytics-card h3 {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--text-main);
  letter-spacing: 0.4px;
}

html.light .analytics-card {
  background: rgba(255, 255, 255, 0.72);
}

.analytics-bar {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) 56px;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 11.5px;
  color: var(--text-sub);
}

.analytics-bar i {
  display: block;
  height: 8px;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, rgba(0, 234, 255, 0.85), rgba(120, 90, 255, 0.8));
}

.analytics-bar b {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-main);
  text-align: right;
}

.analytics-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 0;
  font-size: 11.5px;
  color: var(--text-sub);
  border-bottom: 1px dashed var(--border);
}

.analytics-line:last-of-type {
  border-bottom: none;
}

.analytics-line b {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--neon-cyan);
}

.analytics-note {
  margin-top: 10px;
  font-size: 10.5px;
  color: var(--text-faint);
  line-height: 1.6;
}

.analytics-top {
  margin-top: 10px;
}

.analytics-score {
  font-family: var(--font-mono);
  font-size: 30px;
  color: var(--neon-amber);
  margin-bottom: 10px;
}

.analytics-score small {
  font-size: 12px;
  color: var(--text-faint);
}

.analytics-light {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px 10px;
  margin-bottom: 8px;
  border-left: 2px solid rgba(255, 46, 136, 0.7);
  background: rgba(255, 46, 136, 0.06);
  border-radius: var(--radius-sm);
}

.analytics-light b {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--neon-pink);
}

.analytics-light span {
  font-size: 11.5px;
  color: var(--text-main);
}

.analytics-light em {
  font-style: normal;
  font-size: 10.5px;
  color: var(--text-muted);
}

.analytics-ok {
  font-size: 11.5px;
  color: var(--neon-green);
}

/* ------------------------------------------------------------------
   关于与合规（P1-9）
   ------------------------------------------------------------------ */

.compliance-view {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(rgba(0, 234, 255, 0.03) 1px, transparent 1px) 0 0 / 100% 38px,
    radial-gradient(900px 380px at 20% -10%, rgba(0, 255, 163, 0.08), transparent 70%),
    linear-gradient(160deg, rgba(3, 9, 17, 0.98), rgba(2, 6, 12, 0.99));
}

.compliance-view[hidden] {
  display: none;
}

html.light .compliance-view {
  background:
    linear-gradient(rgba(0, 150, 190, 0.05) 1px, transparent 1px) 0 0 / 100% 38px,
    linear-gradient(160deg, #f3fafd, #eef4fb);
}

.compliance-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 22px 28px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-content: start;
}

.compliance-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  background: rgba(6, 12, 20, 0.55);
}

.compliance-card h3 {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--text-main);
  letter-spacing: 0.4px;
}

html.light .compliance-card {
  background: rgba(255, 255, 255, 0.72);
}

.compliance-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
}

.compliance-item:last-child {
  border-bottom: none;
}

.compliance-item span {
  font-size: 10.5px;
  color: var(--text-faint);
}

.compliance-item b {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-main);
  word-break: break-all;
}

.compliance-boundary {
  margin-top: 12px;
  padding: 8px 10px;
  border-left: 2px solid rgba(0, 255, 163, 0.7);
  background: rgba(0, 255, 163, 0.06);
  border-radius: var(--radius-sm);
  font-size: 11px;
  color: var(--neon-green);
}

/* 对话首条回复的公示页脚 */
.msg-disclosure {
  margin-top: 6px;
  font-size: 10px;
  line-height: 1.6;
  color: var(--text-faint);
}

@media (max-width: 900px) {
  .compliance-body {
    grid-template-columns: 1fr;
  }
}

/* ------------------------------------------------------------------
   账号密码登录 + 管理员后台（v16）
   ------------------------------------------------------------------ */

.auth-card {
  width: min(440px, 92vw);
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 12px;
  font-size: 11.5px;
  color: var(--text-sub);
}

.auth-field input {
  width: 100%;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(4, 8, 15, 0.7);
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 12.5px;
  outline: none;
  transition: border-color var(--transition-fast);
}

.auth-field input:focus {
  border-color: var(--border-glow);
}

html.light .auth-field input {
  background: rgba(255, 255, 255, 0.92);
  color: #10202c;
}

.account-meta {
  display: grid;
  gap: 6px;
  margin: 4px 0 14px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(0, 234, 255, 0.04);
}

.account-meta div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 11.5px;
}

.account-meta span {
  color: var(--text-faint);
}

.account-meta b {
  font-family: var(--font-mono);
  color: var(--text-main);
  font-weight: 500;
}

.account-section {
  margin-bottom: 6px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}

.account-section h4 {
  margin: 0 0 10px;
  font-size: 12px;
  color: var(--text-sub);
  letter-spacing: 0.4px;
}

.account-section .primary-btn {
  width: 100%;
}

.admin-view {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(rgba(0, 234, 255, 0.03) 1px, transparent 1px) 0 0 / 100% 38px,
    radial-gradient(900px 380px at 80% -10%, rgba(157, 92, 255, 0.1), transparent 70%),
    linear-gradient(160deg, rgba(3, 9, 17, 0.98), rgba(2, 6, 12, 0.99));
}

.admin-view[hidden] {
  display: none;
}

html.light .admin-view {
  background:
    linear-gradient(rgba(0, 150, 190, 0.05) 1px, transparent 1px) 0 0 / 100% 38px,
    linear-gradient(160deg, #f3fafd, #eef4fb);
}

.admin-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 22px 28px;
  display: grid;
  grid-template-columns: minmax(0, 360px) minmax(0, 1fr);
  gap: 16px;
  align-content: start;
}

.admin-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-form input,
.admin-form select {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(4, 8, 15, 0.7);
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 12px;
  outline: none;
}

.admin-form input:focus,
.admin-form select:focus {
  border-color: var(--border-glow);
}

/* 下拉框使用不透明深色底，避免原生下拉列表渲染成白色 */
.admin-form select {
  background-color: #050c16;
}

html.light .admin-form input,
html.light .admin-form select {
  background: rgba(255, 255, 255, 0.92);
  color: #10202c;
}

html.light .admin-form select {
  background-color: #ffffff;
}

.admin-config-card {
  grid-column: 1 / -1;
}

.admin-config {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.config-group {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  background: rgba(4, 8, 15, 0.35);
}

.config-group h4 {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--text-main);
  letter-spacing: 0.04em;
}

.config-item {
  padding: 10px 0;
  border-top: 1px dashed var(--border);
}

.config-item:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.config-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
}

.config-head b {
  font-weight: 600;
  color: var(--text-main);
}

.config-required {
  color: #ff86b5;
  font-size: 10.5px;
  white-space: nowrap;
}

.config-desc {
  margin: 4px 0 7px;
  font-size: 11px;
  line-height: 1.55;
  color: var(--text-muted);
}

.config-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.config-row input,
.config-row select,
.config-row textarea {
  flex: 1;
  min-width: 0;
  padding: 7px 9px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background-color: #050c16;
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 12px;
  outline: none;
}

.config-row textarea {
  min-height: 62px;
  resize: vertical;
}

.config-row select {
  color-scheme: dark;
}

.config-row input:focus,
.config-row select:focus,
.config-row textarea:focus {
  border-color: var(--border-glow);
}

.config-btn {
  flex: none;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: rgba(8, 17, 27, 0.8);
  color: var(--text-sub);
  font-size: 11.5px;
  cursor: pointer;
}

.config-btn:hover {
  color: var(--neon-cyan);
  border-color: var(--border-glow);
}

.config-btn.ghost {
  border-color: var(--border);
  color: var(--text-muted);
}

.config-meta {
  margin-top: 5px;
  font-size: 10.5px;
  color: var(--text-faint);
}

html.light .config-group {
  background: rgba(255, 255, 255, 0.72);
}

html.light .config-row input,
html.light .config-row select,
html.light .config-row textarea {
  background-color: #ffffff;
  color: #10202c;
}

html.light .config-row select {
  color-scheme: light;
}

@media (max-width: 1080px) {
  .admin-config {
    grid-template-columns: minmax(0, 1fr);
  }
}

.admin-table {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    'main actions'
    'meta actions';
  gap: 2px 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(0, 234, 255, 0.03);
}

.admin-row:hover {
  border-color: var(--border-glow);
}

.admin-user-main {
  grid-area: main;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.admin-user-main b {
  font-size: 12.5px;
  color: var(--text-main);
}

.admin-user-main small {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-muted);
}

.admin-user-meta {
  grid-area: meta;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-faint);
}

.admin-user-actions {
  grid-area: actions;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.admin-count {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--neon-cyan);
}

.admin-warn {
  font-style: normal;
  color: var(--neon-amber);
}

html.light .admin-row {
  background: rgba(255, 255, 255, 0.72);
}

@media (max-width: 900px) {
  .admin-body {
    grid-template-columns: 1fr;
  }

  .admin-row {
    grid-template-columns: 1fr;
    grid-template-areas:
      'main'
      'meta'
      'actions';
  }
}

/* ============================================================
   窄屏顶部操作区：按钮换行，避免被 topbar 的 overflow 裁切
   ============================================================ */
@media (max-width: 640px) {
  .topbar {
    height: auto;
    min-height: 56px;
    flex-wrap: wrap;
    row-gap: 6px;
    padding: 8px 12px;
    align-content: center;
  }

  .top-title {
    flex: 1 1 auto;
    min-width: 0;
  }

  .top-actions {
    width: 100%;
    margin-left: 0;
    flex-wrap: wrap;
    justify-content: flex-end;
    row-gap: 4px;
  }

  .icon-btn {
    flex: none;
  }

  /* 看板/接入/模板库等页面头：标题与操作按钮分行，避免标题被挤成竖排 */
  .dash-head {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 12px;
  }

  .dash-head-main {
    flex: 1 1 100%;
    min-width: 0;
  }

  .dash-title {
    font-size: 14px;
    letter-spacing: 1px;
    line-height: 1.35;
    word-break: break-word;
  }

  .dash-actions {
    width: 100%;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 6px;
  }

  /* 模板库：引导卡与行业包卡片改为单列，避免小屏内容挤压成竖排 */
  .packs-body {
    padding: 12px;
  }

  .onboard-head {
    flex-wrap: wrap;
    gap: 6px;
  }

  .onboard-head b {
    flex: none;
  }

  .onboard-head span {
    flex: 1 1 100%;
  }

  .onboard-config,
  .packs-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   图表可读性：降低霓虹眩光，提高标签/图例对比度
   ============================================================ */
.mfv-label,
.mfv-spark-label {
  fill: #d7ecfa;
  font-weight: 600;
}

.mfv-value,
.mfv-donut-total {
  fill: #86ecff;
  filter: none;
}

.mfv-bar,
.mfv-col,
.mfv-arc,
.mfv-spark-dot {
  filter: none;
}

.mfv-spark-line {
  stroke: #55d8ea;
  stroke-width: 1.8;
  filter: drop-shadow(0 0 1px rgba(0, 234, 255, 0.28));
}

.mfv-legend-item,
.mfv-legend-name {
  color: #d7ecfa;
}

.mfv-legend-value {
  color: #ffffff;
  font-weight: 600;
}

.mfv-legend-percent {
  color: #c9b8ff;
}

.mfv-spark-caption {
  color: #cfe6f4;
}

.mfv-donut-label {
  fill: #cfe6f4;
  font-weight: 600;
}

.dash-chart-title {
  color: #c9b8ff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
}

html.light .mfv-label,
html.light .mfv-spark-label {
  fill: #1f4a60;
}

html.light .mfv-value,
html.light .mfv-donut-total {
  fill: #007c96;
}

html.light .mfv-donut-label {
  fill: #1f4a60;
}

html.light .mfv-legend-item,
html.light .mfv-legend-name {
  color: #1f4a60;
}

html.light .mfv-legend-value {
  color: #05202f;
}

html.light .mfv-legend-percent {
  color: #5b3fb0;
}

html.light .mfv-spark-line {
  stroke: #0891a8;
}

html.light .mfv-spark-caption {
  color: #1f4a60;
}

html.light .dash-chart-title {
  color: #5b3fb0;
}

/* ================= 资金闭环（T-106） ================= */
.finance-view {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(rgba(0, 234, 255, 0.03) 1px, transparent 1px) 0 0 / 100% 38px,
    radial-gradient(900px 380px at 86% -10%, rgba(0, 234, 255, 0.1), transparent 70%),
    linear-gradient(160deg, rgba(3, 9, 17, 0.99), rgba(2, 6, 12, 1));
}

.finance-view[hidden] {
  display: none;
}

html.light .finance-view {
  background:
    linear-gradient(rgba(0, 150, 190, 0.05) 1px, transparent 1px) 0 0 / 100% 38px,
    linear-gradient(160deg, #f3fafd, #eef4fb);
}

.finance-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
}

.finance-toolbar label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-sub);
}

.finance-toolbar select,
.finance-toolbar input {
  background: rgba(6, 12, 20, 0.72);
  border: 1px solid var(--border);
  color: var(--text-main);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 12px;
  font-family: var(--font-ui);
}

.finance-toolbar input[type='text'] {
  min-width: 190px;
}

html.light .finance-toolbar select,
html.light .finance-toolbar input {
  background: rgba(255, 255, 255, 0.9);
  color: #0f2433;
}

.finance-alert {
  border: 1px solid rgba(255, 176, 32, 0.45);
  background: rgba(255, 176, 32, 0.1);
  color: #ffcf70;
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 12.5px;
}

.finance-alert[hidden] {
  display: none;
}

html.light .finance-alert {
  color: #8a5a00;
}

.finance-table-wrap {
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.finance-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.finance-table th,
.finance-table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid rgba(120, 200, 255, 0.12);
  white-space: nowrap;
}

.finance-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(5, 12, 20, 0.96);
  color: var(--text-sub);
  font-weight: 500;
  letter-spacing: 0.3px;
}

html.light .finance-table th {
  background: #eaf6fb;
  color: #33546a;
}

.finance-table tbody tr {
  cursor: pointer;
}

.finance-table tbody tr:hover {
  background: rgba(0, 234, 255, 0.06);
}

.finance-table tbody tr.selected {
  background: rgba(0, 234, 255, 0.12);
}

.finance-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.finance-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-sub);
}

.finance-badge.ok {
  border-color: rgba(0, 220, 150, 0.4);
  color: #5ff0b6;
}

.finance-badge.warn {
  border-color: rgba(255, 176, 32, 0.45);
  color: #ffcf70;
}

.finance-badge.bad {
  border-color: rgba(255, 92, 120, 0.45);
  color: #ff8ea3;
}

.finance-empty {
  padding: 18px;
  text-align: center;
  color: var(--text-sub);
  font-size: 12.5px;
}

.finance-aging-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  font-size: 12.5px;
  border-bottom: 1px dashed rgba(120, 200, 255, 0.12);
}

.finance-aging-row:last-child {
  border-bottom: 0;
}

.finance-aging-row .label {
  color: var(--text-sub);
}

.finance-aging-row .value {
  font-variant-numeric: tabular-nums;
}

/* ================= 审批规则（T-201） ================= */
.admin-approval-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.admin-approval-form input,
.admin-approval-form select,
.admin-approval-form textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(6, 12, 20, 0.72);
  color: var(--text-main);
  font-size: 12px;
  font-family: var(--font-ui);
}

.admin-approval-form textarea {
  grid-column: 1 / -1;
  min-height: 64px;
  resize: vertical;
}

.admin-approval-form input:focus,
.admin-approval-form select:focus,
.admin-approval-form textarea:focus {
  outline: none;
  border-color: var(--neon-cyan);
}

html.light .admin-approval-form input,
html.light .admin-approval-form select,
html.light .admin-approval-form textarea {
  background: rgba(255, 255, 255, 0.9);
  color: #0f2433;
}

.admin-approval-subtitle {
  margin: 18px 0 8px;
  font-size: 13px;
  color: var(--text-main);
  letter-spacing: 0.3px;
}

.admin-approval-card .admin-warn {
  color: #ffcf70;
  margin-top: 6px;
}

html.light .admin-approval-card .admin-warn {
  color: #8a5a00;
}

/* ================= 待办中心（T-204） ================= */
.side-badge {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #ff4d6d;
  color: #fff;
  font-size: 10px;
  line-height: 18px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.approval-view {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(rgba(0, 234, 255, 0.03) 1px, transparent 1px) 0 0 / 100% 38px,
    radial-gradient(900px 380px at 88% -10%, rgba(255, 77, 109, 0.08), transparent 70%),
    linear-gradient(160deg, rgba(3, 9, 17, 0.99), rgba(2, 6, 12, 1));
}

.approval-view[hidden] {
  display: none;
}

html.light .approval-view {
  background:
    linear-gradient(rgba(0, 150, 190, 0.05) 1px, transparent 1px) 0 0 / 100% 38px,
    linear-gradient(160deg, #f3fafd, #eef4fb);
}

.approval-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 22px 28px;
  overflow: auto;
}

.approval-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.approval-tabs {
  display: flex;
  gap: 6px;
}

.approval-tabs button {
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(8, 16, 26, 0.7);
  color: var(--text-dim);
  font-size: 12px;
  cursor: pointer;
}

.approval-tabs button.active {
  border-color: var(--neon-cyan);
  color: var(--neon-cyan);
  background: rgba(0, 234, 255, 0.08);
}

.approval-tabs button span {
  margin-left: 4px;
  font-variant-numeric: tabular-nums;
}

.approval-toolbar input {
  width: min(320px, 100%);
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(6, 12, 20, 0.72);
  color: var(--text-main);
  font-size: 12px;
}

.approval-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.85fr) minmax(360px, 1.35fr);
  gap: 14px;
  min-height: 0;
}

.approval-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: calc(100vh - 210px);
  overflow: auto;
  padding-right: 4px;
}

.approval-row {
  display: grid;
  grid-template-columns: 1.5fr 0.9fr;
  gap: 4px 12px;
  text-align: left;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(8, 16, 26, 0.66);
  color: var(--text-main);
  cursor: pointer;
}

.approval-row:hover {
  border-color: rgba(0, 234, 255, 0.5);
}

.approval-row.active {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 0 1px rgba(0, 234, 255, 0.25) inset;
}

.approval-row b {
  font-size: 12px;
  font-weight: 600;
}

.approval-row small {
  color: var(--text-dim);
  font-size: 11px;
}

.approval-row .amount {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
}

.approval-row .meta {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--text-dim);
  font-size: 11px;
}

.approval-detail {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  background: rgba(8, 16, 26, 0.6);
  max-height: calc(100vh - 210px);
  overflow: auto;
}

.approval-detail h3 {
  margin: 0 0 4px;
  font-size: 14px;
  color: var(--text-main);
}

.approval-kv {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px 12px;
  margin: 12px 0;
}

.approval-kv div {
  font-size: 11px;
  color: var(--text-dim);
}

.approval-kv b {
  display: block;
  margin-top: 2px;
  color: var(--text-main);
  font-size: 12px;
  font-weight: 500;
}

.approval-steps {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 14px 0;
}

.approval-step {
  border-left: 2px solid var(--border);
  padding: 4px 10px;
}

.approval-step.current {
  border-left-color: var(--neon-cyan);
  background: rgba(0, 234, 255, 0.05);
}

.approval-step .line {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px;
  font-size: 12px;
}

.approval-step small {
  display: block;
  margin-top: 3px;
  color: var(--text-dim);
  font-size: 11px;
}

.approval-step .attachments {
  margin-top: 3px;
  color: var(--neon-cyan);
  font-size: 11px;
}

.approval-payload {
  margin: 12px 0;
}

.approval-payload pre {
  max-height: 180px;
  overflow: auto;
  margin: 6px 0 0;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(3, 8, 14, 0.8);
  color: #9fd8e8;
  font-size: 11px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-all;
}

.approval-form {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.approval-form textarea,
.approval-form input,
.approval-form select {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(6, 12, 20, 0.72);
  color: var(--text-main);
  font-size: 12px;
  font-family: var(--font-ui);
}

.approval-form textarea {
  min-height: 62px;
  resize: vertical;
}

.approval-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.approval-actions .danger {
  border-color: rgba(255, 77, 109, 0.5);
  color: #ff8fa2;
}

.approval-warn {
  margin-top: 8px;
  color: #ffcf70;
  font-size: 11px;
}

html.light .approval-tabs button,
html.light .approval-toolbar input,
html.light .approval-row,
html.light .approval-detail,
html.light .approval-form textarea,
html.light .approval-form input,
html.light .approval-form select {
  background: rgba(255, 255, 255, 0.9);
  color: #0f2433;
}

html.light .approval-payload pre {
  background: rgba(240, 248, 252, 0.95);
  color: #16455c;
}

html.light .approval-warn {
  color: #8a5a00;
}

/* 回写台账（T-305）：筛选区与状态摘要 */
.ledger-toolbar {
  justify-content: flex-start;
}

.ledger-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  width: 100%;
}

.ledger-filters input,
.ledger-filters select {
  width: min(220px, 100%);
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(6, 12, 20, 0.72);
  color: var(--text-main);
  font-size: 12px;
}

html.light .ledger-filters input,
html.light .ledger-filters select {
  background: rgba(255, 255, 255, 0.9);
  color: #0f2433;
}

@media (max-width: 900px) {
  .approval-grid {
    grid-template-columns: 1fr;
  }

  .approval-list,
  .approval-detail {
    max-height: none;
  }
}


