.v2-root.dark-mode,
.dark-mode {
  --v2-bg: #1f2937;
  --v2-surface: #374151;
  --v2-chrome: #111827;
  --v2-text: #ffffff;
  --v2-text-secondary: #878d97;
  --v2-border: rgba(255, 255, 255, 0.15);
  --v2-border-strong: #555d6b;
  --v2-accent: #2298d5;
  --v2-navy: #0e3d55;
  --v2-navy-mid: #145b80;
  --v2-input-bg: #374151;
  --v2-control-bg: #1c1f26;
  --v2-segment-active-bg: #18587a;
  --v2-action-bg: #a7d6ee;
  --v2-action-color: rgba(0, 0, 0, 0.8);
  --v2-action-hover: #8ec8e6;
  --v2-plot-header-bg: #0e3d55;
  --v2-dropdown-bg: #1c1f26;
  --v2-dropdown-border: rgba(255, 255, 255, 0.15);
  --v2-dropdown-text: #ffffff;
  --v2-dropdown-placeholder: rgba(255, 255, 255, 0.4);
  --v2-dropdown-menu-bg: #1c1f26;
  --v2-dropdown-option-hover: rgba(24, 88, 122, 0.55);
  --v2-dropdown-option-selected: #18587a;
  --v2-shimmer-1: #2b3340;
  --v2-shimmer-2: #374151;
  --v2-shimmer-header-1: #0e3d55;
  --v2-shimmer-header-2: #145b80;
  --v2-page-tint: transparent;
  --v2-row-stripe: rgba(0, 0, 0, 0.15);
  --v2-danger-bg: rgba(239, 68, 68, 0.16);
  --v2-danger-border: #ef4444;
  --v2-warning: #fbbf24;
  --v2-grid-line: #4b5462;
}

.v2-root.dark-mode,
body:has(.v2-root.dark-mode),
body.dark-mode {
  background: var(--v2-bg);
  color: var(--v2-text);
}

html.pvt-theme-switching,
html.pvt-theme-switching body,
html.pvt-theme-switching #v2-root,
html.pvt-theme-switching #v2-root *:not(.js-plotly-plot):not(.js-plotly-plot *) {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease,
    fill 0.3s ease, filter 0.3s ease;
}

/* Surfaces */
.v2-root.dark-mode .v2-card,
.v2-root.dark-mode .v2-plot-card,
.v2-root.dark-mode .v2-progress-section,
.v2-root.dark-mode .v2-empty-state,
.v2-root.dark-mode .v2-toolbar-card {
  background: var(--v2-surface) !important;
  border-color: var(--v2-border);
  color: var(--v2-text);
}
.v2-root.dark-mode .v2-excel-summary {
  background: transparent !important;
  border: none !important;
  color: var(--v2-text);
}

.v2-root.dark-mode .v2-subpage-toolbar {
  background: var(--v2-chrome) !important;
  border-color: var(--v2-border) !important;
  color: var(--v2-text);
}

.v2-root.dark-mode .v2-section-title,
.v2-root.dark-mode .v2-field-label,
.v2-root.dark-mode .v2-progress-label,
.v2-root.dark-mode .v2-model-list-col-title {
  color: var(--v2-text);
}

.v2-root.dark-mode .v2-back-text {
  color: var(--v2-text);
}

.v2-root.dark-mode .v2-field-label {
  color: var(--v2-text-secondary);
}

.v2-root.dark-mode .v2-muted,
.v2-root.dark-mode .v2-list-empty,
.v2-root.dark-mode .v2-progress-detail {
  color: var(--v2-text-secondary);
}

.v2-root.dark-mode .v2-progress-section--failed {
  border-color: rgba(239, 68, 68, 0.45);
}
.v2-root.dark-mode .v2-progress-section--failed .v2-progress-label-strong,
.v2-root.dark-mode .v2-progress-section--failed .v2-progress-detail {
  color: #fca5a5;
}
.v2-root.dark-mode .v2-progress-section--done {
  border-color: rgba(74, 222, 128, 0.4);
}
.v2-root.dark-mode .v2-progress-section--done .v2-progress-label-strong {
  color: #86efac;
}
.v2-root.dark-mode .v2-progress-dismiss {
  border-color: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.7);
}
.v2-root.dark-mode .v2-progress-dismiss:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.06);
}

.v2-root.dark-mode .v2-list-empty {
  color: var(--v2-text);
}

/* Upload */
.v2-root.dark-mode .v2-upload-box {
  background: var(--v2-input-bg) !important;
  border-color: var(--v2-border-strong) !important;
  border-style: dashed !important;
}

.v2-root.dark-mode .v2-upload-drop-copy,
.v2-root.dark-mode .v2-upload-drop-types {
  color: var(--v2-text-secondary);
}

.v2-root.dark-mode .v2-upload-drop-title {
  color: #ffffff;
}

.v2-root.dark-mode .v2-upload-drop-title a,
.v2-root.dark-mode .v2-upload-browse-link,
.v2-root.dark-mode .v2-upload-browse {
  color: var(--v2-accent) !important;
}

