/* ============================================================
   Workspace Tools Console — 空间工具治理台
   双 Tab：空间发布管理 / 群绑定管理（复用 base.css 变量体系）
   契约：docs/superpowers/specs/2026-09-27-workspace-tools-console-design.md
   ============================================================ */

/* ---- 顶栏：Tab + 操作 ---- */
.wst-topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 0 0 16px 0; flex-shrink: 0; flex-wrap: wrap;
}
.wst-tabs {
  display: flex; align-items: center; gap: 4px;
  background: var(--bg-secondary); border-radius: var(--radius-lg); padding: 3px;
}
.wst-tab {
  padding: 6px 16px; border: none; background: transparent;
  color: var(--text-secondary); font-size: 12px; font-weight: 500;
  border-radius: var(--radius); cursor: pointer; transition: all var(--transition);
  white-space: nowrap;
}
.wst-tab:hover { color: var(--text-primary); }
.wst-tab.active {
  background: var(--bg-card); color: var(--text-primary); font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.wst-actions { display: flex; gap: 8px; align-items: center; }

/* ---- 面板 + 摘要行 ---- */
.wst-panel {
  display: flex; flex-direction: column; gap: 12px;
  flex: 1; min-height: 0; overflow-y: auto;
}
.wst-summary {
  font-size: 12px; color: var(--text-secondary);
  padding: 8px 12px; background: var(--bg-secondary);
  border-radius: var(--radius); border: 1px solid var(--border-light);
}
.wst-summary b { color: var(--text-primary); }

/* ---- 卡片网格 ---- */
.wst-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px; align-content: start;
}
.wst-grid .loading-state,
.wst-grid .empty-state {
  grid-column: 1 / -1; text-align: center; padding: 48px 0;
  color: var(--text-muted);
}

/* ---- 卡片 ---- */
.wst-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
  transition: all var(--transition);
}
.wst-card:hover { border-color: var(--accent); box-shadow: 0 2px 12px rgba(0,0,0,0.06); }

.wst-card-top { display: flex; align-items: flex-start; gap: 10px; }
.wst-card-info { flex: 1; min-width: 0; }
.wst-card-title {
  font-size: 14px; font-weight: 600; color: var(--text-primary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.wst-card-sub {
  font-size: 11px; color: var(--text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.wst-card-actions { display: flex; align-items: center; gap: 8px; }
.wst-error {
  font-size: 11px; color: var(--danger, #ef4444);
  background: rgba(239,68,68,0.08); border-radius: var(--radius);
  padding: 6px 8px; word-break: break-all;
}
.wst-muted { color: var(--text-muted); font-size: 11px; }

/* ---- 徽章 ---- */
.wst-badge {
  flex-shrink: 0; font-size: 11px; font-weight: 600;
  padding: 3px 10px; border-radius: 999px; white-space: nowrap;
}
.wst-badge.on {
  background: rgba(34,197,94,0.12); color: #22c55e;
  border: 1px solid rgba(34,197,94,0.35);
}
.wst-badge.off {
  background: var(--bg-secondary); color: var(--text-muted);
  border: 1px solid var(--border-light);
}
.wst-badge.stale {
  background: rgba(245,158,11,0.12); color: #f59e0b;
  border: 1px solid rgba(245,158,11,0.35);
}

/* ---- 属性行 ---- */
.wst-rows { display: flex; flex-direction: column; gap: 6px; }
.wst-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--text-secondary);
}
.wst-k {
  flex-shrink: 0; width: 44px; font-size: 11px; color: var(--text-muted);
}
.wst-row code {
  font-size: 11px; color: var(--text-primary);
  background: var(--bg-secondary); border-radius: 4px; padding: 1px 6px;
  word-break: break-all;
}

/* ---- 术语清单（展开区） ---- */
.wst-terms {
  border-top: 1px dashed var(--border-light); padding-top: 10px;
  display: flex; flex-direction: column; gap: 8px;
}
.wst-term-group-name {
  font-size: 11px; font-weight: 600; color: var(--text-secondary);
  margin-bottom: 4px;
}
.wst-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.wst-chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; color: var(--text-primary);
  background: var(--bg-secondary); border: 1px solid var(--border-light);
  border-radius: 999px; padding: 2px 10px; max-width: 100%;
}
.wst-chip code {
  font-size: 10px; color: var(--accent);
  background: transparent; padding: 0;
}
.wst-chip.bound {
  border-color: rgba(34,197,94,0.35);
  background: rgba(34,197,94,0.08);
}
.wst-bound-row { min-height: 24px; }
.wst-expand-btn { white-space: nowrap; }

/* ---- Modal ---- */
.wst-modal-overlay {
  position: fixed; inset: 0; z-index: 3000;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.5);
}
.wst-modal {
  width: 520px; max-width: 92vw; max-height: 82vh;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: 0 20px 60px rgba(0,0,0,0.35);
  display: flex; flex-direction: column;
}
.wst-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border-light);
}
.wst-modal-header h3 {
  margin: 0; font-size: 15px; font-weight: 600; color: var(--text-primary);
}
.wst-modal-close {
  border: none; background: transparent; color: var(--text-muted);
  font-size: 14px; cursor: pointer; padding: 4px 8px; border-radius: var(--radius);
}
.wst-modal-close:hover { color: var(--text-primary); background: var(--bg-secondary); }
.wst-modal-body {
  padding: 16px 18px; overflow-y: auto;
  font-size: 13px; color: var(--text-secondary);
  display: flex; flex-direction: column; gap: 10px;
}
.wst-modal-body code {
  font-size: 12px; color: var(--accent);
  background: var(--bg-secondary); border-radius: 4px; padding: 1px 6px;
  word-break: break-all;
}
.wst-modal-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding-top: 12px; border-top: 1px dashed var(--border-light); margin-top: 4px;
}

