.theme-toggle {
  display: grid;
  width: 25px;
  height: 25px;
  padding: 0;
  place-items: center;
  color: #fff;
  border: 1px solid rgba(255,255,255,.32);
  border-radius: 50%;
  background: rgba(4,48,87,.24);
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.theme-toggle:hover, .theme-toggle:focus-visible { border-color: rgba(255,255,255,.72); background: rgba(255,255,255,.12); transform: translateY(-1px); }
.theme-toggle svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.theme-icon-sun { display: none; }

html[data-theme="dark"] {
  color-scheme: dark;
  --navy-950: #f1f6fb;
  --navy-900: #c2dced;
  --navy-800: #8bc9f2;
  --blue-700: #70b9e8;
  --blue-500: #458bb9;
  --blue-300: #254b68;
  --blue-100: #111d27;
  --surface: rgba(16, 25, 33, .96);
  --ink: #e8eef4;
  --muted: #a6b5c2;
  --shadow: 0 22px 55px rgba(0, 0, 0, .42);
  --image-dark-overlay: rgba(0, 0, 0, 0.62);
}

html[data-theme="dark"] .theme-icon-moon { display: none; }
html[data-theme="dark"] .theme-icon-sun { display: block; }
html[data-theme="dark"] body {
  color: var(--ink);
  background: linear-gradient(180deg, #061b30 0, #263b50 790px);
}
html[data-theme="dark"] .masthead { background: transparent; }
/* Filter only decorative layers so transparent edges and foreground colors stay intact. */
html[data-theme="dark"] #header,
html[data-theme="dark"] .portal-surface,
html[data-theme="dark"] .portal-footer {
  position: relative;
  isolation: isolate;
  background: none;
}
html[data-theme="dark"] #header::before,
html[data-theme="dark"] .portal-surface::before,
html[data-theme="dark"] .portal-footer::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  width: auto;
  pointer-events: none;
  filter: brightness(.4) saturate(.65);
}
html[data-theme="dark"] #header::before {
  background: url("/assets/images/legacy/header.png") center top / auto 160px no-repeat;
  mask-image: linear-gradient(90deg, transparent 10%, #000 35%, #000 65%, transparent 90%);
}
html[data-theme="dark"] .main-nav {
  border-color: rgba(142,190,222,.2);
}
html[data-theme="dark"] .main-nav a:hover,
html[data-theme="dark"] .main-nav a:focus-visible,
html[data-theme="dark"] .main-nav a.active { background: rgba(119,190,235,.18); }
html[data-theme="dark"] .theme-toggle { background: rgba(0,0,0,.3); }

@media (max-width: 940px) {
  /* The isolated decorative header must keep its fixed drawer above the page's stacking contexts. */
  html[data-theme="dark"] #header { z-index: 20; }
  html[data-theme="dark"] .main-nav[data-menu] {
    background: #102535;
    border-color: rgba(142,190,222,.28);
  }
}

html[data-theme="dark"] .portal-top { filter: brightness(.4) saturate(.65); }
html[data-theme="dark"] .portal-surface::before {
  background:
    url("/assets/images/legacy/main_content_bg.png") center top / 100% 623px no-repeat,
    url("/assets/images/legacy/main_bg.jpg") center top / 100% auto repeat-y,
    #7eb0de;
}
html[data-theme="dark"] .page-bottom-bg {
  background: linear-gradient(#263b50, #06182b);
}
html[data-theme="dark"] .portal-footer { color: #dce7ef; }
html[data-theme="dark"] .portal-footer::before {
  background: url("/assets/images/legacy/main_footer.png") center top / 100% 100% no-repeat;
  -webkit-mask-image: none;
  mask-image: none;
}
html[data-theme="dark"] .portal-footer::after { display: none; }

html[data-theme="dark"] .classic-welcome,
html[data-theme="dark"] .page-hero { border-color: #36546a; background: radial-gradient(circle at 80% 20%, rgba(50,116,157,.26), transparent 30%), linear-gradient(145deg, #152a39, #08131c 75%); }
html[data-theme="dark"] .classic-welcome p,
html[data-theme="dark"] .page-hero p { color: #c7d7e3; }
html[data-theme="dark"] .beni-editorial-feature,
html[data-theme="dark"] .legacy-tabs { border-color: #314959; background: #101920; }
html[data-theme="dark"] .legacy-product-tabs { background: #101920; }
html[data-theme="dark"] .legacy-tabs {
  --editorial-link: #82c9f2;
  --editorial-body: #bed0dc;
  --editorial-heading: #bed0dc;
  box-shadow: 8px 18px 15px -10px rgba(0,0,0,.5);
}
html[data-theme="dark"] .legacy-tabs .TabbedPanelsTabGroup {
  background: linear-gradient(90deg, #253b50, #172b3c);
}
/* Keep the spacer, but replace the opaque shadow artwork with a fading CSS shadow. */
html[data-theme="dark"] .tabs-index-shadow { background: none; }
html[data-theme="dark"] .legacy-tabs .tabbed_panels_tab { color: #b5ccdd; }
html[data-theme="dark"] .legacy-tabs .TabbedPanelsContentGroup {
  background: linear-gradient(rgba(10,26,41,.82), rgba(10,26,41,.82)),
    url("/assets/images/legacy/tabs/index_contentgroup.jpg") center / 100% 100% no-repeat;
}
html[data-theme="dark"] .legacy-tabs .tabbed_panels_tab:is([aria-selected="true"], :hover, :focus-visible) {
  color: #f0f6fa;
  background: linear-gradient(90deg, #2c465d, #223c52);
}
html[data-theme="dark"] .legacy-tabs .section-eyebrow { color: #86bddf; }
html[data-theme="dark"] .legacy-product-tabs button {
  border-color: rgba(188,215,235,.2);
  background: linear-gradient(#3c5366, #1a2c3c);
}
html[data-theme="dark"] .legacy-product-tabs button:is(:hover, :focus-visible) {
  background: linear-gradient(#4a657b, #263f53);
}
html[data-theme="dark"] .legacy-product-tabs button::before {
  background: linear-gradient(#dba62e, #bd690c);
}
html[data-theme="dark"] .legacy-tabs h2,
html[data-theme="dark"] .legacy-tabs p,
html[data-theme="dark"] .legacy-tab-story small { color: #bed0dc; }
html[data-theme="dark"] .legacy-tabs a { color: #82c9f2; }
html[data-theme="dark"] .legacy-tab-story { border-color: rgba(145,181,205,.16); }

html[data-theme="dark"] .content-card,
html[data-theme="dark"] .heritage-story,
html[data-theme="dark"] .portal-loading,
html[data-theme="dark"] .contact-form,
html[data-theme="dark"] .product-availability,
html[data-theme="dark"] .client-auth-panel,
html[data-theme="dark"] .client-loading,
html[data-theme="dark"] .client-empty-state,
html[data-theme="dark"] .client-account-strip,
html[data-theme="dark"] .client-data-section { color: #dfe8ef; border-color: #2d4658; background: #111a21; box-shadow: var(--shadow); }
html[data-theme="dark"] .content-card h3,
html[data-theme="dark"] .heritage-story h2,
html[data-theme="dark"] .timeline h3,
html[data-theme="dark"] .contact-form h2,
html[data-theme="dark"] .client-empty-state h2,
html[data-theme="dark"] .client-account-strip strong,
html[data-theme="dark"] .client-record-list h3,
html[data-theme="dark"] .client-document-table div strong,
html[data-theme="dark"] .client-document-table b,
html[data-theme="dark"] .client-note-list h3,
html[data-theme="dark"] .client-support-list summary { color: #edf4f9; }
html[data-theme="dark"] .content-card p,
html[data-theme="dark"] .heritage-story p,
html[data-theme="dark"] .timeline p,
html[data-theme="dark"] .story-body,
html[data-theme="dark"] .client-loading p,
html[data-theme="dark"] .client-empty-state p,
html[data-theme="dark"] .client-data-empty,
html[data-theme="dark"] .client-record-list p,
html[data-theme="dark"] .client-record-meta,
html[data-theme="dark"] .client-document-table article,
html[data-theme="dark"] .client-note-list p { color: #a9bbc8; }
html[data-theme="dark"] .timeline { border-color: #304756; }
html[data-theme="dark"] .timeline article { border-color: rgba(118,153,176,.18); }
html[data-theme="dark"] .story-detail footer { color: #dfe8ef; }

html[data-theme="dark"] .product-availability { background: linear-gradient(135deg, #16242e, #0c141a); }
html[data-theme="dark"] .product-availability > strong { color: #93c9ec; }
html[data-theme="dark"] .product-availability li { color: #d8e5ee; border-color: #304b5e; background: #0a1218; }
html[data-theme="dark"] .platform-icon { color: #6fc5f4; }
html[data-theme="dark"] .product-availability.compact { background: rgba(0,0,0,.22); }

html[data-theme="dark"] .contact-context { background: linear-gradient(145deg, #111f29, #050b10); }
html[data-theme="dark"] .contact-context p { color: #b5c7d3; }
html[data-theme="dark"] .form-grid label,
html[data-theme="dark"] .client-auth-panel form > label { color: #b5c9d7; }
html[data-theme="dark"] .form-grid input,
html[data-theme="dark"] .form-grid textarea,
html[data-theme="dark"] .client-auth-panel form input:not([type="checkbox"]),
html[data-theme="dark"] .client-login-box input { color: #edf4f8; border-color: #3a5364; background: #070d12; }
html[data-theme="dark"] .form-grid input:focus,
html[data-theme="dark"] .form-grid textarea:focus { border-color: #5daee0; box-shadow: 0 0 0 3px rgba(56,145,201,.18); }

html[data-theme="dark"] .client-login-box {
  border-color: #304959;
  background: linear-gradient(180deg, #1a2d3a, #101920);
}
html[data-theme="dark"] .beni-shopping-box h2 { background: linear-gradient(#172630, #070d12); }
html[data-theme="dark"] .client-login-box label { color: #d7e7f2; }
html[data-theme="dark"] .client-login-box > a { color: #9fd6f6; }
html[data-theme="dark"] .expand-menu-header,
html[data-theme="dark"] .side-box h2,
html[data-theme="dark"] .classic-accordion .expand-menu-tab {
  background: linear-gradient(#203340, #111b22);
}
html[data-theme="dark"] .expand-menu-content,
html[data-theme="dark"] .side-box h2,
html[data-theme="dark"] .classic-accordion .expand-menu-tab .expand-menu-content { color: #dce8ef; }
html[data-theme="dark"] .classic-accordion .menu-right-link {
  background-color: #1a2a35;
  background-image: linear-gradient(180deg, #243845, #1a2a35 48%, #15232d);
}
html[data-theme="dark"] .classic-accordion .menu-right-link li a { color: #c5d5df; }
html[data-theme="dark"] .classic-accordion .menu-right-link li a:hover,
html[data-theme="dark"] .classic-accordion .menu-right-link li a:active,
html[data-theme="dark"] .classic-accordion .menu-right-link li a:focus-visible {
  color: #fff;
  background-color: #3a6f99;
}
html[data-theme="dark"] .shopping-content { color: #dce8ef; background: linear-gradient(180deg, #101920 68%, #070d12); }
html[data-theme="dark"] .beni-shopping-box p { color: #dce8ef; }
html[data-theme="dark"] .beni-shopping-box a { color: #7ccaf4; }
html[data-theme="dark"] .start-project-box > div { color: #c4d3dd; background: linear-gradient(135deg, #131e25, #0a1015); }

html[data-theme="dark"] .network-banner { color: #dce8ef; border-color: #315b76; background: linear-gradient(13deg, #172c3a 0 69%, #223e50 69% 100%); }
html[data-theme="dark"] .network-banner strong { color: #81c7ef; }
html[data-theme="dark"] .signal-card { border-color: #324d60; background: #324d60; }
html[data-theme="dark"] .signal-card div { background: linear-gradient(135deg, #182731, #0c141a); }
html[data-theme="dark"] .signal-card strong { color: #dfeaf1; }
html[data-theme="dark"] .signal-card span { color: #9eb2c0; }
html[data-theme="dark"] .insight-list { border-color: #304957; }
html[data-theme="dark"] .insight-list a { border-color: rgba(117,151,173,.2); }
html[data-theme="dark"] .insight-list a:hover { background: rgba(255,255,255,.04); }

html[data-theme="dark"] .client-auth-panel aside,
html[data-theme="dark"] .client-data-section > header { background: linear-gradient(145deg, #172b38, #09131a); }
html[data-theme="dark"] .client-account-strip div,
html[data-theme="dark"] .client-record-list article,
html[data-theme="dark"] .client-document-table article,
html[data-theme="dark"] .client-note-list article,
html[data-theme="dark"] .client-support-list details { border-color: rgba(112,147,170,.18); }
html[data-theme="dark"] .client-account-strip small,
html[data-theme="dark"] .client-record-list small,
html[data-theme="dark"] .client-document-table div small,
html[data-theme="dark"] .client-support-list summary span,
html[data-theme="dark"] .client-support-list summary time { color: #7fb7dc; }
html[data-theme="dark"] .client-message-thread article { background: #182d3a; }
html[data-theme="dark"] .client-message-thread article.from-client { background: #203846; }
html[data-theme="dark"] .client-message-thread small,
html[data-theme="dark"] .client-message-thread p { color: #c2d2dc; }


html[data-theme="dark"] .client-data-section > header { color: #e5f1fa; background: linear-gradient(#243e50, #142936); }
html[data-theme="dark"] .client-data-section > header p { color: #b6cbd9; }
html[data-theme="dark"] .client-section-icon { color: #a9d5f5; border-color: #54768f; background: #183c56; }
html[data-theme="dark"] .client-section-nav a,
html[data-theme="dark"] .client-detail-back,
html[data-theme="dark"] .client-detail-link { color: #d6eafa; border-color: #486980; background: linear-gradient(#28475d, #1a3244); }
html[data-theme="dark"] .client-section-nav b,
html[data-theme="dark"] .client-record-meta span { color: #c7e5f8; border-color: #486980; background: #18384e; }
html[data-theme="dark"] .client-detail-panel { border-color: #486980; }
html[data-theme="dark"] .client-detail-panel > header { background: radial-gradient(circle at 80% 20%, rgba(50,116,157,.26), transparent 40%), linear-gradient(145deg, #152a39, #08131c); }
html[data-theme="dark"] .client-detail-facts,
html[data-theme="dark"] .client-lines th,
html[data-theme="dark"] .client-lines td { border-color: #3b586e; }
