/**
 * Dark mode — extends body.dark-theme (see styles.css variable block)
 * Keep surfaces aligned with inverted --gray-* scale from .dark-theme
 */

.dark-theme {
  --color-text-primary: var(--gray-900);
  --color-text-secondary: var(--gray-800);
  --color-text-tertiary: var(--gray-700);
  --color-background-primary: var(--gray-50);
  --color-background-secondary: var(--gray-100);
  --color-background-tertiary: var(--gray-200);
  --color-border-default: var(--gray-200);
  --color-border-strong: var(--gray-300);
  --color-border-subtle: var(--gray-100);
  /* Used by some dashboard inline styles (e.g. GL) */
  --surface: var(--gray-50);
  --card-bg: var(--gray-50);
}

/* App chrome */
.dark-theme .header {
  background: linear-gradient(135deg, #0f172a 0%, #0c1814 100%);
  border-bottom: 1px solid rgba(0, 212, 170, 0.22);
  box-shadow: 0 8px 20px -12px rgba(0, 0, 0, 0.55);
}

.dark-theme .header .logo-word,
.dark-theme .logo-word {
  color: var(--gray-900) !important;
}

.dark-theme .sidebar-logo .logo-word {
  color: #f1f5f9 !important;
}

.dark-theme .dashboard-selector label {
  color: var(--gray-700) !important;
}

.dark-theme .view-dropdown {
  background: var(--gray-50);
  border-color: rgba(148, 163, 184, 0.35);
  color: var(--gray-900);
  background-image:
    linear-gradient(45deg, transparent 50%, var(--gray-500) 50%),
    linear-gradient(135deg, var(--gray-500) 50%, transparent 50%),
    linear-gradient(to right, rgba(148, 163, 184, 0.35), rgba(148, 163, 184, 0.35));
}

.dark-theme .header-actions select {
  background-color: var(--gray-50);
  border-color: rgba(148, 163, 184, 0.35);
  color: var(--gray-900);
}

/* User menu: styles.css used --gray-800 for panel (reads as light in inverted scale) */
html[data-theme='dark'] .user-menu-dropdown,
.dark-theme .user-menu-dropdown {
  background: var(--gray-50) !important;
  border-color: var(--gray-200) !important;
}

html[data-theme='dark'] .user-menu-profile-name,
.dark-theme .user-menu-profile-name {
  color: var(--gray-900) !important;
}

html[data-theme='dark'] .user-menu-item,
.dark-theme .user-menu-item {
  color: var(--gray-800) !important;
}

html[data-theme='dark'] .user-menu-item:hover,
.dark-theme .user-menu-item:hover {
  background-color: var(--gray-100) !important;
}

html[data-theme='dark'] .user-menu-item--danger,
html[data-theme='dark'] .user-menu-item--danger svg,
html[data-theme='dark'] .user-menu-item--danger i,
.dark-theme .user-menu-item--danger,
.dark-theme .user-menu-item--danger svg,
.dark-theme .user-menu-item--danger i {
  color: var(--danger) !important;
}

html[data-theme='dark'] .user-menu-item--warning,
html[data-theme='dark'] .user-menu-item--warning svg,
html[data-theme='dark'] .user-menu-item--warning i,
.dark-theme .user-menu-item--warning,
.dark-theme .user-menu-item--warning svg,
.dark-theme .user-menu-item--warning i {
  color: var(--warning) !important;
}

html[data-theme='dark'] .user-menu-item--info,
html[data-theme='dark'] .user-menu-item--info svg,
html[data-theme='dark'] .user-menu-item--info i,
.dark-theme .user-menu-item--info,
.dark-theme .user-menu-item--info svg,
.dark-theme .user-menu-item--info i {
  color: #2563eb !important;
}

html[data-theme='dark'] .user-menu-item--success,
html[data-theme='dark'] .user-menu-item--success svg,
html[data-theme='dark'] .user-menu-item--success i,
.dark-theme .user-menu-item--success,
.dark-theme .user-menu-item--success svg,
.dark-theme .user-menu-item--success i {
  color: var(--success) !important;
}

.dark-theme .main-content {
  background: transparent;
}

/* Cards & panels — override hardcoded whites */
.dark-theme .modal-container,
.dark-theme .panel-card,
.dark-theme .table-card,
.dark-theme .metric-card,
.dark-theme .config-card,
.dark-theme .comparison-table,
.dark-theme .trend-analysis-container,
.dark-theme .feature-card,
.dark-theme .ep-tab-content,
.dark-theme .monitoring-section,
.dark-theme .table-responsive {
  background: var(--gray-50) !important;
  border-color: var(--gray-200) !important;
  color: var(--gray-800) !important;
}

.dark-theme .modal-header,
.dark-theme .modal-footer {
  border-color: var(--gray-200) !important;
}

.dark-theme .modal-close:hover {
  background: var(--gray-200) !important;
}

.dark-theme .comparison-table thead {
  background: var(--gray-100) !important;
}

.dark-theme .turbineiq-premium__shell {
  background: linear-gradient(135deg, #0f172a 0%, #0c1f1c 40%, #111827 100%) !important;
  border-color: rgba(0, 212, 170, 0.25) !important;
  box-shadow:
    0 4px 24px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.04) !important;
}

.dark-theme .turbineiq-premium__badge {
  color: #5eead4 !important;
  background: rgba(13, 148, 136, 0.2) !important;
  border-color: rgba(45, 212, 191, 0.35) !important;
}

.dark-theme .turbineiq-premium__header h3 {
  color: #5eead4 !important;
}

.dark-theme .turbineiq-premium__subtitle {
  color: var(--gray-700) !important;
}

html[data-theme='dark'] .turbineiq-premium__tagline,
.dark-theme .turbineiq-premium__tagline {
  color: var(--gray-600) !important;
}

/* TurbineIQ™ premium cards — explicit dark surfaces (base stylesheet uses #fff) */
html[data-theme='dark'] .turbineiq-premium-card,
.dark-theme .turbineiq-premium-card {
  background: linear-gradient(165deg, #1e293b 0%, #0f172a 100%) !important;
  border: 1px solid rgba(148, 163, 184, 0.22) !important;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45) !important;
  color: var(--gray-100) !important;
}

html[data-theme='dark'] .turbineiq-premium-card:hover,
.dark-theme .turbineiq-premium-card:hover {
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.55) !important;
  border-color: rgba(45, 212, 191, 0.35) !important;
}

html[data-theme='dark'] .turbineiq-premium-card__title,
.dark-theme .turbineiq-premium-card__title {
  color: #e2e8f0 !important;
}

html[data-theme='dark'] .turbineiq-premium-card__desc,
.dark-theme .turbineiq-premium-card__desc {
  color: #94a3b8 !important;
}

html[data-theme='dark'] .turbineiq-premium-card__icon,
.dark-theme .turbineiq-premium-card__icon {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

html[data-theme='dark'] .vw-ops-tools,
.dark-theme .vw-ops-tools {
  background: rgba(15, 23, 42, 0.55) !important;
  border-color: var(--gray-700) !important;
}

html[data-theme='dark'] .vw-ops-tools__label,
.dark-theme .vw-ops-tools__label {
  color: var(--gray-400) !important;
}

/* Operator dashboard — production & curtailment chart cards use hardcoded white */
html[data-theme='dark'] #operator-view .chart-card,
html[data-theme='dark'] .charts-grid .chart-card,
.dark-theme #operator-view .chart-card,
.dark-theme .charts-grid .chart-card {
  background: var(--gray-50) !important;
  border-color: var(--gray-200) !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35) !important;
}

html[data-theme='dark'] #operator-view .chart-header h3,
html[data-theme='dark'] .charts-grid .chart-header h3,
.dark-theme #operator-view .chart-header h3,
.dark-theme .charts-grid .chart-header h3 {
  color: var(--gray-900) !important;
}

html[data-theme='dark'] #operator-view .legend-item,
html[data-theme='dark'] .charts-grid .legend-item,
.dark-theme #operator-view .legend-item,
.dark-theme .charts-grid .legend-item {
  color: var(--gray-700) !important;
}

/* Operator dashboard — project banner, workflows (avoid light stripes / hardcoded grays) */
html[data-theme='dark'] #operator-view .project-info-banner,
.dark-theme #operator-view .project-info-banner {
  background: linear-gradient(135deg, rgba(0, 212, 170, 0.12) 0%, rgba(99, 102, 241, 0.1) 100%) !important;
  border-color: var(--gray-200) !important;
}
html[data-theme='dark'] #operator-view .op-row--interactive:hover,
.dark-theme #operator-view .op-row--interactive:hover {
  background: var(--gray-200) !important;
}

/* Real-Time Production Monitor — chart card was still light (hardcoded .chart-card white) */
html[data-theme='dark'] #realtime-view .chart-card,
.dark-theme #realtime-view .chart-card {
  background: var(--gray-50) !important;
  border-color: var(--gray-200) !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35) !important;
}

html[data-theme='dark'] #realtime-view .chart-header h3,
.dark-theme #realtime-view .chart-header h3 {
  color: var(--gray-900) !important;
}

html[data-theme='dark'] #realtime-view .time-range-btn,
.dark-theme #realtime-view .time-range-btn {
  background: var(--gray-100) !important;
  border-color: var(--gray-300) !important;
  color: var(--gray-800) !important;
}

html[data-theme='dark'] #realtime-view .time-range-btn:hover,
.dark-theme #realtime-view .time-range-btn:hover {
  background: var(--gray-200) !important;
  border-color: var(--gray-400) !important;
}

html[data-theme='dark'] #realtime-view .time-range-btn.active,
.dark-theme #realtime-view .time-range-btn.active {
  color: #fff !important;
  background: var(--primary-green, #00d4aa) !important;
  border-color: var(--primary-green, #00d4aa) !important;
}

html[data-theme='dark'] #realtime-view .wind-farm-map,
.dark-theme #realtime-view .wind-farm-map {
  background: var(--gray-100) !important;
}

/* Financial overview (and other views) — empty chart placeholders */
html[data-theme='dark'] .no-data-placeholder,
.dark-theme .no-data-placeholder {
  border-color: var(--gray-200) !important;
  background: rgba(15, 23, 42, 0.45) !important;
  color: var(--gray-500) !important;
}

html[data-theme='dark'] .no-data-placeholder__icon,
html[data-theme='dark'] .no-data-placeholder__hint,
.dark-theme .no-data-placeholder__icon,
.dark-theme .no-data-placeholder__hint {
  color: var(--gray-500) !important;
}

/* Tabs */
.dark-theme .ep-tab {
  background: transparent;
  color: var(--gray-600);
  border-color: var(--gray-200);
}

.dark-theme .ep-tab.active {
  color: var(--primary-green);
  border-bottom-color: var(--primary-green);
}

.dark-theme .ep-tab-btn.active {
  color: var(--primary-green);
  border-bottom-color: var(--primary-green);
}

.dark-theme .rev-sub-tab {
  border-color: var(--gray-200);
}
.dark-theme .rev-sub-tab.active {
  color: var(--primary-green);
  border-bottom-color: var(--primary-green);
}
.dark-theme .rev-sub-tab:hover {
  color: var(--primary-green);
}

.dark-theme .tiq-nav-link {
  border-color: transparent;
  color: var(--gray-600);
}
.dark-theme .tiq-nav-link:hover {
  color: var(--primary-green);
}
.dark-theme .tiq-nav-link.tiq-nav-link--active {
  color: var(--primary-green);
  border-bottom-color: var(--primary-green);
}

.dark-theme .lifecycle-step {
  color: var(--gray-500);
}
.dark-theme .lifecycle-step.active {
  color: var(--primary-green);
  border-bottom-color: var(--primary-green);
}
.dark-theme .lifecycle-step:hover {
  color: var(--primary-green);
}

/* Work order strip (top of styles.css) */
.dark-theme .work-order-item {
  background: var(--gray-100) !important;
  border-color: var(--gray-200) !important;
}

.dark-theme .wo-details {
  color: var(--gray-800) !important;
}

/* Notification center */
.dark-theme .notification-center {
  background: var(--gray-50) !important;
}

.dark-theme .filter-btn {
  background: var(--gray-100) !important;
  border-color: var(--gray-300) !important;
  color: var(--gray-800) !important;
}

/* Form controls */
.dark-theme .form-control,
.dark-theme .form-input,
.dark-theme .form-input-full,
.dark-theme .u-input {
  background: var(--gray-100) !important;
  border-color: var(--gray-200) !important;
  color: var(--gray-900) !important;
}

.dark-theme .form-control:focus,
.dark-theme .form-input:focus {
  border-color: var(--primary-green) !important;
  box-shadow: 0 0 0 3px rgba(0, 212, 170, 0.12) !important;
}

.dark-theme .form-label-config {
  color: var(--gray-800) !important;
}

/* Config / profile cards */
.dark-theme .config-card-highlight {
  background: linear-gradient(135deg, var(--gray-100) 0%, var(--gray-50) 100%) !important;
  border-color: var(--gray-200) !important;
}

.dark-theme #iso-credentials-card {
  background: linear-gradient(135deg, #1c1410 0%, var(--gray-50) 100%) !important;
  border-color: rgba(251, 146, 60, 0.35) !important;
}

/* Leaflet popups */
.dark-theme .leaflet-popup-content-wrapper,
.dark-theme .leaflet-popup-tip {
  background: var(--gray-50) !important;
  color: var(--gray-800) !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45) !important;
}

/* =============================================================================
   Global: all dashboard views — base text (variables already inverted on body)
   ============================================================================= */
html[data-theme='dark'] .dashboard-view,
.dark-theme .dashboard-view {
  color: var(--gray-800);
}

html[data-theme='dark'] .view-header h2,
html[data-theme='dark'] .view-subtitle,
.dark-theme .view-header h2,
.dark-theme .view-subtitle {
  color: var(--gray-900) !important;
}

html[data-theme='dark'] .section-header,
html[data-theme='dark'] .section-header h3,
.dark-theme .section-header,
.dark-theme .section-header h3 {
  color: var(--gray-900) !important;
  border-color: var(--gray-200) !important;
}

html[data-theme='dark'] .monitoring-section,
.dark-theme .monitoring-section {
  background: var(--gray-50) !important;
  border-color: var(--gray-200) !important;
}

/* =============================================================================
   Workflow Center (#workflow-view)
   ============================================================================= */
html[data-theme='dark'] #workflow-view .wf-container,
.dark-theme #workflow-view .wf-container {
  background: linear-gradient(180deg, #0f172a 0%, #0b1220 100%) !important;
}

html[data-theme='dark'] #workflow-view .wf-quick-stats,
.dark-theme #workflow-view .wf-quick-stats {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%) !important;
  border-color: var(--gray-200) !important;
}

html[data-theme='dark'] #workflow-view .wf-stat-card,
html[data-theme='dark'] #workflow-view .wf-workflow-section,
.dark-theme #workflow-view .wf-stat-card,
.dark-theme #workflow-view .wf-workflow-section {
  background: var(--gray-50) !important;
  border-color: var(--gray-200) !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35) !important;
}

html[data-theme='dark'] #workflow-view .wf-side-panel,
.dark-theme #workflow-view .wf-side-panel {
  background: linear-gradient(180deg, var(--gray-50) 0%, var(--gray-100) 100%) !important;
  border-color: var(--gray-200) !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35) !important;
}

html[data-theme='dark'] #workflow-view .wf-stat-card .label,
.dark-theme #workflow-view .wf-stat-card .label {
  color: var(--gray-600) !important;
}

html[data-theme='dark'] #workflow-view .wf-panel-header,
.dark-theme #workflow-view .wf-panel-header {
  border-bottom-color: var(--gray-200) !important;
}

html[data-theme='dark'] #workflow-view .wf-panel-header.company,
.dark-theme #workflow-view .wf-panel-header.company {
  background: linear-gradient(135deg, #1e3a4f 0%, #152a38 100%) !important;
  color: #cbd5e1 !important;
  border-bottom-color: #334155 !important;
}

html[data-theme='dark'] #workflow-view .wf-panel-header.banking,
.dark-theme #workflow-view .wf-panel-header.banking {
  background: linear-gradient(135deg, #1a2e24 0%, #14231c 100%) !important;
  color: #cbd5e1 !important;
  border-bottom-color: #334155 !important;
}

html[data-theme='dark'] #workflow-view .wf-panel-header.reports,
.dark-theme #workflow-view .wf-panel-header.reports {
  background: linear-gradient(135deg, #1e2d3a 0%, #152028 100%) !important;
  color: #cbd5e1 !important;
  border-bottom-color: #334155 !important;
}

html[data-theme='dark'] #workflow-view .wf-panel-header.enterprise,
.dark-theme #workflow-view .wf-panel-header.enterprise {
  background: linear-gradient(135deg, #2a2440 0%, #1a1628 100%) !important;
  color: #cbd5e1 !important;
  border-bottom-color: #334155 !important;
}

