/**
 * MIU header v2 — one white bar: logo, search, navy actions, airy nav.
 * Checkout keeps .hl-checkout-header and is outside :has(.miu-hdr).
 */

#header:has(.miu-hdr) {
  --miu-hdr-navy: #0b2b3b;
  --miu-hdr-petrol: #5da2b0;
  --miu-hdr-line: #e7eceb;
  --miu-hdr-search: #f6f8f8;
  --miu-hdr-h: 46px;
  background: #fff !important;
  background-color: #fff !important;
  border: 0 !important;
  border-bottom: 1px solid var(--miu-hdr-line) !important;
  box-shadow: none !important;
  position: relative;
  top: auto;
  z-index: auto;
  padding-top: 0;
  overflow: visible;
}

/* Phone / tablet: keep compact sticky full header (menu is off-canvas). */
@media (max-width: 991.98px) {
  #header:has(.miu-hdr),
  body #header:has(.miu-hdr) {
    position: sticky !important;
    top: 0 !important;
    z-index: 1040 !important;
    padding-top: env(safe-area-inset-top, 0px);
    border-bottom: 1px solid var(--miu-hdr-line) !important;
    overflow: visible !important;
    background: #fff !important;
  }

  /* Open search strip stays attached under the sticky bar */
  body #header.is-search-open:has(.miu-hdr) {
    z-index: 1050 !important;
  }
}

/* Beat the older sand strip (#f5f4f1) on header, row and the menu itself. */
body #header:has(.miu-hdr),
body #header:has(.miu-hdr) .header-bottom,
body #header:has(.miu-hdr) .header-bottom.miu-hdr,
body #header:has(.miu-hdr) .header-bottom__container,
body #header:has(.miu-hdr) .miu-hdr__container,
body #header:has(.miu-hdr) .header-bottom__row,
body #header:has(.miu-hdr) .miu-hdr__row {
  background: #fff !important;
  background-color: #fff !important;
  background-image: none !important;
}

body #header:has(.miu-hdr) .ps-mainmenu,
body #header:has(.miu-hdr) .ps-mainmenu--desktop,
body #header:has(.miu-hdr) .ps-mainmenu__desktop,
body #header:has(.miu-hdr) #_desktop_top_menu,
body #header:has(.miu-hdr) .ps-mainmenu__tree,
body #header:has(.miu-hdr) #top-menu,
body #header:has(.miu-hdr) #top-menu.ps-mainmenu__tree {
  background: #ffffff !important;
  background-color: #ffffff !important;
  background-image: none !important;
}

#header:has(.miu-hdr):has(.ps-mainmenu__tree-item.is-mega-open) {
  border-bottom-color: transparent !important;
}

#header:has(.miu-hdr) .header-top {
  display: none !important;
}

#header:has(.miu-hdr) .header-bottom.miu-hdr,
#header:has(.miu-hdr) .miu-hdr__container {
  background: #fff !important;
  border: 0 !important;
  box-shadow: none !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  color: var(--miu-hdr-navy);
}

#header:has(.miu-hdr) .miu-hdr__row.row {
  --bs-gutter-x: 0;
  --bs-gutter-y: 0;
  margin: 0 !important;
  width: 100%;
  min-width: 0;
}

#header:has(.miu-hdr) .miu-hdr__row > * {
  min-width: 0;
  margin: 0;
  padding-left: 0;
  padding-right: 0;
}

/* ---- Logo ---- */
#header:has(.miu-hdr) .miu-hdr__logo,
#header:has(.miu-hdr) .header-bottom__h1 {
  display: flex;
  align-items: center;
  margin: 0;
  line-height: 0;
}

#header:has(.miu-hdr) .miu-hdr__logo a,
#header:has(.miu-hdr) .miu-logo-link {
  display: inline-flex !important;
  align-items: center;
  min-height: 0 !important;
  padding: 0 !important;
  line-height: 0;
}

#header:has(.miu-hdr) .miu-hdr__logo img,
#header:has(.miu-hdr) .miu-logo {
  display: block;
  height: 48px !important;
  max-height: 48px !important;
  width: auto !important;
  max-width: 214px !important;
  object-fit: contain;
  /* Hero Petrol #10525A — filter, mitte uus logo-fail */
  filter: brightness(0) saturate(100%) invert(19%) sepia(28%) saturate(1068%) hue-rotate(145deg)
    brightness(94%) contrast(93%);
}

/* ---- Search ---- */
#header:has(.miu-hdr) #_desktop_ps_searchbar,
#header:has(.miu-hdr) #ps_searchbar.ps-searchbar,
#header:has(.miu-hdr) .ps-searchbar,
#header:has(.miu-hdr) .miu-fast-search-host,
#header:has(.miu-hdr) .miu-header-search {
  display: flex !important;
  align-items: center;
  width: 100%;
  max-width: none !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  position: relative;
}