.v2-root.dark-mode .v2-upload-uploaded-badge,
.v2-root.dark-mode .v2-upload-selected-badge,
.v2-root.dark-mode .v2-upload-excel-preview {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
  color: var(--v2-text);
}

.v2-root.dark-mode .v2-upload-excel-preview:hover .v2-upload-excel-hint {
  color: #a7d6ee;
}

.v2-root.dark-mode .v2-upload-excel-img {
  background: transparent;
}

.v2-root.dark-mode .v2-home-run-field-label {
  color: var(--v2-text-secondary);
}

/* Segmented controls */
.v2-root.dark-mode .v2-segmented .form-check-label {
  border-color: var(--v2-border) !important;
  color: #ffffff !important;
  background: transparent !important;
}

.v2-root.dark-mode .v2-segmented .form-check-input:checked + .form-check-label {
  background: var(--v2-segment-active-bg) !important;
  color: #ffffff !important;
  font-weight: 500;
  border-color: var(--v2-segment-active-bg) !important;
}

/* Primary actions — override Bootstrap .btn */
.v2-root.dark-mode .v2-action-btn,
.v2-root.dark-mode .v2-upload-btn,
.v2-root.dark-mode .btn.v2-action-btn,
.v2-root.dark-mode .btn.v2-upload-btn,
.v2-root.dark-mode a.v2-action-link .v2-action-btn,
.v2-root.dark-mode a.v2-action-link .btn {
  background: var(--v2-action-bg) !important;
  border: none !important;
  color: var(--v2-action-color) !important;
  box-shadow: none !important;
}

.v2-root.dark-mode .v2-action-btn:hover,
.v2-root.dark-mode .v2-upload-btn:hover,
.v2-root.dark-mode .btn.v2-action-btn:hover,
.v2-root.dark-mode a.v2-action-link .v2-action-btn:hover {
  background: var(--v2-action-hover) !important;
  color: var(--v2-action-color) !important;
}

.v2-root.dark-mode .v2-btn-secondary {
  background: transparent !important;
  border: 1px solid var(--v2-border) !important;
  color: #fff !important;
}

.v2-root.dark-mode .v2-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.06) !important;
  color: #fff !important;
}

.v2-root.dark-mode .v2-back-btn {
  color: #ffffff;
}

.v2-root.dark-mode .v2-back-btn:hover {
  color: #a7d6ee;
}

/* Plot chrome */
.v2-root.dark-mode .v2-plot-card-header {
  background: var(--v2-plot-header-bg);
  color: #ffffff;
}

.v2-root.dark-mode .v2-plot-card-title {
  color: #ffffff;
}

.v2-root.dark-mode .v2-busy-overlay {
  background: rgba(0, 0, 0, 0.45);
}
.v2-root.dark-mode .v2-busy-card {
  background: var(--v2-surface);
  color: #ffffff;
  border-color: var(--v2-border);
}


/* Manage model table */
.v2-root.dark-mode .v2-manage-model-workspace {
  background: var(--v2-surface) !important;
  border-color: var(--v2-border) !important;
}
.v2-root.dark-mode .v2-model-list-header-row {
  background: var(--v2-navy) !important;
  border-color: transparent;
}
.v2-root.dark-mode .v2-model-list-header-row .v2-model-list-col-title {
  color: #ffffff;
}
.v2-root.dark-mode .v2-model-list-row {
  border-color: var(--v2-border);
  color: #ffffff;
  background: #1a232f !important;
}
.v2-root.dark-mode .v2-model-list-row-stripe {
  background: #161e28 !important;
}
.v2-root.dark-mode .v2-model-list-row-selected {
  background: #1a232f !important;
}
.v2-root.dark-mode .v2-model-list-primary,
.v2-root.dark-mode .v2-model-list-col {
  color: #ffffff;
}
.v2-root.dark-mode .v2-model-list-secondary {
  color: var(--v2-text-secondary);
}
.v2-root.dark-mode .v2-model-list-row-last-run .v2-model-list-col-last-run {
  color: #a7d6ee;
}

.v2-root.dark-mode .v2-mm-inline-detail {
  background: var(--v2-bg) !important;
  border-color: var(--v2-border);
}
.v2-root.dark-mode .v2-mm-inline-detail-title {
  color: #ffffff;
}
.v2-root.dark-mode .v2-mm-inline-col {
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  box-shadow: none !important;
}
.v2-root.dark-mode .v2-mm-inline-col-builder {
  background: #204e41 !important;
  border-color: rgba(102, 187, 106, 0.22) !important;
}
.v2-root.dark-mode .v2-mm-inline-col-lump {
  background: #544d33 !important;
  border-color: rgba(255, 193, 7, 0.2) !important;
}
.v2-root.dark-mode .v2-mm-inline-col-runner {
  background: #1f435d !important;
  border-color: rgba(100, 181, 246, 0.22) !important;
}
.v2-root.dark-mode .v2-mm-inline-col-label,
.v2-root.dark-mode .v2-mm-inline-block-title {
  color: rgba(255, 255, 255, 0.92);
}
.v2-root.dark-mode .v2-mm-inline-field-label,
.v2-root.dark-mode .v2-mm-inline-lump-label {
  color: rgba(255, 255, 255, 0.55);
}
.v2-root.dark-mode .v2-mm-inline-field-value {
  color: #ffffff !important;
  font-weight: 600;
}
.v2-root.dark-mode .v2-mm-inline-lump-chip {
  background: rgba(255, 255, 255, 0.12) !important;
  border-color: rgba(255, 255, 255, 0.16) !important;
  color: rgba(255, 255, 255, 0.92) !important;
}

