/*
 * MASTERBAR UI 0.3.0 – listing produktów
 *
 * Założenie: proste, lekkie karty bez ciężkich efektów i bez JS.
 */

.masterbar-shop-archive .site-main,
.post-type-archive-product .site-main,
.tax-product_cat .site-main,
.tax-product_brand .site-main {
    width: 100%;
}

/* Górna część archiwum */
.woocommerce .woocommerce-result-count {
    color: var(--masterbar-muted);
    font-size: 14px;
}

.woocommerce .woocommerce-ordering select {
    min-height: 42px;
    padding: 0 42px 0 14px;
    border: 1px solid var(--masterbar-border);
    border-radius: 8px;
    background-color: #fff;
    color: var(--masterbar-text);
    font-size: 14px;
    box-shadow: none;
}

/* Siatka */
.woocommerce ul.products {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 22px;
    margin-top: 28px;
}

.woocommerce ul.products::before,
.woocommerce ul.products::after {
    display: none;
}

.woocommerce ul.products li.product {
    position: relative;
    display: flex;
    flex-direction: column;
    width: auto !important;
    min-width: 0;
    margin: 0 !important;
    padding: 16px;
    border: 1px solid var(--masterbar-card-border);
    border-radius: var(--masterbar-card-radius);
    background: var(--masterbar-card-bg);
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}

.woocommerce ul.products li.product:hover {
    transform: translateY(-2px);
    border-color: color-mix(in srgb, var(--masterbar-card-border) 55%, var(--masterbar-primary));
    box-shadow: 0 10px 30px rgba(15, 23, 42, .07);
}

/* Link produktowy */
.woocommerce ul.products li.product .woocommerce-LoopProduct-link {
    display: flex;
    flex: 1;
    flex-direction: column;
    color: inherit;
    text-decoration: none;
}

/* Obraz */
.woocommerce ul.products li.product a img {
    width: 100%;
    height: var(--masterbar-card-image-height);
    margin: 0 0 14px;
    object-fit: contain;
    object-position: center;
    background: #fff;
    transition: transform .15s ease;
}

.woocommerce ul.products li.product:hover a img {
    transform: scale(1.015);
}

/* Badge promocji */
.woocommerce span.onsale {
    top: 12px !important;
    left: 12px !important;
    right: auto !important;
    min-width: 0;
    min-height: 0;
    margin: 0 !important;
    padding: 6px 9px;
    border-radius: 999px;
    background: #fff;
    color: var(--masterbar-card-sale);
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    box-shadow: 0 3px 12px rgba(15, 23, 42, .10);
}

/* Marka i tytuł */
.masterbar-loop-brand {
    margin-bottom: 5px;
    color: var(--masterbar-card-muted);
    font-size: 12px;
    line-height: 1.25;
}

.woocommerce ul.products li.product .woocommerce-loop-product__title {
    min-height: 44px;
    margin: 0;
    padding: 0 !important;
    color: var(--masterbar-card-title);
    font-size: 15px !important;
    font-weight: 650;
    line-height: 1.4;
}

/* Cena */
.woocommerce ul.products li.product .price {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 7px;
    min-height: 28px;
    margin: 10px 0 0;
    color: var(--masterbar-card-price) !important;
    font-size: 18px !important;
    font-weight: 750;
    line-height: 1.2;
}

.woocommerce ul.products li.product .price del {
    color: var(--masterbar-card-muted);
    font-size: 13px;
    font-weight: 500;
    opacity: .8;
}

.woocommerce ul.products li.product .price ins {
    color: var(--masterbar-card-sale);
    font-size: inherit;
    font-weight: inherit;
    text-decoration: none;
}

/* Dostępność */
.masterbar-loop-stock {
    min-height: 20px;
    margin-top: 7px;
    font-size: 12px;
    font-weight: 650;
    line-height: 1.3;
}

.masterbar-loop-stock.is-in-stock {
    color: var(--masterbar-stock-in);
}

.masterbar-loop-stock.is-low-stock {
    color: var(--masterbar-stock-low);
}

.masterbar-loop-stock.is-out-of-stock {
    color: var(--masterbar-stock-out);
}

/* Przycisk */
.woocommerce ul.products li.product .button {
    width: 100%;
    margin-top: 14px;
    padding: 11px 14px;
    border: 1px solid var(--masterbar-card-button-bg);
    border-radius: 8px;
    background: var(--masterbar-card-button-bg);
    color: var(--masterbar-card-button-text);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    box-shadow: none;
}

.woocommerce ul.products li.product .button:hover,
.woocommerce ul.products li.product .button:focus {
    filter: brightness(.95);
    color: var(--masterbar-card-button-text);
}

/* AJAX icon / komunikat */
.woocommerce ul.products li.product .added_to_cart {
    margin-top: 8px;
    color: var(--masterbar-primary);
    font-size: 13px;
    font-weight: 650;
    text-align: center;
}

/* Responsywność */
@media (max-width: 1120px) {
    .woocommerce ul.products {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .woocommerce ul.products {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px;
    }

    .woocommerce ul.products li.product {
        padding: 12px;
    }

    .woocommerce ul.products li.product a img {
        height: min(var(--masterbar-card-image-height), 220px);
    }

    .woocommerce ul.products li.product .woocommerce-loop-product__title {
        min-height: 40px;
        font-size: 14px !important;
    }

    .woocommerce ul.products li.product .price {
        font-size: 16px !important;
    }
}

@media (max-width: 430px) {
    .woocommerce ul.products {
        gap: 10px;
    }

    .woocommerce ul.products li.product {
        padding: 10px;
        border-radius: 8px;
    }

    .woocommerce ul.products li.product a img {
        height: 180px;
    }

    .masterbar-loop-brand {
        font-size: 11px;
    }

    .woocommerce ul.products li.product .button {
        padding: 10px 8px;
        font-size: 13px;
    }
}


/* ==========================================================
   0.4.5 – mobile: zawsze 2 produkty w rzędzie
   ========================================================== */

@media (max-width: 760px) {
    body.woocommerce ul.products,
    body.woocommerce-page ul.products,
    .woocommerce ul.products,
    .woocommerce-page ul.products {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 12px !important;
    }

    body.woocommerce ul.products li.product,
    body.woocommerce-page ul.products li.product,
    .woocommerce ul.products li.product,
    .woocommerce-page ul.products li.product {
        width: auto !important;
        max-width: none !important;
        float: none !important;
        margin: 0 !important;
    }
}

@media (max-width: 420px) {
    body.woocommerce ul.products,
    body.woocommerce-page ul.products,
    .woocommerce ul.products,
    .woocommerce-page ul.products {
        gap: 9px !important;
    }

    .woocommerce ul.products li.product {
        padding: 9px !important;
    }

    .woocommerce ul.products li.product a img {
        height: 160px !important;
    }

    .woocommerce ul.products li.product .woocommerce-loop-product__title {
        font-size: 13px !important;
        line-height: 1.35 !important;
    }

    .woocommerce ul.products li.product .price {
        font-size: 15px !important;
    }

    .woocommerce ul.products li.product .button {
        font-size: 12px !important;
        padding: 10px 6px !important;
    }
}


/* ==========================================================
   MASTERBAR UI 0.4.5
   WooCommerce mobile grid – 2 columns
   ========================================================== */
@media (max-width: 767px) {
    body.woocommerce ul.products,
    body.woocommerce-page ul.products,
    body.archive.woocommerce ul.products,
    .woocommerce ul.products[class*="columns-"] {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        column-gap: 10px !important;
        row-gap: 12px !important;
    }

    body.woocommerce ul.products::before,
    body.woocommerce ul.products::after,
    body.woocommerce-page ul.products::before,
    body.woocommerce-page ul.products::after {
        display: none !important;
        content: none !important;
    }

    body.woocommerce ul.products li.product,
    body.woocommerce-page ul.products li.product,
    .woocommerce ul.products[class*="columns-"] li.product {
        width: 100% !important;
        min-width: 0 !important;
        float: none !important;
        clear: none !important;
        margin: 0 !important;
    }
}


/* ==========================================================
   MASTERBAR UI 0.4.5 – kliknięcie produktu na mobile
   ========================================================== */

.woocommerce ul.products li.product {
    isolation: isolate;
}

.woocommerce ul.products li.product .woocommerce-LoopProduct-link,
.woocommerce ul.products li.product .woocommerce-loop-product__link {
    position: relative !important;
    z-index: 2 !important;
    pointer-events: auto !important;
    touch-action: manipulation;
}

.woocommerce ul.products li.product .woocommerce-LoopProduct-link img,
.woocommerce ul.products li.product .woocommerce-loop-product__link img,
.woocommerce ul.products li.product .woocommerce-loop-product__title {
    pointer-events: auto !important;
}

.woocommerce ul.products li.product .button,
.woocommerce ul.products li.product .added_to_cart {
    position: relative !important;
    z-index: 3 !important;
    pointer-events: auto !important;
    touch-action: manipulation;
}


/* ==========================================================
   MASTERBAR UI 0.4.5
   Link produktu – bez sztucznych warstw i bez przechwytywania
   ========================================================== */

@media (max-width: 920px) {
    .woocommerce ul.products li.product,
    .woocommerce ul.products li.product * {
        -webkit-tap-highlight-color: rgba(0,0,0,0);
    }

    .woocommerce ul.products li.product a.woocommerce-LoopProduct-link,
    .woocommerce ul.products li.product a.woocommerce-loop-product__link {
        position: relative !important;
        z-index: 2 !important;
        display: block !important;
        pointer-events: auto !important;
        touch-action: manipulation !important;
    }

    .woocommerce ul.products li.product .button,
    .woocommerce ul.products li.product .added_to_cart {
        position: relative !important;
        z-index: 3 !important;
        pointer-events: auto !important;
    }
}

/* ==========================================================
   MASTERBAR UI 0.5.2 – archiwum / kategorie produktów
   ========================================================== */
.masterbar-shop-archive .ast-container,
.masterbar-shop-archive .site-content > .ast-container {
    max-width: var(--masterbar-content-width, 1500px);
}

.masterbar-shop-archive .woocommerce-products-header {
    margin: 34px 0 18px;
}

.masterbar-shop-archive .woocommerce-breadcrumb {
    margin-bottom: 14px;
    color: var(--masterbar-muted);
    font-size: 12px;
}

.masterbar-shop-archive .woocommerce-products-header__title.page-title {
    margin: 0;
    color: var(--masterbar-text);
    font-size: clamp(28px, 2.3vw, 38px);
    font-weight: 750;
    line-height: 1.15;
}

.masterbar-shop-archive .term-description {
    max-width: 900px;
    margin-top: 12px;
    color: var(--masterbar-muted);
    font-size: 15px;
    line-height: 1.65;
}

.masterbar-archive-subcats {
    margin: 8px 0 30px;
}

.masterbar-archive-subcats__grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.masterbar-archive-subcat {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    grid-template-rows: auto auto;
    column-gap: 14px;
    align-items: center;
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--masterbar-card-border);
    border-radius: 12px;
    background: #fff;
    color: var(--masterbar-text);
    text-decoration: none !important;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}

