/* app.css
   Tower Balance Lab v0.2 本地样式
   风格：简洁、清晰、明了，不强制深色
*/

:root {
  --tb-border: #e5e7eb;
  --tb-muted: #6b7280;
  --tb-bg: #f8fafc;
}

body {
  background-color: var(--tb-bg);
}

.app-header {
  background-color: #fff;
  border-bottom: 1px solid var(--tb-border);
}

/* Tab 面板切换 */
.tab-panel {
  display: none;
}
.tab-panel.active {
  display: block;
}

/* 空状态 */
.empty-state {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--tb-muted);
  border: 1px dashed var(--tb-border);
  border-radius: 4px;
  background: #fff;
}

/* 占位面板 */
.placeholder-panel {
  padding: 2rem;
  text-align: center;
  font-size: 1.05rem;
}

/* 统计卡片 */
.stat-card {
  min-width: 110px;
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  background: #fff;
  border: 1px solid var(--tb-border);
  text-align: center;
}
.stat-label {
  font-size: 0.75rem;
  color: var(--tb-muted);
  margin-bottom: 0.25rem;
}
.stat-value {
  font-size: 1.25rem;
  font-weight: 600;
}
.stat-primary { border-left: 3px solid #206bc4; }
.stat-info    { border-left: 3px solid #4299e1; }
.stat-success { border-left: 3px solid #2fb344; }
.stat-warning { border-left: 3px solid #f59f00; }
.stat-danger  { border-left: 3px solid #d63939; }

/* Phase C: 问题概览合并卡（danger + warning 合并为 1 张） */
.stat-overview {
  min-width: 140px;
  padding: 0.5rem 0.75rem;
}
.stat-overview-values {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}
.stat-overview-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  transition: background-color 0.15s;
}
.stat-overview-item:hover {
  background: #f3f4f6;
}
.stat-overview-item-active {
  background: #f3f4f6;
  box-shadow: 0 0 0 1px #d1d5db inset;
}
.stat-overview-num {
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.2;
}
.stat-overview-sev {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.stat-overview-danger .stat-overview-num { color: #d63939; }
.stat-overview-warning .stat-overview-num { color: #f59f00; }
.stat-overview-divider {
  width: 1px;
  height: 28px;
  background: var(--tb-border);
}

/* 异常列表 */
.issue-list {
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid var(--tb-border);
  border-radius: 4px;
  background: #fff;
  padding: 0.5rem;
}
.issue-item {
  padding: 0.25rem 0;
  font-size: 0.875rem;
  border-bottom: 1px solid #f1f5f9;
}
.issue-item:last-child {
  border-bottom: none;
}

/* 表格区域 */
.table-area {
  min-height: 120px;
  position: relative;
  max-width: 100%;
}

/* 主表表头：压缩主题默认的 12px 横向内边距，并为可排序列保留独立箭头区。 */
#placeable-table .tabulator-header .tabulator-col .tabulator-col-content {
  padding-left: 6px;
  padding-right: 6px;
}
#placeable-table .tabulator-header .tabulator-col .tabulator-col-title {
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: clip !important;
  width: 100% !important;
  padding-right: 0 !important;
  display: block !important;
  box-sizing: border-box !important;
}
#placeable-table .tabulator-header .tabulator-col.tabulator-sortable .tabulator-col-title {
  padding-right: 20px !important;
}
#placeable-table .tabulator-header .tabulator-col.tabulator-sortable .tabulator-col-sorter {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  width: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
}

/* 等级列专用：保证 Lv1/Lv2/Lv3 按钮组不被裁剪、不显示省略号 */
#placeable-table .tb-level-column {
  overflow: visible !important;
  text-overflow: clip !important;
}
#placeable-table .tb-level-column .level-btn-group {
  display: flex;
  flex-wrap: nowrap;
  width: max-content;
  gap: 0.25rem;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

/* 等级按钮组（Tab 2 单行 + Lv1/Lv2/Lv3 切换） */
.level-btn-group {
  display: inline-flex;
  gap: 0.25rem;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}
.level-btn {
  padding: 0.25rem 0.5rem;
  font-size: 0.8125rem;
  line-height: 1.2;
  font-weight: 500;
  border: 1px solid var(--tb-border);
  border-radius: 4px;
  background: #fff;
  color: #6b7280;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
  min-width: 28px;
  height: 26px;
  text-align: center;
}
.level-btn:hover {
  background: #f3f4f6;
  color: #206bc4;
  border-color: #206bc4;
}
.level-btn.active {
  background: #206bc4;
  color: #fff;
  border-color: #206bc4;
  font-weight: 600;
}

/* V2 数值表紧凑布局：仅在该作用域内压缩单元格/表头 padding，不影晌 legacy */
#tab-tables.tb-v2-tables-active #placeable-table .tabulator-cell {
  padding-left: 3px !important;
  padding-right: 3px !important;
}
#tab-tables.tb-v2-tables-active #placeable-table .tabulator-header .tabulator-col .tabulator-col-content {
  padding-left: 3px;
  padding-right: 3px;
}
#tab-tables.tb-v2-tables-active #placeable-table .tabulator-header .tabulator-col-title {
  font-size: 0.75rem;
}
#tab-tables.tb-v2-tables-active #placeable-table .tb-level-column .level-btn-group,
#tab-tables.tb-v2-tables-active #placeable-table .level-btn-group {
  gap: 2px;
}

/* ========== v0.3 暂存编辑状态栏 ========== */
.edit-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 0.75rem;
  background: #fff;
  border: 1px solid var(--tb-border);
  border-radius: 4px;
  flex-wrap: wrap;
}
.edit-status-info {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem;
}
.edit-status-info .badge {
  color: #fff !important;
  font-weight: 600;
}
.edit-status-actions {
  display: flex;
  gap: 0.5rem;
}
.edit-notice {
  font-size: 0.8rem;
}

/* ========== v0.3 已修改单元格 / 行高亮 ========== */
.modified-cell {
  background: #fff3cd;
  color: #806000;
  font-weight: 600;
  padding: 0.15rem 0.3rem;
  border-radius: 3px;
  display: inline-block;
}
/* fallback 原生 input 编辑框 */
.fallback-edit-input {
  height: 28px;
  padding: 0.25rem 0.4rem;
  font-size: 0.8125rem;
  line-height: 1.2;
  border: 1px solid #d1d5db;
  border-radius: 3px;
  width: 100%;
  box-sizing: border-box;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.fallback-edit-input:focus {
  border-color: #206bc4;
  outline: none;
  box-shadow: 0 0 0 2px rgba(32, 107, 196, 0.12);
}
input.fallback-edit-input.modified-cell {
  background: #fff3cd;
  border-color: #f59f00;
  color: #806000;
  font-weight: 600;
}
/* fallback 原生表格行已修改 */
.native-table tbody tr.modified-row {
  background: #fff8e1;
}
.native-table tbody tr.modified-row td {
  background: #fff8e1;
}
/* Tabulator 单元格已修改（formatter span 已加 modified-cell，这里给整 td 加背景） */
.tabulator-table td .modified-cell {
  background: #fff3cd;
}

/* ========== v0.3 不可编辑单元格（原始 JSON 无对应槽位） ========== */
.disabled-cell {
  color: #9ca3af;
  background: #f9fafb;
  cursor: not-allowed;
  padding: 0.15rem 0.3rem;
  border-radius: 3px;
  display: inline-block;
}
/* fallback 原生 input 不可编辑 */
input.fallback-edit-input.disabled-cell {
  background: #f9fafb;
  border-color: #e5e7eb;
  color: #9ca3af;
  cursor: not-allowed;
  text-align: right;
}
input.fallback-edit-input.disabled-cell:disabled {
  opacity: 0.7;
}
/* Tabulator 单元格不可编辑 */
.tabulator-table td .disabled-cell {
  background: #f9fafb;
}

/* ========== v0.4 Tab 4 风险列表筛选 ========== */
.rule-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.rule-filter-btn {
  font-weight: 500;
}
.rule-filter-btn.btn-active {
  font-weight: 600;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08) inset;
}
.rule-filter-btn.btn-outline-danger.btn-active {
  background: #dc3545;
  color: #fff;
  border-color: #dc3545;
}
.rule-filter-btn.btn-outline-warning.btn-active {
  background: #f59f00;
  color: #212529;
  border-color: #f59f00;
}
.rule-filter-btn.btn-outline-secondary.btn-active {
  background: #6c757d;
  color: #fff;
  border-color: #6c757d;
}

/* 概览卡片可点击（danger/warning 卡片触发筛选） */
.stat-card-clickable {
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease, background-color 0.08s ease;
}
.stat-card-clickable:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}
.stat-card-clickable-active {
  background: #f3f4f6 !important;
  box-shadow: 0 0 0 2px #206bc4 inset;
}
.stat-card-clickable-active.stat-danger {
  box-shadow: 0 0 0 2px #dc3545 inset;
}
.stat-card-clickable-active.stat-warning {
  box-shadow: 0 0 0 2px #f59f00 inset;
}

/* ========== v0.5 Tab 5 范围可视化 ========== */
.range-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.range-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  align-items: flex-start;
  padding: 0.75rem 1rem;
  background: #fafbfc;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
}
.range-control-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}
.range-control-label {
  font-weight: 600;
  color: #374151;
  margin-right: 0.25rem;
}
.range-level-btn.active {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
}
.range-unit-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.5rem;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  user-select: none;
}
.range-unit-checkbox.checked {
  border-color: #2563eb;
  background: rgba(37, 99, 235, 0.08);
}
.range-unit-checkbox input[type="checkbox"] {
  margin: 0;
  cursor: pointer;
}
.range-unit-checkbox input[type="checkbox"]:disabled {
  cursor: not-allowed;
}
.range-body {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-start;
}
.range-body--two-col .range-left-col {
  flex: 1 1 58%;
  min-width: 0;
}
.range-body--two-col .range-right-col {
  flex: 1 1 38%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.range-svg-wrap {
  flex: 0 0 auto;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
}
.range-svg {
  width: 100%;
  height: auto;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
}
.range-legend {
  flex: 1 1 200px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: #fafbfc;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
}
.range-legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.88rem;
  color: #374151;
}
.range-legend-swatch {
  display: inline-block;
  width: 28px;
  height: 14px;
  border-radius: 2px;
}
.range-legend-solid {
  background: transparent;
  border: 2px solid #2563eb;
}
.range-legend-dashed {
  background: transparent;
  border: 2px dashed #2563eb;
  opacity: 0.6;
}
.range-legend-note {
  font-size: 0.78rem;
  color: #6b7280;
  margin-top: 0.25rem;
  line-height: 1.4;
}
.range-table-wrap {
  overflow-x: auto;
  max-width: 100%;
}
.range-table th,
.range-table td {
  white-space: nowrap;
}
.range-table td:nth-child(3),
.range-table td:nth-child(4),
.range-table td:nth-child(5),
.range-table td:nth-child(6),
.range-table td:nth-child(7) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* 图表容器 */
.chart-box {
  height: 320px;
  position: relative;
}

/* badge 软色 */
.bg-primary-soft {
  background-color: rgba(32, 107, 196, 0.12);
  color: #206bc4;
}

/* ========== CDN 降级样式 ========== */

/* 降级提示 */
.fallback-notice {
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.5rem;
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-radius: 4px;
  color: #806000;
  font-size: 0.875rem;
}

/* 原生表格容器（支持横向滚动） */
.native-table-wrap {
  overflow-x: auto;
  max-height: 520px;
  overflow-y: auto;
  border: 1px solid var(--tb-border);
  border-radius: 4px;
  background: #fff;
  max-width: 100%;
}

/* 原生表格 */
.native-table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.native-table thead {
  position: sticky;
  top: 0;
  background: #f8fafc;
  z-index: 10;
}
.native-table th,
.native-table td {
  padding: 0.45rem 0.65rem;
  border-bottom: 1px solid #e5e7eb;
  border-right: 1px solid #f1f5f9;
  text-align: left;
  white-space: nowrap;
  height: 38px;
  vertical-align: middle;
}
.native-table th {
  font-weight: 600;
  color: #374151;
  font-size: 0.8125rem;
  height: 36px;
}
.native-table tbody tr:hover {
  background: #f9fafb;
}
.native-table td.text-right,
.native-table th.text-right {
  text-align: right;
}
.native-table td.text-center,
.native-table th.text-center {
  text-align: center;
}
.native-table td.text-truncate,
.native-table th.text-truncate {
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.native-table td.text-wrap {
  white-space: normal;
  line-height: 1.35;
  min-width: 260px;
  max-width: 360px;
}

/* 简易图表容器 */
.simple-chart {
  padding: 0.5rem;
  background: #fff;
  border: 1px solid var(--tb-border);
  border-radius: 4px;
  max-height: 300px;
  overflow-y: auto;
}
.simple-chart-title {
  font-weight: 600;
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}
.simple-chart-group {
  font-weight: 600;
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: #374151;
  border-top: 1px dashed #e5e7eb;
  padding-top: 0.25rem;
}
.simple-chart-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.15rem 0;
  font-size: 0.8rem;
}
.simple-chart-label {
  flex: 0 0 90px;
  color: #6b7280;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.simple-chart-bar {
  display: inline-block;
  height: 14px;
  background: #206bc4;
  border-radius: 2px;
  min-width: 2px;
  flex: 1 1 auto;
  max-width: 100%;
}
.simple-chart-value {
  flex: 0 0 auto;
  min-width: 48px;
  text-align: right;
  color: #374151;
  font-variant-numeric: tabular-nums;
}

/* ========== v0.6 Tab 1 总览工作台 dashboard ========== */
.dashboard-card {
  border-left: 3px solid #206bc4;
}
.dashboard-action-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
.dashboard-stat-text {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
}
/* 工作流步骤 */
.dashboard-workflow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0;
}
.dashboard-workflow-step {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  background: #fff;
  border: 1px solid var(--tb-border);
  border-radius: 20px;
  font-size: 0.9rem;
  color: #374151;
}
.dashboard-workflow-step.clickable {
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.dashboard-workflow-step.clickable:hover {
  background: #eef2f7;
  border-color: #206bc4;
  color: #206bc4;
}
.dashboard-workflow-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #206bc4;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
}
.dashboard-workflow-label {
  font-weight: 500;
}
.dashboard-workflow-arrow {
  color: var(--tb-muted);
  font-size: 1rem;
  font-weight: 600;
}

/* ========== v0.9.2 Tab 1 次级折叠摘要 ========== */
.dashboard-secondary-details {
  border: 1px solid var(--tb-border);
  border-radius: 6px;
  background: #fff;
}
.dashboard-secondary-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  padding: 0.6rem 1rem;
  cursor: pointer;
  font-size: 0.875rem;
  list-style: none;
}
.dashboard-secondary-summary::-webkit-details-marker {
  display: none;
}
.dashboard-secondary-title {
  font-weight: 600;
  color: #374151;
}
.dashboard-summary-metrics {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.75rem;
  font-size: 0.8125rem;
}
.dash-metric {
  color: #6b7280;
  white-space: nowrap;
}
.dash-metric-danger {
  color: #dc3545;
  font-weight: 600;
}
.dash-metric-warning {
  color: #f59f00;
  font-weight: 600;
}
.dashboard-secondary-content {
  padding: 0.75rem 1rem;
  background: #f8fafc;
  border-top: 1px solid var(--tb-border);
}
.dashboard-secondary-content .dashboard-card {
  border-left: 3px solid #cbd5e1;
  box-shadow: none;
}
.dashboard-secondary-content .card-header {
  min-height: 42px;
  padding: 10px 16px;
}
.dashboard-secondary-content .card-body {
  padding: 12px 16px;
}
.dashboard-secondary-content .stat-card {
  padding: 0.35rem 0.5rem;
  min-width: 90px;
}
.dashboard-secondary-content .stat-value {
  font-size: 1.1rem;
}

/* ========== Phase B: Tab 1 状态摘要网格 ========== */
.stat-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
@media (min-width: 1920px) {
  .stat-card-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
.stat-card-grid > .dashboard-card {
  margin-bottom: 0;
}
.stat-card-grid > .dashboard-card .card-body {
  padding: 0.75rem 1rem;
}

/* 工作流步骤区（不再包 card 外壳） */
.dashboard-workflow-panel {
  background: #fff;
  border: 1px solid var(--tb-border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
}

/* 数据来源折叠区（手动导入 + 设计资料 + 结构校验） */
.dashboard-data-sources {
  border: 1px solid var(--tb-border);
  border-radius: 8px;
  background: #fff;
}

/* 数据来源折叠区容器 */
.dashboard-data-sources {
  border: 1px solid var(--tb-border);
  border-radius: 8px;
  background: #fff;
}

/* ========== UI Rebuild V2: 总览作用域隔离样式 ========== */
/* 所有规则必须位于 .tb-v2-overview 作用域内，禁止全局 reset */

.tb-v2-overview {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #111827;
  background: #f8fafc;
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
}

.tb-v2-overview .tb-v2-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.tb-v2-overview .tb-v2-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0;
  color: #111827;
}

.tb-v2-overview .tb-v2-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  background: #dbeafe;
  color: #1e40af;
}

