/* Azul aço: shared dark surfaces and navigation. */
html[data-bs-theme="dark"] {
  color-scheme: dark;
  --trader-blue: #1D3041;
  --bs-body-bg: #1D3041;
  --bs-body-bg-rgb: 29, 48, 65;
  --bs-paper-bg: #172A3A;
  --bs-paper-bg-rgb: 23, 42, 58;
  --bs-card-bg: #172A3A;
  --bs-menu-bg: #263B4D;
  --bs-secondary-bg: #172A3A;
  --bs-secondary-bg-rgb: 23, 42, 58;
  --bs-tertiary-bg: #203748;
  --bs-tertiary-bg-rgb: 32, 55, 72;
  --bs-body-color: #F0F6FC;
  --bs-heading-color: #F0F6FC;
  --bs-secondary-color: #BDCDDB;
  --bs-border-color: #ffffff18;
}
html[data-bs-theme="dark"] body {
  background: var(--trader-blue) !important;
}
html[data-bs-theme="dark"] :where(.card,.navbar,.bg-navbar-theme,.layout-navbar,.layout-menu,.bg-menu-theme,#layout-menu,.modal-content,dialog,.offcanvas,.dropdown-menu,.accordion-item,.accordion-button,.list-group-item,.aureon-mobile-header,.aureon-mobile-top,.aureon-mobile-sections) {
  background: var(--trader-blue) !important;
}
html[data-bs-theme="dark"] :is(.card,.modal-content,.dropdown-menu,.offcanvas,.accordion-item) {
  border-color: var(--bs-border-color);
  --bs-card-bg: var(--trader-blue);
  --bs-modal-bg: var(--trader-blue);
  --bs-dropdown-bg: var(--trader-blue);
}
html[data-bs-theme="dark"] :is(.form-control,.form-select,.input-group-text,.select2-dropdown,.select2-selection,.flatpickr-calendar) {
  background-color: #203748 !important;
  color: var(--bs-body-color);
  border-color: var(--bs-border-color);
}
html[data-bs-theme="dark"] .table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--bs-body-color);
  --bs-table-border-color: var(--bs-border-color);
}
html[data-bs-theme="dark"] :where(#futuresChartDialog,.tv-trade-chart,.futures-chart-pane,#futuresBenchmarkDialog,#benchmarkCalendarDialog,#benchmarkCalendarPanel) {
  background: var(--trader-blue) !important;
}
html[data-bs-theme="dark"] .layout-page::before {
  background: var(--trader-blue) !important;
}

/* Distinct navigation surfaces within the same blue palette. */
html[data-bs-theme="dark"] {
  --bs-menu-bg: #101E2B;
}
html[data-bs-theme="dark"] :is(#layout-menu,.layout-menu,.bg-menu-theme) {
  background: #101E2B !important;
  border-inline-end: 1px solid #ffffff10;
}
html[data-bs-theme="dark"] :is(.navbar,.layout-navbar,.bg-navbar-theme,.aureon-mobile-header,.aureon-mobile-top) {
  background: #172A3A !important;
  border-bottom: 1px solid #ffffff10;
}
html[data-bs-theme="dark"] .aureon-mobile-sections {
  background: #101E2B !important;
}

html[data-bs-theme="dark"] {
  --bs-link-color: var(--bs-primary);
  --bs-link-hover-color: color-mix(in srgb,var(--bs-primary),white 18%);
  --bs-menu-active-color: var(--bs-primary-contrast);
}
html[data-bs-theme="dark"] :is(.card,.modal-content,.offcanvas,.dropdown-menu,.accordion-item,.accordion-button,.list-group-item) {
  background: #172A3A !important;
  --bs-card-bg: #172A3A;
  --bs-modal-bg: #172A3A;
  --bs-dropdown-bg: #172A3A;
}
html[data-bs-theme="dark"] .btn-primary {
  --bs-btn-bg: var(--bs-primary);
  --bs-btn-border-color: var(--bs-primary);
  --bs-btn-hover-bg: color-mix(in srgb,var(--bs-primary),white 18%);
  --bs-btn-hover-border-color: color-mix(in srgb,var(--bs-primary),white 18%);
  --bs-btn-active-bg: color-mix(in srgb,var(--bs-primary),black 12%);
  --bs-btn-active-border-color: color-mix(in srgb,var(--bs-primary),black 12%);
  background-image: none !important;
  color: var(--bs-primary-contrast) !important;
}
html[data-bs-theme="dark"] .btn-outline-primary {
  --bs-btn-color: var(--bs-primary);
  --bs-btn-border-color: var(--bs-primary);
  --bs-btn-hover-bg: var(--bs-primary);
  --bs-btn-active-bg: color-mix(in srgb,var(--bs-primary),black 12%);
}
html[data-bs-theme="dark"] .btn-outline-primary:is(:hover,:active,.active),
html[data-bs-theme="dark"] .menu-item.active>.menu-link {
  color: var(--bs-primary-contrast) !important;
}
html[data-bs-theme="dark"] .menu-item.active>.menu-link .icon-base {
  color: inherit;
}

