/* 技术标界面仅统一文字颜色和不透明度；字号、字重、行高及布局沿用原有样式。 */
#technical-confirm-page {
  --tconfirm-text: #000000;
  --tconfirm-text-secondary: #404040;
  --tconfirm-text-muted: #595959;
  color: var(--tconfirm-text);
}

#technical-confirm-page :is(
  h2, h3, h4,
  .tconfirm-section-title,
  #technical-project-type-title,
  #technical-engineering-zones > div > p,
  #technical-spec-zones > p:first-child
) {
  color: var(--tconfirm-text) !important;
}

#technical-confirm-page :is(
  #technical-upload-dropzone,
  #technical-boq-zone,
  #technical-drawing-zone,
  #technical-attachment-zone
) p:first-of-type {
  color: var(--tconfirm-text);
}

#technical-confirm-page #technical-upload-dropzone:hover p:first-of-type {
  color: var(--tconfirm-primary);
}

/* 说明文字使用实色，避免透明度叠加后在浅灰面板上难以辨认。 */
#technical-confirm-page :is(
  #technical-upload-hint,
  #technical-project-type-desc,
  #technical-project-type-panel .opacity-40,
  #technical-project-type-panel [role="button"] > p:last-of-type,
  #technical-spec-zones > p:last-child,
  #technical-history-entry > span,
  #tconfirm-page-slider-help,
  #tconfirm-smartart-template-summary,
  .tconfirm-model-description,
  .technical-paste-intro,
  .technical-paste-help
) {
  color: var(--tconfirm-text-secondary) !important;
  opacity: 1;
}

#technical-confirm-page #tconfirm-page-slider-nodes,
#technical-confirm-page #tconfirm-page-slider-panel[data-selected="false"] #tconfirm-page-slider-label {
  color: var(--tconfirm-text-secondary);
}

#technical-confirm-page :is(
  .technical-project-type:not(:disabled)[aria-selected="false"],
  #tconfirm-section-layout [data-tconfirm-preview-tag] > input:not(:checked):not(:disabled) + label,
  #tconfirm-section-style [data-tconfirm-preview-tag] > input:not(:checked):not(:disabled) + label
) {
  color: var(--tconfirm-text) !important;
}

.main-content:has(.technical-flow-header):not(:has(.toolbox-flow-header)) .technical-flow-header__title :is(h1, h3) {
  color: #000000;
}

/* 子工作台仅统一颜色，保留现有字号、字重和布局。 */
.tech-wb {
  --technical-text: #000000;
  --technical-description: #404040;
  color: var(--technical-text);
}

.tech-wb :is(.tech-command-copy h1, .tech-section-heading h2, .tech-writing-copy strong, .tech-tool-title-line strong) {
  color: var(--technical-text);
}

.tech-wb :is(.tech-hero-meta, .tech-writing-copy p, .tech-tool-copy small, .tech-coming-hint) {
  color: var(--technical-description);
  opacity: 1;
}

.tech-wb .tech-tool-card:is(.is-coming, .is-disabled) :is(.tech-tool-title-line strong, .tech-tool-copy small) {
  color: #595959;
  opacity: 1;
}

/* 流程标识来自既有顶栏；工具箱虽复用该顶栏，但不属于技术标编写流程。 */
body:has(.technical-flow-header):not(:has(.toolbox-flow-header)) {
  --technical-text: #000000;
  --technical-description: #404040;
  --technical-muted: #595959;
  --tconfirm-text: var(--technical-text);
  --tconfirm-text-secondary: var(--technical-description);
  --tconfirm-text-muted: var(--technical-muted);
}

body:has(.technical-flow-header):not(:has(.toolbox-flow-header)) .technical-workflow-page {
  --tw-text: var(--technical-text);
  --tw-secondary: var(--technical-description);
  --tw-muted: var(--technical-muted);
}

/* 大标题只覆盖界面标题，不进入招标原文、生成正文和富文本编辑区。 */
body:has(.technical-flow-header):not(:has(.toolbox-flow-header)) :is(
  .technical-loading-visual__title,
  .loading-text-item,
  .technical-workflow-page h1,
  .technical-workflow-page h2,
  .technical-dialog__panel h2,
  #technical-settings-title,
  .overall-heading h1,
  .generation-page-header h1,
  .module-regeneration-loading h2,
  #directory-workspace h2,
  #chapter-details-host h2,
  #xiebiao-content-board-root h2,
  .onlyoffice-rewrite-title,
  .onlyoffice-error h2,
  .commercial-waiting h2,
  [data-slot="dialog-title"]
) {
  color: var(--technical-text);
}

