.main-menu[data-header-mega] > ul > li {
    flex-basis: auto;
}

.main-menu [data-header-mega-item] {
    display: flex;
}

.main-menu [data-header-mega-item] > a {
    flex: 1;
    padding-inline: 8px 0;
}

.header-mega-toggle {
    background: transparent;
    border: 0;
    color: inherit;
    cursor: pointer;
    padding: 0 7px;
}

.header-mega-toggle svg {
    fill: none;
    height: 14px;
    stroke: currentColor;
    stroke-width: 2;
    width: 14px;
}

.header-mega-toggle[aria-expanded="true"] svg {
    transform: rotate(180deg);
}

.main-menu > ul > li.is-mega-open > :is(a, button),
.main-menu > ul > li:hover > .header-mega-toggle,
.main-menu > ul > li:focus-within > .header-mega-toggle {
    background: var(--color-brand);
    color: var(--color-black);
}

.main-menu .header-mega-panel {
    border-radius: 0;
    gap: 0;
    grid-template-columns: clamp(250px, 24vw, 320px) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    max-height: max(0px, calc(100dvh - var(--header-mega-top, 180px) - 16px));
    overflow: hidden;
    padding: 0;
}

[data-header-mega-ready] .has-mega:not(.is-mega-open) .header-mega-panel {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

[data-header-mega-ready] .is-mega-open .header-mega-panel {
    opacity: 1;
    pointer-events: auto;
    transform: none;
    transition-delay: 0s;
    visibility: visible;
}

.header-mega-rail {
    align-content: start;
    background: #f5f6f7;
    border-inline-end: 1px solid var(--color-border);
    display: grid;
    gap: 3px;
    padding: 12px;
}

.header-mega-choice {
    align-items: center;
    background: transparent;
    border: 0;
    border-radius: 6px;
    color: var(--color-text);
    cursor: pointer;
    display: grid;
    font: inherit;
    font-size: .875rem;
    font-weight: 680;
    gap: 8px;
    grid-template-columns: 31px minmax(0, 1fr) 10px;
    min-height: 38px;
    padding: 4px 8px;
    text-align: start;
    width: 100%;
}

.header-mega-choice:hover {
    background: var(--color-gray-100);
    text-decoration: none;
}

.header-mega-choice[aria-pressed="true"] {
    background: var(--color-brand-soft);
    box-shadow: inset 3px 0 var(--color-brand);
    color: #704b00;
}

.header-mega-choice .category-image {
    background: transparent;
    border: 0;
    height: 29px;
    width: 31px;
}

.header-mega-rail .header-mega-choice {
    font-size: 1rem;
    grid-template-columns: 44px minmax(0, 1fr) 10px;
    line-height: 1.25;
    min-height: 46px;
}

.header-mega-rail .category-image {
    height: 38px;
    width: 44px;
}

.header-mega-rail .category-image img {
    padding: 2px;
}

.header-mega-choice > span:last-child {
    color: var(--color-muted);
    justify-self: end;
}

.header-mega-content {
    align-content: start;
    display: grid;
    gap: 18px;
    grid-template-columns: minmax(0, 1fr);
    padding: 21px;
}

.header-mega-rail,
.header-mega-content {
    overflow-y: auto;
    overscroll-behavior-y: contain;
    scrollbar-gutter: stable;
}

[data-header-mega-content][hidden],
[data-header-mobile-level][hidden] {
    display: none;
}

.header-mega-content h2,
.header-mobile-level h2 {
    border-inline-start: 4px solid var(--color-brand);
    font-size: clamp(20px, 2.4vw, 29px);
    line-height: 1.16;
    margin: 0 0 13px;
    padding-inline-start: 10px;
}

.subcategory-grid.subcategory-grid--compact.header-mega-tiles {
    margin-block: 0 12px;
}

.header-mega-content .subcategory-grid.subcategory-grid--compact.header-mega-tiles {
    grid-template-columns: repeat(auto-fill, minmax(0, 256px));
    justify-content: start;
}

.header-mega-all {
    background: var(--color-brand);
    border-radius: 7px;
    color: var(--color-black);
    display: inline-flex;
    font-weight: 750;
    gap: 8px;
    padding: 9px 13px;
    text-decoration: none;
}

.header-mega-all:hover {
    background: var(--color-brand-hover);
    text-decoration: none;
}

.header-mobile-choices {
    display: grid;
    gap: 5px;
    margin-bottom: 12px;
}

.header-mobile-choices .header-mega-choice {
    background: var(--color-gray-50);
    border: 1px solid var(--color-border);
    min-height: 45px;
}

.header-mobile-back {
    background: transparent;
    border: 0;
    color: #704b00;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    margin-bottom: 7px;
    min-height: 44px;
    padding: 0 6px;
}

.mobile-category-panel .subcategory-grid.subcategory-grid--compact.header-mega-tiles {
    grid-template-columns: minmax(0, 1fr);
}

.mobile-category-panel .header-mega-tiles > .subcategory-card {
    font-size: 13px;
    grid-template-columns: minmax(0, 26%) minmax(0, 1fr) 9px;
    padding-inline: 8px;
}

.mobile-category-panel .header-mega-all {
    justify-content: center;
    min-height: 44px;
    width: 100%;
}

.header-mega-products {
    border-top: 1px solid var(--color-border);
    grid-column: 1 / -1;
    margin-top: 2px;
    padding-top: 12px;
}

.mobile-category-panel .header-mega-products {
    margin-top: 14px;
}

.header-mega-products h3 {
    font-size: .9rem;
    margin: 0 0 8px;
}

.header-mega-product-status,
.header-mega-product-more {
    font-size: .8125rem;
    margin: 10px 0 0;
    overflow-anchor: none;
}

.header-mega-product-status:not([hidden]) {
    align-items: center;
    color: var(--color-muted);
    display: flex;
    gap: 8px;
    min-height: 28px;
}

.header-mega-product-status[data-loading]::before {
    animation: header-mega-product-spin .8s linear infinite;
    border: 2px solid var(--color-border);
    border-radius: 50%;
    border-top-color: var(--color-brand);
    content: "";
    height: 14px;
    width: 14px;
}

@keyframes header-mega-product-spin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .header-mega-product-status[data-loading]::before {
        animation: none;
    }
}

