/* =========================================================
   TMS v9.0.2 深色主题完整适配补丁
   解决 legacy 样式中大量 background:#fff 与深色 token 冲突。
   只在 navy / graphite / indigo 三个深色主题生效。
   ========================================================= */

:is(
  html[data-tms-theme="navy"],
  html[data-tms-theme="graphite"],
  html[data-tms-theme="indigo"]
) :is(
  .box,.card,table,.photo-item,.section-note,.filter-panel,.store-picker,
  .alert-card,.doc-card,.v2-kpi,.v2-panel,.dispatch-card,.exec-card,
  .exception-card,.project-ops-card,.customer-list-card,.customer-tab,
  .customer-section,.rate-rule,.project-row-v21,.customer-summary .box2,
  .customer-tabs,.asset-card,.ops-kpi,.ops-card,.quick-item,.list-filter,
  .table-scroll,.tomorrow-stat,.project-rel-card,.tomorrow-filter,
  .plan-prefill-tag,.future-stat,.future-date-card,.ops-shortcut,
  .ex-photo-preview-item,.billing-group,.finance-v25-row,.fin-kpi,
  .customer-branch,.billing-config,.billing-preview-card,.billing-generate,
  .project-bind-list,.project-mode-tab,.bill-tab,.builder-card,
  .template-lib-card,.bill-section,.bill-kpi,.verify-result-card,
  .future-date-detail-item,.toolbar,
  .a29-toolbar,.a29-kpi,.a29-panel,
  .shared-trip-box,.project-load-section,.co-project-card,.co-store-list,
  .shared-submit-bar
){
  background:var(--ui-panel,var(--tms-bg-panel)) !important;
  color:var(--ui-text,var(--tms-text-primary)) !important;
  border-color:var(--ui-line,var(--tms-border)) !important;
}

:is(
  html[data-tms-theme="navy"],
  html[data-tms-theme="graphite"],
  html[data-tms-theme="indigo"]
) :is(
  input,select,textarea,
  .a29-field input,.a29-field select
){
  background:var(--ui-panel-2,var(--tms-bg-panel-soft)) !important;
  color:var(--ui-text,var(--tms-text-primary)) !important;
  border-color:var(--ui-line,var(--tms-border)) !important;
}

:is(
  html[data-tms-theme="navy"],
  html[data-tms-theme="graphite"],
  html[data-tms-theme="indigo"]
) :is(
  .smallbtn,.btn-ghost,.exec-tab,.future-date-toggle
){
  background:var(--ui-panel-2,var(--tms-bg-panel-soft)) !important;
  color:var(--ui-text,var(--tms-text-primary)) !important;
  border-color:var(--ui-line,var(--tms-border)) !important;
}

:is(
  html[data-tms-theme="navy"],
  html[data-tms-theme="graphite"],
  html[data-tms-theme="indigo"]
) .exec-tab.active{
  background:color-mix(in srgb,var(--tms-brand) 24%,var(--tms-bg-panel-soft)) !important;
  color:#fff !important;
  border-color:color-mix(in srgb,var(--tms-brand) 70%,var(--tms-border)) !important;
}

:is(
  html[data-tms-theme="navy"],
  html[data-tms-theme="graphite"],
  html[data-tms-theme="indigo"]
) :is(
  .muted,.sub,.inline-note,.kpi-note,.file-note,
  .dispatch-meta,.timeline-note,.timeline-time
){
  color:var(--ui-muted,var(--tms-text-muted)) !important;
}

:is(
  html[data-tms-theme="navy"],
  html[data-tms-theme="graphite"],
  html[data-tms-theme="indigo"]
) .badge{
  background:color-mix(in srgb,var(--tms-brand) 16%,var(--tms-bg-panel-soft)) !important;
  color:color-mix(in srgb,#fff 82%,var(--tms-brand)) !important;
  border:1px solid color-mix(in srgb,var(--tms-brand) 32%,var(--tms-border)) !important;
}

:is(
  html[data-tms-theme="navy"],
  html[data-tms-theme="graphite"],
  html[data-tms-theme="indigo"]
) .modal-actions,
:is(
  html[data-tms-theme="navy"],
  html[data-tms-theme="graphite"],
  html[data-tms-theme="indigo"]
) .modal>div>#mt{
  background:var(--ui-panel,var(--tms-bg-panel)) !important;
  color:var(--ui-text,var(--tms-text-primary)) !important;
  border-color:var(--ui-line,var(--tms-border)) !important;
}

/* 运输执行页专门修复：截图中的白卡片/浅字问题 */
:is(
  html[data-tms-theme="navy"],
  html[data-tms-theme="graphite"],
  html[data-tms-theme="indigo"]
) #v2ExecList .exec-card{
  background:var(--tms-bg-panel) !important;
  color:var(--tms-text-primary) !important;
  border:1px solid var(--tms-border) !important;
  box-shadow:0 6px 18px rgba(0,0,0,.12) !important;
}
:is(
  html[data-tms-theme="navy"],
  html[data-tms-theme="graphite"],
  html[data-tms-theme="indigo"]
) #v2ExecList .exec-card b{
  color:var(--tms-text-primary) !important;
}
:is(
  html[data-tms-theme="navy"],
  html[data-tms-theme="graphite"],
  html[data-tms-theme="indigo"]
) #v2ExecList .exec-card .muted{
  color:var(--tms-text-muted) !important;
}

/* 长表格深色表头 */
:is(
  html[data-tms-theme="navy"],
  html[data-tms-theme="graphite"],
  html[data-tms-theme="indigo"]
) table thead th{
  background:var(--tms-bg-panel-soft) !important;
  color:var(--tms-text-secondary) !important;
}

/* 登录与遮罩 */
:is(
  html[data-tms-theme="navy"],
  html[data-tms-theme="graphite"],
  html[data-tms-theme="indigo"]
) .login{
  background:var(--tms-bg-page) !important;
}
