/* ─────────────────────────────────────────────────────────────
   人体专业知识 · 灰阶收敛层（monochrome-dark-v1 合同强制执行）
   在全部 *-route.css 之后加载：把原版迁移残留的彩色徽章/渐变/亮彩文字
   收敛为黑白灰；重建近黑背景上的卡片层次。合同 token 见 base.css。
   ───────────────────────────────────────────────────────────── */
.human-knowledge {
    /* 对齐 base.css 实际值（修正旧回退值） */
    --hk-border: var(--tblr-border-color, #333333);
    --hk-border-active: var(--tblr-border-active, #525252);
    --hk-raise: #1a1a1a;      /* 在 #141414 容器内可见的抬升面 */
    --hk-chip-bg: #242424;    /* 徽章/chip 统一底 */
    /* 实心按钮合同对（dark：浅灰底黑字）与 chip 上墨色 */
    --hk-solid-bg: #e5e5e5;
    --hk-solid-fg: #000000;
    --hk-solid-hover: #ffffff;
    --hk-ink-on-chip: #e5e5e5;
}

/* 主题归一（菲戈 2026-09-25 裁定：以设计库默认样式与主题设置为权威）：
   light 主题下表面/墨色/实心按钮对整体翻转，模块不再出现"白底+深灰补丁"拼贴。
   非 neutral 基（slate/stone 等）经 --tblr-* 变量自动跟随 Tabler 原生深色表面。 */
:root[data-bs-theme="light"] .human-knowledge {
    --hk-raise: var(--tblr-bg-surface-secondary, #f2f4f7);
    --hk-chip-bg: var(--tblr-bg-surface-secondary, #f2f4f7);
    --hk-solid-bg: #141414;
    --hk-solid-fg: #ffffff;
    --hk-solid-hover: #000000;
    --hk-ink-on-chip: var(--tblr-body-color, #1a2733);
}

/* light 下模块图标取消反色：invert(1) 是为近黑底准备的，白底上会把深色图标翻成白色（不可见）。 */
:root[data-bs-theme="light"] .human-knowledge img { filter: none; }

/* light 下 collection 的 --cr-label-* 标签族翻转为深墨（原值是近黑底专用亮字，定义在
   .collection-workspace 自身，必须以同元素更高特异性覆盖；主题矩阵闸门 2026-09-25 抓获 ratio 1.26）。 */
:root[data-bs-theme="light"] .collection-workspace {
    --cr-label-blue: var(--tblr-body-color, #1a2733);
    --cr-label-teal: var(--tblr-body-color, #1a2733);
    --cr-label-warn: var(--tblr-secondary, #667382);
    --cr-label-amber: var(--tblr-secondary, #667382);
    --cr-label-indigo: #3b40b8;
}

/* ═══ 1. 彩底收敛：浅彩底一律 → 灰 chip 底，彩字 → 高亮灰 ═══ */
.human-knowledge .chain-list-item > span,
.human-knowledge .chain-detail-head-counts span,
.human-knowledge .body-browser-head > span,
.human-knowledge .body-section-head > span,
.human-knowledge .body-list-mark,
.human-knowledge .body-mechanism-card small,
.human-knowledge .chain-branch-summary-head small,
.human-knowledge .process-section-nav a b,
.human-knowledge .process-risk-card div span,
.human-knowledge .sampling-version-matrix small,
.human-knowledge .sampling-version-repair small,
.human-knowledge .chain-loop-step.support > span,
.human-knowledge .process-entry-card > span,
.human-knowledge .process-mainline-card > span,
.human-knowledge .process-branch-card > span,
.human-knowledge .process-control-trigger,
.human-knowledge .chain-mechanism-stat > span,
.human-knowledge .chain-handoff-card > span,
.human-knowledge .olp-task-card > span,
.human-knowledge .olp-mechanism-card > span,
.human-knowledge .pac-material-card > span,
.human-knowledge .sampling-group-head > span,
.human-knowledge .collection-browser-head > span,
.human-knowledge .improvement-card-head > span {
    background: var(--hk-chip-bg) !important;
    color: var(--hk-ink-on-chip) !important;
    border: 1px solid var(--hk-border) !important;
}

/* ═══ 2. 亮彩文字收敛 → 灰阶三级 ═══ */
.human-knowledge .body-knowledge-card small,
.human-knowledge .chain-transmission-node small,
.human-knowledge .collection-material-signal small,
.human-knowledge .collection-rule-card small,
.human-knowledge .products-step-grid small,
.human-knowledge .collection-evidence-desk-card small,
.human-knowledge .collection-observation-bridge-card small,
.human-knowledge .human-knowledge [style*="color:#5ecfbd"] {
    color: var(--hk-muted, #b3b3b3) !important;
}

/* ═══ 3. 渐变按钮 → 合同实心按钮（浅灰底黑字）═══ */
.human-knowledge .process-branch-card > a,
.human-knowledge a[class*="-pill"],
.human-knowledge button[class*="-pill"] {
    background: var(--hk-solid-bg) !important;
    background-image: none !important;
    color: var(--hk-solid-fg) !important;
    border: none !important;
}
.human-knowledge .process-branch-card > a:hover,
.human-knowledge a[class*="-pill"]:hover,
.human-knowledge button[class*="-pill"]:hover {
    background: var(--hk-chip-bg);
    color: var(--hk-strong, #e5e5e5);
}

/* ═══ 4. 彩色 hover/选中 → 白色系 ═══ */
.human-knowledge a:hover,
.human-knowledge button:hover {
    border-color: var(--hk-border-active) !important;
}

/* ═══ 5. 层次重建：卡片边框升级 + 抬升面 + 阴影清理 ═══ */
.human-knowledge .chain-map-card,
.human-knowledge .chain-mechanism-stat,
.human-knowledge .chain-handoff-card,
.human-knowledge .chain-output-grid article,
.human-knowledge .body-knowledge-card,
.human-knowledge .body-rule-card,
.human-knowledge .body-olp-role-card,
.human-knowledge .olp-evidence-card,
.human-knowledge .process-control-card,
.human-knowledge .process-mainline-card,
.human-knowledge .process-branch-card,
.human-knowledge .process-loop-card,
.human-knowledge .improvement-workbench-step,
.human-knowledge .sampling-material-card,
.human-knowledge .collection-rule-card,
.human-knowledge .pac-material-card,
.human-knowledge .products-fit-card {
    border: 1px solid var(--hk-border-active) !important;
}

/* 列表项在容器内可见：#141414 容器里的项用抬升面 */
.human-knowledge .body-list-item,
.human-knowledge .chain-list-item,
.human-knowledge .sampling-list-item,
.human-knowledge .observation-list-item,
.human-knowledge .collection-list-item {
    background: var(--hk-raise) !important;
}

/* 浅色主题阴影在近黑背景不可见 → 清理 */
.human-knowledge .chain-workspace,
.human-knowledge .chain-browser,
.human-knowledge .chain-detail-view,
.human-knowledge .improvement-sidebar,
.human-knowledge .improvement-body {
    box-shadow: none !important;
}

/* 主内容大卡与页面底拉开：border-active 描边 */
.human-knowledge .chain-detail-view,
.human-knowledge .body-detail-view,
.human-knowledge .observation-detail-view,
.human-knowledge .collection-workspace,
.human-knowledge .improvement-workspace,
.human-knowledge .sampling-detail,
.human-knowledge .pac-detail,
.human-knowledge .olp-detail {
    border: 1px solid var(--hk-border-active) !important;
}

/* ═══ 6. 列表项副标题统一省略（截断兜底）═══ */
.human-knowledge .chain-list-item small,
.human-knowledge .sampling-list-item small,
.human-knowledge .collection-list-item small,
.human-knowledge .observation-list-item small {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ═══ 7. 间距归整：1px 级碎片 → 8/12 ═══ */
.human-knowledge .chain-list { gap: 8px !important; }
.human-knowledge .chain-list-item { padding: 9px 10px 10px !important; gap: 8px !important; }
.human-knowledge .chain-handoff-card { padding: 12px !important; }
.human-knowledge .body-mechanism-card { padding: 12px !important; }

/* ═══ 8. 实心按钮锚点黑字强制（2026-09-25 菲戈截图实测缺陷修复）═══
   base.css 灰阶合同 :root[…] a:not(.btn){color:link-color} 特异性高于各 route.css 的
   实心按钮规则，导致浅灰底按钮文字被压回亮灰=不可见（白字/亮字浅灰底同源）。
   收敛层最后加载，用 !important 执行合同"实心按钮=浅灰底黑字"。 */
.human-knowledge .process-control-card > a,
.human-knowledge .process-mainline-card > a,
.human-knowledge .process-package-card > a,
.human-knowledge .sampling-overview-actions > a:first-child,
.human-knowledge .sampling-workbench-actions > a:first-child,
.human-knowledge .sampling-version-boundary > div > a:first-child,
.human-knowledge .sampling-material-actions > a:first-child,
.human-knowledge .sampling-read-first article > a,
.human-knowledge .observation-section-nav a.active,
.human-knowledge .products-workbench-actions a:first-child,
.human-knowledge .process-entry-card > a,
.human-knowledge .process-gate-card > a,
.human-knowledge .process-responsibility-card > a,
.human-knowledge .process-closed-card > a,
.human-knowledge .process-loop-card > a,
.human-knowledge .chain-action-rail a {
    color: var(--hk-solid-fg) !important;
}
