.market-page-header,
.market-section-heading,
.market-single-product__topbar,
.market-single-product__purchase {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

.market-page-header {
	justify-content: flex-start;
	margin: 14px 0 18px;
}

.market-page-header h1,
.market-section-heading h2,
.market-single-product h1,
.market-single-product h2 {
	margin: 0;
	color: var(--store-text);
}

.market-page-header h1 { font-size: 22px; }
.market-page-header p { margin: 3px 0 0; color: var(--store-muted); font-size: 13px; }

.market-back-link {
	display: inline-flex;
	width: 38px;
	height: 38px;
	flex: 0 0 38px;
	align-items: center;
	justify-content: center;
	border: 1px solid var(--store-border);
	border-radius: 12px;
	background: var(--store-surface);
	font-size: 22px;
}

.market-section-heading { margin: 0 0 10px; }
.market-section-heading h2 { font-size: 17px; }
.market-section-heading > a { color: var(--store-primary); font-size: 13px; font-weight: 700; }
.market-section-more { display: inline-flex; align-items: center; gap: 3px; }
.market-section-more svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; }

.market-home-category-grid { margin: 18px 0 22px; }
.market-home-category-grid__items {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 18px 10px;
	padding: 15px 10px;
	border-radius: 18px;
	background: var(--store-surface);
}
.market-category-rail {
	display: flex;
	gap: 10px;
	overflow-x: auto;
	padding: 2px 0 8px;
	scrollbar-width: none;
}
.market-category-rail::-webkit-scrollbar { display: none; }
.market-category-mini {
	display: flex;
	width: auto;
	min-width: 0;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	font-size: 13px;
	font-weight: 700;
	text-align: center;
}
.market-category-mini__image {
	display: flex;
	width: 82px;
	height: 82px;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	border-radius: 22px;
	background: var(--store-page);
}
.market-category-mini img { width: 100%; height: 100%; object-fit: contain; }
.market-category-fallback {
	display: grid;
	width: 100%;
	height: 100%;
	place-items: center;
	background: linear-gradient(145deg,var(--store-primary-soft),var(--store-surface));
	color: var(--store-primary);
}
.market-category-fallback svg { width: 58px; height: 58px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.market-category-fallback--dairy,.market-category-fallback--beverage { color: #2878b8; background: linear-gradient(145deg,#e8f5ff,#fff); }
.market-category-fallback--produce { color: #23864a; background: linear-gradient(145deg,#e8f8ed,#fff); }
.market-category-fallback--snacks,.market-category-fallback--breakfast { color: #d16a10; background: linear-gradient(145deg,#fff2df,#fff); }
.market-category-fallback--protein { color: #b62c38; background: linear-gradient(145deg,#ffebed,#fff); }
.market-category-fallback--hygiene { color: #6b56b4; background: linear-gradient(145deg,#f0ecff,#fff); }
.market-category-fallback--home { color: #7a5a37; background: linear-gradient(145deg,#f7efe6,#fff); }

.market-home-product-section { margin: 22px 0 28px; }
.market-home-product-section .market-section-heading { margin-bottom: 12px; }
.market-product-rail {
	display: flex;
	gap: 11px;
	overflow-x: auto;
	padding: 2px 1px 10px;
	scroll-snap-type: x proximity;
	scrollbar-width: none;
}
.market-product-rail::-webkit-scrollbar { display: none; }
.market-product-rail .product-card {
	width: 158px;
	min-width: 158px;
	flex: 0 0 158px;
	scroll-snap-align: start;
	border: 1px solid var(--store-border);
	box-shadow: 0 4px 14px color-mix(in srgb,var(--store-text) 5%,transparent);
}

.market-subcategory-chips,
.market-subcategory-grid {
	display: flex;
	gap: 8px;
	overflow-x: auto;
	padding: 0 0 10px;
	scrollbar-width: none;
}
.market-subcategory-chips::-webkit-scrollbar,
.market-subcategory-grid::-webkit-scrollbar { display: none; }
.market-subcategory-chips a,
.market-subcategory-grid a {
	flex: 0 0 auto;
	padding: 7px 12px;
	border: 1px solid var(--store-border);
	border-radius: 14px;
	background: var(--store-surface);
	color: var(--store-text);
	font-size: 13px;
}
.market-subcategory-grid a.is-current {
	border-color: var(--store-primary);
	background: var(--store-primary-soft);
	color: var(--store-primary-dark);
	font-weight: 800;
}

.market-category-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 12px;
	padding-bottom: 24px;
}
.market-category-card {
	display: flex;
	min-width: 0;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	padding: 8px 6px 10px;
	border-radius: 16px;
	background: var(--store-surface);
	text-align: center;
}
.market-category-card__image {
	display: block;
	width: 100%;
	aspect-ratio: 1;
	overflow: hidden;
	border-radius: 12px;
	background: var(--store-page);
}
.market-category-card img { width: 100%; height: 100%; object-fit: contain; }
.market-category-card .market-category-fallback { width: 100%; height: 100%; }
.market-category-card strong { max-width: 100%; font-size: 13px; line-height: 1.6; }
.market-category-card small { color: var(--store-muted); font-size: 11px; }
.market-category-card--sale { background: var(--store-primary-soft); }
.market-category-card__sale-icon { display: grid; place-items: center; background: linear-gradient(145deg,var(--store-primary),var(--store-primary-dark)); color: var(--store-surface); }
.market-category-card__sale-icon svg { width: 48%; height: 48%; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.market-shop-heading {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin: 10px 0 12px;
}
.market-shop-heading h1 { margin: 0; font-size: 22px; }
.market-category-nav-group { margin-bottom: 10px; }
.market-category-nav-group.is-empty { display: none; }
.market-category-nav-label { display: block; margin: 0 2px 7px; color: var(--store-muted); font-size: 11px; font-weight: 700; }
.market-root-tabs,
.market-shop-subcategories {
	display: flex;
	gap: 8px;
	overflow-x: auto;
	padding: 2px 0 10px;
	scrollbar-width: none;
}
.market-root-tabs::-webkit-scrollbar,
.market-shop-subcategories::-webkit-scrollbar { display: none; }
.market-root-tabs button,
.market-shop-subcategories button {
	min-height: 38px;
	flex: 0 0 auto;
	padding: 7px 13px;
	border: 1px solid var(--store-border);
	border-radius: 999px;
	background: var(--store-surface);
	color: var(--store-text);
	font: inherit;
	font-size: 12px;
	cursor: pointer;
}
.market-category-nav-group--root {
	padding: 10px 10px 1px;
	border: 1px solid var(--store-border);
	border-radius: 15px;
	background: var(--store-surface);
}
.market-root-tabs button {
	border: 0;
	border-radius: 9px;
	background: transparent;
	font-weight: 700;
}
.market-root-tabs button.is-current {
	border-color: var(--store-primary);
	background: var(--store-primary);
	color: var(--store-surface);
	font-weight: 800;
}
.market-category-nav-group--child { padding: 7px 2px 0; }
.market-shop-subcategories button { min-height: 34px; padding: 5px 12px; background: var(--store-page); }
.market-shop-subcategories button.is-current {
	border-color: color-mix(in srgb,var(--store-primary) 28%,var(--store-border));
	background: var(--store-primary-soft);
	color: var(--store-primary-dark);
	font-weight: 800;
}
.market-shop-subcategories { min-height: 48px; padding-top: 0; }
.market-shop-subcategories.is-empty { min-height: 0; padding: 0; }
.market-shop-toolbar {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 12px;
	margin: 8px 0 13px;
	padding-top: 10px;
	border-top: 1px solid var(--store-border);
}
.market-shop-toolbar > div { display: grid; gap: 2px; }
.market-shop-toolbar h2 { margin: 0; font-size: 17px; }
.market-shop-toolbar [data-market-count] { color: var(--store-muted); font-size: 11px; }
.market-shop-toolbar label { display: grid; gap: 4px; color: var(--store-muted); font-size: 10px; }
.market-shop-toolbar select {
	max-width: 150px;
	min-height: 38px;
	padding: 5px 9px;
	border: 1px solid var(--store-border);
	border-radius: 10px;
	background: var(--store-surface);
	color: var(--store-text);
	font: inherit;
	font-size: 12px;
}
.market-shop-status { min-height: 0; color: var(--store-muted); font-size: 12px; text-align: center; }
.market-shop-browser.is-loading .market-shop-products { opacity: .52; pointer-events: none; }
.market-shop-products { transition: opacity .18s ease; }
.market-load-more {
	display: block;
	width: 100%;
	min-height: 48px;
	margin: 16px 0 28px;
	border: 1px solid var(--store-primary);
	border-radius: 13px;
	background: var(--store-surface);
	color: var(--store-primary-dark);
	font: inherit;
	font-weight: 800;
}
.market-load-more[hidden] { display: none; }

.market-category-hero img {
	width: 64px;
	height: 64px;
	object-fit: contain;
	border-radius: 14px;
	background: var(--store-surface);
}
.market-category-products { margin-top: 14px; }
.market-empty-state {
	margin: 24px 0;
	padding: 24px 14px;
	border-radius: 16px;
	background: var(--store-surface);
	color: var(--store-muted);
	text-align: center;
}

.market-product-card__brand {
	margin: 1px 0;
	overflow: hidden;
	color: var(--store-muted);
	font-size: 11px;
	line-height: 1.5;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.market-pagination { margin: 22px 0; }
.market-pagination .nav-links { display: flex; align-items: center; justify-content: center; gap: 7px; }
.market-pagination .page-numbers {
	display: inline-flex;
	min-width: 34px;
	height: 34px;
	align-items: center;
	justify-content: center;
	padding: 0 9px;
	border-radius: 10px;
	background: var(--store-surface);
}
.market-pagination .current { background: var(--store-primary); color: var(--store-surface); }

.market-single-product.product-card {
	display: block;
	height: auto;
	overflow: visible;
	padding-top: 10px;
	background: var(--store-page);
}
.market-single-product__topbar { min-height: 42px; margin-bottom: 10px; }
.market-single-product__topbar > a:last-child { color: var(--store-muted); font-size: 13px; }
.market-single-product__gallery,
.market-single-product__summary,
.market-single-product__details {
	position: relative;
	margin-bottom: 12px;
	padding: 14px;
	border-radius: 18px;
	background: var(--store-surface);
}
.market-single-product__main-image { display: flex; align-items: center; justify-content: center; }
.market-single-product__main-image img { width: 100%; max-height: 360px; object-fit: contain; }
.market-single-product__thumbs { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; }
.market-single-product__thumbs img { width: 58px; height: 58px; object-fit: contain; border: 1px solid var(--store-border); border-radius: 10px; }
.market-single-product__brand { margin: 0 0 3px; color: var(--store-primary); font-size: 13px; font-weight: 800; }
.market-single-product h1 { font-size: 21px; line-height: 1.75; }
.market-single-product__meta { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 6px; }
.market-single-product__meta span { padding: 3px 8px; border-radius: 8px; background: var(--store-page); color: var(--store-muted); font-size: 12px; }
.market-single-product__stock { margin-top: 10px; font-size: 13px; font-weight: 700; }
.market-single-product__stock.is-in-stock { color: var(--store-success); }
.market-single-product__stock.is-out-of-stock { color: var(--store-danger); }
.market-single-product__short-description { margin-top: 10px; color: var(--store-muted); font-size: 14px; line-height: 1.9; }
.market-single-product__short-description p { margin: 0; }
.market-single-product__purchase { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--store-border); }
.market-single-product__price { color: var(--store-primary); font-size: 18px; font-weight: 900; }
.market-single-product__price del { display: block; color: var(--store-muted); font-size: 12px; font-weight: 500; }
.market-single-product__price ins { text-decoration: none; }
.market-single-product__details h2,
.market-related-products h2 { margin-bottom: 10px; font-size: 17px; }
.market-single-product__description { color: var(--store-text); font-size: 14px; line-height: 2; }
.market-single-product__details dl { margin: 12px 0 0; }
.market-single-product__details dl > div { display: grid; grid-template-columns: 100px 1fr; gap: 10px; padding: 9px 0; border-top: 1px solid var(--store-border); font-size: 13px; }
.market-single-product__details dt { color: var(--store-muted); }
.market-single-product__details dd { margin: 0; }
.market-related-products { margin: 18px 0; }

@media (max-width: 360px) {
	.market-category-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.market-home-category-grid__items { grid-template-columns: repeat(3, minmax(0, 1fr)); }
	.market-category-mini__image { width: 72px; height: 72px; }
	.market-product-rail .product-card { width: 148px; min-width: 148px; flex-basis: 148px; }
}
