.page-products #main {
    min-height: 500px;
    width: 100% !important;
}

.page-products #content .browse-wrap {
    display: flex;
    align-items: flex-start;
    width: 100%;
    max-width: 100%;
}

.page-products #content .browse-wrap .browse-left {
    flex: 0 0 300px;
    width: 300px;
    max-width: 300px;
    padding: 0;
    box-sizing: border-box;
}

.page-products #content .browse-wrap .browse-right {
    order: 2;
    flex: 0 0 calc(100% - 300px);
    min-width: 0;
    width: auto;
    max-width: calc(100% - 300px);
    padding: 10px 0;
    margin: 0;
}

.page-products #content .product-category-sidebar-wrap {
    width: 300px;
    max-width: 100%;
}

.page-products #content.office-browse #tools .facets {
    border: 0;
    border-top: 0;
    background: transparent;
    background-color: transparent;
    padding: 0 10px;
}

.page-products #linky.product-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    column-gap: 10px;
    row-gap: 10px;
    width: 100%;
    max-width: 100%;
}

.page-products #linky.product-grid.loading > div,
.page-products #linky.product-grid > p {
    grid-column: 1 / -1;
}

.page-products .product-grid-item {
    width: 100%;
    min-width: 0;
    height: auto;
    margin-bottom: 0;
    overflow: hidden;
    position: relative;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    break-inside: avoid-column;
    page-break-inside: avoid;
}

.page-products .product-grid-item .product-gradient {
    display: none;
    position: relative;
    inset: 0;
    border-radius: 8px;
    background: rgba(0, 0, 0, .4);
}

.page-products .product-grid-item .product-image {
    aspect-ratio: 1 / 1;
    height: auto !important;
}

.page-products .product-grid-item .product-image > div {
    height: 100% !important;
    margin-bottom: 0 !important;
}

.page-products .product-grid-item img {
    width: 100%;
    display: block;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

.page-products .product-grid-item a:hover {
    text-decoration: none;
}

.page-products .product-grid-item.product-light-theme .product-content {
    position: relative;
    bottom: 0;
    padding: 10px 15px;
    color: #333;
    width: 100%;
    background-color: #fff;
    border-bottom-right-radius: 8px;
    border-bottom-left-radius: 8px;
}

.page-products .product-grid-item.product-overlay-theme .product-content {
    position: relative;
    bottom: 0;
    padding: 20px;
    color: #fff;
    width: 100%;
}

.page-products .product-grid-item.product-overlay-theme .product-title {
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.page-products .product-grid-item.product-overlay-theme .product-brand {
    color: #fff;
    font-size: 12px;
}

.page-products .product-grid-item .product-title {
    color: #333;
    display: block;
    font-weight: 700;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.page-products .product-grid-item .product-title:hover {
    color: #438bca;
    text-decoration: underline;
}

.page-products .product-grid-item .product-brand {
    color: #438bca;
    display: block;
    font-weight: 600;
}

.page-products .product-grid-item .product-brand:hover {
    text-decoration: underline;
}

.page-products .product-grid-item .product-image:hover {
    opacity: .9;
}

.page-products #content.office-browse #tools .facets .term {
    display: flex !important;
    align-items: center !important;
    gap: 10px;
    padding: 3px 8px !important;
    margin: 0 !important;
    border: 1px solid transparent !important;
    border-radius: 8px !important;
    color: #333 !important;
    font-size: 14px !important;
    font-weight: 400 !important;
    line-height: 1.25 !important;
    box-sizing: border-box;
}

.page-products #content.office-browse #tools .facets .term.product-parent-term-after-children {
    margin-top: 8px !important;
}

.page-products #content.office-browse #tools h4 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 8px 6px 8px !important;
    margin: 0;
    color: #333;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0;
    text-transform: none;
}

.page-products #content.office-browse #tools h4:first-child {
    padding-top: 0 !important;
}

.page-products #content.office-browse #tools .facets .term:hover {
    background: rgba(255, 255, 255, .55) !important;
    color: #333 !important;
    text-decoration: none !important;
}

.page-products #content.office-browse #tools .facets .term.selected-item {
    border-color: #d4d4d8 !important;
    background: rgba(255, 255, 255, .78) !important;
    color: #333 !important;
    font-weight: 400 !important;
    line-height: 1.25 !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .04) !important;
}

.page-products #content.office-browse #tools .facets input.os-facet,
.page-products #content.office-browse #tools .facets input.osep-facet {
    -webkit-appearance: none;
    appearance: none;
    display: inline-grid;
    place-content: center;
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    margin: 0;
    border: 1px solid #a1a1aa;
    border-radius: 5px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
    vertical-align: middle;
}

.page-products #content.office-browse #tools .facets input.os-facet:hover,
.page-products #content.office-browse #tools .facets input.osep-facet:hover {
    border-color: #333;
}

.page-products #content.office-browse #tools .facets input.os-facet:focus-visible,
.page-products #content.office-browse #tools .facets input.osep-facet:focus-visible {
    outline: none;
    border-color: #333;
    box-shadow: 0 0 0 3px rgba(51, 51, 51, .14);
}

