/**
 * 深色模式可读性增强（链接 / 表格 / 禁用态 / 产品链路）
 * 依赖 design-tokens.css
 */

:is(html[data-theme="dark"], html.dark) .product-loop-steps li,
html.dark .product-loop-steps li {
  color: var(--text-secondary, var(--dt-text-muted));
}

:is(html[data-theme="dark"], html.dark) .product-loop-steps strong,
html.dark .product-loop-steps strong {
  color: var(--text-primary, var(--dt-text));
  font-weight: 600;
}

/* 首页产品链路 CTA（修复深紫链接不可见） */
:is(html[data-theme="dark"], html.dark) .product-loop-steps a,
html.dark .product-loop-steps a {
  color: var(--accent-link, #a5b4fc) !important;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

:is(html[data-theme="dark"], html.dark) .product-loop-steps a:hover,
html.dark .product-loop-steps a:hover {
  color: var(--accent-link-hover, #c7d2fe) !important;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* 表格：表头略亮、正文次级、推荐行高亮 */
:is(html[data-theme="dark"], html.dark) table th,
:is(html[data-theme="dark"], html.dark) .token-result th,
html.dark table th,
html.dark .token-result th {
  color: var(--text-primary, var(--dt-text));
  background: var(--table-head-bg, rgba(255, 255, 255, 0.06));
}

:is(html[data-theme="dark"], html.dark) table td,
:is(html[data-theme="dark"], html.dark) .token-result td,
html.dark table td,
html.dark .token-result td {
  color: var(--text-secondary, var(--dt-text-muted));
}

:is(html[data-theme="dark"], html.dark) tr.is-recommended td,
:is(html[data-theme="dark"], html.dark) tr.recommended td,
:is(html[data-theme="dark"], html.dark) .result-row--best,
html.dark tr.is-recommended td,
html.dark .result-row--best {
  background: color-mix(in srgb, var(--dt-color-brand) 12%, var(--dt-card-bg) 88%);
}

/* 禁用态：可见但不抢眼 */
:is(html[data-theme="dark"], html.dark) button:disabled,
:is(html[data-theme="dark"], html.dark) input:disabled,
:is(html[data-theme="dark"], html.dark) textarea:disabled,
:is(html[data-theme="dark"], html.dark) select:disabled,
html.dark button:disabled,
html.dark input:disabled,
html.dark textarea:disabled,
html.dark select:disabled {
  opacity: 1;
  color: var(--text-disabled, #6b7585) !important;
  border-color: var(--border-subtle, rgba(255, 255, 255, 0.08)) !important;
  cursor: not-allowed;
}

:is(html[data-theme="dark"], html.dark) ::placeholder,
html.dark ::placeholder {
  color: var(--text-muted, var(--dt-text-faint)) !important;
  opacity: 1;
}

/* V2 次要说明、推荐理由 */
:is(html[data-theme="dark"], html.dark).page-cost-v2 .section-sub,
html.dark.page-cost-v2 .section-sub,
:is(html[data-theme="dark"], html.dark).page-cost-v2 .recommend-pipeline__reason,
html.dark.page-cost-v2 .recommend-pipeline__reason {
  color: var(--text-secondary, var(--dt-text-muted));
}

/* Prompt Health */
:is(html[data-theme="dark"], html.dark) .phc-card__meta,
:is(html[data-theme="dark"], html.dark) .phc-hint,
html.dark .phc-card__meta,
html.dark .phc-hint {
  color: var(--text-secondary, var(--dt-text-muted));
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .product-loop-steps a {
    color: var(--accent-link, #a5b4fc) !important;
    font-weight: 500;
  }
  html:not([data-theme="light"]) .product-loop-steps a:hover {
    color: var(--accent-link-hover, #c7d2fe) !important;
  }
}