html[data-theme='dark'] #workflow-view .wf-panel-header.contracts,
.dark-theme #workflow-view .wf-panel-header.contracts {
  background: linear-gradient(135deg, #1e3a4f 0%, #1e293b 100%) !important;
  color: #e2e8f0 !important;
  border-bottom-color: #334155 !important;
}
html[data-theme='dark'] #workflow-view .wf-panel-header.operations,
.dark-theme #workflow-view .wf-panel-header.operations {
  background: linear-gradient(135deg, #14532d 0%, #0f172a 100%) !important;
  color: #e2e8f0 !important;
  border-bottom-color: #334155 !important;
}
html[data-theme='dark'] #workflow-view .wf-panel-header.settlements,
.dark-theme #workflow-view .wf-panel-header.settlements {
  background: linear-gradient(135deg, #1e3a4f 0%, #172554 100%) !important;
  color: #e2e8f0 !important;
  border-bottom-color: #334155 !important;
}
html[data-theme='dark'] #workflow-view .wf-panel-header.compliance,
.dark-theme #workflow-view .wf-panel-header.compliance {
  background: linear-gradient(135deg, #1a2e24 0%, #0f172a 100%) !important;
  color: #e2e8f0 !important;
  border-bottom-color: #334155 !important;
}
html[data-theme='dark'] #workflow-view .wf-panel-header.fleet,
.dark-theme #workflow-view .wf-panel-header.fleet {
  background: linear-gradient(135deg, #2a2440 0%, #1a1628 100%) !important;
  color: #e2e8f0 !important;
  border-bottom-color: #334155 !important;
}
html[data-theme='dark'] #workflow-view .wf-panel-header.land,
.dark-theme #workflow-view .wf-panel-header.land {
  background: linear-gradient(135deg, #14532d 0%, #052e16 100%) !important;
  color: #e2e8f0 !important;
  border-bottom-color: #334155 !important;
}
html[data-theme='dark'] #workflow-view .wf-panel-header.workforce,
.dark-theme #workflow-view .wf-panel-header.workforce {
  background: linear-gradient(135deg, #3b2f4a 0%, #1e1628 100%) !important;
  color: #e2e8f0 !important;
  border-bottom-color: #334155 !important;
}

html[data-theme='dark'] #workflow-view .wf-workflow-item,
.dark-theme #workflow-view .wf-workflow-item {
  background: var(--gray-50) !important;
  border-color: var(--gray-200) !important;
}

html[data-theme='dark'] #workflow-view .wf-workflow-item.connected,
.dark-theme #workflow-view .wf-workflow-item.connected {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2) 0%, rgba(5, 150, 105, 0.15) 100%) !important;
  box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.45) !important;
}

html[data-theme='dark'] #workflow-view .wf-flow-legend,
.dark-theme #workflow-view .wf-flow-legend {
  background: var(--gray-100) !important;
  border-color: var(--gray-200) !important;
}

html[data-theme='dark'] .wf-rc-search input,
.dark-theme .wf-rc-search input {
  background: var(--gray-100) !important;
  border-color: var(--gray-200) !important;
  color: var(--gray-900) !important;
}

html[data-theme='dark'] .wf-rc-search input:focus,
.dark-theme .wf-rc-search input:focus {
  background: var(--gray-50) !important;
}

html[data-theme='dark'] .wf-rc-stat,
html[data-theme='dark'] .wf-rp-card,
.dark-theme .wf-rc-stat,
.dark-theme .wf-rp-card {
  background: linear-gradient(145deg, var(--gray-100) 0%, var(--gray-50) 100%) !important;
  border-color: var(--gray-200) !important;
}

html[data-theme='dark'] .wf-rc-section-header h4,
html[data-theme='dark'] .wf-rc-category-info h5,
html[data-theme='dark'] .wf-rp-card-value,
html[data-theme='dark'] .wf-scheduled-name,
.dark-theme .wf-rc-section-header h4,
.dark-theme .wf-rc-category-info h5,
.dark-theme .wf-rp-card-value,
.dark-theme .wf-scheduled-name {
  color: var(--gray-900) !important;
}

html[data-theme='dark'] .wf-rc-category-reports,
.dark-theme .wf-rc-category-reports {
  background: var(--gray-50) !important;
  border-color: var(--gray-200) !important;
}

html[data-theme='dark'] .wf-rc-report,
.dark-theme .wf-rc-report {
  border-bottom-color: var(--gray-200) !important;
}

html[data-theme='dark'] .wf-rc-report-name,
.dark-theme .wf-rc-report-name {
  color: var(--gray-800) !important;
}

html[data-theme='dark'] .wf-rp-filter-group select,
html[data-theme='dark'] .wf-form-group select,
html[data-theme='dark'] .wf-form-group input[type='text'],
.dark-theme .wf-rp-filter-group select,
.dark-theme .wf-form-group select,
.dark-theme .wf-form-group input[type='text'] {
  background: var(--gray-50) !important;
  border-color: var(--gray-200) !important;
  color: var(--gray-900) !important;
}

html[data-theme='dark'] .wf-rp-table th,
.dark-theme .wf-rp-table th {
  background: linear-gradient(135deg, var(--gray-100) 0%, var(--gray-200) 100%) !important;
  color: var(--gray-700) !important;
  border-bottom-color: var(--gray-200) !important;
}

html[data-theme='dark'] .wf-rp-table td,
.dark-theme .wf-rp-table td {
  border-bottom-color: var(--gray-200) !important;
  color: var(--gray-800) !important;
}

html[data-theme='dark'] .wf-rp-table tbody tr:hover,
.dark-theme .wf-rp-table tbody tr:hover {
  background: var(--gray-100) !important;
}

html[data-theme='dark'] .wf-scheduled-item,
.dark-theme .wf-scheduled-item {
  background: linear-gradient(135deg, var(--gray-100) 0%, var(--gray-50) 100%) !important;
  border-color: var(--gray-200) !important;
}

html[data-theme='dark'] .wf-scheduled-actions button,
.dark-theme .wf-scheduled-actions button {
  background: var(--gray-50) !important;
  border-color: var(--gray-200) !important;
  color: var(--gray-700) !important;
}

html[data-theme='dark'] .wf-toggle-label,
.dark-theme .wf-toggle-label {
  color: var(--gray-600) !important;
}

/* Data Flow — SVG paths default to light gray; boost contrast on dark backgrounds */
html[data-theme='dark'] #workflow-view .wf-flow-canvas path,
.dark-theme #workflow-view .wf-flow-canvas path {
  stroke: #94a3b8 !important;
  opacity: 0.55 !important;
}

html[data-theme='dark'] #workflow-view .wf-flow-canvas path.active,
.dark-theme #workflow-view .wf-flow-canvas path.active {
  stroke: #34d399 !important;
  stroke-width: 2px !important;
  opacity: 0.9 !important;
}

html[data-theme='dark'] #workflow-view .wf-flow-dot,
.dark-theme #workflow-view .wf-flow-dot {
  fill: #34d399 !important;
}

html[data-theme='dark'] #workflow-view .wf-flow-dot.active,
.dark-theme #workflow-view .wf-flow-dot.active {
  fill: #6ee7b7 !important;
  opacity: 0.95 !important;
}

html[data-theme='dark'] #workflow-view .wf-animated-dot,
.dark-theme #workflow-view .wf-animated-dot {
  background: #34d399 !important;
  box-shadow: 0 0 10px rgba(52, 211, 153, 0.55) !important;
}

html[data-theme='dark'] #workflow-view .wf-cross-connector,
.dark-theme #workflow-view .wf-cross-connector {
  background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%) !important;
  border-color: #94a3b8 !important;
  box-shadow: 0 0 12px rgba(37, 99, 235, 0.45) !important;
}

html[data-theme='dark'] #workflow-view .wf-lane-divider,
.dark-theme #workflow-view .wf-lane-divider {
  background: linear-gradient(90deg, transparent, rgba(148, 163, 184, 0.45), transparent) !important;
}

html[data-theme='dark'] .wf-toggle-slider,
.dark-theme .wf-toggle-slider {
  background: #475569 !important;
}

html[data-theme='dark'] .wf-toggle-slider::before,
.dark-theme .wf-toggle-slider::before {
  background: var(--gray-100) !important;
}

/* Data Flow toggle on — match active flow line color (#workflow-view .wf-flow-canvas path.active) */
html[data-theme='dark'] .wf-toggle-switch input:checked + .wf-toggle-slider,
.dark-theme .wf-toggle-switch input:checked + .wf-toggle-slider {
  background: #34d399 !important;
}

html[data-theme='dark'] .wf-toggle-switch input:checked ~ .wf-toggle-label,
.dark-theme .wf-toggle-switch input:checked ~ .wf-toggle-label {
  color: #34d399 !important;
}

/* Workflow Center: View By — #workflow-view select beats .dark-theme select specificity */
html[data-theme='dark'] #workflow-view .wf-view-sort-control,
.dark-theme #workflow-view .wf-view-sort-control {
  color: var(--gray-600) !important;
}

html[data-theme='dark'] #workflow-view .wf-view-sort-control select,
.dark-theme #workflow-view .wf-view-sort-control select {
  background: var(--gray-50) !important;
  border-color: var(--gray-200) !important;
  color: var(--gray-900) !important;
}

html[data-theme='dark'] #workflow-view .wf-view-sort-control select:focus,
html[data-theme='dark'] #workflow-view .wf-view-sort-control select:focus-visible,
.dark-theme #workflow-view .wf-view-sort-control select:focus,
.dark-theme #workflow-view .wf-view-sort-control select:focus-visible {
  background: var(--gray-900) !important;
  color: var(--gray-100) !important;
  border-color: var(--gray-300) !important;
}

/* Role view: category cards + headers (light gradients in workflow-dashboard.css) */
html[data-theme='dark'] #workflow-view .wf-role-group,
.dark-theme #workflow-view .wf-role-group {
  background: linear-gradient(180deg, var(--gray-50) 0%, var(--gray-100) 100%) !important;
  border-color: var(--gray-200) !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35) !important;
}

html[data-theme='dark'] #workflow-view .wf-role-group-header,
.dark-theme #workflow-view .wf-role-group-header {
  background: linear-gradient(135deg, #1e3a4f 0%, #1e293b 100%) !important;
  color: #e2e8f0 !important;
  border-bottom-color: rgba(51, 65, 85, 0.75) !important;
}

html[data-theme='dark'] #workflow-view .wf-role-group-header:hover,
.dark-theme #workflow-view .wf-role-group-header:hover {
  filter: brightness(1.1) !important;
}

html[data-theme='dark'] #workflow-view .wf-role-group.is-selected .wf-role-group-header,
.dark-theme #workflow-view .wf-role-group.is-selected .wf-role-group-header {
  background: linear-gradient(135deg, #14532d 0%, #166534 100%) !important;
  color: #ecfdf5 !important;
  border-bottom-color: rgba(16, 185, 129, 0.4) !important;
}

html[data-theme='dark'] #workflow-view .wf-role-group-header:focus-visible,
.dark-theme #workflow-view .wf-role-group-header:focus-visible {
  outline: 2px solid #60a5fa !important;
  outline-offset: -2px !important;
}

html[data-theme='dark'] #workflow-view .wf-role-reset-btn,
.dark-theme #workflow-view .wf-role-reset-btn {
  background: var(--gray-50) !important;
  border-color: var(--gray-200) !important;
  color: var(--gray-800) !important;
}

html[data-theme='dark'] #workflow-view .wf-role-reset-btn:hover:not(:disabled),
.dark-theme #workflow-view .wf-role-reset-btn:hover:not(:disabled) {
  background: var(--gray-200) !important;
  border-color: var(--gray-300) !important;
  color: var(--gray-900) !important;
}

/* Data Flow control: workflow-dashboard label colors are slate-500 — align with other header chrome */
html[data-theme='dark'] #workflow-view .wf-toggle-label,
.dark-theme #workflow-view .wf-toggle-label {
  color: var(--gray-600) !important;
}

html[data-theme='dark'] #workflow-view .wf-toggle-switch input:checked ~ .wf-toggle-label,
.dark-theme #workflow-view .wf-toggle-switch input:checked ~ .wf-toggle-label {
  color: #6ee7b7 !important;
}

/* =============================================================================
   Field dispatch
   ============================================================================= */
html[data-theme='dark'] #field-dispatch-view .fd-tab-btn.active,
.dark-theme #field-dispatch-view .fd-tab-btn.active,
html[data-theme='dark'] #regulatory-reporting-view .fd-tab-btn.active,
.dark-theme #regulatory-reporting-view .fd-tab-btn.active {
  background: transparent !important;
  color: var(--primary-green) !important;
  border-bottom-color: var(--primary-green) !important;
  box-shadow: none !important;
}

/* Overview chart panels use .chart-card outside .charts-grid — base stylesheet is white */
html[data-theme='dark'] #field-dispatch-view .chart-card,
.dark-theme #field-dispatch-view .chart-card {
  background: var(--gray-50) !important;
  border-color: var(--gray-200) !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35) !important;
}

html[data-theme='dark'] #field-dispatch-view .chart-header h3,
.dark-theme #field-dispatch-view .chart-header h3 {
  color: var(--gray-900) !important;
}

html[data-theme='dark'] #field-dispatch-view .fd-tab-bar,
.dark-theme #field-dispatch-view .fd-tab-bar,
html[data-theme='dark'] #regulatory-reporting-view .fd-tab-bar,
.dark-theme #regulatory-reporting-view .fd-tab-bar {
  background: transparent !important;
}

html[data-theme='dark'] #field-dispatch-view .fd-tab-btn,
.dark-theme #field-dispatch-view .fd-tab-btn,
html[data-theme='dark'] #regulatory-reporting-view .fd-tab-btn,
.dark-theme #regulatory-reporting-view .fd-tab-btn {
  color: var(--gray-600) !important;
}

html[data-theme='dark'] #field-dispatch-view .fd-tab-btn:hover,
.dark-theme #field-dispatch-view .fd-tab-btn:hover,
html[data-theme='dark'] #regulatory-reporting-view .fd-tab-btn:hover,
.dark-theme #regulatory-reporting-view .fd-tab-btn:hover {
  color: var(--gray-800) !important;
  background: transparent !important;
}

/* Refresh / Assign / Schedule — settlement .btn-small + !important loses to ID-scoped primary */
html[data-theme='dark'] #field-dispatch-view .btn-primary,
.dark-theme #field-dispatch-view .btn-primary {
  color: #fff !important;
  background: #00d4aa !important;
  border: 1px solid rgba(0, 212, 170, 0.45) !important;
  box-shadow: 0 2px 8px rgba(0, 212, 170, 0.25) !important;
}

html[data-theme='dark'] #field-dispatch-view .btn-primary:hover,
.dark-theme #field-dispatch-view .btn-primary:hover {
  background: #00bf9a !important;
}

html[data-theme='dark'] #field-dispatch-view .btn-primary::before,
.dark-theme #field-dispatch-view .btn-primary::before {
  display: none !important;
}

html[data-theme='dark'] .fd-worker-card,
html[data-theme='dark'] .fd-schedule-day,
.dark-theme .fd-worker-card,
.dark-theme .fd-schedule-day {
  background: var(--gray-50) !important;
  border-color: var(--gray-200) !important;
}

html[data-theme='dark'] .fd-schedule-day-header,
.dark-theme .fd-schedule-day-header {
  background: var(--gray-100) !important;
  border-bottom-color: var(--gray-200) !important;
  color: var(--gray-800) !important;
}

/* =============================================================================
   Field ops advanced (foa-*)
   ============================================================================= */
html[data-theme='dark'] .foa-tab-btn.active,
.dark-theme .foa-tab-btn.active {
  background: transparent !important;
  color: var(--primary-green) !important;
  border-bottom-color: var(--primary-green) !important;
  box-shadow: none !important;
}

html[data-theme='dark'] .foa-badge-red,
.dark-theme .foa-badge-red {
  background: rgba(220, 38, 38, 0.2) !important;
  color: #fca5a5 !important;
}

html[data-theme='dark'] .foa-badge-orange,
.dark-theme .foa-badge-orange {
  background: rgba(234, 88, 12, 0.2) !important;
  color: #fdba74 !important;
}

html[data-theme='dark'] .foa-badge-yellow,
.dark-theme .foa-badge-yellow {
  background: rgba(202, 138, 4, 0.2) !important;
  color: #fde047 !important;
}

html[data-theme='dark'] .foa-badge-green,
.dark-theme .foa-badge-green {
  background: rgba(22, 163, 74, 0.2) !important;
  color: #86efac !important;
}

html[data-theme='dark'] .foa-badge-blue,
.dark-theme .foa-badge-blue {
  background: rgba(37, 99, 235, 0.2) !important;
  color: #93c5fd !important;
}

html[data-theme='dark'] .foa-badge-gray,
.dark-theme .foa-badge-gray {
  background: var(--gray-200) !important;
  color: var(--gray-700) !important;
}

/* Inspection templates & KPI cards — avoid light surfaces + light text (inverted grays) */
html[data-theme='dark'] #field-ops-advanced-view .foa-template-card,
.dark-theme #field-ops-advanced-view .foa-template-card {
  background: var(--gray-50) !important;
  border-color: var(--gray-200) !important;
  color: var(--gray-800) !important;
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.28);
}

html[data-theme='dark'] #field-ops-advanced-view .foa-template-card strong,
.dark-theme #field-ops-advanced-view .foa-template-card strong {
  color: var(--gray-900) !important;
}

html[data-theme='dark'] #field-ops-advanced-view .foa-template-meta,
.dark-theme #field-ops-advanced-view .foa-template-meta {
  color: var(--gray-600) !important;
}