#header:has(.miu-hdr) .ps-searchbar__form {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: var(--miu-hdr-h);
  min-height: var(--miu-hdr-h) !important;
  margin: 0;
  padding: 0 16px 0 16px;
  background: var(--miu-hdr-search) !important;
  border: 1px solid var(--miu-hdr-line) !important;
  border-radius: 999px !important;
  box-shadow: none !important;
}

#header:has(.miu-hdr) .ps-searchbar__form:focus-within {
  background: #fff !important;
  border-color: var(--miu-hdr-petrol) !important;
  box-shadow: 0 0 0 3px rgba(93, 162, 176, 0.22) !important;
}

/* Open results continue the field: square the bottom so the two corners meet. */
body #header:has(.miu-hdr) .ps-searchbar__form.is-joined,
body #header:has(.miu-hdr) .ps-searchbar__form.is-joined:focus-within {
  border-radius: 22px 22px 0 0 !important;
  border-bottom-color: transparent !important;
  box-shadow: none !important;
}

#header:has(.miu-hdr) .ps-searchbar__magnifier,
#header:has(.miu-hdr) .js-search-icon.ps-searchbar__magnifier {
  position: static !important;
  transform: none !important;
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  margin: 0 !important;
  padding: 0 !important;
  font-size: 0 !important;
  line-height: 0 !important;
  color: transparent !important;
  background-color: #6d7f86;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='6.25'/%3E%3Cpath d='M16 16.5 20 20.5'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='6.25'/%3E%3Cpath d='M16 16.5 20 20.5'/%3E%3C/svg%3E") center / contain no-repeat;
  pointer-events: none;
}

#header:has(.miu-hdr) .ps-searchbar__input,
#header:has(.miu-hdr) #ps_searchbar_input,
#header:has(.miu-hdr) .js-search-input.ps-searchbar__input {
  flex: 1 1 auto;
  min-width: 0;
  height: 100% !important;
  min-height: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  outline: none !important;
  box-shadow: none !important;
  background: transparent !important;
  color: var(--miu-hdr-navy) !important;
  font-family: inherit;
  font-size: 15px !important;
  font-weight: 500 !important;
  line-height: 1.2 !important;
}

#header:has(.miu-hdr) .ps-searchbar__input::placeholder {
  color: #7d8d93;
  opacity: 1;
}

/* ---- Sign in (light) and Cart (deep petrol), no shared capsule ---- */
body #header:has(.miu-hdr) .miu-hdr__actions {
  display: inline-flex !important;
  align-items: center !important;
  height: 48px !important;
  padding: 0 !important;
  background: transparent !important;
  background-color: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  color: #0b2b3b !important;
  gap: 8px;
  box-shadow: none !important;
  box-sizing: border-box;
}

body #header:has(.miu-hdr) .miu-hdr__actions > div,
body #header:has(.miu-hdr) .miu-hdr__actions .ps-customersignin,
body #header:has(.miu-hdr) .miu-hdr__actions .ps-shoppingcart,
body #header:has(.miu-hdr) .miu-hdr__actions .header-block,
body #header:has(.miu-hdr) .miu-hdr__actions #_desktop_ps_customersignin,
body #header:has(.miu-hdr) .miu-hdr__actions #_desktop_ps_shoppingcart {
  display: flex !important;
  align-items: center !important;
  align-self: center;
  height: 40px !important;
  margin: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  background-color: transparent !important;
  box-shadow: none;
}

body #header:has(.miu-hdr) .miu-hdr__actions #_desktop_ps_shoppingcart {
  box-shadow: none !important;
  margin-left: 0 !important;
  padding-left: 0 !important;
}

#header:has(.miu-hdr) .miu-hdr__actions .header-block__action-btn,
#header:has(.miu-hdr) .miu-hdr__actions .header-block__action-btn:hover,
#header:has(.miu-hdr) .miu-hdr__actions .header-block__action-btn:focus {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 100%;
  min-height: 40px;
  margin: 0;
  padding: 0 14px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: #0b2b3b !important;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  text-decoration: none !important;
  white-space: nowrap;
  box-shadow: none;
}

#header:has(.miu-hdr) .miu-hdr__actions .header-block__action-btn:hover {
  background: rgba(93, 162, 176, 0.1);
}

#header:has(.miu-hdr) .miu-hdr__actions .header-block__action-btn:focus-visible {
  outline: 2px solid var(--miu-hdr-petrol);
  outline-offset: 1px;
}