.v2-root.dark-mode .v2-mm-view-btn {
  color: #ffffff !important;
}
.v2-root.dark-mode .v2-mm-view-chevron {
  filter: brightness(0) saturate(100%) invert(78%) sepia(24%) saturate(580%)
    hue-rotate(157deg) brightness(95%) contrast(92%);
  opacity: 1;
}
.v2-root.dark-mode .v2-mm-edit-btn,
.v2-root.dark-mode .v2-mm-clone-btn {
  background: #a7d6ee !important;
  color: rgba(0, 0, 0, 0.8) !important;
  border-color: transparent !important;
}
.v2-root.dark-mode .v2-mm-edit-btn:hover,
.v2-root.dark-mode .v2-mm-clone-btn:hover,
.v2-root.dark-mode .v2-mm-edit-btn:focus,
.v2-root.dark-mode .v2-mm-clone-btn:focus {
  background: #8ec8e6 !important;
  color: rgba(0, 0, 0, 0.8) !important;
  border-color: transparent !important;
}
.v2-root.dark-mode .v2-mm-edit-btn .v2-mm-action-icon {
  filter: none;
  opacity: 0.85;
}
.v2-root.dark-mode .v2-mm-delete-btn {
  background: rgba(239, 68, 68, 0.16) !important;
  border-color: #ef4444 !important;
  color: #ef4444 !important;
}
.v2-root.dark-mode .v2-manage-model-toolbar .v2-segmented .form-check-input:checked + .form-check-label {
  background: var(--v2-segment-active-bg) !important;
  border-color: var(--v2-segment-active-bg) !important;
  color: #ffffff !important;
}
.v2-root.dark-mode #v2-manage-model-add-new-btn.v2-action-btn,
.v2-root.dark-mode .v2-manage-model-toolbar .v2-action-btn {
  background: #a7d6ee !important;
  color: rgba(0, 0, 0, 0.8) !important;
  border: none !important;
}

.v2-root.dark-mode .v2-list-action-btn {
  color: #ffffff !important;
}

.v2-root.dark-mode .v2-list-action-btn.btn-link {
  color: #ffffff !important;
}

.v2-root.dark-mode .v2-lump-preview-title {
  background: #071e2b !important;
}

.v2-root.dark-mode .v2-lump-preview-table tbody tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.04);
}

.v2-root.dark-mode .v2-lump-preview-table tbody tr:nth-child(odd) td {
  background: transparent;
}

.v2-root.dark-mode .v2-lump-chip {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

/* Config page */
.v2-root.dark-mode .v2-page-stack:has(.v2-config-page) {
  background: var(--v2-bg);
}
.v2-root.dark-mode .v2-config-metadata {
  background: transparent;
  border: none;
}
.v2-root.dark-mode .v2-config-panel {
  background: var(--v2-surface) !important;
  border-color: var(--v2-border) !important;
}
.v2-root.dark-mode .v2-config-subsection-title {
  color: #ffffff;
}
.v2-root.dark-mode .v2-config-subsection-rule {
  background: rgba(255, 255, 255, 0.15);
}
.v2-root.dark-mode .v2-config-field .v2-field-label {
  color: rgba(255, 255, 255, 0.55);
}
.v2-root.dark-mode .v2-config-check .form-check-label {
  color: rgba(255, 255, 255, 0.85);
}
.v2-root.dark-mode .v2-config-check .form-check-input {
  background-color: var(--v2-control-bg);
  border-color: rgba(255, 255, 255, 0.35);
}
.v2-root.dark-mode .v2-config-check .form-check-input:checked {
  background-color: var(--v2-accent);
  border-color: var(--v2-accent);
}
.v2-root.dark-mode .v2-lump-preview-wrap {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.12);
}
.v2-root.dark-mode .v2-lump-preview-title {
  background: #384152;
}
.v2-root.dark-mode .v2-lump-preview-table thead th {
  background: var(--v2-navy) !important;
  border-right-color: rgba(255, 255, 255, 0.12) !important;
}
.v2-root.dark-mode .v2-lump-preview-table tbody td {
  border-bottom-color: rgba(255, 255, 255, 0.1) !important;
  border-right-color: rgba(255, 255, 255, 0.1) !important;
  color: #ffffff;
}
.v2-root.dark-mode .v2-lump-preview-table tbody tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.04);
}
.v2-root.dark-mode .v2-lump-preview-table tbody tr:nth-child(odd) td {
  background: transparent;
}
.v2-root.dark-mode .v2-lump-chip {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.92);
}
.v2-root.dark-mode #v2-config-toolbar .v2-config-update-btn {
  background: var(--v2-navy) !important;
  color: #ffffff !important;
  border: none !important;
}
.v2-root.dark-mode #v2-config-toolbar .v2-config-update-btn:hover,
.v2-root.dark-mode #v2-config-toolbar .v2-config-update-btn:focus {
  background: var(--v2-navy-mid) !important;
  color: #ffffff !important;
}
.v2-root.dark-mode #v2-config-toolbar .v2-config-run-btn {
  background: #a7d6ee !important;
  color: rgba(0, 0, 0, 0.8) !important;
  border: none !important;
}
.v2-root.dark-mode #v2-config-toolbar .v2-config-run-btn:hover,
.v2-root.dark-mode #v2-config-toolbar .v2-config-run-btn:focus {
  background: #8ec8e6 !important;
  color: rgba(0, 0, 0, 0.8) !important;
}