.masterbar-archive-subcat:hover {
    transform: translateY(-2px);
    border-color: color-mix(in srgb, var(--masterbar-card-border) 55%, var(--masterbar-primary));
    box-shadow: 0 8px 24px rgba(15, 23, 42, .06);
}

.masterbar-archive-subcat__media {
    grid-row: 1 / span 2;
    display: grid;
    place-items: center;
    width: 92px;
    height: 76px;
    overflow: hidden;
    border-radius: 8px;
    background: #f6f8fb;
}

.masterbar-archive-subcat__media img {
    width: 100%;
    height: 100%;
    margin: 0 !important;
    object-fit: contain;
}

.masterbar-archive-subcat__letter {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #fff;
    color: var(--masterbar-primary);
    font-size: 20px;
    font-weight: 800;
    box-shadow: 0 3px 12px rgba(15,23,42,.08);
}

.masterbar-archive-subcat__name {
    align-self: end;
    font-size: 15px;
    font-weight: 750;
    line-height: 1.25;
}

.masterbar-archive-subcat__link {
    align-self: start;
    margin-top: 5px;
    color: var(--masterbar-primary);
    font-size: 12px;
    font-weight: 700;
}

.masterbar-shop-archive .woocommerce-notices-wrapper + .woocommerce-result-count,
.masterbar-shop-archive .woocommerce-result-count {
    margin: 10px 0 18px;
}

.masterbar-shop-archive .woocommerce-ordering {
    margin: 0 0 18px;
}

.masterbar-shop-archive .woocommerce-result-count,
.masterbar-shop-archive .woocommerce-ordering {
    line-height: 42px;
}

.masterbar-shop-archive .woocommerce-pagination {
    margin-top: 34px;
}

.masterbar-shop-archive .woocommerce-pagination ul.page-numbers {
    display: flex;
    justify-content: center;
    gap: 7px;
    border: 0;
}

.masterbar-shop-archive .woocommerce-pagination ul.page-numbers li {
    border: 0;
}

.masterbar-shop-archive .woocommerce-pagination .page-numbers li a,
.masterbar-shop-archive .woocommerce-pagination .page-numbers li span {
    display: grid;
    place-items: center;
    min-width: 40px;
    height: 40px;
    padding: 0 10px;
    border: 1px solid var(--masterbar-border);
    border-radius: 8px;
    background: #fff;
}

.masterbar-shop-archive .woocommerce-pagination .page-numbers li span.current {
    border-color: var(--masterbar-primary);
    background: var(--masterbar-primary);
    color: #fff;
}

@media (max-width: 1120px) {
    .masterbar-archive-subcats__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
    .masterbar-shop-archive .woocommerce-products-header { margin-top: 22px; }
    .masterbar-shop-archive .woocommerce-products-header__title.page-title { font-size: 27px; }
    .masterbar-shop-archive .term-description { font-size: 14px; }
    .masterbar-archive-subcats { margin-bottom: 22px; }
    .masterbar-archive-subcats__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .masterbar-archive-subcat { display: flex; flex-direction: column; align-items: stretch; padding: 9px; }
    .masterbar-archive-subcat__media { width: 100%; height: 120px; }
    .masterbar-archive-subcat__name { margin-top: 9px; font-size: 13px; }
    .masterbar-archive-subcat__link { font-size: 11px; }
    .masterbar-shop-archive .woocommerce-result-count { float: none; margin: 0 0 8px; line-height: 1.4; }
    .masterbar-shop-archive .woocommerce-ordering { float: none; width: 100%; margin: 0 0 18px; line-height: 1; }
    .masterbar-shop-archive .woocommerce-ordering select { width: 100%; }
}

/* ==========================================================
   MASTERBAR UI 0.5.3 – lekkie filtry produktów
   ========================================================== */

.masterbar-shop-archive .woocommerce,
.post-type-archive-product .woocommerce,
.tax-product_cat .woocommerce,
.tax-product_brand .woocommerce {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    column-gap: 28px;
    align-items: start;
}

.masterbar-archive-subcats,
.masterbar-filter-toolbar,
.masterbar-shop-archive .woocommerce-notices-wrapper,
.post-type-archive-product .woocommerce-notices-wrapper,
.tax-product_cat .woocommerce-notices-wrapper,
.tax-product_brand .woocommerce-notices-wrapper {
    grid-column: 1 / -1;
}

.masterbar-product-filters {
    grid-column: 1;
    grid-row: span 20;
    position: sticky;
    top: 92px;
    z-index: 8;
    padding: 18px;
    border: 1px solid var(--masterbar-border);
    border-radius: 12px;
    background: #fff;
}

.masterbar-product-filters__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    font-size: 18px;
}

.masterbar-filter-close,
.masterbar-filter-open {
    border: 0;
    background: none;
    color: inherit;
}

.masterbar-filter-close {
    display: none;
    width: 38px;
    height: 38px;
    padding: 0;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

.masterbar-filter-toolbar {
    display: none;
    margin: 14px 0;
}

.masterbar-filter-open {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 16px;
    border: 1px solid var(--masterbar-border);
    border-radius: 9px;
    background: #fff;
    font-weight: 700;
    cursor: pointer;
}

.masterbar-filter-count {
    display: inline-grid;
    place-items: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--masterbar-primary);
    color: #fff;
    font-size: 12px;
}

.masterbar-filter-group {
    margin: 0;
    padding: 14px 0;
    border: 0;
    border-top: 1px solid var(--masterbar-border);
}

.masterbar-filter-group:first-of-type {
    border-top: 0;
}

.masterbar-filter-title,
.masterbar-filter-group summary {
    color: var(--masterbar-text);
    font-size: 14px;
    font-weight: 750;
    cursor: pointer;
}

.masterbar-filter-group summary {
    list-style: none;
}
.masterbar-filter-group summary::-webkit-details-marker { display: none; }
.masterbar-filter-group summary::after {
    content: '+';
    float: right;
    color: var(--masterbar-muted);
}
.masterbar-filter-group[open] summary::after { content: '−'; }

.masterbar-filter-options {
    display: grid;
    gap: 9px;
    max-height: 220px;
    margin-top: 12px;
    overflow: auto;
}

.masterbar-filter-check {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 0;
    color: var(--masterbar-text);
    font-size: 13px;
    cursor: pointer;
}

.masterbar-filter-check input {
    width: 17px;
    height: 17px;
    margin: 0;
    accent-color: var(--masterbar-primary);
}

.masterbar-filter-price {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 10px;
}

.masterbar-filter-price label span {
    display: block;
    margin-bottom: 5px;
    color: var(--masterbar-muted);
    font-size: 11px;
}

.masterbar-filter-price input {
    width: 100%;
    min-height: 40px;
    padding: 7px 9px;
    border: 1px solid var(--masterbar-border);
    border-radius: 8px;
}

.masterbar-filter-actions {
    display: grid;
    gap: 9px;
    padding-top: 14px;
    border-top: 1px solid var(--masterbar-border);
}

.masterbar-filter-submit.button {
    width: 100%;
    margin: 0;
    border-radius: 8px;
    background: var(--masterbar-primary);
    color: #fff;
    font-weight: 700;
}

.masterbar-filter-reset {
    color: var(--masterbar-muted);
    font-size: 12px;
    text-align: center;
    text-decoration: none;
}

.masterbar-shop-archive .woocommerce-result-count,
.post-type-archive-product .woocommerce-result-count,
.tax-product_cat .woocommerce-result-count,
.tax-product_brand .woocommerce-result-count,
.masterbar-shop-archive .woocommerce-ordering,
.post-type-archive-product .woocommerce-ordering,
.tax-product_cat .woocommerce-ordering,
.tax-product_brand .woocommerce-ordering,
.masterbar-shop-archive ul.products,
.post-type-archive-product ul.products,
.tax-product_cat ul.products,
.tax-product_brand ul.products,
.masterbar-shop-archive .woocommerce-pagination,
.post-type-archive-product .woocommerce-pagination,
.tax-product_cat .woocommerce-pagination,
.tax-product_brand .woocommerce-pagination {
    grid-column: 2;
}

.masterbar-filter-backdrop { display: none; }

@media (max-width: 900px) {
    .masterbar-shop-archive .woocommerce,
    .post-type-archive-product .woocommerce,
    .tax-product_cat .woocommerce,
    .tax-product_brand .woocommerce {
        display: block;
    }

    .masterbar-filter-toolbar {
        display: block;
    }

    .masterbar-product-filters {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        left: auto;
        z-index: 100002;
        width: min(88vw, 380px);
        max-width: 100%;
        padding: 18px;
        border: 0;
        border-radius: 0;
        overflow-y: auto;
        transform: translateX(105%);
        transition: transform .22s ease;
        box-shadow: -16px 0 40px rgba(15, 23, 42, .18);
    }

    .masterbar-product-filters.is-open {
        transform: translateX(0);
    }

    .masterbar-filter-close { display: inline-grid; place-items: center; }

    .masterbar-filter-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 100001;
        background: rgba(15, 23, 42, .38);
    }
    .masterbar-filter-backdrop[hidden] { display: none; }

    html.masterbar-filters-open,
    html.masterbar-filters-open body { overflow: hidden; }

    .masterbar-filter-open {
        width: 100%;
        justify-content: center;
    }
}

/* ==========================================================
   MASTERBAR UI 0.5.4 – filtry otwierane również na desktopie
   ========================================================== */

.masterbar-shop-archive .woocommerce,
.post-type-archive-product .woocommerce,
.tax-product_cat .woocommerce,
.tax-product_brand .woocommerce {
    display: block !important;
}