/* ---- 绑定复选清单 ---- */
.wst-check-list {
  display: flex; flex-direction: column; gap: 6px;
  max-height: 300px; overflow-y: auto;
}
.wst-check {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border: 1px solid var(--border-light);
  border-radius: var(--radius); cursor: pointer;
  background: var(--bg-secondary); font-size: 12px;
}
.wst-check:hover { border-color: var(--accent); }
.wst-check input { accent-color: var(--accent); }
.wst-check code { background: transparent; padding: 0; }

/* ---- 变更片段折叠 ---- */
.wst-details summary {
  cursor: pointer; font-size: 12px; color: var(--accent);
  user-select: none;
}
.wst-details pre {
  margin: 8px 0 0; padding: 10px 12px;
  background: var(--bg-secondary); border: 1px solid var(--border-light);
  border-radius: var(--radius);
  font-size: 11px; color: var(--text-primary);
  overflow-x: auto; white-space: pre;
}

/* ---- ② 消费区：提示条 + 消费者列表 ---- */
.wst-hint {
  font-size: 12px; color: var(--text-secondary);
  background: var(--bg-secondary); border: 1px solid var(--border-light);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius); padding: 8px 12px; line-height: 1.6;
}
.wst-hint code {
  font-size: 11px; color: var(--accent);
  background: transparent; padding: 0;
}
.wst-consumers { display: flex; flex-direction: column; gap: 6px; }
.wst-consumer {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--text-secondary);
}
.wst-ctype {
  flex-shrink: 0; font-size: 10px; font-weight: 600; color: #fff;
  background: var(--text-muted); border-radius: 4px; padding: 1px 6px;
}
.wst-consumer.agent .wst-ctype { background: #6366f1; }
.wst-consumer.group .wst-ctype { background: #0ea5e9; }
.wst-via {
  font-size: 10px; color: var(--text-muted);
  border: 1px solid var(--border-light); border-radius: 999px; padding: 0 6px;
}
.wst-consumer code {
  font-size: 11px; color: var(--text-primary);
  background: var(--bg-secondary); border-radius: 4px; padding: 1px 6px;
  word-break: break-all;
}
.wst-empty-consumer { font-size: 12px; color: #f59e0b; }
.wst-warn { color: #f59e0b; font-weight: 600; }

/* ---- 按钮微调 ---- */
#view-workspace_tools .btn-danger {
  color: var(--danger, #ef4444); border-color: rgba(239,68,68,0.4);
}
#view-workspace_tools .btn-danger:hover {
  background: rgba(239,68,68,0.1); border-color: var(--danger, #ef4444);
}

/* ---- 主站 components.css 未覆盖的 warning toast（reload 降级提示用） ---- */
.toast.warning {
  background: var(--warning-bg); color: var(--warning);
  border: 1px solid var(--warning);
}
