/* ================================================================
   操作中心 & 工作台样式
   复用 base.css 变量体系，纯结构布局，不引入新配色
   ================================================================ */

/* ---- 治理视图：移除 body flex 中的多余元素，铺满全屏 ---- */
body { display: flex; overflow: hidden; }
.main-content { flex: 1; }
#view-governance { flex: 1; min-height: 0; }
#view-governance.active { padding: 0; overflow: hidden; }

/* ---- 能力域 Tab 条 ---- */
.opc-tabstrip {
  display: flex; gap: 2px; padding: 10px 16px 0 16px;
  border-bottom: 1px solid var(--border); background: var(--bg-secondary);
  flex-shrink: 0; overflow-x: auto;
}
.opc-tab {
  padding: 8px 18px; border: none; background: none;
  color: var(--text-secondary); font-size: 13px; font-weight: 500;
  cursor: pointer; border-radius: var(--radius) var(--radius) 0 0;
  transition: all var(--transition);
  white-space: nowrap; position: relative;
}
.opc-tab:hover { color: var(--text-primary); background: var(--bg-hover); }
.opc-tab.active {
  color: var(--accent); font-weight: 600;
  background: var(--bg-card);
}
.opc-tab.active::after {
  content: ''; position: absolute; bottom: 0; left: 0; right: 0;
  height: 2px; background: var(--accent);
}

/* ---- 工作区：面板容器 ---- */
.opc-workspace {
  flex: 1; overflow: hidden; display: flex; flex-direction: column;
  min-height: 0; position: relative;
}