#header:has(.miu-hdr) .miu-hdr__actions .header-block__title {
  color: #0b2b3b !important;
  font-weight: 600;
  letter-spacing: -0.01em;
}

#header:has(.miu-hdr) .miu-hdr__actions .header-block__icon {
  flex: 0 0 18px;
  width: 18px !important;
  height: 18px !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden;
  font-size: 0 !important;
  line-height: 0 !important;
  color: transparent !important;
  background-color: #0b2b3b !important;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: contain;
  mask-size: contain;
}

#header:has(.miu-hdr) .ps-customersignin .header-block__icon {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='8' r='3.15'/%3E%3Cpath d='M5.5 19.25c1.2-3.15 3.35-4.7 6.5-4.7s5.3 1.55 6.5 4.7'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='8' r='3.15'/%3E%3Cpath d='M5.5 19.25c1.2-3.15 3.35-4.7 6.5-4.7s5.3 1.55 6.5 4.7'/%3E%3C/svg%3E");
}

#header:has(.miu-hdr) .ps-shoppingcart .header-block__icon {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6.4 8.2h11.2l-.85 11.1a1.3 1.3 0 0 1-1.3 1.2H8.55a1.3 1.3 0 0 1-1.3-1.2L6.4 8.2z'/%3E%3Cpath d='M9 8.2V6.9a3 3 0 0 1 6 0v1.3'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6.4 8.2h11.2l-.85 11.1a1.3 1.3 0 0 1-1.3 1.2H8.55a1.3 1.3 0 0 1-1.3-1.2L6.4 8.2z'/%3E%3Cpath d='M9 8.2V6.9a3 3 0 0 1 6 0v1.3'/%3E%3C/svg%3E");
}

body #header:has(.miu-hdr) .miu-hdr__actions .header-block__action-btn,
body #header:has(.miu-hdr) .miu-hdr__actions .header-block__action-btn.pe-md-0,
body #header:has(.miu-hdr) .miu-hdr__actions a.header-block__action-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  align-self: center;
  gap: 8px;
  height: 40px !important;
  min-height: 40px !important;
  margin: 0 !important;
  padding: 0 14px !important;
  border: 0 !important;
  border-radius: 11px !important;
  background: transparent !important;
  color: #0b2b3b !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  line-height: 1 !important;
  letter-spacing: 0;
  text-decoration: none !important;
  white-space: nowrap;
  box-shadow: none !important;
  transform: none !important;
}

body #header:has(.miu-hdr) .miu-hdr__actions .header-block__title,
body #header:has(.miu-hdr) .miu-hdr__actions .header-block__title.d-md-flex {
  display: inline !important;
  align-items: center;
  margin: 0 !important;
  padding: 0 !important;
  color: #0b2b3b !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  line-height: 1 !important;
  letter-spacing: -0.01em;
}

body #header:has(.miu-hdr) .miu-hdr__actions .header-block__badge,
body #header:has(.miu-hdr) .header-block__badge {
  position: static !important;
  top: auto !important;
  right: auto !important;
  bottom: auto !important;
  left: auto !important;
  transform: none !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-width: 22px;
  width: auto;
  height: 22px;
  margin: 0 !important;
  padding: 0 6px !important;
  border: 0 !important;
  border-radius: 999px;
  background: #ffffff !important;
  color: #0b2b3b !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  line-height: 1 !important;
  box-shadow: none !important;
  vertical-align: middle;
}

@media (min-width: 768px) {
  body #header:has(.miu-hdr) .miu-hdr__actions .ps-customersignin .header-block__action-btn,
  body #header:has(.miu-hdr) .miu-hdr__actions .ps-customersignin .header-block__action-btn.pe-md-0,
  body #header:has(.miu-hdr) .miu-hdr__actions .ps-customersignin a.header-block__action-btn {
    height: 42px !important;
    min-height: 42px !important;
  }
}

body #header:has(.miu-hdr) .miu-hdr__actions .ps-customersignin .header-block__action-btn:hover,
body #header:has(.miu-hdr) .miu-hdr__actions .ps-customersignin .header-block__action-btn:focus {
  background: transparent !important;
  color: #3f7583 !important;
}

body #header:has(.miu-hdr) .miu-hdr__actions .ps-customersignin .header-block__action-btn:hover .header-block__title,
body #header:has(.miu-hdr) .miu-hdr__actions .ps-customersignin .header-block__action-btn:focus .header-block__title {
  color: #3f7583 !important;
}

