/* Axe/contrast dual-era cluster split from ui-unification.css. */
/* Hard-gate axe color-contrast — solid active chrome + status badges. */
:where(
  .rk.active,
  .tab.active,
  .pf-chip.active,
  .btn-primary,
  .ui-action.is-primary,
  .appearance-segment.active,
  .platform-products-tab.active
) {
  color: var(--ui-on-accent) !important;
  background: var(--ui-accent-solid) !important;
  border-color: transparent !important;
}

:where(
  .micro,
  .reg-fpick-kind,
  .pf-ops-empty-note,
  .admin-state,
  .dash-step-pend,
  .deals-ctx,
  .pf-section-label,
  .pf-section-label.pf-sub,
  .pf-metric-line small,
  .pf-net-line > small,
  .platform-overview-note,
  .platform-panel-head p,
  .platform-kpi span,
  .platform-kpi small,
  .workspace-nav-group,
  .workspace-nav-badge,
  .workspace-stack-id,
  .workspace-stack-sub,
  .pf-billing-table th,
  .pf-client-table th,
  .refs-table th,
  .gs-section-title,
 #platform-bar .pf-billing-table th
) {
  color: var(--ui-muted-strong) !important;
  opacity: 1 !important;
}

.workspace-eyebrow,
.cab-eyebrow,
#platform-bar .workspace-nav-item.active,
#settings-bar .workspace-nav-item.active,
.workspace-nav-item.active,
.ui-action.is-quiet,
.rk.pf-refresh {
  color: var(--ui-accent-ink) !important;
}

/* Quiet chrome on hero/status: readable ink, not raw Telegram link blue. */
.ui-action.is-quiet,
.rk.pf-refresh {
  background: transparent !important;
}

.platform-mode-banner small {
  color: var(--ui-muted-strong) !important;
}

#platform-bar .pf-bill-badge.is-ok,
.cash-status.is-open,
#assets-modal .asset-state.is-active {
  color: #0a5c28 !important;
  background: color-mix(in srgb, #1a8d3e 16%, var(--tg-theme-bg-color, #fff)) !important;
}
#platform-bar .pf-bill-badge.is-warn {
  color: #7a4a00 !important;
  background: color-mix(in srgb, #d98a00 16%, var(--tg-theme-bg-color, #fff)) !important;
}
#platform-bar .pf-bill-badge.is-bad {
  color: #8f1212 !important;
  background: color-mix(in srgb, #d11 14%, var(--tg-theme-bg-color, #fff)) !important;
}

