:root {
  color-scheme: light;
  --theme-bg: #F9FBFC;
  --theme-panel: #F2F6F8;
  --theme-nav: #E8EDF1;
  --theme-text: #182631;
  --theme-muted: #4B6170;
  --theme-border: #CBD6DE;
  --theme-accent: #225985;
  --theme-active: #E4EEF6;
  --theme-hover: #F0F5F8;
}

:root[data-theme="night"] {
  color-scheme: dark;
  --theme-bg: #20262C;
  --theme-panel: #262D35;
  --theme-nav: #1B2025;
  --theme-text: #F0F2F5;
  --theme-muted: #ABB7C3;
  --theme-border: #414B55;
  --theme-accent: #A9C7F4;
  --theme-active: #30435C;
  --theme-hover: #2B343E;
}

body:has(> #homeBackground:not([hidden])),
#page-monitoring:has(> #homeBackground:not([hidden])) {
  isolation: isolate;
}

#homeBackground {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

body:has(> #homeBackground:not([hidden])) .layout > .side {
  background-color: color-mix(in srgb, var(--theme-nav) 82%, transparent);
}

body:has(#homeBackground:not([hidden])) #page-monitoring,
body:has(#homeBackground:not([hidden])) #page-monitoring :is(
  .monitor-chart-shell, .monitor-chart-scroll, .monitor-track-grid, .monitor-sheet-workspace
) {
  background-color: transparent;
}

body:has(#homeBackground:not([hidden])) #page-monitoring .monitor-operations-bar {
  background-color: color-mix(in srgb, var(--theme-panel) 76%, transparent);
}

body:has(#homeBackground:not([hidden])) #page-monitoring .monitor-track:nth-child(n) {
  background-color: color-mix(in srgb, var(--sheet-plot, var(--theme-bg)) 90%, transparent);
}

@media print {
  #homeBackground { display: none; }
}

:where(button[data-theme-toggle]) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-width: 36px;
  min-height: 36px;
  padding: 6px 10px;
  border: 1px solid var(--theme-border);
  border-radius: 6px;
  background: var(--theme-panel);
  color: var(--theme-text);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

:where(button[data-theme-toggle]):hover {
  background: var(--theme-hover);
  color: var(--theme-accent);
}

button[data-theme-toggle]:focus-visible {
  outline: 2px solid var(--theme-accent);
  outline-offset: 2px;
}

[data-theme-toggle] svg {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.monitor-operations-bar [data-theme-toggle] { display: none; flex: none; padding: 5px; }
#page-monitoring:fullscreen .monitor-operations-bar [data-theme-toggle] { display: inline-flex; }
.monitor-operations-bar [data-theme-toggle] span { display: none; }