body #header:has(.miu-hdr) .miu-hdr__actions .ps-customersignin .header-block__action-btn:hover .header-block__icon,
body #header:has(.miu-hdr) .miu-hdr__actions .ps-customersignin .header-block__action-btn:focus .header-block__icon {
  background-color: #3f7583 !important;
}

body #header:has(.miu-hdr) .miu-hdr__actions .ps-shoppingcart .header-block__action-btn,
body #header:has(.miu-hdr) .miu-hdr__actions .ps-shoppingcart .header-block__action-btn.pe-md-0,
body #header:has(.miu-hdr) .miu-hdr__actions .ps-shoppingcart a.header-block__action-btn,
body #header:has(.miu-hdr) .miu-hdr__actions .ps-shoppingcart button.header-block__action-btn {
  gap: 8px;
  height: 42px !important;
  min-height: 42px !important;
  padding: 0 14px 0 12px !important;
  border-radius: 12px !important;
  background: #3f7583 !important;
  color: #fff !important;
  transition: background-color 180ms ease;
}

body #header:has(.miu-hdr) .miu-hdr__actions .ps-shoppingcart .header-block__action-btn:hover,
body #header:has(.miu-hdr) .miu-hdr__actions .ps-shoppingcart .header-block__action-btn:focus {
  background: #346572 !important;
  color: #fff !important;
}

body #header:has(.miu-hdr) .miu-hdr__actions .ps-shoppingcart .header-block__action-btn:focus-visible {
  outline: 2px solid #0b2b3b;
  outline-offset: 2px;
}

body #header:has(.miu-hdr) .miu-hdr__actions .ps-shoppingcart .header-block__title {
  color: #fff !important;
}

body #header:has(.miu-hdr) .miu-hdr__actions .ps-shoppingcart .header-block__icon {
  background-color: #fff !important;
}

#header:has(.miu-hdr) .miu-hdr__actions .dropdown-menu {
  top: calc(100% + 8px);
  right: 0;
  left: auto;
  min-width: 220px;
  padding: 6px;
  background: #fff;
  color: var(--miu-hdr-navy);
  border: 1px solid var(--miu-hdr-line);
  border-radius: 12px;
  box-shadow: 0 14px 36px rgba(11, 43, 59, 0.12);
}

#header:has(.miu-hdr) .miu-hdr__actions .dropdown-item {
  color: var(--miu-hdr-navy);
  border-radius: 8px;
  font-weight: 600;
}

#header:has(.miu-hdr) .miu-hdr__actions .dropdown-item:hover,
#header:has(.miu-hdr) .miu-hdr__actions .dropdown-item:focus {
  background: #f4f7f7;
  color: var(--miu-hdr-navy);
}

/* ---- Hamburger ---- */
#header:has(.miu-hdr) .ps-mainmenu__mobile-toggle,
#header:has(.miu-hdr) .menu-toggle {
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent !important;
  color: var(--miu-hdr-navy) !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  box-shadow: none;
}

#header:has(.miu-hdr) .menu-toggle:hover,
#header:has(.miu-hdr) .menu-toggle:focus-visible {
  background: #f4f7f7 !important;
  color: var(--miu-hdr-navy) !important;
  outline: none;
}

#header:has(.miu-hdr) .menu-toggle:focus-visible {
  outline: 2px solid var(--miu-hdr-petrol);
  outline-offset: 2px;
}

#header:has(.miu-hdr) .menu-toggle .miu-nav-toggle__icon,
#header:has(.miu-hdr) .menu-toggle svg {
  display: block !important;
  width: 22px !important;
  height: 22px !important;
  flex: 0 0 22px;
  stroke: #0b2b3b !important;
  color: #0b2b3b !important;
  fill: none !important;
  opacity: 1 !important;
  visibility: visible !important;
}

/* Search opens from a magnifier on phones. Desktop and tablet keep the field. */
#header:has(.miu-hdr) .miu-hdr__search-open,
#header:has(.miu-hdr) .miu-hdr__search-close {
  display: none;
}

#header:has(.miu-hdr) .miu-hdr__search-open {
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #0b2b3b;
}

#header:has(.miu-hdr) .miu-hdr__search-open svg,
#header:has(.miu-hdr) .miu-hdr__search-close svg {
  display: block;
  stroke: #0b2b3b;
}

#header:has(.miu-hdr) .miu-hdr__search-close {
  align-items: center;
  justify-content: center;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  margin: 0 0 0 4px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
}

