/* R9 light-mode logo contrast. Original artwork is unchanged.
   Load after the applicable page stylesheet. Padding stays inside each
   existing logo allocation, so a 320px header gains no horizontal width. */
html[data-stepstone-theme="light"] body.bms-flat-ui :is(
  .sidebar-logo__link,
  .dashboard-header__brand,
  .page-wrapper .navbar-logo,
  .sidebar__main-logo,
  .bms-public-header.bms-public-header--stepstone .bms-public-brand,
  .bms-public-footer.bms-public-footer--stepstone .bms-public-footerbrand > a:first-child,
  .account-left__logo,
  .bms-system-brand,
  .navbar-brand.logo,
  .footer-item__logo > a,
  .header-new-logo
),
html[data-stepstone-theme="light"] body.bms-public-reference .pub-brand {
  box-sizing: border-box !important;
  padding: 2px 8px !important;
  background: #101923 !important;
  background-image: none !important;
  border: 0 !important;
  border-radius: 6px !important;
  box-shadow: none !important;
}

/* These older wrappers sized themselves from a fixed-width image. Retain
   that allocation explicitly before making the child fill its inner box. */
html[data-stepstone-theme="light"] body.bms-flat-ui.bms-flat-admin
  .page-wrapper .navbar-logo {
  width: 220px !important;
  max-width: 100% !important;
  height: 36px !important;
}
html[data-stepstone-theme="light"] body.bms-flat-ui :is(
  .sidebar__main-logo, .navbar-brand.logo, .footer-item__logo > a, .header-new-logo
) {
  display: inline-flex;
  align-items: center;
  width: 220px;
  max-width: 100%;
  height: 36px;
}

html[data-stepstone-theme="light"] body.bms-flat-ui :is(
  .sidebar-logo__link,
  .dashboard-header__brand,
  .page-wrapper .navbar-logo,
  .sidebar__main-logo,
  .bms-public-header.bms-public-header--stepstone .bms-public-brand,
  .bms-public-footer.bms-public-footer--stepstone .bms-public-footerbrand > a:first-child,
  .account-left__logo,
  .bms-system-brand,
  .navbar-brand.logo,
  .footer-item__logo > a,
  .header-new-logo
) > img,
html[data-stepstone-theme="light"] body.bms-public-reference .pub-brand > img {
  box-sizing: border-box !important;
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  height: 100% !important;
  max-height: 100% !important;
  padding: 0 !important;
  margin: 0 !important;
  object-fit: contain !important;
  object-position: center !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  filter: none !important;
}

/* Stacked authentication art keeps its natural ratio and original width. */
html[data-stepstone-theme="light"] body.bms-flat-ui.bms-flat-auth
  .account-left__logo:has(> img[data-stepstone-logo="full"]) {
  padding: 12px !important;
  border-radius: 8px !important;
}
html[data-stepstone-theme="light"] body.bms-flat-ui.bms-flat-auth
  .account-left__logo > img[data-stepstone-logo="full"] {
  height: auto !important;
  max-height: none !important;
}
html[data-stepstone-theme="light"] body.bms-flat-ui.bms-flat-admin
  .login-wrapper__top > img.bms-admin-auth-logo[data-stepstone-logo="full"] {
  box-sizing: border-box !important;
  max-width: 100% !important;
  height: auto !important;
  padding: 12px !important;
  background: #101923 !important;
  border: 0 !important;
  border-radius: 8px !important;
  box-shadow: none !important;
  filter: none !important;
}

/* The terminal uses its own persisted theme hook. Its status pill retains
   its allocation beside this bounded, shrinkable logo container. */
:is(html[data-stepstone-theme="light"], html[data-theme="light"])
  body.flat-trader.flat-terminal .flat-trade-pane .v2-auto-head h3:has(> img),
body.flat-trader.flat-terminal[data-theme="light"]
  .flat-trade-pane .v2-auto-head h3:has(> img) {
  box-sizing: border-box !important;
  flex: 0 1 180px !important;
  min-width: 0 !important;
  max-width: 100% !important;
  height: 33px !important;
  padding: 2px 8px !important;
  background: #101923 !important;
  border: 0 !important;
  border-radius: 6px !important;
  box-shadow: none !important;
}
:is(html[data-stepstone-theme="light"], html[data-theme="light"])
  body.flat-trader.flat-terminal .flat-trade-pane .v2-auto-head h3 > img,
body.flat-trader.flat-terminal[data-theme="light"]
  .flat-trade-pane .v2-auto-head h3 > img {
  box-sizing: border-box !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  height: 100% !important;
  max-height: 100% !important;
  padding: 0 !important;
  object-fit: contain !important;
  object-position: center !important;
  background: transparent !important;
  filter: none !important;
}

@media (max-width: 639px) {
  html[data-stepstone-theme="light"] body.bms-flat-ui .dashboard-header__brand,
  html[data-stepstone-theme="light"] body.bms-public-reference .pub-header .pub-brand {
    padding-inline: 6px !important;
  }
  html[data-stepstone-theme="light"] body.bms-flat-ui :is(
    .sidebar__main-logo, .navbar-brand.logo, .footer-item__logo > a, .header-new-logo
  ) {
    width: 160px;
    height: 28px;
  }
}
@media (max-width: 575px) {
  html[data-stepstone-theme="light"] body.bms-flat-ui.bms-flat-admin
    .page-wrapper .navbar-logo {
    width: 160px !important;
    height: 32px !important;
  }
}

/* Restricted-account state uses the same unchanged full artwork. */
html[data-stepstone-theme="light"] body.bms-flat-ui.bms-flat-public .bms-access-restricted__brand {
  box-sizing: border-box !important;
  max-width: 100% !important;
  padding: 12px !important;
  background: #101923 !important;
  background-image: none !important;
  border: 0 !important;
  border-radius: 8px !important;
  box-shadow: none !important;
}