.masterbar-filter-toolbar {
    display: flex !important;
    justify-content: flex-end;
    margin: 10px 0 12px;
}

.masterbar-filter-open {
    width: auto;
    min-width: 120px;
    justify-content: center;
    background: #fff;
}

.masterbar-product-filters {
    position: fixed !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: auto !important;
    z-index: 100002 !important;
    width: min(440px, 94vw) !important;
    max-width: 100%;
    padding: 22px !important;
    border: 0 !important;
    border-radius: 0 !important;
    overflow-y: auto;
    background: #fff;
    transform: translateX(105%);
    transition: transform .22s ease;
    box-shadow: -16px 0 40px rgba(15, 23, 42, .18);
}

.masterbar-product-filters.is-open {
    transform: translateX(0);
}

.masterbar-filter-close {
    display: inline-grid !important;
    place-items: center;
}

.masterbar-filter-backdrop {
    display: block !important;
    position: fixed;
    inset: 0;
    z-index: 100001;
    background: rgba(15, 23, 42, .38);
}
.masterbar-filter-backdrop[hidden] { display: none !important; }

html.masterbar-filters-open,
html.masterbar-filters-open body { overflow: hidden; }

.masterbar-shop-archive .woocommerce-result-count,
.post-type-archive-product .woocommerce-result-count,
.tax-product_cat .woocommerce-result-count,
.tax-product_brand .woocommerce-result-count,
.masterbar-shop-archive .woocommerce-ordering,
.post-type-archive-product .woocommerce-ordering,
.tax-product_cat .woocommerce-ordering,
.tax-product_brand .woocommerce-ordering,
.masterbar-shop-archive ul.products,
.post-type-archive-product ul.products,
.tax-product_cat ul.products,
.tax-product_brand ul.products,
.masterbar-shop-archive .woocommerce-pagination,
.post-type-archive-product .woocommerce-pagination,
.tax-product_cat .woocommerce-pagination,
.tax-product_brand .woocommerce-pagination {
    grid-column: auto !important;
}

@media (max-width: 900px) {
    .masterbar-filter-toolbar { justify-content: stretch; }
    .masterbar-filter-open { width: 100%; }
    .masterbar-product-filters { width: min(88vw, 380px) !important; padding: 18px !important; }
}


/* ==========================================================
   MASTERBAR UI 0.5.6 – filtry zawsze nad nagłówkiem + iOS
   ========================================================== */

/* Header MASTERBAR ma bardzo wysoki z-index dla drawerów menu/konta.
   Filtry muszą być jeszcze wyżej, aby na telefonie nic ich nie zasłaniało. */
.masterbar-filter-backdrop {
    z-index: 200100 !important;
}

.masterbar-product-filters {
    z-index: 200110 !important;
}

.masterbar-product-filters__head {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 4px 0 12px;
    background: #fff;
}

.masterbar-filter-close {
    position: relative;
    z-index: 3;
}

@media (max-width: 900px) {
    .masterbar-product-filters {
        top: 0 !important;
        height: 100dvh;
        max-height: 100dvh;
        padding-top: max(18px, env(safe-area-inset-top)) !important;
        padding-bottom: max(18px, env(safe-area-inset-bottom)) !important;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }
}

/* ==========================================================
   MASTERBAR UI 0.5.12 – lekka karuzela nazw podkategorii mobile
   ========================================================== */