.tb-v2-overview .tb-v2-kpi-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

@media (min-width: 1024px) {
  .tb-v2-overview .tb-v2-kpi-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1440px) {
  .tb-v2-overview .tb-v2-kpi-row {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

.tb-v2-overview .tb-v2-kpi-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 1rem;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.tb-v2-overview .tb-v2-kpi-label {
  font-size: 0.875rem;
  color: #6b7280;
  margin-bottom: 0.25rem;
}

.tb-v2-overview .tb-v2-kpi-value {
  font-size: 1.875rem;
  font-weight: 600;
  color: #111827;
  line-height: 1.2;
}

.tb-v2-overview .tb-v2-kpi-value--danger {
  color: #e11d48;
}

.tb-v2-overview .tb-v2-kpi-value--warning {
  color: #d97706;
}

.tb-v2-overview .tb-v2-kpi-hint {
  font-size: 0.75rem;
  color: #9ca3af;
  margin-top: 0.5rem;
}

.tb-v2-overview .tb-v2-grid {
  display: grid;
  gap: 1rem;
  margin-bottom: 1rem;
}

.tb-v2-overview .tb-v2-grid--main {
  grid-template-columns: 1fr;
}

@media (min-width: 1280px) {
  .tb-v2-overview .tb-v2-grid--main {
    grid-template-columns: 2fr 1fr;
  }
}

.tb-v2-overview .tb-v2-grid--third {
  grid-template-columns: 1fr;
}

@media (min-width: 1024px) {
  .tb-v2-overview .tb-v2-grid--third {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1440px) {
  .tb-v2-overview .tb-v2-grid--third {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.tb-v2-overview .tb-v2-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 1rem;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.tb-v2-overview .tb-v2-card-header {
  font-size: 1rem;
  font-weight: 600;
  color: #111827;
  margin-bottom: 0.75rem;
}

.tb-v2-overview .tb-v2-card-header-hint {
  font-size: 0.75rem;
  font-weight: 400;
  color: #6b7280;
  margin-left: 0.5rem;
}

.tb-v2-overview .tb-v2-level-bar {
  margin-bottom: 0.5rem;
}

.tb-v2-overview .tb-v2-level-bar-inner {
  display: inline-flex;
  gap: 0.25rem;
}

.tb-v2-overview .tb-v2-level-btn {
  padding: 0.125rem 0.5rem;
  font-size: 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  background: #fff;
  color: #374151;
  cursor: pointer;
}

.tb-v2-overview .tb-v2-level-btn:hover {
  border-color: #2563eb;
  color: #2563eb;
}

.tb-v2-overview .tb-v2-level-btn--active {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
}

.tb-v2-overview .tb-v2-chart {
  width: 100%;
  height: 320px;
}

.tb-v2-overview .tb-v2-donut {
  width: 100%;
  height: 180px;
}

.tb-v2-overview .tb-v2-muted {
  font-size: 0.875rem;
  color: #6b7280;
}

.tb-v2-overview .tb-v2-risk-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.tb-v2-overview .tb-v2-risk-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem;
  border-radius: 6px;
  background: #f9fafb;
  transition: background-color 0.15s;
}

.tb-v2-overview .tb-v2-risk-item:hover {
  background: #f3f4f6;
}

.tb-v2-overview .tb-v2-risk-item--top {
  background: #fff1f2;
  border: 1px solid #ffe4e6;
}

.tb-v2-overview .tb-v2-risk-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: #111827;
  margin-bottom: 0.125rem;
}

.tb-v2-overview .tb-v2-risk-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  background: #f3f4f6;
  color: #374151;
}

.tb-v2-overview .tb-v2-risk-badge--danger {
  background: #ffe4e6;
  color: #9f1239;
}

.tb-v2-overview .tb-v2-risk-badge--warning {
  background: #fef3c7;
  color: #92400e;
}

.tb-v2-overview .tb-v2-workflow {
  display: flex;
  flex-direction: column;
}

.tb-v2-overview .tb-v2-workflow-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid #f3f4f6;
}

.tb-v2-overview .tb-v2-workflow-item:last-child {
  border-bottom: none;
}

/* ========== UI Rebuild V2: 放置/数值表作用域隔离样式 ========== */
/* 所有规则必须位于 #tab-tables.tb-v2-tables-active 或 .tb-v2-tables-page 作用域内 */

#tab-tables.tb-v2-tables-active .tb-v2-tables-legacy-title,
#tab-tables.tb-v2-tables-active .tb-v2-tables-legacy-panel,
#tab-tables.tb-v2-tables-active .tb-v2-tables-legacy-card {
  display: none !important;
}

#tab-tables.tb-v2-tables-legacy .tb-v2-tables-page {
  display: none !important;
}

#tab-tables.tb-v2-tables-active .tb-v2-tables-page {
  display: flex !important;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 420px;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #111827;
}

.tb-v2-tables-page .tb-v2-tables-header {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.tb-v2-tables-page .tb-v2-tables-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 0.25rem 0;
}

.tb-v2-tables-page .tb-v2-tables-subtitle {
  font-size: 0.875rem;
  color: #6b7280;
  margin: 0;
}

.tb-v2-tables-page .tb-v2-tables-stats {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.75rem;
  flex-shrink: 0;
}

.tb-v2-tables-page .tb-v2-tables-stat {
  min-width: 80px;
  text-align: center;
  padding: 0.5rem 0.75rem;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
}

.tb-v2-tables-page .tb-v2-tables-stat-label {
  display: block;
  font-size: 0.75rem;
  color: #6b7280;
  margin-bottom: 0.125rem;
}

.tb-v2-tables-page .tb-v2-tables-stat-value {
  display: block;
  font-size: 1.25rem;
  font-weight: 600;
  color: #111827;
}

.tb-v2-tables-page .tb-v2-tables-toolbar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 1rem;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.tb-v2-tables-page .tb-v2-tables-search {
  flex: 0 1 320px;
  min-width: 0;
}

.tb-v2-tables-page .tb-v2-tables-input {
  width: 100%;
  padding: 0.4rem 0.6rem;
  font-size: 0.875rem;
  line-height: 1.4;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  color: #111827;
  box-sizing: border-box;
}

.tb-v2-tables-page .tb-v2-tables-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}

.tb-v2-tables-page .tb-v2-tables-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.5rem;
  flex-shrink: 0;
}

.tb-v2-tables-page .tb-v2-tables-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.85rem;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.4;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}

.tb-v2-tables-page .tb-v2-tables-btn--warning {
  background: #f59f00;
  color: #fff;
  border-color: #f59f00;
}

.tb-v2-tables-page .tb-v2-tables-btn--warning:hover {
  background: #f08c00;
}

.tb-v2-tables-page .tb-v2-tables-btn--success {
  background: #2fb344;
  color: #fff;
  border-color: #2fb344;
}

.tb-v2-tables-page .tb-v2-tables-btn--success:hover {
  background: #28a03b;
}

.tb-v2-tables-page .tb-v2-tables-body {
  flex: 0 1 auto;
  min-height: 0;
  overflow: hidden;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.tb-v2-tables-body .tabulator {
  height: auto;
  max-height: calc(100vh - 420px);
  max-width: 100%;
}

.tb-v2-tables-page .tb-v2-tables-editbar {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.tb-v2-tables-page .tb-v2-tables-editinfo {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.75rem;
}

.tb-v2-tables-page .tb-v2-tables-badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 9999px;
  background: #fef3c7;
  color: #92400e;
}

.tb-v2-tables-page .tb-v2-tables-hint {
  font-size: 0.75rem;
  color: #6b7280;
}

.tb-v2-tables-page .tb-v2-tables-review {
  max-height: 220px;
  overflow-y: auto;
}

.tb-v2-tables-page .tb-v2-tables-review .change-review-root {
  margin: 0;
}

.tb-v2-tables-page .tb-v2-tables-review .change-review-title {
  display: none;
}

.tb-v2-tables-page .tb-v2-tables-review .change-review-summary {
  margin-bottom: 0.5rem;
  padding: 0.4rem 0.5rem;
  background: #f8fafc;
  border-radius: 6px;
  font-size: 0.8125rem;
}

.tb-v2-tables-page .tb-v2-tables-review .native-table {
  min-width: 0;
  width: 100%;
}

@media (max-width: 1439px) {
  .tb-v2-tables-page .tb-v2-tables-header {
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
  }

  .tb-v2-tables-page .tb-v2-tables-title {
    font-size: 1.1rem;
  }

  .tb-v2-tables-page .tb-v2-tables-stats {
    gap: 0.5rem;
  }

  .tb-v2-tables-page .tb-v2-tables-stat {
    min-width: 64px;
    padding: 0.4rem 0.5rem;
  }

  .tb-v2-tables-page .tb-v2-tables-stat-value {
    font-size: 1.05rem;
  }

  .tb-v2-tables-page .tb-v2-tables-toolbar {
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
  }

  .tb-v2-tables-page .tb-v2-tables-search {
    flex: 1 1 100%;
  }
}


.tb-v2-overview .tb-v2-workflow-label {
  font-size: 0.875rem;
  color: #374151;
}

.tb-v2-overview .tb-v2-workflow-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.125rem 0.375rem;
  border-radius: 4px;
  background: #f3f4f6;
  color: #4b5563;
}

.tb-v2-overview .tb-v2-workflow-badge--done {
  background: #dbeafe;
  color: #1e40af;
}

.tb-v2-overview .tb-v2-workflow-badge--attention {
  background: #fef3c7;
  color: #92400e;
}

.tb-v2-overview .tb-v2-recent-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.tb-v2-overview .tb-v2-recent-item {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.tb-v2-overview .tb-v2-recent-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 9999px;
  background: #dbeafe;
  color: #1d4ed8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 500;
  flex-shrink: 0;
}

.tb-v2-overview .tb-v2-recent-text {
  font-size: 0.875rem;
  color: #374151;
}

.tb-v2-overview .tb-v2-recent-name {
  font-weight: 500;
  color: #111827;
}

.tb-v2-overview .tb-v2-delta--up {
  color: #e11d48;
}

.tb-v2-overview .tb-v2-delta--down {
  color: #059669;
}

.tb-v2-overview .tb-v2-delta--zero {
  color: #6b7280;
}

.tb-v2-overview .tb-v2-legend {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.tb-v2-overview .tb-v2-legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: #6b7280;
}

.tb-v2-overview .tb-v2-legend-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 9999px;
  display: inline-block;
}

.tb-v2-overview .tb-v2-empty {
  padding: 3rem 1rem;
  text-align: center;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.tb-v2-overview .tb-v2-empty-text {
  color: #6b7280;
}

.tb-v2-overview .tb-v2-alert {
  padding: 1rem;
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
  border-radius: 6px;
}
.dashboard-data-sources-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  padding: 0.75rem 1rem;
  cursor: pointer;
  font-size: 0.875rem;
  list-style: none;
}
.dashboard-data-sources-summary::-webkit-details-marker {
  display: none;
}
.dashboard-data-sources-title {
  font-weight: 600;
  color: #374151;
}
.dashboard-data-sources-hint {
  color: #6b7280;
  font-size: 0.8125rem;
}
.dashboard-data-sources-body {
  padding: 1rem;
  background: #f8fafc;
  border-top: 1px solid var(--tb-border);
}
.dashboard-data-sources-body > .card:last-child {
  margin-bottom: 0 !important;
}

/* ========== UI Rebuild V2: 规则审查作用域隔离样式 ========== */
/* 所有规则必须位于 #tab-rules.tb-v2-rules-active 或 .tb-v2-rules-page 作用域内 */

#tab-rules.tb-v2-rules-active .tb-v2-rules-legacy-title,
#tab-rules.tb-v2-rules-active .tb-v2-rules-legacy-panel {
  display: none !important;
}

#tab-rules.tb-v2-rules-legacy .tb-v2-rules-page {
  display: none !important;
}

#tab-rules.tb-v2-rules-active .tb-v2-rules-page {
  display: flex !important;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 420px;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #111827;
}

.tb-v2-rules-page .tb-v2-rules-header {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-shrink: 0;
}

.tb-v2-rules-page .tb-v2-rules-title-row {
  min-width: 0;
  flex: 1 1 auto;
}

.tb-v2-rules-page .tb-v2-rules-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 0.25rem 0;
  color: #111827;
}

.tb-v2-rules-page .tb-v2-rules-subtitle {
  font-size: 0.875rem;
  color: #6b7280;
  margin: 0;
}

.tb-v2-rules-page .tb-v2-rules-meta {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
  font-size: 0.75rem;
  color: #6b7280;
  white-space: nowrap;
}

.tb-v2-rules-page .tb-v2-rules-stats {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.75rem;
  flex-shrink: 0;
  overflow-x: auto;
}

.tb-v2-rules-page .tb-v2-rules-stat {
  flex: 1 1 0;
  min-width: 100px;
  max-width: 160px;
  padding: 0.625rem 0.875rem;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  text-align: center;
}

.tb-v2-rules-page .tb-v2-rules-stat-label {
  display: block;
  font-size: 0.75rem;
  color: #6b7280;
  margin-bottom: 0.25rem;
}

.tb-v2-rules-page .tb-v2-rules-stat-value {
  display: block;
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.2;
}