/* ---- Desktop ---- */
@media (min-width: 1280px) {
  #header:has(.miu-hdr) .miu-hdr__row {
    display: grid !important;
    grid-template-columns: auto minmax(240px, 1fr) auto;
    grid-template-rows: auto auto;
    justify-content: space-between;
    align-items: center;
    column-gap: clamp(18px, 2.4vw, 40px);
    row-gap: 2px;
    padding: 14px 0 0;
  }

  #header:has(.miu-hdr) .miu-hdr__logo {
    grid-column: 1;
    grid-row: 1;
  }

  #header:has(.miu-hdr) #_desktop_ps_searchbar {
    grid-column: 2;
    grid-row: 1;
    width: 560px !important;
    max-width: 100% !important;
    justify-self: center;
  }

  #header:has(.miu-hdr) .miu-hdr__actions {
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
  }

  #header:has(.miu-hdr) .ps-mainmenu {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100% !important;
    max-width: none !important;
    flex: none !important;
    position: relative;
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
    border: 0 !important;
    border-top: 1px solid #e7eceb !important;
    border-bottom: 1px solid #e7eceb !important;
    box-shadow: none !important;
    overflow: visible !important;
  }

  #header:has(.miu-hdr) .ps-mainmenu__desktop {
    background: #ffffff !important;
    border: 0 !important;
    box-shadow: none !important;
    overflow: visible !important;
    padding: 0 !important;
  }

  #header:has(.miu-hdr) .ps-mainmenu__desktop::after {
    display: none !important;
  }

  #header:has(.miu-hdr) .ps-mainmenu__tree,
  #header:has(.miu-hdr) #top-menu.ps-mainmenu__tree {
    min-height: 48px !important;
    height: 48px !important;
    max-height: 48px !important;
    align-items: center !important;
  }

  #header:has(.miu-hdr) .ps-mainmenu__tree-item {
    height: 48px !important;
  }

  #header:has(.miu-hdr) .ps-mainmenu__desktop--v82 .miu-l1-icon,
  #header:has(.miu-hdr) .ps-mainmenu__desktop--icons .miu-l1-icon {
    width: 20px !important;
    height: 20px !important;
    flex-basis: 20px !important;
  }

  #header:has(.miu-hdr) .ps-mainmenu__desktop--v82 .miu-l1-icon__svg {
    width: 20px !important;
    height: 20px !important;
  }
}

/* Full labels do not fit below 1280 — hamburger, not a squeezed menu. */
@media (max-width: 1279.98px) {
  #header:has(.miu-hdr) .ps-mainmenu__desktop,
  #header:has(.miu-hdr) nav.ps-mainmenu__desktop.d-lg-block {
    display: none !important;
  }

  #header:has(.miu-hdr) .ps-mainmenu__mobile-toggle,
  #header:has(.miu-hdr) .menu-toggle.d-lg-none,
  #header:has(.miu-hdr) .menu-toggle {
    display: inline-flex !important;
    width: 44px !important;
    height: 44px !important;
    min-width: 44px;
    min-height: 44px;
  }
}

/* ---- Tablet: hamburger, search stays on the row when it fits ---- */
@media (min-width: 768px) and (max-width: 1279.98px) {
  #header:has(.miu-hdr) .miu-hdr__row {
    display: grid !important;
    grid-template-columns: 44px auto minmax(180px, 1fr) auto;
    align-items: center;
    column-gap: 12px;
    padding: 12px 0;
    min-height: 72px;
  }

  #header:has(.miu-hdr) .ps-mainmenu {
    grid-column: 1;
    grid-row: 1;
    width: 44px !important;
    max-width: 44px !important;
    position: relative;
    overflow: visible;
  }

  #header:has(.miu-hdr) .miu-hdr__logo {
    grid-column: 2;
    grid-row: 1;
  }

  #header:has(.miu-hdr) .miu-hdr__logo img,
  #header:has(.miu-hdr) .miu-logo {
    height: 40px !important;
    max-height: 40px !important;
    max-width: 176px !important;
  }

  #header:has(.miu-hdr) #_desktop_ps_searchbar {
    grid-column: 3;
    grid-row: 1;
    width: 100%;
  }

  #header:has(.miu-hdr) .miu-hdr__actions {
    grid-column: 4;
    grid-row: 1;
  }
}

@media (min-width: 768px) and (max-width: 899.98px) {
  #header:has(.miu-hdr) .miu-hdr__actions .header-block__title {
    display: none !important;
  }

  #header:has(.miu-hdr) .miu-hdr__actions .header-block__action-btn {
    padding: 0 12px;
  }
}