html[data-theme='dark'] #field-ops-advanced-view .foa-kpi-card,
.dark-theme #field-ops-advanced-view .foa-kpi-card {
  background: var(--gray-50) !important;
  border-color: var(--gray-200) !important;
}

html[data-theme='dark'] #field-ops-advanced-view .foa-kpi-value,
.dark-theme #field-ops-advanced-view .foa-kpi-value {
  color: var(--gray-900) !important;
}

html[data-theme='dark'] #field-ops-advanced-view .foa-kpi-label,
.dark-theme #field-ops-advanced-view .foa-kpi-label {
  color: var(--gray-600) !important;
}

/* =============================================================================
   ETRM dashboard
   ============================================================================= */
html[data-theme='dark'] .etrm-tabs .tab.active,
.dark-theme .etrm-tabs .tab.active {
  background: transparent !important;
  color: var(--primary-green, #00d4aa) !important;
  border-bottom-color: var(--primary-green, #00d4aa) !important;
  box-shadow: none !important;
}

html[data-theme='dark'] .kpi-card,
.dark-theme .kpi-card {
  background: var(--gray-50) !important;
  border-color: var(--gray-200) !important;
}

html[data-theme='dark'] #etrm-view [style*='background:#fffbeb'],
.dark-theme #etrm-view [style*='background:#fffbeb'] {
  background: rgba(245, 158, 11, 0.12) !important;
}

/* =============================================================================
   Advanced features (modals & tools)
   ============================================================================= */
html[data-theme='dark'] .comparison-table,
html[data-theme='dark'] .trend-analysis-container,
html[data-theme='dark'] .export-hub-container,
html[data-theme='dark'] .validation-summary,
html[data-theme='dark'] .heatmap-clean,
html[data-theme='dark'] .heatmap-row,
html[data-theme='dark'] .gantt-container,
html[data-theme='dark'] .gantt-chart,
html[data-theme='dark'] .import-wizard-container,
.dark-theme .comparison-table,
.dark-theme .trend-analysis-container,
.dark-theme .export-hub-container,
.dark-theme .validation-summary,
.dark-theme .heatmap-clean,
.dark-theme .heatmap-row,
.dark-theme .gantt-container,
.dark-theme .gantt-chart,
.dark-theme .import-wizard-container {
  background: var(--gray-50) !important;
  border-color: var(--gray-200) !important;
}

/* =============================================================================
   Upload manager — align with .dark-theme (not only prefers-color-scheme)
   ============================================================================= */
html[data-theme='dark'] .flux-upload-dropzone,
.dark-theme .flux-upload-dropzone {
  background: rgba(15, 23, 42, 0.65) !important;
  border-color: rgba(100, 116, 139, 0.45) !important;
}

html[data-theme='dark'] .flux-upload-dropzone-hint,
.dark-theme .flux-upload-dropzone-hint {
  color: var(--gray-600) !important;
}

html[data-theme='dark'] .flux-upload-dropzone-icon,
.dark-theme .flux-upload-dropzone-icon {
  color: var(--gray-500) !important;
}

html[data-theme='dark'] .flux-upload-thumb,
.dark-theme .flux-upload-thumb {
  background: var(--gray-100) !important;
  border-color: rgba(100, 116, 139, 0.25) !important;
}

html[data-theme='dark'] .flux-upload-thumb-name,
.dark-theme .flux-upload-thumb-name {
  color: var(--gray-700) !important;
}

html[data-theme='dark'] .flux-upload-thumb-remove,
html[data-theme='dark'] .flux-photo-remove,
.dark-theme .flux-upload-thumb-remove,
.dark-theme .flux-photo-remove {
  background: var(--gray-200) !important;
  color: var(--gray-900) !important;
}

html[data-theme='dark'] .flux-upload-progress-bar,
.dark-theme .flux-upload-progress-bar {
  background: var(--gray-200) !important;
}

/* =============================================================================
   Design system — cards & overlays that hardcode white
   ============================================================================= */
html[data-theme='dark'] .ds-card,
html[data-theme='dark'] .config-card-default,
.dark-theme .ds-card,
.dark-theme .config-card-default {
  background: var(--gray-50) !important;
  border-color: var(--gray-200) !important;
}

/* =============================================================================
   Tables, lists, pills (generic)
   ============================================================================= */
html[data-theme='dark'] .data-table,
html[data-theme='dark'] .data-table td,
html[data-theme='dark'] .data-table th,
.dark-theme .data-table,
.dark-theme .data-table td,
.dark-theme .data-table th {
  border-color: var(--gray-200) !important;
}

html[data-theme='dark'] .btn-primary,
.dark-theme .btn-primary {
  box-shadow: 0 2px 8px rgba(0, 212, 170, 0.25);
}

/* Cold Climate — TurbineIQ row accent buttons (injected .cc-btn-* beat .btn-small text color) */
html[data-theme='dark'] #cold-climate-container .cc-btn-ice-cyan,
.dark-theme #cold-climate-container .cc-btn-ice-cyan {
  background: #0e7490 !important;
  color: #f0fdfa !important;
  box-shadow: 0 2px 10px rgba(14, 116, 144, 0.45);
}

html[data-theme='dark'] #cold-climate-container .cc-btn-ice-cyan:hover,
.dark-theme #cold-climate-container .cc-btn-ice-cyan:hover {
  filter: brightness(1.12);
}

html[data-theme='dark'] #cold-climate-container .cc-btn-ice-purple,
.dark-theme #cold-climate-container .cc-btn-ice-purple {
  background: #5b21b6 !important;
  color: #faf5ff !important;
  box-shadow: 0 2px 10px rgba(91, 33, 182, 0.4);
}

html[data-theme='dark'] #cold-climate-container .cc-btn-ice-purple:hover,
.dark-theme #cold-climate-container .cc-btn-ice-purple:hover {
  filter: brightness(1.1);
}

/* =============================================================================
   Inline styles from JS (attribute substring — !important beats non-!important inline)
   ============================================================================= */
html[data-theme='dark'] [style*='background:#fff'],
html[data-theme='dark'] [style*='background: #fff'],
html[data-theme='dark'] [style*='background:#ffffff'],
html[data-theme='dark'] [style*='background: #ffffff'],
html[data-theme='dark'] [style*='background:white'],
.dark-theme [style*='background:#fff'],
.dark-theme [style*='background: #fff'],
.dark-theme [style*='background:#ffffff'],
.dark-theme [style*='background: #ffffff'],
.dark-theme [style*='background:white'] {
  background: var(--gray-50) !important;
}

html[data-theme='dark'] [style*='background:#f8fafc'],
html[data-theme='dark'] [style*='background: #f8fafc'],
html[data-theme='dark'] [style*='background:#f8f9fa'],
html[data-theme='dark'] [style*='background:#ecf0f1'],
.dark-theme [style*='background:#f8fafc'],
.dark-theme [style*='background: #f8fafc'],
.dark-theme [style*='background:#f8f9fa'],
.dark-theme [style*='background:#ecf0f1'] {
  background: var(--gray-100) !important;
}

html[data-theme='dark'] [style*='color:#2c3e50'],
html[data-theme='dark'] [style*='color: #2c3e50'],
html[data-theme='dark'] [style*='color:#1e293b'],
html[data-theme='dark'] [style*='color: #1e293b'],
.dark-theme [style*='color:#2c3e50'],
.dark-theme [style*='color: #2c3e50'],
.dark-theme [style*='color:#1e293b'],
.dark-theme [style*='color: #1e293b'] {
  color: var(--gray-900) !important;
}

html[data-theme='dark'] [style*='color:#334155'],
html[data-theme='dark'] [style*='color: #334155'],
.dark-theme [style*='color:#334155'],
.dark-theme [style*='color: #334155'] {
  color: var(--gray-800) !important;
}

html[data-theme='dark'] [style*='color:#64748b'],
html[data-theme='dark'] [style*='color: #64748b'],
html[data-theme='dark'] [style*='color:#7f8c8d'],
html[data-theme='dark'] [style*='color:#95a5a6'],
.dark-theme [style*='color:#64748b'],
.dark-theme [style*='color: #64748b'],
.dark-theme [style*='color:#7f8c8d'],
.dark-theme [style*='color:#95a5a6'] {
  color: var(--gray-600) !important;
}

html[data-theme='dark'] [style*='border:1px solid #e0e0e0'],
html[data-theme='dark'] [style*='border: 1px solid #e0e0e0'],
html[data-theme='dark'] [style*='border:1px solid #e2e8f0'],
.dark-theme [style*='border:1px solid #e0e0e0'],
.dark-theme [style*='border: 1px solid #e0e0e0'],
.dark-theme [style*='border:1px solid #e2e8f0'] {
  border-color: var(--gray-200) !important;
}

/* =============================================================================
   Design system — BESS / grid action controls (design-system-improvements.css)
   ============================================================================= */
html[data-theme='dark'] .bess-unit-card,
.dark-theme .bess-unit-card {
  background: var(--gray-50) !important;
  border-color: var(--gray-200) !important;
}

html[data-theme='dark'] .bess-btn-outline,
html[data-theme='dark'] .bess-filter-input,
html[data-theme='dark'] .grid-action-btn,
.dark-theme .bess-btn-outline,
.dark-theme .bess-filter-input,
.dark-theme .grid-action-btn {
  background: var(--gray-50) !important;
  border-color: var(--gray-200) !important;
  color: var(--gray-800) !important;
}

html[data-theme='dark'] .grid-action-bess:hover,
.dark-theme .grid-action-bess:hover {
  background: rgba(59, 130, 246, 0.15) !important;
}

html[data-theme='dark'] .grid-action-maint:hover,
.dark-theme .grid-action-maint:hover {
  background: rgba(245, 158, 11, 0.12) !important;
}

html[data-theme='dark'] .grid-action-avoid:hover,
.dark-theme .grid-action-avoid:hover {
  background: rgba(239, 68, 68, 0.12) !important;
}

/* =============================================================================
   Workflow Center — load dark-mode-overrides.css AFTER workflow-dashboard.css
   (fixes white swim-lane canvas, labels, modals, icon chips)
   ============================================================================= */
html[data-theme='dark'] #workflow-view .wf-lane-content,
.dark-theme #workflow-view .wf-lane-content {
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%) !important;
}

html[data-theme='dark'] #workflow-view .wf-swim-lane,
.dark-theme #workflow-view .wf-swim-lane {
  border-bottom-color: var(--gray-200) !important;
}

html[data-theme='dark'] #workflow-view .wf-lane-divider,
.dark-theme #workflow-view .wf-lane-divider {
  background: linear-gradient(90deg, transparent, var(--gray-200), transparent) !important;
}

html[data-theme='dark'] #workflow-view .wf-flow-legend,
.dark-theme #workflow-view .wf-flow-legend {
  background: var(--gray-100) !important;
  border-color: var(--gray-200) !important;
  color: var(--gray-700) !important;
}

html[data-theme='dark'] #workflow-view .wf-workflow-item .wf-label,
html[data-theme='dark'] #workflow-view .wf-panel-item .wf-label,
.dark-theme #workflow-view .wf-workflow-item .wf-label,
.dark-theme #workflow-view .wf-panel-item .wf-label {
  color: var(--gray-700) !important;
}

html[data-theme='dark'] #workflow-view .wf-workflow-item:hover,
.dark-theme #workflow-view .wf-workflow-item:hover {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.2) 0%, rgba(30, 41, 59, 0.85) 100%) !important;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.45) !important;
}

html[data-theme='dark'] #workflow-view .wf-workflow-item.highlight,
.dark-theme #workflow-view .wf-workflow-item.highlight {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.18) 0%, rgba(30, 41, 59, 0.9) 100%) !important;
}

html[data-theme='dark'] #workflow-view .wf-panel-item:hover,
.dark-theme #workflow-view .wf-panel-item:hover {
  background: linear-gradient(135deg, var(--gray-100) 0%, var(--gray-50) 100%) !important;
}

/* Icon wrapper chips — replace pastel fills with dark-tinted surfaces */
html[data-theme='dark'] #workflow-view .wf-icon-wrapper.blue,
.dark-theme #workflow-view .wf-icon-wrapper.blue {
  background: linear-gradient(145deg, #1e3a5f 0%, #172554 100%) !important;
  color: #93c5fd !important;
  border-color: #334155 !important;
}

html[data-theme='dark'] #workflow-view .wf-icon-wrapper.green,
.dark-theme #workflow-view .wf-icon-wrapper.green {
  background: linear-gradient(145deg, #14532d 0%, #166534 100%) !important;
  color: #86efac !important;
  border-color: #14532d !important;
}

html[data-theme='dark'] #workflow-view .wf-icon-wrapper.orange,
.dark-theme #workflow-view .wf-icon-wrapper.orange {
  background: linear-gradient(145deg, #7c2d12 0%, #9a3412 100%) !important;
  color: #fdba74 !important;
  border-color: #9a3412 !important;
}

html[data-theme='dark'] #workflow-view .wf-icon-wrapper.purple,
.dark-theme #workflow-view .wf-icon-wrapper.purple {
  background: linear-gradient(145deg, #4c1d95 0%, #5b21b6 100%) !important;
  color: #d8b4fe !important;
  border-color: #6b21a8 !important;
}

html[data-theme='dark'] #workflow-view .wf-icon-wrapper.teal,
.dark-theme #workflow-view .wf-icon-wrapper.teal {
  background: linear-gradient(145deg, #134e4a 0%, #115e59 100%) !important;
  color: #5eead4 !important;
  border-color: #0f766e !important;
}

html[data-theme='dark'] #workflow-view .wf-icon-wrapper.red,
.dark-theme #workflow-view .wf-icon-wrapper.red {
  background: linear-gradient(145deg, #7f1d1d 0%, #991b1b 100%) !important;
  color: #fca5a5 !important;
  border-color: #991b1b !important;
}

html[data-theme='dark'] #workflow-view .wf-icon-wrapper.gold,
.dark-theme #workflow-view .wf-icon-wrapper.gold {
  background: linear-gradient(145deg, #713f12 0%, #854d0e 100%) !important;
  color: #fde68a !important;
  border-color: #a16207 !important;
}

html[data-theme='dark'] #workflow-view .wf-icon-wrapper.gray,
.dark-theme #workflow-view .wf-icon-wrapper.gray {
  background: linear-gradient(145deg, #334155 0%, #1e293b 100%) !important;
  color: #cbd5e1 !important;
  border-color: #475569 !important;
}

/* Workflow modal */
html[data-theme='dark'] #workflow-view .wf-modal,
html[data-theme='dark'] .wf-modal-overlay .wf-modal,
.dark-theme #workflow-view .wf-modal,
.dark-theme .wf-modal-overlay .wf-modal {
  background: var(--gray-50) !important;
  border-color: var(--gray-200) !important;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.55) !important;
}

html[data-theme='dark'] #workflow-view .wf-modal-header,
html[data-theme='dark'] .wf-modal-overlay .wf-modal-header,
.dark-theme #workflow-view .wf-modal-header,
.dark-theme .wf-modal-overlay .wf-modal-header {
  background: linear-gradient(135deg, var(--gray-100) 0%, var(--gray-50) 100%) !important;
  border-bottom-color: var(--gray-200) !important;
}

html[data-theme='dark'] #workflow-view .wf-modal-header h2,
html[data-theme='dark'] .wf-modal-overlay .wf-modal-header h2,
.dark-theme #workflow-view .wf-modal-header h2,
.dark-theme .wf-modal-overlay .wf-modal-header h2 {
  color: var(--gray-900) !important;
}

html[data-theme='dark'] #workflow-view .wf-modal-body,
html[data-theme='dark'] .wf-modal-overlay .wf-modal-body,
.dark-theme #workflow-view .wf-modal-body,
.dark-theme .wf-modal-overlay .wf-modal-body {
  color: var(--gray-800) !important;
}

html[data-theme='dark'] #workflow-view .wf-modal-body p,
html[data-theme='dark'] .wf-modal-overlay .wf-modal-body p,
.dark-theme #workflow-view .wf-modal-body p,
.dark-theme .wf-modal-overlay .wf-modal-body p {
  color: var(--gray-600) !important;
}

html[data-theme='dark'] #workflow-view .wf-modal-close,
html[data-theme='dark'] .wf-modal-overlay .wf-modal-close,
.dark-theme #workflow-view .wf-modal-close,
.dark-theme .wf-modal-overlay .wf-modal-close {
  color: var(--gray-600) !important;
}

html[data-theme='dark'] #workflow-view .wf-modal-close:hover,
html[data-theme='dark'] .wf-modal-overlay .wf-modal-close:hover,
.dark-theme #workflow-view .wf-modal-close:hover,
.dark-theme .wf-modal-overlay .wf-modal-close:hover {
  background: var(--gray-100) !important;
  color: var(--gray-900) !important;
}

html[data-theme='dark'] #workflow-view .wf-btn-secondary,
html[data-theme='dark'] .wf-modal-overlay .wf-btn-secondary,
html[data-theme='dark'] #workflow-view .btn-secondary,
html[data-theme='dark'] .wf-modal-overlay .btn-secondary,
.dark-theme #workflow-view .wf-btn-secondary,
.dark-theme .wf-modal-overlay .wf-btn-secondary,
.dark-theme #workflow-view .btn-secondary,
.dark-theme .wf-modal-overlay .btn-secondary {
  background: linear-gradient(135deg, var(--gray-100) 0%, var(--gray-50) 100%) !important;
  color: var(--gray-800) !important;
  border: 1px solid var(--gray-200) !important;
}