body:has(.technical-flow-header):not(:has(.toolbox-flow-header)) :is(
  .technical-workflow-page h3,
  .technical-dialog__panel h3,
  .technical-dialog__panel label > span:first-child,
  .technical-lot-row__name,
  .reference-outline-heading,
  .generation-group h2,
  .overview-agent-name,
  .industry-agent-option-name,
  .engineering-info-card > header h2,
  #technical-settings-drawer dt,
  #technical-settings-drawer dd:not(.text-\[\#A66E2C\]),
  #technical-settings-drawer h3,
  #chapter-details-host :is(h3, h4, label),
  .technical-ui-field
) {
  color: var(--technical-text);
}

body:has(.technical-flow-header):not(:has(.toolbox-flow-header)) :is(
  .technical-loading-visual__subtitle,
  .technical-directory-loading-subtitle,
  .technical-parse-lot,
  .technical-parse-details,
  .technical-progress-summary__meta,
  .technical-progress-summary__meta > :last-child,
  .technical-loading-hint,
  .technical-lot-count,
  .technical-lot-row__summary,
  .technical-lot-selection-tip,
  #lot-selection-help,
  #lot-editor-description,
  #precheck-reupload-hint,
  .overview-agent-description,
  .industry-agent-option-description,
  #industry-agent-drawer header p,
  .reference-outline-note,
  .overall-heading p,
  .overall-edit-hint strong,
  .overall-regenerate-action small,
  .planning-rewrite-limit,
  .module-regeneration-hint,
  .generation-page-header > p,
  .generation-group li:not(.generating):not(.failed),
  .generation-group li small,
  .onlyoffice-rewrite-desc,
  .writing-loading-progress-meta,
  .technical-ui-description,
  .technical-dialog__panel > header p,
  #parse-failure-message,
  #precheck-failure-message,
  [data-slot="dialog-description"]
) {
  color: var(--technical-description);
}

body:has(.technical-flow-header):not(:has(.toolbox-flow-header)) :is(
  .technical-check-item:not(.is-warning):not(.is-failed):not(.is-running) .technical-check-item__name,
  .technical-vertical-steps li:not(.is-running),
  .writing-loading-step:not(.current) .writing-loading-step-label
) {
  color: var(--technical-description);
}

body:has(.technical-flow-header):not(:has(.toolbox-flow-header)) :is(
  .technical-check-item.is-running .technical-check-item__name,
  .technical-vertical-steps li.is-running,
  .writing-loading-step.current .writing-loading-step-label
) {
  color: var(--technical-text);
}

body:has(.technical-flow-header):not(:has(.toolbox-flow-header)) :is(
  .overall-tabs button:not([aria-selected="true"]),
  .engineering-plan-editor .plan-tab:not([aria-selected="true"])
) {
  color: var(--technical-text);
}

body:has(.technical-flow-header):not(:has(.toolbox-flow-header)) :is(
  .engineering-plan-editor .plan-cell,
  .engineering-plan-editor .plan-table,
  .planning-rewrite-instructions
) {
  color: var(--technical-text);
}

body:has(.technical-flow-header):not(:has(.toolbox-flow-header)) .engineering-plan-editor .plan-table th {
  color: var(--technical-text);
}

/* 原文导航属于界面；文件名的透明度不随非选中状态降低。 */
body:has(.technical-flow-header):not(:has(.toolbox-flow-header)) :is(
  .attachment-item:not(.active),
  .overall-collapse-source,
  #technical-confirm-toggle-source
) {
  color: var(--technical-text);
  opacity: 1;
}
body:has(.technical-flow-header):not(:has(.toolbox-flow-header)) #chapter-details-host :is(
  label,
  label > span:first-child,
  .text-sm.font-semibold,
  .text-\[\#45474A\] > span:first-child
) {
  color: var(--technical-text) !important;
}

body:has(.technical-flow-header):not(:has(.toolbox-flow-header)) #chapter-details-host :is(
  input, textarea, select, [aria-haspopup="menu"]
) {
  color: var(--technical-text);
}

body:has(.technical-flow-header):not(:has(.toolbox-flow-header)) #technical-confirm-page :is(
  .engineering-info-card table thead th,
  .engineering-info-card table tbody td:nth-child(2),
  .engineering-info-card table tbody td:nth-child(4),
  #technical-scoring-empty > div:first-child > p:first-child,
  .tender-setting-panel-root .tech-scoring-title-input
) {
  color: var(--technical-text) !important;
}