/* Primary components must share the palette, including vendor-generated states. */
html[data-bs-theme="dark"] {
  --bs-primary-bg-subtle: rgba(var(--bs-primary-rgb),.12);
  --bs-primary-text-emphasis: color-mix(in srgb,var(--bs-primary),white 18%);
  --bs-primary-border-subtle: rgba(var(--bs-primary-rgb),.35);
}
html[data-bs-theme="dark"] .btn-primary {
  background-color: var(--bs-primary) !important;
  border-color: var(--bs-primary) !important;
}
html[data-bs-theme="dark"] :is(.btn-outline-primary,.btn-text-primary,.text-primary) {
  color: var(--bs-primary) !important;
}
html[data-bs-theme="dark"] .btn-outline-primary {
  border-color: var(--bs-primary) !important;
}
html[data-bs-theme="dark"] :is(.nav-tabs,.nav-pills) .nav-link.active {
  color: var(--bs-primary-contrast);
  background-color: var(--bs-primary);
}
html[data-bs-theme="dark"] .form-check-input:checked {
  background-color: var(--bs-primary);
  border-color: var(--bs-primary);
}

/* Replay settings: darker surfaces, with restrained input separation. */
html[data-bs-theme="dark"] #futuresChartDialog #futuresStrategyReplay {
  --bs-paper-bg: #172A3A;
  background: #172A3A !important;
}
html[data-bs-theme="dark"] #futuresStrategyReplay :is(.form-control,.form-select,.input-group-text) {
  background-color: #203748 !important;
}
html[data-bs-theme="dark"] #futuresStrategyReplay :is(.futures-config-actions,.futures-regime-card) {
  background-color: #172A3A;
}

/* Chart settings popovers share the dark replay surface. */
html[data-bs-theme="dark"] :is(.futures-chart-indicators,.futures-fibonacci-options,.futures-category-options) {
  --bs-paper-bg: #172A3A;
  background: #172A3A !important;
  border-color: #ffffff18;
}
html[data-bs-theme="dark"] :is(.futures-chart-indicators,.futures-fibonacci-options) :is(.form-control,.form-select,.input-group-text) {
  background-color: #203748 !important;
}

/* Subtle depth on the page canvas; panels retain their dark solid surfaces. */
html[data-bs-theme="dark"] body {
  background: radial-gradient(ellipse at 85% 12%, rgba(75,137,168,.12), transparent 60%), linear-gradient(125deg,#1D3041 0%,#182D3C 48%,#101F2C 100%) !important;
  background-attachment: fixed !important;
}

/* Quiet depth and responsive feedback across the dark interface. */
html[data-bs-theme="dark"] .card {
  background: linear-gradient(145deg,rgba(255,255,255,.025),transparent 65%),#172A3A !important;
  box-shadow: 0 6px 20px #07121c18,inset 0 1px 0 #ffffff05;
}
html[data-bs-theme="dark"] .layout-navbar {
  box-shadow: 0 8px 24px #07121c20;
  border: 1px solid #ffffff0d;
}
html[data-bs-theme="dark"] .btn {
  transition: background-color .16s ease,border-color .16s ease,box-shadow .16s ease;
}
html[data-bs-theme="dark"] .btn-primary:hover {
  box-shadow: 0 4px 16px rgba(var(--bs-primary-rgb),.18);
}
html[data-bs-theme="dark"] :is(.form-control,.form-select):focus {
  box-shadow: 0 0 0 3px rgba(var(--bs-primary-rgb),.12);
  border-color: var(--bs-primary);
}
@media(prefers-reduced-motion:reduce){html[data-bs-theme="dark"] .btn{transition:none}}

/* Restore the original navy / petroleum background from the reference. */
html[data-bs-theme="dark"] {
  --trader-blue: #182C40;
  --bs-body-bg: #162238;
  --bs-body-bg-rgb: 22,34,56;
  --bs-paper-bg: #182C40;
  --bs-paper-bg-rgb: 24,44,64;
  --bs-card-bg: #182C40;
  --bs-menu-bg: #182C40;
  --bs-secondary-bg: #1B3045;
  --bs-secondary-bg-rgb: 27,48,69;
  --bs-tertiary-bg: #20394D;
}
html[data-bs-theme="dark"] body {
  background: radial-gradient(ellipse at 50% 50%,rgba(0,0,0,.145),rgba(0,0,0,.08) 35%,transparent 72%),radial-gradient(ellipse at 88% 48%,rgba(10,148,150,.09),rgba(10,148,150,.04) 42%,transparent 78%),radial-gradient(ellipse at 78% 12%,rgba(43,113,168,.22),rgba(43,113,168,.08) 38%,transparent 72%),linear-gradient(118deg,#121b2b 0%,#17283e 30%,#193950 58%,#1a4560 80%,#173b53 100%) !important;
  background-attachment:fixed!important;
}
html[data-bs-theme="dark"] :where(.card,.navbar,.layout-navbar,.bg-navbar-theme,#layout-menu,.layout-menu,.bg-menu-theme,.modal-content,.offcanvas,.dropdown-menu,.accordion-item,.accordion-button,.list-group-item,.aureon-mobile-header,.aureon-mobile-top,.aureon-mobile-sections) {
  background:#182C40!important;
  --bs-card-bg:#182C40;
  --bs-modal-bg:#182C40;
  --bs-dropdown-bg:#182C40;
}
html[data-bs-theme="dark"] :is(.form-control,.form-select,.input-group-text,.select2-dropdown,.select2-selection,.flatpickr-calendar) {
  background-color:#182A3E!important;
}

/* Replay keeps its dark base with subtle tints from the user's primary color. */
html[data-bs-theme="dark"] #futuresChartDialog #futuresStrategyReplay {
  --bs-paper-bg: #182C40;
  background: var(--bs-paper-bg) !important;
}
html[data-bs-theme="dark"] #futuresStrategyReplay .futures-structure-block {
  background: color-mix(in srgb,#172A3A 94%,var(--bs-primary) 6%);
  border-color: rgba(var(--bs-primary-rgb),.18);
}
html[data-bs-theme="dark"] #futuresStrategyReplay :is(.form-control,.form-select,.input-group-text) {
  background-color: #182A3E !important;
  border-color: var(--bs-border-color);
}
html[data-bs-theme="dark"] #futuresStrategyReplay .futures-config-actions {
  background: var(--bs-paper-bg);
}