html[data-theme="dark"] #platform-bar .pf-bill-badge.is-ok,
html[data-theme="dark"] .cash-status.is-open, html[data-theme="dark"] #assets-modal .asset-state.is-active {
  color: #7ddea0 !important;
  background: color-mix(in srgb, #1a8d3e 28%, transparent) !important;
}
html[data-theme="dark"] #platform-bar .pf-bill-badge.is-warn {
  color: #f0c36a !important;
  background: color-mix(in srgb, #d98a00 26%, transparent) !important;
}
/* Marketplace contrast (tablist children fixed in JS; ink/fills here). */
#suppliers-bar .btn-primary,
#suppliers-bar #mk-search,
#suppliers-bar #b2b-card-new,
#suppliers-bar .ui-action.is-primary,
#suppliers-bar .b2b-empty-new {
  color: var(--ui-on-accent) !important;
  background: var(--ui-accent-solid) !important;
  border-color: transparent !important;
}
#suppliers-bar .ui-action.is-primary > span,
#suppliers-bar .b2b-empty-new > span {
  color: inherit !important;
}
#suppliers-bar :where(
  .mk-detail-block b, .mk-invite-row small, .mk-service-row > span:nth-child(2),
  .fin-empty > span, .fin-empty span, .b2b-from,
  .mk-section-title p, .mk-pane-intro span, .mk-filter-grid label > span,
  .mk-results-head > small, #mk-results-summary, .mk-count, .b2b-badge,
  label[for="b2b-find"], .mk-sort-field > span
) {
  color: var(--ui-muted-strong) !important;
  opacity: 1 !important;
}
#suppliers-bar :where(input.cm, select.cm, #mk-cur, #mk-city, #mk-cat, #mk-sort) {
  color: var(--tg-theme-text-color, #111) !important;
  background: var(--tg-theme-bg-color, #fff) !important;
  border-color: var(--ui-border-strong, #9aa3af) !important;
}
#suppliers-bar button.del,
#suppliers-bar .del {
  color: #8f1212 !important;
  background: color-mix(in srgb, #d11 14%, var(--tg-theme-bg-color, #fff)) !important;
  border-color: transparent !important;
}
#suppliers-bar button[data-view] {
  color: var(--ui-muted-strong) !important;
}
#suppliers-bar button[data-view].active {
  color: var(--ui-on-accent) !important;
  background: var(--ui-accent-solid) !important;
}
html[data-theme="dark"] #suppliers-bar button.del,
html[data-theme="dark"] #suppliers-bar .del {
  color: #ff8e8e !important;
  background: color-mix(in srgb, #d11 22%, transparent) !important;
}
html[data-theme="dark"] #suppliers-bar :where(input.cm, select.cm, #mk-cur, #mk-city, #mk-cat, #mk-sort) {
  color: var(--tg-theme-text-color, #f5f5f5) !important;
  background: var(--tg-theme-secondary-bg-color, #1c2733) !important;
}

html[data-theme="dark"] #platform-bar .pf-bill-badge.is-bad {
  color: #ff8e8e !important;
  background: color-mix(in srgb, #d11 24%, transparent) !important;
}

/* Beat ecosystem `.btn-primary { … !important }` — `:where()` lost that race. */
.btn-primary,
.ui-action.is-primary {
  color: var(--ui-on-accent) !important;
  background: var(--ui-accent-solid) !important;
  border-color: transparent !important;
}

/* Client / Personal / Checkout muted ink + accents (axe color-contrast hard-gate). */
.client-cabinet :where(button.del, .del, .rfq-cancel) {
  color: #8f1212 !important;
  background: color-mix(in srgb, #d11 14%, var(--tg-theme-bg-color, #fff)) !important;
  border-color: transparent !important;
}
html[data-theme="dark"] .client-cabinet :where(button.del, .del, .rfq-cancel) {
  color: #ff8e8e !important;
  background: color-mix(in srgb, #d11 22%, transparent) !important;
}
.client-cabinet :where(
  th, th.txt, .workspace-section-head,
  .workspace-empty > span:not(.workspace-empty-icon),
  .fin, .hint, .muted, small
),
.personal-cabinet :where(
  .personal-quota-grid small,
  .personal-history-row time,
  .personal-premium-includes small,
  .personal-premium-tiers .personal-tier small,
  .fin, .hint, .muted, small
),
.personal-cabinet .personal-head > div > span,
#unified-checkout-modal :where(
  .checkout-breakdown dt,
  .checkout-exact span,
  .checkout-exact small,
  .checkout-detail > span,
  .checkout-hint,
  .fin, .hint, .muted, small
) {
  color: var(--ui-muted-strong) !important;
  opacity: 1 !important;
}
.personal-cabinet .personal-head > div > span {
  color: var(--ui-accent-ink) !important;
}
#unified-checkout-modal .btn-primary,
#unified-checkout-modal .checkout-primary {
  color: var(--ui-on-accent) !important;
  background: var(--ui-accent-solid) !important;
  border-color: transparent !important;
}

/* Maintainability bundle: Platform / Cabinet muted ink (axe color-contrast hard-gate). */
#platform-bar :where(
  .platform-impact-note span,
  .platform-product-card p,
  .platform-plan-card label,
  .platform-meter-card label,
  .platform-plan-card small,
  .platform-panel-head p,
  .platform-kpi span,
  .platform-kpi small,
  .platform-overview-note,
  .platform-limit-grid label,
  .cabinet-admin-summary span,
  .cabinet-admin-summary small,
  .pf-plan-mod small,
  .pf-user-joined,
  .pf-user-id small,
  .pf-user-meta,
  .pf-user-cab small,
  .pf-mod-muted,
  .fin, .hint, .muted, small
),
:is(#settings-bar, #assets-modal, #zones-modal) :where(
  .cab-hero p,
  .cab-panel-head p,
  .cab-section-intro p,
  .cab-custom-head p,
  .cab-sub-current p,
  .cab-summary-label,
  .cab-summary-card > span:last-child,
  .cab-overview-guide,
  .cab-overview-guide span,
  .cab-current-price span,
  .cab-current-price small,
  .cab-plan-price span,
  .cab-plan-list > b,
  .cab-plan-list .is-off,
  .cab-plan-list details,
  .cab-compare th small,
  .cab-compare td small,
  .cab-module-copy small,
  .cab-quote-bar span,
  .cab-quote-bar small,
  .cab-quote-prices span,
  .cab-quote-list small,
  .cab-control-amount span,
  .cab-control-amount small,
  .cab-annual-quote span,
  .cab-annual-quote small,
  .cab-state-error span,
  .member-identity small,
  .member-invite > .ecosystem-field-row > label,
  .admin-state span,
  .admin-field > span,
  .fin, .hint, .muted, small
) {
  color: var(--ui-muted-strong) !important;
  opacity: 1 !important;
}
#settings-bar .cab-overview-guide b {
  color: var(--tg-theme-text-color, #111) !important;
}
:is(#settings-bar, #assets-modal, #zones-modal) :where(table.mini th, table.mini th.txt) {
  color: var(--ui-muted-strong) !important;
  opacity: 1 !important;
}
/* Danger soft fills need darker ink than raw --ui-danger (#d43b43 fails ~3.7:1). */
:is(#settings-bar, #assets-modal, #zones-modal, #ref-card) :where(
 #set-logout-all,
  button.del,
  .ui-action.is-danger,
  .ui-action.ecosystem-danger
) {
  color: #8f1212 !important;
  background: color-mix(in srgb, #d11 14%, var(--tg-theme-bg-color, #fff)) !important;
  border-color: transparent !important;
}
:is(#settings-bar, #assets-modal, #zones-modal, #ref-card) :where(
 #set-logout-all > span,
  button.del > span,
  .ui-action.is-danger > span,
  .ui-action.ecosystem-danger > span
) {
  color: inherit !important;
}
html[data-theme="dark"] :is(#settings-bar, #assets-modal, #zones-modal, #ref-card) :where(
 #set-logout-all,
  button.del,
  .ui-action.is-danger,
  .ui-action.ecosystem-danger
) {
  color: #ff8e8e !important;
  background: color-mix(in srgb, #d11 22%, transparent) !important;
}

/* B2B order cards were only ever rendered empty in tests, so their muted ink
 (#999 on white ≈ 2.9:1) and the danger-soft action label (≈ 4.2:1) never reached axe.
 Same tokens the settings / dashboard passes already use. */
#b2b-orders :where(.mk-card-meta, .mk-order-terms span) {
  color: var(--ui-muted-strong) !important;
  opacity: 1 !important;
}
#b2b-orders :where(
  .ui-action.is-danger,
  .ui-action.ecosystem-danger,
  .b2b-cancel,
  button[data-a="decline"]
) {
  color: #8f1212 !important;
  background: color-mix(in srgb, #d11 14%, var(--tg-theme-bg-color, #fff)) !important;
  border-color: transparent !important;
}
#b2b-orders :where(
  .ui-action.is-danger,
  .ui-action.ecosystem-danger,
  .b2b-cancel,
  button[data-a="decline"]
) > span {
  color: inherit !important;
}
html[data-theme="dark"] #b2b-orders :where(
  .ui-action.is-danger,
  .ui-action.ecosystem-danger,
  .b2b-cancel,
  button[data-a="decline"]
) {
  color: #ff8e8e !important;
  background: color-mix(in srgb, #d11 22%, transparent) !important;
}

/* Quality polish: Lite primary CTA needs solid accent (≥ WCAG AA on label). */
#lite-home #lh-new,
#lite-home .lh-tile.primary {
  color: var(--ui-on-accent) !important;
  background: var(--ui-accent-solid) !important;
  border-color: transparent !important;
}
#lite-home #lh-new :where(span, .ico),
#lite-home .lh-tile.primary :where(span, .ico) {
  color: inherit !important;
}