.tb-v2-rules-page .tb-v2-rules-stat--issue .tb-v2-rules-stat-value { color: #111827; }
.tb-v2-rules-page .tb-v2-rules-stat--danger .tb-v2-rules-stat-value { color: #dc2626; }
.tb-v2-rules-page .tb-v2-rules-stat--warning .tb-v2-rules-stat-value { color: #f59e0b; }
.tb-v2-rules-page .tb-v2-rules-stat--info .tb-v2-rules-stat-value { color: #3b82f6; }
.tb-v2-rules-page .tb-v2-rules-stat--empty .tb-v2-rules-stat-value { color: #6b7280; }
.tb-v2-rules-page .tb-v2-rules-stat--na .tb-v2-rules-stat-value { color: #9ca3af; }

.tb-v2-rules-page .tb-v2-rules-na-note {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
  color: #6b7280;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  white-space: nowrap;
}

.tb-v2-rules-page .tb-v2-rules-na-note-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: #d1d5db;
  color: #fff;
  font-size: 0.625rem;
  line-height: 1;
}

.tb-v2-rules-page .tb-v2-rules-toolbar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
  padding: 0.5rem 0.75rem;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.tb-v2-rules-page .tb-v2-rules-filter-group {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.375rem;
  flex-shrink: 0;
}

.tb-v2-rules-page .tb-v2-rules-filter-btn {
  padding: 0.35rem 0.625rem;
  font-size: 0.8125rem;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #fff;
  color: #374151;
  cursor: pointer;
  white-space: nowrap;
}

.tb-v2-rules-page .tb-v2-rules-filter-btn:hover {
  background: #f3f4f6;
}

.tb-v2-rules-page .tb-v2-rules-filter-btn--active {
  border-color: currentColor;
  background: #fff;
  font-weight: 600;
}

.tb-v2-rules-page .tb-v2-rules-filter-btn--danger.tb-v2-rules-filter-btn--active { color: #dc2626; background: #fee2e2; border-color: #fecaca; }
.tb-v2-rules-page .tb-v2-rules-filter-btn--warning.tb-v2-rules-filter-btn--active { color: #f59e0b; background: #fef3c7; border-color: #fde68a; }
.tb-v2-rules-page .tb-v2-rules-filter-btn--info.tb-v2-rules-filter-btn--active { color: #3b82f6; background: #dbeafe; border-color: #bfdbfe; }
.tb-v2-rules-page .tb-v2-rules-filter-btn--empty.tb-v2-rules-filter-btn--active { color: #6b7280; background: #f3f4f6; border-color: #d1d5db; }

.tb-v2-rules-page .tb-v2-rules-search {
  flex: 1 1 240px;
  min-width: 0;
}

.tb-v2-rules-page .tb-v2-rules-input,
.tb-v2-rules-page .tb-v2-rules-select {
  width: 100%;
  padding: 0.4rem 0.6rem;
  font-size: 0.875rem;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #fff;
  color: #111827;
}

.tb-v2-rules-page .tb-v2-rules-input:focus,
.tb-v2-rules-page .tb-v2-rules-select:focus {
  outline: none;
  border-color: #2563eb;
}

.tb-v2-rules-page .tb-v2-rules-type-filter {
  flex: 0 0 140px;
}

.tb-v2-rules-page .tb-v2-rules-main {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.tb-v2-rules-page .tb-v2-rules-list {
  padding: 0.75rem;
}

.tb-v2-rules-page .tb-v2-rules-empty {
  padding: 3rem 1rem;
  text-align: center;
  color: #6b7280;
}

.tb-v2-rules-page .tb-v2-rules-empty-title {
  font-size: 1rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 0.25rem;
}

.tb-v2-rules-page .tb-v2-rules-issue {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  border-bottom: 1px solid #f3f4f6;
  border-radius: 6px;
  transition: background 0.15s ease;
}

.tb-v2-rules-page .tb-v2-rules-issue:last-child {
  border-bottom: none;
}

.tb-v2-rules-page .tb-v2-rules-issue:hover {
  background: #f8fafc;
}

.tb-v2-rules-page .tb-v2-rules-issue-severity {
  flex: 0 0 auto;
}

.tb-v2-rules-page .tb-v2-rules-issue-severity-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 9999px;
  text-transform: uppercase;
}

.tb-v2-rules-page .tb-v2-rules-issue-severity-badge--danger { background: #fee2e2; color: #991b1b; }
.tb-v2-rules-page .tb-v2-rules-issue-severity-badge--warning { background: #fef3c7; color: #92400e; }
.tb-v2-rules-page .tb-v2-rules-issue-severity-badge--info { background: #dbeafe; color: #1e40af; }
.tb-v2-rules-page .tb-v2-rules-issue-severity-badge--empty { background: #f3f4f6; color: #4b5563; }

.tb-v2-rules-page .tb-v2-rules-issue-body {
  flex: 1 1 auto;
  min-width: 0;
}

.tb-v2-rules-page .tb-v2-rules-issue-title {
  display: flex;
  flex-wrap: nowrap;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: #111827;
  margin-bottom: 0.25rem;
}

.tb-v2-rules-page .tb-v2-rules-issue-unit {
  white-space: nowrap;
}

.tb-v2-rules-page .tb-v2-rules-issue-lv {
  font-size: 0.75rem;
  color: #6b7280;
  white-space: nowrap;
}

.tb-v2-rules-page .tb-v2-rules-issue-field {
  font-size: 0.75rem;
  color: #2563eb;
  background: #eff6ff;
  padding: 0.1rem 0.375rem;
  border-radius: 4px;
  white-space: nowrap;
}

.tb-v2-rules-page .tb-v2-rules-issue-desc {
  font-size: 0.875rem;
  color: #4b5563;
  line-height: 1.4;
  word-break: break-word;
}

.tb-v2-rules-page .tb-v2-rules-issue-value {
  font-size: 0.8125rem;
  color: #6b7280;
  margin-top: 0.25rem;
}

.tb-v2-rules-page .tb-v2-rules-issue-actions {
  flex: 0 0 auto;
}

.tb-v2-rules-page .tb-v2-rules-issue-locate {
  padding: 0.3rem 0.6rem;
  font-size: 0.75rem;
  color: #2563eb;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}

.tb-v2-rules-page .tb-v2-rules-issue-locate:hover {
  background: #dbeafe;
}

.tb-v2-rules-page .tb-v2-rules-impact {
  flex-shrink: 0;
  padding: 0.625rem 0.875rem;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 0.875rem;
  color: #374151;
}

.tb-v2-rules-page .tb-v2-rules-impact-label {
  font-weight: 600;
  margin-right: 0.5rem;
}

.tb-v2-rules-page .tb-v2-rules-impact-value {
  color: #dc2626;
  font-weight: 600;
}

@media (max-width: 1200px) {
  .tb-v2-rules-page .tb-v2-rules-toolbar {
    flex-wrap: wrap;
  }
  .tb-v2-rules-page .tb-v2-rules-search {
    flex: 1 1 100%;
    order: -1;
  }
  .tb-v2-rules-page .tb-v2-rules-type-filter {
    flex: 1 1 120px;
  }
}

@media (max-width: 768px) {
  .tb-v2-rules-page .tb-v2-rules-header {
    flex-wrap: wrap;
  }
  .tb-v2-rules-page .tb-v2-rules-meta {
    align-items: flex-start;
  }
  .tb-v2-rules-page .tb-v2-rules-stats {
    flex-wrap: wrap;
  }
  .tb-v2-rules-page .tb-v2-rules-stat {
    min-width: calc(50% - 0.375rem);
    max-width: none;
  }
}

/* ========== UI Rebuild V2: Tab 3 规则审查四子页 ========== */

#tab-rules.tb-v2-rules-active .tb-v2-rules-subtab-nav {
  flex-shrink: 0;
  padding: 0;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 0.5rem;
}

#tab-rules.tb-v2-rules-active .tb-v2-rules-subtab-inner {
  display: flex;
  flex-wrap: nowrap;
  gap: 0;
}

#tab-rules.tb-v2-rules-active .tb-v2-rules-subtab-btn {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #6b7280;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s ease, border-color 0.15s ease;
}

#tab-rules.tb-v2-rules-active .tb-v2-rules-subtab-btn:hover {
  color: #111827;
}

#tab-rules.tb-v2-rules-active .tb-v2-rules-subtab-btn--active {
  color: #2563eb;
  border-bottom-color: #2563eb;
}

#tab-rules.tb-v2-rules-active .tb-v2-rules-subpage {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

#tab-rules.tb-v2-rules-active .tb-v2-rules-subpage .tb-v2-rules-main {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

#tab-rules.tb-v2-rules-active .tb-v2-rules-subpage .tb-v2-rules-impact {
  flex-shrink: 0;
}

#tab-rules.tb-v2-rules-active .tb-v2-rules-ranking {
  flex-shrink: 0;
  padding: 0.75rem;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  margin-top: 0.75rem;
}

#tab-rules.tb-v2-rules-active .tb-v2-rules-ranking-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

#tab-rules.tb-v2-rules-active .tb-v2-rules-ranking-card {
  flex: 1 1 280px;
  min-width: 0;
  padding: 0.75rem;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

#tab-rules.tb-v2-rules-active .tb-v2-rules-ranking-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: #111827;
  margin-bottom: 0.5rem;
}

#tab-rules.tb-v2-rules-active .tb-v2-rules-ranking-empty {
  font-size: 0.75rem;
  color: #6b7280;
}

#tab-rules.tb-v2-rules-active .tb-v2-rules-ranking-table {
  display: flex;
  flex-direction: column;
}

#tab-rules.tb-v2-rules-active .tb-v2-rules-ranking-row {
  display: flex;
  align-items: center;
  padding: 0.25rem 0;
  font-size: 0.75rem;
}

#tab-rules.tb-v2-rules-active .tb-v2-rules-ranking-head {
  font-weight: 600;
  color: #6b7280;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 0.25rem;
}

#tab-rules.tb-v2-rules-active .tb-v2-rank-cell {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#tab-rules.tb-v2-rules-active .tb-v2-rank-num {
  width: 2rem;
  flex-shrink: 0;
  color: #6b7280;
}

#tab-rules.tb-v2-rules-active .tb-v2-rank-name {
  flex: 1 1 auto;
  min-width: 0;
}

#tab-rules.tb-v2-rules-active .tb-v2-rank-val {
  width: 4.5rem;
  flex-shrink: 0;
  text-align: right;
}

/* V2 等级成长审查子页 */
#tab-rules.tb-v2-rules-active .tb-v2-gr-overview {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  flex-shrink: 0;
  margin-bottom: 0.75rem;
}

#tab-rules.tb-v2-rules-active .tb-v2-gr-stat {
  flex: 1 1 100px;
  padding: 0.625rem 0.875rem;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  text-align: center;
}

#tab-rules.tb-v2-rules-active .tb-v2-gr-stat-value {
  display: block;
  font-size: 1.25rem;
  font-weight: 600;
  color: #111827;
}

#tab-rules.tb-v2-rules-active .tb-v2-gr-stat--danger .tb-v2-gr-stat-value { color: #dc2626; }
#tab-rules.tb-v2-rules-active .tb-v2-gr-stat--warning .tb-v2-gr-stat-value { color: #f59e0b; }

#tab-rules.tb-v2-rules-active .tb-v2-gr-stat-label {
  display: block;
  font-size: 0.75rem;
  color: #6b7280;
  margin-top: 0.25rem;
}

#tab-rules.tb-v2-rules-active .tb-v2-gr-mode {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  margin-bottom: 0.75rem;
}

#tab-rules.tb-v2-rules-active .tb-v2-gr-mode-btn {
  padding: 0.35rem 0.75rem;
  font-size: 0.8125rem;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #fff;
  color: #374151;
  cursor: pointer;
  white-space: nowrap;
}

#tab-rules.tb-v2-rules-active .tb-v2-gr-mode-btn--active {
  border-color: #2563eb;
  color: #2563eb;
  background: #eff6ff;
  font-weight: 600;
}

#tab-rules.tb-v2-rules-active .tb-v2-gr-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

/* ========== UI Rebuild V2: Tab 4 基础数值可视化大盘 ========== */

#tab-charts.tb-v2-charts-active .tb-v2-charts-subtab-nav {
  flex-shrink: 0;
  padding: 0;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 0.5rem;
}

#tab-charts.tb-v2-charts-active .tb-v2-charts-subtab-inner {
  display: flex;
  flex-wrap: nowrap;
  gap: 0;
}

#tab-charts.tb-v2-charts-active .tb-v2-charts-subtab-btn {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #6b7280;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s ease, border-color 0.15s ease;
}

#tab-charts.tb-v2-charts-active .tb-v2-charts-subtab-btn:hover {
  color: #111827;
}

#tab-charts.tb-v2-charts-active .tb-v2-charts-subtab-btn--active {
  color: #2563eb;
  border-bottom-color: #2563eb;
}

#tab-charts.tb-v2-charts-active .tb-v2-charts-subpage {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

/* 效率排行子页：抵消 Bootstrap .row 负边距，避免内部横向滚动条 */
#tb-v2-charts-subpage-efficiency {
  padding-left: 8px;
  padding-right: 8px;
}

#tab-charts.tb-v2-charts-active .tb-v2-charts-legacy-overview {
  margin-bottom: 0.75rem;
}
#tab-charts.tb-v2-charts-active .tb-v2-charts-legacy-title,
#tab-charts.tb-v2-charts-active .tb-v2-charts-legacy-panel {
  display: none !important;
}

#tab-charts.tb-v2-charts-legacy .tb-v2-charts-page {
  display: none !important;
}

#tab-charts.tb-v2-charts-active .tb-v2-charts-page {
  display: flex !important;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 420px;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #111827;
}

.tb-v2-charts-page .tb-v2-charts-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.tb-v2-charts-page .tb-v2-charts-title-row {
  min-width: 0;
}

.tb-v2-charts-page .tb-v2-charts-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: #111827;
}

.tb-v2-charts-page .tb-v2-charts-subtitle {
  margin: 0.25rem 0 0;
  font-size: 0.75rem;
  color: #6b7280;
}

.tb-v2-charts-page .tb-v2-charts-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.125rem;
  font-size: 0.75rem;
  color: #6b7280;
  white-space: nowrap;
}

.tb-v2-charts-page .tb-v2-charts-kpi {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.625rem;
  overflow-x: auto;
}

.tb-v2-charts-page .tb-v2-charts-kpi-card {
  flex: 1 1 0;
  min-width: 120px;
  max-width: 180px;
  padding: 0.625rem 0.875rem;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  text-align: center;
}

.tb-v2-charts-page .tb-v2-charts-kpi-label {
  font-size: 0.6875rem;
  color: #6b7280;
  margin-bottom: 0.25rem;
}

.tb-v2-charts-page .tb-v2-charts-kpi-value {
  font-size: 1rem;
  font-weight: 700;
  color: #111827;
  word-break: break-all;
}

.tb-v2-charts-page .tb-v2-charts-kpi-name {
  font-size: 0.6875rem;
  color: #2563eb;
  margin-top: 0.25rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tb-v2-charts-page .tb-v2-charts-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.tb-v2-charts-page .tb-v2-charts-section + .tb-v2-charts-section {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #e5e7eb;
}

.tb-v2-charts-page .tb-v2-charts-section-header {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.tb-v2-charts-page .tb-v2-charts-section-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: #111827;
}

.tb-v2-charts-page .tb-v2-charts-section-desc {
  margin: 0;
  font-size: 0.75rem;
  color: #6b7280;
}

.tb-v2-charts-page .tb-v2-charts-metric-analysis {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 0.75rem;
  gap: 0.75rem;
}

/* 总览：左侧独立筛选栏 + 右侧内容区 */
.tb-v2-charts-page .tb-v2-charts-overview-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.tb-v2-charts-page .tb-v2-charts-overview-sidebar {
  position: sticky;
  top: 0.75rem;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.tb-v2-charts-page .tb-v2-charts-overview-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.tb-v2-charts-page .tb-v2-charts-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tb-v2-charts-page .tb-v2-charts-sidebar-title {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: #111827;
}

.tb-v2-charts-page .tb-v2-charts-sidebar-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.tb-v2-charts-page .tb-v2-charts-sidebar-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: #374151;
}

.tb-v2-charts-overview-sidebar .tb-v2-charts-level-filter {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.375rem;
}

.tb-v2-charts-overview-sidebar .tb-v2-charts-level-btn {
  width: 100%;
  text-align: center;
}

.tb-v2-charts-overview-sidebar .tb-v2-charts-select,
.tb-v2-charts-overview-sidebar .tb-v2-charts-input {
  width: 100%;
  box-sizing: border-box;
}

.tb-v2-charts-page .tb-v2-charts-sidebar-summary {
  font-size: 0.75rem;
  color: #374151;
  padding: 0.5rem;
  background: #f9fafb;
  border-radius: 6px;
}

.tb-v2-charts-page .tb-v2-charts-summary-count {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.tb-v2-charts-page .tb-v2-charts-summary-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.tb-v2-charts-page .tb-v2-charts-summary-tag {
  display: inline-block;
  padding: 0.125rem 0.375rem;
  background: #e5e7eb;
  border-radius: 4px;
  color: #374151;
  font-size: 0.6875rem;
}

.tb-v2-charts-page .tb-v2-charts-ranking-notes {
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.tb-v2-charts-page .tb-v2-charts-ranking-note {
  font-size: 0.6875rem;
  color: #6b7280;
  padding: 0.25rem 0.375rem;
  background: #fff;
  border-left: 2px solid #d1d5db;
  border-radius: 0 4px 4px 0;
}

.tb-v2-charts-page .tb-v2-charts-reset-btn {
  width: 100%;
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
  color: #374151;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tb-v2-charts-page .tb-v2-charts-reset-btn:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
}

.tb-v2-charts-page .tb-v2-charts-toolbar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.tb-v2-charts-page .tb-v2-charts-level-filter {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.tb-v2-charts-page .tb-v2-charts-level-btn {
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  line-height: 1.4;
  color: #374151;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tb-v2-charts-page .tb-v2-charts-level-btn:hover {
  border-color: #9ca3af;
}

.tb-v2-charts-page .tb-v2-charts-level-btn.tb-v2-charts-level-btn--active {
  color: #fff;
  background: #2563eb;
  border-color: #2563eb;
}

.tb-v2-charts-page .tb-v2-charts-metric-filter {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  color: #374151;
}

.tb-v2-charts-page .tb-v2-charts-select,
.tb-v2-charts-page .tb-v2-charts-input {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  color: #111827;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 6px;
}

.tb-v2-charts-page .tb-v2-charts-input {
  width: 160px;
}

.tb-v2-charts-page .tb-v2-charts-main {
  display: flex;
  flex: 1 1 0;
  min-height: 320px;
  gap: 0.75rem;
}

.tb-v2-charts-page .tb-v2-charts-primary {
  flex: 1.2 1 0;
  min-width: 0;
  min-height: 0;
}

.tb-v2-charts-page .tb-v2-charts-secondary {
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
}

.tb-v2-charts-page .tb-v2-charts-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
}

.tb-v2-charts-page .tb-v2-charts-card-header {
  flex: 0 0 auto;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #f3f4f6;
}

.tb-v2-charts-page .tb-v2-charts-card-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #111827;
}

.tb-v2-charts-page .tb-v2-charts-card-body {
  flex: 1 1 0;
  min-height: 0;
  padding: 0.5rem;
  position: relative;
}

.tb-v2-charts-page .tb-v2-charts-canvas-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.tb-v2-charts-page .tb-v2-charts-canvas-wrap canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.tb-v2-charts-page .tb-v2-charts-detail {
  flex: 0 0 auto;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.tb-v2-charts-page .tb-v2-charts-detail table {
  width: 100%;
  table-layout: fixed;
  min-width: 0;
  border-collapse: collapse;
  font-size: 0.75rem;
}

/* 修复 legacy overview 中 Bootstrap row 负边距导致子页横向溢出 */
.tb-v2-charts-page .charts-summary-cards {
  box-sizing: border-box;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}
.tb-v2-charts-page #tb-v2-charts-legacy-overview > .row {
  margin-left: 0;
  margin-right: 0;
}

.tb-v2-charts-page .tb-v2-charts-detail th,
.tb-v2-charts-page .tb-v2-charts-detail td {
  padding: 0.375rem 0.625rem;
  text-align: left;
  border-bottom: 1px solid #f3f4f6;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tb-v2-charts-page .tb-v2-charts-detail th {
  font-weight: 600;
  color: #6b7280;
  background: #f9fafb;
  position: sticky;
  top: 0;
}

.tb-v2-charts-page .tb-v2-charts-detail tr:hover {
  background: #f9fafb;
  cursor: pointer;
}

.tb-v2-charts-page .tb-v2-charts-detail-empty {
  padding: 1rem;
  text-align: center;
  font-size: 0.75rem;
  color: #6b7280;
}

.tb-v2-charts-page .tb-v2-charts-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #6b7280;
  font-size: 0.875rem;
  text-align: center;
  padding: 1rem;
}

.tb-v2-charts-page .tb-v2-charts-empty-title {
  font-size: 1rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 0.25rem;
}

@media (max-width: 1100px) {
  .tb-v2-charts-page .tb-v2-charts-overview-layout {
    grid-template-columns: 1fr;
  }
  .tb-v2-charts-page .tb-v2-charts-overview-sidebar {
    position: static;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
  }
  .tb-v2-charts-page .tb-v2-charts-overview-sidebar > * {
    min-width: 0;
  }
  .tb-v2-charts-overview-sidebar .tb-v2-charts-level-filter {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 1200px) {
  .tb-v2-charts-page .tb-v2-charts-main {
    flex-direction: column;
  }
  .tb-v2-charts-page .tb-v2-charts-toolbar {
    flex-wrap: wrap;
  }
}

@media (max-width: 768px) {
  .tb-v2-charts-page .tb-v2-charts-header {
    flex-wrap: wrap;
  }
  .tb-v2-charts-page .tb-v2-charts-meta {
    align-items: flex-start;
  }
}

/* ========== UI Rebuild V2: Tab 5 范围 / 接敌 ========== */
#tab-range.tb-v2-range-active .tb-v2-range-legacy-title,
#tab-range.tb-v2-range-active .tb-v2-range-legacy-panel {
  display: none !important;
}

#tab-range.tb-v2-range-legacy .tb-v2-range-page {
  display: none !important;
}

