/*
 * Compatibility guard for feature views that still contain legacy light-only
 * CSS. The root theme selector and targeted !important declarations let
 * Midnight remain readable until each feature stylesheet is fully tokenized.
 */

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body {
  --bs-heading-color: var(--rm-text);
  --bs-secondary-color: var(--rm-text-muted);
  --bs-secondary-bg: var(--rm-surface-soft);
  --bs-tertiary-color: var(--rm-text-muted);
  --bs-tertiary-bg: var(--rm-surface-soft);
  --bs-border-color: var(--rm-border);
  --bs-border-color-translucent: rgba(var(--rm-border-rgb), 0.72);
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .bg-white,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .bg-light,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .alert-light,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .table-light,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .text-bg-light {
  color: var(--rm-text) !important;
  background-color: var(--rm-surface-soft) !important;
  border-color: var(--rm-border) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .text-dark,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .text-body,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .text-body-emphasis {
  color: var(--rm-text) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .text-muted,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .text-secondary,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .text-body-secondary {
  color: var(--rm-text-muted) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .border,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .border-top,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .border-end,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .border-bottom,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .border-start {
  border-color: var(--rm-border) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .card,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .modal-content,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .offcanvas,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .dropdown-menu,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .accordion-item,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .list-group-item,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .popover,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .toast,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body :is(section, article, div, aside)[class$="-card"],
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body :is(section, article, div, aside)[class*="-card "] {
  color: var(--rm-text) !important;
  background: var(--rm-surface-gloss) !important;
  border-color: var(--rm-border) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .card-header,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .card-footer,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .modal-header,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .modal-footer,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .offcanvas-header,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .accordion-button,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body :is(header, footer, div)[class$="-card-header"],
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body :is(header, footer, div)[class*="-card-header "] {
  color: var(--rm-text) !important;
  background: var(--rm-surface-soft) !important;
  border-color: var(--rm-border) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .accordion-button:not(.collapsed) {
  color: var(--rm-accent-strong) !important;
  background: var(--rm-accent-soft) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .page-hero,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .rm-page-header,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .rm-entity-hero,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body :is(section, article, div)[class$="-hero"],
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body :is(section, article, div)[class*="-hero "] {
  color: var(--rm-text) !important;
  background: var(--rm-surface-gloss) !important;
  border-color: var(--rm-border) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .table-responsive,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .rm-table-region,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .rm-table-scroll,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .rm-matrix-scroll,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .dataTables_wrapper,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .rm-dashboard-release-flow-table-wrap {
  color: var(--rm-text) !important;
  background: var(--rm-surface) !important;
  border-color: var(--rm-border) !important;
  box-shadow: var(--rm-shadow-sm) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .table {
  --bs-table-color: var(--rm-text) !important;
  --bs-table-bg: var(--rm-surface) !important;
  --bs-table-border-color: var(--rm-border) !important;
  --bs-table-striped-color: var(--rm-text) !important;
  --bs-table-striped-bg: rgba(var(--rm-accent-rgb), 0.055) !important;
  --bs-table-hover-color: var(--rm-text) !important;
  --bs-table-hover-bg: var(--rm-surface-hover) !important;
  color: var(--rm-text) !important;
  background: var(--rm-surface) !important;
  border-color: var(--rm-border) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .table > :not(caption) > * > * {
  color: var(--rm-text) !important;
  background-color: var(--rm-surface) !important;
  border-color: var(--rm-border) !important;
  box-shadow: none !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .table-striped > tbody > tr:nth-of-type(odd) > * {
  background-color: rgba(var(--rm-accent-rgb), 0.055) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .table-hover > tbody > tr:hover > * {
  color: var(--rm-text) !important;
  background-color: var(--rm-surface-hover) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .table thead th,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .rm-table thead th,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .rm-dashboard-release-flow-table thead th {
  color: #c7d2e8 !important;
  background: var(--rm-surface-soft) !important;
  border-color: var(--rm-border-strong) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .table tfoot th,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .table tfoot td,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .rm-dashboard-release-flow-table tfoot th,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .rm-dashboard-release-flow-table tfoot td {
  color: var(--rm-text) !important;
  background: var(--rm-surface-soft) !important;
  border-color: var(--rm-border-strong) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .table .table-success > *,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .table-success > * {
  color: var(--rm-success-text) !important;
  background: var(--rm-success-bg) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .table .table-warning > *,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .table-warning > * {
  color: var(--rm-warning-text) !important;
  background: var(--rm-warning-bg) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .table .table-danger > *,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .table-danger > * {
  color: var(--rm-danger-text) !important;
  background: var(--rm-danger-bg) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .table .table-info > *,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .table-info > * {
  color: var(--rm-info-text) !important;
  background: var(--rm-info-bg) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .table .table-primary > *,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .table-primary > * {
  color: var(--rm-accent-strong) !important;
  background: var(--rm-accent-soft) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .table .table-secondary > *,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .table-secondary > * {
  color: var(--rm-text-muted) !important;
  background: var(--rm-surface-soft) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .table tbody tr:hover > * {
  box-shadow:
    inset 0 1px 0 rgba(var(--rm-accent-rgb), 0.42),
    inset 0 -1px 0 rgba(var(--rm-accent-rgb), 0.42) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .rm-table-filter-row > th {
  background: #1b263d !important;
  border-color: var(--rm-border) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .form-control,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .form-select,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .input-group-text,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body textarea,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="image"]):not([type="hidden"]),
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body select {
  color: var(--rm-text) !important;
  background-color: #121a2d !important;
  border-color: var(--rm-border-strong) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .form-control::placeholder,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body textarea::placeholder,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body input::placeholder {
  color: #8f9db8 !important;
  opacity: 1;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .form-control:focus,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .form-select:focus,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body textarea:focus,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="image"]):not([type="hidden"]):focus,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body select:focus {
  color: var(--rm-text) !important;
  background-color: #172139 !important;
  border-color: var(--rm-focus-ring) !important;
  box-shadow: 0 0 0 0.2rem rgba(var(--rm-focus-ring-rgb), 0.2) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .btn-light {
  --bs-btn-color: var(--rm-text);
  --bs-btn-bg: var(--rm-surface-soft);
  --bs-btn-border-color: var(--rm-border);
  --bs-btn-hover-color: var(--rm-text);
  --bs-btn-hover-bg: var(--rm-surface-hover);
  --bs-btn-hover-border-color: var(--rm-border-strong);
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .nav-tabs,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .nav-tabs .nav-link {
  border-color: var(--rm-border) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .nav-tabs .nav-link.active {
  color: var(--rm-accent-strong) !important;
  background: var(--rm-surface) !important;
  border-color: var(--rm-border) var(--rm-border) var(--rm-surface) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .rm-dashboard-legend-item,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .rm-dashboard-bar-value,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .rm-dashboard-requestor-legend-item,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .rm-dashboard-requestor-month-value,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .rm-dashboard-requestor-month-label {
  color: var(--rm-text-muted) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .rm-dashboard-requestor-month-stack,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .rm-dashboard-bar-track {
  background: var(--rm-surface-soft) !important;
  border-color: var(--rm-border) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .rm-table-region,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .rm-table-scroll,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .table-responsive {
  scrollbar-color: var(--rm-accent) var(--rm-surface-soft);
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .rm-table-region::-webkit-scrollbar-track,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .rm-table-scroll::-webkit-scrollbar-track,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .table-responsive::-webkit-scrollbar-track {
  background: var(--rm-surface-soft);
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .rm-table-region::-webkit-scrollbar-thumb,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .rm-table-scroll::-webkit-scrollbar-thumb,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .table-responsive::-webkit-scrollbar-thumb {
  background: var(--rm-accent);
  border: 0.2rem solid var(--rm-surface-soft);
  background-clip: padding-box;
}

/* Navigation rails are intentionally flat, not content cards. */
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .release-detail-sidebar-card,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .hotfix-detail-sidebar-card {
  color: var(--rm-text) !important;
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

/* Database migration details still contain a legacy light-only operator shell. */
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .rm-db-migration-details :is(
  .rm-run-shell,
  .rm-run-state-grid,
  .rm-run-tabs,
  .rm-transfer-workspace,
  .rm-transfer-ledger,
  .rm-transfer-ledger-row,
  .rm-transfer-footnote,
  .rm-transfer-sequence,
  .rm-execution-workspace,
  .rm-transfer-panel,
  .rm-transfer-disclosure-body
) {
  color: var(--rm-text) !important;
  background: var(--rm-surface) !important;
  border-color: var(--rm-border) !important;
}

/*
 * Shared execution-workspace bridge. These components pre-date the theme
 * tokens and are reused by the database copy, restore, and migration flows.
 * Keeping the mapping here prevents each execution view from needing its own
 * Graphite/Midnight patch whenever a new task panel is introduced.
 */
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .rm-db-migration-details :is(
  .rm-task-plan-score,
  .rm-task-now-panel,
  .rm-task-summary-tile,
  .rm-task-batch,
  .rm-task-card,
  .rm-task-detail-panel,
  .rm-task-quick-metrics > div
) {
  color: var(--rm-text) !important;
  background: var(--rm-surface-raised) !important;
  border-color: var(--rm-border) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .rm-db-migration-details :is(
  .rm-task-plan-header,
  .rm-execution-state-summary,
  .rm-task-batch-header,
  .rm-task-detail-panel > summary
) {
  color: var(--rm-text) !important;
  background: var(--rm-surface-soft) !important;
  border-color: var(--rm-border) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .rm-db-migration-details :is(
  .rm-task-plan-heading,
  .rm-task-plan-percent,
  .rm-task-summary-tile strong,
  .rm-task-progress-text strong,
  .rm-execution-state-summary strong,
  .rm-task-name,
  .rm-task-quick-metrics strong,
  .rm-task-detail-panel > summary,
  .rm-task-substeps > summary
) {
  color: var(--rm-text) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .rm-db-migration-details :is(
  .rm-section-kicker,
  .rm-task-summary-tile span,
  .rm-task-now-label,
  .rm-task-progress-text,
  .rm-execution-state-summary,
  .rm-task-quick-metrics span
) {
  color: var(--rm-text-muted) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .rm-db-migration-details :is(
  .rm-task-card,
  .rm-task-current,
  .rm-task-detail-panel[open] > summary,
  .rm-core-step-row,
  .rm-task-quick-metrics,
  .rm-task-quick-metrics > div + div,
  .rm-task-stats > div,
  .rm-execution-state-summary > span + span
) {
  border-color: var(--rm-border) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .rm-db-migration-details .rm-task-step-marker {
  color: var(--rm-accent-strong) !important;
  background: var(--rm-accent-soft) !important;
  border: 1px solid var(--rm-border-strong) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .rm-db-migration-details .rm-task-state-active {
  color: var(--rm-info-text) !important;
  background: var(--rm-info-bg) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .rm-db-migration-details .rm-task-state-waiting {
  color: var(--rm-warning-text) !important;
  background: var(--rm-warning-bg) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .rm-db-migration-details .rm-task-state-failed {
  color: var(--rm-danger-text) !important;
  background: var(--rm-danger-bg) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .rm-db-migration-details .rm-task-state-muted,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .rm-db-migration-details .rm-task-batch.is-collapsed,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .rm-db-migration-details .rm-task-batch.is-collapsed .rm-task-batch-header {
  color: var(--rm-text-muted) !important;
  background: var(--rm-surface-soft) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .rm-db-migration-details :is(
  .rm-run-state-grid,
  .rm-transfer-disclosure-body,
  .rm-transfer-footnote
) {
  background: var(--rm-surface-soft) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .rm-db-migration-details :is(
  .rm-run-header h1,
  .rm-run-current-state strong,
  .rm-run-time-state strong,
  .rm-run-state-line strong,
  .rm-transfer-workspace-head h2,
  .rm-transfer-operation strong,
  .rm-transfer-footnote strong,
  .rm-transfer-panel-head h3
) {
  color: var(--rm-text) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .rm-db-migration-details :is(
  .rm-run-kicker,
  .rm-run-route,
  .rm-run-state-label,
  .rm-run-state-caption,
  .rm-transfer-workspace-head p,
  .rm-transfer-summary,
  .rm-transfer-operation small,
  .rm-transfer-duration,
  .rm-transfer-disclosure > summary
) {
  color: var(--rm-text-muted) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .rm-db-migration-details .rm-run-progress-state .progress {
  background: var(--rm-surface-hover) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .rm-db-migration-details .rm-run-status-success {
  color: var(--rm-success-text) !important;
  background: var(--rm-success-bg) !important;
  border-color: var(--rm-success-border) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .rm-db-migration-details .rm-run-status-danger {
  color: var(--rm-danger-text) !important;
  background: var(--rm-danger-bg) !important;
  border-color: var(--rm-danger-border) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .rm-db-migration-details .rm-run-status-warning {
  color: var(--rm-warning-text) !important;
  background: var(--rm-warning-bg) !important;
  border-color: var(--rm-warning-border) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .rm-db-migration-details :is(
  .rm-run-status-active,
  .rm-run-status-info
) {
  color: var(--rm-info-text) !important;
  background: var(--rm-info-bg) !important;
  border-color: var(--rm-info-border) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .rm-db-migration-details .rm-run-status-muted {
  color: var(--rm-text-muted) !important;
  background: var(--rm-surface-soft) !important;
  border-color: var(--rm-border) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .rm-db-migration-details :is(
  .rm-run-notice,
  .rm-run-decision,
  .rm-transfer-empty,
  .rm-attention-row,
  .rm-log-toolbar,
  .rm-task-row
) {
  color: var(--rm-text) !important;
  background: var(--rm-surface-soft) !important;
  border-color: var(--rm-border) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .rm-db-migration-details :is(
  .rm-run-notice strong,
  .rm-run-decision strong,
  .rm-transfer-disclosure-body p,
  .rm-transfer-disclosure-body li
) {
  color: var(--rm-text) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .rm-db-migration-details :is(
  .rm-run-notice span,
  .rm-run-decision span,
  .rm-transfer-operation strong span,
  .rm-run-arrow
) {
  color: var(--rm-text-muted) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .rm-db-migration-details .rm-transfer-sequence {
  color: var(--rm-text-muted) !important;
  background: var(--rm-surface) !important;
  border-color: var(--rm-border-strong) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .rm-db-migration-details .rm-transfer-success .rm-transfer-state {
  color: var(--rm-success-text) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .rm-db-migration-details .rm-transfer-failed .rm-transfer-state {
  color: var(--rm-danger-text) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .rm-db-migration-details .rm-transfer-running .rm-transfer-state {
  color: var(--rm-info-text) !important;
}

/* Release Planner still ships legacy light-only feature surfaces. */
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body [data-sds-plan-root] :is(
  .sds-plan-list,
  .sds-plan-builder,
  .sds-plan-region-toolbar,
  .sds-plan-clone-toolbar,
  .sds-plan-table-wrap,
  .sds-plan-execution-item,
  .sds-plan-execution-item-details-body
) {
  color: var(--rm-text) !important;
  background: var(--rm-surface) !important;
  border-color: var(--rm-border) !important;
  box-shadow: var(--rm-shadow-sm) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body [data-sds-plan-root] :is(
  .sds-plan-list,
  .sds-plan-region-toolbar,
  .sds-plan-clone-toolbar
) {
  background: var(--rm-surface-soft) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body [data-sds-plan-root] .sds-plan-list-item {
  color: var(--rm-text) !important;
  background: var(--rm-surface-raised) !important;
  border-color: var(--rm-border) !important;
  box-shadow: none !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body [data-sds-plan-root] .sds-plan-list-item:hover {
  color: var(--rm-text) !important;
  background: var(--rm-surface-hover) !important;
  border-color: var(--rm-border-strong) !important;
  transform: none !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body [data-sds-plan-root] .sds-plan-list-item.active {
  color: var(--rm-accent-strong) !important;
  background: var(--rm-accent-soft) !important;
  border-color: var(--rm-accent) !important;
  box-shadow: inset 3px 0 0 var(--rm-accent) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body [data-sds-plan-root] :is(
  .sds-plan-list-name,
  .sds-panel-title,
  .sds-field .form-label,
  .sds-plan-region-toolbar .form-label,
  .sds-plan-clone-replace .form-check-label
) {
  color: var(--rm-text) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body [data-sds-plan-root] :is(
  .sds-plan-list-meta,
  .sds-plan-visibility-hint,
  .sds-plan-execution-summary
) {
  color: var(--rm-text-muted) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body [data-sds-plan-root] .sds-plan-clone-title {
  color: var(--rm-info-text) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body [data-sds-plan-root] .sds-plan-region-chip {
  color: var(--rm-accent-strong) !important;
  background: var(--rm-surface) !important;
  border-color: var(--rm-border-strong) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body [data-sds-plan-root] .sds-plan-region-chip:hover {
  color: var(--rm-text) !important;
  background: var(--rm-surface-hover) !important;
  border-color: var(--rm-accent) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body [data-sds-plan-root] .sds-plan-region-chip.active {
  color: var(--rm-on-accent) !important;
  background: var(--rm-accent) !important;
  border-color: var(--rm-accent) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body [data-sds-plan-root] .sds-plan-table thead th {
  color: var(--rm-text-muted) !important;
  background: var(--rm-surface-soft) !important;
  border-color: var(--rm-border-strong) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body [data-sds-plan-root] .sds-plan-table tbody td {
  color: var(--rm-text) !important;
  background: var(--rm-surface) !important;
  border-color: var(--rm-border) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body [data-sds-plan-root] .sds-plan-table tbody tr:nth-child(even) td {
  background: var(--rm-surface-raised) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body [data-sds-plan-root] .sds-plan-table tbody tr:hover td {
  background: var(--rm-surface-hover) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body [data-sds-plan-root] .sds-plan-pager-status {
  color: var(--rm-text-muted) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body [data-sds-plan-root] :is(
  .sds-plan-table .form-select,
  .sds-plan-table .form-control,
  .sds-plan-payload
) {
  color: var(--rm-text) !important;
  background: #121a2d !important;
  border-color: var(--rm-border-strong) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body [data-sds-plan-root] .sds-plan-execution {
  border-color: var(--rm-border) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body [data-sds-plan-root] .sds-plan-execution-results {
  border-color: var(--rm-border) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body [data-sds-plan-root] .sds-plan-execution-item-details-body {
  color: var(--rm-danger-text) !important;
  background: var(--rm-danger-bg) !important;
  border-color: var(--rm-danger-border) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body [data-sds-plan-root].sds-plan-focus-mode :is(
  .sds-plan-builder,
  .sds-panel
) {
  border-color: var(--rm-border-strong) !important;
  box-shadow: var(--rm-shadow-md) !important;
}

/* Completed hotfix impact reports were originally authored as a light-only
   document. Keep every report section readable in both dark workspace themes. */
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body :is(
  .hotfix-impact-document,
  .hotfix-impact-ticket-detail,
  .hotfix-impact-list-section,
  .hotfix-impact-table,
  .hotfix-impact-accordion-body
) {
  color: var(--rm-text) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body :is(
  .hotfix-impact-document-title,
  .hotfix-impact-field-value,
  .hotfix-impact-section-title,
  .hotfix-impact-highlight-value,
  .hotfix-impact-scope-title,
  .hotfix-impact-scope-subtitle,
  .hotfix-impact-major-point-value,
  .hotfix-impact-meta-value,
  .hotfix-impact-accordion-summary strong
) {
  color: var(--rm-text) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body :is(
  .hotfix-impact-document-intro,
  .hotfix-impact-scope-label,
  .hotfix-impact-table-label,
  .hotfix-impact-empty-value,
  .hotfix-impact-highlight-text,
  .hotfix-impact-major-point-label,
  .hotfix-impact-validation-detail
) {
  color: var(--rm-text-muted) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body :is(
  .hotfix-impact-qa-launch,
  .hotfix-impact-filter-empty,
  .hotfix-impact-highlight,
  .hotfix-impact-scope,
  .hotfix-impact-major-point,
  .hotfix-impact-meta-card,
  .hotfix-impact-check-panel,
  .hotfix-impact-validation-panel,
  .hotfix-impact-validation-check,
  .hotfix-impact-checked-log-item,
  .hotfix-impact-raw-report,
  .hotfix-impact-raw-report summary
) {
  color: var(--rm-text) !important;
  background: var(--rm-surface-raised) !important;
  border-color: var(--rm-border) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .hotfix-impact-scope:hover,
html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .hotfix-impact-accordion-button:hover {
  color: var(--rm-text) !important;
  background: var(--rm-surface-hover) !important;
  border-color: var(--rm-border-strong) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .hotfix-impact-table-wrap {
  color: var(--rm-text) !important;
  background: var(--rm-surface) !important;
  border-color: var(--rm-border-strong) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .hotfix-impact-table th {
  color: var(--rm-text-muted) !important;
  background: var(--rm-surface-soft) !important;
  border-color: var(--rm-border-strong) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .hotfix-impact-table td {
  color: var(--rm-text) !important;
  background: var(--rm-surface) !important;
  border-color: var(--rm-border-strong) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .hotfix-impact-review-table tr.is-attention td {
  color: var(--rm-danger-text) !important;
  background: var(--rm-danger-bg) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .hotfix-impact-accordion-button::after {
  color: var(--rm-text-muted) !important;
  background: var(--rm-surface-soft) !important;
  border-color: var(--rm-border-strong) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .hotfix-impact-accordion-button[aria-expanded="true"]::after {
  color: var(--rm-accent-strong) !important;
  background: var(--rm-accent-soft) !important;
  border-color: var(--rm-accent) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .hotfix-impact-accordion-summary span {
  color: var(--rm-text-muted) !important;
  background: var(--rm-surface-soft) !important;
  border-color: var(--rm-border) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .hotfix-impact-accordion-body {
  border-color: var(--rm-border) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .hotfix-impact-text-mark.is-jira {
  color: var(--rm-accent-strong) !important;
  background: var(--rm-accent-soft) !important;
  border-color: var(--rm-accent) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .hotfix-impact-text-mark.is-pr {
  color: var(--rm-info-text) !important;
  background: var(--rm-info-bg) !important;
  border-color: var(--rm-info-border) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .hotfix-impact-text-mark.is-code {
  color: var(--rm-neutral-text) !important;
  background: var(--rm-neutral-bg) !important;
  border-color: var(--rm-neutral-border) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .hotfix-impact-text-mark.is-signal {
  color: var(--rm-warning-text) !important;
  background: var(--rm-warning-bg) !important;
  border-color: var(--rm-warning-border) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body :is(
  .hotfix-impact-highlight.is-danger,
  .hotfix-impact-major-point.is-danger,
  .hotfix-impact-check-panel.is-danger,
  .hotfix-impact-validation-check.is-attention,
  .hotfix-impact-checked-log-item.is-attention,
  .hotfix-impact-missing-list
) {
  color: var(--rm-danger-text) !important;
  background: var(--rm-danger-bg) !important;
  border-color: var(--rm-danger-border) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body :is(
  .hotfix-impact-highlight.is-warning,
  .hotfix-impact-major-point.is-warning,
  .hotfix-impact-major-point.is-performance-required,
  .hotfix-impact-meta-card.is-warning,
  .hotfix-impact-check-panel.is-warning
) {
  color: var(--rm-warning-text) !important;
  background: var(--rm-warning-bg) !important;
  border-color: var(--rm-warning-border) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body :is(
  .hotfix-impact-highlight.is-info,
  .hotfix-impact-major-point.is-info,
  .hotfix-impact-major-point.is-mobile,
  .hotfix-impact-meta-card.is-info
) {
  color: var(--rm-info-text) !important;
  background: var(--rm-info-bg) !important;
  border-color: var(--rm-info-border) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body :is(
  .hotfix-impact-highlight.is-success,
  .hotfix-impact-major-point.is-success
) {
  color: var(--rm-success-text) !important;
  background: var(--rm-success-bg) !important;
  border-color: var(--rm-success-border) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .hotfix-impact-pill.is-danger {
  color: var(--rm-danger-text) !important;
  background: var(--rm-danger-bg) !important;
  border-color: var(--rm-danger-border) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body :is(
  .hotfix-impact-pill.is-warning,
  .hotfix-impact-pill.is-performance-required
) {
  color: var(--rm-warning-text) !important;
  background: var(--rm-warning-bg) !important;
  border-color: var(--rm-warning-border) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body :is(
  .hotfix-impact-pill.is-info,
  .hotfix-impact-pill.is-mobile
) {
  color: var(--rm-info-text) !important;
  background: var(--rm-info-bg) !important;
  border-color: var(--rm-info-border) !important;
}

html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body .hotfix-impact-pill.is-success {
  color: var(--rm-success-text) !important;
  background: var(--rm-success-bg) !important;
  border-color: var(--rm-success-border) !important;
}

@media (prefers-reduced-motion: reduce) {
  html:is([data-rm-theme="midnight"], [data-rm-theme="graphite"]) body * {
    transition-duration: 0.01ms !important;
  }
}