/* ---- Mobile: one row. Search opens from the magnifier. ---- */
@media (max-width: 767.98px) {
  #header:has(.miu-hdr) .miu-hdr__row {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    column-gap: 0;
    row-gap: 0;
    min-height: 64px;
    padding: 8px 0;
  }

  body #header:has(.miu-hdr) .ps-mainmenu {
    order: 1;
    flex: 0 0 48px;
    width: 48px !important;
    max-width: 48px !important;
    position: relative;
    overflow: visible;
  }

  body #header:has(.miu-hdr) .ps-mainmenu__mobile-toggle,
  body #header:has(.miu-hdr) .menu-toggle {
    width: 48px !important;
    height: 48px !important;
    min-width: 48px !important;
    min-height: 48px !important;
    border-radius: 12px !important;
  }

  body #header:has(.miu-hdr) .menu-toggle .miu-nav-toggle__icon,
  body #header:has(.miu-hdr) .menu-toggle svg {
    width: 26px !important;
    height: 26px !important;
    flex-basis: 26px;
  }

  #header:has(.miu-hdr) .miu-hdr__logo {
    order: 2;
    flex: 0 1 auto;
    min-width: 0;
  }

  #header:has(.miu-hdr) .miu-hdr__logo img,
  #header:has(.miu-hdr) .miu-logo {
    height: 34px !important;
    max-height: 34px !important;
    max-width: min(148px, 42vw) !important;
  }

  #header:has(.miu-hdr) #_desktop_ps_searchbar,
  #header:has(.miu-hdr) .miu-header-search {
    order: 3;
    display: flex !important;
    flex: 0 0 44px !important;
    width: 44px !important;
    max-width: 44px !important;
    margin-left: auto !important;
    position: static !important;
  }

  body #header:has(.miu-hdr) .miu-hdr__search-open {
    display: inline-flex !important;
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    border-radius: 12px !important;
  }

  body #header:has(.miu-hdr) .miu-hdr__search-open svg {
    width: 22px !important;
    height: 22px !important;
  }

  #header:has(.miu-hdr) .miu-hdr__search-open:hover {
    background: #f4f7f7 !important;
  }

  #header:has(.miu-hdr) .miu-hdr__search-open:focus-visible {
    outline: 2px solid var(--miu-hdr-petrol);
    outline-offset: 2px;
  }

  body #header:has(.miu-hdr) #_desktop_ps_searchbar #ps_searchbar.ps-searchbar {
    display: none !important;
  }

  body #header.is-search-open:has(.miu-hdr) #_desktop_ps_searchbar #ps_searchbar.ps-searchbar {
    display: block !important;
    position: absolute !important;
    left: 0;
    right: 0;
    top: 100%;
    z-index: 50;
    width: auto !important;
    max-width: none !important;
    margin: 0;
    padding: 8px 12px 12px;
    background: #fff !important;
    border-bottom: 1px solid var(--miu-hdr-line);
    box-shadow: 0 16px 32px rgba(11, 43, 59, 0.08);
    /* Stay docked to sticky header — never float mid-page */
    transform: none !important;
  }

  #header.is-search-open:has(.miu-hdr) .miu-hdr__search-close {
    display: inline-flex !important;
  }

  #header.is-search-open:has(.miu-hdr) .ps-searchbar__clear {
    display: none !important;
  }

  #header.is-search-open:has(.miu-hdr) .ps-searchbar__form {
    height: 44px;
    min-height: 44px !important;
  }

  body #header:has(.miu-hdr) .miu-hdr__actions {
    order: 4;
    height: auto !important;
    margin-left: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    background-color: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    gap: 0;
  }

  body #header:has(.miu-hdr) .miu-hdr__actions #_desktop_ps_customersignin,
  body #header:has(.miu-hdr) .miu-hdr__actions #_desktop_ps_shoppingcart,
  body #header:has(.miu-hdr) .miu-hdr__actions .ps-customersignin,
  body #header:has(.miu-hdr) .miu-hdr__actions .ps-shoppingcart,
  body #header:has(.miu-hdr) .miu-hdr__actions .header-block {
    height: 44px !important;
  }

  body #header:has(.miu-hdr) .miu-hdr__actions #_desktop_ps_shoppingcart {
    box-shadow: none !important;
    margin-left: 0 !important;
    padding-left: 0 !important;
  }

  body #header:has(.miu-hdr) .miu-hdr__actions .header-block__title {
    display: none !important;
  }

  body #header:has(.miu-hdr) .miu-hdr__actions .header-block__action-btn,
  body #header:has(.miu-hdr) .miu-hdr__actions .header-block__action-btn:hover,
  body #header:has(.miu-hdr) .miu-hdr__actions .header-block__action-btn:focus,
  body #header:has(.miu-hdr) .miu-hdr__actions .header-block__action-btn.pe-md-0,
  body #header:has(.miu-hdr) .miu-hdr__actions a.header-block__action-btn,
  body #header:has(.miu-hdr) .miu-hdr__actions button.header-block__action-btn {
    position: relative;
    width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
    max-height: 44px !important;
    padding: 0 !important;
    color: #0b2b3b !important;
    background: transparent !important;
  }

  #header:has(.miu-hdr) .miu-hdr__actions .header-block__action-btn:hover {
    background: #f4f7f7 !important;
  }

  body #header:has(.miu-hdr) .miu-hdr__actions .header-block__icon {
    flex-basis: 22px !important;
    width: 22px !important;
    height: 22px !important;
    background-color: #0b2b3b !important;
  }

  body #header:has(.miu-hdr) .miu-hdr__actions .header-block__badge {
    position: absolute !important;
    top: 4px !important;
    right: 2px !important;
    left: auto !important;
    min-width: 16px;
    height: 16px;
    margin: 0 !important;
    padding: 0 4px !important;
    background: #5da2b0 !important;
    color: #fff !important;
    font-size: 10px !important;
  }

  body #header:has(.miu-hdr) .miu-hdr__actions .ps-shoppingcart .header-block__action-btn,
  body #header:has(.miu-hdr) .miu-hdr__actions .ps-shoppingcart .header-block__action-btn:hover,
  body #header:has(.miu-hdr) .miu-hdr__actions .ps-shoppingcart .header-block__action-btn:focus,
  body #header:has(.miu-hdr) .miu-hdr__actions .ps-shoppingcart a.header-block__action-btn,
  body #header:has(.miu-hdr) .miu-hdr__actions .ps-shoppingcart button.header-block__action-btn {
    width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
    max-height: 44px !important;
    padding: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: #0b2b3b !important;
  }

  body #header:has(.miu-hdr) .miu-hdr__actions .ps-shoppingcart .header-block__icon {
    background-color: #0b2b3b !important;
  }

  body #header:has(.miu-hdr) .miu-hdr__actions .ps-customersignin .header-block__action-btn,
  body #header:has(.miu-hdr) .miu-hdr__actions .ps-customersignin .header-block__action-btn:hover {
    width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
    padding: 0 !important;
  }
}

