/* Customer header + bottom nav — last-layer layout for current HTML. */

html body:not(.admin-view):not(.merchant-view) .libseh-header {
  position: sticky;
  top: 0;
  z-index: 200;
  background: #FBF7F0;
  border-bottom: 1px solid rgba(49, 53, 44, 0.08);
  padding-top: env(safe-area-inset-top, 0px);
  overflow: visible;
}

html body:not(.admin-view):not(.merchant-view) .libseh-header-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 64px;
  width: min(100% - 16px, 1280px);
  margin-inline: auto;
  padding-inline: 4px;
  gap: 4px;
}

html body:not(.admin-view):not(.merchant-view) .header-start,
html body:not(.admin-view):not(.merchant-view) .header-end {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
}

html body:not(.admin-view):not(.merchant-view) .header-start {
  justify-self: start;
  justify-content: flex-start;
}

html body:not(.admin-view):not(.merchant-view) .header-end {
  justify-self: end;
  justify-content: flex-end;
  grid-column: 3;
  overflow: visible;
}

html body:not(.admin-view):not(.merchant-view) .libseh-mark {
  grid-column: 2;
  justify-self: center;
  max-width: min(42vw, 148px);
}

html body:not(.admin-view):not(.merchant-view) .libseh-mark img {
  display: block;
  height: 38px;
  width: auto;
  max-width: 148px;
  object-fit: contain;
}

html body:not(.admin-view):not(.merchant-view) .libseh-header .round-icon,
html body:not(.admin-view):not(.merchant-view) .libseh-header .mobile-menu-toggle {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #66001f;
  background: transparent;
  border: 0;
  position: relative;
}

html body:not(.admin-view):not(.merchant-view) .libseh-header .ls-icon {
  width: 22px;
  height: 22px;
}

html body:not(.admin-view):not(.merchant-view) .header-search-form,
html body:not(.admin-view):not(.merchant-view) .header-desktop-nav,
html body:not(.admin-view):not(.merchant-view) .header-fav-desktop,
html body:not(.admin-view):not(.merchant-view) .header-cart-desktop,
html body:not(.admin-view):not(.merchant-view) .header-cart-mobile,
html body:not(.admin-view):not(.merchant-view) .libseh-header .bag-trigger,
html body:not(.admin-view):not(.merchant-view) .libseh-header .header-language-switcher,
html body:not(.admin-view):not(.merchant-view) .libseh-header .language-switcher.header-language-switcher {
  display: none;
}

html body:not(.admin-view):not(.merchant-view) .header-search-toggle,
html body:not(.admin-view):not(.merchant-view) .header-login-icon {
  display: inline-flex;
}

html body:not(.admin-view):not(.merchant-view) .header-account-btn img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

html body:not(.admin-view):not(.merchant-view) .bottom-cart-badge,
html body:not(.admin-view):not(.merchant-view) .header-fav span {
  position: absolute;
  top: 4px;
  inset-inline-end: 4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 99px;
  background: #66001f;
  color: #FBF7F0;
  font-size: 10px;
  line-height: 16px;
  text-align: center;
  font-weight: 700;
}

html body:not(.admin-view):not(.merchant-view) .header-account-btn,
html body:not(.admin-view):not(.merchant-view) .header-login-icon {
  cursor: pointer;
  z-index: 2;
}

html body:not(.admin-view):not(.merchant-view) .header-guest-login {
  position: relative;
  overflow: visible;
}

html body:not(.admin-view):not(.merchant-view) .account-panel {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 240;
  background: #FBF7F0;
  border-radius: 18px 18px 0 0;
  padding: 12px 12px calc(16px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -8px 32px rgba(49, 53, 44, 0.16);
  display: grid;
  gap: 4px;
}

html body:not(.admin-view):not(.merchant-view) .account-panel[hidden] {
  display: none;
}

html body:not(.admin-view):not(.merchant-view) .account-panel.is-open {
  display: grid;
}

html body:not(.admin-view):not(.merchant-view) .header-guest-login .guest-account-menu,
html body:not(.admin-view):not(.merchant-view) .header-guest-login .guest-account-menu.is-open {
  position: absolute;
  inset: auto;
  inset-inline-end: 0;
  top: calc(100% + 6px);
  bottom: auto;
  z-index: 260;
  width: min(220px, calc(100vw - 24px));
  padding: 8px;
  border-radius: 16px;
  border: 1px solid #E8D8BE;
  background: #FBF7F0;
  box-shadow: 0 12px 28px rgba(49, 53, 44, 0.14);
}

html body:not(.admin-view):not(.merchant-view) .account-panel a,
html body:not(.admin-view):not(.merchant-view) .account-panel button {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  background: transparent;
  color: #31352C;
  text-decoration: none;
  font: inherit;
  width: 100%;
  text-align: start;
  border-radius: 12px;
}

html body:not(.admin-view):not(.merchant-view) .account-hello {
  margin: 4px 12px 8px;
  font-weight: 700;
  color: #66001f;
}

html body:not(.admin-view):not(.merchant-view) .account-logout {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(49, 53, 44, 0.1);
}

html body:not(.admin-view):not(.merchant-view) .account-sheet-scrim {
  position: fixed;
  inset: 0;
  z-index: 230;
  background: rgba(49, 53, 44, 0.28);
}

html body:not(.admin-view):not(.merchant-view) .account-sheet-scrim[hidden] {
  display: none;
}

html body.has-bottom-nav:not(.admin-view):not(.merchant-view) {
  padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
}

html body:not(.admin-view):not(.merchant-view) .customer-bottom-nav {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 80;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  min-height: calc(56px + env(safe-area-inset-bottom, 0px));
  padding: 4px 4px calc(6px + env(safe-area-inset-bottom, 0px));
  background: #FBF7F0;
  border-top: 1px solid rgba(49, 53, 44, 0.08);
}

html body:not(.admin-view):not(.merchant-view) nav.bottom-nav.customer-bottom-nav[style] {
  grid-template-columns: repeat(var(--bn-count, 5), minmax(0, 1fr)) !important;
}

html body:not(.admin-view):not(.merchant-view) .customer-bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 44px;
  color: #31352C;
  text-decoration: none;
  font-size: 11px;
  font-weight: 600;
}