html[data-theme='dark'] #workflow-view .wf-btn-secondary:hover,
html[data-theme='dark'] .wf-modal-overlay .wf-btn-secondary:hover,
html[data-theme='dark'] #workflow-view .btn-secondary:hover,
html[data-theme='dark'] .wf-modal-overlay .btn-secondary:hover,
.dark-theme #workflow-view .wf-btn-secondary:hover,
.dark-theme .wf-modal-overlay .wf-btn-secondary:hover,
.dark-theme #workflow-view .btn-secondary:hover,
.dark-theme .wf-modal-overlay .btn-secondary:hover {
  background: linear-gradient(135deg, var(--gray-200) 0%, var(--gray-100) 100%) !important;
  border-color: var(--gray-300) !important;
}

html[data-theme='dark'] #workflow-view .wf-btn-primary,
html[data-theme='dark'] .wf-modal-overlay .wf-btn-primary,
html[data-theme='dark'] #workflow-view .btn-primary,
html[data-theme='dark'] .wf-modal-overlay .btn-primary,
.dark-theme #workflow-view .wf-btn-primary,
.dark-theme .wf-modal-overlay .wf-btn-primary,
.dark-theme #workflow-view .btn-primary,
.dark-theme .wf-modal-overlay .btn-primary {
  color: #fff !important;
}

html[data-theme='dark'] #workflow-view .wf-btn-success,
html[data-theme='dark'] .wf-modal-overlay .wf-btn-success,
html[data-theme='dark'] #workflow-view .btn-success,
html[data-theme='dark'] .wf-modal-overlay .btn-success,
.dark-theme #workflow-view .wf-btn-success,
.dark-theme .wf-modal-overlay .wf-btn-success,
.dark-theme #workflow-view .btn-success,
.dark-theme .wf-modal-overlay .btn-success {
  color: #fff !important;
}

html[data-theme='dark'] #workflow-view .wf-btn-primary i,
html[data-theme='dark'] .wf-modal-overlay .wf-btn-primary i,
html[data-theme='dark'] #workflow-view .wf-btn-success i,
html[data-theme='dark'] .wf-modal-overlay .wf-btn-success i,
html[data-theme='dark'] #workflow-view .btn-primary i,
html[data-theme='dark'] .wf-modal-overlay .btn-primary i,
html[data-theme='dark'] #workflow-view .btn-success i,
html[data-theme='dark'] .wf-modal-overlay .btn-success i,
.dark-theme #workflow-view .wf-btn-primary i,
.dark-theme .wf-modal-overlay .wf-btn-primary i,
.dark-theme #workflow-view .wf-btn-success i,
.dark-theme .wf-modal-overlay .wf-btn-success i,
.dark-theme #workflow-view .btn-primary i,
.dark-theme .wf-modal-overlay .btn-primary i,
.dark-theme #workflow-view .btn-success i,
.dark-theme .wf-modal-overlay .btn-success i {
  color: inherit !important;
}

/* Quick stats row — label contrast */
html[data-theme='dark'] #workflow-view .wf-stat-card .label,
.dark-theme #workflow-view .wf-stat-card .label {
  color: var(--gray-600) !important;
}

/* Report center shell */
html[data-theme='dark'] .wf-rc-header,
.dark-theme .wf-rc-header {
  border-bottom-color: var(--gray-200) !important;
}

html[data-theme='dark'] .wf-rc-search i,
.dark-theme .wf-rc-search i {
  color: var(--gray-500) !important;
}

html[data-theme='dark'] .wf-rc-report:hover,
.dark-theme .wf-rc-report:hover {
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.12) 0%, transparent 100%) !important;
}

/* —— Fleet Intelligence (TurbineIQ) + embedded turbine fleet —— */
html[data-theme='dark'] .tiq-fi-subtab:not(.active),
.dark-theme .tiq-fi-subtab:not(.active) {
  color: var(--gray-600) !important;
}

html[data-theme='dark'] .tiq-fi-subtab:not(.active):hover,
.dark-theme .tiq-fi-subtab:not(.active):hover {
  color: var(--gray-800) !important;
  background: var(--gray-100) !important;
}

html[data-theme='dark'] .tiq-fi-intro,
.dark-theme .tiq-fi-intro {
  color: var(--gray-600) !important;
}

/* JS-generated cards use inline background:#fff — override for dark surfaces */
html[data-theme='dark'] #tiq-tab-fleet-intelligence [style*='background:#fff'],
html[data-theme='dark'] #tiq-tab-fleet-intelligence [style*='background: #fff'],
.dark-theme #tiq-tab-fleet-intelligence [style*='background:#fff'],
.dark-theme #tiq-tab-fleet-intelligence [style*='background: #fff'] {
  background: var(--gray-50) !important;
  border-color: var(--gray-200) !important;
  color: var(--gray-800) !important;
}

html[data-theme='dark'] #tiq-tab-fleet-intelligence table,
html[data-theme='dark'] #tiq-tab-fleet-intelligence th,
html[data-theme='dark'] #tiq-tab-fleet-intelligence td,
.dark-theme #tiq-tab-fleet-intelligence table,
.dark-theme #tiq-tab-fleet-intelligence th,
.dark-theme #tiq-tab-fleet-intelligence td {
  color: var(--gray-800) !important;
  border-color: var(--gray-200) !important;
}

html[data-theme='dark'] #tiq-tab-fleet-intelligence thead tr,
.dark-theme #tiq-tab-fleet-intelligence thead tr {
  border-bottom-color: var(--gray-200) !important;
}

html[data-theme='dark'] #tiq-tab-fleet-intelligence tbody tr,
.dark-theme #tiq-tab-fleet-intelligence tbody tr {
  border-bottom-color: var(--gray-200) !important;
}

html[data-theme='dark'] #tiq-grid-content,
.dark-theme #tiq-grid-content {
  color: var(--gray-700) !important;
}

/* Fleet overview — live integration + demo banners */
html[data-theme='dark'] .fleet-live-health-banner--unknown,
.dark-theme .fleet-live-health-banner--unknown {
  background: rgba(55, 48, 163, 0.28) !important;
  border-color: rgba(129, 140, 248, 0.45) !important;
  color: #c7d2fe !important;
}

html[data-theme='dark'] .fleet-live-health-banner--live,
.dark-theme .fleet-live-health-banner--live {
  background: rgba(6, 78, 59, 0.45) !important;
  border-color: rgba(52, 211, 153, 0.45) !important;
  color: #a7f3d0 !important;
}

html[data-theme='dark'] .fleet-live-health-banner--stale,
.dark-theme .fleet-live-health-banner--stale {
  background: rgba(120, 53, 15, 0.35) !important;
  border-color: rgba(251, 191, 36, 0.45) !important;
  color: #fde68a !important;
}

html[data-theme='dark'] .fleet-live-health-banner--degraded,
.dark-theme .fleet-live-health-banner--degraded {
  background: rgba(127, 29, 29, 0.5) !important;
  border-color: rgba(248, 113, 113, 0.4) !important;
  color: #fecaca !important;
}

html[data-theme='dark'] .fleet-data-mode-banner,
.dark-theme .fleet-data-mode-banner {
  background: rgba(180, 83, 9, 0.25) !important;
  border-color: rgba(251, 191, 36, 0.4) !important;
  color: #fde68a !important;
}

/* Turbine Fleet — farm/status selects (styles.css uses background: white) */
html[data-theme='dark'] #turbines-view .turbine-filters select,
.dark-theme #turbines-view .turbine-filters select {
  background-color: var(--gray-50) !important;
  color: var(--gray-900) !important;
  border-color: var(--gray-300) !important;
  color-scheme: dark;
}

/* TurbineIQ-embedded fleet: list selection + hover */
html[data-theme='dark'] #turbines-view.tiq-fleet-embed .fleet-list-item.is-active,
.dark-theme #turbines-view.tiq-fleet-embed .fleet-list-item.is-active {
  background: rgba(0, 212, 170, 0.18) !important;
  border-color: rgba(0, 212, 170, 0.5) !important;
}

html[data-theme='dark'] #turbines-view.tiq-fleet-embed .fleet-list-item:hover,
.dark-theme #turbines-view.tiq-fleet-embed .fleet-list-item:hover {
  background: var(--gray-100) !important;
}

html[data-theme='dark'] #turbines-view.tiq-fleet-embed .fleet-sidebar-header,
html[data-theme='dark'] #turbines-view.tiq-fleet-embed .fleet-detail-head,
.dark-theme #turbines-view.tiq-fleet-embed .fleet-sidebar-header,
.dark-theme #turbines-view.tiq-fleet-embed .fleet-detail-head {
  border-bottom-color: var(--gray-200) !important;
}

html[data-theme='dark'] .fleet-sidebar-card,
html[data-theme='dark'] .fleet-detail-card,
.dark-theme .fleet-sidebar-card,
.dark-theme .fleet-detail-card {
  background: var(--gray-50) !important;
  border-color: var(--gray-200) !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35) !important;
}

html[data-theme='dark'] .fleet-comp-box,
.dark-theme .fleet-comp-box {
  background: var(--gray-100) !important;
  border-color: var(--gray-200) !important;
}

html[data-theme='dark'] .fleet-comp-pct,
html[data-theme='dark'] .fleet-list-title,
html[data-theme='dark'] .fleet-list-power,
html[data-theme='dark'] .fleet-detail-title,
.dark-theme .fleet-comp-pct,
.dark-theme .fleet-list-title,
.dark-theme .fleet-list-power,
.dark-theme .fleet-detail-title {
  color: var(--gray-900) !important;
}

html[data-theme='dark'] .fleet-comp-lbl,
html[data-theme='dark'] .fleet-list-status,
html[data-theme='dark'] .fleet-list-id,
.dark-theme .fleet-comp-lbl,
.dark-theme .fleet-list-status,
.dark-theme .fleet-list-id {
  color: var(--gray-600) !important;
}

/* TurbineIQ modal (Grid/TSO actions — rendered on body) */
html[data-theme='dark'] #tiq-modal-overlay > div,
.dark-theme #tiq-modal-overlay > div {
  background: var(--gray-50) !important;
  color: var(--gray-800) !important;
}

html[data-theme='dark'] #tiq-modal-overlay h3,
.dark-theme #tiq-modal-overlay h3 {
  color: var(--gray-900) !important;
}

/* Contract Management — #contract-mgmt-view inline styles use fixed white inputs */
html[data-theme='dark'] #contract-mgmt-view .form-input,
html[data-theme='dark'] #contract-mgmt-view .form-textarea,
html[data-theme='dark'] #contract-mgmt-view select.form-input,
.dark-theme #contract-mgmt-view .form-input,
.dark-theme #contract-mgmt-view .form-textarea,
.dark-theme #contract-mgmt-view select.form-input {
  background: var(--gray-50) !important;
  border-color: var(--gray-200) !important;
  color: var(--gray-900) !important;
}

html[data-theme='dark'] #contract-mgmt-view .form-input:focus,
.dark-theme #contract-mgmt-view .form-input:focus {
  background: var(--gray-50) !important;
  color: var(--gray-900) !important;
}

html[data-theme='dark'] #contract-mgmt-view .form-label,
.dark-theme #contract-mgmt-view .form-label {
  color: var(--gray-700) !important;
}

html[data-theme='dark'] #contract-mgmt-view h1,
html[data-theme='dark'] #contract-mgmt-view h2,
.dark-theme #contract-mgmt-view h1,
.dark-theme #contract-mgmt-view h2 {
  color: var(--gray-900) !important;
}

html[data-theme='dark'] #contract-mgmt-view .contract-management > p,
.dark-theme #contract-mgmt-view .contract-management > p {
  color: var(--gray-600) !important;
}

html[data-theme='dark'] #contract-mgmt-view .tab-buttons,
.dark-theme #contract-mgmt-view .tab-buttons {
  border-bottom-color: var(--gray-200) !important;
}

html[data-theme='dark'] #contract-mgmt-view .upload-dropzone,
html[data-theme='dark'] #contract-mgmt-view .csv-upload-area,
.dark-theme #contract-mgmt-view .upload-dropzone,
.dark-theme #contract-mgmt-view .csv-upload-area {
  background: var(--gray-100) !important;
  border-color: var(--gray-200) !important;
}

html[data-theme='dark'] #contract-mgmt-view .contract-card,
.dark-theme #contract-mgmt-view .contract-card {
  background: var(--gray-50) !important;
  border-color: var(--gray-200) !important;
  color: var(--gray-800) !important;
}

html[data-theme='dark'] #contract-mgmt-view .action-btn,
.dark-theme #contract-mgmt-view .action-btn {
  background: var(--gray-50) !important;
  border-color: var(--gray-200) !important;
  color: var(--gray-800) !important;
}

/* Contract Management - EIB tab: fix low contrast on dark mode for inline-light cards */
html[data-theme='dark'] #contract-mgmt-view .cm-eib-onboarding-banner,
.dark-theme #contract-mgmt-view .cm-eib-onboarding-banner {
  background: linear-gradient(135deg, rgba(13, 148, 136, 0.18), rgba(37, 99, 235, 0.16)) !important;
  border-color: rgba(45, 212, 191, 0.4) !important;
}

html[data-theme='dark'] #contract-mgmt-view .cm-eib-onboarding-banner p,
.dark-theme #contract-mgmt-view .cm-eib-onboarding-banner p {
  color: #d1fae5 !important;
}

html[data-theme='dark'] #contract-mgmt-view .cm-eib-upload-dropzone,
.dark-theme #contract-mgmt-view .cm-eib-upload-dropzone {
  background: rgba(15, 23, 42, 0.72) !important;
  border-color: rgba(148, 163, 184, 0.45) !important;
}

html[data-theme='dark'] #contract-mgmt-view .cm-eib-upload-dropzone p,
.dark-theme #contract-mgmt-view .cm-eib-upload-dropzone p {
  color: #e2e8f0 !important;
}

html[data-theme='dark'] #contract-mgmt-view .cm-eib-header-card,
.dark-theme #contract-mgmt-view .cm-eib-header-card {
  background: rgba(15, 23, 42, 0.75) !important;
}

html[data-theme='dark'] #contract-mgmt-view .cm-eib-header-card--community,
.dark-theme #contract-mgmt-view .cm-eib-header-card--community {
  border-color: rgba(96, 165, 250, 0.45) !important;
}

html[data-theme='dark'] #contract-mgmt-view .cm-eib-header-card--landowner,
.dark-theme #contract-mgmt-view .cm-eib-header-card--landowner {
  border-color: rgba(74, 222, 128, 0.45) !important;
}

html[data-theme='dark'] #contract-mgmt-view .cm-eib-header-card p,
.dark-theme #contract-mgmt-view .cm-eib-header-card p {
  color: #cbd5e1 !important;
}

/* Field Ops Advanced — ensure section titles / tables inherit on dark surfaces */
html[data-theme='dark'] #field-ops-advanced-view .foa-section-title,
.dark-theme #field-ops-advanced-view .foa-section-title {
  color: var(--gray-900) !important;
}

/* Outline buttons — dark surfaces (global .btn-outline) */
html[data-theme='dark'] .btn-outline,
.dark-theme .btn-outline {
  background: var(--gray-100) !important;
  border-color: var(--gray-300) !important;
  color: var(--gray-800) !important;
}

html[data-theme='dark'] .btn-outline:hover,
.dark-theme .btn-outline:hover {
  background: var(--gray-200) !important;
  border-color: var(--gray-400) !important;
  color: var(--gray-900) !important;
}

/* Secondary buttons — use semantic surfaces (replaces hardcoded white from light styles) */
html[data-theme='dark'] .btn-secondary,
.dark-theme .btn-secondary {
  background: var(--color-background-primary) !important;
  color: var(--gray-800) !important;
  border-color: var(--gray-200) !important;
}

html[data-theme='dark'] .btn-secondary:hover,
.dark-theme .btn-secondary:hover {
  background: var(--gray-100) !important;
  border-color: var(--primary-green) !important;
  color: var(--gray-900) !important;
}

html[data-theme='dark'] .btn-secondary:disabled,
.dark-theme .btn-secondary:disabled {
  background: var(--gray-100) !important;
  color: var(--gray-500) !important;
  border-color: var(--gray-200) !important;
  opacity: 0.7 !important;
}

/* Field Ops Advanced — primary buttons (Send Notification, etc.); modal is portaled to #foa-modal-overlay */
html[data-theme='dark'] #field-ops-advanced-view .btn-primary,
.dark-theme #field-ops-advanced-view .btn-primary,
html[data-theme='dark'] #foa-modal-overlay .btn-primary,
.dark-theme #foa-modal-overlay .btn-primary {
  color: #fff !important;
  background: #00d4aa !important;
  border: 1px solid rgba(0, 212, 170, 0.45) !important;
  box-shadow: none !important;
}

html[data-theme='dark'] #field-ops-advanced-view .btn-primary:hover,
.dark-theme #field-ops-advanced-view .btn-primary:hover,
html[data-theme='dark'] #foa-modal-overlay .btn-primary:hover,
.dark-theme #foa-modal-overlay .btn-primary:hover {
  background: #00bf9a !important;
}