@media (max-width: 359.98px) {
  #header:has(.miu-hdr) .miu-hdr__logo img,
  #header:has(.miu-hdr) .miu-logo {
    height: 30px !important;
    max-height: 30px !important;
    max-width: 100px !important;
  }
}

/* Drawer polish — logic stays in miu-mobile-nav.js */
#header:has(.miu-hdr) ~ .miu-catdrawer .miu-catdrawer__title,
.miu-catdrawer .miu-catdrawer__title {
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  font-size: 16px;
  color: #0b2b3b;
}

.miu-catdrawer__item-link {
  min-height: 48px;
}

/* ---- V2: cart badge keeps clear space inside the capsule on desktop ---- */
body #header:has(.miu-hdr) .ps-searchbar__form:focus-within .ps-searchbar__magnifier {
  background-color: #5da2b0 !important;
}

@media (min-width: 1280px) {
  body #header:has(.miu-hdr) .miu-hdr__actions .ps-shoppingcart a.header-block__action-btn,
  body #header:has(.miu-hdr) .miu-hdr__actions .ps-shoppingcart .header-block__action-btn.pe-md-0 {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    padding-left: 14px !important;
    padding-right: 16px !important;
    padding-inline-start: 14px !important;
    padding-inline-end: 16px !important;
    gap: 10px !important;
  }

  body #header:has(.miu-hdr) .miu-hdr__actions .ps-customersignin a.header-block__action-btn {
    padding: 0 16px !important;
    gap: 8px !important;
  }

  body #header:has(.miu-hdr) #top-menu > .ps-mainmenu__tree-item > .ps-mainmenu__tree-item-wrapper > .ps-mainmenu__tree-link {
    gap: 8px !important;
    padding: 7px 10px !important;
    min-height: 36px !important;
    max-height: none !important;
    height: auto !important;
    font-size: 14px !important;
    font-weight: 650 !important;
    letter-spacing: -0.02em !important;
    color: #0b2b3b !important;
    background: transparent !important;
    border-color: transparent !important;
    border-radius: 8px !important;
    box-shadow: none !important;
  }

  body #header:has(.miu-hdr) .ps-mainmenu__desktop--icons .miu-l1-icon,
  body #header:has(.miu-hdr) .ps-mainmenu__desktop--v82 .miu-l1-icon {
    color: #0b2b3b !important;
  }

  body #header:has(.miu-hdr) #top-menu > .ps-mainmenu__tree-item:hover > .ps-mainmenu__tree-item-wrapper > .ps-mainmenu__tree-link,
  body #header:has(.miu-hdr) #top-menu > .ps-mainmenu__tree-item.current > .ps-mainmenu__tree-item-wrapper > .ps-mainmenu__tree-link,
  body #header:has(.miu-hdr) #top-menu > .ps-mainmenu__tree-item.is-mega-open > .ps-mainmenu__tree-item-wrapper > .ps-mainmenu__tree-link,
  body #header:has(.miu-hdr) #top-menu > .ps-mainmenu__tree-item:focus-within > .ps-mainmenu__tree-item-wrapper > .ps-mainmenu__tree-link {
    color: #0b2b3b !important;
    background: transparent !important;
    border-color: transparent !important;
    border-radius: 8px !important;
    box-shadow: none !important;
    font-weight: 700 !important;
  }

  body #header:has(.miu-hdr) #top-menu > .ps-mainmenu__tree-item.current > .ps-mainmenu__tree-item-wrapper > .ps-mainmenu__tree-link::before,
  body #header:has(.miu-hdr) #top-menu > .ps-mainmenu__tree-item.is-mega-open > .ps-mainmenu__tree-item-wrapper > .ps-mainmenu__tree-link::before,
  body #header:has(.miu-hdr) #top-menu > .ps-mainmenu__tree-item:focus-within > .ps-mainmenu__tree-item-wrapper > .ps-mainmenu__tree-link::before {
    content: "" !important;
    display: block !important;
    position: absolute !important;
    top: 1px !important;
    left: 50% !important;
    width: 5px !important;
    height: 5px !important;
    margin: 0 0 0 -2.5px !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 1px !important;
    background: #5da2b0 !important;
    box-shadow: none !important;
    transform: rotate(45deg) !important;
    pointer-events: none !important;
  }

  body #header:has(.miu-hdr) #top-menu > .ps-mainmenu__tree-item:hover > .ps-mainmenu__tree-item-wrapper > .ps-mainmenu__tree-link::after,
  body #header:has(.miu-hdr) #top-menu > .ps-mainmenu__tree-item.current > .ps-mainmenu__tree-item-wrapper > .ps-mainmenu__tree-link::after,
  body #header:has(.miu-hdr) #top-menu > .ps-mainmenu__tree-item.is-mega-open > .ps-mainmenu__tree-item-wrapper > .ps-mainmenu__tree-link::after,
  body #header:has(.miu-hdr) #top-menu > .ps-mainmenu__tree-item:focus-within > .ps-mainmenu__tree-item-wrapper > .ps-mainmenu__tree-link::after {
    transform: scaleX(1) !important;
    background: #5da2b0 !important;
    left: 12px !important;
    right: 12px !important;
    bottom: 2px !important;
    height: 2px !important;
  }

  body #header:has(.miu-hdr) .ps-mainmenu__desktop .ps-mainmenu__tree-item:hover .miu-l1-icon,
  body #header:has(.miu-hdr) .ps-mainmenu__desktop .ps-mainmenu__tree-item.current .miu-l1-icon,
  body #header:has(.miu-hdr) .ps-mainmenu__desktop .ps-mainmenu__tree-item.is-mega-open .miu-l1-icon,
  body #header:has(.miu-hdr) .ps-mainmenu__desktop .ps-mainmenu__tree-item:focus-within .miu-l1-icon {
    color: #5da2b0 !important;
  }
}