/* Tabs */
.v2-root.dark-mode .v2-subpage-tabs .nav-link,
.v2-root.dark-mode .v2-mt-tabs .nav-link {
  color: rgba(255, 255, 255, 0.4) !important;
}

.v2-root.dark-mode .v2-subpage-tabs .nav-link.active,
.v2-root.dark-mode .v2-mt-tabs .nav-link.active {
  color: #a7d6ee !important;
  border-bottom-color: #a7d6ee !important;
}

/* Forms / checkboxes */
.v2-root.dark-mode .v2-text-input.form-control,
.v2-root.dark-mode .v2-text-input,
.v2-root.dark-mode .form-control {
  background: var(--v2-dropdown-bg) !important;
  border-color: var(--v2-dropdown-border) !important;
  color: var(--v2-dropdown-text) !important;
}

.v2-root.dark-mode .v2-text-input::placeholder,
.v2-root.dark-mode .form-control::placeholder {
  color: var(--v2-dropdown-placeholder) !important;
}

.v2-root.dark-mode .form-check-label {
  color: var(--v2-text);
}

.v2-root.dark-mode .form-check-input {
  background-color: var(--v2-control-bg);
  border-color: var(--v2-border);
}

.v2-root.dark-mode .form-check-input:checked {
  background-color: var(--v2-accent);
  border-color: var(--v2-accent);
}

.v2-root.dark-mode .progress {
  background-color: rgba(255, 255, 255, 0.08);
}

.v2-root.dark-mode .progress-bar {
  background-color: var(--v2-accent);
}

/* Dropdowns — menus may portal outside #v2-root */
.v2-root.dark-mode .dash-dropdown-trigger,
.v2-root.dark-mode .v2-dropdown .dash-dropdown-trigger,
body.dark-mode .dash-dropdown-trigger,
body:has(.v2-root.dark-mode) .dash-dropdown-trigger,
.v2-root.dark-mode .v2-dropdown .Select-control,
.v2-root.dark-mode .Select-control,
body.dark-mode .v2-dropdown .Select-control,
body.dark-mode .Select-control,
body:has(.v2-root.dark-mode) .Select-control {
  background-color: var(--v2-dropdown-bg) !important;
  border-color: var(--v2-dropdown-border) !important;
  color: var(--v2-dropdown-text) !important;
}

.v2-root.dark-mode .dash-dropdown-value,
.v2-root.dark-mode .dash-dropdown-value-item,
.v2-root.dark-mode .v2-dropdown .Select-value-label,
.v2-root.dark-mode .v2-dropdown .has-value.Select--single > .Select-control .Select-value .Select-value-label,
.v2-root.dark-mode .Select-value-label,
body.dark-mode .dash-dropdown-value,
body.dark-mode .dash-dropdown-value-item,
body.dark-mode .v2-dropdown .Select-value-label,
body.dark-mode .Select-value-label,
body:has(.v2-root.dark-mode) .dash-dropdown-value,
body:has(.v2-root.dark-mode) .dash-dropdown-value-item,
body:has(.v2-root.dark-mode) .Select-value-label {
  color: var(--v2-dropdown-text) !important;
}

.v2-root.dark-mode .dash-dropdown-placeholder,
.v2-root.dark-mode .dash-dropdown-value-count,
.v2-root.dark-mode .v2-dropdown .Select-placeholder,
.v2-root.dark-mode .Select-placeholder,
body.dark-mode .dash-dropdown-placeholder,
body.dark-mode .Select-placeholder,
body:has(.v2-root.dark-mode) .dash-dropdown-placeholder,
body:has(.v2-root.dark-mode) .Select-placeholder {
  color: var(--v2-dropdown-placeholder) !important;
}

.v2-root.dark-mode .dash-dropdown-search,
.v2-root.dark-mode .dash-dropdown-search input,
.v2-root.dark-mode .v2-dropdown .Select-input > input,
body.dark-mode .dash-dropdown-search,
body.dark-mode .dash-dropdown-search input,
body.dark-mode .Select-input > input,
body:has(.v2-root.dark-mode) .dash-dropdown-search,
body:has(.v2-root.dark-mode) .dash-dropdown-search input,
body:has(.v2-root.dark-mode) .Select-input > input {
  color: var(--v2-dropdown-text) !important;
}

