/**
 * 深色主题 · 全局进阶覆盖层
 * 加载顺序：variables → 业务/模块 CSS → theme-dark-overrides → 本文件
 * 配合 html[data-theme="dark"] + data-bs-theme="dark"
 *
 * 保留原色块：为元素加 data-vh-theme-keep="1"（状态徽标、图表图例等）
 */

/* =============================================================================
   Bootstrap 5.3 组件补全（变量主干见 variables.css）
   ============================================================================= */

[data-theme="dark"] {
  --bs-card-bg: var(--vh-card-bg);
  --bs-card-cap-bg: var(--vh-surface);
  --bs-card-border-color: var(--vh-border);
  --bs-dropdown-bg: var(--vh-card-bg);
  --bs-dropdown-link-color: var(--vh-text);
  --bs-dropdown-link-hover-bg: var(--vh-surface);
  --bs-dropdown-link-hover-color: var(--vh-text);
  --bs-dropdown-divider-bg: var(--vh-border);
  --bs-modal-bg: var(--vh-card-bg);
  --bs-modal-color: var(--vh-text);
  --bs-modal-header-border-color: var(--vh-border);
  --bs-modal-footer-border-color: var(--vh-border);
  --bs-offcanvas-bg: var(--vh-card-bg);
  --bs-offcanvas-color: var(--vh-text);
  --bs-popover-bg: var(--vh-card-bg);
  --bs-popover-body-color: var(--vh-text);
  --bs-popover-header-bg: var(--vh-surface);
  --bs-popover-border-color: var(--vh-border);
  --bs-toast-bg: var(--vh-card-bg);
  --bs-toast-color: var(--vh-text);
  --bs-toast-header-bg: var(--vh-surface);
  --bs-toast-header-color: var(--vh-text);
  --bs-tooltip-color: var(--vh-text);
  --bs-tooltip-bg: #1f1f1f;
  --bs-table-bg: var(--vh-card-bg);
  --bs-table-color: var(--vh-text);
  --bs-table-striped-bg: var(--vh-surface);
  --bs-table-hover-bg: var(--vh-list-table-row-hover-bg);
  --bs-table-border-color: var(--vh-border);
  --bs-table-active-bg: var(--vh-list-table-row-hover-bg);
  --bs-table-active-color: var(--vh-text);
  --bs-nav-tabs-link-active-bg: var(--vh-card-bg);
  --bs-nav-tabs-link-active-color: var(--vh-text);
  --bs-nav-tabs-link-active-border-color: var(--vh-border);
  --bs-nav-tabs-link-hover-border-color: var(--vh-border);
  --bs-nav-tabs-border-color: var(--vh-border);
  --bs-nav-pills-link-active-bg: var(--vh-surface);
  --bs-nav-pills-link-active-color: var(--vh-text);
  --bs-pagination-bg: var(--vh-card-bg);
  --bs-pagination-border-color: var(--vh-border);
  --bs-pagination-color: var(--vh-text-muted);
  --bs-pagination-hover-bg: var(--vh-surface);
  --bs-pagination-hover-color: var(--vh-text);
  --bs-pagination-hover-border-color: var(--vh-border);
  --bs-pagination-active-bg: var(--vh-surface);
  --bs-pagination-active-border-color: var(--vh-border);
  --bs-pagination-active-color: var(--vh-text);
  --bs-pagination-disabled-bg: var(--vh-card-bg);
  --bs-pagination-disabled-color: var(--vh-text-light);
  --bs-pagination-disabled-border-color: var(--vh-border);
  --bs-list-group-bg: var(--vh-card-bg);
  --bs-list-group-color: var(--vh-text);
  --bs-list-group-border-color: var(--vh-border);
  --bs-list-group-action-hover-bg: var(--vh-surface);
  --bs-list-group-action-hover-color: var(--vh-text);
  --bs-list-group-action-active-bg: var(--vh-list-table-row-hover-bg);
  --bs-list-group-action-active-color: var(--vh-text);
  --bs-accordion-bg: var(--vh-card-bg);
  --bs-accordion-color: var(--vh-text);
  --bs-accordion-border-color: var(--vh-border);
  --bs-accordion-btn-bg: var(--vh-card-bg);
  --bs-accordion-btn-color: var(--vh-text);
  --bs-accordion-active-bg: var(--vh-surface);
  --bs-accordion-active-color: var(--vh-text);
  --bs-form-control-bg: var(--vh-card-bg);
  --bs-form-control-color: var(--vh-text);
  --bs-form-control-border-color: var(--vh-border);
  --bs-form-control-disabled-bg: var(--vh-surface);
  --bs-form-select-bg: var(--vh-card-bg);
  --bs-form-select-color: var(--vh-text);
  --bs-form-select-border-color: var(--vh-border);
  --bs-input-group-addon-bg: var(--vh-surface);
  --bs-input-group-addon-color: var(--vh-text-muted);
  --bs-input-group-addon-border-color: var(--vh-border);
  --bs-btn-close-color: #fff;
}