/* Quality polish: Dashboard / Docs / Lite home muted ink (axe color-contrast). */
#dash :where(
  .dash-sec-summary,
  table.mini th,
  table.mini th.txt,
  .fin, .hint, .muted, small
),
#lite-home :where(
  .lh-cur-l,
  .lh-cur-sub,
  .fin, .hint, .muted, small
),
#docs-bar :where(
  .docs-nav a,
  .docs-meta,
 #docs-count,
  .fin, .hint, .muted, small
) {
  color: var(--ui-muted-strong) !important;
  opacity: 1 !important;
}
/* Download CTA is btn-primary — never paint muted ink onto on-accent labels. */
#docs-bar #docs-dl.btn-primary,
#docs-bar #docs-dl.btn-primary :where(span, b, small) {
  color: var(--ui-on-accent) !important;
  opacity: 1 !important;
  background: transparent;
}

/* Counterparties shell muted ink (axe color-contrast hard-gate). */
#refs-bar :where(
 #ref-context,
 #ref-context > span,
  .rf-id,
  .rf-badge,
  .rf-badge.is-neutral,
  .rf-badge.is-muted,
  .rf-last,
  .rf-table-id,
  .refs-table th,
  .workspace-empty > span:not(.workspace-empty-icon),
  .ref-empty-state > span:not(.workspace-empty-icon),
  .fin, .hint, .muted, small
),
.workspace-empty > span:not(.workspace-empty-icon) {
  color: var(--ui-muted-strong) !important;
  opacity: 1 !important;
}
#refs-bar .rf-badge.is-info {
  color: #145a96 !important;
  opacity: 1 !important;
}
#refs-bar .rf-badge.is-warn {
  color: #8a5410 !important;
  opacity: 1 !important;
}
html[data-theme="dark"] #refs-bar .rf-badge.is-info {
  color: #8ec5f5 !important;
}
html[data-theme="dark"] #refs-bar .rf-badge.is-warn {
  color: #f0c27a !important;
}