#tab-range.tb-v2-range-active .tb-v2-range-page {
  display: flex !important;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 420px;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #111827;
}

.tb-v2-range-page .tb-v2-range-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.tb-v2-range-page .tb-v2-range-title-row {
  min-width: 0;
}

.tb-v2-range-page .tb-v2-range-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: #111827;
}

.tb-v2-range-page .tb-v2-range-subtitle {
  margin: 0.25rem 0 0;
  font-size: 0.75rem;
  color: #6b7280;
}

.tb-v2-range-page .tb-v2-range-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.125rem;
  font-size: 0.75rem;
  color: #6b7280;
  white-space: nowrap;
}

.tb-v2-range-page .tb-v2-range-kpi {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.625rem;
  overflow-x: auto;
}

.tb-v2-range-page .tb-v2-range-kpi-card {
  flex: 1 1 0;
  min-width: 120px;
  max-width: 180px;
  padding: 0.625rem 0.875rem;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  text-align: center;
}

.tb-v2-range-page .tb-v2-range-kpi-label {
  font-size: 0.6875rem;
  color: #6b7280;
  margin-bottom: 0.25rem;
}

.tb-v2-range-page .tb-v2-range-kpi-value {
  font-size: 1rem;
  font-weight: 700;
  color: #111827;
  word-break: break-all;
}

.tb-v2-range-page .tb-v2-range-kpi-name {
  font-size: 0.6875rem;
  color: #2563eb;
  margin-top: 0.25rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tb-v2-range-page .tb-v2-range-toolbar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.75rem;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.tb-v2-range-page .tb-v2-range-level-filter {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.tb-v2-range-page .tb-v2-range-level-btn {
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  line-height: 1.4;
  color: #374151;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tb-v2-range-page .tb-v2-range-level-btn:hover {
  border-color: #9ca3af;
}

.tb-v2-range-page .tb-v2-range-level-btn.tb-v2-range-level-btn--active {
  color: #fff;
  background: #2563eb;
  border-color: #2563eb;
}

.tb-v2-range-page .tb-v2-range-type-filter {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  color: #374151;
}

.tb-v2-range-page .tb-v2-range-select,
.tb-v2-range-page .tb-v2-range-input {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  color: #111827;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 6px;
}

.tb-v2-range-page .tb-v2-range-input {
  width: 160px;
}

.tb-v2-range-page .tb-v2-range-main {
  display: flex;
  flex: 1 1 0;
  min-height: 0;
  gap: 0.75rem;
}

.tb-v2-range-page .tb-v2-range-primary {
  flex: 1 1 0;
  min-width: 0;
}

.tb-v2-range-page .tb-v2-range-secondary {
  flex: 1.2 1 0;
  min-width: 0;
}

.tb-v2-range-page .tb-v2-range-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
}

.tb-v2-range-page .tb-v2-range-card-header {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #f3f4f6;
}

.tb-v2-range-page .tb-v2-range-card-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #111827;
}

.tb-v2-range-page .tb-v2-range-card-body {
  flex: 1 1 0;
  min-height: 0;
  padding: 0.5rem;
  position: relative;
}

.tb-v2-range-page .tb-v2-range-svg-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
}

.tb-v2-range-page .tb-v2-range-svg-wrap svg {
  width: 100%;
  height: 100%;
  max-width: 480px;
  max-height: 480px;
}

.tb-v2-range-page .tb-v2-range-canvas-wrap {
  position: relative;
  width: 100%;
  height: 100%;
}

.tb-v2-range-page .tb-v2-range-canvas-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}

.tb-v2-range-page .tb-v2-range-detail {
  flex: 0 0 auto;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.tb-v2-range-page .tb-v2-range-detail table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
}

.tb-v2-range-page .tb-v2-range-detail th,
.tb-v2-range-page .tb-v2-range-detail td {
  padding: 0.375rem 0.625rem;
  text-align: left;
  border-bottom: 1px solid #f3f4f6;
}

.tb-v2-range-page .tb-v2-range-detail th {
  font-weight: 600;
  color: #6b7280;
  background: #f9fafb;
  position: sticky;
  top: 0;
}

.tb-v2-range-page .tb-v2-range-detail tr:hover {
  background: #f9fafb;
  cursor: pointer;
}

.tb-v2-range-page .tb-v2-range-detail-empty {
  padding: 1rem;
  text-align: center;
  font-size: 0.75rem;
  color: #6b7280;
}

.tb-v2-range-page .tb-v2-range-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #6b7280;
  font-size: 0.875rem;
  text-align: center;
  padding: 1rem;
}

.tb-v2-range-page .tb-v2-range-empty-title {
  font-size: 1rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 0.25rem;
}

.tb-v2-range-page .tb-v2-range-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: center;
  font-size: 0.75rem;
  color: #6b7280;
  margin-top: 0.25rem;
}

.tb-v2-range-page .tb-v2-range-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.tb-v2-range-page .tb-v2-range-legend-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 2px;
}

.tb-v2-range-page .tb-v2-range-legend-swatch.dashed {
  background: transparent !important;
  border: 1px dashed currentColor;
}

@media (max-width: 1200px) {
  .tb-v2-range-page .tb-v2-range-main {
    flex-direction: column;
  }
  .tb-v2-range-page .tb-v2-range-toolbar {
    flex-wrap: wrap;
  }
}

@media (max-width: 768px) {
  .tb-v2-range-page .tb-v2-range-header {
    flex-wrap: wrap;
  }
  .tb-v2-range-page .tb-v2-range-meta {
    align-items: flex-start;
  }
}

/* V2 范围 / 接敌页：子页 1 范围圆内完整显示 range-view.js 控件 */

#tab-range.tb-v2-range-active .tb-v2-range-page .range-body {
  flex-wrap: nowrap !important;
  height: 100%;
}

#tab-range.tb-v2-range-active .tb-v2-range-page .range-body--two-col .range-left-col {
  flex: 1 1 100% !important;
  min-width: 0;
  height: 100%;
}

#tab-range.tb-v2-range-active .tb-v2-range-page .range-svg-wrap {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
}

#tab-range.tb-v2-range-active .tb-v2-range-page .range-svg {
  height: 100%;
}

/* ========== UI Rebuild V2: Tab 5 三子页导航 ========== */

#tab-range.tb-v2-range-active .tb-v2-range-subtab-nav {
  flex-shrink: 0;
  padding: 0;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 0.5rem;
}

#tab-range.tb-v2-range-active .tb-v2-range-subtab-inner {
  display: flex;
  flex-wrap: nowrap;
  gap: 0;
}

#tab-range.tb-v2-range-active .tb-v2-range-subtab-btn {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #6b7280;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s ease, border-color 0.15s ease;
}

#tab-range.tb-v2-range-active .tb-v2-range-subtab-btn:hover {
  color: #111827;
}

#tab-range.tb-v2-range-active .tb-v2-range-subtab-btn--active {
  color: #2563eb;
  border-bottom-color: #2563eb;
}

#tab-range.tb-v2-range-active .tb-v2-range-subpage {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

#tab-range.tb-v2-range-active #tb-v2-range-content {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

#tab-range.tb-v2-range-active .tb-v2-range-subpage > #tb-v2-range-svg-container {
  min-height: 0;
}

#tab-range.tb-v2-range-active .tb-v2-range-subpage .tb-v2-range-main {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

#tab-range.tb-v2-range-active .tb-v2-range-subpage .tb-v2-range-detail {
  flex-shrink: 0;
}

/* ========== Phase B: Tab 2 修改对比/表格 ========== */
#change-review-panel:empty {
  display: none;
}
.placeable-table-wrapper {
  overflow-x: auto;
  max-width: 100%;
}
#placeable-table .tabulator-header {
  position: sticky;
  top: 0;
  z-index: 10;
}

/* ========== v0.7 Tab 3 基础数值可视化大盘 ========== */
.charts-section-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: #374151;
  margin: 0.5rem 0 0.25rem 0;
  padding-bottom: 0.25rem;
  border-bottom: 2px solid #206bc4;
}
.charts-summary-cards .summary-card {
  min-width: 0;
  width: 100%;
}
.summary-value-num {
  font-size: 1.15rem;
  font-weight: 700;
  color: #206bc4;
  font-variant-numeric: tabular-nums;
}
.summary-name {
  font-size: 0.78rem;
  color: var(--tb-muted);
  margin-top: 0.15rem;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-title-main {
  color: inherit;
}
.chart-title-meaning {
  color: #f59e0b;
  font-size: 0.9em;
  font-weight: 600;
  margin-left: 0.3em;
}
.chart-axis-explanation {
  margin-top: 3px;
  color: #64748b;
  font-size: 0.8rem;
  font-weight: 400;
}
.unit-level-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 22px;
  padding: 0 8px;
  margin-left: 6px;
  border: 1px solid #b9d3f3;
  border-radius: 999px;
  background: #eef6ff;
  color: #1769c2;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  vertical-align: middle;
}

/* ========== v0.7.1 Tab 3 子页/等级筛选/重点单位卡/折叠区 ========== */

/* 子页导航 */
.charts-subtab-nav {
  display: inline-flex;
  gap: 0.25rem;
  padding: 0.25rem;
  background: #f8fafc;
  border: 1px solid var(--tb-border);
  border-radius: 6px;
}
.charts-subtab-btn {
  padding: 0.3rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 500;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: #6b7280;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.charts-subtab-btn:hover {
  background: #eef2f7;
  color: #206bc4;
}
.charts-subtab-btn.active {
  background: #206bc4;
  color: #fff;
  border-color: #206bc4;
}

/* 等级筛选 */
.charts-level-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
  padding: 0.5rem 0.75rem;
  background: #fafbfc;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
}
.charts-level-label {
  font-weight: 600;
  color: #374151;
  margin-right: 0.25rem;
}
.charts-level-btn.active {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
}

/* 重点单位卡 */
.focus-unit-card {
  border-left: 3px solid #2fb344;
  height: 100%;
}
.focus-unit-name {
  font-size: 1rem;
  font-weight: 700;
  color: #206bc4;
  margin-bottom: 0.5rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid #e5e7eb;
}
.focus-unit-stats {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.focus-unit-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  padding: 0.1rem 0;
}
.focus-unit-stat-label {
  color: var(--tb-muted);
  flex: 0 0 auto;
}
.focus-unit-stat-value {
  font-weight: 600;
  color: #374151;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* Phase D: Tab4 图表卡片统一结构 */
.chart-card {
  height: 100%;
}
.chart-card .card-body {
  position: relative;
  min-height: 320px;
}
.chart-card .chart-box {
  height: 100%;
  min-height: 320px;
}

/* 效率排行卡片高度统一 */
.efficiency-chart-card .card-body {
  min-height: 340px;
}

/* 等级成长图表卡片 */
.growth-chart-card .card-header,
.growth-secondary-chart-card .card-header {
  padding: 0.35rem 0.75rem;
}
.growth-chart-card .card-body,
.growth-chart-card .chart-box,
.growth-secondary-chart-card .card-body,
.growth-secondary-chart-card .chart-box {
  min-height: 180px;
}
@media (min-width: 1920px) {
  .growth-chart-card .card-body,
  .growth-chart-card .chart-box,
  .growth-secondary-chart-card .card-body,
  .growth-secondary-chart-card .chart-box {
    min-height: 220px;
  }
}

/* 等级成长折叠区 */
.charts-growth-details {
  background: #fafbfc;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
}
.charts-growth-details > summary {
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.charts-growth-details > summary::-webkit-details-marker {
  display: none;
}
.charts-growth-details > summary::before {
  content: '▶ ';
  font-size: 0.7rem;
  color: var(--tb-muted);
  transition: transform 0.15s;
  display: inline-block;
}
.charts-growth-details[open] > summary::before {
  content: '▼ ';
}
.charts-growth-details[open] > summary {
  margin-bottom: 0.5rem;
}

/* 主图大尺寸容器 */
.chart-box-lg {
  height: 420px;
}

/* ========== v0.8 Tab 5 范围/接敌子页 ========== */

/* Tab 5 子页切换导航（浅色，与外层一致） */
.range-subtab-nav {
  display: inline-flex;
  gap: 0.25rem;
  padding: 0.25rem;
  background: #f8fafc;
  border: 1px solid var(--tb-border);
  border-radius: 6px;
}
.range-subtab-btn {
  padding: 0.3rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 500;
  border: 1px solid #d8e0ea;
  border-radius: 4px;
  background: #fff;
  color: #475569;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.range-subtab-btn:hover {
  background: #f8fafc;
  color: #1769c2;
  border-color: #2f80d1;
}
.range-subtab-btn.active {
  background: #fff;
  color: #1769c2;
  border-color: #2f80d1;
  box-shadow: 0 1px 3px rgba(47, 128, 209, 0.16);
  font-weight: 600;
}

/* 接敌推演：浅色卡片风格，与全站一致 */
.engagement-simulation {
  background: transparent;
  color: #374151;
  padding: 16px;
  border-radius: 8px;
  border: none;
  font-size: 0.85rem;
}

/* 顶部标题区 */
.engagement-header {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 16px;
}
.engagement-title-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}
.engagement-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 4px;
}
.engagement-subtitle {
  font-size: 0.8rem;
  color: #6b7280;
  max-width: 520px;
}
.engagement-formula {
  background: #f0f4f8;
  border: 1px solid #d1d9e6;
  border-radius: 6px;
  padding: 10px 12px;
  max-width: 520px;
  font-size: 0.8rem;
  color: #475569;
  line-height: 1.5;
}
.engagement-formula-muted {
  color: #6b7280;
  margin-top: 4px;
}
.engagement-disclaimer {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  background: #fef9ee;
  border: 1px solid #f5e6b8;
  border-radius: 6px;
  padding: 8px 12px;
  margin-bottom: 12px;
  font-size: 0.78rem;
  color: #92400e;
  line-height: 1.45;
}
.engagement-disclaimer-icon {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #f59f00;
  color: #fff;
  font-weight: 700;
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* 参数栏：横向紧凑工具栏 */
.engagement-params {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: flex-end;
  padding: 0.5rem 0.75rem;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
}
.engagement-param-group {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
}
.engagement-param-group-level,
.engagement-param-group-action {
  align-items: center;
}
.engagement-param-label {
  font-size: 0.72rem;
  color: #475569;
  font-weight: 500;
  white-space: nowrap;
}
.engagement-param-input {
  width: 78px;
  background: #fff;
  border: 1px solid #d1d5db;
  color: #1e293b;
  font-size: 0.82rem;
  padding: 0.2rem 0.4rem;
  height: calc(1.5em + 0.5rem + 2px);
  border-radius: 4px;
}
.engagement-param-input:focus {
  background: #fff;
  border-color: #2563eb;
  color: #1e293b;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}
.engagement-level-btn-group {
  display: inline-flex;
  gap: 0.15rem;
}
.engagement-level-btn {
  padding: 0.25rem 0.55rem;
  font-size: 0.78rem;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  background: #fff;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s;
}
.engagement-level-btn:hover {
  border-color: #2563eb;
  color: #1e40af;
}
.engagement-level-btn.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}

/* B2/B3 推演等级局部参数栏 */
.engagement-simulation-controls {
  margin: 0 0 12px 0;
}
.engagement-simulation-controls__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  padding: 0.5rem 0.75rem;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
}
.engagement-simulation-controls__label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #1e293b;
  white-space: nowrap;
}
.engagement-simulation-controls__levels {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.15rem;
}
.engagement-simulation-controls__hint {
  font-size: 0.78rem;
  color: #64748b;
  white-space: nowrap;
}
@media (max-width: 768px) {
  .engagement-simulation-controls__hint {
    white-space: normal;
    width: 100%;
  }
}

