:root{
  --sc-bg:#f4f6f9;--sc-card:#ffffff;--sc-text:#172033;--sc-muted:#667085;
  --sc-border:#d8dee8;--sc-dropdown:#ffffff;--sc-dropdown-hover:#f1f4f8;
}
:root[data-theme="dark"]{
  color-scheme:dark;--sc-bg:#0b1220;--sc-card:#111a2b;--sc-text:#f3f6fb;
  --sc-muted:#b8c2d4;--sc-border:#2a3851;--sc-dropdown:#111a2b;--sc-dropdown-hover:#21304a;
}
:root[data-theme="dark"] body,:root[data-theme="dark"] .main-wrap,:root[data-theme="dark"] main,:root[data-theme="dark"] #pageContent{background:var(--sc-bg)!important;color:var(--sc-text)!important}
:root[data-theme="dark"] .card-sc,:root[data-theme="dark"] .modal-content,:root[data-theme="dark"] .offcanvas,:root[data-theme="dark"] .dropdown-menu,:root[data-theme="dark"] .table,:root[data-theme="dark"] .form-control,:root[data-theme="dark"] .form-select,:root[data-theme="dark"] .list-group-item,:root[data-theme="dark"] .accordion-item{background:var(--sc-card)!important;color:var(--sc-text)!important;border-color:var(--sc-border)!important}
:root[data-theme="dark"] .topbar{background:#0f1726!important;border-color:var(--sc-border)!important}
:root[data-theme="dark"] .table>:not(caption)>*>*{background:transparent!important;color:var(--sc-text)!important;border-color:var(--sc-border)!important}
:root[data-theme="dark"] h1,:root[data-theme="dark"] h2,:root[data-theme="dark"] h3,:root[data-theme="dark"] h4,:root[data-theme="dark"] h5,:root[data-theme="dark"] h6,
:root[data-theme="dark"] .page-title,:root[data-theme="dark"] .section-title,:root[data-theme="dark"] .metric-label,:root[data-theme="dark"] .metric-value,:root[data-theme="dark"] .metric-sub,
:root[data-theme="dark"] .user-name,:root[data-theme="dark"] .account-name,:root[data-theme="dark"] .profile-name,:root[data-theme="dark"] .navbar-text,
:root[data-theme="dark"] .drilldown-title,:root[data-theme="dark"] .drilldown-label,:root[data-theme="dark"] .drilldown-value,
:root[data-theme="dark"] .modal-title,:root[data-theme="dark"] .form-label,:root[data-theme="dark"] label,:root[data-theme="dark"] strong,
:root[data-theme="dark"] .fw-semibold,:root[data-theme="dark"] .fw-bold{color:var(--sc-text)!important}
:root[data-theme="dark"] .small-muted,:root[data-theme="dark"] .text-muted,:root[data-theme="dark"] .metric-sub,:root[data-theme="dark"] .user-company,:root[data-theme="dark"] .user-organization,:root[data-theme="dark"] .account-subtitle,:root[data-theme="dark"] .drilldown-meta{color:var(--sc-muted)!important}
:root[data-theme="dark"] .account-dropdown,:root[data-theme="dark"] .user-dropdown,:root[data-theme="dark"] .dropdown-menu{background:var(--sc-dropdown)!important;border-color:var(--sc-border)!important}
:root[data-theme="dark"] .account-dropdown *,:root[data-theme="dark"] .user-dropdown *,:root[data-theme="dark"] .dropdown-menu .dropdown-item,:root[data-theme="dark"] .dropdown-menu .dropdown-header,:root[data-theme="dark"] .dropdown-menu button,:root[data-theme="dark"] .dropdown-menu a,:root[data-theme="dark"] .dropdown-menu i{color:var(--sc-text)!important}
:root[data-theme="dark"] .account-dropdown .dropdown-item:hover,:root[data-theme="dark"] .account-dropdown .dropdown-item:focus,:root[data-theme="dark"] .account-dropdown .dropdown-item.active,:root[data-theme="dark"] .dropdown-menu .dropdown-item:hover,:root[data-theme="dark"] .dropdown-menu .dropdown-item:focus{background:var(--sc-dropdown-hover)!important;color:var(--sc-text)!important}
:root[data-theme="dark"] .account-dropdown .dropdown-divider,:root[data-theme="dark"] .dropdown-divider{border-color:var(--sc-border)!important}
:root[data-theme="dark"] .drilldown-panel,:root[data-theme="dark"] .analytics-inspector,:root[data-theme="dark"] .chart-detail-panel,:root[data-theme="dark"] .summary-box,:root[data-theme="dark"] .empty-state,:root[data-theme="dark"] .dashboard-error-state{background:var(--sc-card)!important;border-color:var(--sc-border)!important;color:var(--sc-text)!important}
:root[data-theme="dark"] .btn-close{filter:invert(1) grayscale(100%) brightness(200%)}
:root[data-theme="dark"] input::placeholder,:root[data-theme="dark"] textarea::placeholder{color:#8f9bb0!important}
.account-dropdown .sc-theme-choice{display:flex;align-items:center;width:100%}
.account-dropdown .sc-theme-check{margin-left:auto;font-weight:800}


/* =========================================================
   v3.5.2c.1 — Account Dropdown Dark Hover Cleanup
   ========================================================= */

:root[data-theme="dark"] .account-menu-btn,
:root[data-theme="dark"] .account-menu-btn:hover,
:root[data-theme="dark"] .account-menu-btn:focus,
:root[data-theme="dark"] .account-menu-btn:focus-visible,
:root[data-theme="dark"] .account-menu-btn.show,
:root[data-theme="dark"] .account-menu-btn[aria-expanded="true"] {
  background: var(--sc-dropdown) !important;
  color: var(--sc-text) !important;
  border-color: var(--sc-border) !important;
}

:root[data-theme="dark"] .account-menu-btn:hover,
:root[data-theme="dark"] .account-menu-btn:focus-visible,
:root[data-theme="dark"] .account-menu-btn.show,
:root[data-theme="dark"] .account-menu-btn[aria-expanded="true"] {
  background: var(--sc-dropdown-hover) !important;
}

/* Override earlier generic dark dropdown active rule with brand orange. */
:root[data-theme="dark"] .account-dropdown .sc-theme-choice:hover,
:root[data-theme="dark"] .account-dropdown .sc-theme-choice:focus,
:root[data-theme="dark"] .account-dropdown [data-theme-value]:hover,
:root[data-theme="dark"] .account-dropdown [data-theme-value]:focus,
:root[data-theme="dark"] .account-dropdown [data-theme]:hover,
:root[data-theme="dark"] .account-dropdown [data-theme]:focus {
  background: var(--sc-accent-soft) !important;
  color: var(--sc-accent) !important;
}

:root[data-theme="dark"] .account-dropdown .sc-theme-choice.active,
:root[data-theme="dark"] .account-dropdown .sc-theme-choice[aria-current="true"],
:root[data-theme="dark"] .account-dropdown [data-theme-value].active,
:root[data-theme="dark"] .account-dropdown [data-theme-value][aria-checked="true"],
:root[data-theme="dark"] .account-dropdown [data-theme].active,
:root[data-theme="dark"] .account-dropdown [data-theme][aria-checked="true"],
:root[data-theme="dark"] .account-dropdown .dropdown-item.active {
  background: var(--sc-accent) !important;
  color: #fff !important;
}


/* =========================================================
   v3.5.2c.2 — Light Theme Surface Refinement
   ========================================================= */

:root:not([data-theme="dark"]) {
  color-scheme: light;
}

:root:not([data-theme="dark"]) .account-menu-btn {
  background: #ffffff !important;
  color: var(--sc-text) !important;
  border-color: var(--sc-border) !important;
}

:root:not([data-theme="dark"]) .account-menu-btn:hover,
:root:not([data-theme="dark"]) .account-menu-btn:focus-visible,
:root:not([data-theme="dark"]) .account-menu-btn.show,
:root:not([data-theme="dark"]) .account-menu-btn[aria-expanded="true"] {
  background: var(--sc-bg-subtle) !important;
  color: var(--sc-text-strong) !important;
  border-color: var(--sc-border-strong) !important;
}