@media (max-width: 1100px) {
    .masterbar-archive-subcats {
        display: block !important;
        margin: 10px 0 22px !important;
        width: 100%;
        overflow: hidden;
    }

    .masterbar-archive-subcats__grid {
        display: flex !important;
        grid-template-columns: none !important;
        gap: 9px !important;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 2px 2px 8px;
        margin: 0;
        scroll-snap-type: x proximity;
        overscroll-behavior-x: contain;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .masterbar-archive-subcats__grid::-webkit-scrollbar {
        display: none;
    }

    .masterbar-archive-subcat {
        flex: 0 0 auto !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        min-width: max-content !important;
        width: auto !important;
        min-height: 46px;
        padding: 10px 16px !important;
        border: 1px solid var(--masterbar-card-border) !important;
        border-radius: 999px !important;
        background: #fff !important;
        box-shadow: none !important;
        transform: none !important;
        scroll-snap-align: start;
    }

    .masterbar-archive-subcat__media,
    .masterbar-archive-subcat__link {
        display: none !important;
    }

    .masterbar-archive-subcat__name {
        margin: 0 !important;
        color: var(--masterbar-primary) !important;
        font-size: 14px !important;
        font-weight: 750 !important;
        line-height: 1.2 !important;
        white-space: nowrap;
    }

    .masterbar-archive-subcat:active {
        transform: scale(.98) !important;
    }
}


/* ==========================================================
   MASTERBAR UI 0.5.13 – podkategorie jako lekkie nazwy bez zdjęć
   ========================================================== */
.masterbar-archive-subcats {
    margin: 10px 0 24px !important;
    width: 100%;
}

.masterbar-archive-subcats__grid {
    display: flex !important;
    flex-wrap: wrap;
    gap: 10px !important;
    grid-template-columns: none !important;
}

.masterbar-archive-subcat {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: auto !important;
    min-width: 0 !important;
    min-height: 42px;
    padding: 9px 16px !important;
    border: 1px solid var(--masterbar-card-border) !important;
    border-radius: 999px !important;
    background: #fff !important;
    color: var(--masterbar-primary) !important;
    box-shadow: none !important;
    text-decoration: none !important;
    transform: none !important;
}

.masterbar-archive-subcat:hover {
    border-color: var(--masterbar-primary) !important;
    background: color-mix(in srgb, var(--masterbar-primary) 5%, #fff) !important;
    transform: none !important;
    box-shadow: none !important;
}

.masterbar-archive-subcat__media,
.masterbar-archive-subcat__link,
.masterbar-archive-subcat__letter {
    display: none !important;
}

.masterbar-archive-subcat__name {
    margin: 0 !important;
    color: inherit !important;
    font-size: 14px !important;
    font-weight: 750 !important;
    line-height: 1.2 !important;
    white-space: nowrap;
}

@media (max-width: 900px) {
    .masterbar-archive-subcats {
        overflow: hidden;
        margin-bottom: 20px !important;
    }

    .masterbar-archive-subcats__grid {
        flex-wrap: nowrap !important;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 2px 2px 8px;
        scroll-snap-type: x proximity;
        overscroll-behavior-x: contain;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .masterbar-archive-subcats__grid::-webkit-scrollbar {
        display: none;
    }

    .masterbar-archive-subcat {
        flex: 0 0 auto !important;
        scroll-snap-align: start;
    }
}

/* ==========================================================
   MASTERBAR UI 0.5.14 – podkategorie: desktop tekst / mobile karuzela
   ========================================================== */
.masterbar-archive-subcats {
    width: 100%;
    margin: 10px 0 24px !important;
    overflow: visible;
}

.masterbar-archive-subcats__grid {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center;
    gap: 10px !important;
    width: 100%;
    grid-template-columns: none !important;
}

.masterbar-archive-subcat {
    display: inline-flex !important;
    flex: 0 0 auto !important;
    align-items: center !important;
    justify-content: center !important;
    width: auto !important;
    min-width: max-content !important;
    min-height: 42px !important;
    padding: 9px 16px !important;
    border: 1px solid var(--masterbar-card-border) !important;
    border-radius: 999px !important;
    background: #fff !important;
    color: var(--masterbar-primary) !important;
    box-shadow: none !important;
    transform: none !important;
    text-decoration: none !important;
}

.masterbar-archive-subcat__media,
.masterbar-archive-subcat__link,
.masterbar-archive-subcat__letter {
    display: none !important;
}

.masterbar-archive-subcat__name {
    display: block !important;
    margin: 0 !important;
    color: inherit !important;
    font-size: 14px !important;
    font-weight: 750 !important;
    line-height: 1.2 !important;
    white-space: nowrap !important;
}

@media (max-width: 900px) {
    .masterbar-archive-subcats {
        overflow: hidden !important;
        margin: 8px 0 20px !important;
    }

    .masterbar-archive-subcats__grid {
        display: flex !important;
        flex-wrap: nowrap !important;
        justify-content: flex-start !important;
        gap: 9px !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        width: 100% !important;
        padding: 2px 2px 9px !important;
        margin: 0 !important;
        scroll-snap-type: x proximity;
        overscroll-behavior-x: contain;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        touch-action: pan-x pan-y;
    }

    .masterbar-archive-subcats__grid::-webkit-scrollbar {
        display: none;
    }

    .masterbar-archive-subcat {
        flex: 0 0 auto !important;
        width: auto !important;
        min-width: max-content !important;
        min-height: 44px !important;
        padding: 10px 15px !important;
        scroll-snap-align: start;
        flex-direction: row !important;
        align-items: center !important;
    }
}

/* ==========================================================
   MASTERBAR UI 0.5.15/0.5.16 – twarde wyrównanie CTA (Astra/Woo)
   ========================================================== */
.woocommerce ul.products li.product {
    height: 100%;
    display: flex !important;
    flex-direction: column !important;
    align-self: stretch !important;
}
.woocommerce ul.products li.product .woocommerce-LoopProduct-link,
.woocommerce ul.products li.product .woocommerce-loop-product__link {
    display: flex !important;
    flex: 1 1 auto !important;
    flex-direction: column !important;
    min-height: 0 !important;
}
.woocommerce ul.products li.product .astra-shop-summary-wrap,
.woocommerce ul.products li.product .ast-woo-product-category,
.woocommerce ul.products li.product .ast-woo-shop-product-description { min-width: 0; }
.woocommerce ul.products li.product .astra-shop-summary-wrap {
    display: flex !important;
    flex: 1 1 auto !important;
    flex-direction: column !important;
    width: 100% !important;
}
.woocommerce ul.products li.product .astra-shop-summary-wrap > a.woocommerce-LoopProduct-link,
.woocommerce ul.products li.product .astra-shop-summary-wrap > a.woocommerce-loop-product__link {
    display: flex !important;
    flex: 1 1 auto !important;
    flex-direction: column !important;
    width: 100% !important;
}
.woocommerce ul.products li.product .button,
.woocommerce ul.products li.product .astra-shop-summary-wrap > .button,
.woocommerce ul.products li.product > .button,
.woocommerce ul.products li.product a.button.product_type_simple,
.woocommerce ul.products li.product a.button.product_type_variable {
    margin-top: auto !important;
    min-height: 48px;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}
@media (max-width: 767px) {
    .woocommerce ul.products li.product .astra-shop-summary-wrap { height: 100% !important; }
    .woocommerce ul.products li.product .button {
        min-height: 52px;
        padding-inline: 8px !important;
    }
}

/* ==========================================================
   MASTERBAR UI 0.5.21 – desktop: jeden słupek Kategorie / Filtry
   ========================================================== */
@media (min-width: 901px) {
    .masterbar-shop-archive .woocommerce,
    .post-type-archive-product .woocommerce,
    .tax-product_cat .woocommerce,
    .tax-product_brand .woocommerce {
        display: grid !important;
        grid-template-columns: 255px minmax(0, 1fr) !important;
        column-gap: 30px !important;
        align-items: start;
    }

    .masterbar-archive-subcats,
    .masterbar-shop-archive .woocommerce-notices-wrapper,
    .post-type-archive-product .woocommerce-notices-wrapper,
    .tax-product_cat .woocommerce-notices-wrapper,
    .tax-product_brand .woocommerce-notices-wrapper {
        grid-column: 1 / -1 !important;
    }

    .masterbar-filter-toolbar {
        display: none !important;
    }

    .masterbar-product-filters {
        grid-column: 1 !important;
        grid-row: 2 / span 30 !important;
        position: sticky !important;
        top: 96px !important;
        right: auto !important;
        bottom: auto !important;
        left: auto !important;
        z-index: 8 !important;
        width: 255px !important;
        max-width: none !important;
        max-height: calc(100vh - 116px);
        padding: 0 !important;
        border: 1px solid var(--masterbar-border) !important;
        border-radius: 12px !important;
        overflow: hidden auto;
        background: #fff;
        transform: none !important;
        box-shadow: none !important;
    }

    .masterbar-sidebar-tabs {
        position: sticky;
        top: 0;
        z-index: 4;
        display: grid;
        grid-template-columns: 1fr 1fr;
        padding: 7px;
        border-bottom: 1px solid var(--masterbar-border);
        background: #fff;
    }

    .masterbar-sidebar-tab {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        min-height: 42px;
        padding: 7px 8px;
        border: 0;
        border-radius: 8px;
        background: transparent;
        color: var(--masterbar-muted);
        font-size: 13px;
        font-weight: 750;
        cursor: pointer;
    }

    .masterbar-sidebar-tab.is-active {
        background: color-mix(in srgb, var(--masterbar-primary) 10%, #fff);
        color: var(--masterbar-primary);
    }

    .masterbar-sidebar-pane {
        display: none;
        padding: 12px 14px 16px;
    }

    .masterbar-sidebar-pane.is-active {
        display: block;
    }

    .masterbar-product-filters__head {
        display: none !important;
    }

    .masterbar-category-nav__list {
        margin: 0;
        padding: 0;
        list-style: none;
    }

    .masterbar-category-nav__item {
        margin: 0;
    }

    .masterbar-category-nav__item > a {
        position: relative;
        display: block;
        padding: 8px 8px;
        border-radius: 7px;
        color: var(--masterbar-text);
        font-size: 13px;
        line-height: 1.25;
        text-decoration: none;
        transition: background-color .15s ease, color .15s ease;
    }

    .masterbar-category-nav__list--root > .masterbar-category-nav__item > a {
        font-weight: 700;
    }

    .masterbar-category-nav__list--level-1,
    .masterbar-category-nav__list--level-2,
    .masterbar-category-nav__list--level-3,
    .masterbar-category-nav__list--level-4 {
        margin: 2px 0 4px 9px;
        padding-left: 9px;
        border-left: 1px solid var(--masterbar-border);
    }

    .masterbar-category-nav__list--level-1 .masterbar-category-nav__item > a,
    .masterbar-category-nav__list--level-2 .masterbar-category-nav__item > a,
    .masterbar-category-nav__list--level-3 .masterbar-category-nav__item > a,
    .masterbar-category-nav__list--level-4 .masterbar-category-nav__item > a {
        padding-top: 7px;
        padding-bottom: 7px;
        font-size: 12.5px;
    }

    .masterbar-category-nav__item.is-branch > a {
        font-weight: 750;
    }

    .masterbar-category-nav__item.is-active > a {
        background: color-mix(in srgb, var(--masterbar-primary) 10%, #fff);
        color: var(--masterbar-primary);
    }

    .masterbar-category-nav__item.is-active > a::before {
        content: '';
        position: absolute;
        top: 10px;
        bottom: 10px;
        left: 0;
        width: 3px;
        border-radius: 999px;
        background: var(--masterbar-primary);
    }

    .masterbar-category-nav__item > a:hover {
        background: #f7f8fa;
    }

    .masterbar-filter-group:first-of-type {
        padding-top: 2px;
    }

    .masterbar-shop-archive .woocommerce-result-count,
    .post-type-archive-product .woocommerce-result-count,
    .tax-product_cat .woocommerce-result-count,
    .tax-product_brand .woocommerce-result-count,
    .masterbar-shop-archive .woocommerce-ordering,
    .post-type-archive-product .woocommerce-ordering,
    .tax-product_cat .woocommerce-ordering,
    .tax-product_brand .woocommerce-ordering,
    .masterbar-shop-archive ul.products,
    .post-type-archive-product ul.products,
    .tax-product_cat ul.products,
    .tax-product_brand ul.products,
    .masterbar-shop-archive .woocommerce-pagination,
    .post-type-archive-product .woocommerce-pagination,
    .tax-product_cat .woocommerce-pagination,
    .tax-product_brand .woocommerce-pagination,
    .masterbar-shop-archive .term-description,
    .post-type-archive-product .term-description,
    .tax-product_cat .term-description,
    .tax-product_brand .term-description {
        grid-column: 2 !important;
    }

    .masterbar-filter-backdrop {
        display: none !important;
    }

    html.masterbar-filters-open,
    html.masterbar-filters-open body {
        overflow: auto !important;
    }
}

@media (max-width: 900px) {
    .masterbar-sidebar-tabs,
    .masterbar-sidebar-pane[data-masterbar-sidebar-pane="categories"] {
        display: none !important;
    }

    .masterbar-sidebar-pane[data-masterbar-sidebar-pane="filters"] {
        display: block !important;
        padding: 0;
    }
}

/* ==========================================================
   MASTERBAR UI 0.5.22 – DOGGROOMER desktop sidebar polish
   ========================================================== */
@media (min-width: 901px) {
    /* Sidebar is a real grid column, never an overlay over products. */
    .masterbar-shop-archive .woocommerce,
    .post-type-archive-product .woocommerce,
    .tax-product_cat .woocommerce,
    .tax-product_brand .woocommerce {
        grid-template-columns: 300px minmax(0, 1fr) !important;
        column-gap: 36px !important;
    }

    /* Everything in the Woo archive belongs to the content column by default. */
    .masterbar-shop-archive .woocommerce > *,
    .post-type-archive-product .woocommerce > *,
    .tax-product_cat .woocommerce > *,
    .tax-product_brand .woocommerce > * {
        grid-column: 2 !important;
        min-width: 0;
    }

    .masterbar-shop-archive .woocommerce > .masterbar-product-filters,
    .post-type-archive-product .woocommerce > .masterbar-product-filters,
    .tax-product_cat .woocommerce > .masterbar-product-filters,
    .tax-product_brand .woocommerce > .masterbar-product-filters {
        grid-column: 1 !important;
        grid-row: 1 / span 60 !important;
        width: 300px !important;
        align-self: start;
        max-height: none !important;
        overflow: visible !important;
        border-radius: 14px !important;
    }

    /* Toolbar is mobile-only and must not consume a desktop grid row. */
    .masterbar-shop-archive .woocommerce > .masterbar-filter-toolbar,
    .post-type-archive-product .woocommerce > .masterbar-filter-toolbar,
    .tax-product_cat .woocommerce > .masterbar-filter-toolbar,
    .tax-product_brand .woocommerce > .masterbar-filter-toolbar {
        display: none !important;
    }

    .masterbar-sidebar-tabs {
        position: static;
        padding: 8px;
        gap: 5px;
    }

    .masterbar-sidebar-tab {
        min-height: 44px;
        font-size: 13.5px;
        border-radius: 9px;
    }

    .masterbar-sidebar-pane {
        padding: 14px 16px 18px;
    }

    .masterbar-category-nav__item > a {
        padding: 9px 10px;
        font-size: 13.5px;
        line-height: 1.3;
    }

    .masterbar-category-nav__list--root > .masterbar-category-nav__item {
        margin-bottom: 2px;
    }

    .masterbar-category-nav__list--root > .masterbar-category-nav__item > a {
        font-weight: 700;
    }

    .masterbar-category-nav__list--level-1,
    .masterbar-category-nav__list--level-2,
    .masterbar-category-nav__list--level-3,
    .masterbar-category-nav__list--level-4 {
        margin-left: 11px;
        padding-left: 10px;
    }

    .masterbar-category-nav__list--level-1 .masterbar-category-nav__item > a,
    .masterbar-category-nav__list--level-2 .masterbar-category-nav__item > a,
    .masterbar-category-nav__list--level-3 .masterbar-category-nav__item > a,
    .masterbar-category-nav__list--level-4 .masterbar-category-nav__item > a {
        padding-top: 8px;
        padding-bottom: 8px;
        font-size: 13px;
    }

    .masterbar-category-nav__item.is-active > a {
        background: color-mix(in srgb, var(--masterbar-primary) 7%, #fff);
    }

    .masterbar-category-nav__item.is-active > a::before {
        top: 7px;
        bottom: 7px;
        width: 3px;
    }
}


/* ==========================================================
   MASTERBAR UI 0.5.23 – DOGGROOMER real catalogue layout
   ========================================================== */
@media (min-width: 901px) {
    .masterbar-shop-archive .woocommerce.masterbar-catalog-layout,
    .post-type-archive-product .woocommerce.masterbar-catalog-layout,
    .tax-product_cat .woocommerce.masterbar-catalog-layout,
    .tax-product_brand .woocommerce.masterbar-catalog-layout {
        display: grid !important;
        grid-template-columns: 300px minmax(0, 1fr) !important;
        gap: 0 36px !important;
        align-items: start !important;
    }

    .woocommerce.masterbar-catalog-layout > .masterbar-archive-subcats,
    .woocommerce.masterbar-catalog-layout > .woocommerce-notices-wrapper {
        grid-column: 1 / -1 !important;
    }

    .woocommerce.masterbar-catalog-layout > .masterbar-product-filters {
        grid-column: 1 !important;
        grid-row: auto !important;
        width: 300px !important;
        position: sticky !important;
        top: 96px !important;
        align-self: start !important;
    }

    .woocommerce.masterbar-catalog-layout > .masterbar-filter-backdrop {
        display: none !important;
    }

    .woocommerce.masterbar-catalog-layout > .masterbar-catalog-main {
        grid-column: 2 !important;
        min-width: 0 !important;
        width: 100% !important;
    }

    .masterbar-catalog-main ul.products,
    .masterbar-catalog-main .woocommerce-pagination,
    .masterbar-catalog-main .term-description {
        grid-column: auto !important;
        width: 100% !important;
        max-width: none !important;
    }

    .masterbar-catalog-toolbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 18px;
        width: 100%;
        min-height: 48px;
        margin: 0 0 18px;
    }

    .masterbar-catalog-toolbar .woocommerce-result-count,
    .masterbar-catalog-toolbar .woocommerce-ordering {
        float: none !important;
        margin: 0 !important;
    }

    .masterbar-catalog-toolbar__actions {
        display: flex;
        align-items: center;
        justify-content: flex-end;
        gap: 16px;
        margin-left: auto;
    }

    .masterbar-catalog-toolbar .woocommerce-pagination {
        width: auto !important;
        margin: 0 !important;
        padding: 0 !important;
        border: 0 !important;
    }

    .masterbar-catalog-toolbar .woocommerce-pagination ul.page-numbers {
        display: flex !important;
        align-items: center;
        gap: 5px;
        margin: 0 !important;
        border: 0 !important;
    }

    .masterbar-catalog-toolbar .woocommerce-pagination ul.page-numbers li {
        border: 0 !important;
    }

    .masterbar-catalog-toolbar .woocommerce-pagination .page-numbers a,
    .masterbar-catalog-toolbar .woocommerce-pagination .page-numbers span {
        display: inline-flex;
        min-width: 38px;
        min-height: 38px;
        align-items: center;
        justify-content: center;
        padding: 6px 10px;
        border: 1px solid var(--masterbar-border);
        border-radius: 8px;
        background: #fff;
    }

    .masterbar-catalog-main ul.products {
        margin-top: 0 !important;
    }
}

/* ==========================================================
   MASTERBAR UI 0.5.26 – SEWING / Astra wide catalog
   Desktop: 310 px sidebar + 32 px gap + fluid catalogue.
   ========================================================== */
@media (min-width: 901px) {
    /* Astra stays responsible for the outer archive structure, but we make
       its two columns deterministic so the catalogue cannot collapse. */
    body.post-type-archive-product .site-content > .ast-container,
    body.tax-product_cat .site-content > .ast-container,
    body.tax-product_brand .site-content > .ast-container,
    body.masterbar-shop-archive .site-content > .ast-container {
        display: flex !important;
        align-items: flex-start !important;
        gap: 32px !important;
        width: 100% !important;
        max-width: var(--masterbar-content-width, 1500px) !important;
        margin-left: auto !important;
        margin-right: auto !important;
        padding-left: 24px !important;
        padding-right: 24px !important;
        box-sizing: border-box !important;
    }

    body.post-type-archive-product #secondary,
    body.tax-product_cat #secondary,
    body.tax-product_brand #secondary,
    body.masterbar-shop-archive #secondary {
        order: 1 !important;
        flex: 0 0 310px !important;
        width: 310px !important;
        min-width: 310px !important;
        max-width: 310px !important;
        margin: 0 !important;
        padding: 0 !important;
        border: 0 !important;
        background: transparent !important;
    }

    body.post-type-archive-product #primary,
    body.tax-product_cat #primary,
    body.tax-product_brand #primary,
    body.masterbar-shop-archive #primary {
        order: 2 !important;
        flex: 1 1 auto !important;
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 0 !important;
        border: 0 !important;
    }

    /* Previous experimental Woo grid must never re-enter the layout. */
    .masterbar-shop-archive .woocommerce,
    .post-type-archive-product .woocommerce,
    .tax-product_cat .woocommerce,
    .tax-product_brand .woocommerce,
    .woocommerce.masterbar-catalog-layout {
        display: block !important;
        grid-template-columns: none !important;
        width: 100% !important;
        min-width: 0 !important;
    }

    .masterbar-filter-toolbar,
    .masterbar-filter-backdrop {
        display: none !important;
    }

    #secondary.masterbar-astra-catalog-sidebar,
    #secondary .masterbar-astra-catalog-sidebar,
    .masterbar-astra-catalog-sidebar {
        min-width: 0 !important;
    }

    /* No internal scrollbar. The category tree follows normal page scroll. */
    .masterbar-astra-catalog-sidebar .masterbar-product-filters {
        display: block !important;
        position: relative !important;
        top: auto !important;
        width: 100% !important;
        max-width: none !important;
        margin: 0 !important;
        max-height: none !important;
        overflow: visible !important;
        border: 1px solid #e5e9ef !important;
        border-radius: 12px !important;
        background: #fff !important;
        box-sizing: border-box !important;
        z-index: 3 !important;
        box-shadow: none !important;
    }

    /* Only the mode switch stays available while scrolling. */
    .masterbar-astra-catalog-sidebar .masterbar-sidebar-tabs {
        position: sticky !important;
        top: 92px !important;
        z-index: 4 !important;
        background: #fff !important;
        padding: 7px !important;
        border-bottom: 1px solid #eef1f4 !important;
        border-radius: 11px 11px 0 0 !important;
    }

    .masterbar-sidebar-tab {
        min-height: 42px !important;
        font-size: 14px !important;
    }

    .masterbar-sidebar-pane {
        padding: 14px 16px 18px !important;
    }

    .masterbar-category-nav__item > a {
        padding: 9px 10px !important;
        font-size: 14px !important;
        line-height: 1.3 !important;
    }

    /* Catalogue toolbar: count on left, pagination + sort on right. */
    .masterbar-catalog-toolbar {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        flex-wrap: wrap !important;
        gap: 12px 18px !important;
        width: 100% !important;
        min-height: 46px !important;
        margin: 0 0 18px !important;
        clear: both !important;
    }

    .masterbar-catalog-toolbar .woocommerce-result-count,
    .masterbar-catalog-toolbar .woocommerce-ordering {
        float: none !important;
        margin: 0 !important;
    }

    .masterbar-catalog-toolbar__actions {
        display: flex !important;
        align-items: center !important;
        justify-content: flex-end !important;
        flex-wrap: wrap !important;
        gap: 12px !important;
        margin-left: auto !important;
    }

    .masterbar-catalog-toolbar .woocommerce-pagination {
        width: auto !important;
        margin: 0 !important;
        padding: 0 !important;
        border: 0 !important;
    }

    /* Four equal cards on a normal desktop once the sidebar is deducted. */
    body.post-type-archive-product #primary ul.products,
    body.tax-product_cat #primary ul.products,
    body.tax-product_brand #primary ul.products,
    body.masterbar-shop-archive #primary ul.products {
        display: grid !important;
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
        gap: 20px !important;
        width: 100% !important;
        min-width: 0 !important;
    }

    body.post-type-archive-product #primary ul.products > li.product,
    body.tax-product_cat #primary ul.products > li.product,
    body.tax-product_brand #primary ul.products > li.product,
    body.masterbar-shop-archive #primary ul.products > li.product {
        width: auto !important;
        min-width: 0 !important;
        margin: 0 !important;
    }
}

@media (min-width: 901px) and (max-width: 1199px) {
    body.post-type-archive-product #secondary,
    body.tax-product_cat #secondary,
    body.tax-product_brand #secondary,
    body.masterbar-shop-archive #secondary {
        flex-basis: 250px !important;
        width: 250px !important;
        min-width: 250px !important;
        max-width: 250px !important;
    }

    body.post-type-archive-product #primary ul.products,
    body.tax-product_cat #primary ul.products,
    body.tax-product_brand #primary ul.products,
    body.masterbar-shop-archive #primary ul.products {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }
}