html[data-theme='dark'] #field-ops-advanced-view .btn-primary::before,
.dark-theme #field-ops-advanced-view .btn-primary::before,
html[data-theme='dark'] #foa-modal-overlay .btn-primary::before,
.dark-theme #foa-modal-overlay .btn-primary::before {
  display: none !important;
}

/* Decommissioning — primary (Save Plan) matches solid mint on dark */
html[data-theme='dark'] #decommissioning-view .btn-primary,
.dark-theme #decommissioning-view .btn-primary {
  color: #fff !important;
  background: #00d4aa !important;
  border: 1px solid rgba(0, 212, 170, 0.45) !important;
  box-shadow: none !important;
}

html[data-theme='dark'] #decommissioning-view .btn-primary:hover,
.dark-theme #decommissioning-view .btn-primary:hover {
  background: #00bf9a !important;
}

html[data-theme='dark'] #decommissioning-view .btn-primary::before,
.dark-theme #decommissioning-view .btn-primary::before {
  display: none !important;
}

/* Settlement Processing — primary actions readable on dark dashboards */
html[data-theme='dark'] #settlement-view .btn-primary,
.dark-theme #settlement-view .btn-primary {
  color: #fff !important;
  background: #00d4aa !important;
  border: 1px solid rgba(0, 212, 170, 0.45) !important;
  box-shadow: none !important;
}

html[data-theme='dark'] #settlement-view .btn-primary:hover,
.dark-theme #settlement-view .btn-primary:hover {
  background: #00bf9a !important;
}

html[data-theme='dark'] #settlement-view .btn-primary::before,
.dark-theme #settlement-view .btn-primary::before {
  display: none !important;
}

/* Settlement Sandbox — Calculate Base Case, Preview with Overrides, Run Sweep (.btn-primary.btn-small) */
html[data-theme='dark'] #settlement-sandbox-view .btn-primary,
.dark-theme #settlement-sandbox-view .btn-primary {
  color: #fff !important;
  background: #00d4aa !important;
  border: 1px solid rgba(0, 212, 170, 0.45) !important;
  box-shadow: none !important;
}

html[data-theme='dark'] #settlement-sandbox-view .btn-primary:hover,
.dark-theme #settlement-sandbox-view .btn-primary:hover {
  background: #00bf9a !important;
}

html[data-theme='dark'] #settlement-sandbox-view .btn-primary::before,
.dark-theme #settlement-sandbox-view .btn-primary::before {
  display: none !important;
}

/* Settlement Adjustments & Disputes — header Refresh (.gl-controls .btn-primary.btn-small) */
html[data-theme='dark'] #settlement-adjustments-view .btn-primary,
.dark-theme #settlement-adjustments-view .btn-primary {
  color: #fff !important;
  background: #00d4aa !important;
  border: 1px solid rgba(0, 212, 170, 0.45) !important;
  box-shadow: none !important;
}

html[data-theme='dark'] #settlement-adjustments-view .btn-primary:hover,
.dark-theme #settlement-adjustments-view .btn-primary:hover {
  background: #00bf9a !important;
}

html[data-theme='dark'] #settlement-adjustments-view .btn-primary::before,
.dark-theme #settlement-adjustments-view .btn-primary::before {
  display: none !important;
}

/* Settlement Processing — Adjustments / Disputes toolbars: Refresh + status filter (hardcoded white select) */
html[data-theme='dark'] #settlement-view .settlement-adjustments-section .history-filters .btn-secondary,
.dark-theme #settlement-view .settlement-adjustments-section .history-filters .btn-secondary {
  background: var(--gray-50) !important;
  border-color: var(--gray-200) !important;
  color: var(--gray-800) !important;
}

html[data-theme='dark'] #settlement-view .settlement-adjustments-section .history-filters .btn-secondary:hover,
.dark-theme #settlement-view .settlement-adjustments-section .history-filters .btn-secondary:hover {
  background: var(--gray-200) !important;
  border-color: var(--primary-green) !important;
  color: var(--gray-900) !important;
}

html[data-theme='dark'] #settlement-view .settlement-adjustments-section .history-filters .btn-secondary::before,
.dark-theme #settlement-view .settlement-adjustments-section .history-filters .btn-secondary::before {
  display: none !important;
}

html[data-theme='dark'] #settlement-view .settlement-adjustments-section .history-filters select,
.dark-theme #settlement-view .settlement-adjustments-section .history-filters select {
  background-color: var(--gray-50) !important;
  color: var(--gray-900) !important;
  border-color: var(--gray-300) !important;
}

/* Approval Chain — inner cards used hardcoded white; step gradient faded to page background */
html[data-theme='dark'] .approval-chain-config,
html[data-theme='dark'] .approval-chain-status,
.dark-theme .approval-chain-config,
.dark-theme .approval-chain-status {
  background: var(--gray-50) !important;
  border-color: var(--gray-200) !important;
  color: var(--gray-800) !important;
}

html[data-theme='dark'] .approval-chain-step,
.dark-theme .approval-chain-step {
  background: linear-gradient(135deg, var(--gray-100) 0%, var(--gray-50) 100%) !important;
  border-color: var(--gray-200) !important;
}

html[data-theme='dark'] .approval-chain-complete-banner,
.dark-theme .approval-chain-complete-banner {
  background: rgba(16, 185, 129, 0.16) !important;
  border-color: rgba(16, 185, 129, 0.42) !important;
  color: var(--gray-900) !important;
}

html[data-theme='dark'] .approval-chain-complete-banner .approval-chain-complete-banner__icon,
.dark-theme .approval-chain-complete-banner .approval-chain-complete-banner__icon {
  color: #34d399 !important;
}

html[data-theme='dark'] .approval-batch-banner,
.dark-theme .approval-batch-banner {
  background: rgba(59, 130, 246, 0.14) !important;
  border-color: rgba(59, 130, 246, 0.35) !important;
  color: var(--gray-900) !important;
}

html[data-theme='dark'] .approval-batch-banner .approval-batch-banner__icon,
.dark-theme .approval-batch-banner .approval-batch-banner__icon {
  color: #60a5fa !important;
}

/* General Ledger — Period dropdown + header Refresh (hardcoded white + cascade vs .dark-theme select) */
html[data-theme='dark'] #general-ledger-view .gl-controls .control-select,
.dark-theme #general-ledger-view .gl-controls .control-select {
  background-color: var(--gray-50) !important;
  color: var(--gray-900) !important;
  border-color: var(--gray-300) !important;
}

html[data-theme='dark'] #general-ledger-view .btn-primary,
.dark-theme #general-ledger-view .btn-primary {
  color: #fff !important;
  background: #00d4aa !important;
  border: 1px solid rgba(0, 212, 170, 0.45) !important;
  box-shadow: none !important;
}

html[data-theme='dark'] #general-ledger-view .btn-primary:hover,
.dark-theme #general-ledger-view .btn-primary:hover {
  background: #00bf9a !important;
}

html[data-theme='dark'] #general-ledger-view .btn-primary::before,
.dark-theme #general-ledger-view .btn-primary::before {
  display: none !important;
}

/* General Ledger — tabs, section titles, chart legends (inactive tabs were too dim vs dark chrome) */
html[data-theme='dark'] #general-ledger-view .gl-tab:not(.active),
.dark-theme #general-ledger-view .gl-tab:not(.active) {
  color: var(--gray-500) !important;
}

html[data-theme='dark'] #general-ledger-view .rev-sub-tab:not(.active),
.dark-theme #general-ledger-view .rev-sub-tab:not(.active) {
  color: var(--gray-500) !important;
}

html[data-theme='dark'] #general-ledger-view .gl-controls .control-label,
.dark-theme #general-ledger-view .gl-controls .control-label {
  color: var(--gray-600) !important;
}

html[data-theme='dark'] #general-ledger-view .table-header h3,
html[data-theme='dark'] #general-ledger-view .chart-header h3,
.dark-theme #general-ledger-view .table-header h3,
.dark-theme #general-ledger-view .chart-header h3 {
  color: var(--gray-900) !important;
}

html[data-theme='dark'] #general-ledger-view .legend-item,
.dark-theme #general-ledger-view .legend-item {
  color: var(--gray-800) !important;
}

html[data-theme='dark'] .je-modal,
.dark-theme .je-modal {
  color: var(--gray-900) !important;
}

html[data-theme='dark'] .je-modal .je-modal-header h2,
.dark-theme .je-modal .je-modal-header h2 {
  color: var(--gray-900) !important;
}

/* Financial Overview (Financial Analytics Dashboard) — date range, KPI figures, section titles */
html[data-theme='dark'] #financial-view .date-range-selector select,
.dark-theme #financial-view .date-range-selector select {
  background-color: var(--gray-50) !important;
  color: var(--gray-900) !important;
  border-color: var(--gray-300) !important;
}

html[data-theme='dark'] #financial-view .panel-header h3,
html[data-theme='dark'] #financial-view .table-header h3,
html[data-theme='dark'] #financial-view .chart-header h3,
.dark-theme #financial-view .panel-header h3,
.dark-theme #financial-view .table-header h3,
.dark-theme #financial-view .chart-header h3 {
  color: var(--gray-900) !important;
}

html[data-theme='dark'] #financial-view .font-medium.text-lg,
.dark-theme #financial-view .font-medium.text-lg {
  color: var(--gray-900) !important;
}

html[data-theme='dark'] #financial-view .legend-item,
.dark-theme #financial-view .legend-item {
  color: var(--gray-800) !important;
}

/* Financial Overview — revenue projections (base uses --primary-dark; stays dark on dark cards) */
html[data-theme='dark'] #financial-view .projection-card,
.dark-theme #financial-view .projection-card {
  background: var(--gray-100) !important;
  border: 1px solid var(--gray-200) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
html[data-theme='dark'] #financial-view .projection-value,
.dark-theme #financial-view .projection-value {
  color: var(--primary-green) !important;
}
html[data-theme='dark'] #financial-view .projection-label,
html[data-theme='dark'] #financial-view .projection-detail,
.dark-theme #financial-view .projection-label,
.dark-theme #financial-view .projection-detail {
  color: var(--gray-600) !important;
}

/* General Ledger — Overview tab only (metrics + charts row) */
html[data-theme='dark'] #gl-tab-overview .legend-item,
.dark-theme #gl-tab-overview .legend-item {
  color: var(--gray-800) !important;
}

/* Treasury Management — header controls + Refresh (same treatment as GL) */
html[data-theme='dark'] #treasury-view .gl-controls .control-select,
.dark-theme #treasury-view .gl-controls .control-select {
  background-color: var(--gray-50) !important;
  color: var(--gray-900) !important;
  border-color: var(--gray-300) !important;
}

html[data-theme='dark'] #treasury-view .btn-primary,
.dark-theme #treasury-view .btn-primary {
  color: #fff !important;
  background: #00d4aa !important;
  border: 1px solid rgba(0, 212, 170, 0.45) !important;
  box-shadow: none !important;
}

html[data-theme='dark'] #treasury-view .btn-primary:hover,
.dark-theme #treasury-view .btn-primary:hover {
  background: #00bf9a !important;
}

html[data-theme='dark'] #treasury-view .btn-primary::before,
.dark-theme #treasury-view .btn-primary::before {
  display: none !important;
}

html[data-theme='dark'] #treasury-view .btn-primary i,
.dark-theme #treasury-view .btn-primary i {
  color: inherit !important;
}

/* Treasury — New Check, Create Check, Print (.ep-tab-content color !important + .btn-small white bg) */
html[data-theme='dark'] #treasury-view .btn-primary.btn-small,
html[data-theme='dark'] #treasury-view .btn-small.btn-primary,
.dark-theme #treasury-view .btn-primary.btn-small,
.dark-theme #treasury-view .btn-small.btn-primary {
  color: #fff !important;
  background: #00d4aa !important;
  border: 1px solid rgba(0, 212, 170, 0.45) !important;
  box-shadow: none !important;
}

html[data-theme='dark'] #treasury-view .btn-primary.btn-small:hover,
html[data-theme='dark'] #treasury-view .btn-small.btn-primary:hover,
.dark-theme #treasury-view .btn-primary.btn-small:hover,
.dark-theme #treasury-view .btn-small.btn-primary:hover {
  background: #00bf9a !important;
  color: #fff !important;
  border-color: rgba(0, 212, 170, 0.55) !important;
}

html[data-theme='dark'] #treasury-view .btn-danger.btn-small,
html[data-theme='dark'] #treasury-view .btn-small.btn-danger,
.dark-theme #treasury-view .btn-danger.btn-small,
.dark-theme #treasury-view .btn-small.btn-danger {
  color: #fff !important;
  background: var(--danger) !important;
  border: 1px solid rgba(239, 68, 68, 0.45) !important;
  box-shadow: none !important;
}

html[data-theme='dark'] #treasury-view .btn-danger.btn-small:hover,
html[data-theme='dark'] #treasury-view .btn-small.btn-danger:hover,
.dark-theme #treasury-view .btn-danger.btn-small:hover,
.dark-theme #treasury-view .btn-small.btn-danger:hover {
  background: #dc2626 !important;
  color: #fff !important;
  border-color: rgba(239, 68, 68, 0.65) !important;
}

/* Treasury — Write Checks: Refresh uses .btn-secondary.btn-small (global .btn-small forces white bg) */
html[data-theme='dark'] #treasury-view .btn-secondary.btn-small,
.dark-theme #treasury-view .btn-secondary.btn-small {
  background: var(--gray-50) !important;
  border-color: var(--gray-200) !important;
  color: var(--gray-800) !important;
  box-shadow: none !important;
}

html[data-theme='dark'] #treasury-view .btn-secondary.btn-small:hover,
.dark-theme #treasury-view .btn-secondary.btn-small:hover {
  background: var(--gray-200) !important;
  border-color: var(--primary-green) !important;
  color: var(--gray-900) !important;
}

html[data-theme='dark'] #treasury-view .btn-secondary.btn-small::before,
.dark-theme #treasury-view .btn-secondary.btn-small::before {
  display: none !important;
}

/* Treasury — New Check form panel + inputs (inline styles in JS were light-only) */
html[data-theme='dark'] #treasury-view .tr-check-form-panel,
.dark-theme #treasury-view .tr-check-form-panel {
  background: var(--gray-100) !important;
  border-color: var(--gray-200) !important;
}

html[data-theme='dark'] #treasury-view .tr-check-form-panel h4,
.dark-theme #treasury-view .tr-check-form-panel h4 {
  color: var(--gray-900) !important;
}

html[data-theme='dark'] #treasury-view .tr-check-form-panel label,
.dark-theme #treasury-view .tr-check-form-panel label {
  color: var(--gray-700) !important;
}

html[data-theme='dark'] #treasury-view .tr-check-form-input,
.dark-theme #treasury-view .tr-check-form-input {
  background: var(--gray-50) !important;
  border: 1px solid var(--gray-200) !important;
  color: var(--gray-900) !important;
}

html[data-theme='dark'] #treasury-view .tr-check-form-input:focus:not(:focus-visible),
.dark-theme #treasury-view .tr-check-form-input:focus:not(:focus-visible) {
  background: var(--gray-900) !important;
  color: var(--gray-100) !important;
  border-color: var(--primary-green) !important;
  outline: none;
}

html[data-theme='dark'] #treasury-view .tr-check-success-msg,
.dark-theme #treasury-view .tr-check-success-msg {
  background: rgba(16, 185, 129, 0.12) !important;
  border-color: rgba(16, 185, 129, 0.35) !important;
  color: var(--gray-800) !important;
}

html[data-theme='dark'] #treasury-view .ep-tab--write-checks:not(.active),
.dark-theme #treasury-view .ep-tab--write-checks:not(.active) {
  color: #a5b4fc !important;
}

html[data-theme='dark'] #treasury-view .ep-tab--write-checks.active,
.dark-theme #treasury-view .ep-tab--write-checks.active {
  color: var(--primary-green) !important;
}

/* Compliance & Audit View — date range (native date inputs often ignore .dark-theme input) */
html[data-theme='dark'] #audit-view .audit-filters input[type='date'],
.dark-theme #audit-view .audit-filters input[type='date'] {
  background-color: var(--gray-50) !important;
  color: var(--gray-900) !important;
  border: 1px solid var(--gray-300) !important;
  border-radius: var(--radius-md);
  padding: var(--spacing-sm) var(--spacing-md);
  font-size: 0.9375rem;
  color-scheme: dark;
}

html[data-theme='dark'] #audit-view .audit-filters input[type='date']:focus:not(:focus-visible),
.dark-theme #audit-view .audit-filters input[type='date']:focus:not(:focus-visible) {
  background: var(--gray-900) !important;
  color: var(--gray-100) !important;
  border-color: var(--primary-green) !important;
  outline: none;
}

html[data-theme='dark'] #audit-view .audit-filters input[type='date']::-webkit-calendar-picker-indicator,
.dark-theme #audit-view .audit-filters input[type='date']::-webkit-calendar-picker-indicator {
  filter: invert(1);
  opacity: 0.9;
}