/* =============================================================================
   全局文本 / 链接 / 滚动条
   ============================================================================= */

[data-theme="dark"] body {
  background-color: var(--vh-bg);
  color: var(--vh-text);
}

[data-theme="dark"] a:not([data-vh-theme-keep]):not(.btn):not(.nav-link):not(.page-link):not(.dropdown-item) {
  color: var(--bs-link-color);
}

[data-theme="dark"] a:not([data-vh-theme-keep]):not(.btn):hover {
  color: var(--bs-link-hover-color);
}

[data-theme="dark"] .text-dark,
[data-theme="dark"] .text-body-emphasis {
  color: var(--vh-text) !important;
}

[data-theme="dark"] .text-secondary,
[data-theme="dark"] .text-black-50 {
  color: var(--vh-text-muted) !important;
}

[data-theme="dark"] ::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

[data-theme="dark"] ::-webkit-scrollbar-track {
  background: transparent;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.28);
}

/* =============================================================================
   表格 · 全局（压过模块内 #fff 硬编码）
   ============================================================================= */

[data-theme="dark"] :where(.table, .list-page-table, table) :where(thead th, tbody td, tbody th, tfoot td, tfoot th):not([data-vh-theme-keep]) {
  background-color: var(--vh-card-bg);
  color: var(--vh-text);
  border-color: var(--vh-border);
}

[data-theme="dark"] :where(.table, .list-page-table) thead th:not([data-vh-theme-keep]) {
  background-color: var(--vh-surface) !important;
}

[data-theme="dark"] :where(.table, .list-page-table) tbody tr:hover :where(td, th):not([data-vh-theme-keep]) {
  background-color: var(--vh-list-table-row-hover-bg) !important;
}

[data-theme="dark"] .table-light,
[data-theme="dark"] .table-light > :not(caption) > * > * {
  background-color: var(--vh-surface) !important;
  color: var(--vh-text);
}

[data-theme="dark"] .table-striped > tbody > tr:nth-of-type(odd) > *:not([data-vh-theme-keep]) {
  background-color: var(--vh-surface) !important;
}

[data-theme="dark"] .table-responsive {
  border-color: var(--vh-border);
}

/* =============================================================================
   卡片 / 面板 / 工作区 · 类名模式
   ============================================================================= */

[data-theme="dark"] :where(
  [class*="-card"]:not([class*="card-body"]):not([class*="card-header"]):not([class*="card-footer"]),
  [class*="__card"],
  [class*="-panel"],
  [class*="__panel"],
  [class*="-workspace"],
  [class*="-shell"],
  [class*="-wrap"]:not(.brand-logo-wrap):not(.login-wrapper),
  [class*="-box"]:not(.checkbox):not(.form-check),
  [class*="-block"],
  [class*="-section"]:not(.logo-section),
  [class*="-stage"],
  [class*="-rail"],
  [class*="-hub"],
  [class*="-workspace"],
  .pm-card,
  .pm-panel,
  .pm-tile,
  .pm-stat,
  .module-home-card,
  .report-panel,
  .detail-section,
  .detail-panel,
  .info-card,
  .form-card,
  .vh-detail-card,
  .vh-form-card,
  .three-column-actions__group,
  .three-column-main__content,
  .offcanvas,
  .toast,
  .popover,
  .img-thumbnail
):not([data-vh-theme-keep]) {
  background-color: var(--vh-card-bg);
  color: var(--vh-text);
  border-color: var(--vh-border);
}

/* =============================================================================
   列表 / 筛选 / 操作栏 · list-layout 与同类
   ============================================================================= */