/* Finance Wallets shell (axe color-contrast hard-gate). */
#grid-wrap :where(
  .fin-mini-table th,
  .fin-mini-table th.txt,
  .wallet-card-meta,
  .wallet-card header span,
  .fin-summary-section > header span,
  .finance-metric-label,
  .finance-data-cell > span,
  .finance-operation-detail > span,
  time,
  .led-day-meta,
  .led-entry-meta,
  .led-meta-dim,
  .is-zero,
  .meta,
  button.act,
  .fin, .hint, .muted, small
) {
  color: var(--ui-muted-strong) !important;
  opacity: 1 !important;
}
#grid-wrap :where(
  .fin-flow.is-in,
  .finance-metric-value.fin-flow.is-in,
  strong > .fin-flow.is-in,
  .led-flow-pos
) {
  color: #0d6b2f !important;
  opacity: 1 !important;
}
#grid-wrap :where(
  .fin-flow.is-out,
  .finance-metric-value.fin-flow.is-out,
  strong > .fin-flow.is-out
) {
  color: #8f1212 !important;
  opacity: 1 !important;
}
#grid-wrap :where(button.del, .del) {
  color: #8f1212 !important;
  background: color-mix(in srgb, #d11 14%, var(--tg-theme-bg-color, #fff)) !important;
  border-color: transparent !important;
}
html[data-theme="dark"] #grid-wrap :where(
  .fin-flow.is-in,
  .finance-metric-value.fin-flow.is-in,
  strong > .fin-flow.is-in,
  .led-flow-pos
) {
  color: #8af0c4 !important;
}
html[data-theme="dark"] #grid-wrap :where(
  .fin-flow.is-out,
  .finance-metric-value.fin-flow.is-out,
  strong > .fin-flow.is-out,
  button.del,
  .del
) {
  color: #ff8e8e !important;
}
html[data-theme="dark"] #grid-wrap :where(button.del, .del) {
  background: color-mix(in srgb, #d11 22%, transparent) !important;
}

