/**
 * Desktop top header polish.
 * Visual-only overrides for row 1; mobile and the secondary nav stay untouched.
 */
@media (min-width: 901px) {
  :root,
  body.is-home-page,
  body.catalog-page-open,
  body.catalog-branch-mode,
  body.catalog-drawer-open,
  body.catalog-drawer-push,
  body:has(#catalogDrawer.open) {
    --nav-main-h: 38px;
    --nav-total-h: 70px;
    --nav-search-h: 34px;
    --nav-util-btn-h: 34px;
  }

  body > nav:not(.mob-bottom-bar) {
    border-bottom-color: #edf0f4 !important;
    box-shadow: 0 2px 10px rgba(15, 45, 107, 0.045) !important;
  }

  .nav-shell.nav-main-row,
  body.is-home-page .nav-shell.nav-main-row,
  html[dir="ltr"] .nav-shell.nav-main-row,
  html[dir="rtl"] .nav-shell.nav-main-row {
    height: 38px !important;
    min-height: 38px !important;
    max-height: 38px !important;
    grid-template-rows: 38px !important;
    align-items: center !important;
    padding-top: 2px !important;
  }

  .nav-actions-wrap,
  .nav-main-actions,
  .nav-search-wrap,
  .nav-lang-wrap,
  .nav-account,
  .nav-garage-btn,
  .nav-cart-btn {
    align-self: center !important;
  }

  .nav-main-actions,
  html[dir="ltr"] .nav-main-actions,
  html[dir="rtl"] .nav-main-actions,
  html[dir="ltr"] body.is-home-page .nav-main-actions,
  html[dir="rtl"] body.is-home-page .nav-main-actions {
    height: 34px !important;
    min-height: 34px !important;
    align-items: center !important;
    align-content: center !important;
    column-gap: 8px !important;
  }

  html[dir="ltr"] .nav-main-actions,
  html[dir="ltr"] body.is-home-page .nav-main-actions {
    display: grid !important;
    grid-template-columns: auto minmax(320px, 1fr) auto auto auto auto !important;
    grid-template-areas: "shop search lang account garage cart" !important;
  }

  html[dir="rtl"] .nav-main-actions,
  html[dir="rtl"] body.is-home-page .nav-main-actions {
    display: grid !important;
    grid-template-columns: auto auto auto auto minmax(320px, 1fr) auto !important;
    grid-template-areas: "cart garage account lang search shop" !important;
  }

  html[dir="ltr"] .nav-search-wrap,
  html[dir="rtl"] .nav-search-wrap,
  html[dir="ltr"] body.is-home-page .nav-search-wrap,
  html[dir="rtl"] body.is-home-page .nav-search-wrap {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 640px !important;
    justify-self: center !important;
    padding-top: 0 !important;
    margin: 0 !important;
  }

  .nav-search,
  html[dir="ltr"] .nav-search,
  html[dir="rtl"] .nav-search,
  body.is-home-page .nav-search {
    width: 100% !important;
    height: 34px !important;
    min-height: 34px !important;
    max-height: 34px !important;
    margin: 0 !important;
    border: 1px solid #dfe5ec !important;
    border-radius: 9px !important;
    box-shadow: none !important;
  }

  .nav-search input,
  .nav-search-btn,
  html[dir="rtl"] .nav-search input,
  html[dir="rtl"] .nav-search-btn {
    height: 32px !important;
    min-height: 32px !important;
    max-height: 32px !important;
  }

  .nav-search:focus-within,
  body.is-home-page .nav-search:focus-within {
    border-color: #9db9df !important;
    box-shadow: 0 0 0 2px rgba(30, 91, 184, 0.09) !important;
  }

  .nav-lang-wrap,
  html[dir="ltr"] .nav-lang-wrap,
  html[dir="rtl"] .nav-lang-wrap,
  html[dir="ltr"] body.is-home-page .nav-lang-wrap,
  html[dir="rtl"] body.is-home-page .nav-lang-wrap {
    margin: 0 !important;
  }

  .nav-util-btn,
  .nav-main-actions .nav-lang-btn,
  .nav-main-actions .nav-account,
  .nav-main-actions .nav-garage-btn,
  .nav-main-actions .nav-cart-btn {
    height: 34px !important;
    min-height: 34px !important;
    max-height: 34px !important;
    border-color: transparent !important;
    border-radius: 8px !important;
    box-shadow: none !important;
  }

  .nav-util-btn:hover,
  .nav-util-btn:focus-visible,
  .nav-main-actions .nav-lang-btn:hover,
  .nav-main-actions .nav-lang-btn:focus-visible {
    background: #f5f7fa !important;
    box-shadow: none !important;
  }

  .nav-shop-btn,
  body.is-home-page .nav-shop-btn {
    height: 34px !important;
    min-height: 34px !important;
    max-height: 34px !important;
    border-radius: 8px !important;
    box-shadow: none !important;
    transform: none !important;
  }

  .nav-shop-btn:hover,
  .nav-shop-btn:focus-visible,
  body.is-home-page .nav-shop-btn:hover,
  body.is-home-page .nav-shop-btn:focus-visible {
    box-shadow: none !important;
    transform: none !important;
  }
}
/* Desktop: My Garage lives inside the account workspace, not the top utility bar. */
@media (min-width: 901px) {
  html body #navGarageBtn.nav-garage-btn,
  html body.is-home-page #navGarageBtn.nav-garage-btn,
  html body .nav-util-cluster #navGarageBtn.nav-garage-btn,
  html body.is-home-page .nav-util-cluster #navGarageBtn.nav-garage-btn {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
    width: 0 !important;
    min-width: 0 !important;
    height: 0 !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
  }
}
/* Account identity state */
.nav-util-btn__icon[id^="navAuthIcon"] {
  position: relative;
  overflow: visible;
}