/* Shared card surface: approved soft smoked glass, dark mode only. */
html[data-bs-theme="dark"] {
  --trader-glass-bg: rgba(18,35,51,.30);
  --trader-glass-border: rgba(220,235,248,.12);
  --trader-glass-shadow: inset 0 1px 0 rgba(255,255,255,.035),0 4px 16px rgba(4,12,20,.06);
}
html[data-bs-theme="dark"] :is(.card,.bi-card,.sc-card,.sc-kpi,.proc-card,.kpi-card,.weight-card,.invest-card,.invest-hero,.invest-panel,.invest-budget,.invest-allocation-section,.a3-settings-card,.exchange-card,.futures-card,.futures-indicator-card,.futures-pnl-card,.futures-regime-card,.futures-structure-block,.rank-card,.risk-card,.score-range-card,.sim-kpi,.stat-card,.stats-trade-card,.tr-panel,.trader-trade-card,.trades-toolbar-card,.benchmark-strategy-card,.benchmark-total-card,.pnl-trade-chart-panel,.scanner-replay-capital-card,.scanner-replay-result-kpi,.trade-replay-capital-card,.benchmark-card,.benchmark-assets-surface,.benchmark-progress-panel,.pnl-calendar-card,.trade-detail-box,.strategy-guide,.scanner-filter-group,.scanner-scope-panel),
html[data-bs-theme="dark"] #futuresChartDialog #futuresStrategyReplay,
html[data-bs-theme="dark"] #futuresPage .futures-radar.card {
  background: var(--trader-glass-bg) !important;
  --bs-card-bg: transparent;
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
  border-color: var(--trader-glass-border);
  box-shadow: var(--trader-glass-shadow);
}

/* Embedded history is a layout wrapper, not an additional opaque surface. */
html[data-bs-theme="dark"] #futuresHistoryPanel #futuresBenchmarkDialog,
html[data-bs-theme="dark"] #futuresHistoryPanel #futuresBenchmarkDialog > .modal-content,
html[data-bs-theme="dark"] #benchmarkCalendarDialog,
html[data-bs-theme="dark"] #benchmarkCalendarPanel {
  background: transparent !important;
}

/* Replay overlays must fully cover the chart underneath. */
html #futuresChartDialog #futuresStrategyReplay {
  background: var(--bs-paper-bg, var(--bs-body-bg, #fff)) !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}
html[data-bs-theme="dark"] #futuresChartDialog #futuresStrategyReplay {
  background: #182c40 !important;
}

/* Replay fields use the same filled blue surface as the scanner search. */
html[data-bs-theme="dark"] #futuresChartDialog #futuresStrategyReplay :is(.form-control,.form-select,.input-group-text){
 background-color:#182A3E!important;
 border-color:var(--bs-border-color)!important;
 color:var(--bs-body-color);
 opacity:1;
}