.v2-root.dark-mode .dash-dropdown,
.v2-root.dark-mode .dash-dropdown-content,
.v2-root.dark-mode .dash-dropdown-search-container,
.v2-root.dark-mode .v2-dropdown .Select-menu-outer,
.v2-root.dark-mode .Select-menu-outer,
body.dark-mode .dash-dropdown,
body.dark-mode .dash-dropdown-content,
body.dark-mode .dash-dropdown-search-container,
body.dark-mode .Select-menu-outer,
body.dark-mode .Select-menu,
body:has(.v2-root.dark-mode) .dash-dropdown-content,
body:has(.v2-root.dark-mode) .dash-dropdown-search-container,
body:has(.v2-root.dark-mode) .Select-menu-outer,
body:has(.v2-root.dark-mode) .Select-menu {
  background: var(--v2-dropdown-menu-bg) !important;
  border-color: var(--v2-dropdown-border) !important;
  color: var(--v2-dropdown-text) !important;
  border-radius: 8px;
}

.v2-root.dark-mode .dash-dropdown-option,
.v2-root.dark-mode .v2-dropdown .Select-option,
.v2-root.dark-mode .Select-option,
body.dark-mode .dash-dropdown-option,
body.dark-mode .Select-option,
body:has(.v2-root.dark-mode) .dash-dropdown-option,
body:has(.v2-root.dark-mode) .Select-option {
  background: transparent !important;
  color: var(--v2-dropdown-text) !important;
}

.v2-root.dark-mode .dash-dropdown-option:hover,
.v2-root.dark-mode .dash-dropdown-option[data-focused="true"],
.v2-root.dark-mode .v2-dropdown .Select-option:hover,
.v2-root.dark-mode .v2-dropdown .Select-option.is-focused,
.v2-root.dark-mode .Select-option:hover,
.v2-root.dark-mode .Select-option.is-focused,
body.dark-mode .dash-dropdown-option:hover,
body.dark-mode .Select-option:hover,
body.dark-mode .Select-option.is-focused,
body:has(.v2-root.dark-mode) .dash-dropdown-option:hover,
body:has(.v2-root.dark-mode) .Select-option:hover,
body:has(.v2-root.dark-mode) .Select-option.is-focused {
  background: var(--v2-dropdown-option-hover) !important;
  color: var(--v2-dropdown-text) !important;
}

.v2-root.dark-mode .dash-dropdown-option[aria-selected="true"],
.v2-root.dark-mode .dash-dropdown-option[data-selected="true"],
.v2-root.dark-mode .v2-dropdown .Select-option.is-selected,
.v2-root.dark-mode .Select-option.is-selected,
body.dark-mode .dash-dropdown-option[aria-selected="true"],
body.dark-mode .Select-option.is-selected,
body:has(.v2-root.dark-mode) .dash-dropdown-option[aria-selected="true"],
body:has(.v2-root.dark-mode) .Select-option.is-selected {
  background: var(--v2-dropdown-option-selected) !important;
  color: var(--v2-dropdown-text) !important;
}

.v2-root.dark-mode .dash-dropdown-trigger-icon,
.v2-root.dark-mode .v2-dropdown .Select-arrow,
body.dark-mode .dash-dropdown-trigger-icon,
body.dark-mode .v2-dropdown .Select-arrow,
body:has(.v2-root.dark-mode) .dash-dropdown-trigger-icon,
body:has(.v2-root.dark-mode) .v2-dropdown .Select-arrow {
  filter: invert(1);
  opacity: 0.85;
}

.v2-root.dark-mode .dash-dropdown-clear,
.v2-root.dark-mode .dash-dropdown-action-button,
body.dark-mode .dash-dropdown-clear,
body.dark-mode .dash-dropdown-action-button,
body:has(.v2-root.dark-mode) .dash-dropdown-clear,
body:has(.v2-root.dark-mode) .dash-dropdown-action-button {
  color: var(--v2-dropdown-text) !important;
}

.v2-root.dark-mode .v2-dropdown.Select--multi .Select-value,
body.dark-mode .Select--multi .Select-value,
body:has(.v2-root.dark-mode) .Select--multi .Select-value {
  background: #145b80 !important;
  border-color: transparent !important;
  color: #ffffff !important;
}

/* Modals */
.v2-root.dark-mode .modal-content,
.v2-root.dark-mode .v2-modal-content,
.dark-mode .modal-content,
body:has(.v2-root.dark-mode) .modal-content {
  background: #1f2937 !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
  color: #fff !important;
  box-shadow: -40px 0 32px rgba(0, 0, 0, 0.4), 0 0 0.5px rgba(0, 0, 0, 0.48);
}

