/* agents.css · 多智能体协同板块 v11
   设计取向：把「五个 Agent 在跑」做成一块深色运行台。
   左侧一条角色轨道常驻（谁在思考、谁在待机），右侧一条执行流，
   过程默认折叠成单行、只有当前步展开四行思维链 —— 参考 WorkBuddy 的执行步骤呈现。
   下方泳道 + 证据收在一张浅色卡里，作为时序补充而非并列主角。 */

.ag-body { background: var(--paper); }
.ag-wrap { max-width: 1240px; margin: 0 auto; padding: 30px 36px 48px; }

/* ---------- 页头 ---------- */
.ag-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 18px; }
.ag-head-l { min-width: 0; }
.ag-title { font-size: 30px; font-weight: 750; letter-spacing: -.02em; margin: 6px 0 7px; color: var(--ink); }
.ag-desc { font-size: 13.5px; color: var(--ink-2); line-height: 1.8; max-width: 640px; }

.ag-tabs { display: flex; gap: 4px; padding: 4px; background: #EDF1EE; border-radius: 999px; flex-shrink: 0; }
.ag-tab {
  padding: 8px 18px; font-size: 13px; font-weight: 600; color: var(--ink-2);
  border-radius: 999px; transition: all .18s ease;
}
.ag-tab:hover { color: var(--deep); }
.ag-tab.on { background: var(--card); color: var(--deep); box-shadow: var(--shadow-s); }

/* ============================================================
   运行台（深色）
   ============================================================ */
.ag-console {
  position: relative; border-radius: 16px; overflow: hidden;
  background: radial-gradient(120% 90% at 8% -10%, #0F2A20 0%, #081611 55%, #061009 100%);
  border: 1px solid rgba(147, 196, 0, .16);
  box-shadow: 0 18px 44px rgba(6, 16, 9, .22), inset 0 1px 0 rgba(255, 255, 255, .04);
}
/* 细微网格，给「指挥台」的质感 */
.ag-console::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image:
    linear-gradient(rgba(147, 196, 0, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(147, 196, 0, .045) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(120% 80% at 50% 0%, #000 40%, transparent 100%);
}
/* 播放时的扫描光带 */
.ag-console::after {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(184, 245, 0, .85), transparent);
  opacity: 0; transform: translateY(0);
}
.ag-console.playing::after { opacity: 1; animation: agScan 2.4s linear infinite; }
@keyframes agScan { 0% { transform: translateY(0); } 100% { transform: translateY(520px); } }

/* ---------- 顶栏 ---------- */
.ag-console-bar {
  position: relative; z-index: 2;
  display: flex; align-items: center; gap: 16px;
  padding: 11px 16px;
  border-bottom: 1px solid rgba(147, 196, 0, .14);
  background: rgba(6, 18, 12, .55);
}
.ag-live {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--mono, ui-monospace, Menlo, monospace);
  font-size: 10.5px; letter-spacing: .16em; font-weight: 700; color: var(--lime);
}
.ag-live-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--lime);
  box-shadow: 0 0 0 0 rgba(184, 245, 0, .6); animation: agLive 2s ease-out infinite;
}
@keyframes agLive {
  0% { box-shadow: 0 0 0 0 rgba(184, 245, 0, .55); }
  70% { box-shadow: 0 0 0 7px rgba(184, 245, 0, 0); }
  100% { box-shadow: 0 0 0 0 rgba(184, 245, 0, 0); }
}
.ag-run-meta { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.ag-run-meta b { font-size: 12.5px; color: #E8EFE9; font-weight: 650; letter-spacing: .01em; }
.ag-run-meta em { font-style: normal; font-size: 11px; color: #7E9689; font-family: var(--mono, ui-monospace, Menlo, monospace); }

.ag-ctrls { margin-left: auto; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.ag-btn {
  font-size: 12px; font-weight: 600; padding: 6px 12px; border-radius: 7px;
  color: #C8D8CD; background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(255, 255, 255, .1);
  transition: all .16s ease;
}
.ag-btn:hover { color: #fff; background: rgba(255, 255, 255, .1); border-color: rgba(184, 245, 0, .35); }
.ag-btn:active { transform: translateY(1px); }
.ag-btn-main { background: var(--lime); color: #10240C; border-color: var(--lime); font-weight: 750; }
.ag-btn-main:hover { background: #C9FF2E; color: #10240C; border-color: #C9FF2E; }
.ag-btn-ghost { background: transparent; border-color: rgba(255, 255, 255, .12); color: #93A89B; }
.ag-btn.is-on { background: rgba(184, 245, 0, .16); border-color: rgba(184, 245, 0, .5); color: var(--lime); }

.ag-switch { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; user-select: none; margin-left: 4px; }
.ag-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.ag-switch i {
  position: relative; width: 30px; height: 16px; border-radius: 999px;
  background: rgba(255, 255, 255, .14); transition: background .18s ease;
}
.ag-switch i::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px;
  border-radius: 50%; background: #9FB2A6; transition: all .18s ease;
}
.ag-switch input:checked + i { background: rgba(184, 245, 0, .32); }
.ag-switch input:checked + i::after { left: 16px; background: var(--lime); }
.ag-switch span { font-size: 11.5px; color: #93A89B; font-weight: 600; }
.ag-switch input:checked ~ span { color: var(--lime); }

/* ---------- 主体：轨道 + 流 ---------- */
.ag-console-body { position: relative; z-index: 2; display: grid; grid-template-columns: 196px 1fr; }

/* 角色轨道 */
.ag-rail {
  position: relative; padding: 14px 12px 16px;
  border-right: 1px solid rgba(147, 196, 0, .12);
  background: rgba(4, 13, 9, .35);
}
/* 竖向数据总线：把五个节点串成一条 */
.ag-rail::before {
  content: ""; position: absolute; left: 22px; top: 54px; bottom: 46px; width: 1px;
  background: linear-gradient(180deg, rgba(147, 196, 0, .05), rgba(147, 196, 0, .3) 20%, rgba(147, 196, 0, .3) 80%, rgba(147, 196, 0, .05));
}
.ag-rail-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 8px 10px 2px;
  font-family: var(--mono, ui-monospace, Menlo, monospace);
  font-size: 9px; letter-spacing: .1em; color: #6E8578;
}
.ag-rail-node {
  position: relative; display: grid; grid-template-columns: 16px 1fr;
  align-items: center; gap: 7px; padding: 7px 6px 7px 2px; margin-bottom: 1px;
  border-radius: 8px; cursor: pointer; transition: background .16s ease;
}
.ag-rail-node:hover { background: rgba(255, 255, 255, .045); }
.ag-rail-node.sel { background: rgba(184, 245, 0, .1); }
.ag-rn-line { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.ag-rn-dot {
  width: 9px; height: 9px; border-radius: 50%; background: #2C3B33; margin-left: 9px;
  border: 1.5px solid #3E5147; transition: all .2s ease; position: relative; z-index: 1;
}
.ag-rn-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ag-rn-name { flex: 1; min-width: 0; font-size: 12.5px; color: #D6E3DA; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ag-rn-code {
  font-family: var(--mono, ui-monospace, Menlo, monospace); font-size: 10px;
  color: #8CA396; letter-spacing: .04em;
}
.ag-rn-post {
  font-family: var(--mono, ui-monospace, Menlo, monospace); font-size: 11px;
  color: #9FB2A6; white-space: nowrap; font-style: normal; font-weight: 600;
}
.ag-rail-foot {
  position: absolute; left: 14px; right: 14px; bottom: 12px;
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 8px; border-top: 1px dashed rgba(147, 196, 0, .14);
  font-family: var(--mono, ui-monospace, Menlo, monospace); font-size: 9.5px; color: #6E8578;
}
.ag-rail-foot b { color: #9FB2A6; font-weight: 600; }
/* 状态 */
.ag-rail-node.done .ag-rn-dot { background: #4E7C5C; border-color: #4E7C5C; }
.ag-rail-node.done .ag-rn-name { color: #A9BDb1; }
.ag-rail-node.cur .ag-rn-dot { background: var(--lime); border-color: var(--lime); box-shadow: 0 0 0 3px rgba(184, 245, 0, .16); }
.ag-rail-node.cur .ag-rn-name { color: #F2F7F3; }
.ag-rail-node.cur .ag-rn-post { color: var(--lime); }
.ag-rail-node.thinking .ag-rn-dot { background: var(--lime); border-color: var(--lime); animation: agBreath 1.1s ease-in-out infinite; }
@keyframes agBreath {
  0%, 100% { box-shadow: 0 0 0 2px rgba(184, 245, 0, .1); opacity: .6; }
  50% { box-shadow: 0 0 0 6px rgba(184, 245, 0, .22); opacity: 1; }
}

/* 执行流 */
.ag-stream { min-width: 0; display: flex; flex-direction: column; position: relative; }
.ag-stream-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 16px 7px 18px;
  font-family: var(--mono, ui-monospace, Menlo, monospace);
  font-size: 9.5px; letter-spacing: .1em; color: #748C7F;
  border-bottom: 1px solid rgba(147, 196, 0, .08);
}
.ag-sh-c { padding-right: 22px; }
.ag-stream-log {
  height: 402px; overflow-y: auto; padding: 10px 12px 14px;
  scrollbar-width: thin; scrollbar-color: rgba(147, 196, 0, .28) transparent;
  /* 顶部 14px 用遮罩做柔化：滚动到一半的行不会硬切在边上 */
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 14px, #000 100%);
  mask-image: linear-gradient(180deg, transparent 0, #000 14px, #000 100%);
}
.ag-stream-log::-webkit-scrollbar { width: 6px; }
.ag-stream-log::-webkit-scrollbar-thumb { background: rgba(147, 196, 0, .24); border-radius: 3px; }
.ag-stream-log::-webkit-scrollbar-track { background: transparent; }

/* 系统行：交接 / 回写 / 证据 */
.ag-sys {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 6px; margin: 1px 0;
  font-family: var(--mono, ui-monospace, Menlo, monospace);
  font-size: 10.5px; color: #6E8578; letter-spacing: .02em;
  animation: agRowIn .3s ease both;
}
.ag-sys i { flex: 1; height: 1px; background: linear-gradient(90deg, transparent, rgba(147, 196, 0, .18)); }
.ag-sys i:last-child { background: linear-gradient(90deg, rgba(147, 196, 0, .18), transparent); }
.ag-sys.fb { color: #E8930C; }
.ag-sys.fb i { background: linear-gradient(90deg, transparent, rgba(232, 147, 12, .26)); }
.ag-sys.fb i:last-child { background: linear-gradient(90deg, rgba(232, 147, 12, .26), transparent); }
.ag-sys.ev { color: var(--lime); }
.ag-sys.ev i { background: linear-gradient(90deg, transparent, rgba(184, 245, 0, .3)); }
.ag-sys.ev i:last-child { background: linear-gradient(90deg, rgba(184, 245, 0, .3), transparent); }

/* 执行行（默认折叠成一行） */
.ag-row { margin: 2px 0; border-radius: 9px; animation: agRowIn .32s ease both; }
@keyframes agRowIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.ag-row-hd {
  display: grid; grid-template-columns: 16px 44px 1fr auto 58px 14px;
  align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 9px; cursor: pointer;
  border: 1px solid transparent; transition: background .15s ease, border-color .15s ease;
}
.ag-row-hd:hover { background: rgba(255, 255, 255, .04); }
.ag-row.open > .ag-row-hd { background: rgba(255, 255, 255, .05); border-color: rgba(147, 196, 0, .18); border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.ag-ic {
  width: 14px; height: 14px; border-radius: 50%; display: grid; place-items: center;
  font-size: 8.5px; color: #0B1A12; background: #3E5147; font-weight: 800;
}
.ag-row.done .ag-ic { background: #5E9C74; color: #04140C; }
.ag-row.cur .ag-ic { background: var(--lime); color: #10240C; animation: agBreath 1.4s ease-in-out infinite; }
.ag-row.thinking .ag-ic { background: transparent; border: 1.5px dashed rgba(184, 245, 0, .7); }
.ag-code {
  font-family: var(--mono, ui-monospace, Menlo, monospace); font-size: 10.5px;
  color: var(--accent, #7E9689); font-weight: 700; letter-spacing: .04em;
}
.ag-row-title { font-size: 13px; color: #EDF5EF; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ag-row.done .ag-row-title { color: #C6D6CB; }
.ag-headline { display: flex; align-items: center; gap: 9px; min-width: 0; }
.ag-view-tag {
  font-family: var(--mono, ui-monospace, Menlo, monospace); font-size: 9.5px;
  color: #8CA396; padding: 2px 6px; border-radius: 4px; background: rgba(255, 255, 255, .06);
  white-space: nowrap; flex-shrink: 0;
}
.ag-tag {
  font-size: 9.5px; font-weight: 700; padding: 2px 0; border-radius: 999px;
  color: #8FA79A; background: rgba(255, 255, 255, .06); white-space: nowrap;
  width: 46px; text-align: center; justify-self: end;
}
.ag-tag.fb { color: #FFB185; background: rgba(255, 107, 61, .16); }
.ag-post { font-family: var(--mono, ui-monospace, Menlo, monospace); font-size: 11px; color: #B8F500; text-align: right; }
.ag-caret { color: #5E766A; font-size: 9px; transition: transform .18s ease; }
.ag-row.open .ag-caret { transform: rotate(180deg); color: var(--lime); }

/* 展开体：四行思维链 */
.ag-body-box {
  overflow: hidden; border: 1px solid rgba(147, 196, 0, .18); border-top: none;
  border-radius: 0 0 9px 9px; background: rgba(255, 255, 255, .022);
  padding: 10px 12px 9px; margin-top: -1px;
}
.ag-cl { display: grid; grid-template-columns: 46px 1fr; gap: 10px; padding: 5px 0; position: relative; }
.ag-cl + .ag-cl { border-top: 1px solid rgba(255, 255, 255, .045); }
.ag-cl-i {
  font-family: var(--mono, ui-monospace, Menlo, monospace); font-size: 9.5px; font-weight: 700;
  letter-spacing: .1em; display: inline-flex; align-items: center; gap: 5px; padding-top: 2px;
}
.ag-cl-i::before { content: ""; width: 3px; height: 11px; border-radius: 2px; background: currentColor; }
.ag-cl-t { font-size: 12px; line-height: 1.72; color: #C3D4C9; }
.ag-cl[data-layer="profile"] .ag-cl-i { color: #00C878; }
.ag-cl[data-layer="memory"] .ag-cl-i { color: #5AA9E6; }
.ag-cl[data-layer="planning"] .ag-cl-i { color: #E8A93C; }
.ag-cl[data-layer="action"] .ag-cl-i { color: #FF8A5F; }
.ag-cl.new { animation: agCLIn .34s ease both; }
@keyframes agCLIn { from { opacity: 0; transform: translateX(-4px); } to { opacity: 1; transform: none; } }
.ag-cl.dim { opacity: .28; }

.ag-row-foot {
  display: flex; align-items: center; gap: 10px; margin-top: 8px; padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, .05);
}
.ag-src {
  font-family: var(--mono, ui-monospace, Menlo, monospace); font-size: 9.5px;
  color: #6E8578; padding: 2px 7px; border-radius: 4px; background: rgba(255, 255, 255, .04);
}
.ag-src.live { color: #B8F500; background: rgba(184, 245, 0, .12); }
.ag-src.fallback { color: #E8A93C; background: rgba(232, 147, 12, .12); }
.ag-ask {
  margin-left: auto; font-size: 10.5px; font-weight: 600; color: #9FB2A6;
  padding: 4px 9px; border-radius: 6px; border: 1px solid rgba(255, 255, 255, .12);
  background: transparent; transition: all .15s ease;
}
.ag-ask:hover { color: var(--lime); border-color: rgba(184, 245, 0, .45); background: rgba(184, 245, 0, .08); }

/* 思考中占位 */
.ag-row.thinking .ag-row-hd { grid-template-columns: 16px 46px 1fr; cursor: default; }
.ag-thinking {
  grid-column: 3 / -1; display: flex; align-items: center; gap: 7px;
  font-size: 11.5px; color: #9FB2A6; font-family: var(--mono, ui-monospace, Menlo, monospace);
}
.ag-thinking i {
  width: 4px; height: 4px; border-radius: 50%; background: var(--lime); opacity: .3;
  animation: agDots 1.1s ease-in-out infinite;
}
.ag-thinking i:nth-child(2) { animation-delay: .15s; }
.ag-thinking i:nth-child(3) { animation-delay: .3s; }
@keyframes agDots { 0%, 100% { opacity: .2; } 50% { opacity: 1; } }

/* 重绘时不做入场动画，避免整屏闪烁 */
.ag-stream-log.silent .ag-row,
.ag-stream-log.silent .ag-sys,
.ag-stream-log.silent .ag-cl { animation: none !important; }

/* 空态：待命花名册（比一片纯黑更有信息，也把分工先交代清楚） */
.ag-idle { padding: 2px 2px 0; }
.ag-idle-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 2px 10px 9px; font-family: var(--mono, ui-monospace, Menlo, monospace);
  font-size: 9.5px; letter-spacing: .1em; color: #6E8578;
}
.ag-idle-row {
  display: grid; grid-template-columns: 14px 42px 1fr auto; gap: 10px; align-items: center;
  padding: 8px 16px 8px 10px; border-radius: 8px; border: 1px solid transparent;
}
.ag-idle-row:hover { background: rgba(255, 255, 255, .035); border-color: rgba(147, 196, 0, .12); }
.ag-idle-row .ag-ic { width: 8px; height: 8px; opacity: .55; }
.ag-idle-duty { font-size: 11.5px; color: #8CA396; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-idle-st {
  font-family: var(--mono, ui-monospace, Menlo, monospace); font-size: 9px;
  color: #6E8578; border: 1px dashed rgba(255, 255, 255, .14); padding: 2px 8px; border-radius: 999px;
}
.ag-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100%; gap: 8px; color: #5E766A; text-align: center;
}
.ag-empty b { font-size: 13px; color: #93A89B; font-weight: 600; }
.ag-empty span { font-size: 11.5px; font-family: var(--mono, ui-monospace, Menlo, monospace); }

/* 流底栏 */
.ag-stream-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 16px; border-top: 1px solid rgba(147, 196, 0, .08);
  font-size: 10.5px; color: #6E8578; font-family: var(--mono, ui-monospace, Menlo, monospace);
}
.ag-src-note { color: #5E766A; }

/* 底栏：进度 + 当前步 */
.ag-console-bot {
  position: relative; z-index: 2;
  display: flex; align-items: center; gap: 14px;
  padding: 9px 16px 10px;
  border-top: 1px solid rgba(147, 196, 0, .12);
  background: rgba(4, 13, 9, .4);
}
.ag-progress { flex: 1; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, .07); overflow: hidden; }
.ag-progress i { display: block; height: 100%; width: 0; border-radius: 2px; background: linear-gradient(90deg, #00A868, var(--lime)); transition: width .3s ease; }
.ag-run-status {
  font-family: var(--mono, ui-monospace, Menlo, monospace); font-size: 10.5px;
  color: #93A89B; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 56%;
}

/* ============================================================
   智能体详情（点击轨道节点）
   ============================================================ */
.ag-agent-detail {
  margin-top: 14px; border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--card); padding: 18px 20px; box-shadow: var(--shadow-s);
}
.ag-ad-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.ag-ad-head h3 { font-size: 16px; font-weight: 700; color: var(--ink); }
.ag-ad-head span { font-size: 12.5px; color: var(--ink-2); }
.ag-ad-close { margin-left: auto; font-size: 11.5px; color: var(--ink-3); }
.ag-ad-close:hover { color: var(--deep); }
.ag-ad-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.ag-ad-block { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px 12px; }
.ag-ad-block b { display: block; font-size: 10px; letter-spacing: .1em; color: var(--ink-3); font-family: var(--mono, ui-monospace, monospace); margin-bottom: 5px; }
.ag-ad-block p { font-size: 12px; line-height: 1.65; color: var(--ink); }
.ag-ad-layers { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.ag-ad-layer { border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px 12px; background: linear-gradient(180deg, #FFF, var(--paper)); }
.ag-ad-layer b { display: block; font-size: 10.5px; color: var(--green); font-weight: 700; margin-bottom: 4px; }
.ag-ad-layer p { font-size: 11.5px; line-height: 1.6; color: var(--ink-2); }
.ag-ad-kb { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 11.5px; color: var(--ink-2); }
.ag-ad-kb b { font-size: 10px; letter-spacing: .1em; color: var(--ink-3); font-family: var(--mono, ui-monospace, monospace); }
.ag-ad-kb span { padding: 3px 8px; border-radius: 999px; background: var(--paper); border: 1px solid var(--line); }
.ag-ad-kb .ag-kb-more { background: transparent; border-style: dashed; color: var(--ink-3); }
.ag-ad-ask {
  margin-top: 14px; font-size: 12px; font-weight: 650; color: var(--deep);
  padding: 8px 16px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--card);
}
.ag-ad-ask:hover { border-color: var(--green); color: var(--green); }

/* ============================================================
   泳道卡（浅色，时序补充）
   ============================================================ */
.ag-lanes-card {
  margin-top: 16px; padding: 18px 20px 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-s);
}
.ag-sec-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 14px; }
.ag-sec-head h2 { font-size: 15px; font-weight: 700; color: var(--ink); margin-bottom: 4px; }
.ag-sec-head p { font-size: 12px; color: var(--ink-2); line-height: 1.6; }
.ag-legend { display: flex; align-items: center; gap: 14px; flex-shrink: 0; font-size: 11px; color: var(--ink-2); }
.ag-legend span { display: inline-flex; align-items: center; gap: 5px; }
.ag-lg-line { display: block; width: 18px; height: 2px; background: var(--green); border-radius: 1px; }
.ag-lg-line.fb { background: repeating-linear-gradient(90deg, var(--bad) 0 4px, transparent 4px 7px); }
.ag-legend-note { color: var(--ink-3); }

.ag-lanes { overflow-x: auto; padding-bottom: 4px; }
.ag-lane { display: grid; grid-template-columns: 86px 1fr; align-items: center; gap: 8px; }
.ag-lane-label { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--ink-2); white-space: nowrap; }
.ag-lane-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.ag-track { display: grid; grid-template-columns: repeat(12, 1fr); gap: 4px; }
.ag-cell { height: 30px; border-radius: 5px; background: #F3F6F4; display: grid; place-items: center; }
.ag-msg {
  width: 100%; height: 100%; border-radius: 5px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono, ui-monospace, Menlo, monospace); font-size: 9px; font-weight: 700;
  color: var(--deep); background: #E2F0E8; border: 1px solid #CBE3D6;
  transition: all .15s ease; line-height: 1.1; text-align: center;
}
.ag-msg:hover { background: #D3EADE; }
.ag-msg.fb { color: #B4481F; background: #FDEBE4; border-color: #F5CBB9; }
.ag-msg.cur { background: var(--deep); color: var(--lime); border-color: var(--deep); box-shadow: 0 2px 8px rgba(11, 61, 46, .22); }
.ag-msg.dim { opacity: .38; }
.ag-flow-axis { display: grid; grid-template-columns: 86px 1fr; gap: 8px; margin-top: 2px; }
.ag-flow-axis .ag-lane-label { font-size: 9.5px; color: var(--ink-3); font-family: var(--mono, ui-monospace, monospace); letter-spacing: .1em; }
.ag-axis-steps { display: grid; grid-template-columns: repeat(12, 1fr); gap: 4px; }
.ag-axis-steps span { text-align: center; font-family: var(--mono, ui-monospace, monospace); font-size: 9px; color: var(--ink-3); }

/* 证据行 */
.ag-ev-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line);
}
.ag-ev-label { font-size: 11px; font-weight: 700; color: var(--ink-2); letter-spacing: .02em; }
.ag-ev-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.ag-ev-btn {
  font-size: 11.5px; padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--card); color: var(--ink-2);
  transition: all .15s ease;
}
.ag-ev-btn:hover { border-color: var(--green); color: var(--green); }
.ag-ev-btn.on { background: var(--deep); border-color: var(--deep); color: var(--lime); font-weight: 650; }
.ag-ev-note { font-size: 11px; color: var(--ink-3); flex: 1; min-width: 180px; }

/* ============================================================
   知识库视图
   ============================================================ */
.ag-kb-note {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 13px 18px; margin-bottom: 14px; flex-wrap: wrap;
  background: linear-gradient(90deg, #EAF4EE, #F7FAF8);
  border: 1px solid #D5E7DD; border-radius: var(--r-md);
}
.ag-kb-note b { display: block; font-size: 13px; color: var(--deep); margin-bottom: 3px; }
.ag-kb-note span { font-size: 11.5px; color: var(--ink-2); line-height: 1.6; }
.ag-kb-goto {
  font-size: 12px; font-weight: 650; padding: 8px 16px; border-radius: 999px;
  background: var(--deep); color: var(--lime); white-space: nowrap;
}
.ag-kb-goto:hover { background: #0E4A38; }

.ag-kb-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 14px; }
.ag-kb-stats { display: flex; gap: 10px; flex-wrap: wrap; }
.ag-kb-stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px 16px; min-width: 86px; }
.ag-kb-stat b { display: block; font-size: 19px; font-weight: 750; color: var(--deep); font-family: var(--mono, ui-monospace, monospace); }
.ag-kb-stat span { font-size: 10.5px; color: var(--ink-3); }
.ag-kb-right { display: flex; align-items: center; gap: 10px; }
.ag-sim-tag { font-size: 11px; color: #8A6200; background: #FFF8E4; border: 1px solid #EFDCA6; border-radius: 999px; padding: 6px 12px; }
.ag-kb-search {
  width: 268px; font-size: 12.5px; padding: 9px 14px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--card); color: var(--ink);
}
.ag-kb-search:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(0, 168, 104, .1); }
.ag-kb-filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.ag-kb-filter {
  font-size: 11.5px; padding: 5px 13px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--card); color: var(--ink-2);
}
.ag-kb-filter:hover { border-color: var(--green); color: var(--green); }
.ag-kb-filter.on { background: var(--deep); border-color: var(--deep); color: var(--lime); font-weight: 650; }
.ag-kb-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.ag-kb-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 15px 17px; cursor: pointer; transition: all .16s ease;
}
.ag-kb-card:hover { border-color: var(--line-2); box-shadow: var(--shadow-s); }
.ag-kb-card.open { border-color: var(--green); box-shadow: 0 0 0 3px rgba(0, 168, 104, .08); }
.ag-kb-top { display: flex; align-items: center; gap: 7px; margin-bottom: 8px; }
.ag-kb-id { font-family: var(--mono, ui-monospace, monospace); font-size: 10px; color: var(--ink-3); }
.ag-kb-cat { font-size: 10px; padding: 2px 7px; border-radius: 4px; background: var(--green-soft); color: var(--green); font-weight: 650; }
.ag-kb-tier { font-size: 9.5px; padding: 2px 6px; border-radius: 4px; background: var(--paper); color: var(--ink-3); margin-left: auto; }
.ag-kb-tier.A { background: #EAF5FF; color: #2F6E9E; }
.ag-kb-tier.B { background: #EFF7E8; color: #4C7A2B; }
.ag-kb-card h4 { font-size: 13.5px; font-weight: 700; color: var(--ink); line-height: 1.5; margin-bottom: 6px; }
.ag-kb-sum { font-size: 12px; line-height: 1.7; color: var(--ink-2); }
.ag-kb-tags { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 9px; }
.ag-kb-tags span { font-size: 10px; padding: 2px 7px; border-radius: 999px; background: var(--paper); color: var(--ink-3); }
.ag-kb-src { font-size: 10.5px; color: var(--ink-3); margin-top: 9px; line-height: 1.6; }
.ag-kb-src a { color: var(--green); }
.ag-kb-detail { font-size: 12px; line-height: 1.75; color: var(--ink); margin-top: 11px; padding-top: 11px; border-top: 1px dashed var(--line-2); }
.ag-kb-agents { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 10px; font-size: 10.5px; color: var(--ink-3); }
.ag-kb-agents span { padding: 2px 8px; border-radius: 999px; background: var(--green-soft); color: var(--green); font-size: 10px; }
.ag-kb-ask {
  margin-top: 12px; font-size: 11.5px; font-weight: 650; color: var(--deep);
  padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--card);
}
.ag-kb-ask:hover { border-color: var(--green); color: var(--green); }
.ag-kb-empty { grid-column: 1 / -1; text-align: center; padding: 40px; color: var(--ink-3); font-size: 12.5px; }

/* ============================================================
   知识图谱
   ============================================================ */
.ag-graph-card {
  border-radius: 16px; overflow: hidden;
  background: #061009; border: 1px solid rgba(147, 196, 0, .16);
  box-shadow: 0 18px 44px rgba(6, 16, 9, .22);
}
.ag-graph-top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 16px; border-bottom: 1px solid rgba(147, 196, 0, .12);
  background: rgba(6, 18, 12, .6); flex-wrap: wrap;
}
.ag-graph-stats { display: flex; gap: 20px; flex-wrap: wrap; }
.ag-graph-stats div { display: flex; align-items: baseline; gap: 6px; }
.ag-graph-stats b {
  font-family: var(--mono, ui-monospace, monospace); font-size: 17px; font-weight: 750;
  color: var(--lime); letter-spacing: -.01em;
}
.ag-graph-stats span { font-size: 10.5px; color: #7E9689; }
.ag-graph-tools { display: flex; align-items: center; gap: 8px; }
.ag-gmatch {
  font-family: var(--mono, ui-monospace, monospace); font-size: 10px; color: #FF8A5F;
  white-space: nowrap;
}
.ag-gsearch {
  width: 260px; font-size: 12px; padding: 7px 13px; border-radius: 999px;
  background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .12);
  color: #E8EFE9; font-family: inherit;
}
.ag-gsearch::placeholder { color: #6E8578; }
.ag-gsearch:focus { outline: none; border-color: rgba(184, 245, 0, .5); background: rgba(255, 255, 255, .09); }
.ag-gfit {
  font-size: 11.5px; font-weight: 600; padding: 6px 12px; border-radius: 7px;
  color: #C8D8CD; background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .1);
}
.ag-gfit:hover { color: #fff; border-color: rgba(184, 245, 0, .35); }

.ag-graph-stage {
  position: relative; height: 660px; min-height: 330px; overflow: hidden;
  background: radial-gradient(120% 90% at 50% 40%, #0A1D15 0%, #06120D 45%, #03080A 100%);
}

/* ---- 图谱视图：整块图谱落在首屏内，不需要往下滑 ---- */
body.ag-in-graph .ag-wrap { padding-top: 16px; padding-bottom: 18px; }
body.ag-in-graph .ag-head { align-items: center; margin-bottom: 10px; }
body.ag-in-graph .ag-head .kicker,
body.ag-in-graph .ag-head .ag-desc { display: none; }
body.ag-in-graph .ag-title { font-size: 19px; margin: 0; letter-spacing: -.015em; }
body.ag-in-graph .ag-graph-top { padding: 9px 14px; }
body.ag-in-graph .ag-graph-stats b { font-size: 15.5px; }
body.ag-in-graph .ag-graph-cats {
  flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain;
  padding: 8px 14px; scrollbar-width: none;
  mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 26px), transparent 100%);
}
body.ag-in-graph .ag-graph-cats::-webkit-scrollbar { display: none; }
body.ag-in-graph .ag-gcat { flex: 0 0 auto; font-size: 10.5px; padding: 4px 10px; }
#kbCanvas { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; }
.ag-graph-hint {
  position: absolute; left: 16px; bottom: 12px; pointer-events: none;
  font-family: var(--mono, ui-monospace, monospace); font-size: 10px; color: #5E766A;
}
.ag-graph-tip {
  position: absolute; z-index: 3; width: 250px; pointer-events: none;
  background: rgba(8, 22, 15, .96); border: 1px solid rgba(147, 196, 0, .28);
  border-radius: 10px; padding: 10px 12px; box-shadow: 0 12px 28px rgba(0, 0, 0, .5);
}
.ag-graph-tip b { font-family: var(--mono, ui-monospace, monospace); font-size: 9.5px; letter-spacing: .08em; }
.ag-graph-tip p { font-size: 12px; line-height: 1.6; color: #E8EFE9; margin: 5px 0 6px; }
.ag-graph-tip span { font-size: 10px; color: #7E9689; font-family: var(--mono, ui-monospace, monospace); }

.ag-graph-cats {
  display: flex; gap: 6px; flex-wrap: wrap; padding: 12px 16px;
  border-top: 1px solid rgba(147, 196, 0, .12); background: rgba(6, 18, 12, .5);
}
.ag-gcat {
  font-size: 11px; padding: 5px 11px; border-radius: 999px;
  color: #9FB2A6; background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .08); transition: all .15s ease;
  display: inline-flex; align-items: center; gap: 6px;
}
.ag-gcat::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--c, #7E9689); }
.ag-gcat:hover { color: #fff; border-color: rgba(184, 245, 0, .35); }
.ag-gcat.on { background: rgba(184, 245, 0, .14); border-color: rgba(184, 245, 0, .5); color: var(--lime); }

/* 运行 HUD */
.ag-ghud {
  position: absolute; top: 14px; left: 16px; z-index: 3; pointer-events: none;
  display: flex; align-items: center; gap: 8px;
  font-family: var(--mono, ui-monospace, monospace); font-size: 9.5px; letter-spacing: .12em;
  color: #6E8578; text-transform: uppercase;
}
.ag-ghud-dot {
  width: 5px; height: 5px; border-radius: 50%; background: #B8F500;
  box-shadow: 0 0 8px rgba(184, 245, 0, .9); animation: agHudPulse 2.4s ease-in-out infinite;
}
@keyframes agHudPulse { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
.ag-ghud b {
  font-size: 10.5px; letter-spacing: .04em; color: #C7E97A; font-weight: 650;
  padding: 2px 8px; border-radius: 4px; background: rgba(184, 245, 0, .1);
  text-transform: none;
}

/* 取景框四角 */
.ag-gframe { position: absolute; inset: 8px; pointer-events: none; z-index: 2; }
.ag-gframe i {
  position: absolute; width: 16px; height: 16px;
  border-color: rgba(147, 196, 0, .38); border-style: solid; border-width: 0;
}
.ag-gframe i:nth-child(1) { top: 0; left: 0; border-top-width: 1px; border-left-width: 1px; }
.ag-gframe i:nth-child(2) { top: 0; right: 0; border-top-width: 1px; border-right-width: 1px; }
.ag-gframe i:nth-child(3) { bottom: 0; left: 0; border-bottom-width: 1px; border-left-width: 1px; }
.ag-gframe i:nth-child(4) { bottom: 0; right: 0; border-bottom-width: 1px; border-right-width: 1px; }

/* 深色浮层详情：不离开星系视野 */
.ag-gdetail {
  position: absolute; z-index: 4; top: 14px; right: 14px; width: 322px;
  max-height: calc(100% - 28px); overflow-y: auto;
  border-radius: 12px; border: 1px solid rgba(147, 196, 0, .26);
  background: rgba(6, 18, 12, .93); backdrop-filter: blur(10px);
  padding: 14px 15px; box-shadow: 0 18px 44px rgba(0, 0, 0, .55);
  scrollbar-width: thin; scrollbar-color: rgba(147, 196, 0, .3) transparent;
}
.ag-gd-head { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.ag-gd-cat {
  font-size: 10px; padding: 2px 8px; border-radius: 4px; font-weight: 650;
  color: var(--c, #9FB2A6); background: color-mix(in srgb, var(--c) 20%, transparent);
}
.ag-gd-tier { font-size: 9.5px; padding: 2px 7px; border-radius: 4px; background: rgba(255, 255, 255, .07); color: #8CA396; }
.ag-gd-tier.A { background: rgba(96, 165, 250, .16); color: #9EC9F8; }
.ag-gd-tier.B { background: rgba(184, 245, 0, .14); color: #C7E97A; }
.ag-gd-close { margin-left: auto; font-size: 12px; color: #7E9689; line-height: 1; padding: 3px 5px; border-radius: 5px; }
.ag-gd-close:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.ag-gdetail h3 { font-size: 14px; font-weight: 700; color: #EDF5EF; line-height: 1.55; margin-bottom: 7px; }
.ag-gdetail > p { font-size: 12px; line-height: 1.8; color: #A9BFB2; }
.ag-gd-tags { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 10px; }
.ag-gd-tags span { font-size: 10px; padding: 2px 8px; border-radius: 999px; background: rgba(255, 255, 255, .06); color: #8CA396; }
.ag-gd-src { font-size: 10.5px; color: #7E9689; margin-top: 10px; }
.ag-gd-rel { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 12px; padding-top: 10px; border-top: 1px dashed rgba(147, 196, 0, .2); }
.ag-gd-rel b { font-size: 10px; letter-spacing: .08em; color: #7E9689; font-family: var(--mono, ui-monospace, monospace); }
.ag-gd-rel span {
  font-size: 10.5px; padding: 3px 9px; border-radius: 999px; cursor: pointer;
  background: rgba(147, 196, 0, .12); color: #C7E97A;
}
.ag-gd-rel span:hover { background: rgba(184, 245, 0, .24); color: #fff; }
.ag-gd-act { display: flex; gap: 7px; margin-top: 12px; }
.ag-gd-act button {
  flex: 1; font-size: 11px; padding: 7px 8px; border-radius: 7px; cursor: pointer;
  color: #C8D8CD; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .1);
}
.ag-gd-act button:hover { color: #fff; border-color: rgba(184, 245, 0, .4); background: rgba(184, 245, 0, .12); }

/* 工具条开关 */
.ag-gtog {
  font-size: 11px; font-weight: 600; padding: 6px 11px; border-radius: 999px;
  color: #9FB2A6; background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(255, 255, 255, .1); transition: all .15s ease; white-space: nowrap;
}
.ag-gtog:hover { color: #fff; border-color: rgba(184, 245, 0, .35); }
.ag-gtog.on { color: var(--lime, #B8F500); background: rgba(184, 245, 0, .13); border-color: rgba(184, 245, 0, .46); }

/* 图例 */
.ag-glegend {
  position: absolute; left: 16px; bottom: 34px; display: flex; gap: 14px; flex-wrap: wrap;
  font-family: var(--mono, ui-monospace, monospace); font-size: 9.5px; color: #7E9689;
  pointer-events: none;
}
.ag-glegend span { display: inline-flex; align-items: center; gap: 5px; }
.ag-glegend i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.ag-glegend .lg-real { background: #FBFFEF; box-shadow: 0 0 0 1px rgba(255, 255, 255, .55), 0 0 8px rgba(184, 245, 0, .7); }
.ag-glegend .lg-demo { background: #6E8578; opacity: .8; }
.ag-glegend .lg-line { width: 12px; height: 1px; border-radius: 0; background: linear-gradient(90deg, rgba(127, 183, 155, 0), rgba(127, 183, 155, .85)); }

@media (max-width: 720px) {
  .ag-graph-stage { height: 460px; }
  .ag-graph-tools { width: 100%; flex-wrap: wrap; gap: 6px; }
  .ag-gsearch { flex: 1 1 100%; width: 100%; order: -1; }
  .ag-gtog, .ag-gfit { flex: 0 0 auto; white-space: nowrap; }
  .ag-gmatch { order: -1; }
  .ag-gdetail { top: auto; bottom: 10px; right: 10px; left: 10px; width: auto; max-height: 52%; }
  .ag-glegend { display: none; }
}

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 1080px) {
  .ag-head { flex-direction: column; align-items: flex-start; gap: 14px; }
  .ag-console-body { grid-template-columns: 1fr; }
  .ag-rail {
    display: flex; gap: 8px; overflow-x: auto; border-right: none;
    border-bottom: 1px solid rgba(147, 196, 0, .12); padding: 10px 12px;
  }
  .ag-rail::before, .ag-rail-head, .ag-rail-foot { display: none; }
  .ag-rail-node { flex: 0 0 auto; grid-template-columns: 14px auto; padding: 6px 10px; margin: 0; background: rgba(255,255,255,.035); }
  .ag-rn-post { display: none; }
  .ag-row-hd { grid-template-columns: 16px 42px 1fr auto 14px; }
  .ag-view-tag, .ag-tag, .ag-sh-c { display: none; }
  .ag-post { display: none; }
  .ag-ad-grid, .ag-ad-layers, .ag-kb-list { grid-template-columns: 1fr; }
  .ag-kb-search { width: 100%; }
}
@media (max-width: 720px) {
  .ag-wrap { padding: 22px 16px 32px; }
  .ag-head { flex-direction: column; align-items: flex-start; gap: 14px; }
  .ag-title { font-size: 25px; }
  .ag-stream-log { height: 360px; }
  .ag-ctrls { justify-content: flex-start; }
  .ag-console-bar { flex-wrap: wrap; }
  .ag-sec-head { flex-direction: column; gap: 10px; }
}

/* 图谱统计：种植 / 算法 分色 */
.ag-graph-stats .ag-agri b { color: var(--lime, #B8F500); }
.ag-graph-stats .ag-tech b { color: #7FB0D8; }
.ag-graph-stats .ag-tech span { color: #6E8A96; }

/* 分类条分组标签 */
.ag-gcat-sep {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono, ui-monospace, Menlo, monospace);
  font-size: 9.5px; letter-spacing: .1em; color: #86A08E;
  padding: 4px 10px 4px 2px; margin-left: 2px;
  border-right: 1px solid rgba(147, 196, 0, .18); white-space: nowrap;
}
.ag-gcat-sep.tech { color: #6E8A96; border-right: none; border-left: 1px solid rgba(147, 196, 0, .18); padding: 4px 2px 4px 12px; margin-left: 4px; }
.ag-gcat.tech { color: #8FA8B4; }
.ag-gcat.tech::before { opacity: .7; }

.ag-glegend b { color: #B4C7BA; font-weight: 600; }

/* 页签不换行，窄屏可横向滑动 */
.ag-tab { white-space: nowrap; }
.ag-tabs { max-width: 100%; }

@media (max-width: 720px) {
  .ag-tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .ag-tabs::-webkit-scrollbar { display: none; }
  .ag-tab { padding: 8px 14px; }
}