.nav-auth-person {
  display: inline-flex;
  width: 100%;
  height: 100%;
}

.nav-auth-plus {
  position: absolute;
  inset-inline-end: -5px;
  top: -5px;
  display: grid;
  place-items: center;
  width: 13px;
  height: 13px;
  color: #fff;
  background: #0754b8;
  border: 2px solid #fff;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
}

@media (min-width: 901px) {
  #navAuthBtn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: #0b2f68;
  }

  #navAuthLabel {
    display: inline-block !important;
    max-width: 92px;
    overflow: hidden;
    color: #0b2f68;
    font-size: 12px;
    font-weight: 750;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* Keep the authenticated first name inside its own header grid cell. */
@media (min-width: 901px) {
  html body #navAuthBtn.nav-util-btn--auth,
  html body.is-home-page #navAuthBtn.nav-util-btn--auth,
  html body .nav-util-cluster #navAuthBtn.nav-util-btn--auth {
    width: auto !important;
    min-width: 44px !important;
    max-width: 118px !important;
    padding: 0 6px !important;
    gap: 6px !important;
    overflow: hidden !important;
    justify-self: end !important;
  }

  #navAuthBtn #navAuthIcon {
    width: 20px !important;
    min-width: 20px !important;
    height: 20px !important;
    flex: 0 0 20px !important;
  }

  #navAuthBtn #navAuthLabel {
    display: block !important;
    min-width: 0 !important;
    max-width: 76px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  html body #navCartBtn.nav-cart-btn {
    position: relative !important;
    z-index: 3 !important;
    flex-shrink: 0 !important;
  }
}

@media (min-width: 901px) and (max-width: 1080px) {
  #navAuthBtn #navAuthLabel {
    max-width: 48px !important;
  }
}

@media (min-width: 901px) and (max-width: 960px) {
  html body #navAuthBtn.nav-util-btn--auth {
    width: 44px !important;
    max-width: 44px !important;
    padding: 0 !important;
  }

  #navAuthBtn #navAuthLabel {
    display: none !important;
  }
}