.header-mega-product-more {
    background: var(--color-gray-50);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    color: var(--color-text);
    cursor: pointer;
    min-height: 36px;
    padding: 6px 12px;
}

.header-mega-product-more[aria-disabled="true"] {
    cursor: wait;
}

.header-mega-product-list {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 180px), 1fr));
    list-style: none;
    margin: 0;
    padding: 0;
}

.header-mega-product {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    color: var(--color-text);
    display: grid;
    gap: 4px;
    grid-template-rows: 106px 1fr auto;
    height: 100%;
    min-width: 0;
    padding: 5px;
}

.header-mega-product:hover {
    border-color: #c5ccd3;
    text-decoration: none;
}

.header-mega-product-photo {
    align-items: center;
    background: linear-gradient(155deg, #f8f9fa, #eceef0);
    border-radius: 6px;
    color: var(--color-muted);
    display: flex;
    isolation: isolate;
    justify-content: center;
    overflow: hidden;
}

.header-mega-product-photo img {
    height: 100%;
    mix-blend-mode: multiply;
    object-fit: contain;
    width: 100%;
}

.header-mega-product-name {
    font-size: .8125rem;
    font-weight: 700;
    line-height: 1.28;
    overflow-wrap: anywhere;
    padding-inline: 3px;
}

.header-mega-product .price-stack {
    margin: 0 3px;
}

.header-mega-product .price-stack .price-current {
    font-size: .875rem;
}

.header-mega-product .price-stack :is(.price-original, .price-without-vat, .b2b-price-note) {
    font-size: .6875rem;
}

.mobile-category-panel .header-mega-product-list {
    grid-template-columns: minmax(0, 1fr);
    justify-content: stretch;
}

.mobile-category-panel .header-mega-product {
    align-items: center;
    gap: 2px 6px;
    grid-template-columns: 66px minmax(0, 1fr);
    grid-template-rows: auto auto;
}

.mobile-category-panel .header-mega-product-photo {
    grid-row: 1 / -1;
    height: 58px;
}
