/* ═══ [2026-11-03] DSH 插件整页视图样式：上下文洞察 + 编队 + 轨迹 + 任务看板 ═══
   原生 CSS，配色/布局对照 DSH 实物截图。 */

/* ── tab 条 ── */
.wsv-tab { background: none; border: none; color: var(--text-sub); font-size: 13px;
  padding: 5px 14px; cursor: pointer; font-family: inherit; border-bottom: 2px solid transparent; }
.wsv-tab.active { color: var(--text-main); border-bottom-color: var(--text-main); font-weight: 500; }
#wsInsightView, #wsTeamView, #wsTraceView, #wsBoardView { display: none; flex-direction: column; }

/* ── 页面栅格：左内容列 + 右 400px 列（上下文页）；编队页同构 ── */
.dsh-page-grid, .dsh-team-grid { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 12px; align-items: start; }
.dsh-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
@media (max-width: 1100px) { .dsh-page-grid, .dsh-team-grid { grid-template-columns: 1fr; } }

.dsh-card { background: var(--bg-panel); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 16px; margin-bottom: 0; }
.dsh-card-head { font-size: 13.5px; font-weight: 600; color: var(--text-main);
  display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.dsh-card-sub { font-size: 10.5px; color: var(--text-sub); font-weight: 400; }
.dsh-sec-title { font-size: 11px; color: var(--text-sub); margin: 2px 0 6px; }

.dsh-chips-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.dsh-chip { background: var(--bg-hover); border: 1px solid var(--border); color: var(--text-main);
  font-size: 12px; border-radius: 14px; padding: 3px 14px; }
.dsh-chip-mini { font-size: 10.5px; padding: 1px 10px; color: var(--text-sub); }
.dsh-empty { padding: 18px; text-align: center; color: var(--text-sub); font-size: 12.5px; }
.dsh-footnote { font-size: 11px; color: var(--text-sub); padding: 10px 4px 0; line-height: 1.6; }
.dsh-mini-btn { background: var(--bg-hover); border: 1px solid var(--border); color: var(--text-sub);
  font-size: 11px; border-radius: 7px; padding: 3px 10px; cursor: pointer; font-family: inherit; }
.dsh-mini-btn:hover { color: var(--text-main); border-color: var(--text-main); }

/* 模式切换小 tab（趋势 全量/增量、浏览器 比前步/比前轮、轨迹 时长/轮次/调用） */
.dsh-mode-tab { font-size: 11px; color: var(--text-sub); background: var(--bg-hover);
  border: 1px solid var(--border); border-radius: 7px; padding: 2px 10px; cursor: pointer; user-select: none; }
.dsh-mode-tab.active { color: var(--text-main); border-color: var(--text-main);
  background: rgba(255, 255, 255, .06); }
.dsh-search { background: var(--bg-hover); border: 1px solid var(--border); color: var(--text-main);
  border-radius: 8px; padding: 4px 10px; font-size: 12px; font-family: inherit; min-width: 140px; outline: none; }
.dsh-search:focus { border-color: var(--text-main); }

/* ── 环形图（多段 conic-gradient，内圈挖空）── */
.dsh-donut-row { display: flex; align-items: center; gap: 22px; }
.dsh-donut { width: 120px; height: 120px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; position: relative; }
.dsh-donut::before { content: ''; position: absolute; width: 84px; height: 84px;
  border-radius: 50%; background: var(--bg-panel); }
.dsh-donut-center { position: relative; z-index: 1; text-align: center; }
.dsh-donut-center b { font-size: 20px; color: var(--text-main); display: block; }
.dsh-donut-center span { font-size: 10px; color: var(--text-sub); }
.dsh-legend { flex: 1; min-width: 0; }
.dsh-legend-row { display: grid; grid-template-columns: 1fr auto auto; gap: 10px;
  font-size: 12px; color: var(--text-main); padding: 2.5px 0; }
.dsh-legend-row .dsh-pct { color: var(--text-sub); min-width: 34px; text-align: right; }
.dsh-legend-row.dsh-lg-zero { color: var(--text-sub); }
.dsh-legend-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; margin-top: 8px; }
.lg { display: inline-flex; align-items: center; gap: 5px; }
.lg::before { content: ''; width: 8px; height: 8px; border-radius: 2px; background: var(--lg-c, #666); }
.lg-run { color: var(--text-sub); display: inline-flex; align-items: center; }
.lg-run::before { content: ''; width: 14px; height: 2px; background: var(--text-sub); border-radius: 1px; }

/* ── 当前上下文：大数字 + 分段水位条 ── */
.dsh-water-big { font-size: 26px; color: var(--text-main); display: flex; align-items: baseline; gap: 8px; margin: 4px 0 10px; }
.dsh-water-big b { font-weight: 700; }
.dsh-water-pct { font-size: 14px; color: var(--text-main); font-weight: 600; }
.dsh-waterbar { display: flex; height: 10px; border-radius: 6px; overflow: hidden; background: var(--bg-hover); }
.wb-seg { height: 100%; }
.wb-free { background: repeating-linear-gradient(45deg, transparent, transparent 6px, rgba(255,255,255,.04) 6px, rgba(255,255,255,.04) 12px); }

/* ── 耗时时间轴条 ── */
.dsh-tl { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: var(--bg-hover); margin-top: 12px; }
.dsh-tl > div { height: 100%; }
.dsh-tl-ticks { display: flex; justify-content: space-between; font-size: 9.5px; color: var(--text-sub); margin-top: 3px; }

/* ── 上下文趋势柱图（左右双轴）── */
/* [BUGFIX 2026-11-05] 趋势图 y 轴刻度此前 position:absolute 但父容器没有
   position:relative → 刻度绝对定位到页面左上角（截图实测溢出到卡片外）。
   这里把 wrap 设为定位上下文，并把刻度放进 28px 左侧留白内。 */
.dsh-trend-wrap { padding: 2px 0; position: relative; }
.dsh-trend-axis { display: flex; flex-direction: column; font-size: 9.5px; color: var(--text-sub);
  height: calc(100% - 18px); justify-content: space-between; position: absolute; left: 2px; top: 0; width: 26px; text-align: right; }
.dsh-trend { display: flex; align-items: flex-end; gap: 6px; height: 130px; padding: 6px 4px 2px 30px; overflow-x: auto; position: relative; }
.dsh-trend-bar { flex: 0 0 30px; height: 100%; display: flex; flex-direction: column;
  justify-content: flex-end; align-items: center; gap: 3px; }
.dtb-fill { width: 100%; border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, #fbbf24, #818cf8); min-height: 2px; }
.dsh-trend-bar span { font-size: 9.5px; color: var(--text-sub); }

/* ── 上下文浏览器 ── */
.dsh-browser-card { display: flex; flex-direction: column; }
.dsh-browser-select { display: flex; align-items: center; font-size: 12px; color: var(--text-main);
  background: var(--bg-hover); border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 12px; margin-bottom: 8px; cursor: default; }
.dsh-cmp-note { font-size: 11px; color: var(--text-sub); background: var(--bg-hover);
  border-radius: 8px; padding: 6px 12px; margin-bottom: 8px; }
.dsh-browser-sum { display: flex; align-items: center; gap: 8px; font-size: 12.5px;
  color: var(--text-main); padding: 4px 2px 6px; }
.dsh-browser-bar { display: flex; height: 8px; border-radius: 5px; overflow: hidden;
  background: var(--bg-hover); margin-bottom: 10px; }
.dsh-browser-bar > div { height: 100%; }
.dsh-tree-node { border: 1px solid var(--border); border-radius: 8px; margin-bottom: 8px;
  background: var(--bg-main); }
.dsh-tree-node summary { display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; cursor: pointer; font-size: 12.5px; color: var(--text-main);
  list-style: none; }
.dsh-tree-node summary::-webkit-details-marker { display: none; }
.dsh-tree-caret { color: var(--text-sub); font-size: 10px; transition: transform 150ms; }
.dsh-tree-node[open] .dsh-tree-caret { transform: rotate(90deg); }
.dsh-tree-n { font-size: 11px; color: var(--text-sub); }
.dsh-tree-est { font-size: 11px; color: var(--text-main); font-variant-numeric: tabular-nums; white-space: nowrap; }
.dsh-badge-up { font-size: 10px; color: #10b981; background: rgba(16, 185, 129, .12);
  border-radius: 5px; padding: 0 5px; }
.dsh-badge-up:empty { display: none; }
.dsh-tree-file { display: flex; justify-content: space-between; padding: 4px 12px 4px 30px;
  font-size: 11.5px; color: var(--text-sub); border-top: 1px dashed var(--border);
  font-family: var(--font-mono, monospace); }
.dsh-tree-files { display: flex; flex-wrap: wrap; gap: 5px; padding: 8px 12px 10px 30px;
  border-top: 1px dashed var(--border); }
.dsh-tree-tool { font-size: 10.5px; color: var(--text-sub); background: var(--bg-hover);
  border: 1px solid var(--border); border-radius: 6px; padding: 1px 8px;
  font-family: var(--font-mono, monospace); }

/* ── 编队页：Agent 网络节点 ── */
.dsh-net-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11px;
  color: var(--text-sub); margin-bottom: 12px; }
.dsh-net { display: flex; flex-wrap: wrap; gap: 14px; min-height: 120px; align-content: flex-start; }
.dsh-net-node { border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px 8px;
  background: var(--bg-main); min-width: 200px; position: relative; cursor: pointer; }
.dsh-net-node.dsh-net-lead { border-color: var(--text-main); }
.dsh-net-node.dsh-net-running { border-color: #10b981; }
.dsh-net-node.dsh-net-hi { box-shadow: 0 0 0 2px rgba(255, 255, 255, .25); }
.dsh-net-dot { position: absolute; top: 10px; left: 10px; width: 7px; height: 7px;
  border-radius: 50%; background: var(--border); }
.dsh-net-dot.on { background: #10b981; box-shadow: 0 0 6px #10b981; }
.dsh-net-node b { margin-left: 12px; font-size: 13px; color: var(--text-main); }
.dsh-net-mid { font-size: 15px; color: var(--text-main); text-align: center; margin: 10px 0 8px; font-weight: 600; }
.dsh-node-bar { height: 5px; border-radius: 3px; background: var(--bg-hover); overflow: hidden; }
.dsh-node-bar-fill { height: 100%; border-radius: 3px; background: #fbbf24; }
.dsh-net-foot { display: flex; justify-content: space-between; font-size: 10.5px;
  color: var(--text-sub); margin-top: 6px; }
.dsh-net-pct { color: #10b981; }
.dsh-tag { font-size: 9.5px; background: var(--bg-hover); color: var(--text-sub);
  border-radius: 5px; padding: 0 6px; margin-left: 4px; }
.dsh-tag-cur { background: rgba(16, 185, 129, .15); color: #10b981; }
.dsh-tag-lead { background: rgba(255, 255, 255, .08); color: var(--text-main); }
.dsh-tag-fail { background: rgba(239, 68, 68, .15); color: #ef4444; }

/* ── 编队页：成员卡 ── */
.dsh-member { display: flex; gap: 8px; padding: 7px 4px; align-items: flex-start; }
.dsh-m-body { flex: 1; min-width: 0; }
.dsh-m-name { font-size: 13px; color: var(--text-main); display: flex; align-items: center; gap: 5px; }
.dsh-m-sub { font-size: 11px; color: var(--text-sub); margin-top: 1px; }
.dsh-m-desc { font-size: 11px; color: var(--text-sub); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dsh-m-foot { display: flex; justify-content: space-between; font-size: 10px; color: var(--text-sub); margin-top: 3px; }
.dsh-dot { width: 14px; height: 14px; display: inline-flex; align-items: center;
  justify-content: center; flex-shrink: 0; font-size: 11px; border-radius: 50%; }
.dsh-dot-idle2 { background: var(--border); }
.dsh-dot-run { background: #10b981; animation: dsh-pulse 1.2s ease-in-out infinite; }
.dsh-dot-done { background: #10b981; }
.dsh-dot-block { background: #f59e0b; }
.dsh-dot-fail { background: #ef4444; }
@keyframes dsh-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }

/* ── 编队页：任务 / 通讯 ── */
.dsh-task { display: flex; gap: 8px; padding: 5px 2px; align-items: flex-start; font-size: 12.5px; }
.dsh-t-id { font-size: 10.5px; color: var(--text-sub); font-family: var(--font-mono, monospace); }
.dsh-t-meta { font-size: 10.5px; color: var(--text-sub); margin-top: 1px; }
.dsh-msg-row { padding: 4px 2px; font-size: 12px; color: var(--text-main);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dsh-msg-from { color: var(--text-main); font-weight: 500; }
.dsh-msg-txt { color: var(--text-sub); }

/* ── 轨迹页：工具行 + 甘特 ── */
.dsh-trace-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.dsh-gantt { background: var(--bg-panel); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.dsh-grow { display: grid; grid-template-columns: 44px 1fr; align-items: center; gap: 10px; margin-bottom: 10px; }
.dsh-glabel { font-size: 11px; color: var(--text-sub); text-align: right; }
.dsh-gtrack { position: relative; height: 16px; background: var(--bg-hover); border-radius: 5px; overflow: hidden; }
.dsh-gseg { position: absolute; top: 2px; height: 12px; border-radius: 3px; min-width: 3px; }
.dsh-gseg-input { background: #60a5fa; }
.dsh-gseg-model { background: #10b981; }
.dsh-gseg-tool { background: #ec4899; }
.dsh-gantt .dsh-tl-ticks { margin-top: 2px; }

/* ── 轨迹页：轮次/调用列表 ── */
.dsh-round-list { background: var(--bg-panel); border: 1px solid var(--border); border-radius: 10px; padding: 8px 14px; }
.dsh-round-group { margin-bottom: 4px; }
.dsh-round-cap { font-size: 10.5px; color: var(--text-sub); padding: 6px 0 2px; }
.dsh-round-row { display: flex; gap: 8px; align-items: flex-start; padding: 4px 0; font-size: 12px; }
.dsh-rtag { flex-shrink: 0; font-size: 10px; border-radius: 5px; padding: 1px 7px; margin-top: 1px; }
.dsh-rtag-sys { background: rgba(129, 140, 248, .15); color: #818cf8; }
.dsh-rtag-asst { background: rgba(96, 165, 250, .15); color: #60a5fa; }
.dsh-rtag-think { background: rgba(139, 92, 246, .15); color: #8b5cf6; }
.dsh-rtag-tool { background: rgba(16, 185, 129, .15); color: #10b981; }
.dsh-rtag-key { background: rgba(245, 158, 11, .15); color: #f59e0b; }
.dsh-rtxt { color: var(--text-main); min-width: 0; overflow: hidden; text-overflow: ellipsis;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.dsh-rsub { font-size: 11px; color: var(--text-sub); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── 任务看板 ── */
.dsh-board-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.dsh-board-title { font-size: 17px; color: var(--text-main); }
.dsh-board-cols { display: flex; gap: 12px; overflow-x: auto; align-items: flex-start; padding-bottom: 10px; flex: 1; }
.dsh-bcol { flex: 0 0 260px; background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 12px; min-height: 420px; display: flex; flex-direction: column; }
.dsh-bcol-head { display: flex; align-items: center; gap: 7px; margin-bottom: 8px; }
.dsh-bcol-head b { font-size: 13px; color: var(--text-main); }
.dsh-bdot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dsh-bcount { margin-left: auto; font-size: 11px; color: var(--text-sub); background: var(--bg-hover);
  border-radius: 9px; padding: 0 8px; }
.dsh-bcard { background: var(--bg-main); border: 1px solid var(--border); border-radius: 8px;
  padding: 9px 11px; margin-bottom: 8px; }
.dsh-bcard-subject { font-size: 12.5px; color: var(--text-main); margin-bottom: 4px; }
.dsh-bcard-actions { display: flex; gap: 6px; margin-top: 7px; }