.v2-root.dark-mode .modal-header,
.v2-root.dark-mode .v2-modal-header,
body:has(.v2-root.dark-mode) .modal-header {
  border-color: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.v2-root.dark-mode .modal-footer,
.v2-root.dark-mode .v2-modal-footer,
body:has(.v2-root.dark-mode) .modal-footer {
  border-color: rgba(255, 255, 255, 0.15);
}

.v2-root.dark-mode .v2-modal-hint,
.v2-root.dark-mode .modal-body .v2-muted {
  color: rgba(255, 255, 255, 0.4);
}

/* Toasts */
.v2-root.dark-mode .app-toast-item .alert {
  background-color: var(--v2-surface) !important;
  border-color: var(--v2-border) !important;
  color: var(--v2-text) !important;
}
.v2-root.dark-mode .app-toast-item .alert-success {
  background-color: rgba(34, 197, 94, 0.15) !important;
  border-color: rgba(34, 197, 94, 0.35) !important;
  color: #86efac !important;
}
.v2-root.dark-mode .app-toast-item .alert-danger {
  background-color: rgba(239, 68, 68, 0.15) !important;
  border-color: rgba(239, 68, 68, 0.35) !important;
  color: #fca5a5 !important;
}
.v2-root.dark-mode .app-toast-item .alert-warning {
  background-color: rgba(245, 158, 11, 0.15) !important;
  border-color: rgba(245, 158, 11, 0.35) !important;
  color: #fcd34d !important;
}
.v2-root.dark-mode .app-toast-item .alert-info {
  background-color: rgba(59, 130, 246, 0.15) !important;
  border-color: rgba(59, 130, 246, 0.35) !important;
  color: #93c5fd !important;
}
.v2-root.dark-mode .app-toast-item .btn-close,
.v2-root.dark-mode .btn-close,
body:has(.v2-root.dark-mode) .modal .btn-close,
body:has(.v2-root.dark-mode) .v2-app-modal .btn-close {
  filter: invert(1) grayscale(100%) brightness(200%);
  opacity: 0.85;
}

.v2-root.dark-mode .v2-modal-success-badge,
.v2-root.dark-mode .v2-modal-header-warning {
  color: var(--v2-warning);
}

.v2-root.dark-mode .v2-modal-success-badge {
  background: var(--v2-warning);
  border: 8px solid #374151;
  color: #fff;
}

/* Icons */
.v2-root.dark-mode .v2-back-icon,
.v2-root.dark-mode .v2-upload-drop-icon,
.v2-root.dark-mode .v2-upload-btn-icon {
  filter: brightness(0) invert(1);
  opacity: 0.9;
}

.v2-root.dark-mode .v2-back-btn:hover .v2-back-icon {
  filter: brightness(0) saturate(100%) invert(78%) sepia(18%) saturate(647%)
    hue-rotate(152deg) brightness(95%) contrast(92%);
  opacity: 1;
}

/* Tables / MT list */
.v2-root.dark-mode .table {
  color: #ffffff;
  --bs-table-bg: transparent;
  --bs-table-border-color: rgba(255, 255, 255, 0.15);
}

.v2-root.dark-mode .table thead th {
  background: var(--v2-navy) !important;
  color: #ffffff;
  border-color: var(--v2-border);
}

.v2-root.dark-mode .table tbody tr:nth-child(even) {
  background: var(--v2-row-stripe);
}

.v2-root.dark-mode .predicted-region-trust {
  background: rgba(46, 125, 50, 0.25);
  color: #81c784;
  border-color: rgba(129, 199, 132, 0.45);
}
.v2-root.dark-mode .predicted-region-sparse {
  background: rgba(239, 108, 0, 0.22);
  color: #ffb74d;
  border-color: rgba(255, 183, 77, 0.45);
}
.v2-root.dark-mode .predicted-region-none {
  background: rgba(198, 40, 40, 0.22);
  color: #ef9a9a;
  border-color: rgba(239, 154, 154, 0.45);
}
.v2-root.dark-mode .predicted-region-unknown {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.65);
  border-color: rgba(255, 255, 255, 0.15);
}
.v2-root.dark-mode .predicted-results-legend-label {
  color: var(--v2-text-secondary);
}
.v2-root.dark-mode .predicted-results-legend-item {
  color: inherit;
}

.v2-root.dark-mode .v2-excel-summary .nav-tabs .nav-link,
.v2-root.dark-mode .v2-excel-summary-body .nav-tabs .nav-link {
  color: #ffffff !important;
  border-color: var(--v2-border) !important;
  background: transparent !important;
}
.v2-root.dark-mode .v2-excel-summary .nav-tabs .nav-link:hover,
.v2-root.dark-mode .v2-excel-summary-body .nav-tabs .nav-link:hover {
  background: rgba(255, 255, 255, 0.06) !important;
}
.v2-root.dark-mode .v2-excel-summary .nav-tabs .nav-link.active,
.v2-root.dark-mode .v2-excel-summary-body .nav-tabs .nav-link.active {
  background: var(--v2-segment-active-bg) !important;
  border-color: var(--v2-segment-active-bg) !important;
  color: #ffffff !important;
}
.v2-root.dark-mode .v2-excel-summary-body .excel-sheet-table-scroll {
  border-color: var(--v2-border);
  background: transparent;
}
.v2-root.dark-mode .v2-excel-summary-body .table {
  --bs-table-striped-bg: rgba(255, 255, 255, 0.03);
  --bs-table-border-color: var(--v2-border);
  color: #ffffff;
}
.v2-root.dark-mode .v2-excel-summary-body .table thead th {
  background: var(--v2-navy) !important;
  color: #ffffff;
  border-color: var(--v2-navy);
}

