/* Keep the storefront controls above account actions on narrow screens. */
@media (max-width: 1024px) {
  /* Keep this independent of page-specific :has() rules and their order values. */
  .market-header-inner {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 8px 9px !important;
  }

  .market-header-inner > .market-brand {
    order: 0 !important;
    flex: 0 0 100% !important;
    width: 100%;
    min-width: 0;
  }

  .market-header-inner > .market-catalog-trigger {
    order: 1 !important;
    flex: 0 0 auto !important;
    min-width: 0;
    white-space: nowrap;
  }

  .market-header-inner > .market-header-search {
    order: 2 !important;
    flex: 1 1 0 !important;
    width: auto;
    min-width: 0;
    max-width: none;
  }

  .market-header-inner > .market-header-actions {
    order: 3 !important;
    flex: 0 0 100% !important;
    width: 100%;
    min-width: 0;
  }

  body:has(.market-home) .market-header-actions .ui-account {
    min-width: 0;
    max-width: min(48vw, 220px);
  }

  body:has(.market-home) .market-header-actions .ui-account-trigger {
    max-width: 100%;
    min-width: 0;
  }

  .market-header-actions .ui-account {
    min-width: 0;
    max-width: min(48vw, 220px);
  }

  .market-header-actions .ui-account-trigger {
    max-width: 100%;
    min-width: 0;
  }
}

/* Long account names must shrink or wrap inside their own layout. */
.ui-account,
.ui-account-trigger,
.ui-account-name,
.ui-account-caption,
.headrow,
.seller-topbar,
.seller-topbar-actions,
.seller-page-heading,
.seller-welcome,
.buyer-account-head,
.product-seller,
.product-seller span,
.seller,
.seller b,
.seller-page-heading > *,
.seller-welcome > *,
.buyer-account-head > * {
  min-width: 0;
  max-width: 100%;
}

.ui-account-trigger,
.ui-account-name {
  max-width: 100%;
}

.ui-account-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ui-account-caption,
.seller-page-heading,
.seller-welcome,
.buyer-account-head,
.product-seller span,
.product-seller,
.seller,
.chatitem b {
  overflow-wrap: anywhere;
  word-break: normal;
}

@media (max-width: 760px) {
  .headrow {
    gap: 8px;
  }

  .headrow > .brand,
  .headrow > .head-spacer {
    min-width: 0;
  }

  .headrow .ui-account {
    flex: 0 1 auto;
    max-width: min(52vw, 240px);
  }

  .headrow .ui-account-trigger {
    max-width: 100%;
  }

  .seller-page-heading,
  .seller-welcome,
  .buyer-account-head {
    flex-wrap: wrap;
  }

  .seller-dashboard-reference .seller-topbar .ui-account-name {
    max-width: 100%;
  }

  .buyer-account-head strong {
    display: block;
    max-width: 100%;
    overflow-wrap: anywhere;
  }
}