html body:not(.admin-view):not(.merchant-view) .customer-bottom-nav a.active {
  color: #66001f;
}

html body:not(.admin-view):not(.merchant-view) .bottom-cart-icon {
  position: relative;
  display: inline-flex;
}

html body.kb-open:not(.admin-view):not(.merchant-view) .customer-bottom-nav {
  transform: translateY(110%);
  pointer-events: none;
}

@media (max-width: 359px) {
  html body:not(.admin-view):not(.merchant-view) .libseh-mark img {
    height: 32px;
  }
}

html body:not(.admin-view):not(.merchant-view) .header-guest-auth {
  display: none;
}

html body:not(.admin-view):not(.merchant-view) .header-account-name {
  display: none;
  max-width: 9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 700;
  color: #31352C;
}

html body:not(.admin-view):not(.merchant-view) .mobile-site-menu .header-logout,
html body:not(.admin-view):not(.merchant-view) .mobile-menu-links a[href*="login"],
html body:not(.admin-view):not(.merchant-view) .mobile-menu-links a[href*="register"] {
  min-height: 44px;
}

html body.account-open:not(.admin-view):not(.merchant-view) .customer-bottom-nav {
  pointer-events: none;
}

@media (min-width: 1024px) {
  html body:not(.admin-view):not(.merchant-view) .libseh-header-inner {
    grid-template-columns: auto auto 1fr auto;
    min-height: 72px;
    width: min(100% - 32px, 1280px);
    gap: 12px;
  }

  html body:not(.admin-view):not(.merchant-view) .header-start {
    display: none;
  }

  html body:not(.admin-view):not(.merchant-view) .libseh-mark {
    grid-column: 1;
    justify-self: start;
    max-width: 180px;
  }

  html body:not(.admin-view):not(.merchant-view) .libseh-mark img {
    height: 42px;
    max-width: 180px;
  }

  html body:not(.admin-view):not(.merchant-view) .header-desktop-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    grid-column: 2;
    white-space: nowrap;
  }

  html body:not(.admin-view):not(.merchant-view) .header-desktop-nav a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 12px;
    color: #31352C;
    text-decoration: none;
    font-weight: 650;
  }

  html body:not(.admin-view):not(.merchant-view) .header-desktop-nav a.is-active,
  html body:not(.admin-view):not(.merchant-view) .header-desktop-nav a:hover {
    color: #66001f;
  }

  html body:not(.admin-view):not(.merchant-view) .header-end {
    grid-column: 4;
  }

  html body:not(.admin-view):not(.merchant-view) .header-fav-desktop,
  html body:not(.admin-view):not(.merchant-view) .header-search-toggle,
  html body:not(.admin-view):not(.merchant-view) .libseh-header .header-language-switcher,
  html body:not(.admin-view):not(.merchant-view) .libseh-header .language-switcher.header-language-switcher {
    display: inline-flex;
  }

  html body:not(.admin-view):not(.merchant-view) .customer-bottom-nav {
    display: none;
  }

  html body.has-bottom-nav:not(.admin-view):not(.merchant-view) {
    padding-bottom: 0;
  }

  html body:not(.admin-view):not(.merchant-view) .account-panel {
    position: fixed;
    inset: auto;
    inset-inline-end: 16px;
    top: calc(env(safe-area-inset-top, 0px) + 76px);
    width: min(280px, 86vw);
    border-radius: 16px;
    padding: 10px;
    box-shadow: 0 12px 32px rgba(49, 53, 44, 0.16);
  }

  html body:not(.admin-view):not(.merchant-view) .header-guest-login .guest-account-menu,
  html body:not(.admin-view):not(.merchant-view) .header-guest-login .guest-account-menu.is-open {
    position: absolute;
    inset: auto;
    inset-inline-end: 0;
    top: calc(100% + 8px);
    width: min(220px, 86vw);
  }

  html body:not(.admin-view):not(.merchant-view) .account-sheet-scrim {
    display: none;
  }

  html body:not(.admin-view):not(.merchant-view) .header-guest-auth {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  html body:not(.admin-view):not(.merchant-view) .header-login-link,
  html body:not(.admin-view):not(.merchant-view) .header-register-link {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0 14px;
    border-radius: 999px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
  }

  html body:not(.admin-view):not(.merchant-view) .header-login-link {
    background: #66001f;
    color: #FBF7F0;
  }

  html body:not(.admin-view):not(.merchant-view) .header-register-link {
    background: #E8D8BE;
    color: #31352C;
    border: 1px solid #59633A;
  }

  html body:not(.admin-view):not(.merchant-view) .header-account-btn {
    width: auto;
    padding-inline: 8px;
    gap: 8px;
  }

  html body:not(.admin-view):not(.merchant-view) .header-account-name {
    display: inline-block;
  }
}