/* Section 垂直堆叠 */
.engagement-section {
  margin-bottom: 16px;
}
.engagement-section:last-child {
  margin-bottom: 0;
}

/* F-016: 接敌推演顶部快速导航 */
.engagement-quick-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}
.engagement-quick-nav-label {
  font-size: 0.85rem;
  color: #475569;
  margin-right: 4px;
}
.engagement-quick-nav-btn {
  white-space: nowrap;
}
.engagement-quick-nav-btn:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

/* F-016: B2 → B3 引导按钮 */
.engagement-b2-to-b3 {
  display: flex;
  justify-content: flex-start;
  margin-top: 12px;
}

/* B1 区块：矩阵居中，限制最大宽度，避免无限拉伸 */
.engagement-b1-section .engagement-matrix-panel {
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
}

/* B2 区块：左侧矩阵 2fr + 右侧辅助栏 1fr */
.engagement-b2-container {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  gap: 12px;
  align-items: start;
}
.engagement-b2-main {
  min-width: 0;
}
.engagement-b2-sidebar {
  min-width: 0;
  margin-top: 0;
}

/* 复用旧类名 */
.engagement-main {
  min-width: 0;
}

/* 摘要区域：右侧单列 */
.engagement-summary-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  margin-top: 0;
}
.engagement-summary-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 14px;
  min-width: 0;
}
.engagement-notes-card {
  grid-column: auto;
}
.engagement-summary-card .engagement-notes {
  grid-template-columns: 1fr;
  gap: 8px;
}

/* 响应式：1280 及以下 B2 单列堆叠 */
@media (max-width: 1280px) {
  .engagement-b2-container {
    grid-template-columns: 1fr;
  }
}

/* 矩阵面板 */
.engagement-matrix-panel {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 14px;
}
.engagement-matrix-title,
.engagement-side-title {
  font-size: 1rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 4px;
}
.engagement-matrix-subtitle,
.engagement-side-subtitle {
  font-size: 0.75rem;
  color: #6b7280;
  margin-bottom: 12px;
  line-height: 1.45;
}

/* 矩阵滚动容器 */
.engagement-matrix-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  padding-bottom: 4px;
  margin-bottom: 12px;
}
.engagement-matrix-table {
  width: max-content;
  margin-left: auto;
  margin-right: auto;
  border-collapse: separate;
  border-spacing: 5px;
  font-size: 0.72rem;
  table-layout: fixed;
}
.engagement-corner {
  width: 90px;
  min-width: 90px;
  background: #f8fafc;
  position: sticky;
  left: 0;
  top: 0;
  z-index: 4;
  border: none;
}
.engagement-col-header {
  width: 88px;
  min-width: 88px;
  height: 108px;
  position: sticky;
  top: 0;
  z-index: 3;
  background: #f8fafc;
  vertical-align: bottom;
  padding: 0 0 10px 0;
  border: none;
}
.engagement-col-header-text {
  display: inline-block;
  white-space: nowrap;
  color: #475569;
  font-size: 0.74rem;
  font-weight: 500;
  padding-left: 8px;
  padding-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 130px;
}
.engagement-row-header {
  width: 92px;
  min-width: 92px;
  position: sticky;
  left: 0;
  z-index: 2;
  background: #f8fafc;
  text-align: left;
  padding: 0 10px;
  border: none;
}
.engagement-row-header-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #475569;
  font-size: 0.8rem;
  font-weight: 500;
}
.engagement-cell {
  width: 88px;
  min-width: 88px;
  height: 86px;
  border-radius: 6px;
  padding: 6px 4px;
  text-align: center;
  vertical-align: middle;
  color: inherit;
  line-height: 1.3;
  position: relative;
  overflow: hidden;
}
.engagement-cell-diagonal::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 2px dashed rgba(0, 0, 0, 0.15);
  border-radius: 6px;
  pointer-events: none;
}
.engagement-cell-status {
  font-size: 0.82rem;
  font-weight: 800;
  margin-bottom: 3px;
  letter-spacing: 0.02em;
}
.engagement-cell-delta {
  font-size: 0.72rem;
  color: inherit;
  font-variant-numeric: tabular-nums;
  margin-bottom: 1px;
}
.engagement-cell-free-damage {
  font-size: 0.74rem;
  font-weight: 700;
  color: inherit;
  font-variant-numeric: tabular-nums;
  margin-bottom: 1px;
}
.engagement-cell-times {
  font-size: 0.68rem;
  color: inherit;
  font-variant-numeric: tabular-nums;
}

/* 图例 */
.engagement-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: center;
  font-size: 0.75rem;
  color: #475569;
}
.engagement-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.engagement-legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
}
.engagement-legend-note {
  color: #6b7280;
  font-size: 0.72rem;
}

/* 摘要卡排行条 */
.engagement-rank-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.engagement-rank-row {
  display: grid;
  grid-template-columns: 130px minmax(100px, 1fr) 70px;
  gap: 8px;
  align-items: center;
  font-size: 0.78rem;
}
.engagement-rank-label {
  color: #374151;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}
.engagement-rank-bar-wrap {
  position: relative;
  height: 14px;
  background: #e5e7eb;
  border-radius: 3px;
  overflow: hidden;
}
.engagement-rank-bar-wrap-zero {
  overflow: visible;
}
.engagement-rank-zero-line {
  position: absolute;
  left: 50%;
  top: -2px;
  bottom: -2px;
  width: 1px;
  background: rgba(0, 0, 0, 0.2);
  z-index: 2;
  pointer-events: none;
}
.engagement-rank-bar {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: 3px;
  transition: width 0.2s ease;
  z-index: 1;
}
.engagement-rank-bar-positive {
  background: #60a5fa;
}
.engagement-rank-bar-negative {
  background: #fb923c;
}
.engagement-rank-bar-purple {
  background: #c084fc;
}
.engagement-rank-value {
  color: #374151;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.engagement-rank-axis-label {
  text-align: center;
  font-size: 0.72rem;
  color: #6b7280;
  margin-top: 8px;
  letter-spacing: 0.05em;
}

/* 说明卡片 */
.engagement-notes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 16px;
}
@media (max-width: 900px) {
  .engagement-notes {
    grid-template-columns: 1fr;
  }
}
.engagement-note-item {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 0.78rem;
  color: #374151;
  line-height: 1.45;
}
.engagement-note-num {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #475569;
  font-size: 0.7rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}

/* Phase E: 接敌推演说明折叠区 */
.engagement-notes-details {
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #f8fafc;
}
.engagement-notes-summary {
  padding: 8px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #374151;
  cursor: pointer;
  list-style: none;
}
.engagement-notes-summary::-webkit-details-marker {
  display: none;
}
.engagement-notes-content {
  padding: 10px 12px;
  border-top: 1px solid #e5e7eb;
}

/* 空状态在深色主题下的调整 */
.engagement-simulation .empty-state {
  background: #f9fafb;
  border-color: #e5e7eb;
  color: #6b7280;
}
.engagement-simulation .alert-danger {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #991b1b;
}

/* ========== B3 轻量 1v1 结算面板 ========== */
.engagement-b3-panel {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 14px;
  margin-top: 10px;
}
.engagement-b3-title {
  font-size: 1rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 4px;
}
.engagement-b3-subtitle {
  font-size: 0.78rem;
  color: #6b7280;
  margin-bottom: 10px;
}
.engagement-b3-prompt {
  font-size: 0.82rem;
  color: #6b7280;
  padding: 8px 0;
}
.engagement-b3-result-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 0.85rem;
}
.engagement-b3-side {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.engagement-b3-side-label {
  font-size: 0.7rem;
  color: #6b7280;
}
.engagement-b3-side-name {
  font-weight: 600;
  color: #1e293b;
}
.engagement-b3-vs {
  font-size: 0.8rem;
  color: #94a3b8;
  font-weight: 600;
}
.engagement-b3-status {
  font-size: 0.95rem;
  font-weight: 700;
  color: #1e40af;
  padding: 6px 0;
  margin-bottom: 8px;
  border-bottom: 1px solid #f1f5f9;
}
.engagement-b3-table {
  width: 100%;
  font-size: 0.82rem;
}
.engagement-b3-warnings {
  margin-top: 8px;
  font-size: 0.75rem;
  color: #dc2626;
}
.engagement-b3-disclaimer {
  margin-top: 10px;
  padding: 8px 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 0.72rem;
  color: #475569;
  line-height: 1.45;
}

/* ========== RF-04: 短窗压制指数与 B3 并列展示 ========== */
.engagement-pressure-b3-comparison,
.engagement-pressure-b3-empty {
  margin-top: 10px;
  padding: 8px;
  border-radius: 6px;
  background: #f9fafb;
}
.engagement-pressure-b3-comparison {
  border: 1px solid #e5e7eb;
}
.engagement-pressure-b3-empty {
  border: 1px dashed #d1d5db;
}
.engagement-pressure-b3-divergence {
  margin-top: 6px;
  padding: 6px;
  border-radius: 4px;
  background: #fff7ed;
  color: #9a3412;
  font-size: 0.72rem;
  line-height: 1.45;
}

/* ========== v0.9 两两接触矩阵（与接敌推演矩阵共享结构） ========== */

/* 公共矩阵结构：通过分组选择器统一尺寸、sticky、标题等 */
.engagement-corner,
.contact-matrix-corner {
  width: 90px;
  min-width: 90px;
  background: #f8fafc;
  position: sticky;
  left: 0;
  top: 0;
  z-index: 4;
  border: none;
}
.engagement-col-header,
.contact-matrix-col-header {
  width: 88px;
  min-width: 88px;
  height: 108px;
  position: sticky;
  top: 0;
  z-index: 3;
  background: #f8fafc;
  vertical-align: bottom;
  padding: 0 0 10px 0;
  border: none;
}
.engagement-col-header-text,
.contact-matrix-col-header-text {
  display: inline-block;
  white-space: nowrap;
  color: #475569;
  font-size: 0.74rem;
  font-weight: 500;
  padding-left: 8px;
  padding-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 88px;
}
.engagement-row-header,
.contact-matrix-row-header {
  width: 92px;
  min-width: 92px;
  position: sticky;
  left: 0;
  z-index: 2;
  background: #f8fafc;
  text-align: left;
  padding: 0 10px;
  border: none;
}
.engagement-row-header-text,
.contact-matrix-row-header-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #475569;
  font-size: 0.8rem;
  font-weight: 500;
}
.engagement-cell,
.contact-matrix-cell {
  width: 88px;
  min-width: 88px;
  height: 86px;
  border-radius: 6px;
  padding: 6px 4px;
  text-align: center;
  vertical-align: middle;
  color: inherit;
  line-height: 1.35;
  position: relative;
  overflow: hidden;
}
.engagement-cell-status,
.contact-matrix-cell-status {
  font-size: 0.84rem;
  font-weight: 800;
  margin-bottom: 3px;
  letter-spacing: 0.02em;
}
.engagement-cell-delta,
.engagement-cell-free-damage,
.engagement-cell-times,
.contact-matrix-cell-line {
  font-size: 0.72rem;
  color: inherit;
  font-variant-numeric: tabular-nums;
  margin-bottom: 1px;
}
.engagement-legend,
.contact-matrix-legend,
.contact-matrix-legend-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: center;
  font-size: 0.75rem;
  color: #475569;
}
.engagement-legend-item,
.contact-matrix-legend-item,
.contact-matrix-legend-inline .contact-matrix-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.engagement-legend-swatch,
.contact-matrix-legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
}
.engagement-legend-note,
.contact-matrix-legend-note {
  color: #6b7280;
  font-size: 0.72rem;
}

.contact-matrix-root {
  background: transparent;
  color: #374151;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 16px;
  font-size: 0.85rem;
}

/* 头部 */
.contact-matrix-header {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 16px;
}
.contact-matrix-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 4px;
}
.contact-matrix-subtitle {
  font-size: 0.8rem;
  color: #6b7280;
  max-width: 720px;
  line-height: 1.5;
}

/* 控件栏 */
.contact-matrix-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  padding: 0.5rem 0.75rem;
  margin-top: 12px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
}
.contact-matrix-control-group {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
}
.contact-matrix-control-label {
  font-size: 0.74rem;
  color: #475569;
  font-weight: 500;
  white-space: nowrap;
}
.contact-matrix-level-group {
  display: inline-flex;
  gap: 0.15rem;
}
.contact-matrix-level-btn {
  padding: 0.25rem 0.55rem;
  font-size: 0.78rem;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  background: #fff;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s;
}
.contact-matrix-level-btn:hover {
  border-color: #2563eb;
  color: #1e40af;
}
.contact-matrix-level-btn.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}

/* 内联图例 */
.contact-matrix-legend-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: center;
  margin-top: 12px;
  font-size: 0.74rem;
  color: #475569;
}

/* 矩阵面板 */
.contact-matrix-panel {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 14px;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}
@media (min-width: 1800px) {
  .contact-matrix-panel {
    max-width: 1400px;
  }
}
.contact-matrix-panel-title {
  font-size: 1rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 4px;
}
.contact-matrix-panel-subtitle {
  font-size: 0.75rem;
  color: #6b7280;
  margin-bottom: 12px;
  line-height: 1.45;
}

/* 滚动容器 */
.contact-matrix-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  padding-bottom: 4px;
  margin-bottom: 12px;
}
.contact-matrix-table {
  width: max-content;
  margin-left: auto;
  margin-right: auto;
  border-collapse: separate;
  border-spacing: 5px;
  font-size: 0.72rem;
  table-layout: fixed;
}

/* 表头 */
.contact-matrix-corner {
  width: 90px;
  min-width: 90px;
  background: #f8fafc;
  position: sticky;
  left: 0;
  top: 0;
  z-index: 4;
  border: none;
}
.contact-matrix-col-header {
  width: 88px;
  min-width: 88px;
  height: 108px;
  position: sticky;
  top: 0;
  z-index: 3;
  background: #f8fafc;
  vertical-align: bottom;
  padding: 0 0 10px 0;
  border: none;
}
.contact-matrix-col-header-text {
  display: inline-block;
  white-space: nowrap;
  color: #475569;
  font-size: 0.74rem;
  font-weight: 500;
  padding-left: 8px;
  padding-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 130px;
}
.contact-matrix-row-header {
  width: 92px;
  min-width: 92px;
  position: sticky;
  left: 0;
  z-index: 2;
  background: #f8fafc;
  text-align: left;
  padding: 0 10px;
  border: none;
}
.contact-matrix-row-header-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #475569;
  font-size: 0.8rem;
  font-weight: 500;
}

/* 单元格 */
.contact-matrix-cell {
  width: 88px;
  min-width: 88px;
  height: 86px;
  border-radius: 6px;
  padding: 6px 4px;
  text-align: center;
  vertical-align: middle;
  color: inherit;
  line-height: 1.35;
  position: relative;
  overflow: hidden;
}
.contact-matrix-cell-status {
  font-size: 0.86rem;
  font-weight: 800;
  margin-bottom: 3px;
  letter-spacing: 0.02em;
}
.contact-matrix-cell-line {
  font-size: 0.72rem;
  color: inherit;
  font-variant-numeric: tabular-nums;
  margin-bottom: 1px;
}

/* 图例 */
.contact-matrix-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: center;
  font-size: 0.75rem;
  color: #475569;
}
.contact-matrix-legend-inline .contact-matrix-legend-item,
.contact-matrix-legend .contact-matrix-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.contact-matrix-legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
}
.contact-matrix-legend-note {
  color: #6b7280;
  font-size: 0.72rem;
}

/* 空状态与提示 */
.contact-matrix-root .empty-state {
  background: #f9fafb;
  border-color: #e5e7eb;
  color: #6b7280;
}
.contact-matrix-root .alert-danger {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #991b1b;
}