/* Compact, balanced storefront header on phones only. */
@media (max-width: 760px) {
  body:has(.market-header-inner) .market-header-inner {
    width: calc(100% - 24px) !important;
    max-width: none !important;
    min-height: 0 !important;
    padding: 10px 0 !important;
    gap: 8px 7px !important;
  }

  body:has(.market-header-inner) .market-brand {
    flex-basis: 100% !important;
    gap: 9px !important;
    font-size: 20px !important;
    line-height: 1.1;
  }

  body:has(.market-header-inner) .market-brand .brand-logo {
    width: 38px !important;
    height: 38px !important;
    border-radius: 10px;
  }

  body:has(.market-header-inner) .market-header-actions {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    flex-wrap: nowrap !important;
    gap: 3px !important;
    margin: 0 !important;
    padding: 2px 0 0;
  }

  body:has(.market-header-inner) .market-header-actions > .market-header-action {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 1 1 0 !important;
    min-width: 0 !important;
    width: auto !important;
    height: 46px !important;
    padding: 3px 1px !important;
    border: 1px solid transparent !important;
    border-radius: 9px !important;
    font-size: 8px !important;
    line-height: 1.1 !important;
  }

  body:has(.market-header-inner) .market-header-actions > .market-header-action span {
    display: block !important;
    max-width: 100%;
    overflow: hidden;
    font-size: 8px !important;
    line-height: 1.1;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body:has(.market-header-inner) .market-header-actions > .market-header-action svg {
    width: 20px !important;
    height: 20px !important;
  }

  body:has(.market-header-inner) .market-header-actions .ui-account {
    flex: 0 1 92px !important;
    width: 92px;
    max-width: 92px !important;
  }

  body:has(.market-header-inner) .market-header-actions .ui-account-trigger {
    display: flex !important;
    width: 100%;
    min-height: 38px !important;
    height: 38px !important;
    justify-content: center;
    gap: 3px !important;
    padding: 3px 5px !important;
    font-size: 10px !important;
  }

  body:has(.market-header-inner) .market-header-actions .ui-account-name {
    max-width: 68px !important;
    font-size: 10px !important;
  }

  body:has(.market-header-inner) .market-header-actions .ui-account-trigger > svg {
    flex: 0 0 12px;
    width: 12px !important;
    height: 12px !important;
  }

  body:has(.market-header-inner) .market-header-actions .auth-actions {
    display: flex !important;
    flex: 0 1 auto !important;
    align-items: center;
    gap: 4px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
  }

  body:has(.market-header-inner) .market-header-actions .auth-actions button {
    min-height: 36px !important;
    padding: 0 8px !important;
    border-radius: 8px !important;
    font-size: 9px !important;
    white-space: nowrap;
  }

  body:has(.market-header-inner) .market-catalog-trigger {
    height: 40px !important;
    min-height: 40px !important;
    gap: 7px !important;
    padding: 0 11px !important;
    border-radius: 9px !important;
    font-size: 12px !important;
  }

  body:has(.market-header-inner) .market-catalog-trigger svg {
    width: 16px !important;
    height: 16px !important;
  }

  body:has(.market-header-inner) .market-header-search {
    height: 40px !important;
    min-height: 40px !important;
    border-radius: 9px !important;
  }

  body:has(.market-header-inner) .market-search-icon {
    padding: 0 7px 0 10px !important;
  }

  body:has(.market-header-inner) #market-header-search {
    min-width: 0;
    font-size: 11px !important;
  }
}

@media (max-width: 360px) {
  body:has(.market-header-inner) .market-header-actions > .market-header-action span {
    font-size: 7px !important;
  }

  body:has(.market-header-inner) .market-header-actions .ui-account {
    flex-basis: 78px !important;
    width: 78px;
    max-width: 78px !important;
  }

  body:has(.market-header-inner) .market-header-actions .ui-account-name {
    max-width: 56px !important;
  }

  body:has(.market-header-inner) .market-header-actions .auth-actions button {
    padding-inline: 6px !important;
    font-size: 8px !important;
  }
}

/* Account dropdowns must escape the finance header's horizontal clipping. */
body:has(.market-header) .header.market-header {
  position: relative !important;
  z-index: 1000 !important;
  overflow: visible !important;
}

body:has(.market-header) .market-header-inner,
body:has(.market-header) .market-header-actions {
  overflow: visible !important;
}

body:has(.market-header) .market-header-actions .ui-account {
  z-index: 1001 !important;
}

body:has(.market-header) .market-header-actions .ui-account-menu {
  z-index: 1002 !important;
}


/* Match the product and checkout canvas to the storefront's warm dark background. */
body.ui-unified[data-theme="dark"]:is(:has(.pp-page),:has(.pp-checkout)){
  background-color:#111211!important;
  background-image:radial-gradient(ellipse 70% 430px at 54% -5%,#3a2917 0%,#201911 36%,transparent 76%),linear-gradient(180deg,#171715 0%,#121312 460px,#101111 100%)!important;
}