/* ==========================================================
   MASTERBAR UI 0.5.28 – SEWING paged sidebar + sticky panel
   ========================================================== */
@media (min-width: 901px) {
    /* Cały panel Kategorie / Filtry jedzie razem z użytkownikiem. */
    .masterbar-astra-catalog-sidebar .masterbar-product-filters {
        position: sticky !important;
        top: 92px !important;
        max-height: calc(100vh - 110px) !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        overscroll-behavior: contain;
        scrollbar-width: thin;
        scrollbar-color: #cfd6df transparent;
    }

    .masterbar-astra-catalog-sidebar .masterbar-product-filters::-webkit-scrollbar {
        width: 6px;
    }

    .masterbar-astra-catalog-sidebar .masterbar-product-filters::-webkit-scrollbar-track {
        background: transparent;
    }

    .masterbar-astra-catalog-sidebar .masterbar-product-filters::-webkit-scrollbar-thumb {
        background: #cfd6df;
        border-radius: 999px;
    }

    .masterbar-astra-catalog-sidebar .masterbar-sidebar-tabs {
        position: sticky !important;
        top: 0 !important;
        z-index: 6 !important;
    }

    #masterbar-catalog-toolbar {
        scroll-margin-top: 104px;
    }

    /* Każda strona paginacji ma identyczne proporcje Astra sidebar/content. */
    body.paged.masterbar-shop-archive #secondary,
    body.paged.tax-product_cat #secondary,
    body.paged.tax-product_brand #secondary,
    body.paged.post-type-archive-product #secondary {
        display: block !important;
        flex: 0 0 310px !important;
        width: 310px !important;
        min-width: 310px !important;
        max-width: 310px !important;
    }

    body.paged.masterbar-shop-archive #primary,
    body.paged.tax-product_cat #primary,
    body.paged.tax-product_brand #primary,
    body.paged.post-type-archive-product #primary {
        display: block !important;
        flex: 1 1 auto !important;
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;
    }
}


