.ksq-filter {
	background: #f6f8fb;
	border: 1px solid #dfe4ea;
	border-radius: 8px;
	margin: 0 0 24px;
	padding: 16px;
}

.ksq-filter__bar {
	align-items: stretch;
	display: grid;
	gap: 12px;
	grid-template-columns: auto minmax(220px, 1fr) minmax(180px, 240px);
}

.ksq-filter__sidebar-header {
	align-items: center;
	display: flex;
	justify-content: space-between;
	margin-bottom: 14px;
}

.ksq-filter__sidebar-header h2 {
	font-size: 18px;
	line-height: 1.2;
	margin: 0;
}

.ksq-filter__mobile-toggle {
	display: none;
}

.ksq-filter__drawer-button,
.ksq-filter__apply,
.ksq-filter__clear,
.ksq-filter-chip {
	border-radius: 8px;
	cursor: pointer;
	font-weight: 800;
}

.ksq-filter__drawer-button,
.ksq-filter__apply {
	background: #0757e3;
	border: 1px solid #0757e3;
	color: #fff;
}

.ksq-filter__drawer-button {
	min-height: 48px;
	padding: 0 18px;
}

.ksq-filter__clear,
.ksq-filter-chip {
	background: #fff;
	border: 1px solid #d7dde5;
	color: #0d368f;
}

.ksq-filter__search input,
.ksq-filter__sort select,
.ksq-filter__price input {
	background: #fff;
	border: 1px solid #d7dde5;
	border-radius: 8px;
	box-sizing: border-box;
	color: #1a1a1a;
	font: inherit;
	min-height: 48px;
	padding: 0 14px;
	width: 100%;
}

.ksq-filter__active {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 12px;
}

.ksq-filter__active.is-empty {
	display: none;
}

.ksq-filter-chip {
	min-height: 34px;
	padding: 0 12px;
}

.ksq-filter-chip::after {
	content: " x";
}

.ksq-filter__drawer {
	margin-top: 16px;
}

/* Search and shop archives open the full controls only when Filters is requested. */
.ksq-filter:not(.ksq-filter--sidebar) .ksq-filter__drawer {
	display: none;
}

.ksq-filter:not(.ksq-filter--sidebar) .ksq-filter__drawer.is-open {
	display: block;
}

.ksq-filter__native-ordering {
	display: none;
}

.ksq-filter--sidebar .ksq-filter__drawer {
	margin-top: 0;
}

.ksq-filter__drawer-header {
	align-items: center;
	display: flex;
	justify-content: space-between;
	margin-bottom: 14px;
}

.ksq-filter__drawer-header button {
	background: #fff;
	border: 1px solid #d7dde5;
	border-radius: 999px;
	color: #1a1a1a;
	cursor: pointer;
	height: 34px;
	width: 34px;
}

.ksq-filter__form {
	display: grid;
	gap: 16px;
	grid-template-columns: repeat(5, minmax(0, 1fr));
}

.ksq-filter--sidebar .ksq-filter__form {
	grid-template-columns: 1fr;
}

.ksq-filter__group {
	background: #fff;
	border: 1px solid #dfe4ea;
	border-radius: 8px;
	padding: 14px;
}

.ksq-filter__group h3 {
	font-size: 16px;
	line-height: 1.2;
	margin: 0 0 12px;
}

.ksq-filter__options {
	display: grid;
	gap: 10px;
}

.ksq-filter__options--scroll {
	max-height: 220px;
	overflow: auto;
	padding-right: 4px;
}

.ksq-filter__options label {
	align-items: center;
	display: grid;
	gap: 8px;
	grid-template-columns: auto 1fr auto;
	line-height: 1.25;
}

.ksq-filter__options input[type="checkbox"] {
	accent-color: #0757e3;
	height: 16px;
	width: 16px;
}

.ksq-filter__options label:has(input:disabled) {
	opacity: 0.5;
}

.ksq-filter__options small {
	color: #68717d;
	font-size: 12px;
}

.ksq-filter__price {
	display: grid;
	gap: 10px;
}

.ksq-filter__price span {
	display: block;
	font-size: 13px;
	font-weight: 800;
	margin-bottom: 4px;
}

.ksq-filter__actions {
	align-content: start;
	display: grid;
	gap: 10px;
}

.ksq-filter--sidebar .ksq-filter__actions {
	position: sticky;
	bottom: 0;
	padding-top: 4px;
	background: #f6f8fb;
}


.ksq-category-layout {
	display: grid;
	grid-template-columns: minmax(220px, 250px) minmax(0, 1fr);
	align-items: start;
	column-gap: 24px;
}

.ksq-category-layout__sidebar {
	position: sticky;
	top: 24px;
	margin-top: 64px;
}

.ksq-category-layout__sidebar .ksq-filter--sidebar {
	margin: 0;
}

.ksq-category-layout__toolbar {
	display: flex;
	align-items: start;
	justify-content: space-between;
	min-height: 44px;
	margin-bottom: 20px;
	gap: 18px;
}

.ksq-category-layout__toolbar .woocommerce-result-count,
.ksq-category-layout__toolbar .woocommerce-ordering {
	float: none;
	margin: 0;
}

.ksq-category-layout__toolbar .woocommerce-ordering {
	display: block;
}

.ksq-category-layout__results ul.products {
	grid-template-columns: repeat(3, minmax(0, 1fr));
	margin-top: 0;
}

.ksq-category-layout__results ul.products li.product {
	max-width: none;
	min-width: 0;
	width: 100% !important;
}

.ksq-filter__apply,
.ksq-filter__clear {
	min-height: 44px;
	padding: 0 14px;
}

.ksq-filter.is-loading {
	opacity: 0.74;
	pointer-events: none;
}

ul.products.is-loading {
	opacity: 0.48;
}

@media (max-width: 1100px) {
	.ksq-filter__form {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}

	.ksq-category-layout {
		grid-template-columns: minmax(200px, 220px) minmax(0, 1fr);
		column-gap: 18px;
	}
}

@media (max-width: 900px) {
	.ksq-category-layout {
		display: block;
	}

	.ksq-category-layout__sidebar {
		position: static;
		margin-top: 0;
	}

	.ksq-category-layout__sidebar .ksq-filter--sidebar {
		margin-bottom: 18px;
	}

	.ksq-category-layout__results ul.products {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 760px) {
	.ksq-filter--sidebar {
		margin-bottom: 18px;
	}

	.ksq-filter--sidebar .ksq-filter__sidebar-header {
		margin-bottom: 0;
	}

	.ksq-filter--sidebar .ksq-filter__mobile-toggle {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		min-height: 42px;
		padding: 0 14px;
		background: #0757e3;
		border: 1px solid #0757e3;
		border-radius: 8px;
		color: #fff;
		cursor: pointer;
		font: inherit;
		font-weight: 800;
	}

	.ksq-filter {
		border-radius: 0;
		margin-left: -16px;
		margin-right: -16px;
	}

	.ksq-filter__bar {
		grid-template-columns: auto 1fr;
	}

	.ksq-filter__sort {
		grid-column: 1 / -1;
	}

	.ksq-filter__drawer {
		background: #fff;
		box-shadow: 0 18px 45px rgba(0, 0, 0, 0.2);
		display: none;
		inset: 0;
		overflow: auto;
		padding: 18px;
		position: fixed;
		z-index: 99999;
	}

	.ksq-filter--sidebar .ksq-filter__drawer {
		margin-top: 0;
	}

	.ksq-filter__drawer.is-open {
		display: block;
	}

	.ksq-filter__form {
		grid-template-columns: 1fr;
	}
}