.miu-catdrawer__header {
  border-bottom-color: #e7eceb;
}

/* Mouse click may focus a link. The ring stays for keyboard only. */
html.miu-pointer a:focus,
html.miu-pointer a:focus-visible {
  outline: none !important;
}
html.miu-pointer #header .ps-mainmenu__tree-link:focus,
html.miu-pointer #header .ps-mainmenu__tree-link:focus-visible {
  outline: none !important;
  box-shadow: none !important;
}
html.miu-pointer body #header:has(.miu-hdr) #top-menu > .ps-mainmenu__tree-item:focus-within:not(:hover):not(.is-mega-open):not(.current) > .ps-mainmenu__tree-item-wrapper > .ps-mainmenu__tree-link::before {
  content: none !important;
}
html.miu-pointer body #header:has(.miu-hdr) #top-menu > .ps-mainmenu__tree-item:focus-within:not(:hover):not(.is-mega-open):not(.current) > .ps-mainmenu__tree-item-wrapper > .ps-mainmenu__tree-link::after {
  transform: scaleX(0) !important;
}
html.miu-pointer body #header:has(.miu-hdr) .ps-mainmenu__desktop .ps-mainmenu__tree-item:focus-within:not(:hover):not(.is-mega-open):not(.current) .miu-l1-icon {
  color: #0b2b3b !important;
}