/* AML hub + storefront: muted ink AA (axe-gated on the project matrix).
 Settings help body was the leftover hole; summary stays accent-ink. */
#aml-pack-modal :where(
  dt,
  .aml-hub-balance small,
  .aml-pack-card small,
  .aml-hub section p,
  .fin, .hint, .muted, small
) {
  color: var(--ui-muted-strong) !important;
  opacity: 1 !important;
}
#market-storefront :where(
  .sf-sync-state,
  .sf-price-row > span,
  .ecosystem-field-row > label,
  .is-danger > span,
  .is-debt,
  small, .fin, .hint, .muted
) {
  color: var(--ui-muted-strong) !important;
  opacity: 1 !important;
}
#deals-cards :where(
  .deals-ctx,
  .dc-badge-note,
  .dc-debt-native,
  .dc-sub,
  .dc-feed-status,
  .dc-feed-flag,
  .dc-feed-head time,
  .dc-feed-client,
  .pager-label,
  .pager-range,
  small, .fin, .hint, .muted
) {
  color: var(--ui-muted-strong) !important;
  opacity: 1 !important;
}
/* .fin is nowrap + overflow-x:auto; pager chips then fail scrollable-region-focusable. */
#deals-cards :where(.pager-label, .pager-range) {
  overflow: visible !important;
}
#deals-cards :where(.dc-leg-in > b, .dc-leg-in > b > em) {
  color: #0a5c28 !important;
  opacity: 1 !important;
}
#deals-cards :where(.dc-leg-out > b, .dc-leg-out > b > em) {
  color: #3d4bb8 !important;
  opacity: 1 !important;
}
#deals-cards .dc-feed-profit.is-positive, #zones-modal .set-pos { color: #0a5c28 !important; }
#deals-cards .dc-feed-profit.is-negative { color: #8f1212 !important; }
html[data-theme="dark"] #deals-cards :where(.dc-leg-in > b, .dc-leg-in > b > em) {
  color: #8af0c4 !important;
}
html[data-theme="dark"] #deals-cards :where(.dc-leg-out > b, .dc-leg-out > b > em) {
  color: #b8c0ff !important;
}
html[data-theme="dark"] #deals-cards .dc-feed-profit.is-positive, html[data-theme="dark"] #zones-modal .set-pos { color: #8af0c4 !important; }
html[data-theme="dark"] #deals-cards .dc-feed-profit.is-negative { color: #ff8e8e !important; }
.set-more-help > summary {
  color: var(--ui-accent-ink) !important;
}
.set-more-help :where(p, li, td, th, small, span, .fin, .hint, .muted) {
  color: var(--ui-muted-strong) !important;
  opacity: 1 !important;
}

/* Lite compact deal form: kicker must pass WCAG AA on modal secondary bg. */
#litedeal-card .ld-kicker {
  color: var(--ui-muted-strong) !important;
  opacity: 1 !important;
}

/* Nested modal muted ink → ui-unification_contrast_nested.css. */

