:root {
  color-scheme: light dark;
  --theme-bg: #f4f6f9;
  --theme-surface: #ffffff;
  --theme-surface-soft: #eef3f8;
  --theme-surface-raised: #ffffff;
  --theme-text: #24313d;
  --theme-text-muted: #5f6f7d;
  --theme-heading: #014672;
  --theme-border: #d8e0e7;
  --theme-link: #075f91;
  --theme-shadow: 0 0.5rem 1.5rem rgba(1, 70, 114, 0.1);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --theme-bg: #0b1118;
  --theme-surface: #121b24;
  --theme-surface-soft: #18242f;
  --theme-surface-raised: #1c2935;
  --theme-text: #e7edf3;
  --theme-text-muted: #afbdca;
  --theme-heading: #7bc8f2;
  --theme-border: #30404d;
  --theme-link: #79caf5;
  --theme-shadow: 0 0.75rem 2rem rgba(0, 0, 0, 0.38);
}

/* Light/dark switch in both language headers. */
.theme-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  min-height: 2.35rem;
  padding: 0.25rem 0.45rem;
  border: 2px solid var(--sht-blue, #014672);
  border-radius: 999px;
  background: #fff;
  color: var(--sht-blue, #014672);
  cursor: pointer;
  line-height: 1;
  transition: background-color 0.2s ease, border-color 0.2s ease,
    color 0.2s ease, transform 0.2s ease;
}

.theme-switch:hover {
  background: #eef7fd;
  border-color: var(--sht-blue-2, #036ea5);
  transform: translateY(-1px);
}

.theme-switch:focus-visible {
  outline: 3px solid rgba(255, 130, 0, 0.45);
  outline-offset: 2px;
}

.theme-switch__icon {
  font-size: 0.85rem;
  opacity: 0.55;
  transition: opacity 0.2s ease;
}

.theme-switch__track {
  position: relative;
  width: 2.25rem;
  height: 1.2rem;
  flex: 0 0 2.25rem;
  border-radius: 999px;
  background: #c8d4de;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.22);
  transition: background-color 0.2s ease;
}

.theme-switch__thumb {
  position: absolute;
  top: 0.15rem;
  left: 0.15rem;
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  transition: transform 0.22s ease;
}

.theme-switch[aria-checked="false"] .theme-switch__sun,
.theme-switch[aria-checked="true"] .theme-switch__moon {
  opacity: 1;
}

.theme-switch[aria-checked="true"] .theme-switch__track {
  background: #0874ad;
}

.theme-switch[aria-checked="true"] .theme-switch__thumb {
  transform: translateX(1.05rem);
}

html[data-theme="dark"] body {
  background: var(--theme-bg) !important;
  color: var(--theme-text) !important;
}

html[data-theme="dark"] .main-header,
html[data-theme="dark"] .main-nav,
html[data-theme="dark"] .main-nav > ul > li > .dropdown.submenu {
  background: #101922 !important;
  color: var(--theme-text) !important;
}

html[data-theme="dark"] .main-header {
  box-shadow: 0 0.4rem 1.25rem rgba(0, 0, 0, 0.36);
}

html[data-theme="dark"] .logo {
  padding: 0.2rem 0.35rem;
  border-radius: 0.4rem;
  background: #fff;
}

html[data-theme="dark"] .main-nav a,
html[data-theme="dark"] .main-nav > ul > li > .dropdown.submenu a {
  color: #8bd0f5 !important;
}

html[data-theme="dark"] .main-nav a::after {
  background: #ff9b32 !important;
}

html[data-theme="dark"] .main-nav > ul > li,
html[data-theme="dark"] .main-nav > ul > li > .dropdown.submenu > li {
  border-color: var(--theme-border) !important;
}

html[data-theme="dark"] .main-nav > ul > li > .dropdown.submenu a:hover,
html[data-theme="dark"] .submenu {
  background: #182530 !important;
}

html[data-theme="dark"] .hamburger {
  color: var(--theme-text) !important;
}

html[data-theme="dark"] .lang-btn,
html[data-theme="dark"] .theme-switch {
  background: #17232d !important;
  border-color: #5eb9ea !important;
  color: #dcebf4 !important;
}

html[data-theme="dark"] .lang-btn:hover,
html[data-theme="dark"] .theme-switch:hover,
html[data-theme="dark"] .lang-btn.active {
  background: #075f91 !important;
  color: #fff !important;
}

html[data-theme="dark"] :is(h1, h2, h3, h4, h5, h6):not(.hero *):not(.pagehead *):not(.sht-hero *):not(.konfig-hero *):not(.footer *) {
  color: var(--theme-heading) !important;
}

html[data-theme="dark"] a:not(.btn):not(.sht-btn):not(.lang-btn):not(.footer a):not(.main-nav a):not(.ticker a) {
  color: var(--theme-link);
}

html[data-theme="dark"] a:not(.btn):not(.sht-btn):not(.lang-btn):not(.footer a):not(.main-nav a):hover {
  color: #ff9b32;
}

/* Shared Bootstrap and site components. */
html[data-theme="dark"] :is(.card, .job-card, .contact-card, .section-contact,
  .config-panel, .referenz-card, .podcast-card, .download-card,
  .certificate-card, .contact-form-container, .modal-content) {
  background: var(--theme-surface) !important;
  color: var(--theme-text) !important;
  border-color: var(--theme-border) !important;
  box-shadow: var(--theme-shadow) !important;
}

html[data-theme="dark"] :is(.card-footer, .card-header, .list-group-item) {
  background: var(--theme-surface-soft) !important;
  color: var(--theme-text) !important;
  border-color: var(--theme-border) !important;
}

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

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

html[data-theme="dark"] :is(.bg-white, .bg-light) {
  background-color: var(--theme-surface) !important;
}

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

html[data-theme="dark"] hr {
  border-color: var(--theme-border);
  opacity: 1;
}

html[data-theme="dark"] :is(.form-control, .form-select, textarea, input:not([type="checkbox"]):not([type="radio"]), select) {
  background-color: #0f1821 !important;
  border-color: #405260 !important;
  color: var(--theme-text) !important;
}

html[data-theme="dark"] :is(.form-control, .form-select, textarea, input, select)::placeholder {
  color: #8fa0ae !important;
  opacity: 1;
}

html[data-theme="dark"] :is(.form-control, .form-select, textarea, input, select):focus {
  background-color: #111d27 !important;
  border-color: #ff9226 !important;
  color: #fff !important;
  box-shadow: 0 0 0 0.2rem rgba(255, 130, 0, 0.2) !important;
}

html[data-theme="dark"] .accordion-item {
  background: var(--theme-surface) !important;
  border-color: var(--theme-border) !important;
  box-shadow: var(--theme-shadow) !important;
}

html[data-theme="dark"] .accordion-button,
html[data-theme="dark"] .accordion-body {
  background: var(--theme-surface) !important;
  color: var(--theme-text) !important;
}

html[data-theme="dark"] .accordion-button.collapsed::after {
  filter: invert(1) grayscale(1) brightness(1.8);
}

html[data-theme="dark"] .accordion-button:not(.collapsed) {
  background: linear-gradient(135deg, #014672, #075f91) !important;
  color: #fff !important;
}

html[data-theme="dark"] :is(.table, table) {
  --bs-table-bg: var(--theme-surface);
  --bs-table-color: var(--theme-text);
  --bs-table-border-color: var(--theme-border);
  --bs-table-striped-bg: var(--theme-surface-soft);
  --bs-table-striped-color: var(--theme-text);
  color: var(--theme-text) !important;
  border-color: var(--theme-border) !important;
}

html[data-theme="dark"] :is(.table, table) :is(th, td) {
  background-color: transparent !important;
  color: inherit !important;
  border-color: var(--theme-border) !important;
}

html[data-theme="dark"] :is(.table, table) thead,
html[data-theme="dark"] .technische-grafik th,
html[data-theme="dark"] .ohf-tabelle thead {
  background: #153247 !important;
  color: #dff3ff !important;
}

html[data-theme="dark"] :is(.table, table) tr:nth-child(even) {
  background-color: #16222c !important;
}

/* Product, overview, construction, service and job layouts. */
html[data-theme="dark"] :is(.page-content, .section, .main, .main_big,
  .bau_container, .main-content, .section-wrapper, .job-section,
  .reparatur-uebersicht) {
  color: var(--theme-text) !important;
}

/* Several older pages use .content as the complete light page section. */
html[data-theme="dark"] section.content {
  background: var(--theme-bg) !important;
  color: var(--theme-text) !important;
}

html[data-theme="dark"] section.content :is(p, li, strong) {
  color: var(--theme-text) !important;
}

html[data-theme="dark"] :is(.section-info, .text, .konfigurator-hinweis,
  .kontakt-hinweis, .kontaktbox, .hinweis, .info-box) {
  background: var(--theme-surface-soft) !important;
  color: var(--theme-text) !important;
  border-color: #2782b4 !important;
}

html[data-theme="dark"] :is(.section-info li, .seite-text p,
  .dreierreihe figcaption, .referenzen p, .job-text) {
  color: var(--theme-text-muted) !important;
}

html[data-theme="dark"] .referenzen {
  background: #0e171f !important;
  color: var(--theme-text) !important;
}

html[data-theme="dark"] .technische-grafik table {
  background: var(--theme-surface) !important;
  box-shadow: var(--theme-shadow) !important;
}

/* Configurator surfaces and selectable controls. */
html[data-theme="dark"] .konfig-progress {
  background: #101922 !important;
  box-shadow: 0 0.4rem 1.2rem rgba(0, 0, 0, 0.4) !important;
}

html[data-theme="dark"] .konfig-progress__step.active,
html[data-theme="dark"] .konfig-progress__step:hover {
  color: #7bc8f2 !important;
}

html[data-theme="dark"] .section-title {
  background: linear-gradient(135deg, #172938, #1b3242) !important;
  color: #9dd9fa !important;
}

html[data-theme="dark"] .form-label,
html[data-theme="dark"] .konfig-checkbox label {
  color: #d3dde6 !important;
}

html[data-theme="dark"] :is(.radio-card label, .konfig-checkbox) {
  background: #14202a !important;
  border-color: #354958 !important;
  color: #b9cad6 !important;
}

html[data-theme="dark"] .radio-card input[type="radio"]:checked + label {
  background: #352718 !important;
  border-color: #ff9226 !important;
  color: #ffd6ad !important;
}

html[data-theme="dark"] .btn-nav.btn-back {
  background: #14202a !important;
  border-color: #79caf5 !important;
  color: #9dd9fa !important;
}

/* Inline light panels on older pages. */
html[data-theme="dark"] [style*="background: #fff"],
html[data-theme="dark"] [style*="background:#fff"],
html[data-theme="dark"] [style*="background-color: white"],
html[data-theme="dark"] [style*="background-color:#fff"] {
  background: var(--theme-surface) !important;
}

html[data-theme="dark"] [style*="color: #333"],
html[data-theme="dark"] [style*="color:#333"],
html[data-theme="dark"] [style*="color: #222"],
html[data-theme="dark"] [style*="color:#222"] {
  color: var(--theme-text) !important;
}

/* Homepage keeps its branded hero, while its content cards become dark. */
html[data-theme="dark"] .sht-hero__image {
  background: #14202a !important;
}

html[data-theme="dark"] :is(.expert-card-animate .card, .category-card) {
  background: var(--theme-surface) !important;
  color: var(--theme-text) !important;
  border-color: var(--theme-border) !important;
  box-shadow: var(--theme-shadow) !important;
}

html[data-theme="dark"] .usp_section {
  background: linear-gradient(135deg, #9f4e00, #c86400) !important;
  color: #fff !important;
}

html[data-theme="dark"] .usp_section :is(.item, h3, p) {
  color: #fff !important;
}

/* Toasts, dialogs and notices must not flash as white panels. */
html[data-theme="dark"] :is(#ct, .outage-modal__dialog, .outage-modal__content,
  #feedback-overlay > div) {
  background: var(--theme-surface-raised) !important;
  color: var(--theme-text) !important;
  border-color: var(--theme-border) !important;
}

html[data-theme="dark"] :is(#ct, #feedback-overlay) p {
  color: var(--theme-text) !important;
}

html[data-theme="dark"] .footer + p,
html[data-theme="dark"] #footer + p {
  background: var(--theme-bg) !important;
  color: var(--theme-text-muted) !important;
}

@media (max-width: 576px) {
  .theme-switch {
    min-height: 2rem;
    padding-inline: 0.35rem;
    gap: 0.2rem;
  }

  .theme-switch__icon {
    font-size: 0.75rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .theme-switch,
  .theme-switch__track,
  .theme-switch__thumb,
  .theme-switch__icon {
    transition: none;
  }
}