/* ========== v1.0 修改前后对比 ========== */
.change-review-root {
  background: #fff;
  border: 1px solid var(--tb-border);
  border-radius: 6px;
  padding: 0.75rem 1rem;
}
.change-review-title {
  font-size: 1rem;
  font-weight: 600;
  color: #374151;
  margin: 0 0 0.5rem 0;
  padding-bottom: 0.35rem;
  border-bottom: 2px solid #206bc4;
}
.change-review-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  color: #374151;
}
.change-review-stat {
  white-space: nowrap;
}
.change-review-increase strong {
  color: #2563eb;
}
.change-review-decrease strong {
  color: #ea580c;
}
.change-review-empty {
  padding: 1rem 0.5rem;
  text-align: center;
  color: var(--tb-muted);
  font-size: 0.875rem;
}
.change-review-table-wrap {
  overflow-x: auto;
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--tb-border);
  border-radius: 4px;
}
.change-review-table {
  width: 100%;
  min-width: 580px;
  font-size: 0.8125rem;
}
.change-review-table th,
.change-review-table td {
  padding: 0.35rem 0.55rem;
  white-space: nowrap;
  height: 32px;
}
.change-delta-positive {
  color: #2563eb;
  font-weight: 600;
}
.change-delta-negative {
  color: #ea580c;
  font-weight: 600;
}

/* ========== v1.0 Tab 3 子页导航（白底分段按钮，与 Tab 5 一致） ========== */
.audit-subtab-nav {
  display: inline-flex;
  gap: 0.25rem;
  padding: 0.25rem;
  background: #f8fafc;
  border: 1px solid var(--tb-border);
  border-radius: 6px;
  margin-bottom: 0.5rem;
}
.audit-subtab-btn {
  padding: 0.3rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 500;
  border: 1px solid #d8e0ea;
  border-radius: 4px;
  background: #fff;
  color: #475569;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.audit-subtab-btn:hover {
  background: #f8fafc;
  color: #1769c2;
  border-color: #2f80d1;
}
.audit-subtab-btn.active {
  background: #fff;
  color: #1769c2;
  border-color: #2f80d1;
  box-shadow: 0 1px 3px rgba(47, 128, 209, 0.16);
  font-weight: 600;
}

/* ========== v1.0 等级成长审查 ========== */
.growth-review-root {
  background: #fff;
  border: 1px solid var(--tb-border);
  border-radius: 6px;
  padding: 0.75rem 1rem;
}
.growth-review-title {
  font-size: 1rem;
  font-weight: 600;
  color: #374151;
  margin: 0 0 0.5rem 0;
  padding-bottom: 0.35rem;
  border-bottom: 2px solid #206bc4;
}
.growth-review-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  color: #374151;
}
.growth-review-stat {
  white-space: nowrap;
}
.growth-review-decline strong {
  color: #7c3aed;
}
.growth-review-jump strong {
  color: #ea580c;
}
.growth-review-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  padding: 0.5rem 0.75rem;
  background: #fafbfc;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  margin-bottom: 0.75rem;
}
.growth-filter-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
}
.growth-filter-label {
  font-weight: 600;
  color: #374151;
  font-size: 0.8rem;
  margin-right: 0.15rem;
}
.growth-filter-btn.active {
  background: #206bc4;
  color: #fff;
  border-color: #206bc4;
}
.growth-filter-select {
  width: auto;
  min-width: 100px;
  font-size: 0.8rem;
}
.growth-filter-input {
  width: 140px;
  font-size: 0.8rem;
}
.growth-review-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--tb-border);
  border-radius: 4px;
}
.growth-review-table {
  width: 100%;
  min-width: 780px;
  font-size: 0.8125rem;
}
.growth-review-table th,
.growth-review-table td {
  padding: 0.35rem 0.55rem;
  white-space: nowrap;
  height: 32px;
}
.growth-derived-badge {
  display: inline-block;
  padding: 0 4px;
  margin-left: 3px;
  background: #eef6ff;
  border: 1px solid #b9d3f3;
  border-radius: 3px;
  color: #1769c2;
  font-size: 0.68rem;
  font-weight: 600;
  vertical-align: middle;
  line-height: 1.4;
}
.growth-shape-badge {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 3px;
  font-size: 0.78rem;
  font-weight: 500;
  white-space: nowrap;
}
.growth-shape-stable {
  background: #eff6ff;
  color: #2563eb;
}
.growth-shape-stall {
  background: #f3f4f6;
  color: #6b7280;
}
.growth-shape-decline {
  background: #f5f3ff;
  color: #7c3aed;
}
.growth-shape-jump {
  background: #fff7ed;
  color: #ea580c;
}
.growth-shape-zero-base {
  background: #f9fafb;
  color: #9ca3af;
  border: 1px dashed #d1d5db;
}
.growth-shape-na {
  background: #f9fafb;
  color: #9ca3af;
  font-style: italic;
  border: 1px dashed #d1d5db;
}

/* ========== v2.0 等级成长审查 — 模式切换与单位选择 ========== */
.growth-mode-switcher {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
}
.growth-mode-label {
  font-weight: 600;
  color: #374151;
  font-size: 0.85rem;
  margin-right: 0.25rem;
}
.growth-mode-btn.active {
  background: #206bc4;
  color: #fff;
  border-color: #206bc4;
}

/* 单位选择工具栏 */
.growth-unit-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}
.growth-unit-toolbar select {
  min-width: 160px;
}
.growth-unit-nav {
  display: flex;
  gap: 0.35rem;
}
.growth-unit-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}
.growth-unit-meta strong {
  color: #1f2937;
}
.growth-unit-meta .badge {
  font-size: 0.75rem;
}

/* 异常单位折叠 */
.growth-issues-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.growth-issue-unit {
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #fff;
  overflow: hidden;
}
.growth-issue-unit.expanded {
  border-color: #206bc4;
}
.growth-issue-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  background: #f8fafc;
  user-select: none;
}
.growth-issue-header:hover {
  background: #f1f5f9;
}
.growth-issue-header strong {
  font-size: 0.9rem;
  color: #1f2937;
}
.growth-issue-header .badge {
  font-size: 0.7rem;
}
.growth-issue-body {
  padding: 0.5rem 0.75rem;
  border-top: 1px solid #e5e7eb;
}

/* 分页 */
.growth-pagination {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* ========== v1.0 同费比较 ========== */
.cost-peer-root {
  background: #fff;
  border: 1px solid var(--tb-border);
  border-radius: 6px;
  padding: 0.75rem 1rem;
}
.cost-peer-title {
  font-size: 1rem;
  font-weight: 600;
  color: #374151;
  margin: 0 0 0.25rem 0;
  padding-bottom: 0.35rem;
  border-bottom: 2px solid #206bc4;
}
.cost-peer-desc {
  font-size: 0.8rem;
  color: #6b7280;
  margin-bottom: 0.5rem;
  line-height: 1.4;
}
.cost-peer-filters {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.75rem;
  align-items: center;
  padding: 0.5rem 0.75rem;
  background: #fafbfc;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  margin-bottom: 0.75rem;
}
.cost-peer-filter-group {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
}
.cost-peer-filter-label {
  font-weight: 600;
  color: #374151;
  font-size: 0.8rem;
  margin-right: 0.15rem;
}
.cost-peer-level-btn.active {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
}
.cost-peer-mode-select,
.cost-peer-cost-select,
.cost-peer-metric-select {
  width: auto;
  min-width: 80px;
  font-size: 0.8rem;
}
.cost-peer-group {
  background: #fafbfc;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
}
.cost-peer-group-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}
.cost-peer-group-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #206bc4;
}
.cost-peer-group-count {
  font-size: 0.8rem;
  color: #6b7280;
}
.cost-peer-single-hint {
  font-size: 0.78rem;
  color: #ea580c;
  font-weight: 500;
}
.cost-peer-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  font-size: 0.8rem;
  color: #374151;
}
.cost-peer-stat {
  white-space: nowrap;
}
.cost-peer-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--tb-border);
  border-radius: 4px;
}
.cost-peer-table {
  width: 100%;
  min-width: 560px;
  font-size: 0.8125rem;
}
.cost-peer-table th,
.cost-peer-table td {
  padding: 0.35rem 0.55rem;
  white-space: nowrap;
  height: 32px;
}
.cost-peer-empty {
  padding: 1rem 0.5rem;
  text-align: center;
  color: var(--tb-muted);
  font-size: 0.875rem;
}

/* ========== v1.0 tooltip 优化（支持多行） ========== */
.modified-cell[title] {
  cursor: help;
}

/* 数字列统一右对齐 + 等宽数字 */
.native-table td.text-right,
.cost-peer-table td.text-right,
.growth-review-table td.text-right,
.change-review-table td.text-right {
  font-variant-numeric: tabular-nums;
}

/* ========== v1.1 AI Panel（Phase F 布局重构） ========== */

/* 子页导航：统一 pill 风格 */
#tab-ai .ai-subtab-nav {
  display: inline-flex;
  gap: 0.25rem;
  padding: 0.25rem;
  background: #f8fafc;
  border: 1px solid var(--tb-border);
  border-radius: 6px;
  margin-bottom: 0.75rem;
}
#tab-ai .ai-subtab-btn {
  padding: 0.3rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 500;
  border: 1px solid #d8e0ea;
  border-radius: 4px;
  background: #fff;
  color: #475569;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
#tab-ai .ai-subtab-btn:hover {
  background: #f8fafc;
  color: #1769c2;
  border-color: #2f80d1;
}
#tab-ai .ai-subtab-btn.active {
  background: #fff;
  color: #1769c2;
  border-color: #2f80d1;
  box-shadow: 0 1px 3px rgba(47, 128, 209, 0.16);
  font-weight: 600;
}

/* 兼容旧状态栏类 */
#tab-ai .ai-status-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  padding: 0.5rem 0.75rem !important;
}
#tab-ai .ai-status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 10px;
  border: 1px solid #d7dee8;
  border-radius: 6px;
  background: #eef2f7;
  color: #334155 !important;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.2;
  opacity: 1;
  visibility: visible;
  white-space: nowrap;
}

/* 6.1 AI 分析：V2 布局样式已在下方 "UI Rebuild V2" 区段统一定义 */

/* 控件高度统一 */
#tab-ai .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1.2;
}
#tab-ai .btn-sm {
  min-height: 24px;
  padding-top: 0.25rem;
  padding-bottom: 0.25rem;
  font-size: 0.85rem;
}
#tab-ai .ai-input-actions .btn,
#tab-ai .ai-settings-actions .btn-primary,
#tab-ai .ai-settings-actions .btn-danger,
#tab-ai .ai-settings-actions .btn-info {
  min-height: 32px;
  padding: 0.375rem 0.75rem;
}
#tab-ai .form-select,
#tab-ai input.form-control,
#tab-ai select.form-select {
  min-height: 32px;
  padding-top: 0.375rem;
  padding-bottom: 0.375rem;
  font-size: 0.85rem;
}
#tab-ai .form-check-input {
  width: 1.1em;
  height: 1.1em;
  margin-top: 0.2em;
}

/* 快捷分析区 */
#tab-ai .ai-quick-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  margin-bottom: 0.5rem;
}
#tab-ai .ai-quick-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.35rem;
  align-items: center;
  margin-bottom: 0.5rem;
}
#tab-ai .ai-quick-row:last-child {
  margin-bottom: 0;
}
#tab-ai .ai-unit-select,
#tab-ai .ai-issue-select {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 360px;
  display: inline-block;
}
#tab-ai .ai-quick-row .ai-quick-btn {
  flex: 0 0 auto;
  white-space: nowrap;
}

/* 对话区 */
#tab-ai .ai-chat-card {
  display: flex;
  flex-direction: column;
}
#tab-ai .ai-chat-card .card-body {
  flex: 1 1 auto;
  min-height: 180px;
  padding: 0.75rem;
}
#tab-ai .ai-message-list {
  max-height: min(360px, calc(100vh - 560px));
  min-height: 160px;
  overflow-y: auto;
  scroll-behavior: smooth;
  padding: 0.75rem;
  background: #f9fafb;
  border-radius: 6px;
}
#tab-ai .ai-empty {
  text-align: center;
  color: #6b7280;
  padding: 2rem 1rem;
  font-size: 0.9rem;
  background: #fff;
  border: 1px dashed var(--tb-border);
  border-radius: 6px;
}
#tab-ai .ai-empty-title {
  font-weight: 600;
  color: #374151;
  margin-bottom: 0.35rem;
}
#tab-ai .ai-empty-hint {
  font-size: 0.8rem;
  color: #9ca3af;
  margin-top: 0.5rem;
}

/* 消息层级 */
#tab-ai .ai-msg {
  margin-bottom: 0.75rem;
  max-width: 100%;
}
#tab-ai .ai-msg-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #6b7280;
  margin-bottom: 0.15rem;
}
#tab-ai .ai-msg-content {
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: break-word;
  font-size: 0.85rem;
  line-height: 1.55;
  max-width: 100%;
}
#tab-ai .ai-msg-user {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
#tab-ai .ai-msg-user .ai-msg-label {
  align-self: flex-end;
}
#tab-ai .ai-msg-user .ai-msg-content {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  color: #1e3a5f;
  max-width: 92%;
}
#tab-ai .ai-msg-assistant .ai-msg-content {
  background: #fff;
  border: 1px solid var(--tb-border);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  color: #1f2937;
}
#tab-ai .ai-msg-reasoning .ai-msg-content {
  background: #fefce8;
  border: 1px solid #fde68a;
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  color: #92400e;
  font-size: 0.8rem;
}
#tab-ai .ai-msg-reasoning-inner {
  background: #fefce8;
  border: 1px solid #fde68a;
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  color: #92400e;
  font-size: 0.8rem;
  margin-bottom: 0.4rem;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: break-word;
  line-height: 1.55;
  max-width: 100%;
}
#tab-ai .ai-msg-error .ai-msg-content {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  color: #991b1b;
}

/* C-FINAL B2: 部分回答未完整提示 */
#tab-ai .ai-msg-incomplete-notice {
  margin-top: 0.35rem;
  padding: 0.35rem 0.6rem;
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: 4px;
  color: #92400e;
  font-size: 0.8rem;
  line-height: 1.5;
}

/* C-FINAL B3: 数据快照 badge */
#tab-ai .ai-msg-snapshot-badge {
  margin-top: 0.35rem;
  font-size: 0.75rem;
  color: #6b7280;
  line-height: 1.5;
}
#tab-ai .ai-msg-snapshot-stale {
  display: inline-block;
  padding: 0.15rem 0.4rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 4px;
  color: #991b1b;
  font-weight: 500;
}

/* 输入区 */
#tab-ai .ai-input-area {
  padding: 0.75rem;
}
#tab-ai .ai-input-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.5rem;
}
#tab-ai .ai-input-textarea {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.85rem;
  resize: vertical;
  min-height: 64px;
  line-height: 1.4;
  padding: 0.5rem 0.75rem;
}
#tab-ai .ai-input-actions {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 0.35rem;
  flex: 0 0 auto;
  align-self: center;
}
#tab-ai .ai-input-actions .btn {
  min-width: 72px;
  white-space: nowrap;
}
#tab-ai .ai-input-secondary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

/* 等待状态 */
#tab-ai .ai-wait-status {
  display: none;
  margin: 0 0 0.75rem;
  padding: 10px 12px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
  color: #1e3a8a;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-line;
}
#tab-ai .ai-wait-status.is-visible {
  display: block;
}

/* 6.2 智谱设置：单列表单 */
#tab-ai .ai-settings-intro {
  font-size: 0.85rem;
  color: #6b7280;
  margin-bottom: 1rem;
  line-height: 1.5;
}

/* AI 能力边界声明与可信度提示 */
#tab-ai .ai-boundary-banner {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.375rem;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  color: #334155;
  line-height: 1.5;
}
#tab-ai .ai-boundary-title {
  font-weight: 600;
  color: #0f172a;
  margin-bottom: 0.35rem;
}
#tab-ai .ai-boundary-body {
  margin-bottom: 0.35rem;
}
#tab-ai .ai-transparency-note {
  color: #475569;
  font-size: 0.8rem;
}
#tab-ai .ai-credibility-hint {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 0.375rem;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.75rem;
  font-size: 0.8rem;
  color: #78350f;
  line-height: 1.4;
}
#tab-ai .ai-settings-form {
  max-width: 720px;
}
#tab-ai .ai-settings-form .form-label {
  font-size: 0.82rem;
  font-weight: 500;
  color: #374151;
  margin-bottom: 0.25rem;
}
#tab-ai .ai-settings-form .form-control,
#tab-ai .ai-settings-form .form-select {
  font-size: 0.85rem;
}
#tab-ai .ai-key-row {
  display: flex;
  gap: 0.35rem;
  align-items: center;
}
#tab-ai .ai-key-input {
  flex: 1;
  min-width: 0;
}
#tab-ai .ai-settings-form .form-text {
  font-size: 0.78rem;
  color: #6b7280;
  margin-top: 0.2rem;
}
#tab-ai .ai-settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
#tab-ai .ai-settings-actions--top {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #fff;
  padding: 0.75rem 0;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--tb-border);
}
#tab-ai .ai-settings-actions .btn {
  min-width: 64px;
}
#tab-ai #ai-cfg-save-result {
  font-size: 0.85rem;
  min-height: 1.4em;
}