/* Home */
.v2-root.dark-mode .v2-page-stack:has(.v2-home-page--top) {
  scrollbar-color: rgba(255, 255, 255, 0.35) rgba(255, 255, 255, 0.08);
}
.v2-root.dark-mode .v2-page-stack:has(.v2-home-page--top)::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.08);
}
.v2-root.dark-mode .v2-page-stack:has(.v2-home-page--top)::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.35);
}
.v2-root.dark-mode
  .v2-home-results-section
  .v2-performance-panel
  .v2-plot-targets
  > .v2-plot-display::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.08);
}
.v2-root.dark-mode
  .v2-home-results-section
  .v2-performance-panel
  .v2-plot-targets
  > .v2-plot-display::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.35);
}
.v2-root.dark-mode .v2-home-page,
.v2-root.dark-mode .v2-home-page--top,
.v2-root.dark-mode .v2-home-page--bottom {
  background: transparent;
  color: var(--v2-text);
}

.v2-root.dark-mode .v2-input-card,
.v2-root.dark-mode .v2-home-results-section {
  background: var(--v2-surface) !important;
  border-color: var(--v2-border) !important;
  color: var(--v2-text);
}

.v2-root.dark-mode .v2-home-results-section > .v2-home-toolbar-inner {
  background: transparent !important;
  border-bottom-color: var(--v2-border) !important;
}

.v2-root.dark-mode .v2-home-toolbar .v2-field-label,
.v2-root.dark-mode .v2-home-page .v2-field-label {
  color: var(--v2-text-secondary) !important;
}

.v2-root.dark-mode .v2-home-toolbar .v2-action-btn.btn,
.v2-root.dark-mode .v2-home-toolbar .btn.v2-action-btn {
  background: var(--v2-action-bg) !important;
  color: var(--v2-action-color) !important;
  border: none !important;
}

.v2-root.dark-mode .v2-home-page .v2-plot-card {
  background: var(--v2-surface) !important;
  border-color: var(--v2-border) !important;
}

.v2-root.dark-mode .v2-home-page .v2-plot-card-header {
  background: var(--v2-plot-header-bg) !important;
  color: #ffffff !important;
}

.v2-root.dark-mode .v2-home-page .v2-plot-card-title {
  color: #ffffff !important;
}

.v2-root.dark-mode .v2-home-page .v2-section-title {
  color: #ffffff !important;
}

.v2-root.dark-mode .v2-home-page .v2-segmented .form-check-input:checked + .form-check-label {
  background: var(--v2-segment-active-bg) !important;
  border-color: var(--v2-segment-active-bg) !important;
  color: #ffffff !important;
}

.v2-root.dark-mode .v2-home-page .dash-dropdown-trigger,
.v2-root.dark-mode .v2-home-page .v2-dropdown .dash-dropdown-trigger,
.v2-root.dark-mode .v2-home-page .v2-dropdown .Select-control {
  background-color: var(--v2-dropdown-bg) !important;
  border-color: var(--v2-dropdown-border) !important;
  color: var(--v2-dropdown-text) !important;
}

.v2-root.dark-mode .v2-home-page .js-plotly-plot .plotly .xgrid line,
.v2-root.dark-mode .v2-home-page .js-plotly-plot .plotly .ygrid line,
.v2-root.dark-mode .v2-home-page .js-plotly-plot .plotly .xgrid path,
.v2-root.dark-mode .v2-home-page .js-plotly-plot .plotly .ygrid path {
  stroke: var(--v2-grid-line) !important;
}