/* Insurance — Enterprise Insurance Management / History tab date range & filters */
html[data-theme='dark'] #insurance-view .insurance-history-filters,
.dark-theme #insurance-view .insurance-history-filters {
  background-color: var(--gray-50) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35) !important;
}

html[data-theme='dark'] #insurance-view .insurance-history-filters .insurance-hist-filter-label,
.dark-theme #insurance-view .insurance-history-filters .insurance-hist-filter-label {
  color: var(--gray-500) !important;
}

html[data-theme='dark'] #insurance-view .insurance-history-filters input[type='date'],
.dark-theme #insurance-view .insurance-history-filters input[type='date'] {
  background-color: var(--gray-50) !important;
  color: var(--gray-900) !important;
  border: 1px solid var(--gray-300) !important;
  border-radius: var(--radius-md);
  color-scheme: dark;
}

html[data-theme='dark'] #insurance-view .insurance-history-filters input[type='date']:focus:not(:focus-visible),
.dark-theme #insurance-view .insurance-history-filters input[type='date']:focus:not(:focus-visible) {
  background: var(--gray-900) !important;
  color: var(--gray-100) !important;
  border-color: var(--primary-green) !important;
  outline: none;
}

html[data-theme='dark']
  #insurance-view
  .insurance-history-filters
  input[type='date']::-webkit-calendar-picker-indicator,
.dark-theme #insurance-view .insurance-history-filters input[type='date']::-webkit-calendar-picker-indicator {
  filter: invert(1);
  opacity: 0.9;
}

html[data-theme='dark'] #insurance-view .insurance-history-filters select,
html[data-theme='dark'] #insurance-view .insurance-history-filters input[type='text'],
.dark-theme #insurance-view .insurance-history-filters select,
.dark-theme #insurance-view .insurance-history-filters input[type='text'] {
  background-color: var(--gray-50) !important;
  color: var(--gray-900) !important;
  border: 1px solid var(--gray-300) !important;
  border-radius: var(--radius-md);
}

html[data-theme='dark'] #insurance-view .insurance-history-filters select:focus:not(:focus-visible),
html[data-theme='dark'] #insurance-view .insurance-history-filters input[type='text']:focus:not(:focus-visible),
.dark-theme #insurance-view .insurance-history-filters select:focus:not(:focus-visible),
.dark-theme #insurance-view .insurance-history-filters input[type='text']:focus:not(:focus-visible) {
  border-color: var(--primary-green) !important;
  outline: none;
}

/* Tax & Compliance Management — header Refresh (.gl-controls .btn-primary.btn-small) */
html[data-theme='dark'] #tax-compliance-view .btn-primary,
.dark-theme #tax-compliance-view .btn-primary {
  color: #fff !important;
  background: #00d4aa !important;
  border: 1px solid rgba(0, 212, 170, 0.45) !important;
  box-shadow: none !important;
}

html[data-theme='dark'] #tax-compliance-view .btn-primary:hover,
.dark-theme #tax-compliance-view .btn-primary:hover {
  background: #00bf9a !important;
  color: #fff !important;
}

html[data-theme='dark'] #tax-compliance-view .btn-primary::before,
.dark-theme #tax-compliance-view .btn-primary::before {
  display: none !important;
}

html[data-theme='dark'] #tax-compliance-view .btn-primary i,
.dark-theme #tax-compliance-view .btn-primary i {
  color: inherit !important;
}

/* ERP Integration & Banking — header Refresh (same as GL / Treasury) */
html[data-theme='dark'] #erp-banking-view .btn-primary,
.dark-theme #erp-banking-view .btn-primary {
  color: #fff !important;
  background: #00d4aa !important;
  border: 1px solid rgba(0, 212, 170, 0.45) !important;
  box-shadow: none !important;
}

html[data-theme='dark'] #erp-banking-view .btn-primary:hover,
.dark-theme #erp-banking-view .btn-primary:hover {
  background: #00bf9a !important;
}

html[data-theme='dark'] #erp-banking-view .btn-primary::before,
.dark-theme #erp-banking-view .btn-primary::before {
  display: none !important;
}

/* Vendor Contact Hub — header Refresh + directory Export CSV / Add Vendor */
html[data-theme='dark'] #vendor-hub-view .btn-primary,
.dark-theme #vendor-hub-view .btn-primary {
  color: #fff !important;
  background: #00d4aa !important;
  border: 1px solid rgba(0, 212, 170, 0.45) !important;
  box-shadow: none !important;
}

html[data-theme='dark'] #vendor-hub-view .btn-primary:hover,
.dark-theme #vendor-hub-view .btn-primary:hover {
  background: #00bf9a !important;
}

html[data-theme='dark'] #vendor-hub-view .btn-primary::before,
.dark-theme #vendor-hub-view .btn-primary::before {
  display: none !important;
}

html[data-theme='dark'] #vendor-hub-view .btn-success,
.dark-theme #vendor-hub-view .btn-success {
  color: #fff !important;
  background: var(--success) !important;
  border: 1px solid rgba(16, 185, 129, 0.45) !important;
  box-shadow: none !important;
}

html[data-theme='dark'] #vendor-hub-view .btn-success:hover,
.dark-theme #vendor-hub-view .btn-success:hover {
  background: #059669 !important;
}

/* Vendor Contact Hub — 1099 tab “Open Full 1099 Filing Dashboard” (explicit CTA class) */
html[data-theme='dark'] .vh-1099-dashboard-btn,
.dark-theme .vh-1099-dashboard-btn {
  color: #fff !important;
  background: #00d4aa !important;
  border: 1px solid rgba(0, 212, 170, 0.45) !important;
  box-shadow: none !important;
}

html[data-theme='dark'] .vh-1099-dashboard-btn:hover,
.dark-theme .vh-1099-dashboard-btn:hover {
  background: #00bf9a !important;
}

html[data-theme='dark'] .vh-1099-dashboard-btn::before,
.dark-theme .vh-1099-dashboard-btn::before {
  display: none !important;
}

html[data-theme='dark'] .vh-1099-dashboard-btn i,
.dark-theme .vh-1099-dashboard-btn i {
  color: inherit !important;
}

/* Vendor Contact Hub — contacts tab cards + search readability */
html[data-theme='dark'] #vendor-hub-view #vh-contact-search,
.dark-theme #vendor-hub-view #vh-contact-search {
  background: #111827 !important;
  color: #e5e7eb !important;
  border: 1px solid #374151 !important;
}

html[data-theme='dark'] #vendor-hub-view #vh-contact-search::placeholder,
.dark-theme #vendor-hub-view #vh-contact-search::placeholder {
  color: #9ca3af !important;
}

html[data-theme='dark'] #vendor-hub-view .vh-contact-card,
.dark-theme #vendor-hub-view .vh-contact-card {
  background: #111827 !important;
  border-color: #374151 !important;
}

html[data-theme='dark'] #vendor-hub-view .vh-contact-card:hover,
.dark-theme #vendor-hub-view .vh-contact-card:hover {
  border-color: #00d4aa !important;
  box-shadow: 0 0 0 1px rgba(0, 212, 170, 0.5) !important;
}

html[data-theme='dark'] #vendor-hub-view .vh-contact-name,
.dark-theme #vendor-hub-view .vh-contact-name {
  color: #f9fafb !important;
}

html[data-theme='dark'] #vendor-hub-view .vh-contact-meta,
.dark-theme #vendor-hub-view .vh-contact-meta {
  color: #9ca3af !important;
}

html[data-theme='dark'] #vendor-hub-view .vh-contact-detail,
.dark-theme #vendor-hub-view .vh-contact-detail {
  color: #d1d5db !important;
}

html[data-theme='dark'] #vendor-hub-view .vh-contact-detail i,
.dark-theme #vendor-hub-view .vh-contact-detail i {
  color: #9ca3af !important;
}

html[data-theme='dark'] #vendor-hub-view .vh-contact-detail a,
.dark-theme #vendor-hub-view .vh-contact-detail a {
  color: #60a5fa !important;
}

html[data-theme='dark'] #vendor-hub-view .vh-contact-detail a:hover,
.dark-theme #vendor-hub-view .vh-contact-detail a:hover {
  color: #93c5fd !important;
}

/* NYISO Member Portal — Connect Portal, Fetch Invoices / Statements (.ep-tab-content color !important + .btn-small) */
html[data-theme='dark'] #nyiso-portal-view .btn-primary,
.dark-theme #nyiso-portal-view .btn-primary {
  color: #fff !important;
  background: #00d4aa !important;
  border: 1px solid rgba(0, 212, 170, 0.45) !important;
  box-shadow: none !important;
}

html[data-theme='dark'] #nyiso-portal-view .btn-primary:hover,
.dark-theme #nyiso-portal-view .btn-primary:hover {
  background: #00bf9a !important;
  color: #fff !important;
}

html[data-theme='dark'] #nyiso-portal-view .btn-primary::before,
.dark-theme #nyiso-portal-view .btn-primary::before {
  display: none !important;
}

html[data-theme='dark'] #nyiso-portal-view .btn-primary i,
.dark-theme #nyiso-portal-view .btn-primary i {
  color: inherit !important;
}

/* Expense & Procurement — tab actions (.ep-tab-content has color !important; reinforce CTAs) */
html[data-theme='dark'] #expense-management-view .btn-primary,
.dark-theme #expense-management-view .btn-primary {
  color: #fff !important;
  background: #00d4aa !important;
  border: 1px solid rgba(0, 212, 170, 0.45) !important;
  box-shadow: none !important;
}

html[data-theme='dark'] #expense-management-view .btn-primary:hover,
.dark-theme #expense-management-view .btn-primary:hover {
  background: #00bf9a !important;
  color: #fff !important;
}

html[data-theme='dark'] #expense-management-view .btn-primary::before,
.dark-theme #expense-management-view .btn-primary::before {
  display: none !important;
}

html[data-theme='dark'] #expense-management-view .btn-success,
html[data-theme='dark'] #expense-management-view .btn-success.btn-small,
.dark-theme #expense-management-view .btn-success,
.dark-theme #expense-management-view .btn-success.btn-small {
  color: #fff !important;
  background: var(--success) !important;
  border: 1px solid rgba(16, 185, 129, 0.45) !important;
  box-shadow: none !important;
}

html[data-theme='dark'] #expense-management-view .btn-success:hover,
html[data-theme='dark'] #expense-management-view .btn-success.btn-small:hover,
.dark-theme #expense-management-view .btn-success:hover,
.dark-theme #expense-management-view .btn-success.btn-small:hover {
  background: #059669 !important;
  color: #fff !important;
}

html[data-theme='dark'] #expense-management-view .btn-danger,
html[data-theme='dark'] #expense-management-view .btn-danger.btn-small,
.dark-theme #expense-management-view .btn-danger,
.dark-theme #expense-management-view .btn-danger.btn-small {
  color: #fff !important;
  background: var(--danger) !important;
  border: 1px solid rgba(239, 68, 68, 0.45) !important;
  box-shadow: none !important;
}

html[data-theme='dark'] #expense-management-view .btn-danger:hover,
html[data-theme='dark'] #expense-management-view .btn-danger.btn-small:hover,
.dark-theme #expense-management-view .btn-danger:hover,
.dark-theme #expense-management-view .btn-danger.btn-small:hover {
  background: #dc2626 !important;
  color: #fff !important;
}

html[data-theme='dark'] #expense-management-view .btn-primary i,
html[data-theme='dark'] #expense-management-view .btn-success i,
html[data-theme='dark'] #expense-management-view .btn-danger i,
.dark-theme #expense-management-view .btn-primary i,
.dark-theme #expense-management-view .btn-success i,
.dark-theme #expense-management-view .btn-danger i {
  color: inherit !important;
}

/* GHG & Carbon Credits — header Refresh / Calculate; tab Run Calculation / New Credit (.ep-tab-content color !important + .btn-small) */
html[data-theme='dark'] #ghg-carbon-view .btn-primary,
.dark-theme #ghg-carbon-view .btn-primary {
  color: #fff !important;
  background: #00d4aa !important;
  border: 1px solid rgba(0, 212, 170, 0.45) !important;
  box-shadow: none !important;
}

html[data-theme='dark'] #ghg-carbon-view .btn-primary:hover,
.dark-theme #ghg-carbon-view .btn-primary:hover {
  background: #00bf9a !important;
  color: #fff !important;
}

html[data-theme='dark'] #ghg-carbon-view .btn-primary::before,
.dark-theme #ghg-carbon-view .btn-primary::before {
  display: none !important;
}

html[data-theme='dark'] #ghg-carbon-view .btn-success,
html[data-theme='dark'] #ghg-carbon-view .btn-success.btn-small,
.dark-theme #ghg-carbon-view .btn-success,
.dark-theme #ghg-carbon-view .btn-success.btn-small {
  color: #fff !important;
  background: var(--success) !important;
  border: 1px solid rgba(16, 185, 129, 0.45) !important;
  box-shadow: none !important;
}

html[data-theme='dark'] #ghg-carbon-view .btn-success:hover,
html[data-theme='dark'] #ghg-carbon-view .btn-success.btn-small:hover,
.dark-theme #ghg-carbon-view .btn-success:hover,
.dark-theme #ghg-carbon-view .btn-success.btn-small:hover {
  background: #059669 !important;
  color: #fff !important;
}

html[data-theme='dark'] #ghg-carbon-view .btn-primary i,
html[data-theme='dark'] #ghg-carbon-view .btn-success i,
.dark-theme #ghg-carbon-view .btn-primary i,
.dark-theme #ghg-carbon-view .btn-success i {
  color: inherit !important;
}

/* GHG modals (Calculate / New Credit / etc.) — standard .btn-* injected into global .wf-modal-overlay */
html[data-theme='dark'] .wf-modal-overlay .btn-primary.btn-small,
.dark-theme .wf-modal-overlay .btn-primary.btn-small {
  color: #fff !important;
  background: #00d4aa !important;
  border: 1px solid rgba(0, 212, 170, 0.45) !important;
  box-shadow: none !important;
}

html[data-theme='dark'] .wf-modal-overlay .btn-primary.btn-small:hover,
.dark-theme .wf-modal-overlay .btn-primary.btn-small:hover {
  background: #00bf9a !important;
  color: #fff !important;
}

html[data-theme='dark'] .wf-modal-overlay .btn-primary.btn-small::before,
.dark-theme .wf-modal-overlay .btn-primary.btn-small::before {
  display: none !important;
}

html[data-theme='dark'] .wf-modal-overlay .btn-success.btn-small,
.dark-theme .wf-modal-overlay .btn-success.btn-small {
  color: #fff !important;
  background: var(--success) !important;
  border: 1px solid rgba(16, 185, 129, 0.45) !important;
  box-shadow: none !important;
}

html[data-theme='dark'] .wf-modal-overlay .btn-success.btn-small:hover,
.dark-theme .wf-modal-overlay .btn-success.btn-small:hover {
  background: #059669 !important;
  color: #fff !important;
}

html[data-theme='dark'] .wf-modal-overlay .btn-primary.btn-small i,
html[data-theme='dark'] .wf-modal-overlay .btn-success.btn-small i,
.dark-theme .wf-modal-overlay .btn-primary.btn-small i,
.dark-theme .wf-modal-overlay .btn-success.btn-small i {
  color: inherit !important;
}

html[data-theme='dark'] .wf-modal-overlay .btn-secondary.btn-small,
.dark-theme .wf-modal-overlay .btn-secondary.btn-small {
  background: linear-gradient(135deg, var(--gray-100) 0%, var(--gray-50) 100%) !important;
  color: var(--gray-800) !important;
  border: 1px solid var(--gray-200) !important;
}

html[data-theme='dark'] .wf-modal-overlay .btn-secondary.btn-small:hover,
.dark-theme .wf-modal-overlay .btn-secondary.btn-small:hover {
  background: linear-gradient(135deg, var(--gray-200) 0%, var(--gray-100) 100%) !important;
  border-color: var(--gray-300) !important;
}

html[data-theme='dark'] #expense-management-view .em-header-btn--refresh,
.dark-theme #expense-management-view .em-header-btn--refresh {
  color: #fff !important;
  background: #00d4aa !important;
  border: 1px solid rgba(0, 212, 170, 0.5) !important;
}

html[data-theme='dark'] #expense-management-view .em-header-btn--refresh:hover,
.dark-theme #expense-management-view .em-header-btn--refresh:hover {
  background: #00bf9a !important;
}

html[data-theme='dark'] #expense-management-view .em-header-btn--po,
.dark-theme #expense-management-view .em-header-btn--po {
  color: #fff !important;
  background: #10b981 !important;
  border: 1px solid rgba(16, 185, 129, 0.5) !important;
}

html[data-theme='dark'] #expense-management-view .em-header-btn--po:hover,
.dark-theme #expense-management-view .em-header-btn--po:hover {
  background: #059669 !important;
}

html[data-theme='dark'] #expense-management-view .invoice-table th,
html[data-theme='dark'] #expense-management-view .invoice-table td,
.dark-theme #expense-management-view .invoice-table th,
.dark-theme #expense-management-view .invoice-table td {
  border-color: var(--gray-200) !important;
  color: var(--gray-800) !important;
}

html[data-theme='dark'] #expense-management-view .invoice-table th,
.dark-theme #expense-management-view .invoice-table th {
  color: var(--gray-600) !important;
}