body:has(.technical-flow-header):not(:has(.toolbox-flow-header)) #industry-agent-drawer input[type="search"] {
  color: var(--technical-text);
}

body:has(.technical-flow-header):not(:has(.toolbox-flow-header)) #technical-confirm-page :is(
  [data-scoring-index],
  [data-scoring-details] textarea,
  [data-technical-scoring-scroll-hint] > span,
  .tech-score-editor-box.score-editor-box span
) {
  color: var(--technical-description) !important;
  opacity: 1;
}

/* 仅归一化中性色工具类，保留品牌、选中、告警、成功和禁用状态色。 */
body:has(.technical-flow-header):not(:has(.toolbox-flow-header)) :is(
  [class~="text-[#222222]"], [class~="text-[#191C1F]"],
  [class~="text-[#18181B]"], [class~="text-[#24262D]"],
  [class~="text-[#45474A]"], [class~="text-[#3F3F46]"],
  [class~="text-[#27272A]"], [class~="text-[#1e293b]"],
  [class~="text-[#191C1F]/80"], [class~="text-[rgba(25,28,31,0.8)]"],
  .text-slate-800, .text-slate-900, .text-gray-800, .text-gray-900,
  .tech-scoring-title-input, .technical-ui-field
):not(:where(:disabled, [aria-disabled="true"], [aria-selected="true"], .active, .is-selected,
  .active *, .is-selected *, .peer:checked ~ *, .peer:checked ~ * *,
  .peer:disabled ~ *, .peer:disabled ~ * *, label:has(:disabled),
  #sidebar *, .console-topbar-tools *,
  .commercial-document-page *, .fz_bid-editor *, .planning-prose *,
  .ProseMirror *, .tiptap *, .docx-wrapper *,
  button:disabled *, label:has(:disabled) *)) {
  color: var(--technical-text) !important;
}

body:has(.technical-flow-header):not(:has(.toolbox-flow-header)) :is(
  [class~="text-[#86888D]"], [class~="text-[#86888d]"],
  [class~="text-[#585B6E]"], [class~="text-[#667085]"],
  [class~="text-[#71717A]"], [class~="text-[#52525B]"],
  [class~="text-[#73777F]"], [class~="text-[#8A8D92]"],
  [class~="text-[#9CA3AF]"], [class~="text-[#94a3b8]"],
  [class~="text-[#64748b]"], [class~="text-[#475569]"],
  [class~="text-[#6F737A]"], [class~="text-[#4E5969]"],
  [class~="text-[rgba(25,28,31,0.4)]"],
  [class~="text-[rgba(25,28,31,0.5)]"],
  [class~="text-[rgba(25,28,31,0.6)]"],
  .text-slate-400, .text-slate-500, .text-slate-600,
  .text-gray-400, .text-gray-500, .text-gray-600
):not(:where(:disabled, [aria-disabled="true"], [aria-selected="true"], .active, .is-selected,
  .active *, .is-selected *, .peer:checked ~ *, .peer:checked ~ * *,
  .peer:disabled ~ *, .peer:disabled ~ * *, label:has(:disabled),
  #sidebar *, .console-topbar-tools *,
  .commercial-document-page *, .fz_bid-editor *, .planning-prose *,
  .ProseMirror *, .tiptap *, .docx-wrapper *,
  button:disabled *, label:has(:disabled) *)) {
  color: var(--technical-description) !important;
}

body:has(.technical-flow-header):not(:has(.toolbox-flow-header)) :is(
  #technical-confirm-page, .technical-dialog, #chapter-details-host, #industry-agent-drawer,
  .overall-plan-dialog, .engineering-plan-editor
) :is(input, textarea)::placeholder {
  color: var(--technical-muted) !important;
  opacity: 1;
}

body:has(.technical-flow-header):not(:has(.toolbox-flow-header)) [data-slot="dialog-content"] :is(input:not([type="checkbox"]):not([type="radio"]), textarea, select) {
  color: var(--technical-text);
}

/* 与公共页签处于同一层，覆盖公共组件中带 important 的浅灰字色。 */
@layer components {
  body:has(.technical-flow-header):not(:has(.toolbox-flow-header)) :is(.main-tab-link, .setting-tab-link):not(.active):not([aria-disabled="true"]):not(:hover) {
    color: var(--technical-text) !important;
  }
}