/* 响应式：小屏下输入区和选择器适配（base 规则，legacy/V2 共用） */
@media (max-width: 768px) {
  #tab-ai .ai-input-row {
    flex-direction: column;
    align-items: stretch;
  }
  #tab-ai .ai-input-actions {
    flex-direction: row;
    width: 100%;
    align-self: stretch;
  }
  #tab-ai .ai-quick-row {
    flex-wrap: wrap;
  }
  #tab-ai .ai-unit-select,
  #tab-ai .ai-issue-select {
    max-width: 100%;
    width: 100%;
  }
}

/* ========== v1.2 身份与克制分析 ========== */

/* 导入状态指标卡 */
.section-card .metric-box {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  text-align: center;
  min-width: 100px;
}
.section-card .metric-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: #206bc4;
}
.section-card .metric-label {
  font-size: 0.75rem;
  color: #6b7280;
  margin-top: 2px;
}

/* Chip 筛选组 */
.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.chip {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.65rem;
  font-size: 0.78rem;
  border: 1px solid #d1d5db;
  border-radius: 999px;
  background: #fff;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s;
}
.chip:hover {
  border-color: #2563eb;
  color: #1e40af;
}
.chip.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}

/* 设计档案卡片网格 */
.design-profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.75rem;
}
.design-profile-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.design-profile-card:hover {
  border-color: #2563eb;
  box-shadow: 0 1px 4px rgba(37, 99, 235, 0.1);
}
.design-profile-card.unmatched {
  border-left: 3px solid #ea580c;
  opacity: 0.85;
}
.design-profile-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.35rem;
}
.design-profile-name {
  font-weight: 700;
  color: #206bc4;
  font-size: 0.92rem;
}
.design-profile-category {
  font-size: 0.72rem;
  color: #6b7280;
  background: #f3f4f6;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
}
.design-profile-summary {
  font-size: 0.78rem;
  color: #6b7280;
  line-height: 1.4;
  margin-bottom: 0.35rem;
}
.design-profile-stats {
  font-size: 0.72rem;
  color: #475569;
  font-variant-numeric: tabular-nums;
}

/* 状态徽章 */
.status-badge {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 3px;
  font-size: 0.78rem;
  font-weight: 500;
  white-space: nowrap;
}

/* 数据表格（用于设计审查和克制关系） */
.data-table {
  width: 100%;
  min-width: 640px;
  font-size: 0.8125rem;
  border-collapse: collapse;
}
.data-table th,
.data-table td {
  padding: 0.4rem 0.6rem;
  border: 1px solid #e5e7eb;
  text-align: left;
}
.data-table th {
  background: #f8fafc;
  font-weight: 600;
  color: #374151;
  position: sticky;
  top: 0;
  z-index: 2;
}
.data-table tr:nth-child(even) {
  background: #fafbfc;
}
.data-table tr:hover {
  background: #f3f4f6;
}

/* 克制矩阵 */
.matrix-table {
  width: max-content;
  border-collapse: separate;
  border-spacing: 3px;
  font-size: 0.72rem;
}
.matrix-table th,
.matrix-table td {
  min-width: 68px;
  max-width: 68px;
  height: 42px;
  padding: 4px 2px;
  text-align: center;
  vertical-align: middle;
  border: 1px solid #e5e7eb;
  border-radius: 3px;
}
.matrix-table thead th {
  background: #f8fafc;
  font-weight: 600;
  color: #374151;
  position: sticky;
  top: 0;
  z-index: 3;
  font-size: 0.7rem;
}
.matrix-table tbody th {
  background: #f8fafc;
  font-weight: 600;
  color: #374151;
  position: sticky;
  left: 0;
  z-index: 2;
  font-size: 0.72rem;
}
.matrix-table thead th:first-child {
  position: sticky;
  left: 0;
  top: 0;
  z-index: 4;
  background: #f8fafc;
}

/* 模态框 */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 1050;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-box {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  padding: 1.25rem;
  max-width: 700px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
}

/* 网格布局 */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
}
@media (max-width: 768px) {
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }
  .design-profile-grid {
    grid-template-columns: 1fr;
  }
}

/* ========== Phase A: 站点骨架与标题区 ========== */

/* 顶栏：品牌 + 状态区 + 简介在同一行，禁止折行 */
.app-header .container-fluid {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.75rem;
}
.app-header .navbar-brand {
  flex: 0 0 auto;
  margin-right: 0;
}
/* 空间不足时隐藏右侧简介，优先保证状态区单行 */
@media (max-width: 1599px) {
  .app-header .navbar-nav.ms-auto {
    display: none !important;
  }
}
.app-header__status-area {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  flex: 1 1 auto;
  min-width: 0;
}
.app-header__status-area #edit-status-bar,
.app-header__status-area #status-bar {
  margin-bottom: 0 !important;
}
.app-header__status-area .edit-status-bar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex: 0 0 auto;
  min-width: 0;
  padding: 0.35rem 0.5rem;
}
.app-header__status-area .edit-status-info {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.25rem;
  flex: 0 0 auto;
  min-width: 0;
}
.app-header__status-area .edit-status-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.5rem;
  flex: 0 0 auto;
}
.app-header__status-area .edit-notice {
  white-space: nowrap;
  flex: 0 0 auto;
  max-width: none;
  overflow: visible;
  text-overflow: clip;
}
@media (max-width: 1399px) {
  .app-header__status-area .edit-status-bar {
    flex-wrap: wrap;
    flex: 1 1 auto;
    max-width: 100%;
    min-width: 0;
  }
  .app-header__status-area .edit-notice {
    white-space: normal;
    flex: 1 1 100%;
    max-width: 100%;
    word-break: break-word;
  }
}
.app-header__status-area #status-bar {
  padding: 0.4rem 0.6rem;
  flex: 0 0 auto;
  min-width: max-content;
  max-width: none;
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
}

/* 响应式内容容器 */
.page > .container-fluid {
  width: 100%;
}
@media (min-width: 1440px) {
  .page > .container-fluid {
    max-width: 1320px;
    margin-left: auto;
    margin-right: auto;
  }
}
@media (min-width: 1920px) {
  .page > .container-fluid {
    max-width: 1600px;
  }
}

/* 页面标题区 */
.page-title-area {
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--tb-border);
}
.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 0.25rem 0;
  line-height: 1.3;
}
.page-subtitle {
  font-size: 0.875rem;
  color: #6b7280;
  margin: 0;
  line-height: 1.5;
}
.page-title-actions {
  margin-top: 0.5rem;
}

/* 子页导航统一 pill 类名（旧类保留作兼容别名） */
.subtab-btn,
.audit-subtab-btn,
.charts-subtab-btn,
.range-subtab-btn,
.ai-subtab-btn {
  cursor: pointer;
}
.subtab-btn--active,
.audit-subtab-btn.active,
.charts-subtab-btn.active,
.range-subtab-btn.active,
.ai-subtab-btn.active {
  font-weight: 600;
}

/* ========== Phase C: Tab 3 四子视图布局优化 ========== */

/* 规则异常：概览卡与风险列表/排行双栏 */
.rule-audit-main {
  align-items: flex-start;
}
.rule-issue-card .card-body {
  padding: 0.75rem 1rem;
}
.rule-issue-card .native-table-wrap {
  max-height: 520px;
}
.rule-audit-ranking {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.rule-audit-ranking .card {
  margin-bottom: 0;
}
.rule-audit-ranking .card-header {
  padding: 0.6rem 0.75rem;
}
.rule-audit-ranking .card-title {
  font-size: 0.9rem;
}
.rule-audit-ranking .native-table-wrap {
  max-height: 320px;
}
.rule-audit-ranking .native-table {
  min-width: 280px;
  font-size: 0.8125rem;
}
.rule-audit-ranking .native-table th,
.rule-audit-ranking .native-table td {
  padding: 0.35rem 0.5rem;
  height: 32px;
}

/* 等级成长审查概览卡 */
#growth-review-panel .row.g-2 {
  margin-bottom: 0.75rem;
}

/* 同费比较：单样本组紧凑折叠区 */
.cost-peer-compact {
  padding: 0.75rem 1rem;
  background: #f8fafc;
  border: 1px dashed #d1d5db;
  border-radius: 6px;
  margin-top: 0.5rem;
}
.cost-peer-compact-hint {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: #374151;
  line-height: 1.4;
}
.cost-peer-compact-icon {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #e5e7eb;
  color: #6b7280;
  font-size: 0.7rem;
  font-weight: 700;
}
.cost-peer-compact-units {
  margin-top: 0.35rem;
  font-size: 0.78rem;
  color: #6b7280;
  line-height: 1.4;
}

/* 克制矩阵：自身/未定义单元格文字加中性色 */
.matrix-table td.matrix-cell-neutral {
  background: transparent !important;
  color: #6b7280 !important;
}

/* 测试钩子：仅作标记，无视觉样式 */
[data-render-ready="false"] {
  opacity: 1;
}

/* ========== UI Rebuild V2: Tab 6 AI Panel ========== */

#tab-ai.tb-v2-ai-active .tb-v2-ai-legacy-title {
  display: none !important;
}

#tab-ai.tb-v2-ai-legacy .tb-v2-ai-header {
  display: none !important;
}

/* Fix: tb-v2-ai-active 的 display:flex 特异性(1,1,0)高于 .tab-panel 的 display:none(0,1,0)，
   会导致非激活 Tab 也显示 AI Panel。此规则特异性(1,2,0)确保非激活时强制隐藏 */
#tab-ai:not(.active).tb-v2-ai-active {
  display: none;
}

/* 高度链修复：tab-panel.active 默认 display:block，V2 AI 需 flex 纵向以传递高度 */
#tab-ai.tb-v2-ai-active {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 147px);
  overflow: hidden;
}

@media (max-width: 1399px) {
  #tab-ai.tb-v2-ai-active {
    height: calc(100vh - 175px);
  }
}

#tab-ai.tb-v2-ai-active #tb-v2-ai-page {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  flex: 1 1 auto;
  min-height: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #111827;
}

#tab-ai.tb-v2-ai-legacy #tb-v2-ai-page {
  display: block;
}

#tab-ai.tb-v2-ai-active .tb-v2-ai-header {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.4rem 0.75rem;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

#tab-ai.tb-v2-ai-active .tb-v2-ai-title-row {
  min-width: 0;
}

#tab-ai.tb-v2-ai-active .tb-v2-ai-title {
  margin: 0 0 0.25rem 0;
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.3;
  color: #111827;
}

#tab-ai.tb-v2-ai-active .tb-v2-ai-subtitle {
  margin: 0;
  font-size: 0.8125rem;
  color: #6b7280;
  line-height: 1.4;
}

#tab-ai.tb-v2-ai-active .tb-v2-ai-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.2rem;
  font-size: 0.75rem;
  color: #6b7280;
  white-space: nowrap;
  flex-shrink: 0;
}

#tab-ai.tb-v2-ai-active #ai-subtab-nav {
  flex-shrink: 0;
}

#tab-ai.tb-v2-ai-active .ai-subtab-nav {
  display: flex;
  gap: 0.5rem;
  padding: 0.25rem;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

#tab-ai.tb-v2-ai-active .ai-subtab-btn {
  padding: 0.35rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #374151;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}

#tab-ai.tb-v2-ai-active .ai-subtab-btn:hover {
  background: #f3f4f6;
}

#tab-ai.tb-v2-ai-active .ai-subtab-btn.active,
#tab-ai.tb-v2-ai-active .ai-subtab-btn.subtab-btn--active {
  color: #206bc4;
  background: rgba(32, 107, 196, 0.08);
  border-color: #206bc4;
  font-weight: 600;
}

#tab-ai.tb-v2-ai-active #ai-analysis-panel,
#tab-ai.tb-v2-ai-active #ai-settings-panel {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#tab-ai.tb-v2-ai-active .ai-analysis-layout {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  flex: 1 1 auto;
  min-height: 0;
}

/* 状态摘要：横向紧凑 chip 行 */
#tab-ai.tb-v2-ai-active .ai-status-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  flex: 0 0 auto;
  padding: 0.35rem 0.5rem;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}
#tab-ai.tb-v2-ai-active .ai-status-summary .ai-summary-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  background: #f8fafc;
  border-radius: 6px;
  font-size: 0.8125rem;
  white-space: nowrap;
}
#tab-ai.tb-v2-ai-active .ai-status-summary .ai-summary-label {
  color: #6b7280;
  font-weight: 500;
}
#tab-ai.tb-v2-ai-active .ai-status-summary .ai-summary-value {
  color: #111827;
  font-weight: 600;
}
#tab-ai.tb-v2-ai-active .ai-summary-value--small {
  font-size: 0.8rem;
  font-weight: 500;
  word-break: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
}

/* 快捷分析：紧凑区域 */
#tab-ai.tb-v2-ai-active .ai-quick-section {
  flex: 0 0 auto;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
}
#tab-ai.tb-v2-ai-active .ai-quick-section-title {
  padding: 0.3rem 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #111827;
  border-bottom: 1px solid #e5e7eb;
}
#tab-ai.tb-v2-ai-active .ai-quick-section-body {
  padding: 0.35rem 0.5rem;
}

/* 能力边界：可折叠指导区 */
#tab-ai.tb-v2-ai-active .ai-guidance-section {
  flex: 0 0 auto;
}
#tab-ai.tb-v2-ai-active .ai-guidance-details {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}
#tab-ai.tb-v2-ai-active .ai-guidance-details > summary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.75rem;
  cursor: pointer;
  font-size: 0.8125rem;
  list-style: none;
  user-select: none;
}
#tab-ai.tb-v2-ai-active .ai-guidance-details > summary::-webkit-details-marker {
  display: none;
}
#tab-ai.tb-v2-ai-active .ai-guidance-details > summary::before {
  content: '\25B6';
  font-size: 0.65rem;
  color: #6b7280;
  transition: transform 0.15s;
  display: inline-block;
}
#tab-ai.tb-v2-ai-active .ai-guidance-details[open] > summary::before {
  transform: rotate(90deg);
}
#tab-ai.tb-v2-ai-active .ai-guidance-summary-title {
  font-weight: 600;
  color: #374151;
  white-space: nowrap;
}
#tab-ai.tb-v2-ai-active .ai-guidance-core-statement {
  color: #6b7280;
  font-size: 0.78rem;
  overflow: hidden;
  text-overflow: ellipsis;
}
#tab-ai.tb-v2-ai-active .ai-guidance-content {
  padding: 0 0.75rem 0.6rem 0.75rem;
}

/* 智谱设置面板卡片样式（保留） */
#tab-ai.tb-v2-ai-active #ai-settings-panel > .card {
  display: flex;
  flex-direction: column;
  margin-bottom: 0;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: none;
}
#tab-ai.tb-v2-ai-active #ai-settings-panel > .card .card-header {
  padding: 0.6rem 0.75rem;
  background: transparent;
  border-bottom: 1px solid #e5e7eb;
}
#tab-ai.tb-v2-ai-active #ai-settings-panel > .card .card-title {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: #111827;
}
#tab-ai.tb-v2-ai-active #ai-settings-panel > .card .card-body {
  padding: 0.75rem;
}

/* 连续对话工作区：页面最大单一区域 */
#tab-ai.tb-v2-ai-active .ai-conversation-workspace {
  flex: 1 1 auto;
  min-height: 150px;
  display: flex;
  flex-direction: column;
  margin-bottom: 0;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: none;
  overflow: hidden;
}
#tab-ai.tb-v2-ai-active .ai-conversation-header {
  flex: 0 0 auto;
  padding: 0.3rem 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #111827;
  border-bottom: 1px solid #e5e7eb;
}

/* 等待状态 */
#tab-ai.tb-v2-ai-active .ai-conversation-workspace .ai-wait-status {
  flex: 0 0 auto;
  margin: 0;
  padding: 0.4rem 0.6rem;
  font-size: 0.8125rem;
  color: #206bc4;
  background: rgba(32, 107, 196, 0.08);
  border-radius: 0;
  display: none;
}
#tab-ai.tb-v2-ai-active .ai-conversation-workspace .ai-wait-status.is-visible {
  display: block;
}

/* 消息列表：内部纵向滚动，覆盖 base max-height */
#tab-ai.tb-v2-ai-active #ai-message-list {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.5rem;
  background: #f8fafc;
  border-radius: 0;
}

/* 输入区：固定在工作区底部 */
#tab-ai.tb-v2-ai-active .ai-composer {
  flex: 0 0 auto;
  padding: 0.35rem 0.5rem;
  border-top: 1px solid #e5e7eb;
}