html body .ui-ico {
  display: block;
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex: 0 0 auto;
  pointer-events: none;
}

html body:not(.admin-view):not(.merchant-view) .libseh-header .round-icon .ui-ico,
html body:not(.admin-view):not(.merchant-view) .header-login-icon .ui-ico {
  width: 28px;
  height: 28px;
}

html body:not(.admin-view):not(.merchant-view) .header-account-btn img.ui-ico {
  width: 28px;
  height: 28px;
  border-radius: 0;
  object-fit: contain;
}

html body:not(.admin-view):not(.merchant-view) .account-panel .ui-ico {
  width: 22px;
  height: 22px;
}

html body:not(.admin-view):not(.merchant-view) .customer-bottom-nav .ui-ico {
  width: 28px;
  height: 28px;
}

html body.has-bottom-nav:not(.admin-view):not(.merchant-view) .customer-bottom-nav a.bottom-cart-link span.bottom-cart-icon {
  width: 32px !important;
  height: 32px !important;
  min-width: 32px !important;
  min-height: 32px !important;
  max-width: 32px !important;
}

html body:not(.admin-view):not(.merchant-view) .overlay-search-form .ui-ico,
html body.stores-dir-page .stores-search .ui-ico {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
}

/* Phones/tablets: the tool group is wider than a centred 1fr column, so the
   logo takes the space left between the menu and the tools instead. */
@media (max-width: 1023px) {
  html body:not(.admin-view):not(.merchant-view) .libseh-header .libseh-header-inner {
    grid-template-columns: auto minmax(0, 1fr) auto !important;
    grid-template-areas: "menu brand tools" !important;
    gap: 4px !important;
    width: min(100% - 12px, 1180px) !important;
    padding-inline: 2px !important;
  }
  html body:not(.admin-view):not(.merchant-view) .libseh-header .header-start {
    grid-area: menu !important;
    grid-column: auto !important;
  }
  html body:not(.admin-view):not(.merchant-view) .libseh-header .libseh-mark {
    grid-area: brand !important;
    grid-column: auto !important;
    justify-self: center !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }
  html body:not(.admin-view):not(.merchant-view) .libseh-header .libseh-mark img {
    max-width: 100% !important;
    height: 38px !important;
    width: auto !important;
    object-fit: contain;
  }
  html body:not(.admin-view):not(.merchant-view) .libseh-header .header-end {
    grid-area: tools !important;
    grid-column: auto !important;
    min-width: 0;
  }
}

html body:not(.admin-view):not(.merchant-view) .libseh-header .libseh-mark {
  display: inline-flex !important;
  align-items: center;
  min-height: 44px;
}

html body:not(.admin-view):not(.merchant-view) .libseh-header details.language-switcher > summary.language-switcher-toggle {
  min-height: 44px !important;
}

@media (max-width: 389px) {
  html body:not(.admin-view):not(.merchant-view) .libseh-header .header-fav-desktop {
    display: none !important;
  }
  html body:not(.admin-view):not(.merchant-view) .libseh-header details.language-switcher > summary.language-switcher-toggle {
    padding: 6px 7px !important;
    gap: 3px !important;
  }
  html body:not(.admin-view):not(.merchant-view) .libseh-header .libseh-mark img {
    height: 34px !important;
  }
}

/* The side menu carries its own language switcher, so the header drops it on very narrow phones. */
@media (max-width: 359px) {
  html body:not(.admin-view):not(.merchant-view) .libseh-header .header-language-switcher {
    display: none !important;
  }
}