/* ---- Manage Template ---- */
.v2-root.dark-mode .v2-mt-viz-shell {
  background: var(--v2-surface) !important;
  border-color: var(--v2-border) !important;
}
.v2-root.dark-mode .v2-mt-viz-divider {
  background: var(--v2-border) !important;
}
.v2-root.dark-mode .v2-mt-prediction-hint {
  color: rgba(255, 255, 255, 0.4) !important;
}
.v2-root.dark-mode .v2-manage-template-page .v2-section-title {
  color: #ffffff !important;
}
.v2-root.dark-mode .v2-manage-template-page .v2-segmented .form-check-input:checked + .form-check-label {
  background: #18587a !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
  color: #ffffff !important;
}
.v2-root.dark-mode .v2-manage-template-page .v2-plot-card {
  background: var(--v2-surface) !important;
  border-color: var(--v2-border) !important;
}
.v2-root.dark-mode .v2-manage-template-page .v2-plot-card-header {
  background: var(--v2-plot-header-bg) !important;
  color: #ffffff !important;
}
.v2-root.dark-mode .v2-manage-template-page .v2-plot-card-title {
  color: #ffffff !important;
}
.v2-root.dark-mode .v2-pr-list-card {
  background: var(--v2-surface) !important;
  border-color: var(--v2-border) !important;
}
.v2-root.dark-mode .v2-pr-list-legend-bar {
  background: #071e2b !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
}
.v2-root.dark-mode .v2-pr-list-header {
  background: #0e3d55 !important;
}
.v2-root.dark-mode .v2-pr-list-col-title {
  color: #ffffff !important;
}
.v2-root.dark-mode .v2-pr-sample-link {
  color: #a7d6ee !important;
}
.v2-root.dark-mode .v2-pr-sample-link:hover {
  color: #ffffff !important;
}
.v2-root.dark-mode .v2-pr-param-link {
  color: #a7d6ee !important;
}
.v2-root.dark-mode .v2-pr-param-link:hover {
  color: #ffffff !important;
}
.v2-root.dark-mode .v2-pr-list-row-selected {
  background: #1a232f !important;
}
.v2-root.dark-mode .v2-pr-input-btn {
  border-color: #a7d6ee !important;
  color: #ffffff !important;
  background: transparent !important;
}
.v2-root.dark-mode .v2-pr-output-btn {
  background: #a7d6ee !important;
  color: rgba(0, 0, 0, 0.8) !important;
}
.v2-root.dark-mode .v2-pr-import-btn {
  border-color: rgba(255, 255, 255, 0.2) !important;
  color: #ffffff !important;
  background: transparent !important;
}
.v2-root.dark-mode .v2-pr-import-btn:hover,
.v2-root.dark-mode .v2-pr-import-btn:focus {
  background: rgba(255, 255, 255, 0.06) !important;
  color: #ffffff !important;
}
.v2-root.dark-mode .v2-pr-status-uploaded,
.v2-root.dark-mode .v2-pr-status-unknown {
  background: rgba(255, 255, 255, 0.08) !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
  color: rgba(255, 255, 255, 0.6) !important;
}
.v2-root.dark-mode .v2-pr-empty,
.v2-root.dark-mode .v2-manage-template-page .v2-muted {
  color: rgba(255, 255, 255, 0.5) !important;
}
.v2-root.dark-mode .v2-mt-form-required-hint {
  color: #fff8d0;
  background: #5c5420;
  border-color: #d4b106;
}
.v2-root.dark-mode .v2-mt-form-step-header {
  background: var(--v2-dropdown-bg) !important;
  border-color: var(--v2-border) !important;
}
.v2-root.dark-mode .v2-mt-form-property-group,
.v2-root.dark-mode .v2-mt-form-composition-wrap,
.v2-root.dark-mode .v2-mt-form-cce-full-wrap {
  border-color: rgba(255, 255, 255, 0.12) !important;
  background: rgba(255, 255, 255, 0.03);
}
.v2-root.dark-mode .v2-mt-form-step-item {
  color: #fff;
}
.v2-root.dark-mode .v2-mt-form-step-item:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}
.v2-root.dark-mode .v2-mt-form-step-item-active,
.v2-root.dark-mode .v2-mt-form-step-item-active:hover {
  background: #062d42;
  color: #fff;
}
.v2-root.dark-mode .v2-mt-form-comp-header,
.v2-root.dark-mode .v2-mt-form-comp-tab {
  border-color: rgba(255, 255, 255, 0.12);
}
.v2-root.dark-mode .v2-mt-form-comp-tab:hover,
.v2-root.dark-mode .v2-mt-form-comp-tab-active {
  background: #062d42;
  color: #fff;
}
.v2-root.dark-mode .v2-mt-form-composition-table,
.v2-root.dark-mode .v2-mt-form-cce-full-table,
.v2-root.dark-mode .v2-mt-form-cce-basic-table,
.v2-root.dark-mode .v2-mt-form-comp-name,
.v2-root.dark-mode .v2-mt-form-cce-row-num,
.v2-root.dark-mode .v2-mt-form-cce-row-label,
.v2-root.dark-mode .v2-mt-form-composition-table th,
.v2-root.dark-mode .v2-mt-form-cce-full-table th,
.v2-root.dark-mode .v2-mt-form-cce-basic-table th,
.v2-root.dark-mode .v2-mt-form-composition-table td,
.v2-root.dark-mode .v2-mt-form-cce-full-table td,
.v2-root.dark-mode .v2-mt-form-cce-basic-table td,
.v2-root.dark-mode .v2-mt-form-total-zi-row,
.v2-root.dark-mode .v2-mt-form-total-zi-value {
  color: #fff !important;
}
.v2-root.dark-mode .v2-mt-form-alert-box .btn-close {
  filter: invert(1);
}
.v2-root.dark-mode .v2-mt-form .v2-mt-form-input.v2-mt-form-input--required.v2-text-input,
.v2-root.dark-mode .v2-mt-form .v2-mt-form-input.v2-mt-form-input--required.v2-text-input:focus {
  background: #5c5420 !important;
  border-color: #d4b106 !important;
  color: #fff8d0 !important;
}
