.cpf-grid-inner {
            display: grid;
            grid-template-columns: repeat(5, minmax(0, 1fr));
            gap: 20px;
            align-items: start;
            width: 100%;
            max-width: 100%;
            min-width: 0;
            box-sizing: border-box;
        }

        .cpf-grid-inner > * {
            width: 100%;
            max-width: 100%;
            min-width: 0;
            box-sizing: border-box;
        }

        @media (max-width: 1366px) {
            .cpf-grid-inner {
                grid-template-columns: repeat(4, minmax(0, 1fr));
            }
        }

        @media (max-width: 1024px) {
            .cpf-grid-inner {
                grid-template-columns: repeat(3, minmax(0, 1fr));
            }
        }

        @media (max-width: 767px) {
            .cpf-products-grid {
                width: 100% !important;
                max-width: 100% !important;
                min-width: 0 !important;
                margin: 0 !important;
                padding: 0 !important;
                box-sizing: border-box !important;
                align-items: center !important;
                align-content: center !important;
                align-self: center !important;
                justify-content: center !important;
            }

            .cpf-grid-inner {
                width: 95% !important;
                max-width: 95% !important;
                min-width: 0 !important;
                margin-left: auto !important;
                margin-right: auto !important;
                padding-left: 0 !important;
                padding-right: 0 !important;
                box-sizing: border-box !important;
                grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
                gap: 14px !important;
            }

            .cpf-grid-inner > * {
                width: 100% !important;
                max-width: 100% !important;
                min-width: 0 !important;
                box-sizing: border-box !important;
            }
        }

        @media (max-width: 380px) {
            .cpf-grid-inner {
                gap: 10px !important;
            }
        }

        .cpf-grid-inner.list {
            grid-template-columns: 1fr !important;
            display: grid;
        }

        .cpf-grid-inner.list > * {
            width: 100%;
            max-width: 100%;
        }

        .cpf-pagination-wrap {
            margin-top: 1.5rem;
            text-align: center;
        }

        .cpf-pagination {
            display: inline-flex;
            list-style: none;
            padding: 0;
            margin: 0;
            gap: .5rem;
        }

        .cpf-pagination a {
            display: inline-block;
            padding: .35rem .6rem;
            border: 1px solid #ddd;
            border-radius: 4px;
            text-decoration: none;
        }

        .cpf-pagination a.current,
        .cpf-pagination a:hover {
            background: black;
            color: white;
        }

        .cpf-products-grid {
            position: relative;
        }

        /* Keep product cards visible while AJAX loads. */
        .cpf-products-grid.cpf-loading .cpf-grid-inner {
            opacity: 1 !important;
            pointer-events: auto !important;
        }

        /* Safety override in case an older overlay rule is cached elsewhere. */
        .cpf-products-grid.cpf-loading::before,
        .cpf-products-grid.cpf-loading::after,
        .cpf-products-grid.cpf-loading-active::before,
        .cpf-products-grid.cpf-loading-active::after,
        .cpf-loading-overlay {
            display: none !important;
            content: none !important;
        }

        .cpf-loading-inline {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            width: auto;
            margin-top: 12px;
            padding: 8px 13px;
            border-radius: 6px;
            background: #111;
            box-shadow: 0 4px 14px rgba(0, 0, 0, 0.14);
            font-size: 13px;
            font-weight: 600;
            color: #fff;
            text-align: center;
            pointer-events: none;
        }

        .cpf-loader-spinner {
            width: 15px;
            height: 15px;
            border-radius: 999px;
            border: 2px solid rgba(255,255,255,0.35);
            border-top-color: #fff;
            display: inline-block;
            animation: cpf-spin 0.8s linear infinite;
            flex: 0 0 auto;
        }

        @keyframes cpf-spin {
            to {
                transform: rotate(360deg);
            }
        }

        .cpf-pagination a.cpf-disabled,
        .cpf-products-grid.cpf-pagination-lock .cpf-pagination a {
            pointer-events: none;
            opacity: 0.5;
            cursor: wait;
        }

        .cpf-pagination a.cpf-clicked-loading {
            background: black;
            color: white;
            cursor: wait;
        }

        .cpf-grid-error {
            margin-bottom: 15px;
            padding: 12px 14px;
            border: 1px solid #f2b8b5;
            border-radius: 6px;
            background: #fff1f0;
            color: #8a1f11;
            font-size: 14px;
            font-weight: 600;
        }

        .cpf-products-grid.cpf-page-loaded .cpf-grid-inner {
            animation: cpf-loaded-flash 0.55s ease;
        }

        @keyframes cpf-loaded-flash {
            from {
                opacity: 0.55;
            }
            to {
                opacity: 1;
            }
        }