[data-theme="dark"] :where(
  .list-page-table-container,
  .list-page-operations-zone,
  .list-page-filter-panel,
  .list-page-filter-fields,
  .list-page-filter-row,
  .list-page-action-bar,
  .list-page-actions-bar,
  .list-page-table-wrap,
  .list-page-table-toolbar,
  .list-page-pagination-bar,
  .list-page-filter-chip,
  .list-page-filter-tags,
  .list-page-scope-tabs,
  .list-page-empty,
  .list-page-column-settings,
  .list-page-bulk-bar,
  .list-page-card,
  .list-page-summary,
  .list-page-tabs,
  .filter-btn,
  .list-filter-panel,
  .msreg-master-tree-table-wrap,
  .msreg-master-tree-toolbar,
  .report-page-panel,
  .report-stat-card,
  .report-summary,
  .report-chart-card,
  .report-finding,
  .report-insight
):not([data-vh-theme-keep]) {
  background-color: var(--vh-card-bg) !important;
  color: var(--vh-text);
  border-color: var(--vh-border);
}

/* =============================================================================
   详情 / 创建 / 三栏 / 工作台
   ============================================================================= */

[data-theme="dark"] :where(
  .detail-block,
  .detail-mirror,
  .detail-header,
  .detail-body,
  .detail-footer,
  .detail-tabs,
  .detail-tab-content,
  .create-form,
  .vh-create-form-base,
  .form-card-header,
  .form-card-body,
  .form-card-footer,
  .three-column-layout,
  .three-column-main,
  .three-column-main__header,
  .three-column-actions,
  .three-column-actions__content,
  .dashboard-main,
  .dashboard-main-stage,
  .dashboard-card,
  .dashboard-section-nav,
  .dashboard-right-rail,
  .dashboard-right-rail__card,
  .dashboard-welcome__chip,
  .dashboard-header-ticker,
  .dashboard-header-ticker__chip,
  .dashboard-header-ticker__viewport,
  .dashboard-culture-card,
  .dashboard-goal-card,
  .dashboard-chart-card,
  .dashboard-project-card,
  .dashboard-feedback-card
):not([data-vh-theme-keep]) {
  background-color: var(--vh-card-bg);
  color: var(--vh-text);
  border-color: var(--vh-border);
}

[data-theme="dark"] .dashboard-header,
[data-theme="dark"] .navbar,
[data-theme="dark"] .vh-sb,
[data-theme="dark"] .vh-sb__top {
  background-color: var(--vh-card-bg);
  border-color: var(--vh-border);
}

/* 模块内表格格再压一层（模块 CSS 常写 #fff） */
[data-theme="dark"] [class*="report-"] :where(.table, table) :where(td, th):not([data-vh-theme-keep]),
[data-theme="dark"] [class*="delivery-"] :where(.table, table) :where(td, th):not([data-vh-theme-keep]),
[data-theme="dark"] [class*="financial-"] :where(.table, table) :where(td, th):not([data-vh-theme-keep]),
[data-theme="dark"] [class*="archive-"] :where(.table, table) :where(td, th):not([data-vh-theme-keep]),
[data-theme="dark"] [class*="litigation-"] :where(.table, table) :where(td, th):not([data-vh-theme-keep]),
[data-theme="dark"] [class*="contract-"] :where(.table, table) :where(td, th):not([data-vh-theme-keep]),
[data-theme="dark"] [class*="operation-log"] :where(.table, table) :where(td, th):not([data-vh-theme-keep]) {
  background-color: var(--vh-card-bg) !important;
  color: var(--vh-text);
}

/* =============================================================================
   表单控件 · Bootstrap + 业务
   ============================================================================= */

[data-theme="dark"] :where(
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]),
  textarea,
  select,
  .form-control,
  .form-select,
  .form-check-input,
  .input-group-text,
  .tom-select .ts-control,
  .tag-input-field
):not([data-vh-theme-keep]) {
  background-color: var(--vh-card-bg);
  color: var(--vh-text);
  border-color: var(--vh-border);
}

