/* Theme contracts. Fallbacks in component CSS preserve the existing light palette. */
.bx-theme-switcher {
  display: inline-flex; align-items: center; gap: .4rem; margin: 0;
  min-inline-size: 0; color: #f2fffc; font-weight: 600;
}
.bx-theme-switcher svg { inline-size: 20px; block-size: 20px; flex: 0 0 20px; fill: currentColor; }
body.blackx-identity .blackx-topbar .bx-theme-switcher select {
  inline-size: auto; min-inline-size: 0; max-inline-size: 10rem; min-block-size: 44px;
  padding: .5rem .65rem; border: 1px solid #647d70; border-radius: 10px;
  background: #152b23; color: #f2fffc !important; box-shadow: none; color-scheme: dark;
  font-size: .82rem;
}
body.blackx-identity .blackx-topbar .bx-theme-switcher option { background: #152b23 !important; color: #f2fffc !important; }
.bx-theme-switcher select:focus-visible { outline: 2px solid #86ebcd; outline-offset: 2px; }
/* Bright workflow actions own a dark foreground in both appearances. */
.axs-studio .axs-button--publish,
.axs-workspace-tabs button[aria-current="page"] { --bx-button-color: #06261d; }
@media (max-width: 540px) {
  .bx-theme-switcher svg { display: none; }
  body.blackx-identity .blackx-topbar .bx-theme-switcher select { max-inline-size: 7rem; padding-inline: .35rem; font-size: .75rem; }
  .blackx-topbar__actions { gap: .35rem; }
}

@media screen {
  html[data-bx-theme="dark"] {
    color-scheme: dark;
    --bx-theme-surface: #17231f; --bx-theme-surface-rgb: 23, 35, 31;
    --bx-theme-raised: #20302a; --bx-theme-raised-rgb: 32, 48, 42;
    --bx-theme-strong: #f3faf6; --bx-theme-muted: #adbfB5; --bx-theme-link: #86ebcd;
    --bx-theme-strong-rgb: 243, 250, 246; --bx-theme-muted-rgb: 173, 191, 181; --bx-theme-link-rgb: 134, 235, 205;
    --bx-theme-border: #647d70; --bx-theme-border-rgb: 100, 125, 112;
    --bx-theme-danger-text: #ffb4bd; --bx-theme-danger-text-rgb: 255, 180, 189;
    --bx-theme-warning-text: #f3cc83; --bx-theme-warning-text-rgb: 243, 204, 131;
    --bx-theme-info-text: #a6d8f0; --bx-theme-info-text-rgb: 166, 216, 240;
    --bx-theme-success-surface: #18392d; --bx-theme-success-surface-rgb: 24, 57, 45;
    --bx-theme-danger-surface: #44252c; --bx-theme-danger-surface-rgb: 68, 37, 44;
    --bx-theme-warning-surface: #3b3221; --bx-theme-warning-surface-rgb: 59, 50, 33;
    --bx-theme-info-surface: #1c3340; --bx-theme-info-surface-rgb: 28, 51, 64;
    --bx-canvas: #101a18; --bx-canvas-deep: #0c1411;
    --bx-surface: var(--bx-theme-surface);
    --bx-surface-muted: var(--bx-theme-raised); --card-bg: var(--bx-theme-surface);
    --bx-surface-glass: rgba(23, 35, 31, .96); --bx-surface-glass-strong: rgba(23, 35, 31, .98);
    --bx-text: #e3eee8; --bx-text-strong: var(--bx-theme-strong);
    --bx-text-muted: var(--bx-theme-muted); --bx-text-subtle: #95aca0;
    --bx-text-on-light: var(--bx-text); --bx-text-on-light-strong: var(--bx-text-strong); --bx-text-on-light-muted: var(--bx-text-muted);
    --bx-success: #86ebcd; --bx-warning: #f3cc83; --bx-info: #a6d8f0;
    --bx-border: rgba(100, 125, 112, .65); --bx-border-soft: rgba(100, 125, 112, .4);
    --bx-border-color: var(--bx-border); --border-color: var(--bx-border);
    --bx-highlight: #86ebcd; --bx-highlight-rgb: 134, 235, 205;
    --bx-shadow-xs: 0 3px 10px rgb(0 0 0 / .12); --bx-shadow-sm: 0 8px 22px rgb(0 0 0 / .18);
    --bx-shadow-md: 0 16px 36px rgb(0 0 0 / .22); --bx-shadow-lg: 0 24px 56px rgb(0 0 0 / .3);
    --bx-focus-ring: 0 0 0 3px rgb(134 235 205 / .18), 0 0 0 1px #86ebcd;
    --bx-control-surface: var(--bx-theme-surface); --bx-control-text: var(--bx-text);
    --bx-control-label: var(--bx-theme-muted); --bx-control-line: var(--bx-theme-border);
    --rx-ink: var(--bx-text); --rx-muted: var(--bx-text-muted); --rx-paper: var(--bx-canvas);
    --rx-card: var(--bx-surface); --rx-line: var(--bx-border); --rx-shadow: var(--bx-shadow-sm);
    --rx-amber: var(--bx-theme-warning-text); --rx-red: var(--bx-theme-danger-text); --rx-blue: var(--bx-theme-info-text);
    --ax-ink: var(--bx-text); --ax-muted: var(--bx-text-muted); --ax-paper: var(--bx-canvas);
    --ax-panel: var(--bx-surface); --ax-line: var(--bx-border); --ax-line-strong: #647d70;
    --ax-green-soft: #18392d; --ax-cyan-soft: #1c3340; --ax-amber-soft: #3b3221; --ax-red-soft: #44252c;
    --ax-shadow: var(--bx-shadow-sm);
  }
  html[data-bx-theme="dark"] body.blackx-identity {
    background: radial-gradient(circle at 10% 0%, rgb(38 215 145 / .035), transparent 26rem), var(--bx-canvas);
    color: var(--bx-text);
  }
  html[data-bx-theme="dark"] body.blackx-identity .bx-form {
    --bx-control-accent: #86ebcd; --bx-text-strong: var(--bx-theme-strong);
    --bx-text-on-light-strong: var(--bx-theme-strong);
  }
  html[data-bx-theme="dark"] body.blackx-identity .bx-form table {
    --bx-text: #e3eee8; --bx-text-strong: var(--bx-theme-strong); --bx-text-muted: var(--bx-theme-muted);
    --bx-text-on-light: #e3eee8; --bx-text-on-light-strong: var(--bx-theme-strong); --bx-text-on-light-muted: var(--bx-theme-muted);
  }
  html[data-bx-theme="dark"] body.blackx-identity :is(.bx-form, .bx-form__control) { color-scheme: dark; }
  html[data-bx-theme="dark"] body.blackx-identity :is(input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="hidden"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="range"]), select, textarea, .form-control, .form-select, .input-group-text) {
    background: var(--bx-control-surface) !important; color: var(--bx-text) !important;
    border-color: var(--bx-control-line); color-scheme: dark; box-shadow: none;
  }
  html[data-bx-theme="dark"] body.blackx-identity :is(input, select, textarea):focus {
    border-color: #86ebcd !important; box-shadow: var(--bx-focus-ring);
  }
  html[data-bx-theme="dark"] body.blackx-identity :is(input, textarea)::placeholder { color: #adbfB5 !important; opacity: .8; }
  html[data-bx-theme="dark"] body.blackx-identity :is(input, select, textarea):disabled {
    background: #20302a !important; color: #adbfB5 !important; opacity: .8;
  }
  html[data-bx-theme="dark"] body.blackx-identity :is(input, textarea)[readonly] { background: #20302a !important; color: #adbfB5 !important; }
  html[data-bx-theme="dark"] body.blackx-identity select option { background: #17231f !important; color: #e3eee8 !important; }
  html[data-bx-theme="dark"] body.blackx-identity :is([aria-invalid="true"], .is-invalid),
  html[data-bx-theme="dark"] body.blackx-identity :is(.bx-field--invalid, .has-error) :is(input, select, textarea) { border-color: #ffb4bd !important; }
  html[data-bx-theme="dark"] body.blackx-identity :is(.errorlist, .bx-field__errors, .invalid-feedback, .form-error, .media-op-error, .text-danger, .bx-required-marker) { color: #ffb4bd !important; }
  html[data-bx-theme="dark"] body.blackx-identity .text-success { color: #86ebcd !important; }
  html[data-bx-theme="dark"] body.blackx-identity .text-warning { color: #f3cc83 !important; }
  html[data-bx-theme="dark"] body.blackx-identity .text-info { color: #a6d8f0 !important; }
  html[data-bx-theme="dark"] body.blackx-identity :is(.bg-white, .bg-light) { background: var(--bx-theme-surface) !important; }
  html[data-bx-theme="dark"] body.blackx-identity .bx-checkbox,
  html[data-bx-theme="dark"] body.blackx-identity .bx-form tbody .bx-checkbox { --bx-checkbox-line: #86ebcd; }
  html[data-bx-theme="dark"] body.blackx-identity :is(.btn-secondary, .btn-light, .btn-outline, .btn-outline-primary, .btn-outline-secondary, .btn-outline-info, .btn-ghost, .blackx-btn--secondary, .blackx-btn--ghost, .blackx-btn--metal) {
    --bx-button-bg: linear-gradient(180deg, #293c32, #1a2922); --bx-button-color: #e3eee8;
    --bx-button-border: #647d70; background: var(--bx-button-bg); box-shadow: var(--bx-shadow-xs);
  }
  html[data-bx-theme="dark"] body.blackx-identity .bx-form :is(button[type="submit"], button:not([type]), input[type="submit"], .bx-form__submit) {
    --bx-button-color: #e3eee8; background: #293c32 !important;
  }
  html[data-bx-theme="dark"] body.blackx-identity .bx-form :is(button[type="submit"], button:not([type]), input[type="submit"]):hover:not(:disabled) {
    --bx-button-color: #f3faf6; background: #344d40 !important; border-color: #86ebcd !important;
  }
  html[data-bx-theme="dark"] body.blackx-identity .bx-form :is(.btn-danger, .blackx-btn--danger, [data-blackx-danger])[type="submit"] {
    --bx-button-color: #fff; background: #8c0e22 !important; border-color: #ffb4bd !important;
  }
  html[data-bx-theme="dark"] body.blackx-identity :is(.btn, .blackx-btn, button, summary, a, [tabindex]):focus-visible {
    outline: 2px solid #86ebcd; outline-offset: 3px;
  }
  html[data-bx-theme="dark"] .bx-guide { --guide-ink: #e3eee8; --guide-muted: #adbfB5; --guide-line: #647d70; }
  html[data-bx-theme="dark"] .axs-studio { --axs-ink: #e3eee8; --axs-muted: #adbfB5; --axs-line: #647d70; }
  html[data-bx-theme="dark"] .axo-surface { --axo-line: #647d70; --axo-green: #86ebcd; color: #e3eee8; }
  html[data-bx-theme="dark"] .rx-operating-strip { background: #17312d; }
  html[data-bx-theme="dark"] .ax-governance-strip { background: #10241f; }
  html[data-bx-theme="dark"] .ax-step-marker > span { background: #10241f; }
  html[data-bx-theme="dark"] :is(.rx-eyebrow, .rx-drill, .rx-worknav a:hover) { color: #86ebcd; }
  html[data-bx-theme="dark"] .axs-modal { --axs-ink: #e3eee8; --axs-muted: #adbfB5; --axs-line: #647d70; }
  html[data-bx-theme="dark"] .react-flow {
    --xy-background-color: #17231f; --xy-background-color-default: #17231f;
    --xy-controls-button-background-color-default: #20302a; --xy-controls-button-color-default: #e3eee8;
    --xy-controls-button-background-color-hover-default: #344d40; --xy-controls-button-border-color-default: #647d70;
    --xy-minimap-background-color-default: #20302a; --xy-minimap-mask-background-color-default: rgb(16 26 24 / .55);
    --xy-edge-stroke-default: #95aca0; --xy-background-pattern-dots-color-default: #647d70;
  }
  html[data-bx-theme="dark"] :is(.axs-node-card .react-flow__handle) { border-color: #17231f; background: #86ebcd; }
  html[data-bx-theme="dark"] :is(.axo-dialog-form, .axl-dialog-form) { --axs-ink: #e3eee8; color: #e3eee8; }
  html[data-bx-theme="dark"] :is(.select2-dropdown, .choices__list--dropdown, .ts-dropdown) { background: #17231f; color: #e3eee8; border-color: #647d70; }
  html[data-bx-theme="dark"] :is(.select2-selection__rendered, .choices__item, .ts-control) { color: #e3eee8 !important; }
  html[data-bx-theme="dark"] :is(.select2-selection__choice, .choices__list--multiple .choices__item, .ts-control .item) { background: #20302a !important; color: #e3eee8 !important; border-color: #647d70 !important; }
  html[data-bx-theme="dark"] body.blackx-identity .bx-form :is(.select2-selection, .choices__inner, .ts-control) { color-scheme: dark; }
  html[data-bx-theme="dark"] :is(.select2-results__option--highlighted, .choices__item--selectable.is-highlighted, .ts-dropdown .active) { background: #344d40 !important; color: #f3faf6 !important; }
  html[data-bx-theme="dark"] { scrollbar-color: #647d70 #101a18; }
}
@media print {
  html[data-bx-theme] { color-scheme: light; }
  *, *::before, *::after { transition: none !important; }
  .bx-theme-switcher, .bx-global-loader { display: none !important; }
}