html[data-theme='dark'] #expense-management-view .ep-tab-content h3,
.dark-theme #expense-management-view .ep-tab-content h3 {
  color: var(--gray-900) !important;
}

html[data-theme='dark'] #field-ops-advanced-view .foa-table,
html[data-theme='dark'] #field-ops-advanced-view .foa-table th,
html[data-theme='dark'] #field-ops-advanced-view .foa-table td,
.dark-theme #field-ops-advanced-view .foa-table,
.dark-theme #field-ops-advanced-view .foa-table th,
.dark-theme #field-ops-advanced-view .foa-table td {
  color: var(--gray-800) !important;
  border-color: var(--gray-200) !important;
}

/* Construction & Dev — project cards + milestone rows (inline #fff / #f0f8ff removed in JS) */
html[data-theme='dark'] #construction-view .cd-project-card,
.dark-theme #construction-view .cd-project-card {
  background: var(--gray-50) !important;
  border-color: var(--gray-200) !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35) !important;
}

html[data-theme='dark'] #construction-view .cd-milestone-edit-panel,
.dark-theme #construction-view .cd-milestone-edit-panel {
  background: var(--gray-100) !important;
  border-color: var(--gray-200) !important;
  color: var(--gray-800) !important;
}

html[data-theme='dark'] #construction-view .cd-gantt-card,
.dark-theme #construction-view .cd-gantt-card {
  background: var(--gray-50) !important;
  border-color: var(--gray-200) !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35) !important;
}

html[data-theme='dark'] #construction-view .cd-gantt-add-toolbar,
.dark-theme #construction-view .cd-gantt-add-toolbar {
  background: var(--gray-100) !important;
  border-color: var(--gray-200) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

html[data-theme='dark'] #construction-view .cd-gantt-add-toolbar__icon,
.dark-theme #construction-view .cd-gantt-add-toolbar__icon {
  color: #38bdf8 !important;
}

html[data-theme='dark'] #construction-view .cd-gantt-add-toolbar__label,
.dark-theme #construction-view .cd-gantt-add-toolbar__label {
  color: var(--gray-800) !important;
}

html[data-theme='dark'] #construction-view .cd-gantt-add-toolbar__select,
html[data-theme='dark'] #construction-view .cd-gantt-add-toolbar__input,
.dark-theme #construction-view .cd-gantt-add-toolbar__select,
.dark-theme #construction-view .cd-gantt-add-toolbar__input {
  background: var(--gray-50) !important;
  border-color: var(--gray-200) !important;
  color: var(--gray-900) !important;
}

html[data-theme='dark'] #construction-view .cd-gantt-add-toolbar .btn-success.btn-small,
.dark-theme #construction-view .cd-gantt-add-toolbar .btn-success.btn-small {
  background: var(--success) !important;
  color: #fff !important;
  border-color: rgba(16, 185, 129, 0.45) !important;
}

html[data-theme='dark'] #construction-view .cd-edit-access-banner,
.dark-theme #construction-view .cd-edit-access-banner {
  background: rgba(52, 152, 219, 0.18) !important;
  border-color: rgba(52, 152, 219, 0.35) !important;
  color: var(--gray-600) !important;
}

html[data-theme='dark'] #construction-view .cd-tab-btn.cd-tab-active,
.dark-theme #construction-view .cd-tab-btn.cd-tab-active {
  background: transparent !important;
  color: var(--primary-green, #00d4aa) !important;
  border-bottom-color: var(--primary-green, #00d4aa) !important;
}

/* Construction — Register New Contractor panel (inline #fff; heading inherited page text) */
html[data-theme='dark'] #construction-view .cd-new-contractor-panel,
.dark-theme #construction-view .cd-new-contractor-panel {
  background: var(--gray-50) !important;
  color: var(--gray-800) !important;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35) !important;
  border-left-color: #22c55e !important;
}

html[data-theme='dark'] #construction-view .cd-new-contractor-panel h4,
.dark-theme #construction-view .cd-new-contractor-panel h4 {
  color: var(--gray-900) !important;
}

html[data-theme='dark'] #construction-view .cd-new-contractor-panel label,
.dark-theme #construction-view .cd-new-contractor-panel label {
  color: var(--gray-600) !important;
}

html[data-theme='dark'] #construction-view .cd-new-contractor-panel input,
.dark-theme #construction-view .cd-new-contractor-panel input {
  background: var(--gray-100) !important;
  border-color: var(--gray-200) !important;
  color: var(--gray-900) !important;
}

html[data-theme='dark'] #construction-view .cd-new-contractor-panel input::placeholder,
.dark-theme #construction-view .cd-new-contractor-panel input::placeholder {
  color: var(--gray-500) !important;
}

html[data-theme='dark'] #construction-view .cd-new-contractor-panel .cd-new-contractor-cancel,
.dark-theme #construction-view .cd-new-contractor-panel .cd-new-contractor-cancel {
  background: var(--gray-200) !important;
  color: var(--gray-800) !important;
  border: 1px solid var(--gray-300) !important;
}

html[data-theme='dark'] #construction-view .cd-new-contractor-panel .cd-new-contractor-cancel:hover,
.dark-theme #construction-view .cd-new-contractor-panel .cd-new-contractor-cancel:hover {
  background: var(--gray-300) !important;
}

/* OSHA Safety — course cards (were inline #fff + JS hover; stayed light in dark mode) */
html[data-theme='dark'] #osha-safety-container .osha-course-card,
.dark-theme #osha-safety-container .osha-course-card {
  background: var(--gray-50) !important;
  border-color: var(--gray-200) !important;
  color: var(--gray-800) !important;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.28) !important;
}

html[data-theme='dark'] #osha-safety-container .osha-course-card:hover,
.dark-theme #osha-safety-container .osha-course-card:hover {
  background: var(--gray-200) !important;
  border-color: var(--gray-300) !important;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45) !important;
}

html[data-theme='dark'] #osha-safety-container .osha-course-card h4,
.dark-theme #osha-safety-container .osha-course-card h4 {
  color: var(--gray-900) !important;
}

html[data-theme='dark'] #osha-safety-container .osha-course-card__meta,
.dark-theme #osha-safety-container .osha-course-card__meta {
  color: var(--gray-600) !important;
}

html[data-theme='dark'] #osha-safety-container .osha-course-card__refs,
.dark-theme #osha-safety-container .osha-course-card__refs {
  color: #93c5fd !important;
}

html[data-theme='dark'] #osha-safety-container .osha-course-card__required,
.dark-theme #osha-safety-container .osha-course-card__required {
  background: rgba(220, 38, 38, 0.2) !important;
  color: #fca5a5 !important;
}

html[data-theme='dark'] #osha-safety-container .osha-course-pill,
.dark-theme #osha-safety-container .osha-course-pill {
  background: var(--gray-200) !important;
  color: var(--gray-800) !important;
  border: 1px solid var(--gray-300);
}

/* Security Analytics — styles.css forces white surfaces on #security-analytics-view; align with dark palette */
html[data-theme='dark'] #security-analytics-view .fleet-summary-card,
html[data-theme='dark'] #security-analytics-view .summary-metric,
html[data-theme='dark'] #security-analytics-view .monitoring-section,
html[data-theme='dark'] #security-analytics-view .chart-container,
html[data-theme='dark'] #security-analytics-view .chart-container-full,
html[data-theme='dark'] #security-analytics-view .chart-grid,
html[data-theme='dark'] #security-analytics-view .security-events-timeline,
html[data-theme='dark'] #security-analytics-view .table-container,
html[data-theme='dark'] #security-analytics-view .data-table,
html[data-theme='dark'] #security-analytics-view .data-table thead,
html[data-theme='dark'] #security-analytics-view .data-table tbody,
.dark-theme #security-analytics-view .fleet-summary-card,
.dark-theme #security-analytics-view .summary-metric,
.dark-theme #security-analytics-view .monitoring-section,
.dark-theme #security-analytics-view .chart-container,
.dark-theme #security-analytics-view .chart-container-full,
.dark-theme #security-analytics-view .chart-grid,
.dark-theme #security-analytics-view .security-events-timeline,
.dark-theme #security-analytics-view .table-container,
.dark-theme #security-analytics-view .data-table,
.dark-theme #security-analytics-view .data-table thead,
.dark-theme #security-analytics-view .data-table tbody {
  background: var(--gray-50) !important;
}

html[data-theme='dark'] #security-analytics-view .summary-metric,
html[data-theme='dark'] #security-analytics-view .monitoring-section,
html[data-theme='dark'] #security-analytics-view .chart-container,
.dark-theme #security-analytics-view .summary-metric,
.dark-theme #security-analytics-view .monitoring-section,
.dark-theme #security-analytics-view .chart-container {
  border-color: var(--gray-200) !important;
}

html[data-theme='dark'] #security-analytics-view .section-header,
.dark-theme #security-analytics-view .section-header {
  border-bottom-color: var(--gray-200) !important;
}

html[data-theme='dark'] #security-analytics-view .section-header h3,
html[data-theme='dark'] #security-analytics-view .section-header h4,
html[data-theme='dark'] #security-analytics-view .summary-label,
html[data-theme='dark'] #security-analytics-view .summary-status-text,
html[data-theme='dark'] #security-analytics-view .data-table th,
html[data-theme='dark'] #security-analytics-view .data-table td,
html[data-theme='dark'] #security-analytics-view h2,
html[data-theme='dark'] #security-analytics-view h3,
html[data-theme='dark'] #security-analytics-view h4,
html[data-theme='dark'] #security-analytics-view p,
html[data-theme='dark'] #security-analytics-view .view-subtitle,
html[data-theme='dark'] #security-analytics-view label,
html[data-theme='dark'] #security-analytics-view .chart-container h4,
html[data-theme='dark'] #security-analytics-view .no-data,
.dark-theme #security-analytics-view .section-header h3,
.dark-theme #security-analytics-view .section-header h4,
.dark-theme #security-analytics-view .summary-label,
.dark-theme #security-analytics-view .summary-status-text,
.dark-theme #security-analytics-view .data-table th,
.dark-theme #security-analytics-view .data-table td,
.dark-theme #security-analytics-view h2,
.dark-theme #security-analytics-view h3,
.dark-theme #security-analytics-view h4,
.dark-theme #security-analytics-view p,
.dark-theme #security-analytics-view .view-subtitle,
.dark-theme #security-analytics-view label,
.dark-theme #security-analytics-view .chart-container h4,
.dark-theme #security-analytics-view .no-data {
  color: var(--gray-900) !important;
}

html[data-theme='dark'] #security-analytics-view .summary-value,
.dark-theme #security-analytics-view .summary-value {
  color: var(--primary-green) !important;
}

html[data-theme='dark'] #security-analytics-view .summary-value.alert-count,
.dark-theme #security-analytics-view .summary-value.alert-count {
  color: var(--warning) !important;
}

html[data-theme='dark'] #security-analytics-view .summary-value.critical-count,
.dark-theme #security-analytics-view .summary-value.critical-count {
  color: var(--danger) !important;
}

html[data-theme='dark'] #security-analytics-view .summary-status.healthy,
.dark-theme #security-analytics-view .summary-status.healthy {
  color: var(--success) !important;
}

html[data-theme='dark'] #security-analytics-view .summary-status.warning,
.dark-theme #security-analytics-view .summary-status.warning {
  color: var(--warning) !important;
}

html[data-theme='dark'] #security-analytics-view .summary-status.critical,
.dark-theme #security-analytics-view .summary-status.critical {
  color: var(--danger) !important;
}

html[data-theme='dark'] #security-analytics-view .summary-status.medium,
.dark-theme #security-analytics-view .summary-status.medium {
  color: var(--info) !important;
}

html[data-theme='dark'] #security-analytics-view .view-subtitle,
.dark-theme #security-analytics-view .view-subtitle {
  color: var(--gray-600) !important;
}

html[data-theme='dark'] #security-analytics-view .section-controls select,
.dark-theme #security-analytics-view .section-controls select {
  background: var(--gray-50) !important;
  color: var(--gray-900) !important;
  border-color: var(--gray-200) !important;
}

html[data-theme='dark'] #security-analytics-view .data-table,
.dark-theme #security-analytics-view .data-table {
  background: var(--gray-50) !important;
  color: var(--gray-900) !important;
}

html[data-theme='dark'] #security-analytics-view .data-table thead,
.dark-theme #security-analytics-view .data-table thead {
  background: var(--gray-100) !important;
  border-bottom: 2px solid var(--gray-200) !important;
}

html[data-theme='dark'] #security-analytics-view .data-table tbody tr,
.dark-theme #security-analytics-view .data-table tbody tr {
  background: var(--gray-50) !important;
  border-bottom: 1px solid var(--gray-200) !important;
}

html[data-theme='dark'] #security-analytics-view .data-table tbody tr:hover,
.dark-theme #security-analytics-view .data-table tbody tr:hover {
  background: var(--gray-100) !important;
}

html[data-theme='dark'] #security-analytics-view .timeline-header,
html[data-theme='dark'] #security-analytics-view .timeline-type,
html[data-theme='dark'] #security-analytics-view .timeline-time,
html[data-theme='dark'] #security-analytics-view .timeline-details,
.dark-theme #security-analytics-view .timeline-header,
.dark-theme #security-analytics-view .timeline-type,
.dark-theme #security-analytics-view .timeline-time,
.dark-theme #security-analytics-view .timeline-details {
  color: var(--gray-800) !important;
}

html[data-theme='dark'] #security-analytics-view .timeline-icon,
.dark-theme #security-analytics-view .timeline-icon {
  color: var(--gray-600) !important;
}

/* Account & Security — styles.css forces light surfaces on #account-security-view */
html[data-theme='dark'] #account-security-view,
.dark-theme #account-security-view {
  --surface-bg: var(--gray-100);
  --border-color: var(--gray-200);
  --bg-tertiary: var(--gray-200);
}

html[data-theme='dark'] #account-security-view .metric-card,
html[data-theme='dark'] #account-security-view .monitoring-section,
.dark-theme #account-security-view .metric-card,
.dark-theme #account-security-view .monitoring-section {
  background: var(--gray-50) !important;
  border-color: var(--gray-200) !important;
}

html[data-theme='dark'] #account-security-view .section-header,
.dark-theme #account-security-view .section-header {
  border-bottom-color: var(--gray-200) !important;
}

html[data-theme='dark'] #account-security-view .section-header h3,
html[data-theme='dark'] #account-security-view h2,
html[data-theme='dark'] #account-security-view h3,
html[data-theme='dark'] #account-security-view h4,
html[data-theme='dark'] #account-security-view label,
html[data-theme='dark'] #account-security-view .view-subtitle,
.dark-theme #account-security-view .section-header h3,
.dark-theme #account-security-view h2,
.dark-theme #account-security-view h3,
.dark-theme #account-security-view h4,
.dark-theme #account-security-view label,
.dark-theme #account-security-view .view-subtitle {
  color: var(--gray-900) !important;
}

html[data-theme='dark'] #account-security-view p,
html[data-theme='dark'] #account-security-view .metric-label,
html[data-theme='dark'] #account-security-view .metric-subtext,
.dark-theme #account-security-view p,
.dark-theme #account-security-view .metric-label,
.dark-theme #account-security-view .metric-subtext {
  color: var(--gray-700) !important;
}

html[data-theme='dark'] #account-security-view .view-subtitle,
.dark-theme #account-security-view .view-subtitle {
  color: var(--gray-600) !important;
}

html[data-theme='dark'] #account-security-view .form-control,
.dark-theme #account-security-view .form-control {
  background: var(--gray-50) !important;
  color: var(--gray-900) !important;
  border-color: var(--gray-200) !important;
}

html[data-theme='dark'] #account-security-view .form-control:focus,
.dark-theme #account-security-view .form-control:focus {
  background: var(--gray-900) !important;
  color: var(--gray-100) !important;
  border-color: var(--primary-green) !important;
}

html[data-theme='dark'] #account-security-view .view-header h2 .fa-shield-alt,
.dark-theme #account-security-view .view-header h2 .fa-shield-alt {
  color: #a5b4fc !important;
}

/* =============================================================================
   Document Vault — Categories tab, Data Import, header actions, invoice tables
   ============================================================================= */
html[data-theme='dark'] #document-vault-view .dv-category-card,
.dark-theme #document-vault-view .dv-category-card {
  background: var(--gray-50) !important;
  border-color: var(--gray-200) !important;
}

html[data-theme='dark'] #document-vault-view .dv-category-card:hover,
.dark-theme #document-vault-view .dv-category-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35) !important;
}

html[data-theme='dark'] #document-vault-view .dv-category-card h4,
.dark-theme #document-vault-view .dv-category-card h4 {
  color: var(--gray-900) !important;
}

html[data-theme='dark'] #document-vault-view .dv-category-card__desc,
html[data-theme='dark'] #document-vault-view .dv-category-card__retention,
.dark-theme #document-vault-view .dv-category-card__desc,
.dark-theme #document-vault-view .dv-category-card__retention {
  color: var(--gray-600) !important;
}

html[data-theme='dark'] #document-vault-view .dv-category-back-btn,
.dark-theme #document-vault-view .dv-category-back-btn {
  background: var(--gray-100) !important;
  border-color: var(--gray-200) !important;
  color: var(--gray-900) !important;
}