/* ---- 统一结果渲染区（常驻停靠面板，工作空间 / Agent 工作室 / 治理 共用） ---- */
:root { --mr-width: min(440px, 46vw); }
.main-render-dock {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: var(--mr-width);
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform .22s ease;
  z-index: 40;
  box-shadow: -8px 0 24px rgba(0,0,0,.16);
}
.main-render-dock.open { transform: translateX(0); }
.main-render-dock.pulse { animation: mrPulse .7s ease; }
@keyframes mrPulse {
  0%,100% { box-shadow: -8px 0 24px rgba(0,0,0,.16); }
  50%     { box-shadow: -8px 0 30px var(--accent); }
}
.main-render-head {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-bottom: 1px solid var(--border);
  background: var(--bg-secondary); flex-shrink: 0;
}
.main-render-title { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.main-render-spacer { flex: 1; }
.main-render-btn {
  border: none; background: transparent; color: var(--text-secondary);
  cursor: pointer; font-size: 14px; line-height: 1; padding: 4px 6px; border-radius: 6px;
}
.main-render-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.main-render-body { flex: 1; overflow: auto; padding: 12px; }
.main-render-handle {
  position: fixed; top: 50%; right: 0; transform: translateY(-50%);
  writing-mode: vertical-rl; padding: 12px 6px;
  background: var(--bg-card); color: var(--text-primary);
  border: 1px solid var(--border); border-right: none;
  border-radius: 8px 0 0 8px; cursor: pointer; font-size: 12px; z-index: 40;
  box-shadow: -4px 0 12px rgba(0,0,0,.12);
}
.main-render-handle:hover { color: var(--accent); }

/* 渲染区展开时，右上角全局浮层条（用户菜单 / 主题切换，z-index 1001）会压住渲染区
   标题栏与关闭按钮。此处让它随渲染区一起左移让位，收起时复位。 */
#globalTopbar { transition: right .22s ease; }
body.mr-open #globalTopbar { right: calc(var(--mr-width) + 14px); }
/* 渲染区自身标题栏留出安全上边距，避免与浮层条视觉贴边 */
body.mr-open .main-render-head { min-height: 44px; }

/* ---- 能力域面板 ---- */
.opc-tabpanel {
  display: none; flex: 1; overflow-y: auto; padding: 20px;
  flex-direction: column; min-height: 0;
}
.opc-tabpanel.active { display: flex; }
/* 协作群等外嵌页面：iframe 充满面板 */
.opc-ext-frame { flex: 1; width: 100%; height: 100%; border: 0; min-height: 0; background: var(--bg, #fff); }

/* ---- 功能卡片网格 ---- */
.opc-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

/* ---- 功能入口卡 ---- */
.opc-func-card {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px; cursor: pointer;
  transition: all var(--transition); text-align: left;
}
.opc-func-card:hover { border-color: var(--accent); background: var(--bg-hover); transform: translateY(-1px); box-shadow: var(--shadow); }
.opc-func-icon { font-size: 28px; margin-bottom: 10px; }
.opc-func-title { font-size: 14px; font-weight: 600; color: var(--text-primary); margin-bottom: 6px; }
.opc-func-desc { font-size: 12px; color: var(--text-secondary); line-height: 1.6; }

/* ---- 功能分组标题 + 卡片元信息 + 次级入口 + 弱化态 ---- */
.opc-group-title {
  font-size: 11px; font-weight: 700; color: var(--text-tertiary);
  text-transform: uppercase; letter-spacing: .08em;
  margin: 16px 2px 2px;
}
.opc-group-title:first-child { margin-top: 4px; }
.opc-func-meta { font-size: 11px; color: var(--text-tertiary); line-height: 1.5; margin-top: 6px; }
.opc-func-meta .tag {
  display: inline-block; padding: 1px 7px; border-radius: 6px;
  margin: 0 4px 4px 0; background: var(--bg-tertiary); color: var(--text-secondary);
  font-size: 10px;
}
.opc-func-sub { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; }
.opc-func-sub button {
  font-size: 11px; padding: 3px 10px; border: 1px solid var(--border);
  border-radius: 6px; background: var(--bg-tertiary); cursor: pointer; color: var(--text-secondary);
  transition: all var(--transition);
}
.opc-func-sub button:hover { border-color: var(--accent); color: var(--accent); }
.opc-func-card--weak { opacity: .5; filter: grayscale(.4); }
.opc-func-card--weak::after {
  content: ' · 数据未就绪'; color: var(--warning, #f59e0b); font-size: 11px; font-weight: 500;
}

/* ---- 内嵌 iframe 区 ---- */
.opc-iframe-wrap {
  display: flex; flex-direction: column; flex: 1; min-height: 0;
}
.opc-back-btn {
  display: inline-flex; align-items: center; gap: 4px; padding: 6px 12px;
  font-size: 12px; color: var(--accent); cursor: pointer;
  background: var(--accent-bg); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 10px;
  width: fit-content; transition: all var(--transition);
}
.opc-back-btn:hover { background: var(--accent-20); }
.opc-iframe {
  flex: 1; width: 100%; border: none; border-radius: var(--radius);
  background: var(--bg-primary);
  min-height: 0;
}

/* ---- P2b 统一入口引导条 ---- */
.gov-entry-guide {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 9px 14px; background: var(--accent-bg);
  border-bottom: 1px solid var(--border); font-size: 12px;
  color: var(--text-secondary); line-height: 1.6; flex-shrink: 0;
  position: relative;
}
.gov-entry-guide-icon { font-size: 15px; line-height: 1.4; flex-shrink: 0; }
#govEntryGuide > span.gov-entry-guide-text { flex: 1; padding-right: 340px; }
.gov-entry-guide-text b { color: var(--text-primary); font-weight: 600; }
.gov-entry-guide-close {
  flex-shrink: 0; border: none; background: none; cursor: pointer;
  color: var(--text-muted); font-size: 16px; line-height: 1; padding: 0 2px;
}
.gov-entry-guide-close:hover { color: var(--text-primary); }

/* ---- P0 架构风险提示条（Verification × 受限架构） ---- */
.orch-arch-warn {
  margin: 10px 0; padding: 9px 14px; border-radius: 8px;
  background: rgba(255, 179, 64, 0.12); border: 1px solid rgba(255, 179, 64, 0.45);
  color: #ffcf8a; font-size: 12px; line-height: 1.6;
}

/* ---- P2b 高级模式徽章条 ---- */
.opc-adv-strip {
  display: flex; align-items: center; gap: 10px; margin: 4px 0 14px;
  padding: 8px 12px; background: var(--accent-bg);
  border: 1px solid var(--border); border-radius: 10px;
}
.opc-adv-badge {
  flex-shrink: 0; font-size: 12px; font-weight: 600;
  background: var(--accent-solid, #4f7cff); color: #fff;
  padding: 3px 10px; border-radius: 999px;
}
.opc-adv-note { font-size: 11.5px; color: var(--text-muted); }

/* ---- 构建·推理合并面板：竖向流（Step1 构建 → Step2 推理） ---- */
.opc-buildrun-grid { display: block; }       /* 覆盖 .opc-card-grid 的 grid 为块流 */
.opc-step { margin-bottom: 4px; }
.opc-step-header {
  display: flex; align-items: center; gap: 10px;
  font-size: 15px; font-weight: 600; color: var(--text-primary);
  margin: 16px 0 12px;
}
.opc-step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent-solid, #4f7cff); color: #fff;
  font-size: 13px; font-weight: 700; flex-shrink: 0;
}
.opc-card-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.opc-flow-connector {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  margin: 10px 0; color: var(--accent); font-size: 12.5px; font-weight: 600;
}
.opc-flow-line {
  width: 56px; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--accent));
}
.opc-flow-connector .opc-flow-line:last-child {
  background: linear-gradient(90deg, var(--accent), transparent);
}

/* ---- 工作台入口引导卡（指向构建·推理 Tab） ---- */
.wb-hint-card {
  display: flex; gap: 14px; align-items: center;
  background: var(--bg-secondary); border: 1px dashed var(--accent);
  border-radius: var(--radius-lg); padding: 18px 22px; cursor: pointer;
  transition: all var(--transition); margin-top: 8px;
}
.wb-hint-card:hover { background: var(--bg-hover); border-style: solid; }
.wb-hint-icon { font-size: 30px; flex-shrink: 0; }
.wb-hint-title { font-size: 14px; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.wb-hint-desc { font-size: 12px; color: var(--text-secondary); line-height: 1.6; }

/* ---- Agent 渲染区（独立 Tab #opc-render，与工作台区分） ---- */
#opc-render { padding: 0; }
/* 渲染区表格行点选提示与选中高亮（与历史列表一致） */
.governance-render .history-table tr.clickable-row { cursor: pointer; }
.governance-render .history-table tr:hover td { background: var(--bg-hover, #f5f6f8); }
.governance-render .history-table tr.selected td { background: var(--accent-bg, #e6f0ff); }
.governance-render .history-table .col-act { width: 72px; text-align: right; color: var(--text-muted); white-space: nowrap; }
.governance-render .history-table .row-select-hint { opacity: 0; font-size: 12px; transition: opacity .12s; color: var(--text-muted); }
.governance-render .history-table tr:hover .row-select-hint { opacity: 1; }
.governance-render .history-table tr.selected .row-select-hint { opacity: 1; color: var(--accent); }
.opc-render-toolbar {
  padding: 10px 16px; border-bottom: 1px solid var(--border);
  background: var(--bg-secondary); display: flex; align-items: center;
  justify-content: space-between; flex-shrink: 0;
}

/* ---- 工作台样式 ---- */

/* 工作台两列排版：左为治理对话侧栏（原主页左边栏），右为工作台总览 */
.wb-layout {
  display: flex; gap: 16px; flex: 1; min-height: 0; align-items: stretch;
}
.wb-content {
  flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 16px;
  overflow: auto; padding-right: 4px;
}

/* 状态条 */
.wb-statusbar {
  display: flex; gap: 12px; margin-bottom: 24px; flex-shrink: 0;
}
.wb-stacard {
  flex: 1; min-width: 100px; background: var(--bg-secondary);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 14px 18px; display: flex; flex-direction: column; align-items: center;
  transition: all var(--transition);
}
.wb-stacard:hover { border-color: var(--accent); }
.wb-stanum {
  font-size: 28px; font-weight: 700; color: var(--accent); line-height: 1.3;
}
.wb-stalabel {
  font-size: 11px; color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 0.5px; margin-top: 2px;
}

/* 能力分区 */
.wb-section {
  margin-bottom: 28px; flex-shrink: 0;
}
.wb-section-title {
  font-size: 15px; font-weight: 600; color: var(--text-primary);
  margin-bottom: 14px; padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

/* 工作台能力卡片网格 */
.wb-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

/* 工作台能力卡片 */
.wb-cap-card {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px; cursor: pointer;
  transition: all var(--transition); text-align: left;
  border-left: 3px solid var(--accent);
}
.wb-cap-card:hover {
  border-color: var(--accent); background: var(--bg-hover);
  transform: translateY(-1px); box-shadow: var(--shadow);
}
.wb-cap-icon { font-size: 24px; margin-bottom: 8px; }
.wb-cap-title { font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 5px; }
.wb-cap-desc { font-size: 11px; color: var(--text-secondary); line-height: 1.5; }