#tab-ai.tb-v2-ai-active .ai-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  color: #6b7280;
  gap: 0.35rem;
}

#tab-ai.tb-v2-ai-active .ai-empty-title {
  font-size: 1rem;
  font-weight: 600;
  color: #374151;
}

#tab-ai.tb-v2-ai-active .ai-empty-hint {
  font-size: 0.75rem;
  color: #9ca3af;
}

#tab-ai.tb-v2-ai-active .ai-msg {
  margin-bottom: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  font-size: 0.875rem;
  line-height: 1.5;
}

#tab-ai.tb-v2-ai-active .ai-msg:last-child {
  margin-bottom: 0;
}

#tab-ai.tb-v2-ai-active .ai-msg-user {
  background: #eff6ff;
  border: 1px solid #dbeafe;
  margin-left: 2rem;
}

#tab-ai.tb-v2-ai-active .ai-msg-assistant {
  background: #fff;
  border: 1px solid #e5e7eb;
  margin-right: 2rem;
}

#tab-ai.tb-v2-ai-active .ai-msg-reasoning {
  background: #f8fafc;
  border: 1px dashed #d1d5db;
  margin-right: 2rem;
}

#tab-ai.tb-v2-ai-active .ai-msg-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  margin-right: 2rem;
}

#tab-ai.tb-v2-ai-active .ai-msg-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: #6b7280;
  margin-bottom: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

#tab-ai.tb-v2-ai-active .ai-msg-content {
  white-space: pre-wrap;
  word-break: break-word;
}

#tab-ai.tb-v2-ai-active .ai-msg-reasoning-inner {
  padding: 0.5rem;
  margin-bottom: 0.5rem;
  background: #fff;
  border-radius: 4px;
  font-size: 0.8125rem;
  color: #6b7280;
  white-space: pre-wrap;
  word-break: break-word;
}

#tab-ai.tb-v2-ai-active .ai-quick-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.35rem;
}

#tab-ai.tb-v2-ai-active .ai-quick-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.25rem;
}

#tab-ai.tb-v2-ai-active .ai-quick-row:last-child {
  margin-bottom: 0;
}

#tab-ai.tb-v2-ai-active .ai-unit-select,
#tab-ai.tb-v2-ai-active .ai-issue-select {
  flex: 1 1 auto;
  min-width: 0;
}

#tab-ai.tb-v2-ai-active .ai-input-area {
  padding: 0;
}

#tab-ai.tb-v2-ai-active .ai-input-row {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  margin-bottom: 0.25rem;
}

#tab-ai.tb-v2-ai-active .ai-input-textarea {
  flex: 1 1 auto;
  min-width: 0;
  resize: vertical;
  min-height: 36px;
  max-height: 100px;
}

#tab-ai.tb-v2-ai-active .ai-input-actions {
  display: flex;
  flex-direction: row;
  gap: 0.35rem;
  flex-shrink: 0;
}

#tab-ai.tb-v2-ai-active .ai-input-secondary {
  display: flex;
  gap: 0.5rem;
}

#tab-ai.tb-v2-ai-active .ai-settings-intro {
  padding: 0.75rem;
  margin-bottom: 0.75rem;
  background: #f8fafc;
  border-radius: 6px;
  font-size: 0.8125rem;
  color: #374151;
  line-height: 1.5;
}

#tab-ai.tb-v2-ai-active .ai-settings-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.75rem;
}

#tab-ai.tb-v2-ai-active .ai-key-row {
  display: flex;
  gap: 0.5rem;
}

#tab-ai.tb-v2-ai-active .ai-key-input {
  flex: 1 1 auto;
  min-width: 0;
}

#tab-ai.tb-v2-ai-active .ai-settings-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

#tab-ai.tb-v2-ai-active #ai-settings-panel {
  overflow-y: auto;
}

#tab-ai.tb-v2-ai-active #ai-settings-panel > .card {
  height: 100%;
}

/* ========== 小视口激进压缩（max-width: 1450px，覆盖 1440×900 和 1366×768） ========== */
/* 必须放在所有 base V2 AI 规则之后，确保同特异性规则正确覆盖 */
@media (max-width: 1450px) {
  /* 压缩 header：隐藏副标题，减小内边距 */
  #tab-ai.tb-v2-ai-active .tb-v2-ai-header {
    padding: 0.2rem 0.5rem;
  }
  #tab-ai.tb-v2-ai-active .tb-v2-ai-title {
    font-size: 1.05rem;
    margin: 0;
  }
  #tab-ai.tb-v2-ai-active .tb-v2-ai-subtitle {
    display: none;
  }

  /* 压缩 subtab nav */
  #tab-ai.tb-v2-ai-active .ai-subtab-nav {
    padding: 0.15rem;
    gap: 0.35rem;
  }
  #tab-ai.tb-v2-ai-active .ai-subtab-btn {
    padding: 0.2rem 0.55rem;
    font-size: 0.75rem;
  }

  /* 压缩 page 和 layout gap */
  #tab-ai.tb-v2-ai-active #tb-v2-ai-page {
    gap: 0.1rem;
  }
  #tab-ai.tb-v2-ai-active .ai-analysis-layout {
    gap: 0.1rem;
  }

  /* 压缩 status summary */
  #tab-ai.tb-v2-ai-active .ai-status-summary {
    padding: 0.15rem 0.4rem;
    gap: 0.35rem;
  }
  #tab-ai.tb-v2-ai-active .ai-status-summary .ai-summary-item {
    padding: 0.1rem 0.4rem;
    font-size: 0.75rem;
  }

  /* 压缩 quick section */
  #tab-ai.tb-v2-ai-active .ai-quick-section-title {
    padding: 0.15rem 0.4rem;
    font-size: 0.78rem;
  }
  #tab-ai.tb-v2-ai-active .ai-quick-section-body {
    padding: 0.2rem 0.4rem;
  }
  #tab-ai.tb-v2-ai-active .ai-quick-btns {
    margin-bottom: 0.15rem;
    gap: 0.25rem;
  }
  #tab-ai.tb-v2-ai-active .ai-quick-row {
    margin-bottom: 0.1rem;
    gap: 0.25rem;
  }
  #tab-ai.tb-v2-ai-active .ai-quick-btn,
  #tab-ai.tb-v2-ai-active .ai-unit-select,
  #tab-ai.tb-v2-ai-active .ai-issue-select {
    font-size: 0.75rem;
    padding-top: 0.1rem;
    padding-bottom: 0.1rem;
    line-height: 1.2;
    min-height: 26px;
  }

  /* 压缩 guidance summary */
  #tab-ai.tb-v2-ai-active .ai-guidance-details > summary {
    padding: 0.15rem 0.5rem;
    font-size: 0.72rem;
  }

  /* 隐藏对话区标题以释放空间 */
  #tab-ai.tb-v2-ai-active .ai-conversation-header {
    display: none;
  }

  /* 压缩 composer */
  #tab-ai.tb-v2-ai-active .ai-composer {
    padding: 0.2rem 0.4rem;
  }
  #tab-ai.tb-v2-ai-active .ai-input-row {
    margin-bottom: 0.1rem;
    gap: 0.35rem;
  }
  #tab-ai.tb-v2-ai-active .ai-input-textarea {
    height: 28px;
    min-height: 28px;
    line-height: 1.2;
    padding: 0.1rem 0.4rem;
  }
  #tab-ai.tb-v2-ai-active .ai-input-secondary {
    gap: 0.35rem;
  }
  #tab-ai.tb-v2-ai-active .ai-input-secondary .btn {
    font-size: 0.72rem;
    padding: 0.12rem 0.4rem;
  }
  #tab-ai.tb-v2-ai-active .ai-input-actions .btn {
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
  }
}

@media (max-width: 1200px) {
  #tab-ai.tb-v2-ai-active .ai-status-summary .ai-summary-item {
    flex: 1 1 calc(33.333% - 0.5rem);
    white-space: normal;
  }
  #tab-ai.tb-v2-ai-active .ai-quick-row {
    flex-wrap: wrap;
  }
}

@media (max-width: 768px) {
  #tab-ai.tb-v2-ai-active {
    min-height: calc(100vh - 120px);
  }
  #tab-ai.tb-v2-ai-active .tb-v2-ai-header {
    flex-direction: column;
    gap: 0.5rem;
  }
  #tab-ai.tb-v2-ai-active .tb-v2-ai-meta {
    align-items: flex-start;
  }
  #tab-ai.tb-v2-ai-active .ai-status-summary .ai-summary-item {
    flex: 1 1 calc(50% - 0.25rem);
    white-space: normal;
  }
  #tab-ai.tb-v2-ai-active .ai-quick-btns {
    flex-direction: column;
    align-items: stretch;
  }
  #tab-ai.tb-v2-ai-active .ai-quick-btns .ai-quick-btn {
    width: 100%;
  }
  #tab-ai.tb-v2-ai-active .ai-quick-row {
    flex-direction: column;
    align-items: stretch;
  }
  #tab-ai.tb-v2-ai-active .ai-input-row {
    flex-direction: column;
  }
  #tab-ai.tb-v2-ai-active .ai-input-actions {
    flex-direction: row;
    width: 100%;
  }
  #tab-ai.tb-v2-ai-active .ai-input-secondary {
    flex-wrap: wrap;
  }
  #tab-ai.tb-v2-ai-active .ai-conversation-workspace {
    min-height: 240px;
  }
}

/* ========== v1.3 轻量登录门禁 ========== */

/* 未登录时隐藏主应用，登录后显示 */
.page {
  display: none !important;
}
body.tb-auth-authenticated .page {
  display: flex !important;
}

/* 登录页容器：作用域严格限制在 .tb-auth-login-screen 内 */
.tb-auth-login-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1.5rem;
  background: #f8fafc;
  box-sizing: border-box;
}
body.tb-auth-authenticated .tb-auth-login-screen {
  display: none !important;
}

.tb-auth-login-card {
  width: 100%;
  max-width: 420px;
  padding: 2rem;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  box-sizing: border-box;
}

.tb-auth-login-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.tb-auth-login-brand {
  font-size: 1.35rem;
  font-weight: 700;
  color: #1f2937;
  letter-spacing: -0.01em;
}

.tb-auth-login-version {
  padding: 0.15rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #206bc4;
  background: rgba(32, 107, 196, 0.1);
  border-radius: 4px;
}

.tb-auth-login-title {
  margin: 0 0 1.5rem;
  font-size: 1.25rem;
  font-weight: 600;
  color: #374151;
  text-align: center;
}

.tb-auth-login-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.tb-auth-form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.tb-auth-form-group label {
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
}

.tb-auth-form-control {
  width: 100%;
  height: 42px;
  padding: 0.5rem 0.75rem;
  font-size: 0.9375rem;
  color: #1f2937;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  box-sizing: border-box;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.tb-auth-form-control:focus {
  border-color: #206bc4;
  outline: none;
  box-shadow: 0 0 0 3px rgba(32, 107, 196, 0.12);
}

.tb-auth-form-control:disabled {
  background: #f3f4f6;
  color: #9ca3af;
  cursor: not-allowed;
}

.tb-auth-password-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.tb-auth-password-wrap .tb-auth-form-control {
  padding-right: 62px;
}

.tb-auth-password-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  padding: 0.25rem 0.6rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #206bc4;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.15s;
}

.tb-auth-password-toggle:hover {
  background: #f3f4f6;
}

.tb-auth-password-toggle:disabled {
  color: #9ca3af;
  cursor: not-allowed;
}

.tb-auth-error {
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: #991b1b;
  background: #fee2e2;
  border: 1px solid #fecaca;
  border-radius: 6px;
}

.tb-auth-submit-btn {
  width: 100%;
  height: 44px;
  margin-top: 0.25rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: #fff;
  background: #206bc4;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.15s;
}

.tb-auth-submit-btn:hover {
  background: #1b5bab;
}

.tb-auth-submit-btn:disabled {
  background: #93c5fd;
  cursor: not-allowed;
}

/* 顶栏当前账号与退出 */
.tb-auth-user-area {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: 1rem;
  padding-left: 1rem;
  border-left: 1px solid #e5e7eb;
  white-space: nowrap;
}

.tb-auth-user-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tb-auth-logout-btn {
  padding: 0.25rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #6b7280;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.tb-auth-logout-btn:hover {
  color: #dc2626;
  border-color: #fca5a5;
  background: #fef2f2;
}

/* 响应式：在较小屏幕上保持可用 */
@media (max-width: 1280px) {
  .tb-auth-login-card {
    max-width: 400px;
    padding: 1.75rem;
  }
}

@media (max-width: 1024px) {
  .tb-auth-login-card {
    max-width: 380px;
    padding: 1.5rem;
  }
  .tb-auth-user-name {
    max-width: 100px;
  }
}

@media (max-width: 768px) {
  .tb-auth-login-screen {
    padding: 1rem;
  }
  .tb-auth-login-card {
    padding: 1.25rem;
  }
  .tb-auth-login-brand {
    font-size: 1.15rem;
  }
  .tb-auth-user-area {
    margin-left: 0.5rem;
    padding-left: 0.5rem;
  }
}

/* F-019/F-018: 战斗影响详情样式 */
.tb-v2-rules-page .tb-v2-combat-impact-section,
.tb-v2-rules-page .tb-v2-combat-risk-section {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid #e5e7eb;
}

.tb-v2-rules-page .tb-v2-rules-section-header {
  font-size: 1rem;
  font-weight: 600;
  color: #111827;
  margin-bottom: 0.75rem;
}

.tb-v2-rules-page .tb-v2-combat-impact-header-hint {
  font-size: 0.75rem;
  color: #9ca3af;
  margin-bottom: 1rem;
}

.tb-v2-rules-page .tb-v2-table--combat-impact {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
}

.tb-v2-rules-page .tb-v2-table--combat-impact thead {
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
}

.tb-v2-rules-page .tb-v2-table--combat-impact th {
  padding: 0.5rem 0.75rem;
  text-align: left;
  font-weight: 600;
  color: #4b5563;
  font-size: 0.75rem;
}

.tb-v2-rules-page .tb-v2-table--combat-impact td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #f3f4f6;
  color: #374151;
}

.tb-v2-rules-page .tb-v2-table--combat-impact .tb-v2-combat-matchup-row:last-child td {
  border-bottom: none;
}

.tb-v2-rules-page .tb-v2-combat-change--flip {
  color: #ef4444;
  font-weight: 600;
}

.tb-v2-rules-page .tb-v2-combat-change--critical {
  color: #f59e0b;
  font-weight: 600;
}

.tb-v2-rules-page .tb-v2-combat-change--delta {
  color: #3b82f6;
}

.tb-v2-rules-page .tb-v2-risk-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.tb-v2-rules-page .tb-v2-risk-item {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 1rem;
}

.tb-v2-rules-page .tb-v2-risk-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.tb-v2-rules-page .tb-v2-risk-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  color: #fff;
  background: #9ca3af;
}

.tb-v2-rules-page .tb-v2-risk-badge--danger {
  background: #ef4444;
}

.tb-v2-rules-page .tb-v2-risk-badge--warning {
  background: #f59e0b;
}

.tb-v2-rules-page .tb-v2-risk-badge--info {
  background: #3b82f6;
}

.tb-v2-rules-page .tb-v2-risk-code {
  font-size: 0.75rem;
  color: #9ca3af;
  font-family: monospace;
}

.tb-v2-rules-page .tb-v2-risk-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: #111827;
  margin-bottom: 0.25rem;
}

.tb-v2-rules-page .tb-v2-risk-summary {
  font-size: 0.8125rem;
  color: #4b5563;
  margin-bottom: 0.25rem;
}

.tb-v2-rules-page .tb-v2-risk-evidence {
  font-size: 0.75rem;
  color: #6b7280;
  margin-bottom: 0.5rem;
  font-family: monospace;
}

.tb-v2-rules-page .tb-v2-risk-before-after {
  background: #f9fafb;
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  margin-top: 0.5rem;
}

.tb-v2-rules-page .tb-v2-risk-ba-block {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.75rem;
  line-height: 1.5;
}

.tb-v2-rules-page .tb-v2-risk-ba-label {
  color: #6b7280;
  font-weight: 500;
  min-width: 3.5rem;
}

.tb-v2-rules-page .tb-v2-risk-ba-value {
  color: #111827;
  font-family: monospace;
  word-break: break-all;
}

.tb-v2-rules-page .tb-v2-risk-summary {
  font-size: 0.8125rem;
  color: #4b5563;
  margin-bottom: 0.75rem;
}

.tb-v2-rules-page .tb-v2-risk-summary-value {
  font-weight: 600;
  color: #111827;
}

.tb-v2-rules-page .tb-v2-risk-summary-value--danger {
  color: #ef4444;
}

.tb-v2-rules-page .tb-v2-risk-summary-value--warning {
  color: #f59e0b;
}
