.kpg-wrap {
	--kpg-columns: 4;
	--kpg-gap: 24px;
	--kpg-radius: 16px;
	--kpg-card-bg: #f2ece3;
	--kpg-info-bg: #ede6da;
	--kpg-media-bg: #5c7060;
	--kpg-accent-1: #5c7060;
	--kpg-accent-2: #1c3d3a;
	--kpg-accent-3: #b8cbe0;
	--kpg-accent-4: #d8b48a;
	--kpg-badge-new-bg: #b5502c;
	--kpg-badge-new-text: #ffffff;
	--kpg-badge-stock-bg: #ffffff;
	--kpg-badge-stock-text: #1a1a2e;
	--kpg-btn-bg: #1a1a2e;
	--kpg-btn-bg-hover: #23233f;
	--kpg-btn-text: #ffffff;
	--kpg-toolbar-bg: #ede6da;
	--kpg-toolbar-text: #1a1a2e;
	--kpg-toolbar-muted: #8a8580;
	box-sizing: border-box;
}
.kpg-wrap *,
.kpg-wrap *::before,
.kpg-wrap *::after {
	box-sizing: border-box;
}
.kpg-wrap input,
.kpg-wrap button {
	font-family: inherit;
	line-height: normal;
}
.kpg-wrap button {
	background-image: none;
}

.kpg-empty {
	padding: 24px;
	text-align: center;
	opacity: 0.7;
}

/* -------------------------------------------------
 * Toolbar (search + sort)
 * ------------------------------------------------- */
.kpg-toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	margin-bottom: 20px;
	flex-wrap: nowrap;
}
@media (max-width: 480px) {
	.kpg-toolbar {
		flex-wrap: wrap;
	}
}

.kpg-search-wrap {
	position: relative;
	flex: 0 1 380px;
	min-width: 160px;
}
.kpg-search-icon {
	position: absolute;
	top: 50%;
	left: 16px;
	width: 16px;
	height: 16px;
	transform: translateY(-50%);
	color: var(--kpg-toolbar-muted);
	display: flex;
	pointer-events: none;
}
.kpg-search-input {
	display: block;
	width: 100%;
	border: 1px solid transparent !important;
	outline: none !important;
	box-shadow: none !important;
	-webkit-appearance: none;
	appearance: none;
	background: var(--kpg-toolbar-bg);
	color: var(--kpg-toolbar-text);
	border-radius: 999px !important;
	padding: 12px 16px 12px 48px !important;
	font-size: 14px;
	text-indent: 0 !important;
	line-height: 1.2;
	box-sizing: border-box;
	margin: 0;
}
.kpg-search-input:focus {
	box-shadow: 0 0 0 2px rgba(26, 26, 46, 0.15) !important;
}
.kpg-search-input::placeholder {
	color: var(--kpg-toolbar-muted);
	opacity: 1;
}

.kpg-sort-wrap {
	position: relative;
	flex: 0 0 auto;
	margin-left: auto;
	white-space: nowrap;
}
.kpg-sort-toggle {
	display: flex;
	align-items: center;
	gap: 8px;
	background: transparent !important;
	border: none !important;
	outline: none !important;
	box-shadow: none !important;
	-webkit-appearance: none;
	appearance: none;
	cursor: pointer;
	color: var(--kpg-toolbar-text) !important;
	font-size: 14px;
	padding: 8px 2px;
	margin: 0;
	text-decoration: none !important;
}
.kpg-sort-toggle span,
.kpg-sort-toggle strong {
	color: inherit;
}
.kpg-sort-toggle strong {
	font-weight: 700;
}
.kpg-sort-chevron {
	color: var(--kpg-toolbar-text);
	transition: transform 0.15s ease;
	flex-shrink: 0;
}
.kpg-sort-toggle[aria-expanded="true"] .kpg-sort-chevron {
	transform: rotate(180deg);
}
.kpg-sort-menu {
	position: absolute;
	top: calc(100% + 8px);
	right: 0;
	background: #fff;
	border: none;
	box-shadow: 0 12px 32px rgba(20, 20, 30, 0.16);
	list-style: none;
	margin: 0;
	padding: 6px;
	min-width: 210px;
	border-radius: 12px;
	z-index: 20;
}
.kpg-sort-menu li {
	padding: 10px 14px;
	border-radius: 8px;
	font-size: 14px;
	color: #444;
	cursor: pointer;
	white-space: nowrap;
}
.kpg-sort-menu li:hover {
	background: #f5f2ec;
}
.kpg-sort-menu li.is-active {
	background: #efeae1;
	color: #1a1a2e;
	font-weight: 700;
}

.kpg-card[hidden] {
	display: none !important;
}

.kpg-grid {
	display: grid;
	grid-template-columns: repeat(var(--kpg-columns), 1fr);
	gap: var(--kpg-gap);
}

.kpg-card {
	position: relative;
	background: var(--kpg-card-bg);
	border-radius: var(--kpg-radius);
	overflow: hidden;
	display: flex;
	flex-direction: column;
}

.kpg-media {
	position: relative;
	aspect-ratio: 1 / 1;
	background: var(--kpg-media-bg);
	display: flex;
	align-items: stretch;
	justify-content: stretch;
	padding: 0 !important;
	overflow: hidden;
}

.kpg-media-link {
	display: block;
	width: 100%;
	height: 100%;
	margin: 0 !important;
	padding: 0 !important;
	line-height: 0;
}