/* 0.5.34 – gdy działa osobny Catalog Sidebar, nie pokazuj konkurencyjnego panelu motywu na desktopie. */
@media (min-width: 901px) {
  body.masterbar-catalog-sidebar-integration .masterbar-filter-toolbar,
  body.masterbar-catalog-sidebar-integration .masterbar-product-filters,
  body.masterbar-catalog-sidebar-integration .masterbar-filter-backdrop { display: none !important; }
}


/* MASTERBAR UI 0.5.57 — czytelniejszy przycisk rozwijania filtrów */
.masterbar-filter-group > summary{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
    min-height:30px;
    padding:2px 0;
}
.masterbar-filter-group > summary::after{
    content:'+';
    float:none;
    flex:0 0 26px;
    width:26px;
    height:26px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    box-sizing:border-box;
    border:1px solid var(--masterbar-border);
    border-radius:999px;
    background:#f4f7fb;
    color:var(--masterbar-primary);
    font-size:18px;
    font-weight:800;
    line-height:1;
    transition:background-color .15s ease,border-color .15s ease,color .15s ease,transform .15s ease;
}
.masterbar-filter-group > summary:hover::after{
    background:#eaf2fb;
    border-color:var(--masterbar-primary);
}
.masterbar-filter-group[open] > summary::after{
    content:'−';
    background:var(--masterbar-primary);
    border-color:var(--masterbar-primary);
    color:#fff;
}
@media(max-width:1024px){
    .masterbar-filter-group > summary{min-height:36px;}
    .masterbar-filter-group > summary::after{flex-basis:30px;width:30px;height:30px;font-size:20px;}
}


/* MASTERBAR UI 0.5.58 — końcowa kategoria: delikatna podpowiedź filtrów na mobile */
@media (max-width:1024px){
  .masterbar-filter-toolbar.is-leaf-category .masterbar-filter-open.is-recommended{
    position:relative;
    font-weight:800 !important;
    box-shadow:0 0 0 2px rgba(13,53,87,.10) !important;
  }
  .masterbar-filter-toolbar.is-leaf-category .masterbar-filter-open.is-recommended .masterbar-filter-count{
    font-weight:800;
  }
}

/* ==========================================================
   MASTERBAR UI 0.5.71 – MOBILE COMPACT CATALOG CARDS
   ========================================================== */
.masterbar-price-stock-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    margin-top: 8px;
}

.masterbar-price-stock-row .price,
.masterbar-price-stock-row .masterbar-loop-stock {
    margin: 0 !important;
    min-height: 0 !important;
}

.masterbar-price-stock-row .masterbar-loop-stock {
    flex: 0 0 auto;
    white-space: nowrap;
    text-align: right;
}

@media (max-width: 767px) {
    /* Na mobile marka i kategoria tylko zabierają miejsce w siatce sklepu. */
    .woocommerce ul.products li.product .masterbar-loop-brand,
    .woocommerce ul.products li.product .ast-woo-product-category {
        display: none !important;
    }

    .woocommerce ul.products li.product {
        padding: 9px !important;
    }

    .woocommerce ul.products li.product a img {
        height: 150px !important;
        margin-bottom: 8px !important;
    }

    .woocommerce ul.products li.product .woocommerce-loop-product__title {
        min-height: 0 !important;
        margin-top: 0 !important;
        font-size: 13px !important;
        line-height: 1.28 !important;
    }

    .masterbar-price-stock-row {
        gap: 5px;
        margin-top: 7px;
    }

    .masterbar-price-stock-row .price {
        flex: 1 1 auto;
        font-size: 15px !important;
        line-height: 1.15 !important;
    }

    .masterbar-price-stock-row .masterbar-loop-stock {
        font-size: 10px !important;
        line-height: 1.15 !important;
    }

    .woocommerce ul.products li.product .button,
    .woocommerce ul.products li.product .astra-shop-summary-wrap > .button,
    .woocommerce ul.products li.product > .button,
    .woocommerce ul.products li.product a.button.product_type_simple,
    .woocommerce ul.products li.product a.button.product_type_variable {
        min-height: 44px !important;
        margin-top: 9px !important;
        padding: 8px 6px !important;
        font-size: 12px !important;
        line-height: 1.15 !important;
    }
}

@media (max-width: 430px) {
    .woocommerce ul.products li.product a img {
        height: 138px !important;
    }

    .masterbar-price-stock-row .price {
        font-size: 14px !important;
    }

    .masterbar-price-stock-row .masterbar-loop-stock {
        font-size: 9.5px !important;
    }
}


/* ==========================================================
   MASTERBAR UI 0.5.72 – MOBILE CTA ALIGN + SHORT LABEL
   ========================================================== */
@media (max-width: 767px) {
    /* Każdy przycisk siedzi na tej samej linii przy dole karty,
       niezależnie od długości nazwy produktu. */
    .woocommerce ul.products li.product .button,
    .woocommerce ul.products li.product .astra-shop-summary-wrap > .button,
    .woocommerce ul.products li.product > .button,
    .woocommerce ul.products li.product a.button.product_type_simple,
    .woocommerce ul.products li.product a.button.product_type_variable {
        width: calc(100% - 12px) !important;
        min-height: 42px !important;
        margin-top: auto !important;
        margin-left: auto !important;
        margin-right: auto !important;
        padding: 7px 8px !important;
        font-size: 11.5px !important;
        line-height: 1.1 !important;
        border-radius: 8px !important;
    }

    /* Mały, stały oddech nad CTA, ale bez rozpychania karty. */
    .woocommerce ul.products li.product .masterbar-price-stock-row {
        margin-bottom: 8px !important;
    }
}


/* ==========================================================
   MASTERBAR UI 0.5.74 – DESKTOP CLEANUP + VARIANT COUNT
   ========================================================== */

/* Producent i kategoria nie są potrzebne na kaflach katalogowych także na desktopie. */
.woocommerce ul.products li.product .masterbar-loop-brand,
.woocommerce ul.products li.product .ast-woo-product-category {
    display: none !important;
}

/* 0.5.76: liczba wariantów jako czytelny badge/pigułka.
   Slot ma stałą wysokość także dla produktów bez grupy, więc kafle pozostają równe. */
.woocommerce ul.products li.product .masterbar-loop-variants {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 24px;
    width: fit-content;
    max-width: 100%;
    margin: 6px 0 0;
    padding: 3px 9px;
    border: 1px solid rgba(20, 58, 94, 0.22);
    border-radius: 999px;
    background: rgba(20, 58, 94, 0.08);
    color: var(--masterbar-primary);
    font-size: 12px;
    font-weight: 800;
    line-height: 1.25;
    white-space: nowrap;
}

.woocommerce ul.products li.product .masterbar-loop-variants.is-empty {
    min-height: 24px;
    padding-top: 3px;
    padding-bottom: 3px;
    border-color: transparent;
    background: transparent;
    visibility: hidden;
}

@media (max-width: 767px) {
    .woocommerce ul.products li.product .masterbar-loop-variants {
        min-height: 22px;
        margin-top: 4px;
        padding: 2px 8px;
        font-size: 11px;
        line-height: 1.25;
    }

    .woocommerce ul.products li.product .masterbar-loop-variants.is-empty {
        min-height: 22px;
        padding-top: 2px;
        padding-bottom: 2px;
    }
}

/* ==========================================================
   MASTERBAR UI 0.5.86 – MOBILE COMPACT CATALOG TOP
   Cel: szybciej pokazać produkty bez usuwania funkcji.
   Desktop bez zmian.
   ========================================================== */
@media (max-width: 900px) {
  .masterbar-shop-archive .woocommerce-products-header {
    margin: 10px 0 8px !important;
  }
  .masterbar-shop-archive .woocommerce-breadcrumb {
    margin: 0 0 5px !important;
    font-size: 11px !important;
    line-height: 1.3 !important;
  }
  .masterbar-shop-archive .woocommerce-products-header__title.page-title {
    font-size: 25px !important;
    line-height: 1.08 !important;
  }

  .masterbar-archive-subcats {
    margin: 5px 0 10px !important;
  }
  .masterbar-archive-subcats__grid {
    gap: 7px !important;
    padding: 1px 1px 4px !important;
  }
  .masterbar-archive-subcat {
    min-height: 38px !important;
    padding: 7px 13px !important;
  }
  .masterbar-archive-subcat__name {
    margin: 0 !important;
    font-size: 12.5px !important;
    line-height: 1.15 !important;
  }

  .masterbar-mobile-catalog-count {
    margin: 2px 0 7px !important;
    color: var(--masterbar-muted) !important;
    font-size: 12px !important;
    line-height: 1.3 !important;
  }

  .masterbar-mobile-catalog-controls {
    display: grid !important;
    grid-template-columns: minmax(0, .78fr) minmax(0, 1.22fr) !important;
    gap: 8px !important;
    width: 100% !important;
    margin: 0 0 12px !important;
    align-items: stretch !important;
  }
  .masterbar-mobile-catalog-controls .masterbar-filter-toolbar,
  .masterbar-mobile-catalog-controls .woocommerce-ordering {
    float: none !important;
    width: 100% !important;
    margin: 0 !important;
    min-width: 0 !important;
  }
  .masterbar-mobile-catalog-controls .masterbar-filter-open,
  .masterbar-mobile-catalog-controls .woocommerce-ordering select {
    width: 100% !important;
    height: 44px !important;
    min-height: 44px !important;
    margin: 0 !important;
    border: 1px solid var(--masterbar-border) !important;
    border-radius: 10px !important;
    background-color: #fff !important;
    box-shadow: none !important;
    font-size: 13px !important;
    line-height: 1.2 !important;
  }
  .masterbar-mobile-catalog-controls .masterbar-filter-open {
    min-width: 0 !important;
    padding: 0 10px !important;
    gap: 6px !important;
    font-weight: 750 !important;
  }
  .masterbar-mobile-catalog-controls .woocommerce-ordering select {
    padding: 0 34px 0 12px !important;
    text-overflow: ellipsis;
  }

  /* Po przeniesieniu przez JS licznik nie może zostawiać starego miejsca. */
  .masterbar-shop-archive .woocommerce-result-count.masterbar-mobile-catalog-count {
    float: none !important;
  }
}


/* ==========================================================
   MASTERBAR UI 0.5.87 – MOBILE FILTER + ORDER ROW FINAL
   Wymuszenie jednego zwartego rzędu także po późnych zmianach DOM.
   ========================================================== */
