/* Desktop header: align utility actions to content right edge + restore height.
   Loaded after hl-header-nav so 42px/0.15rem shrink does not win. Mobile unchanged. */

@media (min-width: 992px) {
  /* Do not flex the container — that shrink-wraps the row and parks Sisene/cart mid-bar. */
  #header .header-top > .container,
  #header .header-top > .container-md {
    display: block !important;
    width: min(var(--hl-container-max, 1400px), calc(100% - var(--hl-container-gutter, 40px))) !important;
    max-width: var(--hl-container-max, 1400px) !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }

  #header .header-top .row {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    --bs-gutter-x: 0 !important;
  }

  #header .header-top__left,
  #header .header-top .col-md-4 {
    display: flex !important;
    flex: 1 1 auto !important;
    align-items: center !important;
    justify-content: flex-start !important;
    width: auto !important;
    max-width: none !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  #header .header-top__right,
  #header .header-top .col-md-8 {
    display: flex !important;
    flex: 0 0 auto !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 8px !important;
    width: auto !important;
    max-width: none !important;
    margin-left: auto !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  /* Thin utility bar — cart flush with search right, not a tall padded strip */
  #header .header-top,
  body .header-top {
    padding: 0 !important;
    min-height: 40px !important;
    height: auto !important;
  }

  #header .header-top .ps-shoppingcart .header-block,
  #header .header-top .blockcart,
  #header .header-top .header-block.blockcart {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    min-height: 34px !important;
    height: 34px !important;
    padding: 0 14px !important;
    border-radius: 6px !important;
  }

  #header .header-top a,
  #header .header-top .header-block__title,
  #header .header-top .ps-contactinfo__email,
  #header .header-top .header-block {
    font-size: 13.5px !important;
    line-height: 1.2 !important;
  }

  /* Logo + search row — tighter stack under logo/search */
  #header .header-bottom {
    padding: .5rem 0 .2rem !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, .05) !important;
  }

  #header .header-bottom__row.row,
  #header .header-bottom__row {
    min-height: 0 !important;
    column-gap: 36px !important;
    row-gap: .2rem !important;
    align-items: center !important;
  }

  #header .header-bottom__logo {
    margin-right: 2rem !important;
  }

  #header .header-bottom__logo .logo,
  #header .navbar-brand .logo,
  #header img.logo,
  #header #_desktop_logo img {
    width: 200px !important;
    max-width: 200px !important;
    max-height: 51px !important;
    height: auto !important;
    aspect-ratio: 1721 / 440;
  }

  #header .header-bottom__logo .navbar-brand {
    min-height: 51px !important;
    max-width: none !important;
    width: auto !important;
  }

  /* Search fills remaining row to cart right edge — no fixed max-width (820 was too short) */
  #header #_desktop_ps_searchbar,
  #header #_desktop_ps_searchbar.ms-auto,
  #header #_desktop_ps_searchbar.order-2 {
    flex: 1 1 auto !important;
    max-width: none !important;
    width: auto !important;
    min-width: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  #header #_desktop_ps_searchbar .ps-searchbar,
  #header #_desktop_ps_searchbar .ps-searchbar__form {
    width: 100% !important;
    max-width: none !important;
  }

  #header .ps-searchbar__input,
  #header .ps-searchbar .form-control,
  #header #_desktop_ps_searchbar .ps-searchbar__input {
    min-height: 46px !important;
    height: 46px !important;
    font-size: .95rem !important;
  }

  /* Space between search and L1 — keep tight */
  #header .ps-mainmenu--desktop {
    margin: .1rem 0 0 !important;
  }

  #header .ps-mainmenu__tree,
  #header #top-menu.ps-mainmenu__tree {
    min-height: 60px !important;
    height: 60px !important;
    max-height: 60px !important;
  }

  #header .ps-mainmenu__tree-link,
  #header .ps-mainmenu__desktop .ps-mainmenu__tree-link {
    font-size: 12.5px !important;
    font-weight: 600 !important;
    min-height: 60px !important;
    padding: 7px 10px !important;
    text-transform: none !important;
    white-space: normal !important;
    line-height: 1.15 !important;
  }

  #header .ps-mainmenu__desktop .hl-mega__toplink-icon,
  #header .ps-mainmenu__tree-link .hl-mega__toplink-icon {
    width: 38px !important;
    height: 38px !important;
    max-width: 38px !important;
    max-height: 38px !important;
    object-fit: contain !important;
  }

  #header {
    margin-bottom: 4px !important;
    min-height: 192px !important;
  }

  /* Cart qty — typographic, no muddy/white bubble */
  #header .header-top .ps-shoppingcart .header-block__action-btn,
  #header .header-top .blockcart .header-block__action-btn {
    display: inline-flex !important;
    align-items: center !important;
    gap: 7px !important;
  }

  #header .header-top .ps-shoppingcart .header-block__badge,
  #header .header-top .blockcart .header-block__badge,
  #header .header-top .header-block.blockcart .header-block__badge {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    align-self: center !important;
    margin: 0 0 0 1px !important;
    min-width: 0 !important;
    height: auto !important;
    padding: 0 0 0 8px !important;
    border: 0 !important;
    border-left: 1px solid rgba(255, 255, 255, 0.38) !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    color: #fff !important;
    font-size: 12.5px !important;
    font-weight: 650 !important;
    line-height: 1 !important;
    letter-spacing: 0.01em !important;
    font-variant-numeric: tabular-nums !important;
    opacity: 1 !important;
  }

  #header .header-top .ps-shoppingcart .header-block.inactive .header-block__badge,
  #header .header-top .blockcart.inactive .header-block__badge {
    display: none !important;
  }
}