html[data-theme='dark'] #document-vault-view .dv-category-back-btn:hover,
.dark-theme #document-vault-view .dv-category-back-btn:hover {
  background: var(--gray-200) !important;
}

html[data-theme='dark'] #document-vault-view .dv-category-detail-count,
.dark-theme #document-vault-view .dv-category-detail-count {
  color: var(--gray-600) !important;
}

html[data-theme='dark'] #document-vault-view .dv-import-category-bar,
.dark-theme #document-vault-view .dv-import-category-bar {
  background: var(--gray-100) !important;
}

html[data-theme='dark'] #document-vault-view .dv-import-cat-btn.is-active,
.dark-theme #document-vault-view .dv-import-cat-btn.is-active {
  background: var(--gray-50) !important;
  color: #c4b5fd !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35) !important;
}

html[data-theme='dark'] #document-vault-view .dv-import-cat-btn:not(.is-active),
.dark-theme #document-vault-view .dv-import-cat-btn:not(.is-active) {
  color: var(--gray-600) !important;
}

html[data-theme='dark'] #document-vault-view .dv-import-type-btn.is-active,
.dark-theme #document-vault-view .dv-import-type-btn.is-active {
  background: rgba(124, 58, 237, 0.2) !important;
  border-color: #a78bfa !important;
  color: #ddd6fe !important;
}

html[data-theme='dark'] #document-vault-view .dv-import-type-btn:not(.is-active),
.dark-theme #document-vault-view .dv-import-type-btn:not(.is-active) {
  background: var(--gray-50) !important;
  border-color: var(--gray-200) !important;
  color: var(--gray-600) !important;
}

html[data-theme='dark'] #document-vault-view .dv-import-field-ref,
.dark-theme #document-vault-view .dv-import-field-ref {
  background: rgba(99, 102, 241, 0.12) !important;
  border-color: rgba(129, 140, 248, 0.35) !important;
  color: var(--gray-800) !important;
}

html[data-theme='dark'] #document-vault-view .dv-import-field-ref__title,
.dark-theme #document-vault-view .dv-import-field-ref__title {
  color: #a5b4fc !important;
}

html[data-theme='dark'] #document-vault-view .dv-import-field-ref__hint,
.dark-theme #document-vault-view .dv-import-field-ref__hint {
  color: #818cf8 !important;
}

html[data-theme='dark'] #document-vault-view .dv-import-dropzone,
.dark-theme #document-vault-view .dv-import-dropzone {
  background: var(--gray-100) !important;
  border-color: var(--gray-200) !important;
}

html[data-theme='dark'] #document-vault-view .dv-import-dropzone h3,
.dark-theme #document-vault-view .dv-import-dropzone h3 {
  color: var(--gray-900) !important;
}

html[data-theme='dark'] #document-vault-view .invoice-table th,
html[data-theme='dark'] #document-vault-view .invoice-table td,
.dark-theme #document-vault-view .invoice-table th,
.dark-theme #document-vault-view .invoice-table td {
  border-color: var(--gray-200) !important;
  color: var(--gray-800) !important;
}

html[data-theme='dark'] #document-vault-view .invoice-table th,
.dark-theme #document-vault-view .invoice-table th {
  color: var(--gray-600) !important;
}

html[data-theme='dark'] #document-vault-view .dv-import-mapping-panel,
.dark-theme #document-vault-view .dv-import-mapping-panel {
  background: var(--gray-50) !important;
  border-color: var(--gray-200) !important;
}

html[data-theme='dark'] #document-vault-view .dv-import-mapping-panel__title,
.dark-theme #document-vault-view .dv-import-mapping-panel__title {
  color: var(--gray-900) !important;
}

html[data-theme='dark'] #document-vault-view .dv-import-mapping-status--ok,
.dark-theme #document-vault-view .dv-import-mapping-status--ok {
  color: #34d399 !important;
}

html[data-theme='dark'] #document-vault-view .dv-import-mapping-status--bad,
.dark-theme #document-vault-view .dv-import-mapping-status--bad {
  color: #f87171 !important;
}

html[data-theme='dark'] #document-vault-view .dv-import-map-col,
.dark-theme #document-vault-view .dv-import-map-col {
  background: var(--gray-100) !important;
  color: var(--gray-900) !important;
}

html[data-theme='dark'] #document-vault-view .dv-import-map-col-label,
html[data-theme='dark'] #document-vault-view .dv-import-map-arrow,
.dark-theme #document-vault-view .dv-import-map-col-label,
.dark-theme #document-vault-view .dv-import-map-arrow {
  color: var(--gray-500) !important;
}

html[data-theme='dark'] #document-vault-view .dv-import-mapping-select,
.dark-theme #document-vault-view .dv-import-mapping-select {
  background: var(--gray-100) !important;
  border-color: var(--gray-200) !important;
  color: var(--gray-900) !important;
}

html[data-theme='dark'] #document-vault-view .dv-import-mapping-select.is-mapped,
.dark-theme #document-vault-view .dv-import-mapping-select.is-mapped {
  background: rgba(99, 102, 241, 0.15) !important;
  border-color: rgba(129, 140, 248, 0.45) !important;
}

html[data-theme='dark'] #document-vault-view .dv-import-msg--warn,
html[data-theme='dark'] #document-vault-view .dv-import-msg--error,
.dark-theme #document-vault-view .dv-import-msg--warn,
.dark-theme #document-vault-view .dv-import-msg--error {
  background: rgba(127, 29, 29, 0.35) !important;
  border-color: rgba(248, 113, 113, 0.35) !important;
  color: #fecaca !important;
}

html[data-theme='dark'] #document-vault-view .dv-import-preview table,
.dark-theme #document-vault-view .dv-import-preview table {
  background: transparent !important;
}

html[data-theme='dark'] #document-vault-view .dv-header-btn--import,
.dark-theme #document-vault-view .dv-header-btn--import {
  background: #6d28d9 !important;
  border-color: rgba(167, 139, 250, 0.45) !important;
  color: #fff !important;
}

html[data-theme='dark'] #document-vault-view .dv-header-btn--import:hover,
.dark-theme #document-vault-view .dv-header-btn--import:hover {
  background: #5b21b6 !important;
}

html[data-theme='dark'] #document-vault-view .dv-import-choose-btn,
.dark-theme #document-vault-view .dv-import-choose-btn {
  background: #6d28d9 !important;
  border-color: rgba(167, 139, 250, 0.45) !important;
  color: #fff !important;
}

html[data-theme='dark'] #document-vault-view .dv-import-choose-btn:hover,
.dark-theme #document-vault-view .dv-import-choose-btn:hover {
  background: #5b21b6 !important;
}

/* =============================================================================
   Integrations Hub (#integrations-view)
   ============================================================================= */
html[data-theme='dark'] .int-connector-card,
.dark-theme .int-connector-card {
  background: var(--gray-50) !important;
  border-color: var(--gray-200) !important;
  color: var(--gray-800) !important;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}

html[data-theme='dark'] .int-connector-card:hover,
.dark-theme .int-connector-card:hover {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
}

html[data-theme='dark'] .int-connector-info h3,
.dark-theme .int-connector-info h3 {
  color: var(--gray-900) !important;
}

html[data-theme='dark'] .int-connector-info p,
.dark-theme .int-connector-info p {
  color: var(--gray-600) !important;
}

html[data-theme='dark'] .int-data-flows,
.dark-theme .int-data-flows {
  background: var(--gray-100) !important;
  border-color: var(--gray-200) !important;
}

html[data-theme='dark'] .int-data-flows h4,
.dark-theme .int-data-flows h4 {
  color: var(--gray-500) !important;
}

html[data-theme='dark'] .int-flow-label,
.dark-theme .int-flow-label {
  color: var(--gray-700) !important;
}

html[data-theme='dark'] .int-flow-count,
.dark-theme .int-flow-count {
  color: var(--gray-500) !important;
}

html[data-theme='dark'] .int-sync-info,
.dark-theme .int-sync-info {
  background: rgba(16, 185, 129, 0.14) !important;
  border-color: rgba(45, 212, 191, 0.35) !important;
  color: var(--gray-700) !important;
}

html[data-theme='dark'] .int-disconnect-btn:hover,
.dark-theme .int-disconnect-btn:hover {
  background: rgba(127, 29, 29, 0.35) !important;
}

html[data-theme='dark'] .int-health-banner--unknown,
.dark-theme .int-health-banner--unknown {
  background: rgba(99, 102, 241, 0.18) !important;
  border-color: rgba(129, 140, 248, 0.45) !important;
  color: #e0e7ff !important;
}

html[data-theme='dark'] .int-health-banner--live,
.dark-theme .int-health-banner--live {
  background: rgba(16, 185, 129, 0.16) !important;
  border-color: rgba(52, 211, 153, 0.4) !important;
  color: #d1fae5 !important;
}

html[data-theme='dark'] .int-health-banner--stale,
.dark-theme .int-health-banner--stale {
  background: rgba(245, 158, 11, 0.1) !important;
  border-color: rgba(251, 191, 36, 0.45) !important;
  color: #fde68a !important;
}

html[data-theme='dark'] .int-health-banner--error,
.dark-theme .int-health-banner--error {
  background: rgba(127, 29, 29, 0.35) !important;
  border-color: rgba(248, 113, 113, 0.35) !important;
  color: #fecaca !important;
}

html[data-theme='dark'] .int-health-stats,
.dark-theme .int-health-stats {
  color: inherit;
  opacity: 0.95;
}

html[data-theme='dark'] #integrations-view .btn-primary.btn-small,
.dark-theme #integrations-view .btn-primary.btn-small {
  color: #fff !important;
}

html[data-theme='dark'] #integrations-view #int-alert-rules-list,
html[data-theme='dark'] #integrations-view #int-webhook-log,
.dark-theme #integrations-view #int-alert-rules-list,
.dark-theme #integrations-view #int-webhook-log {
  background: var(--gray-50) !important;
  border-color: var(--gray-200) !important;
}

html[data-theme='dark'] #integrations-view #int-alert-rules-list p,
html[data-theme='dark'] #integrations-view #int-webhook-log p,
.dark-theme #integrations-view #int-alert-rules-list p,
.dark-theme #integrations-view #int-webhook-log p {
  color: var(--gray-600) !important;
}

/* =============================================================================
   VW Unified Component System — Dark Mode
   ============================================================================= */

/* Cards */
html[data-theme='dark'] .vw-card,
.dark-theme .vw-card {
  background: var(--gray-50) !important;
  border-color: var(--gray-200) !important;
}
html[data-theme='dark'] .vw-card--metric .vw-card__label,
.dark-theme .vw-card--metric .vw-card__label {
  color: var(--gray-600) !important;
}
html[data-theme='dark'] .vw-card--metric .vw-card__value,
.dark-theme .vw-card--metric .vw-card__value {
  color: var(--gray-900) !important;
}

/* Tables */
html[data-theme='dark'] .vw-table-wrap,
.dark-theme .vw-table-wrap {
  background: var(--gray-50) !important;
  border-color: var(--gray-200) !important;
}
html[data-theme='dark'] .vw-table th,
.dark-theme .vw-table th {
  background: var(--gray-100) !important;
  border-color: var(--gray-200) !important;
  color: var(--gray-800) !important;
}
html[data-theme='dark'] .vw-table td,
.dark-theme .vw-table td {
  border-color: var(--gray-100) !important;
  color: var(--gray-800) !important;
}
html[data-theme='dark'] .vw-table tbody tr:hover,
.dark-theme .vw-table tbody tr:hover {
  background: var(--gray-100) !important;
}

/* Tabs */
html[data-theme='dark'] .vw-tabs,
.dark-theme .vw-tabs {
  border-color: var(--gray-200) !important;
}
html[data-theme='dark'] .vw-tab,
.dark-theme .vw-tab {
  color: var(--gray-600) !important;
}
html[data-theme='dark'] .vw-tab:hover,
.dark-theme .vw-tab:hover {
  color: var(--gray-900) !important;
}
html[data-theme='dark'] .vw-tab.active,
html[data-theme='dark'] .vw-tab--active,
.dark-theme .vw-tab.active,
.dark-theme .vw-tab--active {
  color: var(--primary-green, #00d4aa) !important;
  border-bottom-color: var(--primary-green, #00d4aa) !important;
}

/* Toolbar inputs */
html[data-theme='dark'] .vw-toolbar .vw-search,
html[data-theme='dark'] .vw-toolbar .vw-select,
.dark-theme .vw-toolbar .vw-search,
.dark-theme .vw-toolbar .vw-select {
  background: var(--gray-100) !important;
  border-color: var(--gray-200) !important;
  color: var(--gray-900) !important;
}

/* Section headers */
html[data-theme='dark'] .vw-section-header h3,
html[data-theme='dark'] .vw-section-header h4,
.dark-theme .vw-section-header h3,
.dark-theme .vw-section-header h4 {
  color: var(--gray-900) !important;
}

/* Dashboard title / subtitle */
html[data-theme='dark'] .vw-dashboard__title,
.dark-theme .vw-dashboard__title {
  color: var(--gray-900) !important;
}
html[data-theme='dark'] .vw-dashboard__subtitle,
.dark-theme .vw-dashboard__subtitle {
  color: var(--gray-600) !important;
}

/* Loading / empty */
html[data-theme='dark'] .vw-loading,
html[data-theme='dark'] .vw-empty,
.dark-theme .vw-loading,
.dark-theme .vw-empty {
  color: var(--gray-600) !important;
}
html[data-theme='dark'] .vw-empty__title,
.dark-theme .vw-empty__title {
  color: var(--gray-800) !important;
}

/* Modal */
html[data-theme='dark'] .vw-modal,
.dark-theme .vw-modal {
  background: var(--gray-50) !important;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55) !important;
}
html[data-theme='dark'] .vw-modal__header,
html[data-theme='dark'] .vw-modal__footer,
.dark-theme .vw-modal__header,
.dark-theme .vw-modal__footer {
  border-color: var(--gray-200) !important;
}
html[data-theme='dark'] .vw-modal__header h3,
.dark-theme .vw-modal__header h3 {
  color: var(--gray-900) !important;
}
html[data-theme='dark'] .vw-modal__close:hover,
.dark-theme .vw-modal__close:hover {
  background: var(--gray-200) !important;
}

/* Toast */
html[data-theme='dark'] .vw-toast,
.dark-theme .vw-toast {
  background: var(--gray-50) !important;
  border-color: var(--gray-200) !important;
  color: var(--gray-800) !important;
}

/* Alerts — soft text color adjustments */
html[data-theme='dark'] .vw-alert--success,
.dark-theme .vw-alert--success {
  color: #a7f3d0 !important;
  background: rgba(16, 185, 129, 0.15) !important;
}
html[data-theme='dark'] .vw-alert--warning,
.dark-theme .vw-alert--warning {
  color: #fde68a !important;
  background: rgba(245, 158, 11, 0.12) !important;
}
html[data-theme='dark'] .vw-alert--danger,
.dark-theme .vw-alert--danger {
  color: #fecaca !important;
  background: rgba(239, 68, 68, 0.12) !important;
}
html[data-theme='dark'] .vw-alert--info,
.dark-theme .vw-alert--info {
  color: #bfdbfe !important;
  background: rgba(59, 130, 246, 0.12) !important;
}

/* Soft badge text colors in dark mode */
html[data-theme='dark'] .vw-badge--success-soft,
.dark-theme .vw-badge--success-soft {
  color: #a7f3d0 !important;
  background: rgba(16, 185, 129, 0.2) !important;
}
html[data-theme='dark'] .vw-badge--danger-soft,
.dark-theme .vw-badge--danger-soft {
  color: #fecaca !important;
  background: rgba(239, 68, 68, 0.2) !important;
}
html[data-theme='dark'] .vw-badge--warning-soft,
.dark-theme .vw-badge--warning-soft {
  color: #fde68a !important;
  background: rgba(245, 158, 11, 0.2) !important;
}
html[data-theme='dark'] .vw-badge--info-soft,
.dark-theme .vw-badge--info-soft {
  color: #bfdbfe !important;
  background: rgba(59, 130, 246, 0.2) !important;
}
html[data-theme='dark'] .vw-badge--secondary-soft,
.dark-theme .vw-badge--secondary-soft {
  color: var(--gray-700) !important;
  background: var(--gray-100) !important;
}

/* Secondary button in dark mode */
html[data-theme='dark'] .vw-btn--secondary,
.dark-theme .vw-btn--secondary {
  background: var(--gray-100) !important;
  border-color: var(--gray-200) !important;
  color: var(--gray-900) !important;
}

/* Global breadcrumb bar + settlement lifecycle strip */
html[data-theme='dark'] .vw-context-nav,
.dark-theme .vw-context-nav {
  background: var(--gray-100) !important;
  border-color: var(--gray-200) !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}
html[data-theme='dark'] .vw-context-back,
.dark-theme .vw-context-back {
  background: var(--gray-50) !important;
  border-color: var(--gray-200) !important;
  color: var(--gray-800) !important;
}
html[data-theme='dark'] .vw-bc-current,
.dark-theme .vw-bc-current {
  color: var(--gray-900) !important;
}
html[data-theme='dark'] .settlement-lifecycle-hint,
.dark-theme .settlement-lifecycle-hint {
  border-color: var(--gray-200) !important;
}