@media (max-width: 900px) {
  .masterbar-mobile-catalog-controls {
    display: grid !important;
    grid-template-columns: minmax(0, .82fr) minmax(0, 1.18fr) !important;
    gap: 8px !important;
    width: 100% !important;
    margin: 0 0 12px !important;
    align-items: stretch !important;
    clear: both !important;
  }
  .masterbar-mobile-catalog-controls > .masterbar-filter-toolbar,
  .masterbar-mobile-catalog-controls > .woocommerce-ordering {
    display: block !important;
    float: none !important;
    position: static !important;
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    grid-column: auto !important;
  }
  .masterbar-mobile-catalog-controls .masterbar-filter-open,
  .masterbar-mobile-catalog-controls .woocommerce-ordering select {
    width: 100% !important;
    max-width: 100% !important;
    height: 44px !important;
    min-height: 44px !important;
    margin: 0 !important;
    border-radius: 10px !important;
    white-space: nowrap !important;
  }
  .masterbar-mobile-catalog-controls .masterbar-filter-open {
    justify-content: center !important;
  }
  .masterbar-mobile-catalog-controls .woocommerce-ordering select {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
}


/* ==========================================================
   MASTERBAR UI 0.5.88 – MOBILE CATALOG CLEAN TOP
   - breadcrumb ukryty na mobile
   - licznik wyników ukryty na mobile
   - Filtry + Sortowanie pozostają w jednym rzędzie
   Desktop bez zmian.
   ========================================================== */
@media (max-width: 900px) {
  .masterbar-shop-archive .woocommerce-breadcrumb,
  .post-type-archive-product .woocommerce-breadcrumb,
  .tax-product_cat .woocommerce-breadcrumb,
  .tax-product_brand .woocommerce-breadcrumb {
    display: none !important;
  }

  .masterbar-shop-archive .woocommerce-result-count,
  .post-type-archive-product .woocommerce-result-count,
  .tax-product_cat .woocommerce-result-count,
  .tax-product_brand .woocommerce-result-count,
  .masterbar-mobile-catalog-count {
    display: none !important;
  }

  .masterbar-shop-archive .woocommerce-products-header {
    margin-top: 8px !important;
  }

  .masterbar-mobile-catalog-controls {
    margin-top: 2px !important;
    margin-bottom: 12px !important;
  }
}


/* ==========================================================
   MASTERBAR UI 0.5.89 – MOBILE FILTER EMPHASIS
   Filtry są akcją główną, sortowanie pozostaje neutralne.
   Desktop bez zmian.
   ========================================================== */
@media (max-width: 900px) {
  .masterbar-mobile-catalog-controls .masterbar-filter-open {
    border-color: #174a73 !important;
    background: #eef5fb !important;
    color: #123f66 !important;
    box-shadow: 0 1px 0 rgba(18, 63, 102, .05), 0 0 0 1px rgba(18, 63, 102, .04) !important;
    font-weight: 800 !important;
  }
  .masterbar-mobile-catalog-controls .masterbar-filter-open > span:first-child {
    color: #123f66 !important;
  }
  .masterbar-mobile-catalog-controls .masterbar-filter-open:active,
  .masterbar-mobile-catalog-controls .masterbar-filter-open:focus-visible {
    background: #e3eff9 !important;
    border-color: #0f3c62 !important;
    outline: 0 !important;
  }
}


/* ==========================================================
   MASTERBAR UI 0.5.90 – MOBILE CATALOG NAVIGATION
   Filtry + Kategorie; sortowanie wewnątrz filtrów; bez pigułek podkategorii.
   ========================================================== */
.masterbar-mobile-filter-context { display:none; }
@media (max-width: 900px) {
  .masterbar-archive-subcats { display:none !important; }
  .masterbar-mobile-catalog-controls {
    grid-template-columns: 1fr 1fr !important;
  }
  .masterbar-mobile-catalog-controls > .woocommerce-ordering { display:none !important; }
  .masterbar-mobile-category-open {
    display:flex !important; align-items:center; justify-content:center; gap:7px;
    width:100%; height:44px; min-height:44px; margin:0; padding:0 10px;
    border:1px solid #d8dee6; border-radius:10px; background:#fff;
    color:#123f66; font:inherit; font-weight:750; cursor:pointer;
  }
  .masterbar-mobile-category-open::before { content:'☰'; font-size:14px; line-height:1; }
  .masterbar-mobile-filter-context {
    display:flex; flex-direction:column; gap:3px; padding:0 0 14px; margin:0 0 8px;
    border-bottom:1px solid var(--masterbar-border);
  }
  .masterbar-mobile-filter-context strong { font-size:17px; line-height:1.25; color:var(--masterbar-text); }
  .masterbar-mobile-filter-context span { font-size:13px; line-height:1.35; color:var(--masterbar-muted); }
  .masterbar-mobile-filter-ordering { margin:0 0 14px !important; width:100% !important; float:none !important; }
  .masterbar-mobile-filter-ordering::before {
    content:'Sortowanie'; display:block; margin:0 0 7px; color:var(--masterbar-text); font-weight:750; font-size:15px;
  }
  .masterbar-mobile-filter-ordering select { width:100% !important; min-height:44px !important; border-radius:9px !important; }
}


/* ==========================================================
   MASTERBAR UI 0.5.91 – MOBILE CATALOG NAVIGATION FINAL
   Finalne reguły po historycznych 0.5.86/0.5.87: tylko Filtry + Kategorie.
   ========================================================== */
@media (max-width: 900px) {
  .masterbar-archive-subcats { display: none !important; }

  .masterbar-mobile-catalog-controls {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
    width: 100% !important;
    margin: 2px 0 12px !important;
    align-items: stretch !important;
  }

  .masterbar-mobile-catalog-controls > .masterbar-filter-toolbar,
  .masterbar-mobile-catalog-controls > .masterbar-mobile-category-open {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    float: none !important;
    position: static !important;
  }

  .masterbar-mobile-catalog-controls .masterbar-filter-open,
  .masterbar-mobile-category-open {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 7px !important;
    width: 100% !important;
    height: 44px !important;
    min-height: 44px !important;
    margin: 0 !important;
    padding: 0 10px !important;
    border-radius: 10px !important;
    font-size: 13px !important;
    line-height: 1.2 !important;
    white-space: nowrap !important;
  }

  .masterbar-mobile-category-open {
    border: 1px solid #d8dee6 !important;
    background: #fff !important;
    color: #123f66 !important;
    font-weight: 800 !important;
    cursor: pointer;
  }

  /* Natywne sortowanie Woo jest teraz elementem drawera filtrów. */
  .masterbar-mobile-filter-ordering {
    display: block !important;
    float: none !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 0 14px !important;
    padding: 0 !important;
  }
  .masterbar-mobile-filter-ordering::before {
    content: 'Sortowanie';
    display: block;
    margin: 0 0 7px;
    color: var(--masterbar-text);
    font-size: 15px;
    font-weight: 800;
    line-height: 1.25;
  }
  .masterbar-mobile-filter-ordering select {
    width: 100% !important;
    max-width: 100% !important;
    min-height: 44px !important;
    margin: 0 !important;
    border-radius: 9px !important;
  }
}


/* 0.5.97 – jedna paleta zakupowa. */
.woocommerce ul.products li.product .button,
.masterbar-products-grid .button,
.masterbar-shop .button,
.masterbar-product-card .button,
.mb-product-button{
  background:var(--mb-color-primary,#0D2F55)!important;
  border-color:var(--mb-color-primary,#0D2F55)!important;
  color:var(--mb-color-contrast,#FFFFFF)!important;
}
.woocommerce ul.products li.product .button:hover,
.masterbar-products-grid .button:hover,
.masterbar-shop .button:hover,
.masterbar-product-card .button:hover,
.mb-product-button:hover{
  background:var(--mb-color-primary-hover,#1F4E8C)!important;
  border-color:var(--mb-color-primary-hover,#1F4E8C)!important;
}

/* MASTERBAR UI 0.5.103 – mobilny tryb hybrydowy filtrów. Desktop bez zmian. */
@media (max-width: 900px) {
  .masterbar-mobile-hybrid-strip {
    display:flex;
    gap:8px;
    width:100%;
    overflow-x:auto;
    overflow-y:hidden;
    padding:2px 3px 7px;
    -webkit-overflow-scrolling:touch;
    scroll-snap-type:x proximity;
    scrollbar-width:none;
  }
  .masterbar-mobile-hybrid-strip::-webkit-scrollbar { display:none; }
  .masterbar-mobile-hybrid-chip {
    flex:0 0 auto;
    min-height:44px;
    padding:0 16px;
    border:1px solid #d5dee9;
    border-radius:12px;
    background:#fff;
    color:#12213a;
    font:inherit;
    font-weight:700;
    white-space:nowrap;
    scroll-snap-align:start;
    box-shadow:0 1px 2px rgba(18,33,58,.04);
  }
  .masterbar-mobile-hybrid-chip.is-primary {
    border-color:#153e6d;
    background:#eef5fb;
    color:#153e6d;
  }
  .masterbar-mobile-hybrid-chip.is-categories::before { content:'☰ '; font-size:13px; }
  .masterbar-mobile-hybrid-strip::after {
    content:'';
    flex:0 0 12px;
  }
}


/* MASTERBAR UI 0.5.103 – HYBRID LOOP / CLICK SAFETY */
@media (max-width: 900px) {
  .masterbar-mobile-catalog-controls > .masterbar-filter-toolbar.masterbar-hybrid-toolbar-hidden {
    display: none !important;
  }
  .masterbar-mobile-catalog-controls > .masterbar-mobile-hybrid-strip {
    grid-column: 1 / -1 !important;
    min-width: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
    touch-action: pan-x !important;
    overscroll-behavior-x: contain;
  }
}


/* ==========================================================
   MASTERBAR UI 0.5.104 – HYBRID MOBILE UX POLISH
   - brak niebieskiego tap-highlight podczas poziomego scrollowania
   - sticky akcje filtrów przy dolnej krawędzi drawera
   - zamknięcie filtrów po lewej stronie nagłówka na mobile
   Desktop bez zmian.
   ========================================================== */
@media (max-width: 900px) {
  .masterbar-mobile-hybrid-strip,
  .masterbar-mobile-hybrid-chip {
    -webkit-tap-highlight-color: transparent !important;
  }
  .masterbar-mobile-hybrid-chip {
    -webkit-touch-callout: none;
    user-select: none;
  }
  .masterbar-mobile-hybrid-chip:not(.is-primary):active,
  .masterbar-mobile-hybrid-chip:not(.is-primary):focus:not(:focus-visible) {
    background: #fff !important;
    border-color: #d5dee9 !important;
    color: #12213a !important;
    outline: 0 !important;
  }
  .masterbar-mobile-hybrid-chip.is-primary:active,
  .masterbar-mobile-hybrid-chip.is-primary:focus:not(:focus-visible) {
    background: #eef5fb !important;
    border-color: #153e6d !important;
    color: #153e6d !important;
    outline: 0 !important;
  }

  .masterbar-product-filters__head {
    justify-content: flex-start !important;
    gap: 12px;
  }
  .masterbar-product-filters__head .masterbar-filter-close {
    order: -1;
    flex: 0 0 40px;
  }

  .masterbar-product-filters .masterbar-central-filter-form .masterbar-filter-actions {
    position: sticky;
    bottom: calc(-18px + env(safe-area-inset-bottom));
    z-index: 20;
    margin: 18px -18px -18px !important;
    padding: 12px 18px max(12px, env(safe-area-inset-bottom)) !important;
    background: rgba(255,255,255,.98);
    border-top: 1px solid #dbe3ec;
    box-shadow: 0 -8px 18px rgba(18,33,58,.07);
  }
  .masterbar-product-filters .masterbar-central-filter-form .masterbar-filter-submit {
    width: 100%;
    min-height: 48px;
  }
  .masterbar-product-filters .masterbar-central-filter-form .masterbar-filter-reset {
    display: block;
    width: 100%;
    margin-top: 8px;
    text-align: center;
  }
}


/* ==========================================================
   MASTERBAR UI 0.5.105 – HYBRID CHIPS STATE / CLEAN STRIP
   - karuzela zaczyna się od Dostępność (bez kafelka Filtry/Kategorie)
   - niebieski wyłącznie dla filtra z faktycznie wybraną wartością
   - focus/touch/scroll nie zmienia koloru kafelka
   - subtelny cień prawej krawędzi sugeruje dalsze przewijanie
   ========================================================== */
@media (max-width: 900px) {
  .masterbar-mobile-hybrid-chip,
  .masterbar-mobile-hybrid-chip:hover,
  .masterbar-mobile-hybrid-chip:active,
  .masterbar-mobile-hybrid-chip:focus,
  .masterbar-mobile-hybrid-chip:focus-visible {
    background:#fff !important;
    border-color:#d5dee9 !important;
    color:#12213a !important;
    outline:0 !important;
    box-shadow:0 1px 2px rgba(18,33,58,.04) !important;
    -webkit-tap-highlight-color:transparent !important;
  }
  .masterbar-mobile-hybrid-chip.is-selected,
  .masterbar-mobile-hybrid-chip.is-selected:hover,
  .masterbar-mobile-hybrid-chip.is-selected:active,
  .masterbar-mobile-hybrid-chip.is-selected:focus,
  .masterbar-mobile-hybrid-chip.is-selected:focus-visible {
    background:#2866bf !important;
    border-color:#2866bf !important;
    color:#fff !important;
  }
  .masterbar-mobile-catalog-controls { position:relative; }
  .masterbar-mobile-catalog-controls::after {
    content:'';
    position:absolute;
    right:0;
    bottom:0;
    width:24px;
    height:58px;
    pointer-events:none;
    background:linear-gradient(to right, rgba(255,255,255,0), rgba(255,255,255,.96));
    z-index:2;
  }
}

/* ==========================================================
   MASTERBAR UI 0.5.106 — Catalog Sidebar ownership cleanup
   On desktop, when MASTERBAR Catalog Sidebar is active, UI must not
   impose its legacy viewport height/scroll model on the old filter shell.
   The dedicated sidebar plugin is the sole owner of sidebar scrolling.
   Mobile rules are intentionally untouched.
   ========================================================== */
@media (min-width: 1025px) {
  body.masterbar-catalog-sidebar-enabled .masterbar-product-filters {
    max-height: none !important;
    height: auto !important;
    overflow: visible !important;
  }

  body.masterbar-catalog-sidebar-enabled .masterbar-product-filters .masterbar-sidebar-pane,
  body.masterbar-catalog-sidebar-enabled .masterbar-product-filters .masterbar-central-filter-form {
    max-height: none !important;
    height: auto !important;
    overflow: visible !important;
  }
}

/* 0.5.110 – czytelna typografia opisów kategorii i marek pod listingiem produktów. */
.masterbar-shop-archive .term-description,
.post-type-archive-product .term-description,
.tax-product_cat .term-description,
.tax-product_brand .term-description {
    max-width: 920px;
    margin-top: 32px;
    color: var(--masterbar-text);
    font-size: 15px;
    line-height: 1.72;
}

.masterbar-shop-archive .term-description > :first-child,
.post-type-archive-product .term-description > :first-child,
.tax-product_cat .term-description > :first-child,
.tax-product_brand .term-description > :first-child {
    margin-top: 0;
}

.masterbar-shop-archive .term-description h2,
.post-type-archive-product .term-description h2,
.tax-product_cat .term-description h2,
.tax-product_brand .term-description h2 {
    margin: 34px 0 14px;
    color: var(--masterbar-text);
    font-size: clamp(21px, 1.8vw, 26px);
    font-weight: 700;
    line-height: 1.28;
}

.masterbar-shop-archive .term-description h3,
.post-type-archive-product .term-description h3,
.tax-product_cat .term-description h3,
.tax-product_brand .term-description h3 {
    margin: 26px 0 10px;
    color: var(--masterbar-text);
    font-size: clamp(18px, 1.45vw, 21px);
    font-weight: 700;
    line-height: 1.3;
}

.masterbar-shop-archive .term-description p,
.post-type-archive-product .term-description p,
.tax-product_cat .term-description p,
.tax-product_brand .term-description p {
    margin: 0 0 16px;
}

.masterbar-shop-archive .term-description ul,
.masterbar-shop-archive .term-description ol,
.post-type-archive-product .term-description ul,
.post-type-archive-product .term-description ol,
.tax-product_cat .term-description ul,
.tax-product_cat .term-description ol,
.tax-product_brand .term-description ul,
.tax-product_brand .term-description ol {
    margin: 10px 0 22px;
    padding-left: 24px;
}

.masterbar-shop-archive .term-description ul,
.post-type-archive-product .term-description ul,
.tax-product_cat .term-description ul,
.tax-product_brand .term-description ul {
    list-style: disc outside;
}

.masterbar-shop-archive .term-description ol,
.post-type-archive-product .term-description ol,
.tax-product_cat .term-description ol,
.tax-product_brand .term-description ol {
    list-style: decimal outside;
}

.masterbar-shop-archive .term-description li,
.post-type-archive-product .term-description li,
.tax-product_cat .term-description li,
.tax-product_brand .term-description li {
    margin: 6px 0;
    padding-left: 3px;
}

.masterbar-shop-archive .term-description strong,
.post-type-archive-product .term-description strong,
.tax-product_cat .term-description strong,
.tax-product_brand .term-description strong {
    color: var(--masterbar-text);
    font-weight: 700;
}

@media (max-width: 767px) {
    .masterbar-shop-archive .term-description,
    .post-type-archive-product .term-description,
    .tax-product_cat .term-description,
    .tax-product_brand .term-description {
        margin-top: 24px;
        font-size: 14px;
        line-height: 1.68;
    }

    .masterbar-shop-archive .term-description h2,
    .post-type-archive-product .term-description h2,
    .tax-product_cat .term-description h2,
    .tax-product_brand .term-description h2 {
        margin: 28px 0 12px;
        font-size: 21px;
    }

    .masterbar-shop-archive .term-description ul,
    .masterbar-shop-archive .term-description ol,
    .post-type-archive-product .term-description ul,
    .post-type-archive-product .term-description ol,
    .tax-product_cat .term-description ul,
    .tax-product_cat .term-description ol,
    .tax-product_brand .term-description ul,
    .tax-product_brand .term-description ol {
        padding-left: 21px;
    }
}


/* ==========================================================
   MASTERBAR UI 0.5.116 – MOBILE: JAWNY PRZYCISK FILTRY
   Kategorie + Filtry w pierwszym rzędzie. Szybkie filtry pozostają poniżej.
   Drawer otwiera się wyłącznie po kliknięciu użytkownika.
   ========================================================== */
@media (max-width: 900px) {
  .masterbar-mobile-filter-open {
    display:flex !important;
    align-items:center !important;
    justify-content:center !important;
    gap:7px !important;
    width:100% !important;
    height:44px !important;
    min-height:44px !important;
    margin:0 !important;
    padding:0 10px !important;
    border:1px solid #d8dee6 !important;
    border-radius:10px !important;
    background:#fff !important;
    color:#123f66 !important;
    font:inherit !important;
    font-size:13px !important;
    line-height:1.2 !important;
    font-weight:800 !important;
    white-space:nowrap !important;
    cursor:pointer;
    -webkit-tap-highlight-color:transparent;
  }
  .masterbar-mobile-filter-open::before {
    content:'☷';
    font-size:16px;
    line-height:1;
    transform:rotate(90deg);
  }
  .masterbar-mobile-filter-open:active,
  .masterbar-mobile-filter-open:focus-visible {
    background:#f5f8fb !important;
    border-color:#b9c8d8 !important;
    outline:0 !important;
  }
  .masterbar-mobile-catalog-controls > .masterbar-mobile-category-open,
  .masterbar-mobile-catalog-controls > .masterbar-mobile-filter-open {
    grid-column:auto !important;
  }
}


/* ==========================================================
   MASTERBAR UI 0.5.117 – MOBILE: CHEVRONY SZYBKICH FILTRÓW
   Delikatna strzałka pokazuje, że szybki filtr otwiera panel/sekcję.
   ========================================================== */
@media (max-width: 900px) {
  .masterbar-mobile-hybrid-chip {
    display:inline-flex !important;
    align-items:center !important;
    gap:8px !important;
  }
  .masterbar-mobile-hybrid-chip::after {
    content:'⌄';
    display:inline-block;
    margin-left:1px;
    font-size:14px;
    line-height:1;
    font-weight:700;
    opacity:.65;
    transform:translateY(-1px);
  }
}