[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus,
[data-theme="dark"] textarea:focus {
  background-color: var(--vh-card-bg);
  color: var(--vh-text);
  border-color: var(--vh-primary-light);
  box-shadow: 0 0 0 0.15rem rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .form-control:disabled,
[data-theme="dark"] .form-control[readonly],
[data-theme="dark"] .form-control.bg-light,
[data-theme="dark"] .form-select:disabled {
  background-color: var(--vh-surface) !important;
  color: var(--vh-text-muted);
}

[data-theme="dark"] ::placeholder {
  color: var(--vh-text-light);
  opacity: 1;
}

/* =============================================================================
   按钮 · 导航 · Tab
   ============================================================================= */

[data-theme="dark"] .btn-light,
[data-theme="dark"] .btn-outline-light {
  background-color: var(--vh-surface);
  border-color: var(--vh-border);
  color: var(--vh-text);
}

[data-theme="dark"] .btn-light:hover,
[data-theme="dark"] .btn-outline-light:hover {
  background-color: var(--vh-list-table-row-hover-bg);
  color: var(--vh-text);
}

[data-theme="dark"] .btn-outline-dark {
  color: var(--vh-text);
  border-color: var(--vh-border);
}

[data-theme="dark"] .btn-outline-dark:hover {
  background-color: var(--vh-surface);
  color: var(--vh-text);
}

[data-theme="dark"] .nav-tabs .nav-link {
  color: var(--vh-text-muted);
  border-color: transparent;
}

[data-theme="dark"] .nav-tabs .nav-link.active,
[data-theme="dark"] .nav-tabs .nav-link:hover {
  color: var(--vh-text);
  background-color: var(--vh-card-bg);
  border-color: var(--vh-border);
}

[data-theme="dark"] .tab-content,
[data-theme="dark"] .tab-pane {
  background-color: var(--vh-card-bg);
  color: var(--vh-text);
}

/* =============================================================================
   语义浅底 · 警告/提示条（保留可读对比，非刺目白底）
   ============================================================================= */

[data-theme="dark"] :where(
  .alert-warning,
  [class*="--warning"],
  [class*="-warning-"],
  [class*="warning-pill"],
  [class*="warning-banner"],
  [class*="alert--warning"]
):not([data-vh-theme-keep]) {
  background-color: var(--vh-warning-surface) !important;
  border-color: var(--vh-warning-border) !important;
  color: var(--vh-text) !important;
}

[data-theme="dark"] :where(
  .alert-info,
  [class*="--info"],
  [class*="-info-"]
):not([data-vh-theme-keep]) {
  background-color: var(--vh-info-surface) !important;
  border-color: var(--vh-info-border) !important;
  color: var(--vh-text) !important;
}

[data-theme="dark"] :where(
  .alert-danger,
  [class*="--danger"],
  [class*="-danger-"]
):not([data-vh-theme-keep]):not([class*="list-badge"]) {
  background-color: var(--vh-danger-surface) !important;
  border-color: var(--vh-danger-border) !important;
  color: var(--vh-text) !important;
}

[data-theme="dark"] :where(
  .alert-success,
  [class*="--success"],
  [class*="-success-"]
):not([data-vh-theme-keep]):not([class*="list-badge"]) {
  background-color: var(--vh-success-surface) !important;
  border-color: var(--vh-success-border) !important;
  color: var(--vh-text) !important;
}

/* 状态徽标保留模块定义色；仅无 data-vh-theme-keep 的通用浅黄块走变量 */
[data-theme="dark"] [class*="list-badge"],
[data-theme="dark"] [class*="list-page-status-badge"],
[data-theme="dark"] [class*="vh-count-badge"],
[data-theme="dark"] [class*="vh-tag-badge"] {
  /* 徽标色由 badges.css / 模块定义；不强制改底 */
}

/* =============================================================================
   代码 / 预格式化 / 图表容器
   ============================================================================= */

[data-theme="dark"] :where(code, pre, kbd, samp):not([data-vh-theme-keep]) {
  background-color: var(--vh-surface);
  color: var(--vh-text-muted);
  border-color: var(--vh-border);
}

[data-theme="dark"] :where(.chart-container, .chart-wrap, [class*="chart-card"], canvas):not([data-vh-theme-keep]) {
  background-color: transparent;
}

[data-theme="dark"] .chart-container,
[data-theme="dark"] [class*="chart-card"] {
  background-color: var(--vh-card-bg);
  border-color: var(--vh-border);
}

/* =============================================================================
   Bootstrap 语义浅底 / 徽标
   ============================================================================= */

[data-theme="dark"] :where(
  .text-bg-light,
  .badge.bg-light.text-dark,
  .badge.text-bg-light
):not([data-vh-theme-keep]) {
  background-color: var(--vh-surface) !important;
  color: var(--vh-text) !important;
  border-color: var(--vh-border);
}

[data-theme="dark"] :where(
  .border.rounded,
  .border.rounded-2,
  .border.rounded-3
):not([data-vh-theme-keep]):not(.report-page):not(.report-document *) {
  border-color: var(--vh-border) !important;
  background-color: var(--vh-card-bg);
}

/* =============================================================================
   通知下拉（notification_widget.js 注入样式兜底）
   ============================================================================= */

[data-theme="dark"] .notification-icon-wrapper {
  color: var(--vh-text-muted);
}

[data-theme="dark"] .notification-popover__head {
  background: linear-gradient(165deg, #334155 0%, #1e293b 100%);
}

[data-theme="dark"] .notification-popover__more {
  color: var(--vh-link, #93c5fd);
}

[data-theme="dark"] .notification-popover__more:hover {
  color: var(--vh-link-hover, #bfdbfe);
  background: rgba(147, 197, 253, 0.1);
}

/* =============================================================================
   操作日志（system/operation-logs.css）
   ============================================================================= */

[data-theme="dark"] .sol-page,
[data-theme="dark"] .sol-toolbar,
[data-theme="dark"] .sol-filters,
[data-theme="dark"] .sol-table-wrap {
  background-color: var(--vh-card-bg);
  border-color: var(--vh-border);
  color: var(--vh-text);
}

[data-theme="dark"] .sol-table th,
[data-theme="dark"] .sol-table td {
  border-color: var(--vh-border-light);
  color: var(--vh-text);
}

[data-theme="dark"] .sol-table tbody tr:hover {
  background-color: var(--vh-surface-subtle);
}

[data-theme="dark"] .sol-detail-drawer,
[data-theme="dark"] .sol-detail-panel {
  background-color: var(--vh-card-bg);
  border-color: var(--vh-border);
  color: var(--vh-text);
}

[data-theme="dark"] .sol-pill:not(.is-active) {
  background-color: var(--vh-surface);
  border-color: var(--vh-border);
  color: var(--vh-text-muted);
}

/* =============================================================================
   合并报告：屏幕区 chrome 随主题，正文纸面保持浅色
   ============================================================================= */

[data-theme="dark"] body.project-opinion-merge-report {
  --mr-screen-bg: var(--vh-bg);
}

[data-theme="dark"] .report-chrome:not([data-vh-theme-keep]) {
  background: var(--vh-card-bg);
  border-bottom-color: var(--vh-border);
  color: var(--vh-text);
}

[data-theme="dark"] .report-chrome .btn-outline-secondary {
  color: var(--vh-text-muted);
  border-color: var(--vh-border);
}

[data-theme="dark"] .report-document[data-vh-theme-keep],
[data-theme="dark"] .report-document[data-vh-theme-keep] .report-page {
  /* 纸面预览保持白底，与打印一致 */
}

/* =============================================================================
   详情 / 表格白底容器
   ============================================================================= */

[data-theme="dark"] :where(
  .vh-form-control-prefilled,
  .form-control.vh-form-control-prefilled
) {
  background-color: var(--vh-surface) !important;
  color: var(--vh-text-muted);
  border-color: var(--vh-border);
}

[data-theme="dark"] .rounded.bg-light {
  background-color: var(--vh-surface) !important;
  color: var(--vh-text);
}

[data-theme="dark"] :where(.table-responsive.bg-white, .bg-white.table-responsive):not([data-vh-theme-keep]) {
  background-color: var(--vh-card-bg) !important;
}

/* =============================================================================
   交付方式面板（delivery _delivery_method_ui_styles）
   ============================================================================= */

[data-theme="dark"] .delivery-method-btn:not(.active) {
  background-color: var(--vh-card-bg);
  border-color: var(--vh-border);
}

[data-theme="dark"] .vh-delivery-method-panel {
  background-color: var(--vh-surface);
}

/* =============================================================================
   组织权限矩阵（perm-matrix-page 局部变量）
   ============================================================================= */

[data-theme="dark"] .perm-matrix-page {
  --pm-accent: #8ab4ff;
  --pm-accent-soft: rgba(37, 99, 235, 0.14);
  --pm-accent-border: rgba(147, 197, 253, 0.45);
  --pm-surface: var(--vh-card-bg);
  --pm-muted: var(--vh-text-muted);
  --pm-line: var(--vh-border);
}

[data-theme="dark"] .perm-matrix-hint {
  background: var(--vh-info-surface);
  border-color: var(--vh-info-border);
  color: var(--vh-text);
  box-shadow: none;
}

[data-theme="dark"] .perm-matrix-hint-icon {
  background: var(--vh-card-bg);
  border-color: var(--vh-info-border);
}

[data-theme="dark"] .perm-matrix-role-item:hover,
[data-theme="dark"] .perm-matrix-role-item.is-active {
  background: var(--vh-surface-subtle);
}

[data-theme="dark"] .perm-matrix-filter,
[data-theme="dark"] .perm-matrix-role-search {
  background-color: var(--vh-input-bg, var(--vh-card-bg));
  border-color: var(--vh-border);
  color: var(--vh-text);
}

[data-theme="dark"] :where(
  .perm-matrix-role-col,
  .perm-matrix-center,
  .perm-matrix-aside,
  .perm-matrix-aside-rail,
  .perm-matrix-perm-row,
  .perm-matrix-module,
  .perm-matrix-module-body,
  .perm-matrix-copy-panel
) {
  background: var(--vh-card-bg);
  border-color: var(--vh-border);
  color: var(--vh-text);
}

[data-theme="dark"] .perm-matrix-center {
  background: var(--vh-bg);
}

[data-theme="dark"] :where(
  .perm-matrix-role-col-header,
  .perm-matrix-center-header,
  .perm-matrix-module-head,
  .perm-matrix-aside-head,
  .perm-matrix-toolbar
) {
  background: var(--vh-surface-subtle);
  border-color: var(--vh-border);
  color: var(--vh-text);
}

[data-theme="dark"] :where(
  .perm-matrix-role-item,
  .perm-matrix-role-kind-tab,
  .perm-matrix-perm-item,
  .perm-matrix-copy-target
) {
  background: var(--vh-card-bg);
  border-color: var(--vh-border);
  color: var(--vh-text-muted);
}

[data-theme="dark"] .perm-matrix-role-item:hover,
[data-theme="dark"] .perm-matrix-role-kind-tab:hover {
  background: var(--vh-surface-subtle);
  border-color: var(--vh-border);
}

[data-theme="dark"] .perm-matrix-role-item.is-active,
[data-theme="dark"] .perm-matrix-role-kind-tab.is-active {
  background: rgba(37, 99, 235, 0.14);
  border-color: rgba(147, 197, 253, 0.45);
  color: #93c5fd;
}

[data-theme="dark"] :where(
  .perm-matrix-role-name,
  .perm-matrix-center-header-row > h2,
  .perm-matrix-module-title,
  .perm-matrix-perm-label
) {
  color: var(--vh-text);
}

[data-theme="dark"] :where(
  .perm-matrix-role-empty,
  .perm-matrix-role-group-body,
  .perm-matrix-role-group > summary.perm-matrix-role-group-summary
) {
  background: var(--vh-surface);
  color: var(--vh-text-muted);
}

[data-theme="dark"] :where(
  .perm-matrix-stat-pill,
  .perm-matrix-role-group-count,
  .perm-matrix-badge:not(.global)
) {
  background: var(--vh-surface-muted);
  border-color: var(--vh-border);
  color: var(--vh-text-muted);
}

[data-theme="dark"] .perm-matrix-stat-pill em {
  color: #93c5fd;
}

[data-theme="dark"] .perm-matrix-stat-pill--filter {
  background: var(--vh-success-surface-strong);
  border-color: var(--vh-success-border);
  color: #86efac;
}

[data-theme="dark"] .perm-matrix-badge.global {
  background: var(--vh-highlight-surface);
  color: #fcd34d;
}

[data-theme="dark"] .perm-matrix-perm-check,
[data-theme="dark"] .perm-matrix-perm-checkbox {
  accent-color: #93c5fd;
}

/* =============================================================================
   项目权限矩阵（ppm-*）
   ============================================================================= */

[data-theme="dark"] :where(
  .ppm-roles-panel,
  .ppm-main,
  .ppm-module,
  .ppm-role-group,
  .ppm-tri-state,
  .ppm-save-bar
) {
  background: var(--vh-card-bg);
  border-color: var(--vh-border);
  color: var(--vh-text);
}

[data-theme="dark"] :where(
  .ppm-meta,
  .ppm-main-stats,
  .ppm-module-count,
  .ppm-perm-code,
  .ppm-perm-desc,
  .ppm-role-group-meta,
  .ppm-role-empty,
  .ppm-empty-filter,
  .ppm-dirty-hint
) {
  color: var(--vh-text-muted);
}

[data-theme="dark"] :where(
  .ppm-roles-head-title,
  .ppm-role-short,
  .ppm-role-group-title,
  .ppm-module-title,
  .ppm-main-title,
  .ppm-perm-name
) {
  color: var(--vh-text);
}

[data-theme="dark"] :where(
  .ppm-role-group-head,
  .ppm-module-head,
  .ppm-toolbar,
  .ppm-meta .ppm-legend-item:not(.is-none):not(.is-grant):not(.is-scoped)
) {
  background: var(--vh-surface-subtle);
  border-color: var(--vh-border);
}

[data-theme="dark"] .ppm-party-tab {
  background: var(--vh-card-bg);
  border-color: var(--vh-border);
  color: var(--vh-text-muted);
}

[data-theme="dark"] .ppm-party-tab:hover,
[data-theme="dark"] .ppm-role-btn:hover {
  background: var(--vh-surface-subtle);
}

[data-theme="dark"] .ppm-party-tab.is-active,
[data-theme="dark"] .ppm-role-btn.is-active {
  background: rgba(37, 99, 235, 0.14);
  border-color: rgba(147, 197, 253, 0.45);
  color: #93c5fd;
}

[data-theme="dark"] .ppm-role-btn.is-active .ppm-role-short {
  color: #93c5fd;
}

[data-theme="dark"] :where(.ppm-roles-head-count, .ppm-role-badge) {
  background: var(--vh-surface);
  color: var(--vh-text-muted);
}

[data-theme="dark"] .ppm-tri-btn {
  color: var(--vh-text-muted);
  border-color: var(--vh-border);
}

[data-theme="dark"] .ppm-tri-btn:hover:not(:disabled) {
  background: var(--vh-surface-subtle);
}

[data-theme="dark"] .ppm-table-head,
[data-theme="dark"] .ppm-perm-row {
  border-color: var(--vh-border-light);
}

/* 语义态（禁止/允许/限专业）保留对比色 */
[data-theme="dark"] .ppm-meta .ppm-legend-item.is-none,
[data-theme="dark"] .ppm-tri-btn.is-active[data-state="none"] {
  background: var(--vh-danger-surface-strong);
  border-color: var(--vh-danger-border);
  color: #fca5a5;
}

[data-theme="dark"] .ppm-meta .ppm-legend-item.is-grant,
[data-theme="dark"] .ppm-tri-btn.is-active[data-state="grant"] {
  background: var(--vh-success-surface-strong);
  border-color: var(--vh-success-border);
  color: #86efac;
}

[data-theme="dark"] .ppm-meta .ppm-legend-item.is-scoped,
[data-theme="dark"] .ppm-tri-btn.is-active[data-state="scoped"] {
  background: var(--vh-highlight-surface);
  border-color: var(--vh-highlight-border);
  color: #fcd34d;
}

/* =============================================================================
   工作流配置设计器
   ============================================================================= */

[data-theme="dark"] .wecom-approval-designer,
[data-theme="dark"] .wecom-approval-designer .designer-canvas,
[data-theme="dark"] .wecom-approval-designer .designer-sidebar,
[data-theme="dark"] .wecom-approval-designer .designer-panel {
  background: var(--vh-card-bg);
  border-color: var(--vh-border);
  color: var(--vh-text);
}

[data-theme="dark"] .wecom-approval-designer .designer-node {
  background: var(--vh-surface);
  border-color: var(--vh-border);
  color: var(--vh-text);
}

[data-theme="dark"] .wecom-approval-designer .designer-node-actions {
  border-top-color: var(--vh-border);
}

[data-theme="dark"] .wecom-approval-designer .designer-toolbar {
  background: var(--vh-surface-subtle);
  border-color: var(--vh-border);
}

/* =============================================================================
   过渡动画（由 theme.js 短时挂载 .vh-theme-transitioning）
   ============================================================================= */

html.vh-theme-transitioning,
html.vh-theme-transitioning body,
html.vh-theme-transitioning .navbar,
html.vh-theme-transitioning .vh-sb,
html.vh-theme-transitioning .two-col-main,
html.vh-theme-transitioning .card,
html.vh-theme-transitioning .form-control,
html.vh-theme-transitioning .table td,
html.vh-theme-transitioning .table th {
  transition:
    background-color 0.22s ease,
    color 0.22s ease,
    border-color 0.22s ease,
    box-shadow 0.22s ease;
}