.kpg-image {
	display: block;
	width: 100% !important;
	height: 100% !important;
	max-width: none !important;
	max-height: none !important;
	margin: 0 !important;
	padding: 0 !important;
	object-fit: cover;
}

.kpg-badge {
	position: absolute;
	top: 16px;
	left: 16px;
	padding: 5px 12px;
	border-radius: 999px;
	font-size: 12px;
	font-weight: 600;
	z-index: 2;
}
.kpg-badge--new {
	background: var(--kpg-badge-new-bg);
	color: var(--kpg-badge-new-text);
}
.kpg-badge--light {
	background: var(--kpg-badge-stock-bg);
	color: var(--kpg-badge-stock-text);
}

.kpg-add {
	position: absolute;
	bottom: 16px;
	right: 16px;
	height: 42px;
	width: 42px;
	min-width: 42px;
	border-radius: 999px;
	background: var(--kpg-btn-bg);
	color: var(--kpg-btn-text);
	border: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: flex-start;
	overflow: hidden;
	white-space: nowrap;
	padding: 0;
	z-index: 2;
	transition: width 0.28s cubic-bezier(0.4, 0, 0.2, 1), background 0.15s ease;
}
.kpg-add:hover,
.kpg-add:focus-visible {
	width: 150px;
	max-width: calc(100% - 32px);
	background: var(--kpg-btn-bg-hover);
}
.kpg-add-icon {
	flex: 0 0 42px;
	width: 42px;
	height: 42px;
	display: flex;
	align-items: center;
	justify-content: center;
}
.kpg-add-icon svg {
	display: block;
	width: 14px;
	height: 14px;
}
.kpg-add-label {
	font-size: 14px;
	font-weight: 600;
	opacity: 0;
	max-width: 0;
	transform: translateX(-6px);
	transition: opacity 0.2s ease 0.05s, transform 0.2s ease 0.05s, max-width 0.28s ease;
	padding-right: 0;
}
.kpg-add:hover .kpg-add-label,
.kpg-add:focus-visible .kpg-add-label {
	opacity: 1;
	max-width: 220px;
	transform: translateX(0);
	padding-right: 18px;
}
.kpg-add.kpg-loading {
	opacity: 0.7;
	pointer-events: none;
}

.kpg-info {
	background: var(--kpg-info-bg);
	padding: 16px 18px 20px;
	flex: 1;
}

.kpg-top-row {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 8px;
}

.kpg-name {
	font-size: 17px;
	font-weight: 700;
	margin: 0;
}
.kpg-name a {
	color: inherit;
	text-decoration: none;
}
.kpg-name a:hover {
	text-decoration: underline;
}

.kpg-price {
	font-size: 17px;
	font-weight: 700;
	white-space: nowrap;
	text-align: right;
}
.kpg-price ins {
	text-decoration: none;
}
.kpg-price del {
	opacity: 0.5;
	font-weight: 500;
	font-size: 0.85em;
	margin-right: 4px;
}
.kpg-price-from {
	display: block;
	font-size: 11px;
	font-weight: 500;
	opacity: 0.55;
	text-transform: uppercase;
	letter-spacing: 0.03em;
}

.kpg-tags {
	margin: 6px 0 0;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.03em;
	text-transform: uppercase;
}
.kpg-tags a {
	color: inherit;
	text-decoration: none;
}
.kpg-tags a:hover {
	text-decoration: underline;
}

/* Responsive fallback if a control isn't set for a breakpoint */
@media (max-width: 767px) {
	.kpg-wrap { --kpg-columns: 1; }
}

/* -------------------------------------------------
 * Variation picker modal
 * ------------------------------------------------- */
body.kpg-modal-open {
	overflow: hidden;
}
.kpg-modal-overlay {
	position: fixed;
	inset: 0;
	background: rgba(20, 20, 30, 0.55);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 100000;
	padding: 20px;
}
.kpg-modal {
	background: #fff;
	border-radius: 14px;
	width: 100%;
	max-width: 420px;
	max-height: 80vh;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}
.kpg-modal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 18px 20px;
	border-bottom: 1px solid #eee;
}
.kpg-modal-header h4 {
	margin: 0;
	font-size: 16px;
	font-weight: 700;
	color: #1a1a2e;
}
.kpg-modal-close {
	background: none;
	border: none;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	color: #666;
	padding: 4px;
}
.kpg-modal-list {
	overflow-y: auto;
	padding: 8px 10px;
}
.kpg-modal-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 12px 10px;
	border-bottom: 1px solid #f2f2f2;
}
.kpg-modal-row:last-child {
	border-bottom: none;
}
.kpg-modal-row-label {
	font-weight: 600;
	color: #1a1a2e;
	flex: 1;
}
.kpg-modal-row-price {
	color: #444;
	font-size: 14px;
	white-space: nowrap;
}
.kpg-modal-row-add {
	background: #1a1a2e;
	color: #fff;
	border: none;
	border-radius: 999px;
	padding: 8px 16px;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	white-space: nowrap;
	transition: background 0.15s ease;
}
.kpg-modal-row-add:hover {
	background: #33334f;
}
.kpg-modal-row-add:disabled {
	background: #ccc;
	cursor: not-allowed;
}
.kpg-modal-empty {
	padding: 20px;
	text-align: center;
	color: #777;
}