.page-products #content.office-browse #tools .facets input.os-facet:checked,
.page-products #content.office-browse #tools .facets input.osep-facet:checked {
    border-color: #333;
    background-color: #333;
    background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M3.5 8.25 6.5 11 12.5 5' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e");
    background-position: center;
    background-repeat: no-repeat;
    background-size: 14px 14px;
}

.page-products #content.office-browse #tools .facets .term label {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1 1 auto;
    min-width: 0;
    color: #333;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.25;
    cursor: pointer;
}

.page-products #content.office-browse #tools .facets .term-name {
    flex: 1 1 auto;
    min-width: 0;
}

.page-products #content.office-browse #tools .facets .term .term-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    min-width: 36px;
    padding: 3px 6px;
    border-radius: 999px;
    background: #f1f1f1;
    color: #333;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    text-align: center;
}

.page-products #content.office-browse #tools .facets .product-parent-term-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    min-width: 36px;
    padding: 3px 6px;
    border-radius: 999px;
    background: #f1f1f1;
    color: #333;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    text-align: center;
}

@media (max-width: 1200px) {
    .page-products #linky.product-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .page-products #linky.product-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 700px) {
    .page-products #linky.product-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 520px) {
    .page-products #content .browse-wrap {
        display: block;
    }

    .page-products #content .browse-wrap .browse-left,
    .page-products #content .browse-wrap .browse-right {
        width: 100%;
        max-width: 100%;
    }

    .page-products #linky.product-grid {
        grid-template-columns: 1fr;
    }
}

.single-brands .brand-tabs {
    box-sizing: border-box;
    width: auto;
}

.single.single-brands .brand-tabs button.tablinks,
.single.single-brands .brand-tabs a.tablinks {
    cursor: pointer;
}

.single.single-brands .brand-tabs button.tablinks:hover,
.single.single-brands .brand-tabs a.tablinks:hover,
.single.single-brands .brand-tabs button.tablinks:focus-visible,
.single.single-brands .brand-tabs a.tablinks:focus-visible {
    cursor: pointer;
    border-bottom: 2px solid #438bca !important;
    color: #333 !important;
    font-weight: 600;
    text-decoration: none;
}

.single-brands #content.profile.brand .product-gallery.brand-gallery.profile-gallery .gallery-item-wrap {
    box-sizing: border-box;
}

@media only screen and (max-device-width: 480px) {
    .single-brands #content.profile.brand .product-gallery.brand-gallery.profile-gallery .gallery-item-wrap {
        width: calc(100% - 40px);
    }
}

/* Brand profile product gallery pagination — same .osep-pager chrome as /products/
   (styled by osep-facet facet.css). Full-width so it is not crushed by the brand card grid. */
.single-brands #content.profile.brand #products-tab .osep-pager-wrap,
.single-brands #content.profile.brand #products-tab .brand-products-pager-wrap {
  grid-column: 1 / -1;
  text-align: center;
  margin-top: 30px;
  clear: both;
  width: 100%;
  max-width: none;
  float: none;
}
.single-brands #content.profile.brand #products-tab .osep-pager:empty,
.single-brands #content.profile.brand #products-tab #product-pager:empty,
.single-brands #content.profile.brand #products-tab #brand-product-pager:empty {
  display: none;
}
.brand-products-status {
  grid-column: 1 / -1;
  margin: 8px 0 0;
  font-size: 13px;
  color: #666;
  min-height: 1.2em;
  text-align: center;
  width: 100%;
}
/* Empty/error messages span the full products-tab grid. */
.single-brands #content.profile.brand #products-tab .brand-products-grid > .brand-products-empty,
.single-brands #content.profile.brand #products-tab .brand-products-grid > p {
  grid-column: 1 / -1;
}
/* Cards participate in the parent tab grid; pager stays a full-row sibling. */
.brand-products-grid {
  display: contents;
}

/*
 * Brand gallery fetch: keep cards visible at ~30% opacity; spinner is an
 * absolute overlay so it does not participate in the CSS grid / push cards.
 */
.single-brands #content.profile.brand #products-tab.is-fetching-products {
  position: relative;
}
.single-brands #content.profile.brand #products-tab.is-fetching-products .gallery-item-wrap,
.single-brands #content.profile.brand #products-tab.is-fetching-products .brand-products-empty {
  opacity: 0.3;
  pointer-events: none;
  transition: opacity 0.15s ease;
}
.single-brands #content.profile.brand #products-tab .brand-products-loading-overlay {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 10;
  /* Not a flex-centered full-height middle — JS parks .loading-spinner on first row. */
  display: block;
  pointer-events: none;
  /* Out of flow — must not use grid-column/row or it will push cards down. */
  margin: 0;
  padding: 0;
  border: 0;
}
.single-brands #content.profile.brand #products-tab .brand-products-loading-overlay .loading-spinner {
  position: absolute;
  left: 50%;
  top: 120px; /* fallback before JS measures first .gallery-item-wrap */
  transform: translate(-50%, -50%);
  border: 4px solid #f3f3f3;
  border-top: 4px solid #3498db;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  animation: brand-products-spin-loading 1s linear infinite;
}
@keyframes brand-products-spin-loading {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
